feat(cli): add --dry-run guardrails to mutating scale commands#222
feat(cli): add --dry-run guardrails to mutating scale commands#222emil07770 wants to merge 2 commits into
Conversation
Closes profullstack#144. Adds --dry-run to scale up, scale down, scale auto, scale dns, scale rollout, and scale deploy destroy — all commands that would spend money, modify live DNS, or tear down infrastructure. Each command short-circuits with a [dry-run] plan line instead of performing real side effects when the flag is present. Also renames rollout's --version option to --release to avoid the Commander.js built-in -V / --version flag conflict that caused `sh1pt scale rollout --version v1.4.2` to print the CLI version string instead of executing the subcommand. Includes 7 Vitest tests covering every guarded command. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
17 similar comments
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
Summary
Closes #144. Addresses #133.
Adds
--dry-runto everyscalesubcommand that mutates live infrastructure, implementing the global CLI convention ("supported by anything that spends money, ships bits, or sends mail"):--dry-run--dry-runscale upscale downscale autoscale dnsscale rolloutscale deploy destroyAlso fixes a latent bug:
scale rolloutdeclared--version <id>which conflicts with Commander.js's built-in-V / --versionflag, causingsh1pt scale rollout --version v1.4.2to print the CLI version string instead of executing the subcommand. The option is renamed to--release <id>.Implementation details
dryRunGuard(label, opts)helper inscale.tskeeps all six short-circuits DRY — checksopts.dryRun, formats a[dry-run] <label> · key=value …summary line, and returnstrueso the caller canreturnimmediately.deploy destroygets the same--dry-runguard indeploy.tssince it's the most destructive action in the tree.rolloutregisters--releaseand not--version.Test plan
pnpm exec vitest run packages/cli/src/commands/scale-dry-run.test.ts— 7/7 passpnpm --filter @profullstack/sh1pt typecheck— no errorsgit diff --check— no trailing whitespace🤖 Generated with Claude Code