Skip to content

feat: add --diff flag to deploy command#485

Open
notgitika wants to merge 2 commits intoaws:mainfrom
notgitika:feat/deploy-diff-flag
Open

feat: add --diff flag to deploy command#485
notgitika wants to merge 2 commits intoaws:mainfrom
notgitika:feat/deploy-diff-flag

Conversation

@notgitika
Copy link
Contributor

Description

Adds a --diff flag to agentcore deploy that runs cdk diff and displays a structured summary of infrastructure changes without actually deploying. In interactive (TUI) mode, users can also toggle the diff view with Ctrl+D during a normal deploy.

What this includes:

  1. CLI plumbing — New --diff option registered on the deploy command, routed to both CLI and TUI code paths
  2. CDK IoHost data pipe — Extended setOnRawMessage callback to pass structured data from CDK messages (not just text), enabling access to parsed diff objects
  3. Diff execution in deploy actions — Early-return path in handleDeploy() that calls toolkitWrapper.diff(), listens for CDK diff event codes (I4002 per-stack, I4001 summary), and skips deployment
  4. Diff-aware logging — New logDiff() method on ExecLogger that strips ANSI codes and writes formatted diff output to the log file
  5. Diff parser + TUI componentparseStackDiff() and parseDiffResult() parse CDK structured data into typed sections (Resources, Outputs, etc.) with add/modify/remove changes; DiffSummaryView renders a scrollable, color-coded diff view with security warnings
  6. Deploy screen integrationuseDeployFlow adds diff-mode effect and lazy requestDiff(); DeployScreen renders DiffSummaryView, supports Ctrl+D toggle, and adjusts UI for diff mode

Related Issue

Closes #75

Documentation PR

N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@notgitika notgitika requested a review from a team March 3, 2026 16:43
@github-actions github-actions bot added the size/l PR size: L label Mar 3, 2026
# Conflicts:
#	src/cli/commands/deploy/actions.ts
#	src/cli/tui/screens/deploy/DeployScreen.tsx
#	src/cli/tui/screens/deploy/useDeployFlow.ts
@github-actions github-actions bot added size/l PR size: L and removed size/l PR size: L labels Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --diff flag to agentcore deploy to show CDK diff before deploying

1 participant