feat: add --json and --since flags to jilog review nightly#1
Merged
Conversation
Closes README/code drift: the README documents 'jilog review nightly --json' and '--since 24h' but neither flag was implemented (only --days existed). - --json emits a single JSON object to stdout with schema_version: 1 and the documented keys (counts plus structured p0_alerts and created_issues), suppressing the human summary lines so output is one parseable document. - --since accepts the same forms as 'jilog query --since' (Nh, Nd, Nw, YYYY-MM-DD); reuses pub(crate) parse_since from commands::query. parse_since extended to accept hour suffix. - --since conflicts with --days only when both are user-supplied (clap v4 ValueSource::CommandLine semantics); --days default of 1 stays. - DigestReport stays non-Serialize; JSON is hand-built from a serde_json::Value in commands/review.rs.
Owner
|
Hi Mvan — thanks for the first PR! Both of these are excellent. Reading through them is a pleasure: sharp motivation, careful scoping, tests that exercise the subtle behavior (the clap This one I'm merging as-is. Thanks again — looking forward to more. — Joi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jilog review nightly --jsonandjilog review nightly --dry-run --since 24hnow run as documented in the README.Why this matters
The README's Quick Start shows
jilog review nightly --json | your-agent synthesize-suggestions(line 52) and the dry-run example showsjilog review nightly --dry-run --since 24h(line 57), butNightlyArgsonly exposes--days,--digest-dir,--dry-run,--create-issues,--date,--processed-file. Anyone copy-pasting from the README hits an unknown-flag error.This PR closes that drift in code rather than walking the README back, so the documented agent-synthesis pipe works end to end.
Changes
--json(boolean): emit a single JSON object to stdout and suppress the human summary lines so the output is one parseable document. Thequerysubcommand already accepts--format json, so the JSON path is consistent with existing precedent inside the same binary.--since <duration>: acceptsNh,Nd,Nw, orYYYY-MM-DD. Reusespub(crate) fn parse_sincefromcommands::query.parse_sinceis extended with an hour suffix so--since 24hfrom the README example works as written.--daysis retained for back-compat.--sinceand--daysconflict only when both are user-supplied (clap v4 evaluatesconflicts_withviaValueSource::CommandLine, so--since 24halone with the default--days 1does not raise).DigestReportis left non-Serialize. The JSON output is hand-built as aserde_json::Valueinsidecommands/review.rs, so this PR stays in thejilogcrate.JSON shape
{ "schema_version": 1, "sessions_scanned": 0, "corrections": 0, "errors": 0, "workarounds": 0, "p0_alerts": { "<tool_name>": ["<session_id>", ...] }, "digest_path": "/abs/path/learning-digest-2026-05-10.md", "created_issues": [{"id": "...", "backend": "...", "title": "...", "url": "..."}] }schema_version: 1reserves room for additive evolution.p0_alertsis the structured tool-to-sessions map (not a count) so a downstream agent can synthesize from the JSON alone without re-parsing the markdown digest.created_issuescarries theIssueReffields the markdown digest does not expose.digest_pathisnullunder--dry-run. Happy to adjust the shape if you had something different in mind for v1.Testing
cargo build --workspacepassescargo test --workspacepassesjilog review nightly --dry-run --since 24handjilog review nightly --dry-run --json | jq .--sincealone with default--daysdoes not conflict,--since+ user--daysdoes conflict,--since 24hmatches--days 1window within 2s,--sinceparser error path, JSON output keys present,--json --dry-runemitsdigest_path: null.