Skip to content

CLI

The tenchi command scaffolds the prescribed structure, inspects the composed application, and keeps API changes reviewable.

Create an application

uvx tenchi new my_app

Names use snake_case. The generated project includes a todos feature, SQLite persistence with request-scoped transactions, a memory test adapter, strict checks, integration tests, Swagger UI, OpenAPI and application-tool snapshots, a concise AGENTS.md, project-local MCP configuration, and GitHub Actions CI.

Generate application slices

uv run tenchi make feature notes
uv run tenchi make feature notes --dry-run
uv run tenchi make use-case notes create_note
uv run tenchi make use-case notes create_note --json

Generators create files and print explicit wiring instructions. They never rewrite route or infrastructure modules. --dry-run validates the operation and lists every file without writing it. --json emits the same result as a versioned object with the app root, artifact identity, files, follow-up steps, and any error.

Inspect routes

uv run tenchi routes
uv run tenchi routes --json

The default target is app.server.routes:routes. Override it with --routes module:attribute. JSON output is a versioned object containing the application root and the composed HTTP surface under routes.

Map the application

uv run tenchi map
uv run tenchi map --json
uv run tenchi map --feature notes --json
uv run tenchi map --feature notes \
  --kind route,job,task,tool,use-case,policy,port --json

Map combines the canonical source layout with composed API routes, operational tasks, background jobs, and application tools. It returns a deterministic, versioned graph covering features, contracts, routes, background jobs, operational tasks, application tools, use cases, policies, ports, adapters, context types, entrypoints, and tests. Edges describe ownership, route bindings, dependencies, authorization, implementations, and feature tests. Each edge carries project-relative source evidence and an exact or inferred confidence value.

--feature keeps the selected feature and its directly connected nodes, which makes cross-feature policy and shared-port dependencies visible without loading the entire application. --kind accepts a comma-separated projection of node kinds. The default route target is app.server.routes:api_routes; override it with --routes module:attribute. The default job target is app.server.jobs:jobs; override it with --jobs module:attribute. The default tool target is app.server.tools:tools; override it with --tools module:attribute.

The JSON result also embeds tenchi doctor diagnostics and unresolved source relationships. Agents should inspect both before editing and use stable node IDs and source locations to choose the files involved in a change. See coding agents for the complete workflow across map, make, check, and OpenAPI compatibility.

Manage application-tool contracts

uv run tenchi tools
uv run tenchi tools --json
uv run tenchi tools --diff tools.json
uv run tenchi tools \
  --diff-ref origin/main \
  --snapshot tools.json
uv run tenchi tools --check tools.json
uv run tenchi tools --write tools.json

The default target is app.server.tools:tools; override it with --tools module:attribute. Plain output is the canonical portable manifest. --json wraps that manifest with the application root and agent protocol version for automation.

--check is an exact drift check. --diff and --diff-ref classify changes directionally and fail on breaking or unknown changes. A Git ref supplies a meaningful historical baseline even when the working branch updates its snapshot. Use --diff-format json for the versioned compatibility result. See Application tools for the compatibility rules.

Manage OpenAPI

uv run tenchi openapi --routes app.server.routes:api_routes --title my_app
uv run tenchi openapi --routes app.server.routes:api_routes \
  --title my_app --diff openapi.json
uv run tenchi openapi --routes app.server.routes:api_routes \
  --title my_app --diff-ref origin/main --snapshot openapi.json
uv run tenchi openapi --routes app.server.routes:api_routes \
  --title my_app --check openapi.json
uv run tenchi openapi --routes app.server.routes:api_routes \
  --title my_app --write openapi.json

Common metadata options are --title, --version, --description, and --security. --diff-ref reads --snapshot (default openapi.json) from a Git commit instead of the working tree. See OpenAPI and compatibility for the safe baseline workflow.

When --diff-format json is selected, the versioned result includes the application root, baseline label, compatibility status, severity counts, and classified changes.

Check architecture

uv run tenchi doctor
uv run tenchi doctor --json

