From 5250278159199227929f30953efb6bd0835ab068 Mon Sep 17 00:00:00 2001 From: Zan Markan Date: Sun, 1 Mar 2026 16:02:52 +0000 Subject: [PATCH 1/2] Change log command default to rich output with prompts Add -s/--sparse flag to show the previous compact format, and -n/--number flag to configure how many recent commits to display. Prompt: "I want to change how git-whence's log behaves so by default I want to show rich log with all the prompts for the last 10 commits or whatever the default is. Configurable to the number of commits or a specific commit, and also configurable to show the sparse log (which is the current behaviour)." Co-Authored-By: Claude Opus 4.6 --- cli/src/git_whence/commands/log.py | 35 ++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/cli/src/git_whence/commands/log.py b/cli/src/git_whence/commands/log.py index 54c3fe5..3d2d107 100644 --- a/cli/src/git_whence/commands/log.py +++ b/cli/src/git_whence/commands/log.py @@ -12,9 +12,16 @@ def register(subparsers): p.add_argument( "revision_range", nargs="?", - default="HEAD~10..HEAD", + default=None, help="Git revision range (default: HEAD~10..HEAD)", ) + p.add_argument( + "-n", "--number", + type=int, + default=10, + dest="num_commits", + help="Number of recent commits to show (default: 10)", + ) p.add_argument( "--format", dest="output_format", @@ -22,6 +29,11 @@ def register(subparsers): default="text", help="Output format (default: text)", ) + p.add_argument( + "-s", "--sparse", + action="store_true", + help="Show compact summary without prompts", + ) p.add_argument("--all", action="store_true", dest="show_all", help="Include commits without traces") p.add_argument("--stats", action="store_true", help="Show summary statistics") p.set_defaults(func=run) @@ -30,10 +42,13 @@ def register(subparsers): def run(args) -> int: git.ensure_acp_initialized() + # Resolve revision range: explicit range wins, otherwise use -n + revision_range = args.revision_range if args.revision_range else f"HEAD~{args.num_commits}..HEAD" + try: - commits = git.log_range(args.revision_range) + commits = git.log_range(revision_range) except git.GitError: - print(f"Error: invalid revision range: {args.revision_range}", file=sys.stderr) + print(f"Error: invalid revision range: {revision_range}", file=sys.stderr) return USER_ERROR if not commits: @@ -75,7 +90,19 @@ def _output_text(entries: list[dict], args) -> int: tool = trace_obj.get("tool_summary", {}).get("primary_tool", "unknown") mode = trace_obj.get("redaction_mode", "unknown") print(f"{sha} {msg}") - print(f" ACP: {event_count} events via {tool} ({mode})") + print(f" {event_count} events via {tool} ({mode})") + + if not args.sparse: + events = trace_obj.get("events", []) + for i, event in enumerate(events, 1): + prompt = event.get("prompt") + if prompt: + if len(prompt) > 120: + prompt = prompt[:117] + "..." + print(f' {i}. "{prompt}"') + else: + print(f" {i}. [hash-only]") + print() elif args.show_all: print(f"{sha} {msg}") From 26987c53cef986aab83f8a878adb41eefb51e3ee Mon Sep 17 00:00:00 2001 From: Zan Markan Date: Sun, 1 Mar 2026 16:12:38 +0000 Subject: [PATCH 2/2] Show all commits by default in log, including untraced ones Replace --all flag with --traced-only; the absence of a provenance trace is itself a meaningful signal that should be visible by default. Co-Authored-By: Claude Opus 4.6 --- cli/src/git_whence/commands/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/src/git_whence/commands/log.py b/cli/src/git_whence/commands/log.py index 3d2d107..f9b7f18 100644 --- a/cli/src/git_whence/commands/log.py +++ b/cli/src/git_whence/commands/log.py @@ -34,7 +34,7 @@ def register(subparsers): action="store_true", help="Show compact summary without prompts", ) - p.add_argument("--all", action="store_true", dest="show_all", help="Include commits without traces") + p.add_argument("--traced-only", action="store_true", help="Only show commits that have ACP traces") p.add_argument("--stats", action="store_true", help="Show summary statistics") p.set_defaults(func=run) @@ -104,7 +104,7 @@ def _output_text(entries: list[dict], args) -> int: print(f" {i}. [hash-only]") print() - elif args.show_all: + elif not args.traced_only: print(f"{sha} {msg}") print(" (no ACP trace)") print()