@deftai/directive-core 0.107.0 → 0.109.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/architecture/sor-preflight.js +2 -0
- package/dist/cache/operations.js +1 -1
- package/dist/check/cached-orchestrator.js +28 -3
- package/dist/check/gate-lists.d.ts +14 -0
- package/dist/check/gate-lists.js +26 -3
- package/dist/check/named-cause.js +18 -3
- package/dist/check/session-completed-ac.d.ts +1 -1
- package/dist/check/session-completed-ac.js +1 -1
- package/dist/codebase/provider.js +7 -1
- package/dist/consumer-check-contract/evaluate.d.ts +47 -0
- package/dist/consumer-check-contract/evaluate.js +181 -15
- package/dist/delivery-attempt/evaluate.d.ts +9 -1
- package/dist/delivery-attempt/evaluate.js +69 -0
- package/dist/delivery-attempt/handoff.js +1 -1
- package/dist/delivery-attempt/index.d.ts +1 -1
- package/dist/delivery-attempt/index.js +1 -1
- package/dist/deposit/live-procedure-exclusions.d.ts +18 -0
- package/dist/deposit/live-procedure-exclusions.js +110 -0
- package/dist/deposit/live-procedure-targets.d.ts +45 -0
- package/dist/deposit/live-procedure-targets.js +274 -0
- package/dist/deposit/python-free.d.ts +6 -0
- package/dist/deposit/python-free.js +15 -0
- package/dist/deposit/rewrite-deposit-links.d.ts +42 -0
- package/dist/deposit/rewrite-deposit-links.js +148 -0
- package/dist/deposit/run-stage-content-pack.d.ts +2 -0
- package/dist/deposit/run-stage-content-pack.js +3 -0
- package/dist/deposit/stage-content-pack.d.ts +17 -0
- package/dist/deposit/stage-content-pack.js +91 -0
- package/dist/design-critique/citation-grammar.d.ts +60 -0
- package/dist/design-critique/citation-grammar.js +303 -0
- package/dist/design-critique/completed-arc-record.d.ts +62 -0
- package/dist/design-critique/completed-arc-record.js +277 -0
- package/dist/freshness/bind.d.ts +32 -3
- package/dist/freshness/bind.js +58 -12
- package/dist/hooks/classify/host-session-identity.d.ts +89 -0
- package/dist/hooks/classify/host-session-identity.js +467 -0
- package/dist/hooks/classify/index.d.ts +3 -2
- package/dist/hooks/classify/index.js +3 -2
- package/dist/hooks/classify/paths.d.ts +9 -0
- package/dist/hooks/classify/paths.js +39 -0
- package/dist/hooks/classify/stdin.d.ts +5 -0
- package/dist/hooks/classify/stdin.js +94 -1
- package/dist/hooks/dest-form.d.ts +20 -1
- package/dist/hooks/dest-form.js +158 -21
- package/dist/hooks/dispatcher.d.ts +58 -3
- package/dist/hooks/dispatcher.js +762 -73
- package/dist/hooks/fixtures/cases.d.ts +22 -2
- package/dist/hooks/fixtures/cases.js +228 -0
- package/dist/hooks/git-destructive-log.d.ts +32 -0
- package/dist/hooks/git-destructive-log.js +46 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/scope.js +3 -1
- package/dist/hooks/shell-write-targets.d.ts +10 -0
- package/dist/hooks/shell-write-targets.js +274 -0
- package/dist/hooks/tools.d.ts +20 -2
- package/dist/hooks/tools.js +30 -1
- package/dist/init-deposit/agent-hooks.d.ts +2 -1
- package/dist/init-deposit/agent-hooks.js +8 -1
- package/dist/init-deposit/gitignore.d.ts +7 -0
- package/dist/init-deposit/gitignore.js +24 -0
- package/dist/init-deposit/hook-runtime-travel.d.ts +77 -0
- package/dist/init-deposit/hook-runtime-travel.js +269 -0
- package/dist/init-deposit/init-deposit.js +3 -0
- package/dist/init-deposit/refresh.js +7 -0
- package/dist/init-deposit/runtime-writers.d.ts +14 -0
- package/dist/init-deposit/runtime-writers.js +33 -0
- package/dist/intake/clause-derivation.js +9 -3
- package/dist/intake/issue-ingest.d.ts +6 -1
- package/dist/intake/issue-ingest.js +83 -4
- package/dist/intake/platform-capabilities.d.ts +9 -2
- package/dist/intake/platform-capabilities.js +38 -9
- package/dist/intake/reconcile-issues.js +13 -13
- package/dist/lifecycle/brief-envelope.d.ts +25 -0
- package/dist/lifecycle/brief-envelope.js +42 -0
- package/dist/lifecycle/index.d.ts +1 -0
- package/dist/lifecycle/index.js +1 -0
- package/dist/literal-acceptance/evaluate.js +14 -5
- package/dist/literal-acceptance/index.d.ts +1 -1
- package/dist/literal-acceptance/index.js +1 -1
- package/dist/literal-acceptance/run.d.ts +2 -0
- package/dist/literal-acceptance/run.js +19 -1
- package/dist/orphan-active/candidate-scope.d.ts +53 -0
- package/dist/orphan-active/candidate-scope.js +157 -0
- package/dist/orphan-active/evaluate.d.ts +52 -0
- package/dist/orphan-active/evaluate.js +250 -128
- package/dist/orphan-active/index.d.ts +2 -0
- package/dist/orphan-active/index.js +2 -0
- package/dist/orphan-active/issue-state.d.ts +121 -0
- package/dist/orphan-active/issue-state.js +278 -0
- package/dist/platform/cursor-managed-runtime.d.ts +95 -0
- package/dist/platform/cursor-managed-runtime.js +241 -0
- package/dist/platform/index.d.ts +1 -0
- package/dist/platform/index.js +1 -0
- package/dist/platform/platform-capabilities.d.ts +23 -1
- package/dist/platform/platform-capabilities.js +55 -15
- package/dist/policy/ceremony-dial.js +5 -9
- package/dist/policy/host-hooks.js +4 -9
- package/dist/policy/merge-approval-head.js +7 -6
- package/dist/policy/org-force-on-migration.js +5 -10
- package/dist/policy/plan-extensions.d.ts +14 -2
- package/dist/policy/plan-extensions.js +24 -3
- package/dist/policy/product-signal.js +5 -10
- package/dist/policy/require-human-merge.js +5 -9
- package/dist/policy/resolve.js +77 -16
- package/dist/policy/value-feedback.js +9 -18
- package/dist/pr-closeout-attestable/evaluate.d.ts +80 -0
- package/dist/pr-closeout-attestable/evaluate.js +306 -0
- package/dist/pr-closeout-attestable/index.d.ts +2 -0
- package/dist/pr-closeout-attestable/index.js +2 -0
- package/dist/pr-closing-keywords/gh.js +32 -9
- package/dist/pr-closing-keywords/main.d.ts +1 -0
- package/dist/pr-closing-keywords/main.js +68 -3
- package/dist/pr-closing-keywords/types.d.ts +2 -0
- package/dist/pr-merge-readiness/gh.js +32 -9
- package/dist/pr-protected-issues/gh.d.ts +6 -2
- package/dist/pr-protected-issues/gh.js +42 -11
- package/dist/pr-wait-mergeable/cascade.d.ts +9 -1
- package/dist/pr-wait-mergeable/cascade.js +21 -1
- package/dist/pr-wait-mergeable/types.d.ts +2 -0
- package/dist/pr-wait-mergeable/wrappers.d.ts +6 -0
- package/dist/pr-wait-mergeable/wrappers.js +14 -3
- package/dist/preflight/evaluate.d.ts +15 -0
- package/dist/preflight/evaluate.js +29 -3
- package/dist/product-first-done-gate/acceptance-resolver.d.ts +14 -2
- package/dist/product-first-done-gate/acceptance-resolver.js +13 -2
- package/dist/product-first-done-gate/evaluate.js +23 -9
- package/dist/product-first-done-gate/types.js +2 -0
- package/dist/release/cli-drift-report.d.ts +68 -0
- package/dist/release/cli-drift-report.js +189 -0
- package/dist/release/consumer-hard-stops.d.ts +48 -0
- package/dist/release/consumer-hard-stops.js +140 -0
- package/dist/release/consumer-readiness-disclosure.d.ts +18 -0
- package/dist/release/consumer-readiness-disclosure.js +51 -0
- package/dist/release/index.d.ts +3 -0
- package/dist/release/index.js +3 -0
- package/dist/release/issue-state-fetch.d.ts +5 -3
- package/dist/release/issue-state-fetch.js +86 -21
- package/dist/release/native-steps.js +1 -0
- package/dist/release/pipeline.js +74 -0
- package/dist/release/run-consumer-readiness.d.ts +15 -0
- package/dist/release/run-consumer-readiness.js +24 -0
- package/dist/release/types.d.ts +20 -0
- package/dist/render/constants.d.ts +4 -0
- package/dist/render/constants.js +11 -8
- package/dist/render/export-spec.js +31 -5
- package/dist/render/index.d.ts +1 -1
- package/dist/render/index.js +1 -1
- package/dist/render/prd-render.d.ts +4 -1
- package/dist/render/prd-render.js +82 -23
- package/dist/render/project-render.js +14 -7
- package/dist/render/scope-outlook.d.ts +2 -0
- package/dist/render/scope-outlook.js +3 -0
- package/dist/render/spec-render.js +2 -2
- package/dist/resolution/package-manager.d.ts +33 -4
- package/dist/resolution/package-manager.js +210 -9
- package/dist/review-monitor/constants.d.ts +7 -0
- package/dist/review-monitor/constants.js +7 -0
- package/dist/review-monitor/github-lease.d.ts +98 -1
- package/dist/review-monitor/github-lease.js +186 -4
- package/dist/review-monitor/lease-comment.d.ts +36 -0
- package/dist/review-monitor/lease-comment.js +103 -2
- package/dist/run-summary/types.d.ts +2 -2
- package/dist/scm/build-command.d.ts +2 -2
- package/dist/scm/build-command.js +2 -2
- package/dist/scm/call-shape.d.ts +25 -0
- package/dist/scm/call-shape.js +59 -0
- package/dist/scm/call.d.ts +7 -4
- package/dist/scm/call.js +48 -9
- package/dist/scm/design-critique-chip.d.ts +1 -0
- package/dist/scm/design-critique-chip.js +22 -6
- package/dist/scm/gh-rest.d.ts +34 -13
- package/dist/scm/gh-rest.js +168 -15
- package/dist/scm/index.d.ts +2 -0
- package/dist/scm/index.js +2 -0
- package/dist/scm/readiness.d.ts +2 -0
- package/dist/scm/readiness.js +28 -4
- package/dist/scm/spawn-status.d.ts +33 -0
- package/dist/scm/spawn-status.js +53 -0
- package/dist/scope/acceptance-evidence.d.ts +1 -1
- package/dist/scope/project-definition-sync.js +14 -7
- package/dist/scope/transition.js +4 -14
- package/dist/session/ac-pass-banking.d.ts +2 -2
- package/dist/session/ac-pass-banking.js +2 -2
- package/dist/session/git.d.ts +24 -0
- package/dist/session/git.js +138 -2
- package/dist/session/host-session-owner.d.ts +53 -0
- package/dist/session/host-session-owner.js +89 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/occupancy.d.ts +259 -13
- package/dist/session/occupancy.js +877 -33
- package/dist/session/ritual-sentinel.d.ts +5 -0
- package/dist/session/ritual-sentinel.js +5 -0
- package/dist/session/session-ready.d.ts +5 -1
- package/dist/session/session-ready.js +98 -8
- package/dist/session/session-start.d.ts +5 -1
- package/dist/session/session-start.js +32 -17
- package/dist/session/toolchain-preflight.d.ts +13 -3
- package/dist/session/toolchain-preflight.js +93 -18
- package/dist/session/verify-ac-session-cache.d.ts +2 -2
- package/dist/session/verify-ac-session-cache.js +2 -2
- package/dist/session/verify-session-ritual.d.ts +11 -0
- package/dist/session/verify-session-ritual.js +60 -15
- package/dist/slice/constants.d.ts +1 -1
- package/dist/spec-authority/constants.d.ts +10 -2
- package/dist/spec-authority/constants.js +53 -8
- package/dist/spec-authority/resolver.d.ts +3 -0
- package/dist/spec-authority/resolver.js +55 -7
- package/dist/subprocess/max-buffer.d.ts +14 -0
- package/dist/subprocess/max-buffer.js +15 -0
- package/dist/swarm/complete-cohort.d.ts +2 -0
- package/dist/swarm/complete-cohort.js +21 -13
- package/dist/swarm/index.d.ts +1 -0
- package/dist/swarm/index.js +1 -0
- package/dist/swarm/launch-cli.js +53 -33
- package/dist/swarm/launch.d.ts +8 -0
- package/dist/swarm/launch.js +63 -43
- package/dist/swarm/pre-dispatch-cli.js +2 -1
- package/dist/swarm/pre-dispatch.js +10 -1
- package/dist/swarm/subagent-status-dir.d.ts +27 -0
- package/dist/swarm/subagent-status-dir.js +42 -0
- package/dist/swarm/worktrees.d.ts +17 -3
- package/dist/swarm/worktrees.js +48 -4
- package/dist/triage/evaluate/worktrees.js +153 -6
- package/dist/triage/scope/mutations-core.d.ts +2 -6
- package/dist/triage/scope/mutations-core.js +23 -55
- package/dist/triage/scope-drift/add-ignore.js +5 -39
- package/dist/triage/subscribe/index.d.ts +2 -6
- package/dist/triage/subscribe/index.js +15 -65
- package/dist/triage/welcome/writers.js +15 -74
- package/dist/umbrella-current-shape/index.d.ts +51 -3
- package/dist/umbrella-current-shape/index.js +106 -18
- package/dist/validate-content/deposit-required.d.ts +39 -0
- package/dist/validate-content/deposit-required.js +147 -0
- package/dist/validate-content/index.d.ts +1 -0
- package/dist/validate-content/index.js +1 -0
- package/dist/validate-content/validate-links.d.ts +2 -3
- package/dist/validate-content/validate-links.js +29 -2
- package/dist/vbrief-activate/activate.d.ts +7 -2
- package/dist/vbrief-activate/activate.js +26 -13
- package/dist/vbrief-build/index.d.ts +2 -1
- package/dist/vbrief-build/index.js +2 -1
- package/dist/vbrief-build/parity-scenarios.js +5 -5
- package/dist/vbrief-build/project-definition-io.d.ts +63 -3
- package/dist/vbrief-build/project-definition-io.js +357 -31
- package/dist/vbrief-build/project-definition-mutation.d.ts +32 -0
- package/dist/vbrief-build/project-definition-mutation.js +43 -0
- package/dist/vbrief-validate/conformance.d.ts +1 -0
- package/dist/vbrief-validate/conformance.js +85 -8
- package/dist/vbrief-validate/main.js +2 -0
- package/dist/vbrief-validate/precutover.js +5 -10
- package/dist/verify-ac/clauses.d.ts +62 -2
- package/dist/verify-ac/clauses.js +183 -111
- package/dist/verify-ac/evaluate.d.ts +9 -0
- package/dist/verify-ac/evaluate.js +32 -9
- package/dist/verify-ac/index.d.ts +1 -1
- package/dist/verify-ac/index.js +1 -1
- package/dist/verify-env/node-runtime.d.ts +8 -4
- package/dist/verify-env/node-runtime.js +9 -6
- package/dist/verify-env/toolchain-check.d.ts +35 -3
- package/dist/verify-env/toolchain-check.js +155 -36
- package/dist/verify-source/deposit-closure.d.ts +23 -0
- package/dist/verify-source/deposit-closure.js +162 -0
- package/dist/verify-source/index.d.ts +2 -0
- package/dist/verify-source/index.js +2 -0
- package/dist/verify-source/project-definition-mutation-boundary.d.ts +104 -0
- package/dist/verify-source/project-definition-mutation-boundary.js +326 -0
- package/dist/verify-source/semantic-single-source.d.ts +36 -0
- package/dist/verify-source/semantic-single-source.js +349 -0
- package/package.json +7 -3
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* C1 declared deposit closure (#3601 / #3899).
|
|
5
|
+
*
|
|
6
|
+
* Required consumer-deposit paths are a closed typed declaration, not a
|
|
7
|
+
* regex over AGENTS.md RFC2119 prose. Existence checks reuse existsSync
|
|
8
|
+
* the same way validate-links.ts does, against a staged pack root (the
|
|
9
|
+
* prepack flatten), not the source checkout.
|
|
10
|
+
*/
|
|
11
|
+
export const DEPOSIT_REQUIRED_SCHEMA = "deft.deposit-required-paths.v1";
|
|
12
|
+
export const DEPOSIT_REQUIRED_REL = "contracts/deposit-required-paths.json";
|
|
13
|
+
export const DEPOSIT_PREFIX = ".deft/core/";
|
|
14
|
+
/** Parser-visible field. Not a scan of ! / backtick paths. */
|
|
15
|
+
const DEPOSIT_REQUIRED_COMMENT = /<!--\s*deposit-required:\s+(\S+)\s*-->/g;
|
|
16
|
+
export function extractDepositRequiredComments(source) {
|
|
17
|
+
const out = [];
|
|
18
|
+
const re = new RegExp(DEPOSIT_REQUIRED_COMMENT.source, "g");
|
|
19
|
+
let match = re.exec(source);
|
|
20
|
+
while (match !== null) {
|
|
21
|
+
const path = match[1];
|
|
22
|
+
if (path !== undefined) {
|
|
23
|
+
out.push(path);
|
|
24
|
+
}
|
|
25
|
+
match = re.exec(source);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
export function parseDepositRequiredDeclaration(jsonText) {
|
|
30
|
+
let _data;
|
|
31
|
+
let parsed;
|
|
32
|
+
try {
|
|
33
|
+
parsed = JSON.parse(jsonText);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
37
|
+
throw new Error(`deposit-required: invalid JSON (${reason})`);
|
|
38
|
+
}
|
|
39
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
40
|
+
throw new Error("deposit-required: expected an object");
|
|
41
|
+
}
|
|
42
|
+
const data = parsed;
|
|
43
|
+
if (data.schema !== DEPOSIT_REQUIRED_SCHEMA) {
|
|
44
|
+
throw new Error("deposit-required: expected schema " +
|
|
45
|
+
DEPOSIT_REQUIRED_SCHEMA +
|
|
46
|
+
", got " +
|
|
47
|
+
String(data.schema));
|
|
48
|
+
}
|
|
49
|
+
if (!Array.isArray(data.paths) || data.paths.length === 0) {
|
|
50
|
+
throw new Error("deposit-required: paths must be a non-empty array of strings");
|
|
51
|
+
}
|
|
52
|
+
const paths = [];
|
|
53
|
+
for (const item of data.paths) {
|
|
54
|
+
if (typeof item !== "string" ||
|
|
55
|
+
!item.startsWith(DEPOSIT_PREFIX) ||
|
|
56
|
+
item.includes("\\") ||
|
|
57
|
+
item.includes("..")) {
|
|
58
|
+
throw new Error(`deposit-required: invalid path ${String(item)}`);
|
|
59
|
+
}
|
|
60
|
+
paths.push(item);
|
|
61
|
+
}
|
|
62
|
+
return { schema: DEPOSIT_REQUIRED_SCHEMA, paths };
|
|
63
|
+
}
|
|
64
|
+
export function packRelativeFromDepositPath(declared) {
|
|
65
|
+
if (!declared.startsWith(DEPOSIT_PREFIX)) {
|
|
66
|
+
throw new Error(`deposit-required: not a deposit path: ${declared}`);
|
|
67
|
+
}
|
|
68
|
+
return declared.slice(DEPOSIT_PREFIX.length);
|
|
69
|
+
}
|
|
70
|
+
/** Prepack mapping used by @deftai/directive-content. */
|
|
71
|
+
export function sourcePathForPackRelative(repoRoot, packRelative) {
|
|
72
|
+
const rel = packRelative.replace(/\\/g, "/");
|
|
73
|
+
if (rel === "main.md" ||
|
|
74
|
+
rel === "SKILL.md" ||
|
|
75
|
+
rel === "Taskfile.yml" ||
|
|
76
|
+
rel.startsWith("tasks/") ||
|
|
77
|
+
rel.startsWith(".githooks/")) {
|
|
78
|
+
return join(repoRoot, ...rel.split("/"));
|
|
79
|
+
}
|
|
80
|
+
return join(repoRoot, "content", ...rel.split("/"));
|
|
81
|
+
}
|
|
82
|
+
export function evaluateDepositClosure(options) {
|
|
83
|
+
const missing = [];
|
|
84
|
+
for (const declared of options.paths) {
|
|
85
|
+
const rel = packRelativeFromDepositPath(declared);
|
|
86
|
+
const target = join(options.packRoot, ...rel.split("/"));
|
|
87
|
+
if (!existsSync(target)) {
|
|
88
|
+
missing.push(declared);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return { ok: missing.length === 0, missing, checked: options.paths.length };
|
|
92
|
+
}
|
|
93
|
+
export function loadDepositRequiredDeclaration(filePath) {
|
|
94
|
+
return parseDepositRequiredDeclaration(readFileSync(filePath, "utf8"));
|
|
95
|
+
}
|
|
96
|
+
export function resolveDeclarationFile(root) {
|
|
97
|
+
const underContent = join(root, "content", DEPOSIT_REQUIRED_REL);
|
|
98
|
+
if (existsSync(underContent)) {
|
|
99
|
+
return underContent;
|
|
100
|
+
}
|
|
101
|
+
const underRoot = join(root, DEPOSIT_REQUIRED_REL);
|
|
102
|
+
if (existsSync(underRoot)) {
|
|
103
|
+
return underRoot;
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
export function evaluateInstalledDepositClosure(projectRoot) {
|
|
108
|
+
const deftDir = join(projectRoot, ".deft", "core");
|
|
109
|
+
const declarationPath = resolveDeclarationFile(deftDir) ?? resolveDeclarationFile(projectRoot);
|
|
110
|
+
if (declarationPath === null) {
|
|
111
|
+
return { skipped: true, missing: [], declarationPath: null, error: null };
|
|
112
|
+
}
|
|
113
|
+
if (!existsSync(deftDir)) {
|
|
114
|
+
return { skipped: true, missing: [], declarationPath, error: null };
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
const declaration = loadDepositRequiredDeclaration(declarationPath);
|
|
118
|
+
const result = evaluateDepositClosure({ packRoot: deftDir, paths: declaration.paths });
|
|
119
|
+
return { skipped: false, missing: result.missing, declarationPath, error: null };
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
123
|
+
return { skipped: false, missing: [], declarationPath, error: reason };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export function renderDeclaredDepositClosureLine(result) {
|
|
127
|
+
if (result.skipped) {
|
|
128
|
+
return "Deposit required-paths: skip -- no C1 declaration in this tree.";
|
|
129
|
+
}
|
|
130
|
+
if (result.error) {
|
|
131
|
+
return ("Deposit required-paths: fail -- could not read C1 declaration (" +
|
|
132
|
+
result.error +
|
|
133
|
+
"). Run directive update to refresh the deposit (#3601 C1).");
|
|
134
|
+
}
|
|
135
|
+
if (result.missing.length === 0) {
|
|
136
|
+
return "Deposit required-paths: ok -- declared C1 paths exist in .deft/core.";
|
|
137
|
+
}
|
|
138
|
+
const sample = result.missing.slice(0, 5).join(", ");
|
|
139
|
+
const extra = result.missing.length > 5 ? ` (+${String(result.missing.length - 5)} more)` : "";
|
|
140
|
+
return ("Deposit required-paths: fail -- " +
|
|
141
|
+
String(result.missing.length) +
|
|
142
|
+
" declared path(s) missing from .deft/core. Examples: " +
|
|
143
|
+
sample +
|
|
144
|
+
extra +
|
|
145
|
+
". Run directive update to refresh the deposit (#3601 C1).");
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=deposit-required.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { resolveCapacityAllocation } from "./capacity-policy.js";
|
|
2
2
|
export { computeReport, renderReport } from "./capacity-show.js";
|
|
3
|
+
export * as depositRequired from "./deposit-required.js";
|
|
3
4
|
export { isDatePrefixedVbriefFilename } from "./filename.js";
|
|
4
5
|
export { extractLinkTargets, shouldSkipLinkTarget } from "./link-parser.js";
|
|
5
6
|
export * from "./types.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { resolveCapacityAllocation } from "./capacity-policy.js";
|
|
2
2
|
export { computeReport, renderReport } from "./capacity-show.js";
|
|
3
|
+
export * as depositRequired from "./deposit-required.js";
|
|
3
4
|
export { isDatePrefixedVbriefFilename } from "./filename.js";
|
|
4
5
|
export { extractLinkTargets, shouldSkipLinkTarget } from "./link-parser.js";
|
|
5
6
|
export * from "./types.js";
|
|
@@ -18,8 +18,7 @@ export interface ValidateLinksOptions {
|
|
|
18
18
|
readonly linkCheckStrict?: boolean;
|
|
19
19
|
readonly argv?: readonly string[];
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
*/
|
|
21
|
+
/** Collect broken internal markdown links under cwd. Used by packed-fixture tests (#3937). */
|
|
22
|
+
export declare function collectBrokenLinks(cwd: string): BrokenLink[];
|
|
24
23
|
export declare function evaluate(options?: ValidateLinksOptions): EvaluateResult;
|
|
25
24
|
//# sourceMappingURL=validate-links.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { evaluateLiveProcedureTargets, formatLiveProcedureFailure, } from "../deposit/live-procedure-targets.js";
|
|
3
4
|
import { NON_PRODUCT_DIRS } from "../fs/non-product-dirs.js";
|
|
4
5
|
import { extractLinkTargets, shouldSkipLinkTarget } from "./link-parser.js";
|
|
5
6
|
/**
|
|
@@ -43,7 +44,8 @@ function collectMarkdownFiles(root) {
|
|
|
43
44
|
walk(root, []);
|
|
44
45
|
return out.sort();
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
/** Collect broken internal markdown links under cwd. Used by packed-fixture tests (#3937). */
|
|
48
|
+
export function collectBrokenLinks(cwd) {
|
|
47
49
|
const broken = [];
|
|
48
50
|
const root = resolve(cwd);
|
|
49
51
|
for (const md of collectMarkdownFiles(root)) {
|
|
@@ -82,13 +84,38 @@ function findBrokenLinks(cwd) {
|
|
|
82
84
|
/**
|
|
83
85
|
* Validate internal markdown links. Faithful to `scripts/validate-links.py`.
|
|
84
86
|
*/
|
|
87
|
+
function contentRootForC3(cwd) {
|
|
88
|
+
const underContent = join(cwd, "content");
|
|
89
|
+
return existsSync(underContent) ? underContent : cwd;
|
|
90
|
+
}
|
|
91
|
+
function extraMarkdownForC3(cwd) {
|
|
92
|
+
const extras = [];
|
|
93
|
+
for (const name of ["main.md", "SKILL.md"]) {
|
|
94
|
+
const absolutePath = join(cwd, name);
|
|
95
|
+
if (existsSync(absolutePath)) {
|
|
96
|
+
extras.push({ relativePath: name, absolutePath });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return extras;
|
|
100
|
+
}
|
|
85
101
|
export function evaluate(options = {}) {
|
|
86
102
|
const cwd = resolve(options.cwd ?? ".");
|
|
87
103
|
const strict = options.strict === true ||
|
|
88
104
|
options.linkCheckStrict === true ||
|
|
89
105
|
(options.argv ?? []).includes("--strict") ||
|
|
90
106
|
process.env.LINK_CHECK_STRICT === "1";
|
|
91
|
-
const
|
|
107
|
+
const c3 = evaluateLiveProcedureTargets({
|
|
108
|
+
stagedRoot: contentRootForC3(cwd),
|
|
109
|
+
extraFiles: extraMarkdownForC3(cwd),
|
|
110
|
+
});
|
|
111
|
+
if (c3.uniqueTargets.length > 0) {
|
|
112
|
+
return {
|
|
113
|
+
code: 1,
|
|
114
|
+
message: formatLiveProcedureFailure(c3),
|
|
115
|
+
stream: "stdout",
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const broken = collectBrokenLinks(cwd);
|
|
92
119
|
if (broken.length === 0) {
|
|
93
120
|
return {
|
|
94
121
|
code: 0,
|
|
@@ -6,8 +6,13 @@ export interface ActivateOptions {
|
|
|
6
6
|
readonly now?: Date;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Pure activator
|
|
10
|
-
* ``scripts/vbrief_activate.py::activate
|
|
9
|
+
* Pure activator -- returns ``{ exitCode, message }``. Ported from
|
|
10
|
+
* ``scripts/vbrief_activate.py::activate`` under the #1782 byte-identical
|
|
11
|
+
* parity contract, with one deliberate divergence: the Python oracle created a
|
|
12
|
+
* ``vBRIEFInfo`` when the artifact carried no envelope, and that behaviour is
|
|
13
|
+
* NOT preserved (#3933). Envelope handling now follows the shared lifecycle
|
|
14
|
+
* policy -- stamp whichever envelope exists, refuse an envelope-less artifact
|
|
15
|
+
* by name.
|
|
11
16
|
*/
|
|
12
17
|
export declare function activate(vbriefPath: string, options?: ActivateOptions): ActivateResult;
|
|
13
18
|
//# sourceMappingURL=activate.d.ts.map
|
|
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, unli
|
|
|
2
2
|
import { basename, dirname, resolve } from "node:path";
|
|
3
3
|
import { containedWrite } from "../fs/contained-write.js";
|
|
4
4
|
import { assertProjectionContained, ProjectionContainmentError, } from "../fs/projection-containment.js";
|
|
5
|
+
import { BRIEF_ENVELOPE_KEYS, missingEnvelopeMessage, stampExistingEnvelopes, } from "../lifecycle/brief-envelope.js";
|
|
5
6
|
import { evaluateEffortActivateGate } from "../scope/effort-activate-gate.js";
|
|
6
7
|
import { utcNowIso } from "../scope/vbrief-json.js";
|
|
7
8
|
import { pythonJsonPretty } from "../vbrief-build/json.js";
|
|
@@ -57,8 +58,13 @@ function loadVbrief(vbriefPath) {
|
|
|
57
58
|
return { payload: payload, error: null };
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
|
-
* Pure activator
|
|
61
|
-
* ``scripts/vbrief_activate.py::activate
|
|
61
|
+
* Pure activator -- returns ``{ exitCode, message }``. Ported from
|
|
62
|
+
* ``scripts/vbrief_activate.py::activate`` under the #1782 byte-identical
|
|
63
|
+
* parity contract, with one deliberate divergence: the Python oracle created a
|
|
64
|
+
* ``vBRIEFInfo`` when the artifact carried no envelope, and that behaviour is
|
|
65
|
+
* NOT preserved (#3933). Envelope handling now follows the shared lifecycle
|
|
66
|
+
* policy -- stamp whichever envelope exists, refuse an envelope-less artifact
|
|
67
|
+
* by name.
|
|
62
68
|
*/
|
|
63
69
|
export function activate(vbriefPath, options = {}) {
|
|
64
70
|
const now = options.now ?? new Date();
|
|
@@ -143,19 +149,26 @@ export function activate(vbriefPath, options = {}) {
|
|
|
143
149
|
}
|
|
144
150
|
throw err;
|
|
145
151
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
for (const key of BRIEF_ENVELOPE_KEYS) {
|
|
153
|
+
if (!(key in payload)) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const env = payload[key];
|
|
157
|
+
if (env === null || typeof env !== "object" || Array.isArray(env)) {
|
|
158
|
+
return {
|
|
159
|
+
exitCode: 1,
|
|
160
|
+
message: `vBRIEF at ${vbriefPath} has a non-object \`${key}\` -- malformed.`,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
151
163
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
164
|
+
// #3933: stamp the envelope the brief already carries; never create one. A
|
|
165
|
+
// manufactured version-less `vBRIEFInfo` wins schema resolution over a valid
|
|
166
|
+
// `xBRIEFInfo`, so the brief this verb just moved would fail validation.
|
|
167
|
+
const stampedEnvelopes = stampExistingEnvelopes(payload, utcNowIso(now));
|
|
168
|
+
if (stampedEnvelopes.length === 0) {
|
|
169
|
+
return { exitCode: 1, message: missingEnvelopeMessage(`vBRIEF at ${vbriefPath}`) };
|
|
157
170
|
}
|
|
158
|
-
|
|
171
|
+
planObj.status = TARGET_STATUS;
|
|
159
172
|
try {
|
|
160
173
|
mkdirSync(activeDir, { recursive: true });
|
|
161
174
|
}
|
|
@@ -3,7 +3,8 @@ export { DEFAULT_STATUS_FOR_FOLDER, DEPRECATION_SENTINEL, EMITTED_VBRIEF_VERSION
|
|
|
3
3
|
export { pythonJsonPretty } from "./json.js";
|
|
4
4
|
export { cmdVbriefBuild, run, usage } from "./main.js";
|
|
5
5
|
export { PARITY_SCENARIO_NAMES, renderScenarioOutput, runParityScenario, SAMPLE_PROJECT_MD, SAMPLE_ROADMAP_MD, SAMPLE_SPEC_MD, SAMPLE_SPEC_VBRIEF, } from "./parity-scenarios.js";
|
|
6
|
-
export { atomicWriteProjectDefinition, loadProjectDefinitionForMutation, projectDefinitionMutationLock, projectDefinitionPath, } from "./project-definition-io.js";
|
|
6
|
+
export { atomicWriteProjectDefinition, CONFIGURED_PROJECT_DEFINITION_LABEL, loadProjectDefinitionForMutation, type MutationLockDeps, ProjectDefinitionLockError, parseProjectDefinitionAt, projectDefinitionArtifactLabel, projectDefinitionMutationLock, projectDefinitionPath, } from "./project-definition-io.js";
|
|
7
|
+
export { type ProjectDefinitionMutation, withProjectDefinitionMutation, } from "./project-definition-mutation.js";
|
|
7
8
|
export { loadProjectInvariants, parseProjectInvariantsField } from "./project-invariants-io.js";
|
|
8
9
|
export { buildScopeVbriefFromReconciled, defaultStatusForFolder, folderForStatus, migrationTimestamp, planStatusMatchesFolder, } from "./routing.js";
|
|
9
10
|
export { deriveOverviewNarrative, extractTechStack, firstProseParagraph, parseRoadmapItems, resolveRepoUrl, } from "./sources.js";
|
|
@@ -3,7 +3,8 @@ export { DEFAULT_STATUS_FOR_FOLDER, DEPRECATION_SENTINEL, EMITTED_VBRIEF_VERSION
|
|
|
3
3
|
export { pythonJsonPretty } from "./json.js";
|
|
4
4
|
export { cmdVbriefBuild, run, usage } from "./main.js";
|
|
5
5
|
export { PARITY_SCENARIO_NAMES, renderScenarioOutput, runParityScenario, SAMPLE_PROJECT_MD, SAMPLE_ROADMAP_MD, SAMPLE_SPEC_MD, SAMPLE_SPEC_VBRIEF, } from "./parity-scenarios.js";
|
|
6
|
-
export { atomicWriteProjectDefinition, loadProjectDefinitionForMutation, projectDefinitionMutationLock, projectDefinitionPath, } from "./project-definition-io.js";
|
|
6
|
+
export { atomicWriteProjectDefinition, CONFIGURED_PROJECT_DEFINITION_LABEL, loadProjectDefinitionForMutation, ProjectDefinitionLockError, parseProjectDefinitionAt, projectDefinitionArtifactLabel, projectDefinitionMutationLock, projectDefinitionPath, } from "./project-definition-io.js";
|
|
7
|
+
export { withProjectDefinitionMutation, } from "./project-definition-mutation.js";
|
|
7
8
|
export { loadProjectInvariants, parseProjectInvariantsField } from "./project-invariants-io.js";
|
|
8
9
|
export { buildScopeVbriefFromReconciled, defaultStatusForFolder, folderForStatus, migrationTimestamp, planStatusMatchesFolder, } from "./routing.js";
|
|
9
10
|
export { deriveOverviewNarrative, extractTechStack, firstProseParagraph, parseRoadmapItems, resolveRepoUrl, } from "./sources.js";
|
|
@@ -2,7 +2,7 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { createScopeVbrief, referenceWithDefaultTrust, slugify } from "./build.js";
|
|
4
4
|
import { pythonJsonPretty } from "./json.js";
|
|
5
|
-
import {
|
|
5
|
+
import { withProjectDefinitionMutation } from "./project-definition-mutation.js";
|
|
6
6
|
import { buildScopeVbriefFromReconciled, folderForStatus, planStatusMatchesFolder, } from "./routing.js";
|
|
7
7
|
import { deriveOverviewNarrative, extractTechStack, firstProseParagraph, parseRoadmapItems, resolveRepoUrl, } from "./sources.js";
|
|
8
8
|
import { createSpeckitScopeVbrief, dependenciesForItem, edgeNodes, migrateSpeckitPlan, speckitIpIndex, speckitIpSlug, } from "./speckit.js";
|
|
@@ -209,11 +209,11 @@ export function runParityScenario(name, ctx) {
|
|
|
209
209
|
const pdPath = join(vbriefDir, "PROJECT-DEFINITION.xbrief.json");
|
|
210
210
|
writeFileSync(pdPath, pythonJsonPretty(seed), "utf8");
|
|
211
211
|
let roundtrip = {};
|
|
212
|
-
|
|
213
|
-
const
|
|
212
|
+
withProjectDefinitionMutation(ctx.fixtureRoot, (mutation) => {
|
|
213
|
+
const data = mutation.load();
|
|
214
214
|
data.plan.policy = { wipCap: 12 };
|
|
215
|
-
|
|
216
|
-
roundtrip = JSON.parse(readFileSync(
|
|
215
|
+
mutation.persist(data);
|
|
216
|
+
roundtrip = JSON.parse(readFileSync(mutation.artifactPath, "utf8"));
|
|
217
217
|
});
|
|
218
218
|
return { scenario: name, ok: true, payload: roundtrip };
|
|
219
219
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { JsonObject } from "./types.js";
|
|
2
|
+
/** Setup override for a noncanonical PROJECT-DEFINITION path. */
|
|
3
|
+
export declare const ENV_PROJECT_PATH = "DEFT_PROJECT_PATH";
|
|
4
|
+
/**
|
|
5
|
+
* Constant display label for a PROJECT-DEFINITION reached through the
|
|
6
|
+
* `DEFT_PROJECT_PATH` override (#3796). A configured path is operator- or
|
|
7
|
+
* environment-supplied data, so lock and loader diagnostics name this label
|
|
8
|
+
* instead of interpolating the raw path. Matches the label already used by
|
|
9
|
+
* `verify:vbrief-conformance` so one artifact reads the same way on every
|
|
10
|
+
* diagnostic surface.
|
|
11
|
+
*/
|
|
12
|
+
export declare const CONFIGURED_PROJECT_DEFINITION_LABEL = "<configured PROJECT-DEFINITION>";
|
|
2
13
|
/**
|
|
3
14
|
* Absolute path to the PROJECT-DEFINITION artifact. Layout-aware (#2302):
|
|
4
15
|
* resolves `xbrief/PROJECT-DEFINITION.xbrief.json` on a migrated tree, else the
|
|
@@ -6,14 +17,63 @@ import type { JsonObject } from "./types.js";
|
|
|
6
17
|
* name the path that actually applies to the project's layout.
|
|
7
18
|
*/
|
|
8
19
|
export declare function projectDefinitionPath(projectRoot: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Control-safe label for an artifact path in a human diagnostic (#3796).
|
|
22
|
+
* A configured artifact collapses to {@link CONFIGURED_PROJECT_DEFINITION_LABEL};
|
|
23
|
+
* a layout-resolved canonical artifact keeps its path because the layout
|
|
24
|
+
* resolver derived it rather than reading it from configuration.
|
|
25
|
+
*/
|
|
26
|
+
export declare function projectDefinitionArtifactLabel(artifactPath: string): string;
|
|
27
|
+
/** Result of probing whether a recorded lock owner PID is still running. */
|
|
28
|
+
export type ProcessLiveness = "dead" | "alive" | "unknown";
|
|
29
|
+
/**
|
|
30
|
+
* Why an acquisition attempt could not take the lock. Only `contended` is
|
|
31
|
+
* ordinary traffic; the rest fail closed to manual recovery (#3796).
|
|
32
|
+
*/
|
|
33
|
+
export type LockBlockedReason = "contended" | "owner-alive" | "owner-liveness-unknown" | "malformed-lock-directory" | "legacy-file-sidecar";
|
|
9
34
|
export interface MutationLockDeps {
|
|
10
35
|
readonly sleepMs?: (ms: number) => void;
|
|
11
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Monotonic millisecond clock. One budget is derived from a single reading of
|
|
38
|
+
* this clock and shared by every retry and recovery branch (#3796), so a
|
|
39
|
+
* wall-clock step or a recovery detour cannot extend the acquisition window.
|
|
40
|
+
*/
|
|
41
|
+
readonly monotonicNowMs?: () => number;
|
|
42
|
+
/** Total acquisition budget in milliseconds. */
|
|
43
|
+
readonly acquisitionBudgetMs?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Three-state liveness oracle. Only `dead` authorises an automatic reap;
|
|
46
|
+
* `alive` (including possible PID reuse) and `unknown` fail closed.
|
|
47
|
+
*/
|
|
48
|
+
readonly probeProcess?: (pid: number) => ProcessLiveness;
|
|
49
|
+
readonly writeOwner?: (fd: number, payload: string) => number;
|
|
50
|
+
readonly renameLock?: (source: string, destination: string) => void;
|
|
51
|
+
/** Test seam: fires after the stale owner entry is unlinked, before `rmdir`. */
|
|
52
|
+
readonly beforeLockDirRemove?: (lockPath: string) => void;
|
|
12
53
|
}
|
|
13
|
-
/**
|
|
14
|
-
export declare
|
|
54
|
+
/** Acquisition failed within the shared budget. `reason` names the blocker. */
|
|
55
|
+
export declare class ProjectDefinitionLockError extends Error {
|
|
56
|
+
readonly reason: LockBlockedReason;
|
|
57
|
+
constructor(message: string, reason: LockBlockedReason);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Serialise PROJECT-DEFINITION read-modify-write critical sections.
|
|
61
|
+
*
|
|
62
|
+
* Acquisition publishes a fully-materialised, non-empty owner directory by
|
|
63
|
+
* renaming it onto the public lock pathname, so no contender can observe a
|
|
64
|
+
* partial lock. Prefer {@link withProjectDefinitionMutation} in
|
|
65
|
+
* `project-definition-mutation.ts`: it binds load/parse/persist to the captured
|
|
66
|
+
* artifact path so a caller cannot lock one identity and write another (#3796).
|
|
67
|
+
*/
|
|
68
|
+
export declare function projectDefinitionMutationLock<T>(projectRoot: string, fn: (artifactPath: string) => T, deps?: MutationLockDeps): T;
|
|
15
69
|
/** Read PROJECT-DEFINITION.vbrief.json and return ``(data, path)``. */
|
|
16
70
|
export declare function loadProjectDefinitionForMutation(projectRoot: string): [JsonObject, string];
|
|
71
|
+
/**
|
|
72
|
+
* Load and parse the PROJECT-DEFINITION at an already-captured path (#3796).
|
|
73
|
+
* Diagnostics name the artifact through {@link projectDefinitionArtifactLabel}
|
|
74
|
+
* so a configured path is never interpolated raw.
|
|
75
|
+
*/
|
|
76
|
+
export declare function parseProjectDefinitionAt(path: string): JsonObject;
|
|
17
77
|
/** Atomically write ``data`` to ``path`` as pretty-printed JSON. */
|
|
18
78
|
export declare function atomicWriteProjectDefinition(path: string, data: JsonObject): void;
|
|
19
79
|
//# sourceMappingURL=project-definition-io.d.ts.map
|