Skip to content

feat(diff): add -i/--interactive to diff snapshot - #2545

Open
cavalcanticampos wants to merge 1 commit into
vercel-labs:mainfrom
cavalcanticampos:feat/diff-snapshot-interactive
Open

cavalcanticampos wants to merge 1 commit into
vercel-labs:mainfrom
cavalcanticampos:feat/diff-snapshot-interactive

Conversation

@cavalcanticampos

Copy link
Copy Markdown

Fixes #1647.

What changes for users

diff snapshot accepts -i / --interactive, the same flag as snapshot. A baseline saved from snapshot -i can now be diffed without every static line showing up as a change:

agent-browser snapshot -i > before.txt
# ... act on the page ...
agent-browser diff snapshot -i --baseline before.txt

Changes

  • cli/src/commands.rs: parse -i / --interactive into "interactive": true; usage strings list it.
  • cli/src/native/actions.rs: handle_diff_snapshot passes interactive to SnapshotOptions.
  • cli/src/mcp.rs: agent_browser_diff_snapshot takes an interactive boolean and forwards --interactive. Default is false, so existing MCP calls behave as before (note the MCP snapshot tool defaults interactive to true; I left the diff default alone rather than change existing output). The argument building moved into diff_snapshot_command_args, following snapshot_command_args, so it can be tested against the CLI parser.
  • packages/@agent-browser/sandbox/mcp-tools.json: regenerated with AGENT_BROWSER_UPDATE_MCP_TOOLS=1.
  • --help output and docs/content/docs/diffing.mdx options table document the flag.

Verification

On Linux (WSL2), rustc 1.99:

  • cargo fmt -- --check, cargo clippy -- -D warnings: clean.
  • cargo test: all pass, including test_diff_snapshot_interactive (both spellings, absent by default) and diff_snapshot_arguments_use_canonical_cli_command (MCP arguments go through the CLI parser and come out with the same interactive, baseline, selector and depth), plus mcp_tool_catalog_snapshot_is_current.
  • New e2e e2e_diff_snapshot_interactive_matches_interactive_baseline (headless Chrome, snapshot_diff_probe fixture): a baseline from snapshot -i diffs as changed without the flag and as unchanged with it. cargo test e2e_diff -- --ignored --test-threads=1: all pass.

Not run: the docs site suite. The docs change is one table row.

Companion to #2544 (bare diff snapshot compares against the last snapshot, #1755). The two touch neighbouring lines in handle_diff_snapshot; whichever lands second needs a trivial rebase, which I'm happy to do.

🤖 Generated with Claude Code

`snapshot -i` output could not be diffed: `diff snapshot` always captured
the full tree, so every non-interactive line showed up as a change. The
flag now passes `interactive` to the snapshot the diff takes, as
`snapshot -i` does. The MCP tool takes an `interactive` boolean (default
false, so existing calls are unchanged).

Fixes vercel-labs#1647

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

@cavalcanticampos is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

Interactive flag is missing in diff snapshot

1 participant