Skip to content

fix(cli): reject flags that need another flag in preview deploy and env create - #622

Draft
PiquelChips wants to merge 1 commit into
mainfrom
fix/cli-flags-needing-another-flag
Draft

PiquelChips wants to merge 1 commit into
mainfrom
fix/cli-flags-needing-another-flag

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

What and why

Fixes PQD-166

clap skips a requires rule when an argument that conflicts with the required one is present, so two commands accepted flags they then ignored. This follows #613's fix for app service add: the conflicting argument also conflicts with the flags that need it.

  • preview deploy <app> <preview> accepted and ignored --branch, --full-history and --allow-secret-files, which need --local. <PREVIEW> now also conflicts with the SnapshotArgs group.
  • env create <app> <name> --promote-from <env> --commit <sha> was accepted although --commit needs --branch. The daemon already refused the request (400 source_invalid, "a promoted environment follows no branch"), but only after the application lookup and the confirmation prompt. --promote-from now also conflicts with --commit.

Both are now usage errors (exit 2) at parse time. No other requires rule in the CLI has the problem: analytics --env requires --app, which conflicts with nothing, and source git's GitBuildArgs requires a required positional. app service add is fixed by #613.

Proof: new CLI tests in tests/cli/environments.rs fail on main (exit 4: the CLI tries to reach a daemon) and pass now; they also check that a valid preview deploy and env create --branch --commit still send the same request. --help and the generated CLI reference are unchanged.

Checklist

  • The feature reaches each surface in AGENTS.md it applies to,
    documentation included, with its reverse states. (CLI-only parsing fix; the manifest and dashboard are unaffected.)

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…nv create

clap skips a `requires` rule when an argument that conflicts with the
required one is present. `preview deploy <app> <preview>` accepted and
ignored `--branch`, `--full-history` and `--allow-secret-files`, which
need `--local`; `env create --promote-from <env> --commit <sha>` sent the
commit to the daemon, which refused it after the confirmation prompt.
The preview now also conflicts with the `--local` options, and
`--promote-from` with `--commit`, so both are usage errors.

Fixes PQD-166
@PiquelChips
PiquelChips force-pushed the fix/cli-flags-needing-another-flag branch from deb8c16 to ba39f4b Compare November 22, 2026 22:12
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