跳到主要内容

bolt-cli/cli

bolt-cli/cli

此内容目前仅提供英文版。

运行方式 bolt

The bolt command (@norbital-ai/bolt-cli's bin): a workspace's verbs, run inside it or given its directory, and the template repository's bolt templates CI verbs. Exit 0 ok, 1 author errors, 2 tool failure.

workspace

bolt command

bolt

bolt: the workspace CLI, the workspace's own pinned @norbital-ai/bolt-cli (a devDependency at its Bolt's release that never enters a release). Every verb runs in the workspace or takes its directory first; templates runs from a template repository root. Exit codes: 0 ok, 1 author error, 2 tool failure.

源码: packages/bolt-cli/src/cli/main.ts:344

bolt build command

bolt build [<dir>] [--json] [--squash] [--platform] [--migrations]

bolt build: the release, built once in the template's CI and run unchanged in every environment.

Writes .norbital/bundle/ (manifest, guest, client and server pages, assets, migrations: what a host runs), .norbital/source/ (the authored tree and its tests, which Studio uses to verify customer changes), .norbital/seed/<pack>/ (base from seed/public/, which a release carries; test from seed/test/, never published) and, last, .norbital/release.json naming each part's SHA-256 digest (over its file tree, *.map excluded), so a reader that finds it finds every part. Identical source gives an identical bundle digest. An unchanged seed input reuses its packs; unchanged public page graphs reuse .norbital/cache/pages. No type check (bolt check owns it).

Schema: when the declared schema changed it generates the next editable SQL migration under migrations/, then replays the whole history on a fresh database and compares the physical schema with the declaration. Commit the SQL, snapshot.json, migrations.lock.json and physical.json together. A destructive step needs its acceptance line; a build that would generate an unaccepted one writes nothing (BOLT_ACCEPT_DESTRUCTIVE=1 generates it accepted). Hand edits to generated SQL are kept as long as replay still equals the declaration; a -- check: <name> line followed by one SELECT is a post-condition that fails the file (SQLSTATE BM005) when it returns a row. Each file runs in one transaction under the host's lock (5 s) and statement (15 s) timeouts; CONCURRENTLY is refused, and a backfill past that budget must be reshaped.

Exit 0 ok, 1 author errors, 2 tool failure.

参数

名称类型说明
<dir>?string

the workspace directory (default: the current one)

--json?boolean

a job: the errors also as one JSON line on stderr

--squash?string

verify a fresh-database schema prefix baseline (name: lowercase letters, digits, _), archiving the originals under migrations/archive/ and retaining any procedural/data or checked suffix; commit migrations/archive/, migrations/squashes/ and the lock

--platform?string

a directory bolt platform wrote: its layer is read, and its files are left for the host to add to the bundle

--migrations?boolean

compile only: write the next migration and prove the history

源码: packages/bolt-cli/src/cli/main.ts:156

bolt check command

bolt check [<dir>] [--json] [--no-types]

bolt check: every author error of every stage in one run, then one type check over the workspace's own node_modules. Runs bolt sync, then discover → names → bundle → evaluate → manifest → seed decode → schema and migration history → types. Run it before a commit and in CI. Exit 0 ok, 1 author errors, 2 tool failure.

参数

名称类型说明
<dir>?string

the workspace directory (default: the current one)

--json?boolean

a job: the errors also as one JSON line on stderr

--no-types?boolean

skip the whole-program type check; a warm host type service answers it instead

源码: packages/bolt-cli/src/cli/main.ts:73

bolt dev command

bolt dev [<dir>] [--port] [--host] [--tethered]

bolt dev: the workspace's norbital.host.ts (or --host=<file>) serves it untethered with that file's Facilities, pages hot reloaded from source. Neither, or --tethered (which ignores any host file): tethered, it builds on save, serves its pages from source for local Colony to proxy, and Colony serves the rest of each build.

