@deftai/directive-core 0.84.0 → 0.86.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.
Files changed (79) hide show
  1. package/dist/cache/fetch.d.ts +17 -0
  2. package/dist/cache/fetch.js +50 -0
  3. package/dist/doctor/checks.js +16 -1
  4. package/dist/doctor/constants.d.ts +4 -2
  5. package/dist/doctor/constants.js +10 -6
  6. package/dist/doctor/index.d.ts +1 -0
  7. package/dist/doctor/index.js +1 -0
  8. package/dist/doctor/main.d.ts +2 -1
  9. package/dist/doctor/main.js +83 -22
  10. package/dist/doctor/npm-registry.d.ts +23 -0
  11. package/dist/doctor/npm-registry.js +128 -0
  12. package/dist/doctor/npm-view.d.ts +10 -0
  13. package/dist/doctor/npm-view.js +31 -0
  14. package/dist/doctor/payload-staleness.js +2 -9
  15. package/dist/doctor/signpost-checks.d.ts +2 -1
  16. package/dist/doctor/signpost-checks.js +2 -0
  17. package/dist/doctor/types.d.ts +12 -0
  18. package/dist/eval-health-relocation/evaluate.js +15 -1
  19. package/dist/fs/projection-containment.js +1 -1
  20. package/dist/hooks/cursor-hooks.d.ts +6 -20
  21. package/dist/hooks/cursor-hooks.js +7 -92
  22. package/dist/init-deposit/agent-hooks.d.ts +2 -2
  23. package/dist/init-deposit/agent-hooks.js +24 -38
  24. package/dist/init-deposit/gitignore.js +5 -0
  25. package/dist/init-deposit/hygiene.d.ts +22 -0
  26. package/dist/init-deposit/hygiene.js +136 -4
  27. package/dist/init-deposit/legacy-detect.d.ts +25 -1
  28. package/dist/init-deposit/legacy-detect.js +143 -11
  29. package/dist/init-deposit/refresh.d.ts +2 -0
  30. package/dist/init-deposit/refresh.js +18 -5
  31. package/dist/policy/index.d.ts +2 -0
  32. package/dist/policy/index.js +2 -0
  33. package/dist/policy/org-force-on-migration.d.ts +44 -0
  34. package/dist/policy/org-force-on-migration.js +242 -0
  35. package/dist/policy/product-signal.d.ts +3 -1
  36. package/dist/policy/product-signal.js +15 -4
  37. package/dist/policy/value-feedback.d.ts +18 -1
  38. package/dist/policy/value-feedback.js +78 -5
  39. package/dist/preflight-cache/evaluate.js +12 -1
  40. package/dist/product-signal/consent-prompt.d.ts +13 -0
  41. package/dist/product-signal/consent-prompt.js +30 -0
  42. package/dist/product-signal/submit.js +22 -1
  43. package/dist/render/framework-commands.d.ts +1 -1
  44. package/dist/render/framework-commands.js +6 -6
  45. package/dist/render/index.d.ts +1 -0
  46. package/dist/render/index.js +1 -0
  47. package/dist/render/roadmap-render.d.ts +5 -1
  48. package/dist/render/roadmap-render.js +20 -2
  49. package/dist/render/rule-map-template.d.ts +2 -0
  50. package/dist/render/rule-map-template.js +407 -0
  51. package/dist/render/rule-map.d.ts +2 -0
  52. package/dist/render/rule-map.js +708 -0
  53. package/dist/review-monitor/constants.d.ts +7 -1
  54. package/dist/review-monitor/constants.js +40 -14
  55. package/dist/review-monitor/github-lease.d.ts +45 -0
  56. package/dist/review-monitor/github-lease.js +106 -0
  57. package/dist/review-monitor/index.d.ts +2 -0
  58. package/dist/review-monitor/index.js +2 -0
  59. package/dist/review-monitor/lease-comment.d.ts +36 -0
  60. package/dist/review-monitor/lease-comment.js +152 -0
  61. package/dist/review-monitor/record.d.ts +61 -13
  62. package/dist/review-monitor/record.js +379 -132
  63. package/dist/review-monitor/verify.d.ts +2 -0
  64. package/dist/review-monitor/verify.js +32 -13
  65. package/dist/scm/gh-rest.d.ts +7 -1
  66. package/dist/scm/gh-rest.js +35 -0
  67. package/dist/session/session-start.js +5 -0
  68. package/dist/task-surface/index.js +53 -13
  69. package/dist/verify-env/agent-hooks-live-probe.d.ts +32 -0
  70. package/dist/verify-env/agent-hooks-live-probe.js +216 -0
  71. package/dist/verify-env/index.d.ts +1 -0
  72. package/dist/verify-env/index.js +1 -0
  73. package/dist/xbrief-migrate/constants.d.ts +6 -0
  74. package/dist/xbrief-migrate/constants.js +6 -0
  75. package/dist/xbrief-migrate/index.d.ts +2 -2
  76. package/dist/xbrief-migrate/index.js +2 -2
  77. package/dist/xbrief-migrate/migrate-project.d.ts +7 -0
  78. package/dist/xbrief-migrate/migrate-project.js +44 -18
  79. package/package.json +3 -3
@@ -1,9 +1,10 @@
1
1
  import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
2
2
  import { dirname, join, relative, resolve } from "node:path";
3
+ import { assertWriteTargetSafe, ProjectionContainmentError } from "../fs/projection-containment.js";
3
4
  import { checkGitClean } from "../migrate-preflight/index.js";
4
- import { agentsRefreshPlan } from "../platform/agents-md.js";
5
+ import { applyAgentsRefresh } from "../platform/agents-md.js";
5
6
  import { patchAgentsMdHeader, renderHeaderPatchSummary } from "./agents-header.js";
