Skip to content

feat: add non-interactive flags for setup-aws/gcp and env load#92

Open
crowlbot wants to merge 1 commit into
feat/agent-foundationfrom
feat/agent-non-interactive
Open

feat: add non-interactive flags for setup-aws/gcp and env load#92
crowlbot wants to merge 1 commit into
feat/agent-foundationfrom
feat/agent-non-interactive

Conversation

@crowlbot
Copy link
Copy Markdown

Summary

Stacked on #91. Wires up per-command non-interactive flags so the wizard subcommands (setup-aws, setup-gcp) and env load can be driven end-to-end by an agent.

What's in this PR

setup-aws

  • --policies <arn> (repeatable) replaces the interactive policy multi-select. In --non-interactive mode without --policies, fails fast with MISSING_FLAG instead of blocking on stdin.
  • --role-name <name> replaces the random-suffixed default, enabling idempotent re-runs (subject to the underlying AWS error if the role already exists).
  • The `confirm("Do you want to apply these changes?")` auto-accepts under --non-interactive.

setup-gcp

  • --roles <role> (repeatable) — same treatment as --policies.
  • --service-account-name <name> — same treatment as --role-name.
  • --enable-apis skips the "enable missing APIs?" confirmation; the final apply-confirmation also auto-accepts in non-interactive mode.

env load

  • The existing TTY-only guard now also fires when --non-interactive is set on a TTY, so env load .env --non-interactive no longer falls through to a blocking `prompt()`. Error message points at --replace or --skip-existing.

The getOrg/getApp selection paths already route through requireInteractive(), which PR #91 taught to honor context.nonInteractive, so no additional changes were needed there.

Test plan

  • deno fmt clean
  • deno lint clean
  • deno check main.ts — same error count as main (114; pre-existing TS/Cliffy issues). No new regressions.
  • deno test -A tests/agent.test.ts — 6/6 pass (new test covers the setup-aws --non-interactive error envelope).
  • deno test -A tests/create.test.ts — 17/17 pass (no regression).
  • Interactive UX unchanged when stdout is a TTY and no --non-interactive is set.

Notes on idempotency

--role-name / --service-account-name let re-runs reuse a known name, but the underlying AWS/gcloud CLI will still error if the resource exists. That's by design for this PR (avoid clobbering existing user resources). A later idempotency PR can layer "already exists is OK" semantics on top via a --reuse-if-exists flag.

🤖 Generated with Claude Code

Second slice of the agent-ergonomics series. The previous PR added the
global `--non-interactive` flag and the `requireInteractive()` guard;
this one wires up the per-command flags so agents can actually drive
the wizard subcommands end-to-end.

- `setup-aws`:
  - `--policies <arn>` (repeatable) replaces the interactive policy
    multi-select. With `--non-interactive` set and no `--policies`,
    we now fail fast with `MISSING_FLAG` instead of blocking on stdin.
  - `--role-name <name>` replaces the random-suffixed default, so
    re-running the wizard with the same name is idempotent (subject to
    the underlying AWS error if the role already exists).
  - The final "apply these changes?" `confirm()` now auto-accepts in
    non-interactive mode.
- `setup-gcp`:
  - `--roles <role>` (repeatable) — same treatment as `--policies`.
  - `--service-account-name <name>` — same treatment as `--role-name`.
  - `--enable-apis` skips the "enable missing APIs?" confirmation; the
    final apply-confirmation also auto-accepts in non-interactive mode.
- `env load`: the existing TTY-only guard now also fires when
  `--non-interactive` is set on a TTY, so `env load .env --non-interactive`
  no longer falls through to a blocking `prompt()`.

Existing interactive UX is unchanged when stdout is a TTY and no
`--non-interactive` flag is set. The `getOrg`/`getApp` selection paths
already route through `requireInteractive()`, which the previous PR
taught to honor `context.nonInteractive`, so no additional changes
were needed there.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@crowlbot crowlbot force-pushed the feat/agent-non-interactive branch from cfd9e77 to 535af87 Compare May 13, 2026 13:53
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