Moose CLI Reference
Installation
bash -i <(curl -fsSL https://fiveonefour.com/install.sh) mooseGlobal Flags
These flags apply to all commands:
--backtrace: Print backtraces for all errors (same as RUST_LIB_BACKTRACE=1)-d, --debug: Turn debugging information on
Setup
Init
Initialize a new project.
moose init <name> [template] [--location <location>] [--from-remote [<connection-string>]] [--custom-dockerfile] [--no-fail-already-exists]<name>: Name of your app or service[template]: Template to use. Runmoose template listto see the catalog. Omit to pick interactively.--location, -l: Location for your app or service--from-remote: Initialize from a remote database--custom-dockerfile: Generate a custom Dockerfile at project root--no-fail-already-exists: Allow init in an existing directory
Harness Init
Initialize a project and set up the developer harness in one flow.
moose harness init
moose harness init <name> <template> [--location <location>] [--agent <agent>] [--from-remote <connection-string>] [--lsp | --no-lsp] [--branch <name>] [--no-fail-already-exists] [--custom-dockerfile]- Zero-arg
moose harness initstarts the interactive wizard. - Arg-driven mode is non-interactive: if you pass flags or positionals, omitted values fall back to defaults.
--agent: Target specific coding agents instead of auto-detecting (repeatable)--name <name>: Explicit project name. Use this when the name would otherwise conflict with a subcommand likeschema.--template <template>: Explicit template name. Use this with--namewhen positional parsing would be ambiguous.--from-remote <connection-string>: Initialize from a remote ClickHouse database--lsp: Install and configure MooseStack LSP (default)--no-lsp: Skip MooseStack LSP installation/configuration--branch <name>: Git branch of the agent-skills repo to install from (default: main)--no-fail-already-exists: Allow init in an existing directory--custom-dockerfile: Generate a custom Dockerfile at project root--input <path>: Read structured JSON input from a file, or use-for stdin
For automation, inspect the versioned input contract:
moose harness init schema --jsonExamples:
moose harness init my-app typescript --agent codex
moose harness init --name schema --template typescript --agent none
moose harness init my-app python-empty --location ./sandbox
moose harness init --input request.json
cat request.json | moose harness init --input -Template List
List available templates for project initialization.
moose template list [--json]Component List
List available components you can add to your project.
Note: This command is experimental. Component APIs and available components may change in future releases.
moose component listAdd
Add a pre-built component to an existing project.
Note: This command is experimental. Component APIs and available components may change in future releases.
moose add <component> [--dir <path>] [--overwrite] [--yes]Components:
mcp-server: MCP server with ClickHouse query tools at /toolschat: AI chat panel for Next.js (requires an MCP server)benchmark: Query benchmark package for a TypeScript Moose project
Flags:
--dir, -d: Target directory (defaults to current directory)--overwrite: Replace files that already exist--yes, -y: Skip confirmation prompts
Examples:
moose add mcp-server --dir packages/moosestack-service
moose add chat --dir packages/web-app
moose add benchmark --dir mooseDevelop
Dev
Start a local development environment with hot reload and automatic infrastructure management.
Prerequisites: Install project dependencies before running moose dev:
- TypeScript:
npm installorpnpm install - Python:
pip install -r requirements.txt
moose dev [--mcp] [--agent] [--no-infra] [--dockerless] [--timestamps] [--timing] [--log-payloads] [--yes-all] [--yes-destructive] [--yes-rename]--mcp: Enable or disable the MCP server (default: true). Provides AI-assisted development tools athttp://localhost:4000/mcp. See MCP Server documentation.--agent: Agent-driven mode. Confirmation prompts (destructive changes, column renames, version bumps) are answered via the MCPrespond_to_prompttool instead of stdin. Implies--mcp. Can also be set viaMOOSE_AGENT=1.--no-infra: Skip starting local infrastructure--dockerless: Use native binaries for ClickHouse and Temporal instead of Docker--timestamps: Show HH:MM:SS.mmm timestamps on all output lines--timing: Show elapsed time for operations (e.g., "completed in 234ms")--log-payloads: Log payloads at ingest API and streaming functions for debugging--yes-all: Skip all confirmation prompts (renames, destructive operations, and version bump decisions). Can also be set viaMOOSE_ACCEPT_ALL=1.--yes-destructive: Auto-approve destructive operations (including old table drops from version bumps). Can also be set viaMOOSE_ACCEPT_DESTRUCTIVE=1.--yes-rename: Auto-approve column renames. Can also be set viaMOOSE_ACCEPT_RENAME=1.
When a version bump is detected (a version field change on an OlapTable), moose dev prompts for backfill and old-table retention decisions before applying the change. In --agent mode, these prompts are published to the MCP server and must be answered by calling the respond_to_prompt tool.
When debugging slow hot reloads, use --timing to identify which operation is the bottleneck; use --timestamps to correlate events across runs.
Running in background:
nohup moose dev &Build
Build your Moose project.
moose build [--docker] [--amd64] [--arm64]--docker, -d: Build for Docker--amd64: Build for amd64 architecture--arm64: Build for arm64 architecture
Check
Check the project for non-runtime errors.
moose check [--write-infra-map]--write-infra-map: Write the infrastructure map to disk
Clean
Clear temporary data and stop development infrastructure.
moose cleanProd
Start a production environment.
moose prod [--start-include-dependencies]--start-include-dependencies: Include and manage dependencies (ClickHouse, Redpanda, etc.) using Docker containers
MCP
Run an MCP proxy server for AI agents. Provides a stdio interface that proxies to the Moose dev server's MCP endpoint.
moose mcp [--host <host>] [--port <port>]--host: Host of the dev server to proxy to (auto-detected from project config if omitted)--port: Port of the dev server to proxy to (auto-detected from project config if omitted)
Data
Query
Execute SQL queries against ClickHouse.
moose query [<query>] [-f <file>] [-l <limit>] [-c <language>] [-p]<query>: SQL query string (optional if using--fileor stdin)-f, --file <PATH>: Read query from file-l, --limit <NUM>: Maximum rows to return (default: 10000)-c, --format-query <LANGUAGE>: Format query as code literal (python|typescript). Skips execution.-p, --prettify: Prettify SQL before formatting (requires--format-query)
Examples:
moose query "SELECT count(*) FROM users"
moose query -f queries/analysis.sql
cat query.sql | moose query
moose query -c python -p "SELECT id, name FROM users WHERE active = 1 ORDER BY name"Requirements: Requires moose dev to be running. Returns results as newline-delimited JSON.
Peek
View data from a table or stream.
moose peek <name> [-l <limit>] [-f <path>] [-t|--table] [-s|--stream]<name>: Name of the table or stream to peek-l, --limit: Number of rows to view (default: 5)-f, --file: Output to a file-t, --table: View data from a table-s, --stream: View data from a stream/topic
Seed
Seed your local ClickHouse from a remote ClickHouse instance.
moose seed clickhouse [--clickhouse-url <URL>] [--table <name>] [--limit <n> | --all] [--order-by <clause>] [--report]--clickhouse-url: Remote ClickHouse connection URL. Alias:--connection-string. Falls back toMOOSE_SEED_CLICKHOUSE_URLenv var.--table: Only seed a specific table--limit: Maximum rows to copy per table (mutually exclusive with--all)--all: Copy all rows, ignoring limit (mutually exclusive with--limit)--order-by: ORDER BY clause for the seed query--report: Show row counts after seeding (default: true)
Truncate
Truncate tables or delete the last N rows.
moose truncate [TABLE[,TABLE...]] [--all] [--rows <n>]TABLE[,TABLE...]: One or more table names (comma-separated). Omit to use--all.--all: Apply to all non-view tables in the current database--rows <n>: Number of most recent rows to delete per table. Omit to delete all rows (TRUNCATE).
Refresh
Integrate tables from a remote Moose instance.
moose refresh [--url <url>] [--token <token>]--url: Remote Moose instance URL (default: http://localhost:4000)--token: API token for the remote Moose instance
DB Pull
Import external database schemas. Refreshes EXTERNALLY_MANAGED table definitions from a remote ClickHouse instance.
moose db pull [--clickhouse-url <URL>] [--file-path <path>]--clickhouse-url: ClickHouse connection URL (e.g.,clickhouse://user:pass@host:port/database)--file-path: Output file for external table definitions (defaults toapp/externalModels.tsorapp/external_models.py)
See the full guide: DB Pull
Kafka Pull
Discover topics from a Kafka/Redpanda cluster and optionally fetch JSON Schemas from Schema Registry to generate typed external models.
moose kafka pull <bootstrap> [--path <PATH>] [--include <glob>] [--exclude <glob>] [--schema-registry <URL>]<bootstrap>: Kafka bootstrap servers (e.g.,localhost:19092)--path: Output directory for generated files--include: Include pattern (glob, default:*)--exclude: Exclude pattern (glob, default:{__consumer_offsets,_schemas})--schema-registry: Schema Registry base URL (e.g.,http://localhost:8081)
Workflows
Run
moose workflow run <name> [--input <json>]<name>: Name of the workflow to run--input, -i: JSON input parameters for the workflow
Resume
moose workflow resume <name> --from <task><name>: Name of the workflow to resume--from: Task to resume from
List
moose workflow list [--json]History
moose workflow history [--status <status>] [--limit <n>] [--json]--status, -s: Filter by status (running, completed, failed)--limit, -l: Number of workflows shown (default: 10)
Status
moose workflow status <name> [--id <run-id>] [--verbose] [--json]<name>: Name of the workflow--id: Run ID (defaults to most recent)--verbose: Verbose output
Cancel
moose workflow cancel <name>Pause / Unpause
moose workflow pause <name>
moose workflow unpause <name>Deploy
Plan
Preview infrastructure changes for next deployment.
For Moose Server deployments:
moose plan [--url <url>] [--token <token>] [--json]--url: Remote Moose instance URL (default: http://localhost:4000)--token: API token for the remote Moose instance--json: Output plan as JSON
For serverless deployments:
moose plan --clickhouse-url <url>--clickhouse-url: ClickHouse connection URL
Migrate
Execute a migration plan against a remote ClickHouse database.
moose migrate [--clickhouse-url <url>] [--redis-url <url>] [--validate]--clickhouse-url: ClickHouse connection URL--redis-url: Redis connection URL for state storage--validate: Validate migration files without executing them. Checks delta sequence consistency and detects semantic conflicts. Does not require ClickHouse or Redis.
Generate Dockerfile
Generate a Dockerfile without building Docker images.
moose generate dockerfileRequires custom_dockerfile = true in moose.config.toml.
Generate Hash Token
Generate an API key hash and bearer token pair for authentication.
moose generate hash-token [--json]Generate Migration
Create an ordered ClickHouse DDL plan by comparing a remote instance with your local code.
moose generate migration [--url <url> --token <token> | --clickhouse-url <url>] [--redis-url <url>] [--save] [--yes-all] [--yes-destructive] [--yes-rename] [--no-auto-backfill-sql] [--agent]Connection options (one required):
--url+--token: Connect to a running Moose server--clickhouse-url: Connect directly to ClickHouse (for serverless). Also requires--redis-urlwhenstate_config.storage = "redis".
All connection flags accept env var fallbacks: MOOSE_CLICKHOUSE_CONFIG__URL for --clickhouse-url and MOOSE_REDIS_CONFIG__URL for --redis-url.
Output options:
--save: Save migration files to themigrations/directory. Omit to output plan YAML to stdout.
Confirmation flags:
--yes-all: Skip all confirmation prompts (renames, destructive operations, and version bump decisions). Can also be set viaMOOSE_ACCEPT_ALL=1.--yes-destructive: Auto-approve destructive operations (including old table drops from version bumps). Can also be set viaMOOSE_ACCEPT_DESTRUCTIVE=1.--yes-rename: Auto-approve column renames. Can also be set viaMOOSE_ACCEPT_RENAME=1.--no-auto-backfill-sql: Disable automatic backfill SQL generation for versioned tables.--agent: Agent-driven mode. Confirmation prompts are answered via the MCPrespond_to_prompttool instead of stdin. A lightweight MCP server is started automatically. Can also be set viaMOOSE_AGENT=1.
When a version bump is detected, the CLI prompts for backfill and old-table retention. In --agent mode, these prompts are published to the MCP server. When --save is used and you choose to keep the old table, Moose generates a retained table file with LifeCycle.EXTERNALLY_MANAGED in your source directory.
Requires OLAP to be enabled in moose.config.toml:
[features]olap = trueObserve
Ls
List the project's Moose resources with queryable names and hittable URLs.
moose ls [--type <type>] [--name <name>] [--json]Renders a table per resource type: tables (database-qualified name + schema fields, pastable into moose query), streams, ingestion_apis (name, HTTP method, full URL, destination topic), consumption_apis (name, HTTP method, full URL, query params), sql_resources, stream_transformations, workflows, web_apps (name, full URL, mount path), and dictionaries. URLs are composed from the dev server's host/port in moose.config.toml.
--type: Filter by infrastructure type. One of:tables,streams,ingestion,consumption,sql_resource,stream_transformations,workflows,web_apps,dictionaries. Omit to list every type.--name: Filter by name (supports partial matching; matches the rendered display name — e.g.db.foofor a table pinned to a non-default database)--json: Output in JSON format
Ps
View Moose processes.
moose psLogs
View Moose logs.
moose logs [--tail] [--filter <search_string>]-t, --tail: Follow logs in real-time-f, --filter: Filter logs by a specific string
Metrics
Open the live metrics console.
moose metricsHelp
Docs
Browse and search documentation in the terminal.
moose docs [<slug>] [-l <LANG>] [--raw] [--expand] [--web]<slug>: Documentation page slug (e.g.,moosestack/olap). Omit to show the table of contents. Slugs are case-insensitive.-l, --lang <LANG>: Language:typescript(ts) orpython(py). Auto-detected from your project.--raw: Output raw content without formatting (for piping to other tools)--expand: Show full expanded tree with all leaf pages--web: Open documentation page in your web browser
Subcommands:
moose docs browse [--web]: Interactively browse and select a documentation pagemoose docs search <query> [--expand]: Search documentation by title or description. Use--expandto also search within page headings.
Guide section navigation:
moose docs guides/chat-in-your-app#overview
moose docs guides/chat-in-your-app#setupUse with AI clients:
moose docs --raw guides/chat-in-your-app#setup | claude "do this step, ask me any questions you need to execute"This pattern works with any AI client that accepts stdin, allowing you to get AI assistance on specific documentation sections.
Feedback
Submit feedback or report issues.
moose feedback [message] [--email <email>] [--bug] [--community][message]: Feedback message (e.g.,moose feedback "loving the DX!")--email: Your email address for follow-up--bug: Report a bug (opens GitHub Issues with system info and log paths)--community: Join the Moose community on Slack