ReviewOS

also looking at this

stacks/ts-cloud

feat(consolidation): report an attach's credential radius, and rename a server in place

#175
Merged glennmichael123 wants to merge feat/consolidation-credential-reach-and-rename into main
12 files +1138 -14
docs/cli.mdmodified+44-0
Changes to docs/cli.md
@@ -154,6 +154,7 @@ See [Preview environments](/features/preview-environments) for policy, source li
154154| `cloud server:list` / `server:create <name>` / `server:destroy <name>` | Manage servers. |
155155| `cloud server:ssh <name>` / `server:logs <name>` / `server:monitoring <name>` | Connect / logs / metrics. |
156156| `cloud server:deploy <name>` / `server:reboot` / `server:resize <name> <type>` | Deploy / reboot / resize. |
157| `cloud server:rename <name> <new-name> [--apply]` | Rename a server in place. Prints the plan; `--apply` performs it. |
157158| `cloud server:recipe <name> <recipe>` | Run a reusable script across servers. |
158159| `cloud server:worker:add/list/restart/remove` | Queue workers (Supervisor). |
159160| `cloud server:cron:add/list/remove` | Scheduled jobs / cron. |
@@ -164,6 +165,49 @@ See [Preview environments](/features/preview-environments) for policy, source li
164165
165166See [Laravel / Forge-style](/features/laravel) for the `infrastructure.compute` + `sites` config.
166167
168### Renaming a server
169
170A name is spelled in four places, and a rename is only done when all four agree:
171the provider record, the local driver state pin
172(`storage/cloud/state/<stack>.json`), the box's own hostname, and the fleet
173inventory record. The state pin is the one that is not cosmetic a deploy
174REFUSES a pinned server whose live name no longer matches the recorded one, a
175guard against a stale pin sending a database operation to another project's box
176 so renaming at the provider alone quietly invalidates it.
177
178```bash
179cloud server:rename bughq hq-production-server # plan only
180cloud server:rename bughq hq-production-server --apply # perform it
181```
182
183Without `--apply` it prints the plan and changes nothing:
184
185```
186server:rename bughq
187 Rename the server at the provider
188 bughq hq-production-server
189 Update the recorded name in the local driver state
190 bughq hq-production-server
191 ok Set the hostname on the box [already done]
192 Rename the fleet inventory record
193 bughq hq-production-server
194 3 step(s) would run
195 Re-run with --apply to perform it.
196```
197
198Every step asks reality whether it is already done, so a rename that dies
199halfway is resumed by running the same command again the finished steps skip
200themselves rather than being attempted twice and a completed rename re-runs as
201`Nothing to do`. A step whose capability is missing is dropped and reported
202under `not covered`: a hand-enrolled server has no provider record, a project
203deploying purely from labels has no state pin, and a box whose host key is not
204pinned cannot be reached to set a hostname (`cloud server:validate` first).
205
206Renaming is reversible by renaming back, so it needs no typed confirmation. It
207is also non-interactive by construction the plan is data and the authorization
208is a flag so it runs unattended from CI, and `--json` emits both the plan and
209the outcome. Each step appends to the operation log as it starts and finishes.
210
167211## Databases
168212
169213`cloud db:create` · `db:list` · `db:connect` · `db:tunnel` · `db:users:add` · `db:users:list` ·