Skip to content

feat(cli): add --json output for reply and mode (#5) - #7

Open
AhmadBilalDSA wants to merge 2 commits into
primeodin:mainfrom
AhmadBilalDSA:feat/cli-json-output
Open

feat(cli): add --json output for reply and mode (#5)#7
AhmadBilalDSA wants to merge 2 commits into
primeodin:mainfrom
AhmadBilalDSA:feat/cli-json-output

Conversation

@AhmadBilalDSA

Copy link
Copy Markdown

Closes #5

@AhmadBilalDSA

AhmadBilalDSA commented Sep 8, 2026

Copy link
Copy Markdown
Author

Summary

Adds an optional `--json` CLI flag allowing callers to pipe structured output without external parsing dependencies.

Changes

  • `src/first_commit_ai/cli.py`: Added `--json` argument to `build_parser()`. When enabled, outputs a JSON object containing `reply`, `mock`, and `system` fields. Preserves standard plain text output when omitted.
  • `tests/test_cli.py`: Added test validating JSON payload structure, required keys, and types using `capsys` under `--mock` and `--json`.
  • `README.md`: Documented `--json` usage in the 60-second start section.

Verification

  • Ran `pytest` (8/8 passed).
  • Manual check: `python -m first_commit_ai --mock --json "hi"` prints a valid single-line JSON string."

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.

good first issue: --json CLI output for reply + mode

1 participant