@decantr/cli 2.4.0 → 2.4.1

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/dist/bin.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-H6TIXG5K.js";
3
- import "./chunk-PEGMSXDJ.js";
2
+ import "./chunk-6BRD6DTB.js";
3
+ import "./chunk-P4NUDLWB.js";
4
4
  import "./chunk-IEW2QFYI.js";
@@ -14,7 +14,7 @@ import {
14
14
  scaffoldProject,
15
15
  syncRegistry,
16
16
  writeExecutionPackBundleArtifacts
17
- } from "./chunk-PEGMSXDJ.js";
17
+ } from "./chunk-P4NUDLWB.js";
18
18
  import {
19
19
  buildGuardRegistryContext,
20
20
  createDoctrineMap,
@@ -5624,6 +5624,7 @@ function extractPatternName(item) {
5624
5624
  function generateGreenfieldPrompt(ctx) {
5625
5625
  const lines = [];
5626
5626
  const usesDecantrCss = ctx.adoptionMode === "decantr-css" || !ctx.adoptionMode;
5627
+ const hasCompiledPacks = ctx.hasCompiledPacks ?? true;
5627
5628
  lines.push("Build this greenfield application using the Decantr design system.");
5628
5629
  lines.push("");
5629
5630
  if (ctx.blueprint) lines.push(`Blueprint: ${ctx.blueprint}`);
@@ -5640,44 +5641,66 @@ function generateGreenfieldPrompt(ctx) {
5640
5641
  "This workspace is a new Decantr scaffold. Use the contract to create or extend the runtime deliberately, not to reverse-engineer a hidden starter."
5641
5642
  );
5642
5643
  lines.push("");
5643
- lines.push("Treat the compiled execution-pack files as the primary source of truth.");
5644
- lines.push(
5645
- "Use narrative docs only as secondary explanation when the compiled packs are not enough."
5646
- );
5644
+ if (hasCompiledPacks) {
5645
+ lines.push("Treat the compiled execution-pack files as the primary source of truth.");
5646
+ lines.push(
5647
+ "Use narrative docs only as secondary explanation when the compiled packs are not enough."
5648
+ );
5649
+ } else {
5650
+ lines.push(
5651
+ "Compiled execution-pack files are not present in this scaffold. Treat narrative Decantr context as the temporary source of truth and run `decantr refresh` after fixing the reported validation issue."
5652
+ );
5653
+ }
5647
5654
  lines.push(
5648
5655
  "Use only files present in this workspace as the source of truth. If local scaffold files disagree, stop and report the mismatch instead of relying on external Decantr assumptions or prior examples."
5649
5656
  );
5650
5657
  lines.push("");
5651
5658
  lines.push("Read in this order:");
5652
- lines.push(
5653
- "1. .decantr/context/scaffold-pack.md \u2014 the canonical compiled contract. Contains route plan, shell layouts, navigation, Required Theme Decorators, and project-wide execution rules."
5654
- );
5655
- lines.push(
5656
- "2. Before section work, read the matching .decantr/context/section-*-pack.md first, then .decantr/context/section-*.md only for extra slot/layout detail."
5657
- );
5658
- lines.push(
5659
- "3. Before route work, read the matching .decantr/context/page-*-pack.md file. Its pattern layout and interaction checklists are contract."
5660
- );
5661
- lines.push(
5662
- "4. .decantr/context/scaffold.md for broader topology, route map, and voice guidance after the compact packs are understood."
5663
- );
5664
- lines.push(
5665
- "5. DECANTR.md as a lookup reference for atoms, treatments, decorators, interaction implementations, and guard rules. Do not let narrative docs override compiled packs."
5666
- );
5667
- lines.push("");
5668
- lines.push("\u2550\u2550\u2550 INTERACTIONS ARE CONTRACT, NOT GUIDANCE \u2550\u2550\u2550");
5669
- lines.push("");
5670
- lines.push(
5671
- 'Each page pack lists "Interactions (MUST implement each)" per pattern. Implement the actual behavior, not visible text saying it exists. Use DECANTR.md only to look up the canonical implementation shape when needed.'
5672
- );
5673
- lines.push(
5674
- "Examples: pointer handlers for dragging/panning, onWheel for zoom, onKeyDown + tabIndex for keyboard navigation, IntersectionObserver for scroll reveal, state updates for real-time indicators, and d-* motion classes where the contract calls for animation."
5675
- );
5676
- lines.push("");
5677
- lines.push(
5678
- "`decantr check --strict` fails when a declared interaction has no matching implementation."
5679
- );
5680
- lines.push("");
5659
+ if (hasCompiledPacks) {
5660
+ lines.push(
5661
+ "1. .decantr/context/scaffold-pack.md \u2014 the canonical compiled contract. Contains route plan, shell layouts, navigation, Required Theme Decorators, and project-wide execution rules."
5662
+ );
5663
+ lines.push(
5664
+ "2. Before section work, read the matching .decantr/context/section-*-pack.md first, then .decantr/context/section-*.md only for extra slot/layout detail."
5665
+ );
5666
+ lines.push(
5667
+ "3. Before route work, read the matching .decantr/context/page-*-pack.md file. Its pattern layout and interaction checklists are contract."
5668
+ );
5669
+ lines.push(
5670
+ "4. .decantr/context/scaffold.md for broader topology, route map, and voice guidance after the compact packs are understood."
5671
+ );
5672
+ lines.push(
5673
+ "5. DECANTR.md as a lookup reference for atoms, treatments, decorators, interaction implementations, and guard rules. Do not let narrative docs override compiled packs."
5674
+ );
5675
+ lines.push("");
5676
+ lines.push("\u2550\u2550\u2550 INTERACTIONS ARE CONTRACT, NOT GUIDANCE \u2550\u2550\u2550");
5677
+ lines.push("");
5678
+ lines.push(
5679
+ 'Each page pack lists "Interactions (MUST implement each)" per pattern. Implement the actual behavior, not visible text saying it exists. Use DECANTR.md only to look up the canonical implementation shape when needed.'
5680
+ );
5681
+ lines.push(
5682
+ "Examples: pointer handlers for dragging/panning, onWheel for zoom, onKeyDown + tabIndex for keyboard navigation, IntersectionObserver for scroll reveal, state updates for real-time indicators, and d-* motion classes where the contract calls for animation."
5683
+ );
5684
+ lines.push("");
5685
+ lines.push(
5686
+ "`decantr check --strict` fails when a declared interaction has no matching implementation."
5687
+ );
5688
+ lines.push("");
5689
+ } else {
5690
+ lines.push(
5691
+ "1. .decantr/context/scaffold.md for topology, route map, voice, and section inventory."
5692
+ );
5693
+ lines.push(
5694
+ "2. The matching .decantr/context/section-*.md file before implementing each section."
5695
+ );
5696
+ lines.push(
5697
+ "3. DECANTR.md for atoms, treatments, decorators, interaction shapes, and guard rules."
5698
+ );
5699
+ lines.push(
5700
+ "4. Run `decantr refresh` and switch to compiled pack files once validation passes."
5701
+ );
5702
+ lines.push("");
5703
+ }
5681
5704
  lines.push("\u2550\u2550\u2550 STYLING ADOPTION \u2550\u2550\u2550");
5682
5705
  lines.push("");
5683
5706
  if (ctx.adoptionMode === "contract-only") {
@@ -5764,12 +5787,18 @@ function generateGreenfieldPrompt(ctx) {
5764
5787
  lines.push("");
5765
5788
  lines.push("\u2550\u2550\u2550 THEME DECORATOR CONTRACT \u2014 APPLY OR THE THEME DOES NOT LAND \u2550\u2550\u2550");
5766
5789
  lines.push("");
5767
- lines.push(
5768
- 'Each theme ships namespaced decorator classes (`clean-card`, `lum-glass`, `carbon-canvas`, `paper-card`, etc.). Apply the scaffold-pack.md "Required Theme Decorators" as additive classes alongside d-* treatments so the theme lands as more than token colors.'
5769
- );
5770
- lines.push(
5771
- "Section packs may point back to the scaffold-pack table; scaffold-pack.md is authoritative."
5772
- );
5790
+ if (hasCompiledPacks) {
5791
+ lines.push(
5792
+ 'Each theme ships namespaced decorator classes (`clean-card`, `lum-glass`, `carbon-canvas`, `paper-card`, etc.). Apply the scaffold-pack.md "Required Theme Decorators" as additive classes alongside d-* treatments so the theme lands as more than token colors.'
5793
+ );
5794
+ lines.push(
5795
+ "Section packs may point back to the scaffold-pack table; scaffold-pack.md is authoritative."
5796
+ );
5797
+ } else {
5798
+ lines.push(
5799
+ "Each theme ships namespaced decorator classes (`clean-card`, `lum-glass`, `carbon-canvas`, `paper-card`, etc.). Use DECANTR.md and section context to apply the theme, then rerun `decantr refresh` to restore the authoritative decorator table."
5800
+ );
5801
+ }
5773
5802
  lines.push("");
5774
5803
  lines.push("\u2550\u2550\u2550 HARD RULES (NON-NEGOTIABLE) \u2550\u2550\u2550");
5775
5804
  lines.push("");
@@ -5790,7 +5819,7 @@ function generateGreenfieldPrompt(ctx) {
5790
5819
  "- Use lucide-react for ALL iconography (already in package.json). Pick semantic icons (Bot, Activity, Database, Search) over generic ones. Do NOT inline SVGs for icons that have Lucide equivalents."
5791
5820
  );
5792
5821
  lines.push(
5793
- "- Section Directives in section packs are execution rules for layout proportions, treatment stacks, copy conventions, and pattern fitness."
5822
+ hasCompiledPacks ? "- Section Directives in section packs are execution rules for layout proportions, treatment stacks, copy conventions, and pattern fitness." : "- Section context files are execution rules for layout proportions, treatment stacks, copy conventions, and pattern fitness until compiled packs are restored."
5794
5823
  );
5795
5824
  lines.push(
5796
5825
  "- Filter chip rows / tab strips use `d-step-chip[data-step-state]`, not bare `d-interactive` buttons."
@@ -5804,9 +5833,11 @@ function generateGreenfieldPrompt(ctx) {
5804
5833
  lines.push("");
5805
5834
  lines.push("\u2550\u2550\u2550 IMPLEMENTATION RULES \u2550\u2550\u2550");
5806
5835
  lines.push(
5807
- "- Do not invent routes, sections, shells, themes, or features beyond the compiled packs."
5836
+ hasCompiledPacks ? "- Do not invent routes, sections, shells, themes, or features beyond the compiled packs." : "- Do not invent routes, sections, shells, themes, or features beyond decantr.essence.json and generated narrative context."
5837
+ );
5838
+ lines.push(
5839
+ hasCompiledPacks ? "- Prefer scaffold-pack, section-pack, and page-pack guidance over narrative docs." : "- Prefer decantr.essence.json and generated section context over assumptions from prior examples."
5808
5840
  );
5809
- lines.push("- Prefer scaffold-pack, section-pack, and page-pack guidance over narrative docs.");
5810
5841
  lines.push(
5811
5842
  "- Start with the shell layouts and route structure first, then build section pages route by route."
5812
5843
  );
@@ -5850,7 +5881,9 @@ function generateGreenfieldPrompt(ctx) {
5850
5881
  lines.push("");
5851
5882
  lines.push("\u2550\u2550\u2550 EXECUTION FLOW \u2550\u2550\u2550");
5852
5883
  lines.push("- Build the shell and shared layout first.");
5853
- lines.push("- Then implement each section's pages using the matching section and page packs.");
5884
+ lines.push(
5885
+ hasCompiledPacks ? "- Then implement each section's pages using the matching section and page packs." : "- Then implement each section's pages using decantr.essence.json and the matching section context."
5886
+ );
5854
5887
  lines.push(
5855
5888
  "- After implementation, run `decantr check` (primary gate) and `decantr audit` (supplementary diagnostics)."
5856
5889
  );
@@ -7353,19 +7386,34 @@ ${YELLOW9}You're offline. Scaffolding Decantr default.${RESET14}`);
7353
7386
  )
7354
7387
  );
7355
7388
  }
7389
+ const hasCompiledPacks = existsSync26(join27(projectRoot, ".decantr", "context", "scaffold-pack.md"));
7356
7390
  console.log("");
7357
7391
  console.log(" Next steps:");
7358
- console.log(
7359
- " 1. Read .decantr/context/scaffold-pack.md first as the primary compiled contract"
7360
- );
7361
- console.log(
7362
- " 2. Read .decantr/context/scaffold.md for broader topology, route map, and voice guidance"
7363
- );
7364
- console.log(" 3. Read the matching section and page packs before implementing each route");
7365
- console.log(" 4. Use DECANTR.md as a lookup reference for atoms, treatments, and guard rules");
7366
- console.log(" 5. Build the shell and route structure first, then implement the pages");
7367
- console.log(" 6. Run decantr check and decantr audit after implementation");
7368
- console.log(" 7. Explore more at decantr.ai/registry");
7392
+ if (hasCompiledPacks) {
7393
+ console.log(
7394
+ " 1. Read .decantr/context/scaffold-pack.md first as the primary compiled contract"
7395
+ );
7396
+ console.log(
7397
+ " 2. Read .decantr/context/scaffold.md for broader topology, route map, and voice guidance"
7398
+ );
7399
+ console.log(" 3. Read the matching section and page packs before implementing each route");
7400
+ console.log(
7401
+ " 4. Use DECANTR.md as a lookup reference for atoms, treatments, and guard rules"
7402
+ );
7403
+ console.log(" 5. Build the shell and route structure first, then implement the pages");
7404
+ console.log(" 6. Run decantr check and decantr audit after implementation");
7405
+ console.log(" 7. Explore more at decantr.ai/registry");
7406
+ } else {
7407
+ console.log(" 1. Fix the validation issue reported above");
7408
+ console.log(" 2. Run decantr refresh to restore compiled execution packs");
7409
+ console.log(
7410
+ " 3. Until packs exist, read .decantr/context/scaffold.md and section context files"
7411
+ );
7412
+ console.log(
7413
+ " 4. Use DECANTR.md as a lookup reference for atoms, treatments, and guard rules"
7414
+ );
7415
+ console.log(" 5. Run decantr check and decantr audit after implementation");
7416
+ }
7369
7417
  console.log("");
7370
7418
  console.log(" Commands:");
7371
7419
  console.log(` ${cyan3("decantr status")} Project health`);
@@ -7416,7 +7464,8 @@ Validation warnings: ${validation.errors.join(", ")}`));
7416
7464
  pages: promptPages,
7417
7465
  personality: options.personality,
7418
7466
  features: options.features,
7419
- guard: options.guard
7467
+ guard: options.guard,
7468
+ hasCompiledPacks
7420
7469
  };
7421
7470
  const curatedPrompt = generateCuratedPrompt(promptCtx);
7422
7471
  console.log("");
@@ -8178,7 +8227,7 @@ async function main() {
8178
8227
  break;
8179
8228
  }
8180
8229
  case "upgrade": {
8181
- const { cmdUpgrade } = await import("./upgrade-XTTGHFG7.js");
8230
+ const { cmdUpgrade } = await import("./upgrade-HSPWYROM.js");
8182
8231
  const applyFlag = args.includes("--apply");
8183
8232
  await cmdUpgrade(process.cwd(), { apply: applyFlag });
8184
8233
  break;
@@ -3969,6 +3969,44 @@ function buildFlagsString(options) {
3969
3969
  }
3970
3970
  return flags.join(" ");
3971
3971
  }
3972
+ function serializeConstraintValue(value) {
3973
+ if (value === void 0 || value === null) return void 0;
3974
+ if (typeof value === "string") return value;
3975
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
3976
+ try {
3977
+ return JSON.stringify(value);
3978
+ } catch {
3979
+ return String(value);
3980
+ }
3981
+ }
3982
+ function normalizeBlueprintDesignConstraints(designConstraints) {
3983
+ if (!designConstraints || typeof designConstraints !== "object" || Array.isArray(designConstraints)) {
3984
+ return void 0;
3985
+ }
3986
+ const constraints = {};
3987
+ const effects = {};
3988
+ for (const [key, value] of Object.entries(designConstraints)) {
3989
+ if (key === "effects" && value && typeof value === "object" && !Array.isArray(value)) {
3990
+ for (const [effectKey, effectValue] of Object.entries(value)) {
3991
+ const serialized2 = serializeConstraintValue(effectValue);
3992
+ if (serialized2) effects[effectKey] = serialized2;
3993
+ }
3994
+ continue;
3995
+ }
3996
+ const serialized = serializeConstraintValue(value);
3997
+ if (!serialized) continue;
3998
+ if (key === "mode" && typeof value === "string") constraints.mode = value;
3999
+ else if (key === "typography" && typeof value === "string") constraints.typography = value;
4000
+ else if (key === "borders" && typeof value === "string") constraints.borders = value;
4001
+ else if (key === "corners" && typeof value === "string") constraints.corners = value;
4002
+ else if (key === "shadows" && typeof value === "string") constraints.shadows = value;
4003
+ else effects[key] = serialized;
4004
+ }
4005
+ if (Object.keys(effects).length > 0) {
4006
+ constraints.effects = effects;
4007
+ }
4008
+ return Object.keys(constraints).length > 0 ? constraints : void 0;
4009
+ }
3972
4010
  function generateTaskContextV4(templateName, essence) {
3973
4011
  const template = loadTemplate(templateName);
3974
4012
  const sections = essence.blueprint.sections;
@@ -4226,8 +4264,11 @@ async function scaffoldProject(projectRoot, options, detected, registry, archety
4226
4264
  if (blueprintData?.personality?.length) {
4227
4265
  essenceV4.dna.personality = typeof blueprintData.personality === "string" ? [blueprintData.personality] : blueprintData.personality;
4228
4266
  }
4229
- if (blueprintData?.design_constraints) {
4230
- essenceV4.dna.constraints = blueprintData.design_constraints;
4267
+ const normalizedDesignConstraints = normalizeBlueprintDesignConstraints(
4268
+ blueprintData?.design_constraints
4269
+ );
4270
+ if (normalizedDesignConstraints) {
4271
+ essenceV4.dna.constraints = normalizedDesignConstraints;
4231
4272
  }
4232
4273
  if (blueprintData?.seo_hints) {
4233
4274
  essenceV4.meta.seo = blueprintData.seo_hints;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import "./chunk-H6TIXG5K.js";
2
- import "./chunk-PEGMSXDJ.js";
1
+ import "./chunk-6BRD6DTB.js";
2
+ import "./chunk-P4NUDLWB.js";
3
3
  import "./chunk-IEW2QFYI.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  RegistryClient,
3
3
  refreshDerivedFiles
4
- } from "./chunk-PEGMSXDJ.js";
4
+ } from "./chunk-P4NUDLWB.js";
5
5
 
6
6
  // src/commands/upgrade.ts
7
7
  import { existsSync, readFileSync, writeFileSync } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/cli",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Decantr CLI - scaffold, audit, inspect Project Health, and maintain Decantr projects from the terminal",
5
5
  "keywords": [
6
6
  "decantr",
@@ -48,9 +48,9 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "ajv": "^8.20.0",
51
+ "@decantr/core": "2.1.0",
51
52
  "@decantr/registry": "2.0.0",
52
53
  "@decantr/essence-spec": "2.0.1",
53
- "@decantr/core": "2.1.0",
54
54
  "@decantr/telemetry": "2.2.1",
55
55
  "@decantr/verifier": "2.1.0"
56
56
  },