@decantr/cli 2.11.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,13 +14,15 @@ npm install -D @decantr/cli
14
14
  Or run it without installing:
15
15
 
16
16
  ```bash
17
+ npx @decantr/cli scan
17
18
  npx @decantr/cli new my-app --blueprint=esports-hq
18
19
  ```
19
20
 
20
21
  Use `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 right entry path.
22
+ Use `decantr scan` when you want a zero-commit Brownfield preview. It reads local files, detects framework/routes/styling/static-hosting/assistant-rule signals, prints a terminal report, and writes no `.decantr` files or report artifacts. Add `--json` when automation needs the `ScanReportV1` payload.
21
23
  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`.
22
24
  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.
23
- 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. Once accepted, that local law is the first Hybrid lane: the app still owns source and styling, but Decantr treats accepted local patterns and rules as project authority.
25
+ 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 --style-bridge` when you want project-owned UI patterns, local rules, and token/class bridge mappings such as button/card/shell/theme standards to appear in future task context and verification. Once accepted, that local law is the first Hybrid lane: the app still owns source and styling, but Decantr treats accepted local patterns, rules, and style bridge mappings as project authority.
24
26
  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.
25
27
  Use `decantr init`, `decantr analyze`, `decantr check`, and `decantr health` as advanced primitives when you need direct control over one step.
26
28
 
@@ -41,11 +43,14 @@ Explicit workflow/adoption flags:
41
43
 
42
44
  ```bash
43
45
  decantr setup
46
+ decantr scan
47
+ decantr scan --project apps/web --json
44
48
  decantr adopt --yes
45
49
  decantr doctor
46
50
  decantr ci --fail-on error
47
51
  decantr ci init
48
- decantr codify --from-audit
52
+ decantr codify --from-audit --style-bridge
53
+ decantr codify --map-pattern hero
49
54
  decantr codify --accept
50
55
  decantr task /feed "add saved recipe actions"
51
56
  decantr verify --brownfield --local-patterns
@@ -75,16 +80,19 @@ pnpm exec decantr setup
75
80
  pnpm exec decantr workspace list
76
81
  pnpm exec decantr adopt --project apps/web --yes
77
82
  pnpm exec decantr doctor --project apps/web
83
+ pnpm exec decantr codify --from-audit --style-bridge --project apps/web
84
+ pnpm exec decantr codify --map-pattern hero --project apps/web
78
85
  pnpm exec decantr ci init --project apps/web
