Tooling & production/CLI, Diagnostics & AX

CLI, Diagnostics & AX

Complete CLI command and flag reference, diagnostic code catalog, and agent-experience (AX) inspection and MCP tools.

axgithub.com/fletchhq/fletch/ax· fletch docs show cli-and-ax

On this page

The fletch CLI handles project scaffolding, live-reloading development, code generation, static verification, database and job operations, production builds, and structured agent-experience (AX) inspection.

Project and Build Commands

Command Flags Purpose
fletch new <name> --dir, --module, --fletch-path, --single-config, --js esbuild|importmap|vite, --pm npm|pnpm|bun Scaffold a new modular-monolith Fletch application.
fletch dev --addr, --dashboard-addr, --no-dashboard, --https, --store-dir, --tidy Run the dev server with file watching, codegen, asset rebuilds, and the loopback dev dashboard.
fletch build -o, --os, --arch, --ldflags, --tags, --skip-assets, --json Run fletch gen, build assets into public/dist, and compile a CGO_ENABLED=0 binary.
fletch upgrade --dry-run, --json, --to, --adopt, --write-conflicts Three-way merge scaffold updates against .fletch/scaffold.json without overwriting user edits.
fletch assets build --src resources, --out public/dist Build frontend assets standalone from resources into public/dist.

Generators, Codegen, and Static Checks

Command Flags Purpose
fletch make <kind> <name...> --json, --force Scaffold code for module, handler, live, job, command, policy, migration, seeder, or email.
fletch gen [dir...] Compile .crest templates, generate Nock schema_gen.go files, and refresh command/route artifacts.
fletch gen openapi --out openapi.json Generate an OpenAPI 3.1 specification statically from your registered routes and types.
fletch check --json, --cold-plugins, --go=false Run all static analyzers: route conflicts, auth guards, Crest/Alpine lints, module boundaries, schema drift, OpenAPI staleness, and Go compilation.

Database, Config, Storage, Jobs, State, and Docs

Command Subcommands / Flags Purpose
fletch db generate, migrate, rollback, status, fresh, seed Diff Nock schemas into SQL migrations, run/roll back migrations, check migration status, reset local DBs, and run seeders.
fletch config show, check, env-example Inspect active layered config, validate config files, and emit .env.example.
fletch credentials init, edit, show Create, edit, and view AES-256-GCM encrypted credentials files.
fletch storage ls, stat, put, get, rm, sign Inspect objects, upload/download files, delete keys, and generate signed URLs on configured storage disks.
fletch jobs list, stats, retry, cancel, pause, resume Inspect and manage Quiver queues and jobs from the terminal.
fletch state plan [dir] --baseline, --fail-on-remount, --write-manifest Compare Live component state layouts against a baseline manifest to catch breaking remounts before deployment.
fletch docs [list|show|path|search] Browse and search embedded offline Fletch documentation.

App Binary Commands

Every compiled Fletch binary includes built-in subcommands alongside any custom commands you define under commands/:

./app serve
./app migrate
./app work
./app routes
./app jobs
./app help

During development, you can invoke any built-in or custom app command through the global CLI without building manually first:

fletch app <cmd>

AX, MCP, and LSP

Fletch exposes structured machine-readable inspection of your running or compiled app for editors, CI checks, and coding agents.

fletch ax inspect

Inspect the full application graph or focus on a single section:

fletch ax inspect --json
fletch ax inspect routes --json

Supported section arguments:

Section Output
subsystems Configured subsystems (includes alpine when Alpine is enabled).
routes Registered HTTP routes, methods, patterns, names, and auth posture.
live Live component mounts, events, and state metadata.
components Crest templates and UI components.
jobs Registered Quiver job types, queues, and schedules.
pubsub PubSub topics, subscribers, and broker backend.
storage Configured storage disks and drivers.
config Layered config schema and redacted values.
assets Asset pipeline configuration and manifest entries.
images Image transform presets and pipeline settings.
elements Registered custom Crest elements and plugins.
commands Built-in and custom CLI commands discovered in commands/.

fletch ax sync, fletch mcp, and fletch lsp

  • fletch ax sync writes AGENTS.md, CLAUDE.md, local skills, .mcp.json, and the docs index so external tools stay aligned with your app layout.
  • fletch mcp starts Fletch’s compact Model Context Protocol server over stdio for live inspection, checks, and offline doc lookup.
  • fletch lsp runs the language server for .crest templates, Go integration, and inline diagnostics in your editor.

Diagnostic Code Reference

fletch check, fletch dev, and the Live runtime emit structured diagnostic codes. Pass --json to fletch check to consume them programmatically in CI or editors.

Routes

Code Condition
W0101 Duplicate route name.
W0102 Duplicate HTTP method and path.
W0103 Invalid route pattern syntax.
W0104 Overlapping route patterns.

Auth

Code Condition
W0201 Handler is missing Authorize or fletch.Public, or has an ambiguous auth mixin.
W0207 Trivial Authorize implementation returning nil unconditionally.

Crest and Alpine

Code Condition
W0300–W0312 Template syntax, signal, handler binding, and form checks.
W0313 Dynamic JavaScript or Alpine directive injection risk.
W0314 PCI card-name lint triggered on Live payment input fields.
W0315 Standard Alpine build enabled without 'unsafe-eval' permitted by CSP.
W0330–W0344 Crest plugin registration, compilation, and execution diagnostics.

Assets and Islands

Code Condition
W0401 Missing asset() reference in template or code.
W0402 Dev asset build error.
W0501–W0503 Island import boundary violations and bundle size budget warnings/errors.

Modules and Schema

Code Condition
W0510 Cross-module internal import violation.
W0511 Cross-module table or schema access violation.
W0512 Module directory exists under modules/ but is not mounted on the app.
W0513 Nock schema drift between schema.go definitions and migration snapshots.
W0514 Stale OpenAPI specification relative to current routes and types.
W0515 Invalid Nock schema definition.

Config

Code Condition
W0601 YAML parse error in a configuration file.
W0602 Configuration load, environment interpolation, or validation failure.

Dev and Live Runtime

Code Condition
W0403 Dev or Live runtime access/origin rejection diagnostic.
W0429 Dev or Live runtime rate-limit diagnostic.
W5000, W5001 Dev server runtime diagnostics.
W6001–W6011, W6013, W6014 Live runtime lifecycle, transport, state, and event diagnostics.