Skip to content

feat(agents): add diff and open commands (3/8)#8282

Open
VaibhavAcharya wants to merge 1 commit into
agent/cli/pr8237-existing-cmdsfrom
agent/cli/pr8237-cmd-diff-open
Open

feat(agents): add diff and open commands (3/8)#8282
VaibhavAcharya wants to merge 1 commit into
agent/cli/pr8237-existing-cmdsfrom
agent/cli/pr8237-cmd-diff-open

Conversation

@VaibhavAcharya
Copy link
Copy Markdown
Contributor

@VaibhavAcharya VaibhavAcharya commented Jun 1, 2026

Summary

Linear: https://linear.app/netlify/issue/EX-2195

Part 3 of the agents CLI revamp split. Adds two read-only commands.

  • agents:diff prints the change set an agent run produced. Supports --session, --cumulative, pagination, and --no-strip-binary to keep raw binary patches (stripped by default).
  • agents:open opens the run's preview, dashboard, or pull request in the browser. Honors NETLIFY_WEB_UI so links work on staging.
$ netlify agents:open <id> dashboard
Opening https://app.netlify.com/projects/another-astro-starter/agent-runs/69e766451314e00fad873557

$ netlify agents:open <id> pr   # when a PR is being created
A pull request is being created. Try again in a moment.

$ netlify agents:open <id> bogus
Error: Invalid target "bogus". Choose one of: preview, dashboard, pr

Stacked on the existing-commands PR.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If youre fixing a typo or something thats on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds two new Netlify CLI subcommands for managing agent runs. agents:open opens agent run destinations (preview deployments, dashboard, or pull requests) in a browser with conditional fallback behavior. agents:diff fetches and displays code diffs produced by agent runs, supporting both session-based and paginated diff modes with color formatting and pagination footers. The implementation includes CLI command registration, handler functions with API integration and error handling, comprehensive integration tests covering all code paths, and updated documentation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding two new CLI commands (diff and open) to the agents command group.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly outlines two new commands (agents:diff and agents:open) with specific functionality, flags, and examples that directly correspond to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/cli/pr8237-cmd-diff-open

Comment @coderabbitai help to get the list of available commands and usage tips.

@VaibhavAcharya VaibhavAcharya changed the title feat(agents): add diff and open commands (3/8 of #8237) feat(agents): add diff and open commands (3/8) Jun 1, 2026
@VaibhavAcharya VaibhavAcharya force-pushed the agent/cli/pr8237-existing-cmds branch from 79a1657 to c47c842 Compare June 1, 2026 09:59
@VaibhavAcharya VaibhavAcharya force-pushed the agent/cli/pr8237-cmd-diff-open branch from c6e77a5 to 3220465 Compare June 1, 2026 09:59
@VaibhavAcharya VaibhavAcharya marked this pull request as ready for review June 1, 2026 10:20
@VaibhavAcharya VaibhavAcharya requested review from a team as code owners June 1, 2026 10:20
@VaibhavAcharya
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/agents/agents-open.ts`:
- Around line 60-67: The messages in agents-open referencing a non-existent CLI
command `netlify agents:pr` are dead-ends; update the user-facing strings in
src/commands/agents/agents-open.ts (the block that checks runner.pr_error and
the subsequent "No pull request exists" branch using runner) to point to the
correct invocation `netlify agents:open <id> pr` (or to the actual command you
choose to implement), so users are given a valid CLI instruction; ensure both
the retry and create messages use `netlify agents:open ${id} pr` (or replace
with the name of a newly added agents:pr command if you implement that
endpoint).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3567f08-9402-45bd-b650-7d5a9d1369a9

📥 Commits

Reviewing files that changed from the base of the PR and between c47c842 and 3220465.

📒 Files selected for processing (7)
  • docs/commands/agents.md
  • docs/index.md
  • src/commands/agents/agents-diff.ts
  • src/commands/agents/agents-open.ts
  • src/commands/agents/agents.ts
  • tests/integration/commands/agents/agents-diff.test.ts
  • tests/integration/commands/agents/agents-open.test.ts

Comment thread src/commands/agents/agents-open.ts
- agents:diff renders the change set for an agent run (with
  --no-strip-binary to keep binary patches)
- agents:open opens the run's preview, dashboard, or PR in the browser,
  honoring NETLIFY_WEB_UI for staging

Part 3/8 of the agents CLI revamp split.
@VaibhavAcharya VaibhavAcharya force-pushed the agent/cli/pr8237-existing-cmds branch from c47c842 to 8a0f826 Compare June 1, 2026 11:13
@VaibhavAcharya VaibhavAcharya force-pushed the agent/cli/pr8237-cmd-diff-open branch from 3220465 to 35a38b9 Compare June 1, 2026 11:13
@VaibhavAcharya
Copy link
Copy Markdown
Contributor Author

Link EX-2195

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