@deftai/directive-core 0.72.0 → 0.73.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.
Files changed (103) hide show
  1. package/dist/branch/evaluate.js +2 -1
  2. package/dist/category-b-namespace/index.js +16 -2
  3. package/dist/codebase/default-extractor.js +9 -1
  4. package/dist/codebase/map.js +1 -1
  5. package/dist/deposit/copy-tree.js +31 -7
  6. package/dist/doctor/checks.d.ts +9 -0
  7. package/dist/doctor/checks.js +85 -5
  8. package/dist/doctor/main.js +2 -1
  9. package/dist/eval/health.js +7 -1
  10. package/dist/eval/readback.js +7 -1
  11. package/dist/init-deposit/gitignore.js +6 -0
  12. package/dist/init-deposit/hygiene.d.ts +30 -0
  13. package/dist/init-deposit/hygiene.js +60 -1
  14. package/dist/init-deposit/refresh.d.ts +16 -2
  15. package/dist/init-deposit/refresh.js +162 -52
  16. package/dist/init-deposit/scaffold.d.ts +11 -1
  17. package/dist/init-deposit/scaffold.js +9 -8
  18. package/dist/integration-e2e/helpers.js +7 -7
  19. package/dist/layout/index.d.ts +1 -1
  20. package/dist/layout/index.js +1 -1
  21. package/dist/layout/resolve.d.ts +47 -31
  22. package/dist/layout/resolve.js +93 -36
  23. package/dist/lifecycle/lifecycle-hygiene.d.ts +1 -1
  24. package/dist/lifecycle/lifecycle-hygiene.js +1 -1
  25. package/dist/migrate-preflight/index.js +10 -10
  26. package/dist/policy/disclosure.d.ts +1 -0
  27. package/dist/policy/disclosure.js +1 -0
  28. package/dist/policy/index.d.ts +1 -0
  29. package/dist/policy/index.js +1 -0
  30. package/dist/policy/policy-invocation.d.ts +5 -0
  31. package/dist/policy/policy-invocation.js +9 -0
  32. package/dist/policy/resolve.d.ts +2 -2
  33. package/dist/policy/resolve.js +15 -5
  34. package/dist/policy/value-feedback.js +6 -3
  35. package/dist/policy/wip.d.ts +1 -1
  36. package/dist/policy/wip.js +15 -3
  37. package/dist/preflight-cache/evaluate.js +1 -1
  38. package/dist/release/native-steps.js +14 -2
  39. package/dist/render/export-spec.js +2 -2
  40. package/dist/render/project-render.js +40 -9
  41. package/dist/scope/decompose.js +12 -2
  42. package/dist/session/resume-conditions.js +2 -2
  43. package/dist/session/ritual-sentinel.d.ts +1 -1
  44. package/dist/session/ritual-sentinel.js +6 -4
  45. package/dist/slice/constants.d.ts +1 -1
  46. package/dist/slice/constants.js +1 -1
  47. package/dist/slice/project-context.js +1 -1
  48. package/dist/spec-authority/resolver.js +9 -2
  49. package/dist/swarm/complete-cohort.js +14 -1
  50. package/dist/swarm/constants.d.ts +1 -1
  51. package/dist/swarm/constants.js +2 -1
  52. package/dist/swarm/readiness.js +33 -3
  53. package/dist/swarm/subagent-backend.js +2 -1
  54. package/dist/task-surface/index.js +3 -3
  55. package/dist/triage/actions/candidates-log.d.ts +1 -1
  56. package/dist/triage/bootstrap/gitignore.js +22 -10
  57. package/dist/triage/bootstrap/index.d.ts +1 -1
  58. package/dist/triage/bootstrap/index.js +9 -3
  59. package/dist/triage/cache-path.d.ts +1 -1
  60. package/dist/triage/cache-path.js +32 -6
  61. package/dist/triage/classify/index.d.ts +1 -1
  62. package/dist/triage/classify/index.js +11 -4
  63. package/dist/triage/help/registry-data.d.ts +2 -2
  64. package/dist/triage/help/registry-data.js +2 -2
  65. package/dist/triage/queue/constants.d.ts +4 -4
  66. package/dist/triage/queue/constants.js +4 -4
  67. package/dist/triage/queue/scope-walk.js +7 -1
  68. package/dist/triage/reconcile/reconcile.js +23 -3
  69. package/dist/triage/reconcile/types.d.ts +1 -1
  70. package/dist/triage/reconcile/types.js +1 -1
  71. package/dist/triage/refresh/refresh.js +9 -2
  72. package/dist/triage/scope/constants.d.ts +2 -2
  73. package/dist/triage/scope/constants.js +2 -2
  74. package/dist/triage/scope/renderers.js +7 -1
  75. package/dist/triage/smoketest/index.js +9 -6
  76. package/dist/triage/subscribe/index.d.ts +2 -2
  77. package/dist/triage/subscribe/index.js +2 -2
  78. package/dist/triage/summary/index.d.ts +2 -2
  79. package/dist/triage/summary/index.js +1 -1
  80. package/dist/triage/summary/reconcilable.d.ts +1 -1
  81. package/dist/triage/welcome/constants.d.ts +2 -2
  82. package/dist/triage/welcome/constants.js +2 -2
  83. package/dist/triage/welcome/onboard.js +8 -1
  84. package/dist/triage/welcome/prior-state.js +14 -2
  85. package/dist/triage/welcome/summary.js +14 -2
  86. package/dist/triage/welcome/writers.js +7 -1
  87. package/dist/ts-check-lane/run-lane.d.ts +4 -0
  88. package/dist/ts-check-lane/run-lane.js +20 -6
  89. package/dist/validate-content/validate-strategy-output.js +11 -1
  90. package/dist/value/feedback-file.js +3 -2
  91. package/dist/value/readback.js +3 -2
  92. package/dist/vbrief-build/parity-scenarios.js +3 -3
  93. package/dist/vbrief-reconcile/labels.js +16 -1
  94. package/dist/vbrief-reconcile/parity-scenarios.js +10 -10
  95. package/dist/vbrief-reconcile/umbrellas.js +16 -1
  96. package/dist/vbrief-validate/main.js +13 -1
  97. package/dist/vbrief-validate/precutover.js +33 -5
  98. package/dist/vbrief-validate/staleness.d.ts +1 -1
  99. package/dist/vbrief-validate/staleness.js +5 -2
  100. package/dist/verify-source/code-structure-validate.js +7 -1
  101. package/dist/xbrief-migrate/signpost.d.ts +4 -4
  102. package/dist/xbrief-migrate/signpost.js +11 -15
  103. package/package.json +3 -3