Doctor validates the canonical application structure, dependency direction, and authorization consistency. Findings include a stable code, severity, file, line, and message in the versioned JSON result.

Run every check

uv run tenchi check
uv run tenchi check --json

Check runs Ruff format, Ruff lint, Pyright, pytest, doctor, and the exact OpenAPI and application-tool snapshot checks. Every step runs even when an earlier one fails. Human output shows a compact status list; JSON includes stable step names, commands, exit codes, durations, and bounded failure output. Use --timeout to change the per-step limit.

OpenAPI defaults come from literal top-level OPENAPI_TITLE, OPENAPI_VERSION, optional OPENAPI_DESCRIPTION, and optional OPENAPI_SECURITY declarations in the module selected by --routes; command flags override them. The route target defaults to app.server.routes:api_routes, and the snapshot defaults to openapi.json. The tool target defaults to app.server.tools:tools, and its snapshot defaults to tools.json.

Verify a completed change

uv run tenchi verify --base-ref origin/main
uv run tenchi verify --base-ref origin/main --json

Verify produces one receipt for the finished source tree. It runs tenchi check, rejects application-map diagnostics and unresolved relationships, and compares the generated OpenAPI document and application-tool manifest with the snapshots at the selected Git ref. The receipt records the immutable commit resolved from --base-ref, so both compatibility reports use the same historical state even if the named ref moves later.

Use the pull request base, previous push, or previous release as the base ref. The option is required: using the current branch snapshot could hide a breaking change when code and its updated snapshot are committed together. The command exits non-zero for a failed check, incomplete architecture evidence, a breaking or unknown boundary change, or a baseline that cannot be read.

--snapshot, --tool-snapshot, and the route, task, job, tool, and OpenAPI metadata options override the generated application conventions. Verify never updates either snapshot. Because it runs the application's tests and validation commands, those commands retain their normal side effects and per-step timeout.

Verify the deployment environment

uv run tenchi preflight
uv run tenchi preflight --json
uv run tenchi preflight --timeout 3

Preflight discovers app.server.preflight:checks and runs its read-only async observations concurrently. Each check keeps its declared timeout; --timeout can only cap those limits. Results expose stable names, descriptions, statuses, durations, and failure codes while discarding dependency values and exception messages. The command exits non-zero when any check fails or times out.

Use --preflight module:attribute to override the declaration target. See deployment preflight for declarations, dependency patterns, redaction, and rollout placement.

Run operational tasks

uv run tenchi task list
uv run tenchi task list --json
uv run tenchi task run projects.repair_members \
  --input '{"dry_run": true}'
uv run tenchi task run projects.repair_members \
  --input '{"dry_run": false}' \
  --json

task list discovers app.server.tasks:runner and reports every task's input and output JSON Schema. task run validates input, opens the application lifespan and scoped context, invokes the use case, validates its result before the context commits, and returns a non-zero exit status for failure results. Use --tasks module:attribute to override the runner target.

See Operational tasks for declarations, composition, dry-run design, failure semantics, and MCP access.

Serve coding-agent tools over MCP

uv run tenchi mcp
uv run tenchi mcp --root path/to/application

This command exposes repository inspection and validation—not the application's ToolGroup. MCP support is installed through the tenchi[mcp] extra. Generated applications include it as a development dependency and register the default command in .mcp.json. --routes, --api-routes, --preflight, --tasks, --jobs, --tools, --snapshot, and --tool-snapshot override the conventions captured by the server when it starts. --title, --version, --description, and --security override discovered OpenAPI metadata for the diff and check tools. Pass --allow-task-runs only when the connected agent may perform operational writes; task discovery remains available without it. The command uses stdio and waits for an MCP client; it does not start an HTTP listener.

See connect an MCP-aware coding agent for tool behavior, safety, and client configuration.

Run development

uv run tenchi dev
uv run tenchi dev --host 0.0.0.0 --port 8080
uv run tenchi dev --no-reload

The default ASGI target is app.server.asgi:app. Override it with --app module:attribute. Production deployments should invoke an ASGI server directly rather than the development command.