---
url: https://jetpack-desktop.github.io/publishing/cli-tools.md
description: >-
  Reference for the console jetpack developer CLI (init, env, i18n, mcp,
  codegen, validate, install-local, package) and jetpack-daemon runtime/signing
  flags.
---

# CLI Tools Reference

JetPack provides two complementary binaries, both built together by `make release-daemon` and included in every release bundle (`JetPack.app/Contents/MacOS/` on macOS, `JetPack-windows-x64.zip` on Windows, and `JetPack-linux-x64.tar.gz` on Linux):

* **`jetpack`** (`crates/jetpack-cli`) — Standalone console developer CLI for scaffolding AI-ready two-environment projects, validating DevEnv/ProdEnv manifests, running the local MCP server (`stdio`), generating TypeScript opcode contracts, and driving local installs/packaging.
* **`jetpack-daemon`** (`crates/jetpack-daemon`) — Native system-tray orchestrator and catalog operator binary.

## Console Developer CLI (`jetpack`)

### `jetpack init <target_dir> [--app-id <id>] [--dev-app-id <id>] [--template <python|fullstack>]`

Scaffolds a ready-to-run two-environment JetPack project in `<target_dir>` with AI instructions (`AGENTS.md`, regular-file mirror `CLAUDE.md`, `.cursor/rules/jetpack.mdc`), Agent Skills (`.agents/skills/create-jetpack-worker/SKILL.md`, `.agents/skills/add-binary-opcode/SKILL.md`, `.agents/skills/add-translations/SKILL.md`, `.agents/skills/debug-pairing/SKILL.md`), DevEnv/ProdEnv manifests (`app.toml`, `app.dev.toml`, `.env.development`, `.env.production`), starter i18n (`locales/en.json` and `createI18n` in `fullstack`), and cross-platform `npm` scripts inside `package.json`. Refuses to overwrite an existing `app.toml`.

```bash
# Python worker starter (default)
jetpack init ./workers/my-ocr-worker --app-id com.acme.my-ocr-worker --template python

# Fullstack TypeScript (@jetpack-desktop/client) + Python worker starter with custom DevEnv ID
jetpack init ./apps/my-ai-app --app-id com.acme.my-ai-app --dev-app-id com.dev.my-ai-app --template fullstack
```

### `jetpack env <init|check>`

Manages DevEnv (`app.dev.toml`, `.env.development`) and ProdEnv (`app.toml`, `.env.production`) overlays without touching `app.toml`:

* `jetpack env init [path] [--dev-app-id <id>] [--prod-app-id <id>] [--force]` — Generates `app.dev.toml`, `.env.development`, and `.env.production` for an existing project (refusing to overwrite existing files unless `--force` is passed).
* `jetpack env check [path]` — Resolves and validates both **ProdEnv** (`app.toml`) and **DevEnv** (`app.toml` + `app.dev.toml`), checks `.env.*` alignment, and verifies that DevEnv and ProdEnv resolve to distinct `package.id` values to prevent `APP_SPOOFING_DETECTED`.

```bash
jetpack env init ./workers/my-ocr-worker
jetpack env check ./workers/my-ocr-worker
```

### `jetpack i18n <init|add|check|sync>`

Manages flat JSON translation catalogs (`locales/*.json`) in pure Rust with English (`locales/en.json`) as the canonical base catalog:

* `jetpack i18n init [path] [--locales-dir <dir>] [--force]` — Creates starter `locales/en.json` (defaults `--locales-dir` to `locales`). Refuses to overwrite unless `--force` is passed.
* `jetpack i18n add <lang> [path] [--locales-dir <dir>] [--force]` — Validates and normalizes `<lang>` to its lowercase ASCII primary BCP-47 subtag (e.g. `uk-UA` → `uk`, rejecting `en`, path traversal, and invalid tags) and creates or tops up `locales/<lang>.json` from `locales/en.json`.
* `jetpack i18n check [path] [--locales-dir <dir>] [--strict]` — Validates valid flat `Record<string, string>` JSON, non-empty `en.json` values, orphan keys, and identical `{placeholder}` tokens across all secondary catalogs. Missing or empty keys in secondary locales emit warnings by default, or fail non-zero when `--strict` is passed.
* `jetpack i18n sync [path] [--locales-dir <dir>] [--prune]` — Synchronizes secondary `<lang>.json` catalogs against `en.json` in sorted key order, preserving existing non-empty translations and optionally removing orphan keys with `--prune`.

```bash
jetpack i18n init .
jetpack i18n add uk .
jetpack i18n check . --strict
jetpack i18n sync . --prune
```

### Unified Developer `npm` Scripts (`package.json`)

Every project scaffolded by `jetpack init` or `jetpack-daemon --init-app` (both `python` and `fullstack` templates) includes a cross-platform `package.json` runnable identically on macOS, Linux, and Windows (`cmd.exe` / PowerShell):

