CLI Reference
The cuttlefish command-line tool transpiles TypeScript to C++, manages projects, and interfaces with hardware toolchains. Hardware tests use the separate cuttlefish-test binary (see Testing).
cuttlefish <input.ts> [options]
Transpile a TypeScript file to C++. Transpilation is always performed first.
cuttlefish src/main.ts --emit cpp --outDir out| Option | Description |
|---|---|
--emit <mode> | cpp (single file) or split (separate .cpp/.h). Default: split. |
--target <platform> | Target platform string (default: generic). |
--outDir, --out-dir <path> | Output directory (default: input file directory). |
--emit-maps <bool> | Emit source maps (true/false, default: true). |
--framework <pkg> | Framework package for code generation (e.g. @typecad/framework-zephyr). Overrides cuttlefish.config.ts. |
--autosar[=<mode>] | AUTOSAR C++14 compliance checking: off (default), warn, or strict. See AUTOSAR Compliance. |
--autosar-arxml | Also write the deviations sidecar as .arxml. No-op unless --autosar is warn/strict. |
--strict-css | Treat UI CSS-compatibility warnings as errors (quantized font sizes, unsupported display/position values, viewport-hogging sizes). |
cuttlefish build [options]
Build using the entry point from cuttlefish.config.ts.
cuttlefish build --compile --upload --port COM4Build options chain in order: --compile → --upload → --monitor:
| Option | Description |
|---|---|
--compile | Compile generated output via the framework toolchain. Requires a build target. |
--upload | Upload firmware to the board. Requires --compile and a port. |
--monitor | Open an interactive serial monitor after upload. Requires a port. |
--expect [file] | Run hardware tests via @typecad/expect (discover and validate over serial). For the full-featured runner, prefer cuttlefish-test. |
--build-target <id> | Framework-specific build target (the Zephyr board target; e.g. esp32s3_devkitc/esp32s3/procpu). |
--port <port> | Serial port (COM4, /dev/ttyACM0). Resolution order: --port flag → CUTTLEFISH_PORT environment variable. |
--baud <rate> | Baud rate for --monitor. If unset, the framework’s monitor default applies (115200 on Zephyr). |
--framework <pkg> | Framework package override (e.g. @typecad/framework-zephyr). |
--watch, -w | Watch for file changes and retranspile. Incompatible with --monitor. |
--diagnostics | Generate diagnostics.md and diagnostics.json (call graph, memory use, task analysis). |
--debug | Inject serial instrumentation at breakpoints from .cuttlefish/breakpoints.json (written by the TypeCAD Debug VS Code extension). At each breakpoint the firmware prints the location and in-scope variables, then halts until you press ENTER over serial. |
--force | Force the build, bypassing the cached ESLint-gate result. Setting CUTTLEFISH_NO_CACHE=1 does the same and also skips writing the cache. |
--skip-type-check | Skip the TypeScript type-check pass. |
--no-transpile | Reuse the previously generated C++ instead of re-transpiling (direct cuttlefish <input.ts> invocation only). |
⚙️ Advanced details — tree-shaking options
Tree-shaking (removing unused code) is on by default. These flags let you tune it.
| Option | Description |
|---|---|
--no-tree-shake | Disable dead-code elimination. |
--keep-unused-enums / --keep-unused-classes / --keep-unused-types / --keep-unused-variables | Retain specific unused symbols. |
--entry-point <name> | Add a custom entry-point symbol (repeatable). |
cuttlefish create [name] [options]
Create a new Cuttlefish project. Interactive on a terminal (it asks only what the flags didn’t set); piped/CI runs with a --target are non-interactive.
cuttlefish create my-project --target esp32s3_devkitc| Option | Description |
|---|---|
--target, -t <id> | Target: native, or any board from the catalog — a bare board id (esp32s3_devkitc) or a qualified Zephyr target (esp32s3_devkitc/esp32s3/procpu). Embedded targets build on the Zephyr framework. |
--board, -b <id> | Alias for --target. |
--framework, -f <id> | Framework catalog id: native or zephyr. With this flag the wizard’s framework question is skipped. |
--probe, --flash <id> | Probe/flash method (stlink, dfu, jlink, …) — what uploads and debugs the board. Validated against the board’s probe-method table. |
--port, -p <port> | Serial port the board is on (COM10, /dev/ttyACM0); written into the scaffolded config. |
--baud <rate> | Serial baud rate written into the scaffolded config (default: 115200 on Zephyr, 9600 otherwise). |
--no-starter | Skip generating the starter program. |
--no-install | Skip the automatic dependency install (npm install in the new project). By default create installs dependencies for you using the package manager it detects. |
--outDir, -o <path> | Output directory (default: ./<name>). |
cuttlefish board sync [zephyr-base] / cuttlefish board regen
The board catalog is generated from your Zephyr tree, and the project-local board module (.cuttlefish/board.ts + board.json) is generated from the catalog.
board syncrebuilds the catalog from the tree — the refresh path afterwest update. It prints what changed (added/changed/removed board variants), then regenerates the current project’s board module so the sync lands immediately. Pass an explicit path to a different Zephyr checkout to sync from.board regenre-emits the project’s board module from the active catalog. The module also regenerates automatically on build whenever any input moves (the config’sboard, the catalog, the Zephyr tree); this command refreshes it explicitly.
cuttlefish board sync
cuttlefish board regencuttlefish preview [--config <path>] [--port <port>]
Start a browser preview of the configured UI display. Uses cuttlefish.config.ts by default.
npx @typecad/ui --config
Interactive wizard that sets up a display. It asks which display you use and how it is wired, then writes the display section of cuttlefish.config.ts and a preview script into package.json. See Display Configuration.
cuttlefish doctor
Check the active framework’s environment — the framework configured in cuttlefish.config.ts provides the check; frameworks without doctor support say so.
cuttlefish doctor- Zephyr verifies
westis discoverable (PATH,ZEPHYR_BASE, a micromamba environment, or a well-known workspace), checks the Zephyr version against the supported range, and confirms the configured board target exists — suggestingwest boardswhen it doesn’t.
Run this before --compile/--upload if a build fails with a missing-toolchain or missing-core error.
cuttlefish licenses [--all] [--strict]
Audit the licenses of the libraries this project depends on. The Zephyr framework scans the kernel and every west list manifest project. By default the scan is scoped to what the project actually links; --all widens it. Each dependency’s SPDX license is resolved and classified by copyleft risk.
cuttlefish licenses
cuttlefish licenses --all # audit the whole west workspace
cuttlefish licenses --strict # exit non-zero on unknown or strong-copyleft licensesOutput sorts worst-first: strong copyleft ([COPYLEFT]), weak copyleft ([weak copyleft]), permissive (✓), then unknown (UNKNOWN). A summary line reports the count of each. Dependencies whose license can’t be determined are listed in a warnings block with their location so you can inspect them.
| Option | Description |
|---|---|
--all | Audit everything in scope, not just this project’s dependencies. Default: this project’s only. |
--strict | Exit non-zero if any dependency’s license is unknown or carries strong-copyleft terms. Useful in CI. |
⚙️ How dependency resolution works
Zephyr — the project scope is reconstructed from compile_commands.json (so build once before auditing); each west manifest project’s SPDX license is read from its source. Without a prior build, or with --all, the whole workspace is scanned.
cuttlefish library <search|install|init|validate>
The library package manager. npm keywords are the catalog — every library package carries the marker cuttlefish-library plus one category keyword, and search scans the npm registry with those terms. See Library Packages for the full picture.
cuttlefish library search # every published library (--json for machine output)
cuttlefish library search --category led # one of the 12 categories
cuttlefish library search ws2812 # free text within libraries
cuttlefish library install <pkg...> # npm install into the nearest project package.json
cuttlefish library init [name] # scaffold a new library package (interactive)
cuttlefish library validate [path] # validate a package: manifest, shims, keywords, AUTOSAR strictinit prompts for package name, framework, category, and board targets — every prompt has a flag override (--framework, --category, --targets, --dir, --yes). The scaffold passes validate as generated; exit code 1 with named errors when it doesn’t.
cuttlefish gen-decls <file.cpp|--all <dir>>
Generate TypeScript .d.ts declarations from C++ headers.
cuttlefish gen-decls src/sensor.h
cuttlefish gen-decls --all ./vendor/include--all scans a directory for C++ files; without it the argument is a single .h/.cpp file. No declaration file is created when a header declares no classes or constants.
Common workflows
cuttlefish build --compile --build-target esp32s3_devkitc/esp32s3/procpu
cuttlefish build -w --compile --upload --port COM4
cuttlefish build --diagnostics
cuttlefish create my-esp32 --target esp32s3_devkitcFor hardware tests, use the dedicated cuttlefish-test binary — see Expect Assertion API.
On This Page