Add the CLI API client, preflight prompts and sc apps #11
No reviewers
Labels
No labels
⏳in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grey.ooo/someones.computer_agent!11
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/sc-cli-api"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Three things, all riding on the new
/cli/*API in the platform (see its PR).A client for it —
internal/client/cliapi.go: organizations, applications, a preflight lookup and application creation. Errors come back as a typedAPIErrorthat records whether the platform actually explained itself, which is what lets the CLI tell "no such application" from "no such route".deployasks before it uploads. A preflight resolves the target first, so two things a detected name can get wrong become questions rather than a failed upload:A first-ever deployment is not asked about — nothing for it to be a departure from. Answers come from stdin, so
printf "y\\n" | sc deployworks like typing it; nothing to read from is an error naming--yes, never a hang.--orgpicks the organization when you belong to several, and now reaches the upload URL too, so an ambiguous slug is finally resolvable from the CLI.sc appsprints organizations → applications → deployments as a tree, with an optional filter that keeps a match's ancestors — so filtering by a deployment name still shows you where it lives.Degrades rather than breaks
scships separately from the server and will routinely be the newer of the two. A 404 from a route that does not exist is not read as "the application does not exist": the preflight warns once and uploads exactly as before, andsc appssays<endpoint> has no /cli API — needs a newer platform.Verified
go vetandgo test ./...clean, with new tests for the client, the prompt branches (accept, decline, no-answer), the older-platform path and the tree filter. Exercised end to end against a local stack: created an application from the prompt, declined a new deployment name, and drew the tree.sc appstree 24b65f99e4