79
86
  ```
80
87
 
81
88
  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.
82
89
 
83
- 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` with Hybrid authority guidance and source-derived button/card class hints; after review, `decantr codify --accept` promotes `.decantr/local-patterns.json` and `.decantr/rules.json`. `decantr doctor` reports whether the app is contract-only, Hybrid local law, style bridge, Decantr CSS, or Hybrid composition. `decantr task` prints that authority block and warns before mixing runtimes or adding Decantr CSS to a non-Decantr-CSS app. `decantr suggest --from-code` surfaces accepted local patterns from the app root or selected `--project`, and `decantr ci` prints accepted local-rule findings with file/line evidence. `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.
90
+ `decantr scan` is different from the mutating Brownfield primitives: it is look-don't-touch reconnaissance for fit, route/style evidence, GitHub Pages hints, and next-command guidance. `decantr analyze` 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` with Hybrid authority guidance, source-derived button/card/form/theme evidence, variant hints, and confidence tiers; `decantr codify --style-bridge` proposes `.decantr/style-bridge.proposal.json`, mapping Decantr intent to project-owned tokens/classes without requiring `@decantr/css`; `decantr codify --map-pattern <slug>` maps a hosted or bundled registry pattern into an advisory local-law proposal without changing source. After review, `decantr codify --accept` promotes whichever proposals exist. `decantr doctor` reports whether the app is contract-only, Hybrid local law, style bridge, Decantr CSS, or Hybrid composition. `decantr task` prints that authority block and warns before mixing runtimes or adding Decantr CSS to a non-Decantr-CSS app. `decantr suggest --from-code` surfaces accepted local patterns and style bridge mappings from the app root or selected `--project`, and `decantr ci` prints accepted local-rule findings plus style bridge status in text, markdown, and JSON reports. `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.
84
91
 
85
92
  ## What It Does
86
93
 
87
94
  - scaffolds Decantr projects from blueprints, archetypes, or prompts
95
+ - previews existing apps with read-only Brownfield scan reports
88
96
  - guides users through human workflow commands: setup, adopt, doctor, task, verify, ci, and codify
89
97
  - supports explicit workflow lanes: greenfield blueprint, greenfield contract-only, brownfield adoption, Hybrid local law, Hybrid style bridge, Hybrid Decantr CSS, and hybrid composition
90
98
  - generates execution-pack context files for AI coding assistants
@@ -98,7 +106,7 @@ Brownfield analysis also writes `.decantr/doctrine-map.json`, a ranked source-pr
98
106
 
99
107
  ## Security And Permissions
100
108
 
101
- The CLI is intentionally a local project inspector and artifact writer. It reads selected project/workspace files, package manifests, routing/style/config files, `.decantr` artifacts, and Decantr cache/config files. It writes `decantr.essence.json`, `DECANTR.md`, `.decantr/*`, generated context packs, optional CI workflows/snippets, optional style/export files, and auth/telemetry config only when explicitly requested.
109
+ The CLI is intentionally a local project inspector and artifact writer. It reads selected project/workspace files, package manifests, routing/style/config files, `.decantr` artifacts, and Decantr cache/config files. It writes `decantr.essence.json`, `DECANTR.md`, `.decantr/*`, generated context packs, optional CI workflows/snippets, optional style/export files, and auth/telemetry config only when explicitly requested. `decantr scan` is the exception by design: it reads and prints only, and does not create `.decantr`, save reports, upload source, run package scripts, or install dependencies.
102
110
 
103
111
  Telemetry is disabled by default. Hosted registry, hosted pack hydration, hosted critique/audit, and browser evidence are explicit command paths; screenshots and Evidence Bundles stay local unless a hosted workflow is invoked. Release audits prove the installed package with `npm pack --dry-run --json`. See [security permissions](https://decantr.ai/reference/security-permissions.md).
104
112
 
@@ -106,12 +114,16 @@ Telemetry is disabled by default. Hosted registry, hosted pack hydration, hosted
106
114
 
107
115
  ```bash
108
116
  decantr setup
117
+ decantr scan
118
+ decantr scan --project apps/web
119
+ decantr scan --json
109
120
  decantr new my-app --blueprint=esports-hq
110
121
  decantr adopt --yes
111
122
  decantr adopt --project apps/web --yes
112
123
  decantr doctor
113
124
  decantr doctor --project apps/web
114
- decantr codify --from-audit
125
+ decantr codify --from-audit --style-bridge
126
+ decantr codify --map-pattern hero --project apps/web
115
127
  decantr codify --accept
116
128
  decantr task /feed "add saved recipe actions"
117
129
  decantr verify --brownfield --local-patterns
package/dist/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-ET4BG746.js";
3
- import "./chunk-IQZCIMQJ.js";
4
- import "./chunk-NUNUW5IS.js";
5
- import "./chunk-5WPRTVNA.js";
6
- import "./chunk-4SZ4SEKT.js";
2
+ import "./chunk-5MZH6XXQ.js";
3
+ import "./chunk-SIDKK73N.js";
4
+ import "./chunk-YBSBAJ3E.js";
5
+ import "./chunk-3A2DLR47.js";
6
+ import "./chunk-MNZKOZW7.js";
@@ -3,7 +3,7 @@ import {
3
3
  sendProjectHealthCiFailedTelemetry,
4
4
  sendProjectHealthPromptTelemetry,
5
5
  sendProjectHealthReportTelemetry
6
- } from "./chunk-4SZ4SEKT.js";
6
+ } from "./chunk-MNZKOZW7.js";
7
7
 
8
8
  // src/commands/health.ts
9
9
  import { execFileSync } from "child_process";
@@ -91,8 +91,10 @@ function listWorkspaceAppCandidates(workspaceRoot) {
91
91
  }
92
92
  function resolveWorkspaceInfo(cwd, projectArg) {
93
93
  const absoluteCwd = resolve(cwd);
94
- const workspaceRoot = findWorkspaceRoot(absoluteCwd) ?? absoluteCwd;
95
- const appRoot = projectArg ? resolve(isAbsolute(projectArg) ? "/" : workspaceRoot, projectArg) : absoluteCwd;
94
+ const appRoot = projectArg ? resolve(
95
+ isAbsolute(projectArg) ? projectArg : join(findWorkspaceRoot(absoluteCwd) ?? absoluteCwd, projectArg)
96
+ ) : absoluteCwd;
97
+ const workspaceRoot = projectArg && isAbsolute(projectArg) ? findWorkspaceRoot(appRoot) ?? appRoot : findWorkspaceRoot(absoluteCwd) ?? absoluteCwd;
96
98
  const appCandidates = listWorkspaceApps(workspaceRoot);
97
99
  const projectScope = workspaceRoot !== appRoot || appCandidates.length > 0 ? "workspace-app" : "single-app";
98
100
  const requiresProjectSelection = !projectArg && workspaceRoot === absoluteCwd && appCandidates.length > 0;
@@ -330,10 +332,11 @@ function normalizeHealthCategory(category, source) {
330
332
  return category;
331
333
  }
332
334
  function contractAssertionApplies(assertion, metadata) {
333
- if (assertion.rule === "tokens-file-present" && metadata.adoptionMode === "contract-only") {
335
+ const projectOwnedStyling = metadata.adoptionMode === "contract-only" || metadata.adoptionMode === "style-bridge";
336
+ if (assertion.rule === "tokens-file-present" && projectOwnedStyling) {
334
337
  return false;
335
338
  }
336
- if (metadata.adoptionMode === "contract-only" && (assertion.rule === "pack-manifest-present" || assertion.rule === "review-pack-present")) {
339
+ if (projectOwnedStyling && (assertion.rule === "pack-manifest-present" || assertion.rule === "review-pack-present")) {
337
340
  return false;
338
341
  }
339
342
  return true;