Skip to content

feat: add JSON output support to CLI commands#52

Open
Jiya3177 wants to merge 1 commit into
Hell1213:mainfrom
Jiya3177:feat/json-output-cli-33
Open

feat: add JSON output support to CLI commands#52
Jiya3177 wants to merge 1 commit into
Hell1213:mainfrom
Jiya3177:feat/json-output-cli-33

Conversation

@Jiya3177
Copy link
Copy Markdown

Summary

Add JSON output support to selected Typer CLI commands.

Related Issue

Fixes #33

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Test changes
  • CI/Chore

Testing

  • uv run ruff check passes
  • uv run mypy passes
  • uv run pytest passes
  • Manual testing done

Manual testing:

  • PYTHONPATH=src python3 -m pytest tests/cli/test_new_cli.py
  • python3 -m ruff check src/oss_dev/cli/app.py tests/cli/test_new_cli.py

Note: Full test suite was run and has unrelated existing/environment failures around Gemini API key, GitHub PR fallback behavior, and macOS temp path resolution.

Description

Added a --json flag to:

  • oss-dev discover repos
  • oss-dev discover issues
  • oss-dev issues list
  • oss-dev analyze

When --json is passed, the commands now print valid structured JSON and skip the default formatted text output. Existing text output remains unchanged when --json is not provided.

Added CLI tests using CliRunner and json.loads() to verify JSON output for all updated commands.

Copy link
Copy Markdown
Owner

@Hell1213 Hell1213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: JSON output support for CLI commands

Hi @Jiya3177, clean implementation.

Verified: Tests pass (77/77, including 5 new JSON tests), ruff checks clean.

Looks good: The --json flag pattern with early return is clean and the _echo_json helper is reusable. Good test coverage.

One consideration: Adding indent=2 to json.dumps(data) in _echo_json would make the output more human-readable, but not essential.

Important: PR #48 by @geetanunakani also modifies src/oss_dev/cli/app.py (adds progress bars). Both PRs change the same function bodies (discover_repos, discover_issues, issues_list, analyze). Merging both will require reconciling the --json early returns with the progress bar context managers.

Copy link
Copy Markdown
Owner

@Hell1213 Hell1213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --json flag approach is straightforward and the tests cover all four commands. Early return pattern keeps it clean. Good work.

@Jiya3177 Jiya3177 force-pushed the feat/json-output-cli-33 branch from d6c3834 to b880a9b Compare June 3, 2026 15:57
@Jiya3177
Copy link
Copy Markdown
Author

Jiya3177 commented Jun 3, 2026

Hi @Hell1213,

I rebased the branch, resolved the conflicts with the progress-bar changes, updated the affected test accordingly, and CI is now passing.

The only remaining failing check is Gitleaks. I didn't add any credentials or secrets in this PR, so could you please share the specific Gitleaks finding or log output? I'll address it right away if there's a false positive or something I missed.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add JSON output format support to CLI commands

2 participants