CLI Commands

All kern CLI commands and flags.

kern dev

Watch mode — auto-compiles .kern files on every change. This is the main command for local development.

kern dev <file.kern|dir> [--target=<target>] [--outdir=<dir>]

Flags

  • --target — Compilation target: nextjs, vue, nuxt, express, native, web
  • --outdir — Output directory for generated files

Examples

# Watch a single file, emit Next.js components
kern dev app.kern --target=nextjs --outdir=app/

# Watch an entire directory, emit Vue SFCs
kern dev kern/ --target=vue --outdir=src/

kern compile

One-shot compilation — processes files once and exits. Same flags as kern dev but without file watching.

kern compile <file.kern|dir> [--target=<target>] [--outdir=<dir>]

Examples

# Compile all .kern files in a directory
kern compile kern/ --target=nextjs --outdir=app/

# Single file compile for CI
kern compile dashboard.kern --target=vue --outdir=dist/

kern review

Deep static analysis for TypeScript and Python. Runs 68 AST-based rules + 5 concept rules against your codebase.

kern review <dir|file> [flags]

Flags

  • --json — Machine-readable JSON output
  • --sarif — SARIF format for GitHub Security tab
  • --summary — Human-readable summary
  • --enforce — Exit with non-zero code if findings exceed threshold
  • --min-coverage=N — Minimum coverage percentage (used with --enforce)
  • --llm — LLM-exportable format (5x smaller IR)
  • --recursive — Recurse into subdirectories

Examples

# Review a directory recursively
kern review src/ --recursive

# JSON output for CI pipelines
kern review src/ --json --recursive

# SARIF for GitHub Security tab
kern review src/ --sarif > results.sarif

# Enforce minimum coverage in CI
kern review src/ --enforce --min-coverage=80 --recursive

# Human-readable summary
kern review src/ --summary

# LLM-assisted analysis
kern review src/ --recursive --llm

kern scan

Detects your project's framework versions and generates a kern.config.ts file with the appropriate target and settings.

kern scan <dir>

Example

$ kern scan .
Detected: Next.js 14.2, React 18, Tailwind 3.4
Generated kern.config.ts with target "nextjs"

kern init-templates

Initializes templates from the built-in catalog based on your package.json dependencies. Automatically detects Zustand, SWR, Prisma, and other common libraries.

kern init-templates [--package=<name>]

Flags

  • --package=<name> — Scope template initialization to a specific package

Example

$ kern init-templates
Found: zustand@4.5, swr@2.2, prisma@5.10
Initialized 3 template sets in kern/templates/

kern evolve

Detects pattern gaps in your codebase and proposes new templates to fill them. Experimental — requires review before applying.

kern evolve <dir> [--approve] [--reject]

Flags

  • --approve — Accept all proposed templates
  • --reject — Reject all proposed templates

Example

$ kern evolve src/
Found 2 pattern gaps:
  1. Repeated fetch+loading+error in 4 components
  2. Modal open/close state in 3 components
Proposed: async-data-view.kern, modal-state.kern
Use --approve to accept or --reject to discard.

kern confidence

Analyzes the confidence graph for review findings. Shows how confidence scores propagate across rule layers and dependencies.

kern confidence <dir>

Example

$ kern confidence src/
Confidence graph: 47 findings, avg 0.82
  High (>0.9):  31 findings
  Medium (0.7-0.9): 12 findings
  Low (<0.7):   4 findings

kern version

Prints the installed kern CLI version.

kern --version