@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
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
/** Node/
|
|
2
|
-
|
|
1
|
+
/** Node/package-manager presence contract for TS-backed consumer gates. */
|
|
2
|
+
/** All supported Node/package-manager tool names across consumer projects. */
|
|
3
|
+
export const NODE_RUNTIME_TOOL_NAMES = ["node", "npm", "pnpm"];
|
|
3
4
|
export const NODE_RUNTIME_REMEDIATION = "Node.js and pnpm are required for TS-backed deft gates. Install Node 20+ (see .nvmrc), then run: corepack enable && corepack prepare pnpm@latest --activate. See UPGRADING.md § Node runtime.";
|
|
4
|
-
/**
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/** npm ships with the supported Node distribution; Corepack/pnpm is not required. */
|
|
6
|
+
export const NPM_RUNTIME_REMEDIATION = "Node.js and npm are required for TS-backed deft gates. Install or repair Node 20+ (see .nvmrc; npm is bundled), then re-run the consumer check. See UPGRADING.md § Node runtime.";
|
|
7
|
+
/** Append remediation lines for node or the package manager selected by the project. */
|
|
8
|
+
export function nodeRuntimeRemediationLines(failed, packageManager = "pnpm") {
|
|
9
|
+
if (failed.includes("node") || failed.includes(packageManager)) {
|
|
10
|
+
return [packageManager === "npm" ? NPM_RUNTIME_REMEDIATION : NODE_RUNTIME_REMEDIATION];
|
|
8
11
|
}
|
|
9
12
|
return [];
|
|
10
13
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { type PackageManager, type PackageManagerResolutionSource } from "../resolution/package-manager.js";
|
|
1
2
|
export interface ToolCheck {
|
|
2
3
|
readonly name: string;
|
|
3
4
|
readonly command: readonly string[];
|
|
4
5
|
}
|
|
5
6
|
export declare const MAINTAINER_TOOLS: readonly ToolCheck[];
|
|
6
|
-
/** Consumer
|
|
7
|
+
/** Consumer prerequisites shared by npm and pnpm projects. */
|
|
7
8
|
export declare const CONSUMER_TOOLS: readonly ToolCheck[];
|
|
8
9
|
/** @deprecated use MAINTAINER_TOOLS */
|
|
9
10
|
export declare const TOOLS: readonly ToolCheck[];
|
|
10
|
-
export type CommandRunner = (command: readonly string[], timeoutMs: number) => {
|
|
11
|
+
export type CommandRunner = (command: readonly string[], timeoutMs: number, options?: CommandRunnerOptions) => {
|
|
11
12
|
returncode: number;
|
|
12
13
|
stdout: string;
|
|
13
14
|
stderr: string;
|
|
@@ -15,11 +16,38 @@ export type CommandRunner = (command: readonly string[], timeoutMs: number) => {
|
|
|
15
16
|
error: "not-found" | "exception";
|
|
16
17
|
message: string;
|
|
17
18
|
};
|
|
19
|
+
export interface CommandRunnerOptions {
|
|
20
|
+
/** Working directory whose package-manager contract the probe must observe. */
|
|
21
|
+
readonly cwd?: string;
|
|
22
|
+
/** Environment used for PATH lookup and subprocess execution. */
|
|
23
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
24
|
+
}
|
|
18
25
|
export interface ToolchainCheckResult {
|
|
19
26
|
readonly lines: readonly string[];
|
|
20
27
|
readonly exitCode: 0 | 1;
|
|
28
|
+
readonly packageManager?: PackageManager;
|
|
29
|
+
readonly packageManagerSource?: PackageManagerResolutionSource;
|
|
30
|
+
}
|
|
31
|
+
export interface ToolchainExecFileOptions {
|
|
32
|
+
readonly encoding: "utf8";
|
|
33
|
+
readonly timeout: number;
|
|
34
|
+
readonly stdio: ["ignore", "pipe", "pipe"];
|
|
35
|
+
readonly shell: boolean;
|
|
36
|
+
readonly windowsVerbatimArguments?: boolean;
|
|
37
|
+
readonly cwd?: string;
|
|
38
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
39
|
+
}
|
|
40
|
+
export type ToolchainExecFileSync = (bin: string, args: readonly string[], options: ToolchainExecFileOptions) => string;
|
|
41
|
+
export interface DefaultCommandRunnerOptions extends CommandRunnerOptions {
|
|
42
|
+
readonly platform?: NodeJS.Platform;
|
|
43
|
+
readonly execFileSync?: ToolchainExecFileSync;
|
|
44
|
+
readonly exists?: (path: string) => boolean;
|
|
21
45
|
}
|
|
22
|
-
|
|
46
|
+
/** Child-env transport for Windows shim paths (#3814 option F). */
|
|
47
|
+
export declare const RESOLVED_PACKAGE_MANAGER_SHIM_ENV = "DEFT_RESOLVED_PACKAGE_MANAGER_SHIM";
|
|
48
|
+
export declare function childEnvWithResolvedPackageManagerShim(baseEnv: NodeJS.ProcessEnv, shimPath: string): NodeJS.ProcessEnv;
|
|
49
|
+
/** Execute one fixed tool argv with Windows `.cmd` fallback. */
|
|
50
|
+
export declare function defaultCommandRunner(command: readonly string[], timeoutMs: number, options?: DefaultCommandRunnerOptions): {
|
|
23
51
|
returncode: number;
|
|
24
52
|
stdout: string;
|
|
25
53
|
stderr: string;
|
|
@@ -29,6 +57,10 @@ export declare function defaultCommandRunner(command: readonly string[], timeout
|
|
|
29
57
|
};
|
|
30
58
|
export interface ToolchainCheckOptions {
|
|
31
59
|
readonly consumer?: boolean;
|
|
60
|
+
/** Consumer project root used for package.json/lockfile resolution. */
|
|
61
|
+
readonly projectRoot?: string;
|
|
62
|
+
/** Environment map used for package-manager precedence. */
|
|
63
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
32
64
|
}
|
|
33
65
|
/** Run maintainer or consumer toolchain probe (mirrors scripts/toolchain-check.py). */
|
|
34
66
|
export declare function runToolchainCheck(runner?: CommandRunner, options?: ToolchainCheckOptions, tools?: readonly ToolCheck[]): ToolchainCheckResult;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as childProcess from "node:child_process";
|
|
2
|
+
import { win32 } from "node:path";
|
|
3
|
+
import { pythonSplitlines } from "../encoding/text.js";
|
|
4
|
+
import { packageManagerSourceLabel, resolveProjectPackageManager, sanitizeSingleLineDiagnostic, } from "../resolution/package-manager.js";
|
|
5
|
+
import { resolveCommandOnPath } from "./command-spawn.js";
|
|
2
6
|
import { nodeRuntimeRemediationLines } from "./node-runtime.js";
|
|
3
7
|
export const MAINTAINER_TOOLS = [
|
|
4
8
|
{ name: "go", command: ["go", "version"] },
|
|
@@ -8,87 +12,202 @@ export const MAINTAINER_TOOLS = [
|
|
|
8
12
|
{ name: "node", command: ["node", "--version"] },
|
|
9
13
|
{ name: "pnpm", command: ["pnpm", "--version"] },
|
|
10
14
|
];
|
|
11
|
-
/** Consumer
|
|
15
|
+
/** Consumer prerequisites shared by npm and pnpm projects. */
|
|
12
16
|
export const CONSUMER_TOOLS = [
|
|
13
17
|
{ name: "git", command: ["git", "--version"] },
|
|
14
18
|
{ name: "gh", command: ["gh", "--version"] },
|
|
15
19
|
{ name: "node", command: ["node", "--version"] },
|
|
16
|
-
{ name: "pnpm", command: ["pnpm", "--version"] },
|
|
17
|
-
{ name: "task", command: ["task", "--version"] },
|
|
18
20
|
];
|
|
21
|
+
const PACKAGE_MANAGER_TOOLS = {
|
|
22
|
+
npm: { name: "npm", command: ["npm", "--version"] },
|
|
23
|
+
pnpm: { name: "pnpm", command: ["pnpm", "--version"] },
|
|
24
|
+
};
|
|
19
25
|
/** @deprecated use MAINTAINER_TOOLS */
|
|
20
26
|
export const TOOLS = MAINTAINER_TOOLS;
|
|
21
27
|
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
22
|
-
|
|
28
|
+
function executionFailure(error) {
|
|
29
|
+
return error;
|
|
30
|
+
}
|
|
31
|
+
function failedExecution(error) {
|
|
32
|
+
const failure = executionFailure(error);
|
|
33
|
+
return {
|
|
34
|
+
returncode: typeof failure.status === "number" ? failure.status : 1,
|
|
35
|
+
stdout: typeof failure.stdout === "string" ? failure.stdout : "",
|
|
36
|
+
stderr: typeof failure.stderr === "string" ? failure.stderr : String(failure.message ?? error),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function windowsShellReportsMissing(error) {
|
|
40
|
+
const failure = executionFailure(error);
|
|
41
|
+
if (failure.code === "ENOENT")
|
|
42
|
+
return true;
|
|
43
|
+
const diagnostic = `${failure.stderr ?? ""}\n${failure.message ?? ""}`;
|
|
44
|
+
return /is not recognized as an internal or external command|command not found/i.test(diagnostic);
|
|
45
|
+
}
|
|
46
|
+
function isFixedWindowsPackageManagerProbe(bin, args) {
|
|
47
|
+
return (bin === "npm" || bin === "pnpm") && args.length === 1 && args[0] === "--version";
|
|
48
|
+
}
|
|
49
|
+
/** Child-env transport for Windows shim paths (#3814 option F). */
|
|
50
|
+
export const RESOLVED_PACKAGE_MANAGER_SHIM_ENV = "DEFT_RESOLVED_PACKAGE_MANAGER_SHIM";
|
|
51
|
+
export function childEnvWithResolvedPackageManagerShim(baseEnv, shimPath) {
|
|
52
|
+
const childEnv = { ...baseEnv };
|
|
53
|
+
const targetLower = RESOLVED_PACKAGE_MANAGER_SHIM_ENV.toLowerCase();
|
|
54
|
+
for (const key of Object.keys(childEnv)) {
|
|
55
|
+
if (key.toLowerCase() === targetLower) {
|
|
56
|
+
delete childEnv[key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
childEnv[RESOLVED_PACKAGE_MANAGER_SHIM_ENV] = shimPath;
|
|
60
|
+
return childEnv;
|
|
61
|
+
}
|
|
62
|
+
function windowsCommandInterpreter(env) {
|
|
63
|
+
return win32.join(env.SystemRoot ?? "C:\\Windows", "System32", "cmd.exe");
|
|
64
|
+
}
|
|
65
|
+
/** Execute one fixed tool argv with Windows `.cmd` fallback. */
|
|
66
|
+
export function defaultCommandRunner(command, timeoutMs, options = {}) {
|
|
23
67
|
const bin = command[0] ?? "";
|
|
24
68
|
const args = command.slice(1);
|
|
25
|
-
const
|
|
69
|
+
const platform = options.platform ?? process.platform;
|
|
70
|
+
const env = options.env ?? process.env;
|
|
71
|
+
const execFileSync = options.execFileSync ??
|
|
72
|
+
((file, fileArgs, execOptions) => childProcess.execFileSync(file, [...fileArgs], execOptions));
|
|
73
|
+
const execOptions = {
|
|
26
74
|
encoding: "utf8",
|
|
27
75
|
timeout: timeoutMs,
|
|
28
76
|
stdio: ["ignore", "pipe", "pipe"],
|
|
29
|
-
shell,
|
|
30
|
-
|
|
77
|
+
shell: false,
|
|
78
|
+
cwd: options.cwd,
|
|
79
|
+
env,
|
|
80
|
+
};
|
|
81
|
+
// Windows package-manager shims are commonly .cmd files. Resolve an
|
|
82
|
+
// absolute PATH candidate first so cmd.exe cannot select a repo-local shim,
|
|
83
|
+
// then invoke the fixed `--version` probe through the system interpreter.
|
|
84
|
+
if (platform === "win32" && isFixedWindowsPackageManagerProbe(bin, args)) {
|
|
85
|
+
const resolvedBin = resolveCommandOnPath(bin, {
|
|
86
|
+
env,
|
|
87
|
+
platform,
|
|
88
|
+
exists: options.exists,
|
|
89
|
+
});
|
|
90
|
+
if (resolvedBin === null) {
|
|
91
|
+
return { error: "not-found", message: "" };
|
|
92
|
+
}
|
|
93
|
+
const isCommandShim = /\.(?:cmd|bat)$/i.test(resolvedBin);
|
|
94
|
+
const executable = isCommandShim ? windowsCommandInterpreter(env) : resolvedBin;
|
|
95
|
+
const shimEnv = isCommandShim ? childEnvWithResolvedPackageManagerShim(env, resolvedBin) : env;
|
|
96
|
+
const commandLine = `"%${RESOLVED_PACKAGE_MANAGER_SHIM_ENV}%" --version`;
|
|
97
|
+
const executableArgs = isCommandShim ? ["/d", "/s", "/c", `"${commandLine}"`] : args;
|
|
98
|
+
// Mirror Node's cmd.exe shell plan: the outer command quote satisfies /s,
|
|
99
|
+
// while verbatim arguments prevent libuv from re-escaping the command line.
|
|
100
|
+
const commandOptions = isCommandShim
|
|
101
|
+
? { ...execOptions, env: shimEnv, windowsVerbatimArguments: true }
|
|
102
|
+
: execOptions;
|
|
103
|
+
try {
|
|
104
|
+
const stdout = execFileSync(executable, executableArgs, commandOptions);
|
|
105
|
+
return { returncode: 0, stdout: typeof stdout === "string" ? stdout : "", stderr: "" };
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (windowsShellReportsMissing(error)) {
|
|
109
|
+
return { error: "not-found", message: "" };
|
|
110
|
+
}
|
|
111
|
+
return failedExecution(error);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
31
114
|
try {
|
|
32
|
-
const stdout =
|
|
115
|
+
const stdout = execFileSync(bin, args, execOptions);
|
|
33
116
|
return { returncode: 0, stdout: typeof stdout === "string" ? stdout : "", stderr: "" };
|
|
34
117
|
}
|
|
35
118
|
catch (err) {
|
|
36
|
-
const e = err;
|
|
37
|
-
// win32: npm global shims are `.cmd` and need shell/PATHEXT (#2467 / #2415).
|
|
38
|
-
if (e.code === "ENOENT" && process.platform === "win32") {
|
|
39
|
-
try {
|
|
40
|
-
const stdout = trySpawn(true);
|
|
41
|
-
return { returncode: 0, stdout: typeof stdout === "string" ? stdout : "", stderr: "" };
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
// Shell still failed — binary is absent (cmd.exe often exits 1, not ENOENT).
|
|
45
|
-
return { error: "not-found", message: "" };
|
|
46
|
-
}
|
|
47
|
-
}
|
|
119
|
+
const e = executionFailure(err);
|
|
48
120
|
if (e.code === "ENOENT") {
|
|
49
121
|
return { error: "not-found", message: "" };
|
|
50
122
|
}
|
|
51
|
-
return
|
|
52
|
-
returncode: typeof e.status === "number" ? e.status : 1,
|
|
53
|
-
stdout: typeof e.stdout === "string" ? e.stdout : "",
|
|
54
|
-
stderr: typeof e.stderr === "string" ? e.stderr : String(e.message ?? err),
|
|
55
|
-
};
|
|
123
|
+
return failedExecution(err);
|
|
56
124
|
}
|
|
57
125
|
}
|
|
58
126
|
/** Run maintainer or consumer toolchain probe (mirrors scripts/toolchain-check.py). */
|
|
59
127
|
export function runToolchainCheck(runner = defaultCommandRunner, options = {}, tools) {
|
|
60
|
-
const selectedTools = tools ?? (options.consumer ? CONSUMER_TOOLS : MAINTAINER_TOOLS);
|
|
61
128
|
const lines = [];
|
|
129
|
+
const projectRoot = options.projectRoot ?? process.cwd();
|
|
130
|
+
const env = options.env ?? process.env;
|
|
131
|
+
let packageManager = "pnpm";
|
|
132
|
+
let packageManagerSource;
|
|
133
|
+
let selectedTools;
|
|
134
|
+
if (tools !== undefined) {
|
|
135
|
+
selectedTools = tools;
|
|
136
|
+
}
|
|
137
|
+
else if (options.consumer) {
|
|
138
|
+
const resolution = resolveProjectPackageManager({
|
|
139
|
+
projectRoot,
|
|
140
|
+
env,
|
|
141
|
+
});
|
|
142
|
+
if (!resolution.ok) {
|
|
143
|
+
lines.push(` package manager: ERROR - ${resolution.message}`);
|
|
144
|
+
lines.push("");
|
|
145
|
+
lines.push("Package manager selection failed");
|
|
146
|
+
return { lines, exitCode: 1 };
|
|
147
|
+
}
|
|
148
|
+
packageManager = resolution.packageManager;
|
|
149
|
+
packageManagerSource = resolution.source;
|
|
150
|
+
lines.push(` package manager: ${packageManager} (${packageManagerSourceLabel(packageManagerSource)})`);
|
|
151
|
+
selectedTools = [...CONSUMER_TOOLS, PACKAGE_MANAGER_TOOLS[packageManager]];
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
selectedTools = MAINTAINER_TOOLS;
|
|
155
|
+
}
|
|
156
|
+
const missing = [];
|
|
62
157
|
const failed = [];
|
|
63
158
|
for (const tool of selectedTools) {
|
|
64
|
-
const result = runner(tool.command, DEFAULT_TIMEOUT_MS);
|
|
159
|
+
const result = runner(tool.command, DEFAULT_TIMEOUT_MS, { cwd: projectRoot, env });
|
|
65
160
|
if ("error" in result) {
|
|
66
161
|
if (result.error === "not-found") {
|
|
67
|
-
|
|
162
|
+
missing.push(tool.name);
|
|
68
163
|
lines.push(` ${tool.name}: NOT FOUND`);
|
|
69
164
|
}
|
|
70
165
|
else {
|
|
71
166
|
failed.push(tool.name);
|
|
72
|
-
|
|
167
|
+
const diagnostic = firstSafeDiagnostic(result.message);
|
|
168
|
+
lines.push(` ${tool.name}: ERROR${diagnostic === "" ? "" : ` - ${diagnostic}`}`);
|
|
73
169
|
}
|
|
74
170
|
continue;
|
|
75
171
|
}
|
|
76
|
-
const version = (result.stdout || result.stderr)
|
|
172
|
+
const version = firstSafeOutputLine(result.stdout || result.stderr);
|
|
77
173
|
if (result.returncode === 0) {
|
|
78
174
|
lines.push(` ${tool.name}: ${version}`);
|
|
79
175
|
}
|
|
80
176
|
else {
|
|
81
177
|
failed.push(tool.name);
|
|
82
|
-
|
|
178
|
+
const diagnostic = firstSafeDiagnostic(result.stderr || result.stdout);
|
|
179
|
+
lines.push(` ${tool.name}: FAILED (exit ${result.returncode})${diagnostic === "" ? "" : ` - ${diagnostic}`}`);
|
|
83
180
|
}
|
|
84
181
|
}
|
|
85
182
|
lines.push("");
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
183
|
+
const unavailable = [...missing, ...failed];
|
|
184
|
+
if (unavailable.length > 0) {
|
|
185
|
+
if (missing.length > 0)
|
|
186
|
+
lines.push(`Missing tools: ${missing.join(", ")}`);
|
|
187
|
+
if (failed.length > 0)
|
|
188
|
+
lines.push(`Failed tools: ${failed.join(", ")}`);
|
|
189
|
+
lines.push(...nodeRuntimeRemediationLines(unavailable, packageManager));
|
|
190
|
+
return {
|
|
191
|
+
lines,
|
|
192
|
+
exitCode: 1,
|
|
193
|
+
...(options.consumer ? { packageManager, packageManagerSource } : {}),
|
|
194
|
+
};
|
|
90
195
|
}
|
|
91
196
|
lines.push("All required tools available");
|
|
92
|
-
return {
|
|
197
|
+
return {
|
|
198
|
+
lines,
|
|
199
|
+
exitCode: 0,
|
|
200
|
+
...(options.consumer ? { packageManager, packageManagerSource } : {}),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function firstSafeOutputLine(text) {
|
|
204
|
+
const first = pythonSplitlines(text)
|
|
205
|
+
.map((line) => line.trim())
|
|
206
|
+
.find((line) => line.length > 0);
|
|
207
|
+
return first === undefined ? "" : sanitizeSingleLineDiagnostic(first);
|
|
208
|
+
}
|
|
209
|
+
function firstSafeDiagnostic(text) {
|
|
210
|
+
const first = firstSafeOutputLine(text);
|
|
211
|
+
return /^[A-Z][A-Z0-9_]*=/.test(first) ? "" : first;
|
|
93
212
|
}
|
|
94
213
|
//# sourceMappingURL=toolchain-check.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check 1 -- staged-pack deposit closure (#3900 / #3601 C1).
|
|
3
|
+
*
|
|
4
|
+
* Resolves the C1 declaration against a staged pack root. Does not infer
|
|
5
|
+
* required paths from AGENTS.md prose. Reuses evaluateDepositClosure.
|
|
6
|
+
*
|
|
7
|
+
* Three-state: 0 clean / 1 missing declared paths / 2 config.
|
|
8
|
+
*/
|
|
9
|
+
import { type DepositClosureResult, type DepositRequiredDeclaration } from "../validate-content/deposit-required.js";
|
|
10
|
+
export interface StagedDepositClosureResult {
|
|
11
|
+
readonly code: 0 | 1 | 2;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly stream: "stdout" | "stderr";
|
|
14
|
+
readonly missing: readonly string[];
|
|
15
|
+
readonly checked: number;
|
|
16
|
+
}
|
|
17
|
+
/** Copy declared C1 paths into dest using the content-package mapping. */
|
|
18
|
+
export declare function stageDeclaredPack(repoRoot: string, destPackRoot: string): DepositRequiredDeclaration;
|
|
19
|
+
export declare function formatStagedDepositClosureLine(result: DepositClosureResult): string;
|
|
20
|
+
export declare function evaluateStagedDepositClosure(packRoot: string, paths: readonly string[]): StagedDepositClosureResult;
|
|
21
|
+
export declare function evaluateDepositClosureFromRepo(repoRoot: string): StagedDepositClosureResult;
|
|
22
|
+
export declare function evaluateDepositClosureAtRoot(root: string, packRootExplicit: boolean): StagedDepositClosureResult;
|
|
23
|
+
//# sourceMappingURL=deposit-closure.d.ts.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check 1 -- staged-pack deposit closure (#3900 / #3601 C1).
|
|
3
|
+
*
|
|
4
|
+
* Resolves the C1 declaration against a staged pack root. Does not infer
|
|
5
|
+
* required paths from AGENTS.md prose. Reuses evaluateDepositClosure.
|
|
6
|
+
*
|
|
7
|
+
* Three-state: 0 clean / 1 missing declared paths / 2 config.
|
|
8
|
+
*/
|
|
9
|
+
import { cpSync, existsSync, mkdirSync, mkdtempSync, rmSync, statSync } from "node:fs";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
11
|
+
import { dirname, join, resolve } from "node:path";
|
|
12
|
+
import { evaluateDepositClosure, loadDepositRequiredDeclaration, packRelativeFromDepositPath, resolveDeclarationFile, sourcePathForPackRelative, } from "../validate-content/deposit-required.js";
|
|
13
|
+
const EXIT_OK = 0;
|
|
14
|
+
const EXIT_MISSING = 1;
|
|
15
|
+
const EXIT_CONFIG = 2;
|
|
16
|
+
const REMEDIATION = "Recovery: restore the declared files in content/ (or root harness files) so they survive content-package prepack. Do not infer paths from AGENTS.md prose (#3601 C1 / #3900).";
|
|
17
|
+
function keepPackFile(src) {
|
|
18
|
+
const posix = src.replace(/\\/g, "/");
|
|
19
|
+
if (posix.includes("__pycache__"))
|
|
20
|
+
return false;
|
|
21
|
+
if (posix.endsWith(".pyc") || posix.endsWith(".py"))
|
|
22
|
+
return false;
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
/** Copy declared C1 paths into dest using the content-package mapping. */
|
|
26
|
+
export function stageDeclaredPack(repoRoot, destPackRoot) {
|
|
27
|
+
const declarationPath = resolveDeclarationFile(repoRoot);
|
|
28
|
+
if (declarationPath === null) {
|
|
29
|
+
throw new Error("deposit-closure: C1 declaration missing (contracts/deposit-required-paths.json).");
|
|
30
|
+
}
|
|
31
|
+
const declaration = loadDepositRequiredDeclaration(declarationPath);
|
|
32
|
+
mkdirSync(destPackRoot, { recursive: true });
|
|
33
|
+
for (const declared of declaration.paths) {
|
|
34
|
+
const rel = packRelativeFromDepositPath(declared);
|
|
35
|
+
const from = sourcePathForPackRelative(repoRoot, rel);
|
|
36
|
+
if (!existsSync(from)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (!keepPackFile(from)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const to = join(destPackRoot, ...rel.split("/"));
|
|
43
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
44
|
+
cpSync(from, to);
|
|
45
|
+
}
|
|
46
|
+
return declaration;
|
|
47
|
+
}
|
|
48
|
+
export function formatStagedDepositClosureLine(result) {
|
|
49
|
+
if (result.ok) {
|
|
50
|
+
return ("Deposit required-paths: ok -- " +
|
|
51
|
+
String(result.checked) +
|
|
52
|
+
" declared C1 path(s) exist in the staged pack.");
|
|
53
|
+
}
|
|
54
|
+
const sample = result.missing.slice(0, 5).join(", ");
|
|
55
|
+
const extra = result.missing.length > 5 ? " (+" + String(result.missing.length - 5) + " more)" : "";
|
|
56
|
+
return ("Deposit required-paths: fail -- " +
|
|
57
|
+
String(result.missing.length) +
|
|
58
|
+
" declared path(s) missing from staged pack. Examples: " +
|
|
59
|
+
sample +
|
|
60
|
+
extra +
|
|
61
|
+
". " +
|
|
62
|
+
REMEDIATION);
|
|
63
|
+
}
|
|
64
|
+
export function evaluateStagedDepositClosure(packRoot, paths) {
|
|
65
|
+
const root = resolve(packRoot);
|
|
66
|
+
let isDir = false;
|
|
67
|
+
try {
|
|
68
|
+
isDir = statSync(root).isDirectory();
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
isDir = false;
|
|
72
|
+
}
|
|
73
|
+
if (!isDir) {
|
|
74
|
+
return {
|
|
75
|
+
code: EXIT_CONFIG,
|
|
76
|
+
message: "verify_deposit_closure: --pack-root is not a directory: " +
|
|
77
|
+
root +
|
|
78
|
+
"\n Recovery: pass a staged pack root or framework checkout.",
|
|
79
|
+
stream: "stderr",
|
|
80
|
+
missing: [],
|
|
81
|
+
checked: 0,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const result = evaluateDepositClosure({ packRoot: root, paths });
|
|
85
|
+
if (result.ok) {
|
|
86
|
+
return {
|
|
87
|
+
code: EXIT_OK,
|
|
88
|
+
message: formatStagedDepositClosureLine(result),
|
|
89
|
+
stream: "stdout",
|
|
90
|
+
missing: result.missing,
|
|
91
|
+
checked: result.checked,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
code: EXIT_MISSING,
|
|
96
|
+
message: formatStagedDepositClosureLine(result),
|
|
97
|
+
stream: "stderr",
|
|
98
|
+
missing: result.missing,
|
|
99
|
+
checked: result.checked,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function evaluateDepositClosureFromRepo(repoRoot) {
|
|
103
|
+
const root = resolve(repoRoot);
|
|
104
|
+
const declarationPath = resolveDeclarationFile(root);
|
|
105
|
+
if (declarationPath === null) {
|
|
106
|
+
return {
|
|
107
|
+
code: EXIT_CONFIG,
|
|
108
|
+
message: "verify_deposit_closure: C1 declaration missing.\n Recovery: add content/contracts/deposit-required-paths.json (#3601 C1).",
|
|
109
|
+
stream: "stderr",
|
|
110
|
+
missing: [],
|
|
111
|
+
checked: 0,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const tmp = mkdtempSync(join(tmpdir(), "deft-3900-pack-"));
|
|
115
|
+
try {
|
|
116
|
+
const declaration = stageDeclaredPack(root, tmp);
|
|
117
|
+
return evaluateStagedDepositClosure(tmp, declaration.paths);
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
121
|
+
return {
|
|
122
|
+
code: EXIT_CONFIG,
|
|
123
|
+
message: "verify_deposit_closure: " + reason + "\n " + REMEDIATION,
|
|
124
|
+
stream: "stderr",
|
|
125
|
+
missing: [],
|
|
126
|
+
checked: 0,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export function evaluateDepositClosureAtRoot(root, packRootExplicit) {
|
|
134
|
+
if (packRootExplicit) {
|
|
135
|
+
const declarationPath = resolveDeclarationFile(root);
|
|
136
|
+
if (declarationPath === null) {
|
|
137
|
+
return {
|
|
138
|
+
code: EXIT_CONFIG,
|
|
139
|
+
message: "verify_deposit_closure: C1 declaration missing under the given pack root.\n Recovery: stage contracts/deposit-required-paths.json with the pack (#3601 C1).",
|
|
140
|
+
stream: "stderr",
|
|
141
|
+
missing: [],
|
|
142
|
+
checked: 0,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const declaration = loadDepositRequiredDeclaration(declarationPath);
|
|
147
|
+
return evaluateStagedDepositClosure(root, declaration.paths);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
151
|
+
return {
|
|
152
|
+
code: EXIT_CONFIG,
|
|
153
|
+
message: "verify_deposit_closure: " + reason + "\n " + REMEDIATION,
|
|
154
|
+
stream: "stderr",
|
|
155
|
+
missing: [],
|
|
156
|
+
checked: 0,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return evaluateDepositClosureFromRepo(root);
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=deposit-closure.js.map
|
|
@@ -5,10 +5,12 @@ export * from "./contained-writes.js";
|
|
|
5
5
|
export * from "./content-manifest.js";
|
|
6
6
|
export { CANONICAL_SCHEMA_REL, type ContractDriftOptions, type ContractDriftResult, evaluateContractDrift, PUBLISHED_SCHEMA_REL, } from "./contract-drift.js";
|
|
7
7
|
export * from "./cursor-tier1.js";
|
|
8
|
+
export * from "./deposit-closure.js";
|
|
8
9
|
export * from "./openclaw-tier1.js";
|
|
9
10
|
export * from "./python-call-scan.js";
|
|
10
11
|
export * from "./rule-ownership-lint.js";
|
|
11
12
|
export * from "./scm-boundary.js";
|
|
13
|
+
export * from "./semantic-single-source.js";
|
|
12
14
|
export * from "./skill-external-fetch-gate.js";
|
|
13
15
|
export * from "./verify-stubs.js";
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,10 +5,12 @@ export * from "./contained-writes.js";
|
|
|
5
5
|
export * from "./content-manifest.js";
|
|
6
6
|
export { CANONICAL_SCHEMA_REL, evaluateContractDrift, PUBLISHED_SCHEMA_REL, } from "./contract-drift.js";
|
|
7
7
|
export * from "./cursor-tier1.js";
|
|
8
|
+
export * from "./deposit-closure.js";
|
|
8
9
|
export * from "./openclaw-tier1.js";
|
|
9
10
|
export * from "./python-call-scan.js";
|
|
10
11
|
export * from "./rule-ownership-lint.js";
|
|
11
12
|
export * from "./scm-boundary.js";
|
|
13
|
+
export * from "./semantic-single-source.js";
|
|
12
14
|
export * from "./skill-external-fetch-gate.js";
|
|
13
15
|
export * from "./verify-stubs.js";
|
|
14
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* project-definition-mutation-boundary.ts -- mechanized production inventory for
|
|
3
|
+
* PROJECT-DEFINITION mutation identity (#3796).
|
|
4
|
+
*
|
|
5
|
+
* A convention that mutators "should" use the shared lock is not checkable: a
|
|
6
|
+
* caller can take the lock and then resolve, read, or write the artifact through
|
|
7
|
+
* its own path, and a helper-level test still passes while a production family
|
|
8
|
+
* split-brains. This scanner replaces that convention with a boundary.
|
|
9
|
+
*
|
|
10
|
+
* Two things are enforced:
|
|
11
|
+
*
|
|
12
|
+
* 1. **Boundary** -- outside the modules that own the protocol, no production
|
|
13
|
+
* source may call the raw lock, the raw write sink, or the raw loader, and no
|
|
14
|
+
* file that mutates PROJECT-DEFINITION may re-resolve the artifact path. The
|
|
15
|
+
* mutation capability is the only way in.
|
|
16
|
+
* 2. **Inventory** -- the per-file census of mutation call expressions is
|
|
17
|
+
* recorded. Adding or removing a mutation site is a deliberate edit to
|
|
18
|
+
* {@link PRODUCTION_MUTATION_INVENTORY}, not a silent drift.
|
|
19
|
+
*
|
|
20
|
+
* Consumed fail-closed by `project-definition-mutation-boundary.test.ts`.
|
|
21
|
+
*/
|
|
22
|
+
/** The capability that owns load/parse/persist against the captured path. */
|
|
23
|
+
export declare const MUTATION_CAPABILITY_MODULE = "packages/core/src/vbrief-build/project-definition-mutation.ts";
|
|
24
|
+
/** The module that owns the lock protocol and the raw primitives it wraps. */
|
|
25
|
+
export declare const MUTATION_PROTOCOL_MODULE = "packages/core/src/vbrief-build/project-definition-io.ts";
|
|
26
|
+
/**
|
|
27
|
+
* This scanner. Excluded from its own scan: it names every pattern it looks for
|
|
28
|
+
* in prose and regex literals, so scanning it would count the rules as call
|
|
29
|
+
* sites and let the inventory drift by editing the gate.
|
|
30
|
+
*/
|
|
31
|
+
export declare const MUTATION_BOUNDARY_MODULE = "packages/core/src/verify-source/project-definition-mutation-boundary.ts";
|
|
32
|
+
/**
|
|
33
|
+
* Raw primitives and the only production files allowed to call them. Anything
|
|
34
|
+
* else reaching for these is a bypass of the captured-path identity.
|
|
35
|
+
*/
|
|
36
|
+
export declare const RAW_MUTATION_CALL_RULES: readonly {
|
|
37
|
+
readonly label: string;
|
|
38
|
+
readonly pattern: RegExp;
|
|
39
|
+
readonly allowedFiles: readonly string[];
|
|
40
|
+
}[];
|
|
41
|
+
/** Resolver calls that would give a mutation section a second artifact identity. */
|
|
42
|
+
export declare const RESOLVER_CALL_PATTERNS: readonly RegExp[];
|
|
43
|
+
/**
|
|
44
|
+
* Character offsets of each `withProjectDefinitionMutation(...)` argument list.
|
|
45
|
+
*
|
|
46
|
+
* Scoping to the section is what keeps the resolver rule precise: resolving the
|
|
47
|
+
* path *before* acquiring the lock is ordinary pre-check work, while resolving it
|
|
48
|
+
* *inside* the critical section is the second identity the contract forbids.
|
|
49
|
+
* String, template, and comment spans are skipped so their braces and parens do
|
|
50
|
+
* not throw off the match.
|
|
51
|
+
*/
|
|
52
|
+
export declare function extractMutationSections(text: string): Array<[number, number]>;
|
|
53
|
+
/**
|
|
54
|
+
* Production mutation call expressions, per file.
|
|
55
|
+
*
|
|
56
|
+
* The counts are the #3796 census: **18** call expressions across 13 core files
|
|
57
|
+
* that previously took the shared lock, plus the **2** `packages/cli` policy
|
|
58
|
+
* writers (`wipCap`, `swarmSubagentBackend`) that previously wrote
|
|
59
|
+
* PROJECT-DEFINITION with no lock at all. `parity-scenarios.ts` is the fixture
|
|
60
|
+
* harness for the same protocol and is counted separately below.
|
|
61
|
+
*/
|
|
62
|
+
export declare const PRODUCTION_MUTATION_INVENTORY: Readonly<Record<string, number>>;
|
|
63
|
+
/**
|
|
64
|
+
* The #3796 census, split by provenance so a drift failure says which family
|
|
65
|
+
* moved. 18 core call expressions across 13 files already took the shared lock;
|
|
66
|
+
* the 2 `packages/cli` policy writers did not; `parity-scenarios.ts` is the
|
|
67
|
+
* fixture harness for the same protocol.
|
|
68
|
+
*/
|
|
69
|
+
export declare const PREVIOUSLY_LOCKED_CORE_CALL_EXPRESSIONS = 18;
|
|
70
|
+
export declare const PREVIOUSLY_LOCKED_CORE_FILES = 13;
|
|
71
|
+
export declare const PREVIOUSLY_UNLOCKED_CLI_WRITERS = 2;
|
|
72
|
+
export declare const PARITY_HARNESS_CALL_EXPRESSIONS = 1;
|
|
73
|
+
export interface MutationBoundaryFinding {
|
|
74
|
+
readonly path: string;
|
|
75
|
+
readonly line: number;
|
|
76
|
+
readonly rule: string;
|
|
77
|
+
readonly text: string;
|
|
78
|
+
}
|
|
79
|
+
export interface MutationBoundaryScan {
|
|
80
|
+
readonly findings: readonly MutationBoundaryFinding[];
|
|
81
|
+
/** Mutation call expressions per production file, posix-relative. */
|
|
82
|
+
readonly inventory: Readonly<Record<string, number>>;
|
|
83
|
+
readonly filesScanned: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Scan production TypeScript for mutation-identity bypasses and build the
|
|
87
|
+
* mutation call-expression inventory. The scan reads the filesystem, not the git
|
|
88
|
+
* index, so an unstaged or brand-new bypass is still caught.
|
|
89
|
+
*/
|
|
90
|
+
export declare function scanProjectDefinitionMutationBoundary(projectRoot: string): MutationBoundaryScan;
|
|
91
|
+
/** Render findings as a stable, reviewable report. */
|
|
92
|
+
export declare function formatMutationBoundaryFindings(findings: readonly MutationBoundaryFinding[]): string;
|
|
93
|
+
export interface MutationBoundaryVerdict {
|
|
94
|
+
readonly ok: boolean;
|
|
95
|
+
readonly errors: readonly string[];
|
|
96
|
+
readonly scan: MutationBoundaryScan;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The fail-closed verdict: no bypass, and the mutation inventory still matches
|
|
100
|
+
* the recorded census. Adding or removing a mutation site is a deliberate edit
|
|
101
|
+
* to {@link PRODUCTION_MUTATION_INVENTORY} and the census constants above.
|
|
102
|
+
*/
|
|
103
|
+
export declare function evaluateProjectDefinitionMutationBoundary(projectRoot: string): MutationBoundaryVerdict;
|
|
104
|
+
//# sourceMappingURL=project-definition-mutation-boundary.d.ts.map
|