Skip to content
Get Started

CLI Reference

Create the first-app starter without prompts or automatic dependency installation. Outside a project, use the create-zebric package, which creates the same starter:

Terminal window
npm create zebric@latest my-app
cd my-app
npm install
npm run validate
npm run dev

The directory defaults to .. The target must be new or empty; nonempty directories, files, and symlink destinations are refused. The generated project contains blueprint.toml, a package.json pinning the CLI version used to create it, a README, and a .gitignore. No AI credentials are needed.

For dev, validate, and audit, --blueprint <path> takes precedence. Without it, the command uses the only blueprint.toml or blueprint.json in the current directory. Both files present is an error requiring an explicit choice. Neither file present is an error with guidance to select a file or run init.

Start a development server with hot reload:

Terminal window
zebric dev --blueprint blueprint.toml --port 3000 --seed
Flag Default Description
-b, --blueprint <path> Auto-detect Path to TOML or JSON blueprint
-p, --port <number> 3000 App port; 0 selects a free port
--admin-port <number> App port + 30 Admin port; 0 selects a free port
-h, --host <host> localhost Host to bind to
--seed — Seed database with sample data

Ports must be whole numbers from 0 to 65535. With app port 0, the admin port also defaults to 0. Otherwise app port + 30 must fit in the range, or you must set --admin-port explicitly. App and admin ports must differ unless both are 0. Startup checks Blueprint validity and configured port availability before opening the database.

Validate a blueprint without starting the engine:

Terminal window
zebric validate --blueprint blueprint.toml

Returns validation errors and warnings without starting a server. Useful for CI checks.

Validate a blueprint and inspect it using deterministic static rules. No model, server, database, plugin execution, or deployment credentials are needed. Imported TOML fragments are composed using the same loader as validate.

Terminal window
zebric audit --blueprint blueprint.toml
zebric audit --blueprint blueprint.toml --format json
zebric audit --blueprint blueprint.toml --output audit.json
zebric audit --blueprint blueprint.toml --check audit.json
zebric audit --blueprint blueprint.toml --fail-on warning
Flag Default Description
-b, --blueprint <path> Auto-detect TOML or JSON blueprint
--format <text|json> text Standard output format
--output <path> — Write the JSON report
--check <path> — Compare the report with a saved JSON snapshot
--fail-on <error|warning|info|none> error Fail on findings at or above this severity

Exit status is 1 for validation or file errors, snapshot differences, or findings meeting the selected severity threshold; otherwise it is 0. --fail-on none disables only the severity gate. --output and --check are mutually exclusive. Snapshot comparison ignores JSON whitespace and object-key order, and detects both added and removed findings. A failed validation never produces an audit report.

Reports contain a format/rules version, findings with stable rule IDs, severity, composed blueprint path segments, explanations and suggestions, and severity counts. They omit timestamps, absolute source paths, and input hashes. Array indexes in paths refer to the composed blueprint. Reordering definitions can change paths.

The initial rules are:

Rule ID Severity Checks
access.implicit warning Missing entity CRUD access declarations
access.public-mutation warning Explicit true or public entity create/update/delete policies
performance.reference-index info Reference fields without a field index, uniqueness, primary key, or leading composite index
query.unbounded warning Page queries without explicit positive limits
query.offset-without-order warning Page query offsets without ordering
workflow.no-trigger warning Enabled workflows without a complete trigger
workflow.webhook-default-secret info Active webhooks relying on the default signing-secret variable
plugin.full-trust warning Enabled plugins declaring full trust

These findings flag declarations for review. They do not prove an authorization bypass, inspect deployed secrets, or replace runtime testing. Other authorization layers can restrict public entity policies; reference indexes depend on workload. Version 1 has warning and informational rules; validation handles invalid inputs. The reusable auditBlueprint(blueprint) API is exported by @zebric/runtime-core and expects an already validated, composed blueprint.

After building the CLI and its dependencies, run:

Terminal window
pnpm --filter @zebric/cli... build
pnpm audit:examples
# After reviewing intended blueprint or rule changes:
pnpm audit:examples:update
git diff -- examples/

CI checks every application directory under examples/ automatically. Each application’s root audit.json contains a versioned blueprints array of { path, report } entries for all root blueprint*.toml and blueprint*.json files, including alternate examples. Imported fragments are audited through their entrypoint. Hidden directories and __* cache directories are ignored; an application directory with no matching entrypoint fails the check.

These aggregate example snapshots differ from the single-report files produced by zebric audit --output. Use the repository scripts to check or update them. CI never updates snapshots: missing files, changed findings, removed findings, and added or removed entrypoints require an explicit, reviewed snapshot update. A matching snapshot acknowledges existing findings; it does not assert a clean audit.

Variable Description
SLACK_BOT_TOKEN Slack bot token (for Slack notification adapter)
SLACK_SIGNING_SECRET Slack webhook signing secret

API key environment variables are defined per key in [[auth.apiKeys]] using the keyEnv field.

zebric dev takes its host, port, and Blueprint path from command-line flags; it does not read HOST or PORT.

The lower-level zebric-engine binary additionally reads:

Variable Description
DATABASE_URL SQLite or PostgreSQL connection URL
ZEBRIC_RATE_LIMIT_MAX Maximum requests in one rate-limit window
ZEBRIC_RATE_LIMIT_WINDOW_MS Rate-limit window length in milliseconds

zebric-engine defaults to --host 0.0.0.0, while zebric dev defaults to localhost.

Run the repository’s internal Big Zebra benchmark harness. This command forwards remaining arguments to benchmark/cli.mjs in the current workspace and is intended for Zebric contributors rather than application deployment.

Run integration tests for example blueprints:

Terminal window
pnpm --filter @zebric/framework-stories test

Stories validate that blueprint parsing, page routing, form configuration, workflow wiring, and notification setup all remain correct.

Parse and validate a Blueprint without a model or running application:

Terminal window
zebric-agent validate [blueprint] [--workspace <root>] [--json]

The Blueprint defaults to blueprint.toml, and the workspace defaults to the current directory. The resolved path must remain inside the workspace.

Run one non-interactive agent task:

Terminal window
zebric-agent run \
--prompt <text> \
--model <provider:model> \
[--connect <url>] \
[--credential-env <name>] \
[--workspace <root>] \
[--approve-operation <operation-id>] \
[--run-id <id>] \
[--json]

--approve-operation may be repeated and requires --connect. Mutations whose exact operation ID is absent are rejected locally. --run-id requires an approved operation and contributes to deterministic idempotency keys. --credential-env names an environment variable; it never accepts the credential value directly.

With --json, success and failure are written as one JSON object. Configured application credentials are redacted from both output paths.

Code Category
0 Success
1 Internal error
2 Invalid CLI or agent configuration
3 Blueprint validation failure
4 Mutation approval rejected
5 Authentication or authorization failure
6 State or idempotency conflict
7 Incomplete execution, such as job observation timeout

See Get Started with Zebric Agent for a complete read-only invocation.