@switchboard-host/cli 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -126,16 +126,17 @@ Check what will be uploaded with `npm pack --dry-run` (it should be `dist/switch
126
126
  ## Commands
127
127
 
128
128
  `login`, `logout`, `whoami`, `apps`, `init <slug> [dir]`, `link [slug]`,
129
- `deploy [-m msg] [--no-follow]`, `status`, `logs [-f] [--role frontend|backend] [-n N]`,
129
+ `deploy [-m msg] [--no-follow] [--confirm-data-loss <id> | --cancel-deploy <id>]`, `status`, `logs [-f] [--role frontend|backend] [-n N]`,
130
130
  `env list|set KEY VALUE|- [--secret] [--allow-empty]|unset KEY`, `open [--dashboard]`, `domains`,
131
- `rollback [number]`, `restart`, `errors [--status open|resolved|ignored|all] | show <id> |
131
+ `rollback [number] [--force]`, `db points|open|tables|query|recover|close`, `restart`, `errors [--status open|resolved|ignored|all] | show <id> |
132
132
  resolve <id…|all> | ignore <id…> | reopen <id…>`, `doctor [--fix]`, `git-credential`, `mcp`.
133
133
  Every command accepts `--json` (exactly one JSON document on stdout), `--app <slug>`,
134
134
  `--lang`, `--api-url`, `--verbose`.
135
135
 
136
136
  MCP tools: `deploy`, `deployment_status`, `deployment_log`, `app_logs`, `app_status`,
137
137
  `browser_errors`, `browser_errors_resolve`, `list_apps`, `env_list`, `env_set`, `env_unset`,
138
- `domains_list`, `restart`. They resolve the website from `.switchboard/app.json` in the agent's
138
+ `domains_list`, `restart`, `confirm_deploy`, `restore_points`, `db_snapshot_open`,
139
+ `db_snapshot_tables`, `db_snapshot_query`, `db_query`, `db_recover_rows`, `db_snapshot_close`. They resolve the website from `.switchboard/app.json` in the agent's
139
140
  working folder, or take a `slug` argument.
140
141
 
141
142
  ### Browser errors (CLI ≥ 0.3.0)
@@ -147,3 +148,23 @@ from visitors' browsers (uncaught errors, unhandled promise rejections, files th
147
148
  the full stack; `errors resolve <id|all>` marks them fixed after a deploy (a resolved error reopens by
148
149
  itself when it happens again). With `--json` the output also carries a ready-made `markdown` block.
149
150
  The MCP tools `browser_errors` / `browser_errors_resolve` do the same for an agent.
151
+
152
+ ### Data safety (CLI ≥ 0.4.0, ARCHITECTURE §16)
153
+
154
+ * **Deploys that would delete data wait.** Before migrations run on live data, the platform runs
155
+ the release step on a copy of the pre-deploy backup. If a table or a filled column would be
156
+ dropped (or a table loses rows), the deployment stops in `needs_confirmation` before anything
157
+ changed: `deploy` exits with code 2 and prints what would be deleted plus the two ways on:
158
+ `deploy --confirm-data-loss <id>` (publish anyway; the build is re-used) or
159
+ `deploy --cancel-deploy <id>`. The MCP `deploy` tool returns the same, and `confirm_deploy`
160
+ (`cancel: true` to cancel) continues. Agents must only confirm after the user agreed.
161
+ * **Rollback warns** when the older code expects tables/columns the database no longer has
162
+ (`rollback_schema_mismatch`); `rollback <n> --force` goes back anyway, the dashboard offers
163
+ "code and data together".
164
+ * **Database tools** (`db …`, MCP `restore_points` / `db_*`): open a copy of the database of a backup
165
+ or of any moment within the continuous-backup window (`db open <backup-id>` / `--at <time>`; it
166
+ also starts a private preview for the owner), compare tables (`db tables`), query it read-only
167
+ (`db query "SELECT …" --snapshot`), query a fresh copy of live (`db query "SELECT …"`), and put
168
+ missing rows back (`db recover <tables>` is a dry run; `--confirm` does it, after a backup).
169
+ Queries are one `SELECT`/`WITH` statement, run in a sandbox on a read-only copy, max 500 rows
170
+ and 10 s per statement; writes, `ATTACH` and `PRAGMA` are refused.