@switchboard-host/cli 0.2.1 → 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 +37 -4
- package/dist/switchboard.mjs +135 -82
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,12 +126,45 @@ 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`, `
|
|
131
|
+
`rollback [number] [--force]`, `db points|open|tables|query|recover|close`, `restart`, `errors [--status open|resolved|ignored|all] | show <id> |
|
|
132
|
+
resolve <id…|all> | ignore <id…> | reopen <id…>`, `doctor [--fix]`, `git-credential`, `mcp`.
|
|
132
133
|
Every command accepts `--json` (exactly one JSON document on stdout), `--app <slug>`,
|
|
133
134
|
`--lang`, `--api-url`, `--verbose`.
|
|
134
135
|
|
|
135
136
|
MCP tools: `deploy`, `deployment_status`, `deployment_log`, `app_logs`, `app_status`,
|
|
136
|
-
`
|
|
137
|
-
|
|
137
|
+
`browser_errors`, `browser_errors_resolve`, `list_apps`, `env_list`, `env_set`, `env_unset`,
|
|
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
|
|
140
|
+
working folder, or take a `slug` argument.
|
|
141
|
+
|
|
142
|
+
### Browser errors (CLI ≥ 0.3.0)
|
|
143
|
+
|
|
144
|
+
Switchboard adds a small script to every page of a hosted website that reports JavaScript errors
|
|
145
|
+
from visitors' browsers (uncaught errors, unhandled promise rejections, files that fail to load,
|
|
146
|
+
`console.error`, CSP violations). `switchboard errors` lists the open ones, grouped, with the pages
|
|
147
|
+
(paths without query string), browsers, file/line and the top stack frame; `errors show <id>` prints
|
|
148
|
+
the full stack; `errors resolve <id|all>` marks them fixed after a deploy (a resolved error reopens by
|
|
149
|
+
itself when it happens again). With `--json` the output also carries a ready-made `markdown` block.
|
|
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.
|