| Script | Underlying Command | Purpose |
| :--- | :--- | :--- |
| `npm run sdk:install` | Cross-platform `uv sync` (or `pip install -e .`) + `npm install` (in `fullstack`) | Install Python and TypeScript SDK dependencies. |
| `npm run sdk:update` | `uv sync --upgrade-package jetpack-sdk` + `npm update @jetpack-desktop/client` (in `fullstack`) | Upgrade JetPack worker and frontend SDKs. |
| `npm run validate` | `jetpack validate --env dev` | Validate merged DevEnv (`app.toml` + `app.dev.toml`). |
| `npm run validate:prod` | `jetpack validate --env prod` | Validate strict ProdEnv (`app.toml` only). |
| `npm run env:check` | `jetpack env check` | Verify DevEnv/ProdEnv parity and non-colliding `package.id`. |
| `npm run i18n:check` | `jetpack i18n check .` | Validate `locales/en.json` and secondary translation catalogs. |
| `npm run i18n:sync` | `jetpack i18n sync .` | Synchronize missing keys cleanly across `locales/*.json`. |
| `npm run codegen` | `jetpack codegen --worker worker.py --out ...` | Generate strict `JetPackOpcodeMap` TypeScript contracts. |
| `npm run typecheck` | `tsc --noEmit` *(fullstack template)* | Type-check frontend TypeScript against `JetPackOpcodeMap`. |
| `npm run install:local` | `jetpack install-local . --env dev` | Install DevEnv worker into local user-space CAS without spoofing collisions. |
| `npm run dev` | `jetpack validate --env dev && jetpack install-local . --env dev` *(+ `typecheck` in fullstack)* | Validate and refresh local DevEnv install during iteration. |
| `npm run build` | `jetpack validate --env prod` *(+ `typecheck` in fullstack)* | Verify production manifest and types before packaging. |
| `npm run package` | `jetpack validate --env prod && jetpack package . --out dist/oci` | Build ProdEnv OCI Image Layout v1.0.0 bundle (stripping `app.dev.toml` and `.env*`). |

### `jetpack mcp`

Starts the local Model Context Protocol (MCP) server (`rmcp`) over `stdio` transport (`stdin`/`stdout` JSON-RPC, all `tracing` diagnostics directed to `stderr`). Bridges AI coding agents with embedded/local documentation (`JETPACK_DOCS_DIR` override supported) and token-authenticated `jetpack-daemon` introspection (`pairing.ipc`).

Exposes 5 tools:

* `search_docs(query, max_results?)` — Searches embedded/local JetPack SDK, security, and `app.toml` docs.
* `get_daemon_status()` — Checks daemon health, version, `127.0.0.1` WebSocket reachability, paired origins, and running workers.
* `read_worker_logs(app_id, lines?)` — Tails live or offline `worker.log` / `daemon.log` lines and crash tracebacks with sensitive token/key redaction.
* `validate_manifest(path, env?)` — Validates `app.toml` against `AppManifest` (`env = "prod"`, default) or merges `app.dev.toml` (`env = "dev"`), returning `env`, optional `dev_overlay_path`, `models`, `services`, `volumes`, `runtimes`, `gpu_access`, and `model_cache`.
* `scaffold_app(target_dir, app_id?, dev_app_id?, template?)` — Scaffolds a two-environment `python` or `fullstack` project with DevEnv/ProdEnv files, `package.json` scripts, AI rules, and Agent Skills.

### `jetpack codegen [--worker <path>] [--out <path>] [--strict]`

Parses Python worker source files or directories in pure Rust (`rustpython-parser`, zero Python runtime required) to extract Pydantic `BaseModel`, `TypedDict`, `@dataclass`, `@opcode(...)` / `client.opcode(...)` handlers, and `if opcode == ...` / `match` branches into a strict TypeScript declaration file (`jetpack-env.d.ts` exporting `JetPackOpcodeMap`):

```bash
jetpack codegen --worker worker.py --out src/jetpack-env.d.ts --strict
```

* `--worker <path>`: Python file or directory to inspect (defaults to `worker.py`).
* `--out <path>`: Output TypeScript `.d.ts` file path (defaults to `jetpack-env.d.ts`).
* `--strict`: Exit non-zero if zero opcodes are discovered.

### `jetpack validate [path] [--env <prod|dev>]`

Validates `app.toml` (defaults to `app.toml` in the current directory, or `<dir>/app.toml` when a directory path is passed) using `#[serde(deny_unknown_fields)]` and semantic security checks. Pass `--env dev` to merge and validate `app.dev.toml` (default is `prod`):

```bash
jetpack validate ./workers/my-ocr-worker --env dev
jetpack validate ./workers/my-ocr-worker/app.toml --env prod
```