Tethered: one build, then one per burst of edits under src/, seed/ and migrations/*.sql (150 ms debounce); a failed rebuild prints its errors and the loop goes on. No type check. Internal-SPA pages are served by a Vite dev server under /__bolt/dev/<directory>/, recorded in .norbital/dev.json (origin, base, artifact) after each good build; a host serving that artifact routes the base there. A page-only .svelte edit hot-updates and keeps the artifact hash; any other edit is a new artifact the host cuts over to, reloading open pages.

Untethered: the host file default-exports a Facilities record; guest code runs on host-api's node_guests. Each build is migrated on its database and activated through the needs check, so a bundle needing a member left off refuses to start, naming it. Served at http://127.0.0.1:<port>; the optional serving export adds integration links, a converter, geocoder and web reader.

Runs until stopped; exit 2 on a tool failure.

参数

名称类型说明
<dir>?string

the workspace directory (default: the current one)

--port?string

the untethered dev server’s port on 127.0.0.1

--host?string

serve untethered with this host file (default: the workspace’s norbital.host.ts)

--tethered?boolean

build for local Colony, ignoring any norbital.host.ts

源码: packages/bolt-cli/src/cli/main.ts:217

bolt platform command

bolt platform <dir>

bolt platform <dir>: this install's platform layer under dir, which bolt build --platform=<dir> reads.

The layer is the browser code of Bolt's shell, ui, svelte and effect: nothing of a workspace. A host keeps one per package graph and mounts it read-only into every build on that graph; such a build leaves client/assets/platform/** out for the host to add, its digests already counted, so the release is byte for byte the one a plain build writes. Exit 0 ok, 2 tool failure.

参数

名称类型说明
<dir>string

the directory the platform layer is written to

源码: packages/bolt-cli/src/cli/platform.ts:14

bolt seed command

bolt seed [<dir>] [--json] --bank [--target] [--tenant]

bolt seed --bank=<checkout>: the seeder's bank tree read and decoded in memory; with --target=<host url> and --tenant=<handle>, loaded into that demo environment, signed with NORBITAL_OPS_SECRET for NORBITAL_OPS_SCOPE (default local).

Decodes the public rows joined with the private ones, checks start names automations and every named asset exists, then restores them into a scratch database before sending anything, so a seed the host would refuse fails here and leaves the environment as it was. The target resets the environment to public ∪ private rows: assets go to its object store, rows in the request; the host keeps neither. A host's reset runs it for every template whose seeder names a bank tree. Exit 0 ok, 1 author errors, 2 tool failure.

参数

名称类型说明
<dir>?string

the workspace directory (default: the current one)

--json?boolean

a job: the errors also as one JSON line on stderr

--bankstring

the bank checkout holding the seeder’s tree

--target?string

the host’s origin

--tenant?string

the demo workspace handle

源码: packages/bolt-cli/src/cli/main.ts:297

bolt sync command

bolt sync [<dir>] [--json]

bolt sync: the declarations evaluated, .norbital/names.ts written; bolt dev and bolt check run it first. Run it after adding or renaming a declaration so its generated names resolve. Exit 0 ok, 1 author errors, 2 tool failure.

参数

名称类型说明
<dir>?string

the workspace directory (default: the current one)

--json?boolean

a job: the errors also as one JSON line on stderr

源码: packages/bolt-cli/src/cli/main.ts:95

bolt templates command

bolt templates

bolt templates: the template repository's CI verbs (check, lock, test, verify, publish), run from its root. A template pinning another Bolt release is delegated to that release's CLI.

源码: packages/bolt-cli/src/cli/templates.ts:988

bolt templates check command

bolt templates check [--filter]

bolt templates check: each template's repository contract: a private package with build and test scripts, an exact @norbital-ai/bolt pin, no local-protocol dependencies or foreign package-manager files, a bun.lock satisfying first-party peer pins, valid catalogue metadata, and committed migrations under migrations/. A template pinning another Bolt release is checked by that release's CLI. Run in CI from the repository root. Exit 0 ok, 2 on a failed check.

参数

名称类型说明
--filter?string

one template directory or handle; every template when absent

源码: packages/bolt-cli/src/cli/templates.ts:890

bolt templates lock command

bolt templates lock [--filter] [--check]

bolt templates lock: writes each template's pinned Bolt toolchain set (from that release's published toolchain.json) into its package.json, FIRST_PARTY_BUNFIG into its and the repo root's bunfig.toml, and re-resolves its bun.lock. Run only when moving dependencies; with --check (CI) it writes nothing and fails on drift. Exit 0 ok, 2 on drift or a failed resolution.

参数

名称类型说明
--filter?string

one template directory or handle; every template when absent

--check?boolean

write nothing; fail when a package.json, bunfig.toml or bun.lock differs from its resolution

源码: packages/bolt-cli/src/cli/templates.ts:905

bolt templates publish command

bolt templates publish --out [--filter]

bolt templates publish --out=<dir>: packs each built template's release for CI to upload by digest: bundle/<b>.tar.gz, source/<s>.tar.gz, seed/<p>.tar.gz (the base pack; test is never published) and template/<directory>/<b>.json (its release.json). Run after bolt build. Nothing serves a release until the host is told its bundle digest; the host fetches and verifies each part, then cuts the template's demo workspaces over (same schema: flip; changed: pause, migrate, flip). Customer workspaces own their source and never follow. Exit 0 ok, 2 when a template has no .norbital/release.json.

参数

名称类型说明
--outstring

the directory the release objects are written under

--filter?string

one template directory or handle; every template when absent

源码: packages/bolt-cli/src/cli/templates.ts:973

bolt templates test command

bolt templates test [--only] [<args…>]

bolt templates test: every template's own bolt test (through its test script), standalone on its own pins, up to three at once sharing the machine's workers; prints each suite's totals. Exit 0 ok, 2 when any suite fails.

参数

名称类型说明
--only?string

comma-separated template directories or handles; every template when absent

<args…>?string

passed to each template’s Vitest

源码: packages/bolt-cli/src/cli/templates.ts:925

bolt templates verify command

bolt templates verify [--filter]

bolt templates verify: each template as a tenant receives it: its tracked files alone in a scratch directory, installed from its frozen lock, bolt checked and built once, then tested against that build. Unfiltered, only the templates changed since origin/main. Run in CI before publishing. Exit 0 ok, 2 on any failed step.

参数

名称类型说明
--filter?string

one template directory or handle; the templates changed since origin/main when absent

源码: packages/bolt-cli/src/cli/templates.ts:956

bolt test command

bolt test [<dir>] [<args…>]

bolt test [dir] [vitest args…]: the workspace's own Vitest, in process, with the test kit preconfigured (Svelte compiled, @norbital-ai/bolt-cli/test, forks without per-file isolation, one per free core and at least 4, a one-minute hang guard and the test lint). Needs no prior bolt build. Each TestWorkspace seeds from the test pack (seed/test/, built once per source hash), never from base or bank rows. Run it before a commit and in CI. Exit 0 ok, 1 author errors or failing tests, 2 tool failure.

参数

名称类型说明
<dir>?string

the workspace directory (default: the current one)

<args…>?string

passed to Vitest: test file filters and flags

源码: packages/bolt-cli/src/cli/main.ts:265