@deftai/directive-core 0.84.0 → 0.85.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/dist/cache/fetch.d.ts +17 -0
- package/dist/cache/fetch.js +50 -0
- package/dist/doctor/checks.js +16 -1
- package/dist/doctor/constants.d.ts +2 -0
- package/dist/doctor/constants.js +8 -4
- package/dist/doctor/index.d.ts +1 -0
- package/dist/doctor/index.js +1 -0
- package/dist/doctor/main.js +13 -4
- package/dist/doctor/npm-registry.d.ts +23 -0
- package/dist/doctor/npm-registry.js +128 -0
- package/dist/doctor/npm-view.d.ts +10 -0
- package/dist/doctor/npm-view.js +31 -0
- package/dist/doctor/payload-staleness.js +2 -9
- package/dist/doctor/signpost-checks.d.ts +2 -1
- package/dist/doctor/signpost-checks.js +2 -0
- package/dist/doctor/types.d.ts +9 -0
- package/dist/eval-health-relocation/evaluate.js +15 -1
- package/dist/fs/projection-containment.js +1 -1
- package/dist/hooks/cursor-hooks.d.ts +6 -20
- package/dist/hooks/cursor-hooks.js +7 -92
- package/dist/init-deposit/agent-hooks.d.ts +2 -2
- package/dist/init-deposit/agent-hooks.js +15 -37
- package/dist/init-deposit/hygiene.d.ts +22 -0
- package/dist/init-deposit/hygiene.js +136 -4
- package/dist/init-deposit/legacy-detect.d.ts +25 -1
- package/dist/init-deposit/legacy-detect.js +143 -11
- package/dist/init-deposit/refresh.d.ts +2 -0
- package/dist/init-deposit/refresh.js +18 -5
- package/dist/policy/index.d.ts +2 -0
- package/dist/policy/index.js +2 -0
- package/dist/policy/org-force-on-migration.d.ts +44 -0
- package/dist/policy/org-force-on-migration.js +240 -0
- package/dist/policy/product-signal.d.ts +3 -1
- package/dist/policy/product-signal.js +15 -4
- package/dist/policy/value-feedback.d.ts +18 -1
- package/dist/policy/value-feedback.js +78 -5
- package/dist/preflight-cache/evaluate.js +12 -1
- package/dist/product-signal/consent-prompt.d.ts +13 -0
- package/dist/product-signal/consent-prompt.js +30 -0
- package/dist/product-signal/submit.js +22 -1
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.js +1 -0
- package/dist/render/rule-map-template.d.ts +2 -0
- package/dist/render/rule-map-template.js +407 -0
- package/dist/render/rule-map.d.ts +2 -0
- package/dist/render/rule-map.js +703 -0
- package/dist/review-monitor/constants.d.ts +7 -1
- package/dist/review-monitor/constants.js +40 -14
- package/dist/review-monitor/github-lease.d.ts +45 -0
- package/dist/review-monitor/github-lease.js +106 -0
- package/dist/review-monitor/index.d.ts +2 -0
- package/dist/review-monitor/index.js +2 -0
- package/dist/review-monitor/lease-comment.d.ts +36 -0
- package/dist/review-monitor/lease-comment.js +152 -0
- package/dist/review-monitor/record.d.ts +61 -13
- package/dist/review-monitor/record.js +379 -132
- package/dist/review-monitor/verify.d.ts +2 -0
- package/dist/review-monitor/verify.js +32 -13
- package/dist/scm/gh-rest.d.ts +7 -1
- package/dist/scm/gh-rest.js +35 -0
- package/dist/session/session-start.js +5 -0
- package/dist/task-surface/index.js +53 -13
- package/dist/xbrief-migrate/constants.d.ts +6 -0
- package/dist/xbrief-migrate/constants.js +6 -0
- package/dist/xbrief-migrate/index.d.ts +2 -2
- package/dist/xbrief-migrate/index.js +2 -2
- package/dist/xbrief-migrate/migrate-project.d.ts +7 -0
- package/dist/xbrief-migrate/migrate-project.js +18 -1
- package/package.json +3 -3
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { existsSync, statSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { sweepScratchDirs } from "../orchestration/subagent-monitor.js";
|
|
4
|
+
import { resolveRepo } from "../triage/queue/repo.js";
|
|
4
5
|
import { EXIT_CONFIG_ERROR, EXIT_NOT_READY, EXIT_READY, MONITORING_TIER_1, MONITORING_TIER_3, } from "./constants.js";
|
|
5
|
-
import { defaultSubagentStatusDir,
|
|
6
|
+
import { defaultSubagentStatusDir, fetchActiveMonitorFromGithub, readReviewMonitorFile, reviewMonitorPath, } from "./record.js";
|
|
6
7
|
import { isTier1, probeMonitoringTier } from "./tier-detection.js";
|
|
7
8
|
function spawnRedirect(probe) {
|
|
8
9
|
const primitive = probe.primitive ?? "sub-agent";
|
|
@@ -59,6 +60,8 @@ export function evaluateReviewMonitorGate(args) {
|
|
|
59
60
|
const callSite = args.callSite ?? "unspecified";
|
|
60
61
|
const staleMinutes = args.staleMinutes ?? 30;
|
|
61
62
|
const now = args.now ?? new Date();
|
|
63
|
+
// Legacy `.deft/review-monitor.json` is obsolete (#2814); explicit no-op read documents migration.
|
|
64
|
+
readReviewMonitorFile(reviewMonitorPath(projectRoot));
|
|
62
65
|
if (args.approach3 === true) {
|
|
63
66
|
if (isTier1(tier)) {
|
|
64
67
|
return {
|
|
@@ -103,33 +106,43 @@ export function evaluateReviewMonitorGate(args) {
|
|
|
103
106
|
callSite,
|
|
104
107
|
};
|
|
105
108
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
if (data === null) {
|
|
109
|
+
const repo = resolveRepo(args.repo ?? null, projectRoot);
|
|
110
|
+
if (repo === null) {
|
|
109
111
|
return {
|
|
110
112
|
exitCode: EXIT_CONFIG_ERROR,
|
|
111
|
-
message:
|
|
113
|
+
message: "verify_review_monitor: could not resolve owner/repo — pass --repo OWNER/REPO or run inside a git repo with origin",
|
|
112
114
|
tier,
|
|
113
115
|
monitorRecord: null,
|
|
114
116
|
heartbeatActive: false,
|
|
115
117
|
callSite,
|
|
116
118
|
};
|
|
117
119
|
}
|
|
118
|
-
const
|
|
120
|
+
const githubMonitor = fetchActiveMonitorFromGithub(repo, args.pr, {
|
|
119
121
|
now,
|
|
120
|
-
staleMinutes,
|
|
121
122
|
headSha: args.headSha ?? null,
|
|
123
|
+
seams: args.seams,
|
|
122
124
|
});
|
|
125
|
+
if (githubMonitor !== null && typeof githubMonitor === "object" && "error" in githubMonitor) {
|
|
126
|
+
return {
|
|
127
|
+
exitCode: EXIT_CONFIG_ERROR,
|
|
128
|
+
message: `verify_review_monitor: ${githubMonitor.error}`,
|
|
129
|
+
tier,
|
|
130
|
+
monitorRecord: null,
|
|
131
|
+
heartbeatActive: false,
|
|
132
|
+
callSite,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const monitorRecord = githubMonitor;
|
|
123
136
|
const heartbeatActive = hasActivePollingHeartbeat(projectRoot, args.pr, {
|
|
124
137
|
now,
|
|
125
138
|
staleMinutes,
|
|
126
139
|
});
|
|
127
|
-
if (monitorRecord !== null
|
|
128
|
-
const via = monitorRecord !== null ? "review-monitor record" : "subagent heartbeat";
|
|
140
|
+
if (monitorRecord !== null) {
|
|
129
141
|
return {
|
|
130
142
|
exitCode: EXIT_READY,
|
|
131
|
-
message: `verify_review_monitor: active review-
|
|
132
|
-
`(
|
|
143
|
+
message: `verify_review_monitor: active GitHub review-owner lease for PR #${args.pr} ` +
|
|
144
|
+
`(monitor_agent_id=${monitorRecord.monitor_agent_id}, owner=${monitorRecord.owner}, ` +
|
|
145
|
+
`call-site=${callSite}, tier=1, descriptor=${tier.descriptor ?? "unknown"}).`,
|
|
133
146
|
tier,
|
|
134
147
|
monitorRecord,
|
|
135
148
|
heartbeatActive,
|
|
@@ -141,15 +154,20 @@ export function evaluateReviewMonitorGate(args) {
|
|
|
141
154
|
: callSite === "swarm-phase6-cascade"
|
|
142
155
|
? "Swarm Phase 6 post force-push (#380)"
|
|
143
156
|
: "Solo drive-to merge-ready / review-cycle ownership";
|
|
157
|
+
const heartbeatHint = heartbeatActive
|
|
158
|
+
? " Note: local subagent heartbeat is present but is not a GitHub review-owner lease (#2814).\n"
|
|
159
|
+
: "";
|
|
144
160
|
return {
|
|
145
161
|
exitCode: EXIT_NOT_READY,
|
|
146
|
-
message: `verify_review_monitor: Tier 1 available but no active review-
|
|
162
|
+
message: `verify_review_monitor: Tier 1 available but no active GitHub review-owner lease for PR #${args.pr} (#2814).\n` +
|
|
163
|
+
heartbeatHint +
|
|
147
164
|
` Call site: ${siteHint}.\n` +
|
|
148
165
|
` Detected descriptor=${tier.descriptor ?? "unknown"} primitive=${tier.primitive ?? "none"}.\n` +
|
|
166
|
+
` Legacy .deft/review-monitor.json is ignored.\n` +
|
|
149
167
|
` ${spawnRedirect(tier)}`,
|
|
150
168
|
tier,
|
|
151
169
|
monitorRecord: null,
|
|
152
|
-
heartbeatActive
|
|
170
|
+
heartbeatActive,
|
|
153
171
|
callSite,
|
|
154
172
|
};
|
|
155
173
|
}
|
|
@@ -160,6 +178,7 @@ export function verifyResultToJson(result) {
|
|
|
160
178
|
heartbeat_active: result.heartbeatActive,
|
|
161
179
|
message: result.message,
|
|
162
180
|
monitor_agent_id: result.monitorRecord?.monitor_agent_id ?? null,
|
|
181
|
+
monitor_owner: result.monitorRecord?.owner ?? null,
|
|
163
182
|
monitor_record: result.monitorRecord,
|
|
164
183
|
ready: result.exitCode === EXIT_READY,
|
|
165
184
|
tier: result.tier.tier,
|
package/dist/scm/gh-rest.d.ts
CHANGED
|
@@ -53,9 +53,15 @@ export interface RestIssueListOptions {
|
|
|
53
53
|
export declare function restIssueList(repo: string, options?: RestIssueListOptions, seams?: GhRestSeams): Record<string, unknown>[];
|
|
54
54
|
export declare const REST_MAX_PER_PAGE = 100;
|
|
55
55
|
export declare const REST_PAGINATION_MAX_PAGES = 100;
|
|
56
|
-
export declare const PUBLIC_HELPERS: readonly ["restCreateIssue", "restPostComment", "restUpdateIssue", "restCreateLabel", "restCloseIssue", "restOpenPr", "restMergePr", "restIssueView", "restPrView", "restIssueList", "restIssueListPaginated"];
|
|
56
|
+
export declare const PUBLIC_HELPERS: readonly ["restCreateIssue", "restPostComment", "restUpdateComment", "restDeleteComment", "restGetUser", "restUpdateIssue", "restCreateLabel", "restCloseIssue", "restOpenPr", "restMergePr", "restIssueView", "restPrView", "restIssueList", "restIssueListPaginated"];
|
|
57
57
|
export declare function restCreateIssue(repo: string, title: string, body: string, labels?: readonly string[], seams?: GhRestSeams): Record<string, unknown>;
|
|
58
58
|
export declare function restPostComment(repo: string, n: number, body: string, seams?: GhRestSeams): Record<string, unknown>;
|
|
59
|
+
/** `PATCH /repos/{owner}/{repo}/issues/comments/{id}` -- edit a PR/issue comment in place. */
|
|
60
|
+
export declare function restUpdateComment(repo: string, commentId: number, body: string, seams?: GhRestSeams): Record<string, unknown>;
|
|
61
|
+
/** `DELETE /repos/{owner}/{repo}/issues/comments/{id}` -- remove a duplicate claim comment. */
|
|
62
|
+
export declare function restDeleteComment(repo: string, commentId: number, seams?: GhRestSeams): Record<string, unknown>;
|
|
63
|
+
/** `GET /user` -- authenticated GitHub login for review-owner claims. */
|
|
64
|
+
export declare function restGetUser(seams?: GhRestSeams): Record<string, unknown>;
|
|
59
65
|
export declare function restUpdateIssue(repo: string, n: number, patch: Record<string, unknown>, seams?: GhRestSeams): Record<string, unknown>;
|
|
60
66
|
export declare function restCreateLabel(repo: string, name: string, color: string, description: string, seams?: GhRestSeams): Record<string, unknown>;
|
|
61
67
|
export declare function restCloseIssue(repo: string, n: number, reason?: string | null, seams?: GhRestSeams): Record<string, unknown>;
|
package/dist/scm/gh-rest.js
CHANGED
|
@@ -171,6 +171,9 @@ export const REST_PAGINATION_MAX_PAGES = 100;
|
|
|
171
171
|
export const PUBLIC_HELPERS = [
|
|
172
172
|
"restCreateIssue",
|
|
173
173
|
"restPostComment",
|
|
174
|
+
"restUpdateComment",
|
|
175
|
+
"restDeleteComment",
|
|
176
|
+
"restGetUser",
|
|
174
177
|
"restUpdateIssue",
|
|
175
178
|
"restCreateLabel",
|
|
176
179
|
"restCloseIssue",
|
|
@@ -226,6 +229,38 @@ export function restPostComment(repo, n, body, seams = {}) {
|
|
|
226
229
|
...seams,
|
|
227
230
|
});
|
|
228
231
|
}
|
|
232
|
+
/** `PATCH /repos/{owner}/{repo}/issues/comments/{id}` -- edit a PR/issue comment in place. */
|
|
233
|
+
export function restUpdateComment(repo, commentId, body, seams = {}) {
|
|
234
|
+
const [owner, name] = splitRepo(repo);
|
|
235
|
+
const endpoint = `repos/${owner}/${name}/issues/comments/${commentId}`;
|
|
236
|
+
return execMutation([endpoint, "--method", "PATCH"], {
|
|
237
|
+
endpoint,
|
|
238
|
+
payload: { body },
|
|
239
|
+
hint: "verify repo permissions and comment id; check gh auth status",
|
|
240
|
+
...seams,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/** `DELETE /repos/{owner}/{repo}/issues/comments/{id}` -- remove a duplicate claim comment. */
|
|
244
|
+
export function restDeleteComment(repo, commentId, seams = {}) {
|
|
245
|
+
const [owner, name] = splitRepo(repo);
|
|
246
|
+
const endpoint = `repos/${owner}/${name}/issues/comments/${commentId}`;
|
|
247
|
+
return execMutation([endpoint, "--method", "DELETE"], {
|
|
248
|
+
endpoint,
|
|
249
|
+
payload: {},
|
|
250
|
+
hint: "verify repo permissions and comment id; check gh auth status",
|
|
251
|
+
...seams,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/** `GET /user` -- authenticated GitHub login for review-owner claims. */
|
|
255
|
+
export function restGetUser(seams = {}) {
|
|
256
|
+
return execApi(["user"], {
|
|
257
|
+
endpoint: "user",
|
|
258
|
+
payload: null,
|
|
259
|
+
hint: "verify gh auth status (`gh auth login`)",
|
|
260
|
+
runGhApiFn: seams.runGhApiFn,
|
|
261
|
+
whichFn: seams.whichFn,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
229
264
|
export function restUpdateIssue(repo, n, patch, seams = {}) {
|
|
230
265
|
const [owner, name] = splitRepo(repo);
|
|
231
266
|
const endpoint = `repos/${owner}/${name}/issues/${n}`;
|
|
@@ -5,6 +5,7 @@ import { MIGRATE_COMPLETION_NUDGE, shouldEmitMigrateNudge } from "../init-deposi
|
|
|
5
5
|
import { detectEnvironmentContext, environmentContextToDict, formatEnvironmentContext, } from "../platform/shell-context.js";
|
|
6
6
|
import { disclosureLine } from "../policy/disclosure.js";
|
|
7
7
|
import { resolvePolicy } from "../policy/resolve.js";
|
|
8
|
+
import { maybeFormatProductSignalConsentPrompt } from "../product-signal/consent-prompt.js";
|
|
8
9
|
import { maybeRunStalenessTickler } from "../staleness-tickler/run.js";
|
|
9
10
|
import { runDefaultMode } from "../triage/welcome/default-mode.js";
|
|
10
11
|
import { resolveUserMdPath } from "../user-config/resolve-user-md.js";
|
|
@@ -380,6 +381,10 @@ export function runSessionStart(projectRoot, options = {}) {
|
|
|
380
381
|
catch {
|
|
381
382
|
// observability only — session start must not abort on transient eval readback I/O
|
|
382
383
|
}
|
|
384
|
+
const consentPrompt = maybeFormatProductSignalConsentPrompt({ projectRoot });
|
|
385
|
+
if (consentPrompt.length > 0) {
|
|
386
|
+
lines.push(consentPrompt.trimEnd());
|
|
387
|
+
}
|
|
383
388
|
const payload = newRitualStatePayload({
|
|
384
389
|
sessionId: (options.newSessionId ?? randomUUID)(),
|
|
385
390
|
gitHead: gitHeadValue,
|
|
@@ -2,10 +2,24 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import { LEGACY_VBRIEF_VERSION } from "@deftai/directive-types";
|
|
5
|
+
import { assertProjectionContained, assertWriteTargetSafe, ProjectionContainmentError, } from "../fs/projection-containment.js";
|
|
5
6
|
const UNRELEASED_RE = /## \[Unreleased\][ \t]*\n([\s\S]*?)(?=\n## \[|$)/;
|
|
6
7
|
const CHANGE_NAME_RE = /^[\w][\w-]*$/;
|
|
7
8
|
const COMMIT_TYPES = "feat|fix|docs|chore|refactor|test|style|perf|ci|build|revert";
|
|
8
9
|
const COMMIT_SUBJECT_RE = new RegExp(`^(${COMMIT_TYPES})(\\(.+\\))?!?: .+`);
|
|
10
|
+
/** Refuse task-surface writes that escape via repo-controlled symlinks (#2807). */
|
|
11
|
+
function projectionTarget(projectDir, ...relSegments) {
|
|
12
|
+
const target = join(resolve(projectDir), ...relSegments);
|
|
13
|
+
assertProjectionContained(projectDir, target);
|
|
14
|
+
return target;
|
|
15
|
+
}
|
|
16
|
+
function containmentExitCode(io, err) {
|
|
17
|
+
if (err instanceof ProjectionContainmentError) {
|
|
18
|
+
io.writeErr(`FAIL: ${err.message}\n`);
|
|
19
|
+
return 2;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
9
23
|
function proposalTemplate(name) {
|
|
10
24
|
return {
|
|
11
25
|
vBRIEFInfo: { version: LEGACY_VBRIEF_VERSION },
|
|
@@ -67,19 +81,35 @@ export function runChangeInit(projectRoot, name, io) {
|
|
|
67
81
|
io.writeOut("FAIL: Name must contain only alphanumeric characters, underscores, and hyphens\n");
|
|
68
82
|
return 1;
|
|
69
83
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
const projectAbs = resolve(projectRoot);
|
|
85
|
+
try {
|
|
86
|
+
const base = projectionTarget(projectAbs, join("history", "changes", trimmed));
|
|
87
|
+
if (existsSync(base)) {
|
|
88
|
+
io.writeOut(`FAIL: ${base} already exists\n`);
|
|
89
|
+
return 1;
|
|
90
|
+
}
|
|
91
|
+
const specsDir = join(base, "specs");
|
|
92
|
+
assertProjectionContained(projectAbs, specsDir);
|
|
93
|
+
mkdirSync(specsDir, { recursive: true });
|
|
94
|
+
const proposalPath = join(base, "proposal.xbrief.json");
|
|
95
|
+
const tasksPath = join(base, "tasks.xbrief.json");
|
|
96
|
+
assertWriteTargetSafe(projectAbs, proposalPath);
|
|
97
|
+
assertWriteTargetSafe(projectAbs, tasksPath);
|
|
98
|
+
writeFileSync(proposalPath, `${JSON.stringify(proposalTemplate(trimmed), null, 2)}\n`, "utf8");
|
|
99
|
+
writeFileSync(tasksPath, `${JSON.stringify(tasksTemplate(trimmed), null, 2)}\n`, "utf8");
|
|
100
|
+
io.writeOut(`OK: Created change proposal at ${base}/\n`);
|
|
101
|
+
for (const file of ["proposal.xbrief.json", "tasks.xbrief.json", "specs/"]) {
|
|
102
|
+
io.writeOut(` - ${file}\n`);
|
|
103
|
+
}
|
|
104
|
+
return 0;
|
|
74
105
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
catch (err) {
|
|
107
|
+
const code = containmentExitCode(io, err);
|
|
108
|
+
if (code !== null) {
|
|
109
|
+
return code;
|
|
110
|
+
}
|
|
111
|
+
throw err;
|
|
81
112
|
}
|
|
82
|
-
return 0;
|
|
83
113
|
}
|
|
84
114
|
/** Port of ``task commit:lint`` inline Python (#2022 Phase 2). */
|
|
85
115
|
export function runCommitLint(projectRoot, io) {
|
|
@@ -119,8 +149,18 @@ export function runInstallUninstall(projectRoot, io) {
|
|
|
119
149
|
const filtered = lines.filter((line) => !line.startsWith("See deft/main.md") && !line.startsWith("Skills: deft/skills/"));
|
|
120
150
|
const next = filtered.join("");
|
|
121
151
|
if (next !== original) {
|
|
122
|
-
|
|
123
|
-
|
|
152
|
+
try {
|
|
153
|
+
assertWriteTargetSafe(resolve(projectRoot), path);
|
|
154
|
+
writeFileSync(path, next, "utf8");
|
|
155
|
+
io.writeOut("Removed deft entry from AGENTS.md\n");
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
const code = containmentExitCode(io, err);
|
|
159
|
+
if (code !== null) {
|
|
160
|
+
return code;
|
|
161
|
+
}
|
|
162
|
+
throw err;
|
|
163
|
+
}
|
|
124
164
|
}
|
|
125
165
|
else {
|
|
126
166
|
io.writeOut("No deft entry found in AGENTS.md\n");
|
|
@@ -4,6 +4,12 @@ export { LEGACY_VBRIEF_VERSION, VBRIEF_REFERENCE_PREFIX, VBRIEF_VERSION, XBRIEF_
|
|
|
4
4
|
export declare const V08_CONTAINER_ITEM_TYPES: Set<string>;
|
|
5
5
|
export declare const LEGACY_ARTIFACT_DIR: "vbrief";
|
|
6
6
|
export declare const MIGRATED_ARTIFACT_DIR: "xbrief";
|
|
7
|
+
/**
|
|
8
|
+
* Obsolete framework support narrative at the lifecycle root. Legacy
|
|
9
|
+
* `migrate:xbrief` copied this to `xbrief/vbrief.md` with broken framework
|
|
10
|
+
* links; consumer projections use `xbrief.md` instead (#2806).
|
|
11
|
+
*/
|
|
12
|
+
export declare const OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME: "vbrief.md";
|
|
7
13
|
export declare const LEGACY_ARTIFACT_SUFFIX: ".vbrief.json";
|
|
8
14
|
export declare const MIGRATED_ARTIFACT_SUFFIX: ".xbrief.json";
|
|
9
15
|
export declare const LEGACY_INFO_ROOT_KEY: "vBRIEFInfo";
|
|
@@ -5,6 +5,12 @@ export { LEGACY_VBRIEF_VERSION, VBRIEF_REFERENCE_PREFIX, VBRIEF_VERSION, XBRIEF_
|
|
|
5
5
|
export const V08_CONTAINER_ITEM_TYPES = new Set([...VALID_PLAN_ITEM_TYPES].filter((t) => t !== "task"));
|
|
6
6
|
export const LEGACY_ARTIFACT_DIR = "vbrief";
|
|
7
7
|
export const MIGRATED_ARTIFACT_DIR = "xbrief";
|
|
8
|
+
/**
|
|
9
|
+
* Obsolete framework support narrative at the lifecycle root. Legacy
|
|
10
|
+
* `migrate:xbrief` copied this to `xbrief/vbrief.md` with broken framework
|
|
11
|
+
* links; consumer projections use `xbrief.md` instead (#2806).
|
|
12
|
+
*/
|
|
13
|
+
export const OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME = "vbrief.md";
|
|
8
14
|
export const LEGACY_ARTIFACT_SUFFIX = ".vbrief.json";
|
|
9
15
|
export const MIGRATED_ARTIFACT_SUFFIX = ".xbrief.json";
|
|
10
16
|
export const LEGACY_INFO_ROOT_KEY = "vBRIEFInfo";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { detectStaleUnmanagedHeader, type HeaderPatchOutcome, type HeaderRewriteResult, type HeaderTokenReplacement, LEGACY_HEADER_TOKENS, patchAgentsMdHeader, renderHeaderPatchSummary, renderStaleHeaderLine, rewriteUnmanagedHeaderTokens, type StaleHeaderDetection, } from "./agents-header.js";
|
|
2
|
-
export { VBRIEF_DEPRECATION_MARKER_BODY, VBRIEF_DEPRECATION_MARKER_FILENAME, VBRIEF_DEPRECATION_MARKER_SENTINEL, } from "./constants.js";
|
|
2
|
+
export { OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME, VBRIEF_DEPRECATION_MARKER_BODY, VBRIEF_DEPRECATION_MARKER_FILENAME, VBRIEF_DEPRECATION_MARKER_SENTINEL, } from "./constants.js";
|
|
3
3
|
export { detectLegacyVbriefLayout, detectXbriefConvergence, type LegacyVbriefLayoutDetection, type XbriefConvergenceDetection, type XbriefConvergenceState, } from "./detect.js";
|
|
4
4
|
export { BUILTIN_ALLOW_LIST, type DriftEvaluateOptions, type DriftEvaluateResult, type DriftFinding, type DriftScanMode, evaluateXbriefDrift, LEGACY_REFERENCE_PREFIX, scanCorpusToken, } from "./drift-gate.js";
|
|
5
5
|
export { hasVbriefDeprecationMarker, isDirectory, isEffectivelyEmptyDir, } from "./fs-helpers.js";
|
|
6
|
-
export { convergeLegacyVbriefRoot, emitXbriefMigration, runXbriefMigration, runXbriefMigrationCli, type VbriefConvergeAction, type XbriefMigrationArgs, type XbriefMigrationIo, type XbriefMigrationOutcome, } from "./migrate-project.js";
|
|
6
|
+
export { convergeLegacyVbriefRoot, emitXbriefMigration, removeStaleMigratedFrameworkNarrative, runXbriefMigration, runXbriefMigrationCli, shouldOmitLegacyMigrationFile, type VbriefConvergeAction, type XbriefMigrationArgs, type XbriefMigrationIo, type XbriefMigrationOutcome, } from "./migrate-project.js";
|
|
7
7
|
export { renderXbriefMigrationLine, xbriefMigrationGuidance } from "./signpost.js";
|
|
8
8
|
export { assertFeatureEmissionAllowed, assertLayoutAwareWritePath, FeatureEmissionRejectedError, type JsonObject, type JsonValue, readDeclaredArtifactVersion, resolveLayoutAwareRelativePath, rewriteEmbeddedTokens, SplitLayoutRejectedError, TransformError, transformArtifactV06ToV08, transformArtifactV06ToV08Transactional, } from "./transforms.js";
|
|
9
9
|
export { isPatchOnlyUpgrade, parseSemverPrefix } from "./version.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { detectStaleUnmanagedHeader, LEGACY_HEADER_TOKENS, patchAgentsMdHeader, renderHeaderPatchSummary, renderStaleHeaderLine, rewriteUnmanagedHeaderTokens, } from "./agents-header.js";
|
|
2
|
-
export { VBRIEF_DEPRECATION_MARKER_BODY, VBRIEF_DEPRECATION_MARKER_FILENAME, VBRIEF_DEPRECATION_MARKER_SENTINEL, } from "./constants.js";
|
|
2
|
+
export { OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME, VBRIEF_DEPRECATION_MARKER_BODY, VBRIEF_DEPRECATION_MARKER_FILENAME, VBRIEF_DEPRECATION_MARKER_SENTINEL, } from "./constants.js";
|
|
3
3
|
export { detectLegacyVbriefLayout, detectXbriefConvergence, } from "./detect.js";
|
|
4
4
|
export { BUILTIN_ALLOW_LIST, evaluateXbriefDrift, LEGACY_REFERENCE_PREFIX, scanCorpusToken, } from "./drift-gate.js";
|
|
5
5
|
export { hasVbriefDeprecationMarker, isDirectory, isEffectivelyEmptyDir, } from "./fs-helpers.js";
|
|
6
|
-
export { convergeLegacyVbriefRoot, emitXbriefMigration, runXbriefMigration, runXbriefMigrationCli, } from "./migrate-project.js";
|
|
6
|
+
export { convergeLegacyVbriefRoot, emitXbriefMigration, removeStaleMigratedFrameworkNarrative, runXbriefMigration, runXbriefMigrationCli, shouldOmitLegacyMigrationFile, } from "./migrate-project.js";
|
|
7
7
|
export { renderXbriefMigrationLine, xbriefMigrationGuidance } from "./signpost.js";
|
|
8
8
|
export { assertFeatureEmissionAllowed, assertLayoutAwareWritePath, FeatureEmissionRejectedError, readDeclaredArtifactVersion, resolveLayoutAwareRelativePath, rewriteEmbeddedTokens, SplitLayoutRejectedError, TransformError, transformArtifactV06ToV08, transformArtifactV06ToV08Transactional, } from "./transforms.js";
|
|
9
9
|
export { isPatchOnlyUpgrade, parseSemverPrefix } from "./version.js";
|
|
@@ -33,6 +33,13 @@ export type XbriefMigrationOutcome = {
|
|
|
33
33
|
readonly kind: "config";
|
|
34
34
|
readonly message: string;
|
|
35
35
|
};
|
|
36
|
+
/** True when a legacy lifecycle file is an obsolete framework narrative (#2806). */
|
|
37
|
+
export declare function shouldOmitLegacyMigrationFile(relativePath: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Remove a stale `xbrief/vbrief.md` left by an earlier migrate:xbrief run.
|
|
40
|
+
* Project JSON records and `xbrief/schemas/` are untouched (#2806).
|
|
41
|
+
*/
|
|
42
|
+
export declare function removeStaleMigratedFrameworkNarrative(projectRoot: string): boolean;
|
|
36
43
|
/**
|
|
37
44
|
* Converge a leftover legacy `vbrief/` root to an unambiguous state (#2270).
|
|
38
45
|
* An effectively-empty tree is removed by default (single canonical root); a
|
|
@@ -3,7 +3,7 @@ import { dirname, join, relative, resolve } from "node:path";
|
|
|
3
3
|
import { checkGitClean } from "../migrate-preflight/index.js";
|
|
4
4
|
import { agentsRefreshPlan } from "../platform/agents-md.js";
|
|
5
5
|
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";
|
|
6
|
+
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
7
|
import { detectLegacyVbriefLayout, detectXbriefConvergence } from "./detect.js";
|
|
8
8
|
import { hasVbriefDeprecationMarker, isDirectory, isEffectivelyEmptyDir } from "./fs-helpers.js";
|
|
9
9
|
import { assertMigrationSourceSafe } from "./migration-containment.js";
|
|
@@ -24,6 +24,21 @@ function collectFiles(root, acc = []) {
|
|
|
24
24
|
}
|
|
25
25
|
return acc;
|
|
26
26
|
}
|
|
27
|
+
/** True when a legacy lifecycle file is an obsolete framework narrative (#2806). */
|
|
28
|
+
export function shouldOmitLegacyMigrationFile(relativePath) {
|
|
29
|
+
return relativePath.replace(/\\/g, "/") === OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Remove a stale `xbrief/vbrief.md` left by an earlier migrate:xbrief run.
|
|
33
|
+
* Project JSON records and `xbrief/schemas/` are untouched (#2806).
|
|
34
|
+
*/
|
|
35
|
+
export function removeStaleMigratedFrameworkNarrative(projectRoot) {
|
|
36
|
+
const stale = join(projectRoot, MIGRATED_ARTIFACT_DIR, OBSOLETE_FRAMEWORK_NARRATIVE_FILENAME);
|
|
37
|
+
if (!existsSync(stale))
|
|
38
|
+
return false;
|
|
39
|
+
rmSync(stale, { force: true });
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
27
42
|
function mapRelativePath(relativePath) {
|
|
28
43
|
return relativePath
|
|
29
44
|
.split(/[/\\]/)
|
|
@@ -81,6 +96,8 @@ function migrateLegacyTree(projectRoot, legacyDir, options) {
|
|
|
81
96
|
try {
|
|
82
97
|
for (const srcPath of files) {
|
|
83
98
|
const rel = relative(legacyDir, srcPath);
|
|
99
|
+
if (shouldOmitLegacyMigrationFile(rel))
|
|
100
|
+
continue;
|
|
84
101
|
const destPath = join(stagedDir, mapRelativePath(rel));
|
|
85
102
|
writeMigratedFile(srcPath, destPath);
|
|
86
103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.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.
|
|
321
|
-
"@deftai/directive-types": "^0.
|
|
320
|
+
"@deftai/directive-content": "^0.85.0",
|
|
321
|
+
"@deftai/directive-types": "^0.85.0",
|
|
322
322
|
"archiver": "^8.0.0"
|
|
323
323
|
},
|
|
324
324
|
"scripts": {
|