The ztron CLI provides eight main commands — init/doctor/dev/
build/codegen/check/signer/version (plus the
icon/info/add/migrate utility commands, see the end). The command set
is defined by the dispatch switch in packages/cli/src/index.ts (the USAGE
strings do not yet cover codegen/signer).
Scaffolds a new project in the target directory (default: current
directory): generates the src/main.ts entry, the frontend/ skeleton, and
ztron.conf.json. Only missing files are written (existing content is never
overwritten).
Templates (--template <name>, default vanilla):
vanilla — plain JS skeleton: a hello command + inline HTML fallback +
a minimal frontend.react-ts — React 19 + Tailwind CSS v4 scaffold (config values identical
to the pipeline-verified examples/react-demo): capabilities/,
tsconfig.json, frontend/vite.config.ts (react + tailwindcss plugins),
and a Tailwind-styled greeting App.tsx; the backend registers a typed
command via defineCommand("app:greet").vue-ts — Vue 3 + Tailwind CSS v4 scaffold (config values identical to
the pipeline-verified examples/vue-demo): frontend/vite.config.ts
(vue + tailwindcss plugins), a <script setup lang="ts"> Tailwind-styled
greeting App.vue, typecheck via vue-tsc --noEmit, and the same
defineCommand("app:greet") backend.svelte — Svelte 5 + Tailwind CSS v4 scaffold (config values identical
to the pipeline-verified examples/svelte-demo): frontend/vite.config.ts
(svelte + tailwindcss plugins), a root svelte.config.js (for
svelte-check), a runes-style Tailwind-styled greeting App.svelte with a
mount(App, { target }) entry, typecheck via svelte-check, and the
same defineCommand("app:greet") backend.
Unknown template names exit 1 listing the valid templates.One-shot environment check for node / tjs / ztron-host / the webview
library: prints doctor: OK and exits 0 when all checks pass; on any FAIL
it prints the per-check fix hints and exits 1.
Builds the frontend (vite) and runs the app under the native host + tjs
backend; --entry defaults to ./src/main.ts.
Bundles the backend into a standalone executable with tjs compile and
produces a macOS .app (ad-hoc signed; .dmg also supported).
Scans defineCommand declarations in all .ts files under src/, dedupes
by command name (last one wins), and generates the src/ztron-commands.ts
typed bindings for typed frontend calls like
g.invoke("my:greet", {...}).
Regression run: starts the app through the full dev flow and parses the
checks it reports (hello-style frontend reported lines and bare TAG_OK
lines). It exits 0 only on reaching FULL_OK with 0 FAILs; the harness's
verdict covers the subprocess exit code. --expect takes a comma-separated
list of required tags; --timeout (milliseconds) bounds the total duration.
minisign-compatible key generation/signing/verification, wire-level
cross-verified with jedisct1/minisign (signatures produced by this tool
verify with real minisign, and vice versa). The generate subcommand
additionally supports --password (or the ZTRON_SIGNER_PASSWORD
environment variable) to encrypt the private key with scrypt on write.
The switch also has: ztron icon [input] [-o outDir] (generate
icns/iconset/multi-size pngs), ztron info (print environment info),
ztron add <plugin> (add a plugin to the project), and ztron migrate
(migrate legacy configuration).
适用版本:ztron 0.3.1