@@ -333,7 +333,22 @@ export function nowIso(date = new Date()) {
333
333
  }
334
334
  export function reconcileUmbrellas(projectRoot, options = {}) {
335
335
  const root = resolve(projectRoot);
336
- const vbriefDir = resolveLifecycleRoot(root);
336
+ let vbriefDir;
337
+ try {
338
+ vbriefDir = resolveLifecycleRoot(root);
339
+ }
340
+ catch {
341
+ return [
342
+ 2,
343
+ {
344
+ changed: [],
345
+ unchanged: [],
346
+ skipped_no_ref: [],
347
+ errors: [],
348
+ dry_run: options.dryRun ?? false,
349
+ },
350
+ ];
351
+ }
337
352
  if (!existsSync(vbriefDir)) {
338
353
  return [
339
354
  2,
@@ -42,7 +42,19 @@ export function runValidate(argv) {
42
42
  return 2;
43
43
  }
44
44
  }
45
- const resolvedDir = vbriefDir ?? resolveLifecycleLayout(projectRoot ?? process.cwd()).root;
45
+ let resolvedDir;
46
+ if (vbriefDir !== null) {
47
+ resolvedDir = vbriefDir;
48
+ }
49
+ else {
50
+ try {
51
+ resolvedDir = resolveLifecycleLayout(projectRoot ?? process.cwd()).root;
52
+ }
53
+ catch {
54
+ process.stdout.write(`OK: No xbrief/ layout found at ${projectRoot ?? process.cwd()} -- skipping validation\n`);
55
+ return 0;
56
+ }
57
+ }
46
58
  if (!existsSync(resolvedDir)) {
47
59
  process.stdout.write(`OK: No vbrief directory at ${resolvedDir} -- skipping validation\n`);
48
60
  return 0;
@@ -8,7 +8,14 @@ export { DEPRECATION_SENTINEL as DEPRECATED_REDIRECT_SENTINEL };
8
8
  const DEPRECATION_REDIRECT_PURPOSE = "<!-- Purpose: deprecation redirect -->";
9
9
  const LIFECYCLE_FOLDERS = ["proposed", "pending", "active", "completed", "cancelled"];
10
10
  export function missingLifecycleFolders(projectRoot) {
11
- const lifecycleRoot = resolveLifecycleRoot(projectRoot);
11
+ let lifecycleRoot;
12
+ try {
13
+ lifecycleRoot = resolveLifecycleRoot(projectRoot);
14
+ }
15
+ catch {
16
+ // No xbrief/ layout present -- all lifecycle folders are missing.
17
+ return [...LIFECYCLE_FOLDERS];
18
+ }
12
19
  return LIFECYCLE_FOLDERS.filter((folder) => !existsSync(join(lifecycleRoot, folder)));
13
20
  }
14
21
  function hasCompleteLifecycle(projectRoot) {
@@ -20,9 +27,15 @@ export function isDeprecationRedirect(content) {
20
27
  }
21
28
  /** Full-spec generated export (layout-resolved specification artifact source line). */
22
29
  export function isGeneratedSpecificationExport(projectRoot, content) {
23
- return (content.includes(GENERATED_SPEC_PURPOSE) &&
24
- contentHasGeneratedSpecSource(content) &&
25
- existsSync(resolveSpecArtifactPath(projectRoot)));
30
+ if (!content.includes(GENERATED_SPEC_PURPOSE) || !contentHasGeneratedSpecSource(content)) {
31
+ return false;
32
+ }
33
+ try {
34
+ return existsSync(resolveSpecArtifactPath(projectRoot));
35
+ }
36
+ catch {
37
+ return false;
38
+ }
26
39
  }
27
40
  /** Return true for a fully current generated spec export (full-spec or greenfield). */
28
41
  export function isCurrentGeneratedSpecification(projectRoot, content) {
@@ -91,7 +104,22 @@ export function detectPreCutover(projectRoot) {
91
104
  reasons.push("PROJECT.md is a pre-v0.20 hand-authored doc (not a deprecation redirect)");
92
105
  }
93
106
  }
94
- const layout = resolveLifecycleLayout(projectRoot);
107
+ // Since #2112, resolveLifecycleLayout throws when no xbrief/ layout is present.
108
+ // Catch that error so the doctor can still diagnose pre-cutover state on unmigrated trees.
109
+ // However, an empty (greenfield) directory with no pre-cutover artifacts is NOT pre-cutover.
110
+ let layout = null;
111
+ try {
112
+ layout = resolveLifecycleLayout(projectRoot);
113
+ }
114
+ catch {
115
+ // No xbrief/ layout found. Only report a pre-cutover reason if legacy artifacts
116
+ // (SPECIFICATION.md / PROJECT.md) were already detected above; a bare empty directory
117
+ // without any artifacts is greenfield, not pre-cutover.
118
+ if (reasons.length > 0) {
119
+ reasons.push("xbrief/ lifecycle layout not found -- run `deft migrate:xbrief` first");
120
+ }
121
+ return { preCutover: reasons.length > 0, reasons };
122
+ }
95
123
  if (existsSync(layout.root)) {
96
124
  const missing = missingLifecycleFolders(projectRoot);
97
125
  if (missing.length > 0) {
@@ -1,3 +1,3 @@
1
- /** Warn if PRD.md or SPECIFICATION.md are stale relative to specification.vbrief.json (#398). */
1
+ /** Warn if PRD.md or SPECIFICATION.md are stale relative to the spec artifact (#398). */
2
2
  export declare function checkRenderStaleness(vbriefDir: string): string[];
3
3
  //# sourceMappingURL=staleness.d.ts.map
@@ -66,11 +66,14 @@ function checkSpecStaleness(specMdPath, narratives, items, title) {
66
66
  }
67
67
  return [];
68
68
  }
69
- /** Warn if PRD.md or SPECIFICATION.md are stale relative to specification.vbrief.json (#398). */
69
+ /** Warn if PRD.md or SPECIFICATION.md are stale relative to the spec artifact (#398). */
70
70
  export function checkRenderStaleness(vbriefDir) {
71
71
  const warnings = [];
72
72
  const projectRoot = join(vbriefDir, "..");
73
- const specPath = join(vbriefDir, "specification.vbrief.json");
73
+ // Prefer the migrated xbrief artifact; fall back to the legacy vbrief artifact.
74
+ const specPath = existsSync(join(vbriefDir, "specification.xbrief.json"))
75
+ ? join(vbriefDir, "specification.xbrief.json")
76
+ : join(vbriefDir, "specification.vbrief.json");
74
77
  if (!existsSync(specPath)) {
75
78
  return warnings;
76
79
  }
@@ -545,7 +545,13 @@ export function discoverCodeStructurePaths(projectRoot) {
545
545
  paths.set(projectDef.replace(/\\/g, "/"), projectDef);
546
546
  }
547
547
  }
548
- const vbriefRoot = resolveLifecycleRoot(projectRoot);
548
+ let vbriefRoot;
549
+ try {
550
+ vbriefRoot = resolveLifecycleRoot(projectRoot);
551
+ }
552
+ catch {
553
+ return [...paths.values()];
554
+ }
549
555
  if (existsSync(vbriefRoot)) {
550
556
  const stack = [vbriefRoot];
551
557
  while (stack.length > 0) {
@@ -2,10 +2,10 @@
2
2
  export declare function xbriefMigrationGuidance(): string;
3
3
  /**
4
4
  * One-line doctor / ritual signpost mirroring `renderPrecutoverLine` (#2110),
5
- * reporting an unambiguous convergence state (#2270). A migrated project reads
6
- * as `xbrief active` plus either `vbrief legacy marker` or `vbrief removed`; a
7
- * stray empty legacy root is called out as a pending convergence rather than a
8
- * generic "run migrate" dead end never a dual-empty-root ambiguity.
5
+ * reporting an unambiguous convergence state (#2270 / #2112). As of #2112
6
+ * (0.73.0 MINOR), the legacy vbrief read path is removed; the `legacy-only` and
7
+ * `dual-populated` states are still reported here so the doctor can direct
8
+ * unmigrated-project operators to `deft migrate:xbrief` before the engine runs.
9
9
  */
10
10
  export declare function renderXbriefMigrationLine(projectRoot: string): string;
11
11
  //# sourceMappingURL=signpost.d.ts.map
@@ -1,14 +1,14 @@
1
- import { detectLegacyVbriefLayout, detectXbriefConvergence } from "./detect.js";
1
+ import { detectXbriefConvergence } from "./detect.js";
2
2
  /** Operator guidance for the TS-native xbrief rename (#2034 / #2110). */
3
3
  export function xbriefMigrationGuidance() {
4
4
  return "Run `deft migrate:xbrief` (or `task migrate:xbrief`) to convert vbrief/ to xbrief/ safely.";
5
5
  }
6
6
  /**
7
7
  * One-line doctor / ritual signpost mirroring `renderPrecutoverLine` (#2110),
8
- * reporting an unambiguous convergence state (#2270). A migrated project reads
9
- * as `xbrief active` plus either `vbrief legacy marker` or `vbrief removed`; a
10
- * stray empty legacy root is called out as a pending convergence rather than a
11
- * generic "run migrate" dead end never a dual-empty-root ambiguity.
8
+ * reporting an unambiguous convergence state (#2270 / #2112). As of #2112
9
+ * (0.73.0 MINOR), the legacy vbrief read path is removed; the `legacy-only` and
10
+ * `dual-populated` states are still reported here so the doctor can direct
11
+ * unmigrated-project operators to `deft migrate:xbrief` before the engine runs.
12
12
  */
13
13
  export function renderXbriefMigrationLine(projectRoot) {
14
14
  const convergence = detectXbriefConvergence(projectRoot);
@@ -16,19 +16,15 @@ export function renderXbriefMigrationLine(projectRoot) {
16
16
  if (convergence.state === "xbrief-marker") {
17
17
  return "xBrief migration: converged -- xbrief active, vbrief legacy marker (read-compat).";
18
18
  }
19
- // Ambiguous dual-empty root: canonical xbrief/ (or none) plus a stray empty vbrief/.
19
+ // Ambiguous: canonical xbrief/ (or none) plus a stray empty vbrief/.
20
20
  if (convergence.state === "empty-vbrief") {
21
21
  return `xBrief migration: converge pending -- xbrief active, empty legacy vbrief/ present. ${xbriefMigrationGuidance()}`;
22
22
  }
23
- const { legacyLayout, reasons } = detectLegacyVbriefLayout(projectRoot);
24
- if (!legacyLayout) {
25
- return "xBrief migration: none -- xbrief active, vbrief removed.";
23
+ // Unmigrated: only vbrief/ found, or both roots populated without a marker.
24
+ if (convergence.state === "legacy-only" || convergence.state === "dual-populated") {
25
+ return `xBrief migration: migrate required -- ${convergence.state === "legacy-only" ? "only vbrief/ found, no xbrief/ layout" : "both vbrief/ and xbrief/ found without a migration marker"}. ${xbriefMigrationGuidance()}`;
26
26
  }
27
- const maxReasons = 3;
28
- const shown = reasons.slice(0, maxReasons);
29
- const remainder = reasons.length - shown.length;
30
- const summary = shown.join("; ").replace(/\r?\n/g, " ");
31
- const tail = remainder > 0 ? `${summary}; …and ${remainder} more marker(s)` : summary;
32
- return `xBrief migration: legacy vbrief layout detected -- ${tail}. ${xbriefMigrationGuidance()}`;
27
+ // Fully migrated: xbrief active, no legacy vbrief/ present (or empty root with no content).
28
+ return "xBrief migration: none -- xbrief active, vbrief removed.";
33
29
  }
34
30
  //# sourceMappingURL=signpost.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive-core",
3
- "version": "0.72.0",
3
+ "version": "0.73.1",
4
4
  "description": "TypeScript engine core for the Directive framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -281,8 +281,8 @@
281
281
  "provenance": true
282
282
  },
283
283
  "dependencies": {
284
- "@deftai/directive-content": "^0.72.0",
285
- "@deftai/directive-types": "^0.72.0",
284
+ "@deftai/directive-content": "^0.73.1",
285
+ "@deftai/directive-types": "^0.73.1",
286
286
  "archiver": "^8.0.0"
287
287
  },
288
288
  "scripts": {