6
- import { LEGACY_ARTIFACT_DIR, LEGACY_ARTIFACT_SUFFIX, MIGRATED_ARTIFACT_DIR, MIGRATED_ARTIFACT_SUFFIX, VBRIEF_DEPRECATION_MARKER_BODY, VBRIEF_DEPRECATION_MARKER_FILENAME, } from "./constants.js";
7
+ import { LEGACY_ARTIFACT_DIR, LEGACY_ARTIFACT_SUFFIX, MIGRATED_ARTIFACT_DIR, MIGRATED_ARTIFACT_SUFFIX, OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME, VBRIEF_DEPRECATION_MARKER_BODY, VBRIEF_DEPRECATION_MARKER_FILENAME, } from "./constants.js";
7
8
  import { detectLegacyVbriefLayout, detectXbriefConvergence } from "./detect.js";
8
9
  import { hasVbriefDeprecationMarker, isDirectory, isEffectivelyEmptyDir } from "./fs-helpers.js";
9
10
  import { assertMigrationSourceSafe } from "./migration-containment.js";
@@ -24,6 +25,21 @@ function collectFiles(root, acc = []) {
24
25
  }
25
26
  return acc;
26
27
  }
28
+ /** True when a legacy lifecycle file is an obsolete framework narrative (#2806). */
29
+ export function shouldOmitLegacyMigrationFile(relativePath) {
30
+ return relativePath.replace(/\\/g, "/") === OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME;
31
+ }
32
+ /**
33
+ * Remove a stale `xbrief/vbrief.md` left by an earlier migrate:xbrief run.
34
+ * Project JSON records and `xbrief/schemas/` are untouched (#2806).
35
+ */
36
+ export function removeStaleMigratedFrameworkNarrative(projectRoot) {
37
+ const stale = join(projectRoot, MIGRATED_ARTIFACT_DIR, OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME);
38
+ if (!existsSync(stale))
39
+ return false;
40
+ rmSync(stale, { force: true });
41
+ return true;
42
+ }
27
43
  function mapRelativePath(relativePath) {
28
44
  return relativePath
29
45
  .split(/[/\\]/)
@@ -81,6 +97,8 @@ function migrateLegacyTree(projectRoot, legacyDir, options) {
81
97
  try {
82
98
  for (const srcPath of files) {
83
99
  const rel = relative(legacyDir, srcPath);
100
+ if (shouldOmitLegacyMigrationFile(rel))
101
+ continue;
84
102
  const destPath = join(stagedDir, mapRelativePath(rel));
85
103
  writeMigratedFile(srcPath, destPath);
86
104
  }
@@ -140,25 +158,33 @@ function renameOrReplace(src, dest) {
140
158
  rmSync(src, { recursive: true, force: true });
141
159
  }
142
160
  function runAgentsRefresh(projectRoot, frameworkRoot, io) {
143
- const plan = agentsRefreshPlan(projectRoot, { frameworkRoot });
144
- const state = String(plan.state ?? "unknown");
145
- if (state === "current") {
146
- io.writeOut("AGENTS.md managed section is current — no changes.\n");
161
+ try {
162
+ assertWriteTargetSafe(projectRoot, join(projectRoot, "AGENTS.md"));
163
+ const { state, wrote, writable } = applyAgentsRefresh(projectRoot, {}, { frameworkRoot });
164
+ if (state === "current") {
165
+ io.writeOut("AGENTS.md managed section is current — no changes.\n");
166
+ return 0;
167
+ }
168
+ if (state === "template-missing" || state === "template-malformed" || state === "unreadable") {
169
+ io.writeErr(`agents:refresh failed: ${state}\n`);
170
+ return 2;
171
+ }
172
+ if (!writable) {
173
+ io.writeErr("agents:refresh failed: plan produced no new_content\n");
174
+ return 2;
175
+ }
176
+ if (wrote) {
177
+ io.writeOut(`AGENTS.md updated (state=${state}).\n`);
178
+ }
147
179
  return 0;
148
180
  }
149
- if (state === "template-missing" || state === "template-malformed" || state === "unreadable") {
150
- io.writeErr(`agents:refresh failed: ${state}\n`);
151
- return 2;
152
- }
153
- const newContent = plan.new_content;
154
- if (typeof newContent !== "string") {
155
- io.writeErr("agents:refresh failed: plan produced no new_content\n");
156
- return 2;
181
+ catch (err) {
182
+ if (err instanceof ProjectionContainmentError) {
183
+ io.writeErr(`agents:refresh failed: ${err.message}\n`);
184
+ return 2;
185
+ }
186
+ throw err;
157
187
  }
158
- const path = String(plan.path ?? join(projectRoot, "AGENTS.md"));
159
- writeFileSync(path, newContent, "utf8");
160
- io.writeOut(`AGENTS.md updated (state=${state}).\n`);
161
- return 0;
162
188
  }
163
189
  /** Core orchestrator for the consumer xbrief rename (#2110) + convergence (#2270). */
164
190
  export function runXbriefMigration(args, _io) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive-core",
3
- "version": "0.84.0",
3
+ "version": "0.86.0",
4
4
  "description": "TypeScript engine core for the Directive framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -317,8 +317,8 @@
317
317
  "provenance": true
318
318
  },
319
319
  "dependencies": {
320
- "@deftai/directive-content": "^0.84.0",
321
- "@deftai/directive-types": "^0.84.0",
320
+ "@deftai/directive-content": "^0.86.0",
321
+ "@deftai/directive-types": "^0.86.0",
322
322
  "archiver": "^8.0.0"
323
323
  },
324
324
  "scripts": {