Package Exports
- @decantr/cli
- @decantr/cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@decantr/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@decantr/cli
Support status: core-supported
Release channel: stable
Decantr’s main local operator surface for scaffolding, auditing, inspecting, and maintaining Decantr projects.
Install
npm install -D @decantr/cliOr run it without installing:
npx @decantr/cli new my-app --blueprint=esports-hqUse decantr setup when you are unsure which path applies. It detects whether the repo is empty, already attached, or a Brownfield app and recommends the next command.
Use decantr new for a greenfield workspace in a fresh directory. With a blueprint/archetype it uses the runnable adapter and Decantr CSS; without registry content it creates a contract-only workspace unless you explicitly pass --adoption=decantr-css.
Use decantr adopt when you already have an app and want Decantr governance without adopting a blueprint. Brownfield attach is proposal-driven: Decantr inventories the app, writes an observed essence proposal, hydrates hosted execution packs when online, and only applies the contract when you explicitly accept or merge it.
Use decantr doctor when the next step is unclear, decantr task before asking an LLM to modify a route, decantr verify after the edit, and decantr ci in required automation. Use decantr codify --from-audit when you want project-owned UI patterns and local rules such as button/card/shell/theme standards to appear in future task context and verification.
In monorepos, app-scoped commands accept --project <app-path>. setup shows attach guidance before adoption and the day-two loop after adoption. Hosted pack hydration also follows the essence path: decantr registry compile-packs apps/web/decantr.essence.json --write-context writes into apps/web/.decantr/context. In contract-only/offline Brownfield, deferred hosted packs are optional context unless a present manifest references missing files.
Use decantr init, decantr analyze, decantr check, and decantr health as advanced primitives when you need direct control over one step.
App-scoped primitives now share the same --project posture as the primary workflow commands. From a workspace root, health, status, upgrade, add, remove, theme, export, suggest, magic, rules, and telemetry target the selected app instead of the root. Task/read paths, local-law summaries, and refresh change summaries are printed as openable workspace paths. Nonexistent project paths fail immediately, and Brownfield adoption refuses component packages unless you intentionally pass --force-package.
Current starter adapter availability:
react-viteis the React + Vite runnable bootstrap adapternext-appis the runnable Next.js App Router adaptervanilla-viteis the plain HTML/CSS/JS runnable bootstrap adaptervue-viteis the Vue 3 + Vite runnable bootstrap adaptersveltekitis the SvelteKit runnable bootstrap adapterangularis the Angular standalone runnable bootstrap adaptersolid-viteis the Solid + Vite runnable bootstrap adapter- other contract targets use the
generic-webcontract-only adapter until their runnable adapters land
Explicit workflow/adoption flags:
decantr setup
decantr adopt --yes
decantr doctor
decantr ci --fail-on error
decantr ci init
decantr codify --from-audit
decantr codify --accept
decantr task /feed "add saved recipe actions"
decantr verify --brownfield --local-patterns
decantr init --workflow=greenfield --adoption=contract-only
decantr analyze
decantr init --existing --accept-proposal
decantr init --existing --merge-proposal
decantr init --existing --adoption=style-bridge
decantr init --existing --adoption=decantr-css
decantr init --project=apps/web --yes
decantr init --assistant-bridge=preview
decantr rules preview
decantr rules applyAdoption modes:
contract-onlywrites Decantr essence/context/governance files without Decantr CSS files or@decantr/cssdependency guidance.style-bridgewrites bridge tokens/files that map Decantr intent onto an existing style system without requiring@decantr/css.decantr-csswrites the full Decantr CSS files and runtime guidance.
Monorepos store both workspaceRoot and appRoot. Install Decantr at the workspace root if that is where dependencies are managed, but attach Decantr to an app root with --project=<path>.
pnpm add -D -w @decantr/cli
pnpm exec decantr setup
pnpm exec decantr workspace list
pnpm exec decantr adopt --project apps/web --yes
pnpm exec decantr doctor --project apps/web
pnpm exec decantr ci init --project apps/webAssistant rule integration is preview-first: --assistant-bridge=preview writes .decantr/context/assistant-bridge.md, decantr rules preview prints the bridge, and --assistant-bridge=apply or decantr rules apply mutates supported rule files with idempotent marked blocks.
Brownfield analysis also writes .decantr/doctrine-map.json, a ranked source-precedence map across security/data, architecture, design-system, workflow/CI, feature/business, assistant-specific, stale, and unsafe-to-cite evidence. It also writes .decantr/brownfield-intelligence.json, .decantr/theme-inventory.json, and .decantr/enrichment-backlog.md. The proposal groups routes into observed semantic domains such as auth, RBAC, billing, reporting, facilities, settings, and public surfaces across Next App/Pages Router, React Router, Angular Router, SvelteKit, Vue Router, and Nuxt file routes. Existing styling systems such as Tailwind, Bootstrap, MUI, Chakra, plain CSS, and Decantr CSS are observed as evidence instead of replaced. Theme variants are observed in the theme inventory without changing Essence V4. decantr codify --from-audit proposes .decantr/local-patterns.proposal.json and .decantr/rules.proposal.json; after review, decantr codify --accept promotes .decantr/local-patterns.json and .decantr/rules.json. decantr verify --brownfield --local-patterns uses the Brownfield guard layer plus accepted local law to flag actionable missing doctrine coverage, unsafe context, missing assistant bridges, style drift, raw local-rule violations, and unsafe defaults without treating current database migrations as stale docs.
What It Does
- scaffolds Decantr projects from blueprints, archetypes, or prompts
- guides users through human workflow commands: setup, adopt, doctor, task, verify, ci, and codify
- supports explicit workflow lanes: greenfield blueprint, greenfield contract-only, brownfield adoption, and hybrid composition
- generates execution-pack context files for AI coding assistants
- audits projects against Decantr contracts
- produces local Project Health reports, Evidence Bundles, workspace health, and a localhost Studio dashboard for end-user drift triage
- audits local registry content repositories with Content Health reports for schema, reference, and quality coverage
- searches the registry and showcase benchmark corpus
- filters blueprints through public portfolio sets:
All,Featured,Certified, and opt-inLabs - syncs paginated hosted registry content into a full slug-keyed local cache for offline guards and context generation
- validates, refreshes, and maintains
decantr.essence.json
Common Commands
decantr setup
decantr new my-app --blueprint=esports-hq
decantr adopt --yes
decantr adopt --project apps/web --yes
decantr doctor
decantr doctor --project apps/web
decantr codify --from-audit
decantr codify --accept
decantr task /feed "add saved recipe actions"
decantr verify --brownfield --local-patterns
decantr verify --base-url http://localhost:3000 --evidence
decantr ci --project apps/web
decantr ci --workspace --changed --since origin/main
decantr ci init --project apps/web
decantr init --existing --blueprint=esports-hq
decantr init --workflow=greenfield --adoption=contract-only
decantr rules preview
decantr rules apply
decantr magic "AI-native analytics workspace"
decantr audit
decantr check
decantr studio --port 4319 --host 127.0.0.1
decantr telemetry status
decantr telemetry explain
decantr telemetry link --enable --org <org-slug>
decantr content check --ci --fail-on error
decantr registry summary --namespace @official --json
decantr list blueprints --blueprint-set featured
decantr list blueprints --blueprint-set certified
decantr search dashboard --type blueprint --blueprint-set labs
decantr suggest "recipe feed with infinite scroll" --route /feed --from-code
decantr suggest --from-code --file app/page.tsx --project apps/web
decantr suggest "standardize buttons" --project apps/web
decantr list patterns
decantr showcase verification --jsonProject Health And Studio
decantr verify is the workflow command most users should run locally after edits. It delegates to Project Health, can add Brownfield guard validation with --brownfield, requires an accepted local pattern pack with --local-patterns, scans .decantr/rules.json when present, supports workspace mode, and writes evidence to .decantr/evidence/latest.json by default when --evidence is used.
decantr doctor explains project/workspace state, adoption mode, generated artifacts, local law, visual evidence, design authority signals, CI wiring, and the next command to run. It is the command to reach for when an app is in a monorepo, has stale Decantr files, or someone is not sure what Decantr expects next.
decantr ci is the blessed non-mutating automation gate. It runs the Project Health surface with adoption-mode-aware local law checks and emits a schema-backed CI report. decantr ci init writes root GitHub workflows or portable generic snippets using the detected package manager and pinned local CLI command instead of @latest; if the root manifest has not pinned Decantr yet, it prints the exact install command first.
decantr health remains the advanced project observability primitive. It composes the existing verifier audit, guard checks, brownfield route drift checks, runtime evidence, and execution-pack files into a ProjectHealthReport with a status, score, route summary, pack summary, findings, and AI-ready remediation prompts.
decantr verify
decantr verify --brownfield --local-patterns
decantr verify --brownfield --local-patterns --fail-on warn
decantr verify --base-url http://localhost:3000 --evidence
decantr verify --since-baseline
decantr doctor --project apps/registry
decantr ci --project apps/registry
decantr ci init --project apps/registry
decantr ci init --provider generic --project apps/registry
decantr health
decantr health --format json
decantr health --markdown --output health.md
decantr health --prompt <finding-id>
decantr health --project apps/registry --prompt <finding-id>
decantr health --evidence --output .decantr/evidence/latest.json
decantr health --browser --base-url http://localhost:3000 --evidence
decantr health --save-baseline
decantr health --since-baseline
decantr health --design-tokens .decantr/design/figma-tokens.json
decantr health --json --output decantr-health.json
decantr ci init
decantr ci init --fail-on warn --force
decantr ci init --project apps/registry
decantr ci init --workspace
decantr workspace list
decantr verify --workspace --changed --since origin/main
decantr export --to figma-tokensUse --json for machines and schema validation, --markdown for summaries, --evidence for the privacy-redacted Evidence Bundle, and --prompt <finding-id> when you want a scoped remediation prompt for an AI assistant. The prompt command prints instructions only; it does not modify source files. In monorepos, prompt commands preserve --project <path>, include app-prefixed read targets such as apps/web/DECANTR.md, and use root-safe runtime commands such as pnpm --dir apps/web build so the finding resolves from the same app that produced it. --browser uses a project-local Playwright install and a supplied base URL to capture local route screenshots under .decantr/evidence/screenshots/ and write .decantr/evidence/visual-manifest.json; missing Playwright becomes a visible setup finding/message, not a crash or silent skip. --save-baseline writes .decantr/health-baseline.json; --since-baseline writes .decantr/health-baseline-diff.json with changed files, route impact, finding deltas, screenshot hash drift, and contract drift. --design-tokens <path> compares a Tokens Studio/Figma token JSON export against Decantr CSS token names. decantr ci --fail-on error fails only when blocking errors exist; decantr ci --fail-on warn also fails on warnings.
decantr ci init installs .github/workflows/decantr-ci.yml for GitHub Actions. The generated workflow installs dependencies at the workspace root, writes JSON/markdown CI artifacts, gates with decantr ci, appends the markdown report to the GitHub step summary, and uploads both files as artifacts. Use --force to replace an existing workflow or --fail-on warn for stricter repositories. In monorepos, add --project <path> from the repository root; dependency install stays at the root while CI evaluates the app contract and uploads app-scoped artifacts. Use --workspace to generate an aggregate gate. Use --provider generic for Jenkins, Please, Buildkite, GitLab, Azure DevOps, or internal deployment tools. Generated CI uses the pinned local package-manager command and does not depend on @latest. Project Health remediation prompts are also monorepo-aware, so missing-pack fixes use apps/web/decantr.essence.json and CI recommendations include --project apps/web.
decantr workspace is the monorepo reliability namespace. Before attach, workspace list shows app candidates. After attach, it also discovers Decantr projects from .decantr/workspace.json or by finding decantr.essence.json files, and it distinguishes "attach another app" from the empty-workspace first attach. Workspace health runs projects with deterministic ordering, concurrency, per-project timeout, failure isolation, and aggregate JSON, and can limit a run to changed projects:
decantr workspace list
decantr workspace health
decantr workspace health --json --output .decantr/workspace-health.json
decantr verify --workspace --changed --since origin/mainIn observed Brownfield projects, common section shorthands are accepted for page and feature additions when they resolve unambiguously. For example, decantr add page app/settings --route /settings --project apps/web and decantr add feature saved-recipes --section app --project apps/web resolve app to the single primary section, such as observed-primary, so docs and LLM prompts do not have to guess generated section IDs first.
decantr studio starts a local-only dashboard powered by the same report. It uses Node built-ins only and serves GET /, GET /api/health, and POST /api/refresh.
decantr studio
decantr studio --port 4319 --host 127.0.0.1
decantr studio --report decantr-health.json
decantr studio --workspaceStudio is for local triage, not Decantr admin telemetry. The Overview keeps the first decision simple: pick the issue to fix first, review the full AI repair prompt before copying it, switch to manual guidance or commands, and expand project details when route/runtime/pack evidence matters. The tabs cover Overview, Routes, Drift, Findings, Remediation, CI, and Packs without uploading source code, prompts, file paths, or project data.
Workspace Studio uses decantr workspace health behind GET /api/workspace and POST /api/workspace/refresh so large monorepos can triage many Decantr projects from one local dashboard.
Use report mode for customer-controlled reporting from CI artifacts:
decantr health --json --output decantr-health.json
decantr studio --report decantr-health.jsonIf the project has explicitly enabled Decantr CLI telemetry, new --telemetry, init --telemetry, analyze, check --telemetry, health, and studio emit only aggregate product-activation metadata such as lifecycle command outcome, analyze counts, status, score, finding counts, CI failure outcome, Studio usage, and remediation prompt requests. They never upload the health report, finding evidence, local paths, route names, source code, package names, or prompt text.
Opted-In Telemetry Identity
decantr telemetry lets users inspect and link the opaque install/project ids used by opted-in CLI telemetry. This is how customer org attribution becomes durable without collecting repository names, local paths, source code, prompts, private package slugs, emails, or secrets.
decantr telemetry status
decantr telemetry status --json
decantr telemetry explain
decantr telemetry explain --json
decantr login --api-key=<key>
decantr telemetry link --enable --org <org-slug>telemetry link calls the hosted /v1/me/telemetry-link endpoint with only opaque ids, optional org slug, and optional label. The API verifies org membership, writes telemetry_identity_aliases, clears the actor-resolution cache, audit logs the change, and emits telemetry.identity_linked.
telemetry explain prints the CLI event catalog subset, aggregate field categories, current opaque ids if they already exist, and the explicit never-collected list. It is designed for security review and customer trust conversations before a team opts in.
Content Health
decantr content check is the preferred content-author workflow for registry content repositories such as decantr-content. decantr content-health remains as a backward-compatible primitive. Content Health is separate from Project Health: Project Health checks an end-user app against its Decantr contract, while Content Health checks published content inputs before they flow into the hosted registry.
decantr content check
decantr content check --ci --fail-on error
decantr content-health
decantr content-health --json
decantr content-health --markdown --output content-health.md
decantr content-health --ci --fail-on error
decantr content-health --ci --fail-on warn
decantr content check --prompt <finding-id>The report validates local patterns/, themes/, blueprints/, archetypes/, and shells/ against the published registry schemas, checks hard references such as blueprint themes and composed archetypes, summarizes softer generation-coverage gaps such as missing pattern coverage, and emits AI-ready remediation prompts. It does not call the hosted registry by default; use the existing registry drift audits when you need live publish parity.
Greenfield Certification
Use the built-in certification harness before releases when you want to prove that representative blueprints still scaffold into runnable starter projects:
pnpm --filter @decantr/cli certify:blueprintsBy default it certifies portfolio, producer-studio, and agent-marketplace by:
- running
decantr newin fresh temp directories - seeding offline content from
DECANTR_CONTENT_DIRor a siblingdecantr-contentcheckout - verifying the starter runtime files and router mode match the generated essence
- running
npm run buildin each scaffolded project
Override the matrix or emit JSON when needed:
pnpm --filter @decantr/cli certify:blueprints -- --blueprints=portfolio,legal-research --jsonOffline blueprint scaffolding expects a real local content source:
DECANTR_CONTENT_DIR=/path/to/decantr-content decantr new my-app --blueprint=esports-hq --offlineIf a requested offline blueprint, archetype, or theme cannot be resolved from local cache/custom content or DECANTR_CONTENT_DIR, the CLI now stops explicitly instead of silently falling back to the default scaffold.
Run decantr sync before offline-heavy or CI-heavy workflows that depend on hosted registry content. Sync paginates the official registry list endpoints, then fetches and stores each item by slug as a full content record under .decantr/cache/@official/. That keeps guard checks, Project Health, and context generation aligned with the canonical registry contract instead of abbreviated public list summaries.
Workflow Certification
The broader workflow matrix now has its own certification entrypoint:
pnpm --filter @decantr/cli certify:workflowsIt covers:
- greenfield blueprint bootstrap
- greenfield contract-only
- brownfield
adopt -> task -> verify, withanalyze -> init --existing --accept-proposal -> check --brownfieldstill covered as primitives - brownfield doctrine maps and contract coverage checks
- brownfield semantic route-domain sectioning
- direct brownfield compatibility init
- adoption modes (
contract-only,style-bridge,decantr-css) - offline contract-only and offline blueprint flows
- unsupported target contract-only fallback
- monorepo
--projecthandling - Next.js App Router adapter
- hybrid follow-up composition via Decantr mutation commands
Generated Context
Scaffolded projects include compiled execution packs under .decantr/context/, including:
scaffold-pack.md/scaffold-pack.jsonsection-*-pack.md/section-*-pack.jsonpage-*-pack.md/page-*-pack.jsonreview-pack.md/review-pack.jsonpack-manifest.json
Those files are the compact task contracts meant for AI assistants and downstream tooling.
Recommended read order for AI-assisted scaffolding:
DECANTR.mdfor the design spec, CSS approach, and guard rules.decantr/context/scaffold-pack.mdas the primary compiled shell, theme, feature, and route contract.decantr/context/scaffold.mdas the broader app overview and topology guide- matching
section-*-pack.mdandsection-*.mdfiles before section work - matching
page-*-pack.mdfiles before route work
Treat the compiled execution packs as the source of truth. Use the narrative docs as secondary explanation, start with the shell and route structure first, and run decantr check plus decantr audit after implementation.
For a broader health pass, run decantr verify after refresh or before opening a pull request, and run decantr ci inside CI. Install the default GitHub Actions gate with decantr ci init. Findings include remediation commands and can be turned into focused AI prompts with decantr health --prompt <finding-id>.
For cold-start harness or certification runs, use only the scaffolded workspace files as the contract. If local scaffold files disagree, stop and report the mismatch rather than relying on repo-global Decantr assumptions.
Related Packages
@decantr/essence-specfor schema and guard validation@decantr/registryfor registry contracts and API access@decantr/verifierfor audit and critique
Docs
License
MIT