Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -1,14 +1,14 @@
|
||||
# CLI ops (`toolctrl ops`)
|
||||
# CLI ops (`hivegrid ops`)
|
||||
|
||||
The operator CLI under `packages/cli/` ships three ops sub-commands
|
||||
for day-to-day operational work:
|
||||
|
||||
- `toolctrl ops doctor` — local environment health check
|
||||
- `toolctrl ops migrate-tenant` — resumable tenant migration between envs
|
||||
- `toolctrl ops impersonate` — audit-logged debug magic-link for a tenant user
|
||||
- `hivegrid ops doctor` — local environment health check
|
||||
- `hivegrid ops migrate-tenant` — resumable tenant migration between envs
|
||||
- `hivegrid ops impersonate` — audit-logged debug magic-link for a tenant user
|
||||
|
||||
All three commands accept the `--env` flag to target a named env file
|
||||
under `~/.toolctrl/envs/`. The default is the current working-dir's
|
||||
under `~/.hivegrid/envs/`. The default is the current working-dir's
|
||||
`.env` (i.e. whatever is already loaded into `process.env`).
|
||||
|
||||
## Env-file layout
|
||||
@@ -16,13 +16,13 @@ under `~/.toolctrl/envs/`. The default is the current working-dir's
|
||||
Named envs live under:
|
||||
|
||||
```
|
||||
~/.toolctrl/envs/<name>.env
|
||||
~/.hivegrid/envs/<name>.env
|
||||
```
|
||||
|
||||
Example layout:
|
||||
|
||||
```
|
||||
~/.toolctrl/envs/
|
||||
~/.hivegrid/envs/
|
||||
├── staging.env # chmod 600
|
||||
├── staging-backup.env
|
||||
└── dev.env
|
||||
@@ -32,12 +32,12 @@ Example layout:
|
||||
No shell interpolation, no multi-line values.
|
||||
- File permissions must be `0600` (owner-only). The CLI emits a warning
|
||||
when world-readable bits are set; rotate the file with
|
||||
`chmod 600 ~/.toolctrl/envs/<name>.env`.
|
||||
`chmod 600 ~/.hivegrid/envs/<name>.env`.
|
||||
- Production env files **must not** live in CI. The `impersonate`
|
||||
command refuses any env named `prod`, `production`, or `live`
|
||||
regardless of file content.
|
||||
|
||||
## `toolctrl ops doctor`
|
||||
## `hivegrid ops doctor`
|
||||
|
||||
Runs eight probes against the resolved env and emits an ok/warn/fail
|
||||
table:
|
||||
@@ -57,13 +57,13 @@ Examples:
|
||||
|
||||
```bash
|
||||
# Default — read local .env
|
||||
node packages/cli/bin/toolctrl-cli.mjs ops doctor
|
||||
node packages/cli/bin/hivegrid-cli.mjs ops doctor
|
||||
|
||||
# Read ~/.toolctrl/envs/staging.env
|
||||
node packages/cli/bin/toolctrl-cli.mjs ops doctor --env=staging
|
||||
# Read ~/.hivegrid/envs/staging.env
|
||||
node packages/cli/bin/hivegrid-cli.mjs ops doctor --env=staging
|
||||
|
||||
# JSON output for CI
|
||||
node packages/cli/bin/toolctrl-cli.mjs ops doctor --json
|
||||
node packages/cli/bin/hivegrid-cli.mjs ops doctor --json
|
||||
```
|
||||
|
||||
**Exit codes:** `0` when every probe is `ok` or `warn`; `1` when any
|
||||
@@ -79,12 +79,12 @@ probe reports `fail`.
|
||||
| `env.required: fail Missing required env vars: SESSION_SECRET` | Bootstrap your `.env` from `.env.example` |
|
||||
| `prisma.migrations: warn N pending` | Run `pnpm db:migrate dev` |
|
||||
|
||||
## `toolctrl ops migrate-tenant`
|
||||
## `hivegrid ops migrate-tenant`
|
||||
|
||||
End-to-end tenant migration between named envs. Reuses the
|
||||
`packages/cli/src/commands/tenant/snapshot.ts` infrastructure from
|
||||
phase 03 (#44). Resumable via a state file under
|
||||
`~/.toolctrl/migrations/<tenantId>-<timestamp>.state.json`.
|
||||
`~/.hivegrid/migrations/<tenantId>-<timestamp>.state.json`.
|
||||
|
||||
Steps (each is an atomic resume-point):
|
||||
|
||||
@@ -98,42 +98,42 @@ Examples:
|
||||
|
||||
```bash
|
||||
# Plan a migration (no writes)
|
||||
node packages/cli/bin/toolctrl-cli.mjs ops migrate-tenant tenant-abc \
|
||||
node packages/cli/bin/hivegrid-cli.mjs ops migrate-tenant tenant-abc \
|
||||
--from=staging --to=staging-backup --dry-run
|
||||
|
||||
# Real migration
|
||||
node packages/cli/bin/toolctrl-cli.mjs ops migrate-tenant tenant-abc \
|
||||
node packages/cli/bin/hivegrid-cli.mjs ops migrate-tenant tenant-abc \
|
||||
--from=staging --to=staging-backup
|
||||
|
||||
# Resume after a crash
|
||||
node packages/cli/bin/toolctrl-cli.mjs ops migrate-tenant tenant-abc \
|
||||
node packages/cli/bin/hivegrid-cli.mjs ops migrate-tenant tenant-abc \
|
||||
--from=staging --to=staging-backup \
|
||||
--resume ~/.toolctrl/migrations/tenant-abc-2026-05-17T120000000Z.state.json
|
||||
--resume ~/.hivegrid/migrations/tenant-abc-2026-05-17T120000000Z.state.json
|
||||
```
|
||||
|
||||
The CLI emits a per-step status line:
|
||||
|
||||
```
|
||||
state-file=/home/op/.toolctrl/migrations/tenant-abc-2026-05-17T120000000Z.state.json
|
||||
state-file=/home/op/.hivegrid/migrations/tenant-abc-2026-05-17T120000000Z.state.json
|
||||
preflight: ok — from=staging to=staging-backup
|
||||
snapshot: ok — /home/op/.toolctrl/migrations/tenant-abc-….tar.gz
|
||||
snapshot: ok — /home/op/.hivegrid/migrations/tenant-abc-….tar.gz
|
||||
restore: ok — restored 12345 rows
|
||||
verify: ok — row-counts match
|
||||
cleanup: ok — snapshot kept on disk for audit
|
||||
```
|
||||
|
||||
The Prisma + S3 backends are injected at the `bin/toolctrl-cli.mjs`
|
||||
The Prisma + S3 backends are injected at the `bin/hivegrid-cli.mjs`
|
||||
entrypoint. The standalone subcommand prints a warning if invoked
|
||||
without that injection (no destructive operations happen).
|
||||
|
||||
## `toolctrl ops impersonate`
|
||||
## `hivegrid ops impersonate`
|
||||
|
||||
Generates a 15-minute HMAC-signed magic-link the engineer can paste
|
||||
into a browser to debug a specific tenant user. Every issued link
|
||||
writes an `AuditEvent` so the action is reviewable.
|
||||
|
||||
```bash
|
||||
node packages/cli/bin/toolctrl-cli.mjs ops impersonate \
|
||||
node packages/cli/bin/hivegrid-cli.mjs ops impersonate \
|
||||
tenant-abc user-123 \
|
||||
--env=staging \
|
||||
--reason="support-ticket-456"
|
||||
@@ -186,14 +186,14 @@ packages/cli/src/commands/ops/
|
||||
└── index.ts # citty subcommand group
|
||||
```
|
||||
|
||||
The bin entrypoint in `packages/cli/bin/toolctrl-cli.mjs` is responsible
|
||||
The bin entrypoint in `packages/cli/bin/hivegrid-cli.mjs` is responsible
|
||||
for injecting the live Prisma client + S3 client + URL base into the
|
||||
commands. The standalone files keep zero dependencies on `@prisma/client`
|
||||
or AWS SDK so the package builds without optional peers.
|
||||
|
||||
## Security considerations
|
||||
|
||||
- **Never commit `~/.toolctrl/envs/*.env`.** The path is outside the
|
||||
- **Never commit `~/.hivegrid/envs/*.env`.** The path is outside the
|
||||
repo on purpose.
|
||||
- The `migrate-tenant` state files contain tenant IDs but no secrets.
|
||||
They are safe to retain for audit.
|
||||
|
||||
Reference in new issue
Block a user