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=agent-marketplaceUse 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 analyze first 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, and only applies it when you explicitly accept or merge it.
Use decantr init to attach Decantr contract/context files to an existing project or to create a contract-only workspace.
Current starter adapter availability:
react-viteis the runnable bootstrap adapter in this wavenext-appis the runnable Next.js App Router adapter- other contract targets use the
generic-webcontract-only adapter until their runnable adapters land
Explicit workflow/adoption flags:
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. In non-interactive workspace-root runs with multiple app candidates, pass --project=<path> so Decantr attaches to the intended app.
Assistant 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. 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. decantr check --brownfield uses the doctrine map to flag actionable missing doctrine coverage, unsafe context, missing assistant bridges, style drift, and unsafe defaults without treating current database migrations as stale docs.
What It Does
- scaffolds Decantr projects from blueprints, archetypes, or prompts
- 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 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
- validates, refreshes, and maintains
decantr.essence.json
Common Commands
decantr new my-app --blueprint=agent-marketplace
decantr analyze
decantr init --existing --accept-proposal
decantr check --brownfield
decantr init --existing --blueprint=agent-marketplace
decantr init --workflow=greenfield --adoption=contract-only
decantr rules preview
decantr rules apply
decantr magic "AI-native analytics workspace"
decantr audit
decantr check
decantr health --ci --fail-on error
decantr studio --port 4319 --host 127.0.0.1
decantr content-health --ci --fail-on error
decantr registry summary --namespace @official --json
decantr showcase verification --jsonProject Health And Studio
decantr health is the local project observability command. 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 health
decantr health --format json
decantr health --markdown --output health.md
decantr health --ci --fail-on error
decantr health --ci --fail-on warn
decantr health --prompt <finding-id>Use --json for machines and schema validation, --markdown for CI summaries, and --prompt <finding-id> when you want a scoped remediation prompt for an AI assistant. --ci --fail-on error fails only when blocking errors exist; --ci --fail-on warn also fails on warnings.
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.1Studio is for local triage, not Decantr admin telemetry. The tabs cover Overview, Routes, Drift, Findings, Remediation, CI, and Packs without uploading source code, prompts, file paths, or project data.
Content Health
decantr content-health is the local supply-chain observability command for registry content repositories such as decantr-content. It 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-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-health --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=agent-marketplace --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.
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
analyze -> init --existing --accept-proposal -> check --brownfield - 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 health after refresh, before opening a pull request, or inside CI. 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