### `jetpack install-local [path] [--env <dev|prod>]`

Delegates to `jetpack-daemon --install-local-app <path> --env <dev|prod>` to package and install a local developer worker (including any built `ui/` static directory) directly into `<root>/blobs/sha256/` and `<root>/apps/<app-id>/<version>/` in unverified developer mode (`is_verified = false`, restricted to `127.0.0.1` / `localhost`). Defaults `path` to `.` and automatically selects `dev` when `app.dev.toml` is present (unless `--env prod` is explicitly passed).

### `jetpack package [path] --out <bundle_dir> [--oci-ref <ref>] [--env <prod|dev>]`

Delegates to `jetpack-daemon --package-app` to package a validated project—alongside its built `ui/` static frontend (`ui/index.html`, `ui/assets/*`) if present—into an OCI Image Layout v1.0.0 bundle (defaults to `--env prod`; automatically excluding `app.dev.toml`, `.env`, `.env.*`, `AGENTS.md`, `CLAUDE.md`, `.cursor/`, `.agents/`, `jetpack-env.d.ts`, `node_modules/`, `target/`, `.git/`, `.venv/`, `__pycache__/`, symlinks, and secret files). Defaults `path` to `.`.

***

## Daemon Developer & Publisher Flags (`jetpack-daemon`)

### `--init-app <target_dir>`

Scaffolds a ready-to-run starter Python worker project in `<target_dir>` using the same shared template builder as `jetpack init` (including `app.toml`, `app.dev.toml`, `.env.development`, `.env.production`, `package.json` developer scripts, `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/jetpack.mdc`, and `.agents/skills/`, refusing to overwrite an existing `app.toml`):

```bash
jetpack-daemon --init-app ./workers/my-ocr-worker
```

Creates:

* `app.toml` — Validated ProdEnv starter manifest.
* `app.dev.toml` — Strict DevEnv partial overlay using a non-official `com.dev.<slug>` ID (`com.dev.my-ocr-worker-dev`).
* `.env.development` and `.env.production` — Frontend environment defaults (`VITE_JETPACK_ENV`, `VITE_JETPACK_APP_ID`, `VITE_JETPACK_DAEMON_PORT`).
* `package.json` — Cross-platform unified developer `npm` scripts (`validate`, `env:check`, `install:local`, `dev`, `package`, `sdk:install`, `sdk:update`).
* `worker.py` — Executable (`0755` on Unix) Python worker using `jetpack_sdk.JetPackClient`.
* `pyproject.toml` — Project metadata (`requires-python = ">=3.12"`, `jetpack-sdk` dependency).
* `README.md` — Project-specific validation, DevEnv/ProdEnv, local install, and packaging commands.
* `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/jetpack.mdc`, and `.agents/skills/*` — AI agent instructions and workflows (automatically excluded from OCI packaging).

### `--validate-manifest <path> [--env <prod|dev>]`

Parses `app.toml` (and merges sibling `app.dev.toml` when `--env dev` is passed) with `#[serde(deny_unknown_fields)]` and runs all semantic and security checks:

```bash
jetpack-daemon --validate-manifest ./workers/my-ocr-worker/app.toml --env dev
```

### `--install-local-app <source_dir> [--env <dev|prod>]`

Validates, packages, and installs a local developer worker (plus any `ui/` bundle) directly into `<root>/blobs/sha256/` and `<root>/apps/<app-id>/<version>/` in unverified developer mode (`is_verified = false`):

```bash
jetpack-daemon --install-local-app ./workers/my-ocr-worker --env dev
```

* Automatically uses DevEnv (`app.dev.toml`, falling back to `derive_dev_app_id`) when `app.dev.toml` exists or `--env dev` is passed, preventing `APP_SPOOFING_DETECTED` collisions against already-published `SignedAppCatalog` apps.
* Still strictly blocks official `SignedAppCatalog` IDs (`APP_SPOOFING_DETECTED`) whenever the effective ID matches the signed catalog.
* Displays the app with an `UNVERIFIED / LOCAL DEV` badge in Control Center, automatically discovers `<root>/apps/<app-id>/<version>/ui/index.html` for `/apps/<app-id>/`, and restricts WebSocket origins to `127.0.0.1` / `localhost`.

### `--package-app <source_dir> --out <bundle_dir> [--oci-ref <ref>] [--env <prod|dev>]`

Packages a validated worker directory (including optional `ui/` static assets served dynamically at `/apps/<app-id>/`) into an ORAS-compatible **OCI Image Layout v1.0.0** directory (`index.json` with `org.opencontainers.image.ref.name`, defaulting to `--env prod`) and prints `manifest_sha256`, the `oras cp --from-oci-layout` push command, `oras manifest fetch --descriptor` digest check, and a `CatalogAppEntry` JSON snippet (including computed `install_size_bytes`, `install_size_approximate`, and mapped `models` disclosures from `app.toml`):

