Skip to content

cli: auto-run deploy command in node new / node edit when possible (#111)#116

Open
zjma wants to merge 1 commit into
mainfrom
cli-auto-run-deploy
Open

cli: auto-run deploy command in node new / node edit when possible (#111)#116
zjma wants to merge 1 commit into
mainfrom
cli-auto-run-deploy

Conversation

@zjma
Copy link
Copy Markdown
Collaborator

@zjma zjma commented May 21, 2026

Summary

Fixes #111. Today node new / node edit print the gcloud (or docker) command and ask the user to run it in another terminal, then prompt for the URL. If the relevant CLI is installed and reachable, offer to run it inline.

  • New cli/src/auto-deploy.ts:
    • gcloudReady()gcloud --version succeeds AND gcloud auth list --filter=status:ACTIVE returns a non-empty account.
    • dockerReady()docker info succeeds.
    • maybeAutoRun(script, preflight, prompt) — confirms with the user, runs via bash -c, streams stdio.
    • captureCloudRunUrl(svc, project, region)gcloud run services describe ... --format='value(status.url)' to pre-fill the endpoint prompt in node new.
  • Wired into onboarding.ts and commands/edit-node.ts for the three deploy-emitting schemes (gcp-monolith, gcp-microservices, docker-monolith). local-build-monolith was already auto-spawned; unchanged.

The printed command stays exactly as before and is the source of truth — if preflight fails or the user declines, the flow matches today's "run this yourself" behavior.

Test plan

  • pnpm typecheck / pnpm build clean.
  • gcloudReady() and dockerReady() smoke-tested via tsx -e — both { ok: true } in my env.
  • Manual: node new + node edit against a throwaway GCP service (will verify when I next spin one up).
  • Manual: node new + node edit for docker-monolith.

🤖 Generated with Claude Code

#111)

Today `node new` / `node edit` print the gcloud / docker command and
ask the user to run it in another terminal, then prompt for the URL.
If the relevant CLI is installed and reachable, offer to run the
command inline.

- New `cli/src/auto-deploy.ts`:
  * `gcloudReady()` — checks `gcloud --version` and that an ACTIVE
    account exists.
  * `dockerReady()` — checks `docker info`.
  * `maybeAutoRun(script, preflight, prompt)` — confirms with the user,
    runs via `bash -c`, streams stdio.
  * `captureCloudRunUrl(svc, project, region)` — pulls the auto-assigned
    URL post-deploy so `node new` can pre-fill the endpoint prompt.

- Wired into:
  * `onboarding.ts` for `node new` (gcp-monolith, gcp-microservices,
    docker-monolith). For Cloud Run, the captured URL is passed as the
    default to `promptEndpoint`.
  * `commands/edit-node.ts` for `node edit` (same three schemes).

The printed command is unchanged and remains the source of truth — if
preflight fails or the user declines, the flow matches today's behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

cli node operations should be more automated

1 participant