feat: add JSON output support to CLI commands#52
Conversation
Hell1213
left a comment
There was a problem hiding this comment.
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.
Hell1213
left a comment
There was a problem hiding this comment.
The --json flag approach is straightforward and the tests cover all four commands. Early return pattern keeps it clean. Good work.
d6c3834 to
b880a9b
Compare
|
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! |
Summary
Add JSON output support to selected Typer CLI commands.
Related Issue
Fixes #33
Type of Change
Testing
uv run ruff checkpassesuv run mypypassesuv run pytestpassesManual testing:
PYTHONPATH=src python3 -m pytest tests/cli/test_new_cli.pypython3 -m ruff check src/oss_dev/cli/app.py tests/cli/test_new_cli.pyNote: 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
--jsonflag to:oss-dev discover repososs-dev discover issuesoss-dev issues listoss-dev analyzeWhen
--jsonis passed, the commands now print valid structured JSON and skip the default formatted text output. Existing text output remains unchanged when--jsonis not provided.Added CLI tests using
CliRunnerandjson.loads()to verify JSON output for all updated commands.