Repository navigation
bl apps: create the static app on first deploy --dir - #53
scottcrawford03 wants to merge 2 commits into
Conversation
`bl apps deploy <id> --dir <dir>` now creates the app as a static app when the caller has none with that ID, then deploys to it. Later deploys to the same ID update it. An ID someone else owns fails at reservation and nothing is deployed. `--private` makes a new app private before its first deploy; for an existing app it only checks the app is already private. Prebuilt artifact deploys are unchanged and still need `bl apps create`. The create flow is shared with `bl apps create` through `create_app`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| CreateOptions { | ||
| private, | ||
| mysql_requested: false, | ||
| retry_command: "bl apps deploy", |
There was a problem hiding this comment.
🤖 For a new app the server's plan always asks for initialize (Recommended: live == nil in compose internal/app/agent.go). If initialize fails after the reserve, this error tells the user to "retry the same bl apps deploy command to reconcile the reservation and continue initialization". On that rerun, though, get_app finds the reservation and returns Ok. So ensure_static_app skips create_app, the upload happens straight away, and initialize never runs. I couldn't confirm whether the server accepts a deploy to an uninitialized static app, but either way the message promises something the rerun doesn't do. Not blocking. Two options: have the Ok(_) branch re-plan and resume through create_app when initialize.required is still true, or point this message at bl apps initialize.
There was a problem hiding this comment.
🤖 Fixed in f7c2ab2. For static plans the server never asks for initialize: the static branch in the plan handler overrides it to required: false, and both live staging creates came back initialized: false. So this path is unreachable today, but you were right that the message was wrong. Deploy-created apps now get their own recovery text. An initialize failure says nothing was deployed and to run bl apps initialize <id>, then the same bl apps deploy. A failure to make the app private now points at bl apps visibility <id> private, because a rerun on its own would just hit the existing-app check. I added a process test for the initialize case.
| .get("external_url") | ||
| .and_then(Value::as_str) | ||
| .unwrap_or(""); | ||
| eprintln!( |
There was a problem hiding this comment.
🤖 Product tradeoff, not a bug. With this change, a typo in the app ID (bl apps deploy docs-stie --dir dist) creates a stray app instead of failing. That app counts against the app limit, and the only signal is this stderr line and created: true in the JSON. One-command deploys are probably worth it. If the typo case turns out to bite people, a confirmation on interactive terminals or a louder message could help.
There was a problem hiding this comment.
🤖 Agreed it's worth it. In f7c2ab2 the stderr line now says no app with that ID existed and that a typo can be undone with bl apps delete. The README tells people to check that line on first deploys. If typos start costing people app slots, we can add an interactive confirmation later.
Rerunning `bl apps deploy` after an interrupted create finds the reserved app and only deploys, so it cannot finish a private or initialize step. Point those failures at `bl apps visibility` and `bl apps initialize` instead of promising the rerun reconciles them. Also say plainly on stderr that no app with the ID existed and how to remove one created by a typo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Publishing a static site used to take two commands:
bl apps create --runtime-profile static, thenbl apps deploy --dir. Now one command does it:If you have no app with that ID, the deploy creates it as a static app and then deploys. It prints
Created new app docs-site at <url>on stderr, and the JSON gains"created": trueplus the creation result undercreate. Later deploys to the same ID update the app and report"created": false.app_id_collision) and nothing is uploaded.--private: a new app is made private before its first deploy. If the app already exists,--privateonly checks that it is already private. When it isn't, the command fails before uploading and points tobl apps visibility <id> private.artifact.tar.gzdeploys: unchanged. They still needbl apps createbecause the CLI can't tell their runtime.--privateconflicts with an artifact path.run_create's plan → reserve → visibility → initialize sequence moves into a sharedcreate_app, so both commands use the same reservation reconciliation and private handling.Testing
just lintandjust test.staticis in the plan and reserve bodies;--privateon a new app → visibility before deploy;--privateon an existing public app is refused before upload;--privateon an existing private app deploys;--privateis rejected.created: falseand went ready.--privateon that existing public app was refused.--privateon a new ID created the app with visibilityrestricted.🤖 Generated with Claude Code