Skip to content

added --json flag issue_2 - #8

Merged
maledadams merged 1 commit into
maledadams:mainfrom
adjenk:issue_2
Sep 17, 2026
Merged

maledadams merged 1 commit into
maledadams:mainfrom
adjenk:issue_2

Conversation

@adjenk

@adjenk adjenk commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Adds --json to git why log, per #2, so the reasoning timeline can be piped into other tools instead of only read as coloured text.

cmd_log now branches on args.json early in its existing filter loop (still honours --agent, --session, --spec, --with-reason), and reuses log_records() / first_of_each() unchanged — no new parsing. Each matching commit is printed as one JSON object per line (NDJSON): commit (short hash), subject, date, plus a why/why_* key for each Why* trailer actually present on that commit, mirroring the field naming cmd_export already uses.

test/smoke.sh gained an assertion piping git why log --json through python3 -c "import sys,json; [json.loads(l) for l in sys.stdin if l.strip()]" to confirm it's valid NDJSON, plus a check that why_agent comes through.

  • sh test/smoke.sh prints SMOKE OK
  • still one file, no new dependencies
  • committed with git why commit

Why: issue #2 asked for NDJSON output from log so the timeline can be scripted/piped
Why-Agent: claude-sonnet-5
@maledadams
maledadams merged commit c94045f into maledadams:main Sep 17, 2026
2 checks passed
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.

2 participants