Skip to content

feat(cli): add 'record' subcommand — capture traces from any callable (E3) - #23

Merged
lostmartian merged 1 commit into
mainfrom
feat/record-subcommand
Aug 24, 2026
Merged

lostmartian merged 1 commit into
mainfrom
feat/record-subcommand

Conversation

@lostmartian

Copy link
Copy Markdown
Collaborator

What

agentdiff record module:function --input '{...}' --out trace.json — runs any callable once and captures a canonical AgentDiff trace. Kills the biggest onboarding wall: "how do I get a trace?"

Why

E3 from the release plan (0.4.0 Capture, Fri 2026-08-29). Visitors bounced at setup because they had no trace to diff. record makes the install → record → diff → gate loop work in <5 minutes with zero telemetry.

How

  • recorder.py: resolves module:function / module:Class.method (imports from CWD, pytest-style), times execution, captures return/errors as a canonical AgentTrace (single step, Generic format)
  • Failed runs are still recorded (exit 1) — diff a failure to see exactly what broke
  • E1 backward compat preserved: agentdiff base.json cand.json (no subcommand) still means diff, via a click.Group parse_args patch that works in both the real CLI and CliRunner
  • 19 new tests (319 total green), cookbooks/record_callable.py demo, README + quickstart updated

Testing

  • make lint clean · pytest 319 passed · pnpm run build clean
  • Manual end-to-end: record baseline → record changed candidate → diff blocks gate (exit 1); failed-run recording; input from @file

Checklist

  • Branch + one logical change
  • Lint + tests green
  • Docs (README quickstart §0, docs quickstart §2, cookbook + index)

… (E3)

- recorder.py: resolve 'module:function' targets (CWD import like pytest),
  time execution, capture output/errors as canonical AgentTrace
- CLI: 'agentdiff record mod:fn --input JSON|@file --out trace.json'
  failed runs still recorded (exit 1) — diff them to see what broke
- E1 compat preserved: 'agentdiff base.json cand.json' still means diff
  via click.Group parse_args patch (works in CLI + CliRunner)
- 19 new tests (319 total), cookbook record_callable.py, README + quickstart docs
@lostmartian
lostmartian merged commit c5d36f2 into main Aug 24, 2026
7 checks passed
@lostmartian
lostmartian deleted the feat/record-subcommand branch August 24, 2026 21:47
@lostmartian lostmartian mentioned this pull request Aug 28, 2026
3 tasks done
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.

1 participant