```bash
jetpack-daemon \
  --package-app ./workers/my-ocr-worker \
  --out ./dist/my-ocr-worker-oci \
  --oci-ref ghcr.io/your-org/my-ocr-worker:0.1.0 \
  --env prod
```

Automatically strips `app.dev.toml`, `.env`, `.env.*`, `*.key`, `*.pem`, `*.secret`, `jetpack-root-signing*`, `node_modules/`, `target/`, `.git/`, `.venv/`, `__pycache__/`, and symlinks so local development overrides, build caches, secrets, and unsafe links cannot leak into published layers.

## Catalog Operator Commands

### `--generate-catalog-keypair --out-priv <path>`

Generates an `Ed25519` root keypair using `OsRng`:

```bash
jetpack-daemon --generate-catalog-keypair --out-priv ~/.secrets/jetpack-root-signing.key
```

* Writes the 32-byte seed (64 lowercase hex characters) atomically (`create_new(true)`) with mode `0600` on Unix.
* Prints only the public key hex and the Rust `CATALOG_VERIFY_PUBKEY` literal to stdout.

### `--sign-catalog <catalog_json_path> [--key <priv_key_path>]`

Canonicalizes `SignedAppCatalog`, signs it with `Ed25519` (reading `--key` or `JETPACK_SIGNING_KEY`), writes `ed25519_signature` atomically, and immediately re-verifies the file from disk:

```bash
jetpack-daemon --sign-catalog crates/jetpack-daemon/assets/catalog.signed.json --key ~/.secrets/jetpack-root-signing.key
```

## Runtime, Inspection & Diagnostic Flags

| Flag | Purpose |
| :--- | :--- |
| `--version, -V` | Print the compiled `jetpack-daemon` semantic version and exit cleanly. |
| `--headless` | Run `jetpack-daemon` without a desktop system tray icon (CI / server). |
| `--seed-core-apps` | Package and pre-install curated core workers from `examples/` (e.g., slim release bundle `examples/ffmpeg-media-converter`, excluding `.venv`, `__pycache__`, `tests`, and media files) into CAS and `<root>/apps/`. |
| `--export-diagnostics [--out <path>]` | Collect a sanitized `.zip` diagnostic bundle (`diagnostics.json` + redacted `daemon.log` tail) and write it to `<path>` or `<root>/logs/jetpack-diagnostics-<timestamp>.zip`. |
| `--print-hardware-profile` | Probe CPU topology, RAM/unified memory, and GPUs (`NVML`, `Vulkan`, `DX12`, `Metal`). |
| `--list-paired-clients` | List approved origins and client UUIDs stored in `paired_clients.db`. |
| `--list-installed-apps` | Scan `<root>/apps/` and print discovered manifests and versions. |
| `--register-uri-scheme` | Register `jetpack://` and `corenode://` custom URL schemes in user space. |
| `--generate-test-pair-uri` | Print a deterministic test `jetpack://pair` URI and SHA-256 fingerprint. |
| `--test-ws-client` | Connect to a running daemon (`127.0.0.1:9470`) to verify PNA, handshake, and `system.echo` (supports `--send-json` and `--origin`). |
| `--ws-smoke-test` | Run offline end-to-end WebSocket security and `hardware.get_profile` smoke test. |
| `--oci-smoke-test` | Run offline OCI CAS, SHA-256 verification, and hardlink/APFS clone smoke test. |
| `--oci-remote-smoke-test <ref> [--expected-digest <sha256:...>]` | Pull a live public OCI reference (such as `ghcr.io/...`), verify manifest + blob SHA-256 digests, and safely unpack into an isolated temporary CAS root. |
| `--python-smoke-test` | Run offline hermetic `uv` + `python-build-standalone` provisioner smoke test. |
| `--sandbox-smoke-test` | Run offline OS native kernel sandbox (`AppContainer` / `Seatbelt` / `bwrap+Landlock`) smoke test. |
| `--worker-ipc-smoke-test` | Run offline sandboxed worker IPC, userspace proxy, and lifecycle cleanup smoke test. |
| `--full-e2e-smoke-test` | Run the full end-to-end orchestrator, sandbox, GPU worker, and WebSocket integration test. |
| `--background` | Hidden internal flag omitted from `--help`; passed by OS autostart entries (`LaunchAgents`, `HKCU\...\Run`, XDG `.desktop`) to suppress auto-opening the Control Center window at OS login. |
| `--cleanup-old-binary <path>` | Hidden internal post-update flag spawned by the self-updater; validates a `.old` suffix and removes the previous binary or `.app.old` bundle asynchronously (`10 × 200ms` retries). |
