@deftai/directive 0.61.2 → 0.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/{branch-parity.d.ts → branch-fixtures.d.ts} +1 -3
  2. package/dist/{branch-parity.js → branch-fixtures.js} +3 -110
  3. package/dist/dispatch.d.ts +1 -1
  4. package/dist/dispatch.js +4 -1
  5. package/dist/framework-check-updates.d.ts +10 -0
  6. package/dist/framework-check-updates.js +68 -0
  7. package/dist/install-cli/coverage-map.js +3 -2
  8. package/dist/orchestration-cli/coverage-map.js +1 -1
  9. package/dist/{policy-parity.d.ts → policy-fixtures.d.ts} +1 -3
  10. package/dist/{policy-parity.js → policy-fixtures.js} +4 -100
  11. package/dist/{release-e2e-parity.d.ts → release-e2e-fixtures.d.ts} +1 -3
  12. package/dist/release-e2e-fixtures.js +38 -0
  13. package/dist/{story-ready-parity.d.ts → story-ready-fixtures.d.ts} +1 -3
  14. package/dist/{story-ready-parity.js → story-ready-fixtures.js} +4 -121
  15. package/dist/{triage-aux-a-parity.d.ts → triage-aux-a-fixtures.d.ts} +1 -3
  16. package/dist/{triage-aux-a-parity.js → triage-aux-a-fixtures.js} +3 -73
  17. package/dist/{triage-aux-b-parity.d.ts → triage-aux-b-fixtures.d.ts} +1 -3
  18. package/dist/triage-aux-b-fixtures.js +167 -0
  19. package/dist/{triage-bootstrap-parity.d.ts → triage-bootstrap-fixtures.d.ts} +1 -3
  20. package/dist/{triage-bootstrap-parity.js → triage-bootstrap-fixtures.js} +4 -91
  21. package/dist/{triage-classify-parity.d.ts → triage-classify-fixtures.d.ts} +1 -3
  22. package/dist/{triage-classify-parity.js → triage-classify-fixtures.js} +4 -94
  23. package/dist/{triage-queue-parity.d.ts → triage-queue-fixtures.d.ts} +1 -3
  24. package/dist/{triage-queue-parity.js → triage-queue-fixtures.js} +4 -86
  25. package/dist/{triage-scope-parity.d.ts → triage-scope-fixtures.d.ts} +1 -3
  26. package/dist/{triage-scope-parity.js → triage-scope-fixtures.js} +4 -91
  27. package/dist/umbrella-current-shape.d.ts +9 -0
  28. package/dist/umbrella-current-shape.js +56 -0
  29. package/dist/{vbrief-preflight-parity.d.ts → vbrief-preflight-fixtures.d.ts} +1 -3
  30. package/dist/vbrief-preflight-fixtures.js +79 -0
  31. package/dist/{wip-cap-parity.d.ts → wip-cap-fixtures.d.ts} +1 -3
  32. package/dist/{wip-cap-parity.js → wip-cap-fixtures.js} +4 -91
  33. package/package.json +4 -15
  34. package/dist/cache-parity.d.ts +0 -36
  35. package/dist/cache-parity.js +0 -165
  36. package/dist/codebase-parity.d.ts +0 -31
  37. package/dist/codebase-parity.js +0 -303
  38. package/dist/doc-cli-parity.d.ts +0 -29
  39. package/dist/doc-cli-parity.js +0 -159
  40. package/dist/doctor-parity.d.ts +0 -42
  41. package/dist/doctor-parity.js +0 -157
  42. package/dist/intake-parity.d.ts +0 -30
  43. package/dist/intake-parity.js +0 -203
  44. package/dist/lifecycle-packs-parity.d.ts +0 -30
  45. package/dist/lifecycle-packs-parity.js +0 -377
  46. package/dist/orchestration-parity.d.ts +0 -38
  47. package/dist/orchestration-parity.js +0 -364
  48. package/dist/parity.d.ts +0 -36
  49. package/dist/parity.js +0 -176
  50. package/dist/platform-parity.d.ts +0 -26
  51. package/dist/platform-parity.js +0 -309
  52. package/dist/pr-closing-keywords-parity.d.ts +0 -45
  53. package/dist/pr-closing-keywords-parity.js +0 -259
  54. package/dist/pr-merge-readiness-parity.d.ts +0 -44
  55. package/dist/pr-merge-readiness-parity.js +0 -296
  56. package/dist/pr-monitor-parity.d.ts +0 -44
  57. package/dist/pr-monitor-parity.js +0 -283
  58. package/dist/pr-protected-issues-parity.d.ts +0 -41
  59. package/dist/pr-protected-issues-parity.js +0 -220
  60. package/dist/pr-wait-mergeable-parity.d.ts +0 -45
  61. package/dist/pr-wait-mergeable-parity.js +0 -340
  62. package/dist/release-e2e-parity.js +0 -114
  63. package/dist/release-parity.d.ts +0 -40
  64. package/dist/release-parity.js +0 -226
  65. package/dist/release-publish-parity.d.ts +0 -36
  66. package/dist/release-publish-parity.js +0 -138
  67. package/dist/release-rollback-parity.d.ts +0 -37
  68. package/dist/release-rollback-parity.js +0 -161
  69. package/dist/render-parity.d.ts +0 -36
  70. package/dist/render-parity.js +0 -385
  71. package/dist/scm-parity.d.ts +0 -39
  72. package/dist/scm-parity.js +0 -181
  73. package/dist/scope-lifecycle-parity.d.ts +0 -35
  74. package/dist/scope-lifecycle-parity.js +0 -177
  75. package/dist/session-parity.d.ts +0 -39
  76. package/dist/session-parity.js +0 -262
  77. package/dist/slice-parity.d.ts +0 -36
  78. package/dist/slice-parity.js +0 -304
  79. package/dist/swarm-parity.d.ts +0 -28
  80. package/dist/swarm-parity.js +0 -327
  81. package/dist/triage-actions-parity.d.ts +0 -36
  82. package/dist/triage-actions-parity.js +0 -357
  83. package/dist/triage-aux-b-parity.js +0 -308
  84. package/dist/triage-summary-parity.d.ts +0 -50
  85. package/dist/triage-summary-parity.js +0 -306
  86. package/dist/validate-content-parity.d.ts +0 -33
  87. package/dist/validate-content-parity.js +0 -356
  88. package/dist/vbrief-activate-parity.d.ts +0 -39
  89. package/dist/vbrief-activate-parity.js +0 -216
  90. package/dist/vbrief-build-parity.d.ts +0 -28
  91. package/dist/vbrief-build-parity.js +0 -399
  92. package/dist/vbrief-preflight-parity.js +0 -163
  93. package/dist/vbrief-reconcile-parity.d.ts +0 -23
  94. package/dist/vbrief-reconcile-parity.js +0 -609
  95. package/dist/vbrief-validate-parity.d.ts +0 -27
  96. package/dist/vbrief-validate-parity.js +0 -122
  97. package/dist/vbrief-validation-parity.d.ts +0 -28
  98. package/dist/vbrief-validation-parity.js +0 -645
  99. package/dist/verify-env-parity.d.ts +0 -28
  100. package/dist/verify-env-parity.js +0 -272
  101. package/dist/verify-source-parity.d.ts +0 -26
  102. package/dist/verify-source-parity.js +0 -178
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  export interface ScenarioResult {
3
2
  readonly name: string;
4
3
  readonly exitCode: number;
@@ -41,7 +40,6 @@ export declare function diffParity(python: ScenarioResult, ts: ScenarioResult):
41
40
  tsMessage: string;
42
41
  };
43
42
  /** Run all parity scenarios and return a structured result. */
44
- export declare function runParity(): ParityResult;
45
43
  /** Render a human-readable parity report (exported for unit tests). */
46
44
  export declare function renderReport(result: ParityResult): string;
47
- //# sourceMappingURL=branch-parity.d.ts.map
45
+ //# sourceMappingURL=branch-fixtures.d.ts.map
@@ -1,17 +1,8 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Golden-output parity harness (#1719): builds throwaway git fixture repos for
4
- * branch-protection scenarios, runs BOTH the Python oracle
5
- * (`scripts/preflight_branch.py`) and the ported TS gate, and diffs exit
6
- * codes + normalised messages. Exit 0 only on identical results.
7
- *
8
- * Exit codes: 0 parity / 1 divergence / 2 harness setup error.
9
- */
1
+ /** Test fixtures extracted from legacy parity harness (#2083). */
10
2
  import { execFileSync } from "node:child_process";
11
3
  import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
12
4
  import { tmpdir } from "node:os";
13
- import { dirname, join, resolve } from "node:path";
14
- import { fileURLToPath } from "node:url";
5
+ import { join } from "node:path";
15
6
  function gitCommit(cwd, message) {
16
7
  execFileSync("git", ["commit", "-q", "-m", message], {
17
8
  cwd,
@@ -96,30 +87,6 @@ export const PARITY_SCENARIOS = [
96
87
  env: { DEFT_SETUP_INTERVIEW: "", DEFT_ALLOW_DEFAULT_BRANCH_COMMIT: "" },
97
88
  },
98
89
  ];
99
- function runCapture(cmd, args, cwd, env = {}) {
100
- const merged = { ...process.env, ...env };
101
- for (const key of Object.keys(merged)) {
102
- if (merged[key] === undefined)
103
- delete merged[key];
104
- }
105
- try {
106
- const stdout = execFileSync(cmd, args, {
107
- cwd,
108
- encoding: "utf8",
109
- env: merged,
110
- stdio: ["ignore", "pipe", "pipe"],
111
- });
112
- return { status: 0, stdout, stderr: "" };
113
- }
114
- catch (err) {
115
- const e = err;
116
- return {
117
- status: typeof e.status === "number" ? e.status : 2,
118
- stdout: typeof e.stdout === "string" ? e.stdout : "",
119
- stderr: typeof e.stderr === "string" ? e.stderr : "",
120
- };
121
- }
122
- }
123
90
  /** Normalise gate message for comparison (trim, collapse whitespace). */
124
91
  export function normaliseMessage(stdout, stderr, exitCode) {
125
92
  const raw = exitCode === 0 ? stdout : stderr;
@@ -154,39 +121,6 @@ export function buildScenarioRepo(scenario) {
154
121
  }
155
122
  return { root };
156
123
  }
157
- function resolveDeftRoot() {
158
- if (process.env.DEFT_ROOT !== undefined && process.env.DEFT_ROOT.length > 0) {
159
- return resolve(process.env.DEFT_ROOT);
160
- }
161
- return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
162
- }
163
- function runScenario(deftRoot, scenario) {
164
- const { root } = buildScenarioRepo(scenario);
165
- const env = scenario.env ?? {};
166
- const sharedArgs = ["--project-root", root];
167
- if (scenario.allowMissingProjectDefinition) {
168
- sharedArgs.push("--allow-missing-project-definition");
169
- }
170
- const pyArgs = ["run", "python", join(deftRoot, "scripts", "preflight_branch.py"), ...sharedArgs];
171
- const tsArgs = [join(deftRoot, "packages", "cli", "dist", "verify-branch.js"), ...sharedArgs];
172
- const py = runCapture("uv", pyArgs, deftRoot, env);
173
- const ts = runCapture("node", tsArgs, deftRoot, env);
174
- return {
175
- root,
176
- python: {
177
- name: scenario.name,
178
- exitCode: py.status,
179
- stdout: py.stdout,
180
- stderr: py.stderr,
181
- },
182
- ts: {
183
- name: scenario.name,
184
- exitCode: ts.status,
185
- stdout: ts.stdout,
186
- stderr: ts.stderr,
187
- },
188
- };
189
- }
190
124
  /** Diff python vs TS gate outputs for one scenario. */
191
125
  export function diffParity(python, ts) {
192
126
  const pythonMessage = normaliseMessage(python.stdout, python.stderr, python.exitCode);
@@ -199,31 +133,6 @@ export function diffParity(python, ts) {
199
133
  };
200
134
  }
201
135
  /** Run all parity scenarios and return a structured result. */
202
- export function runParity() {
203
- const deftRoot = resolveDeftRoot();
204
- const scenarios = [];
205
- for (const scenario of PARITY_SCENARIOS) {
206
- let root;
207
- try {
208
- const ran = runScenario(deftRoot, scenario);
209
- root = ran.root;
210
- const diff = diffParity(ran.python, ran.ts);
211
- scenarios.push({
212
- name: scenario.name,
213
- pythonExit: ran.python.exitCode,
214
- tsExit: ran.ts.exitCode,
215
- ...diff,
216
- });
217
- }
218
- finally {
219
- if (root !== undefined) {
220
- rmSync(root, { recursive: true, force: true });
221
- }
222
- }
223
- }
224
- const ok = scenarios.every((s) => !s.exitMismatch && !s.messageMismatch);
225
- return { ok, scenarios };
226
- }
227
136
  /** Render a human-readable parity report (exported for unit tests). */
228
137
  export function renderReport(result) {
229
138
  if (result.ok) {
@@ -244,20 +153,4 @@ export function renderReport(result) {
244
153
  }
245
154
  return lines.join("\n");
246
155
  }
247
- if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
248
- try {
249
- const result = runParity();
250
- if (result.ok) {
251
- process.stdout.write(`${renderReport(result)}\n`);
252
- process.exit(0);
253
- }
254
- process.stderr.write(`${renderReport(result)}\n`);
255
- process.exit(1);
256
- }
257
- catch (err) {
258
- const msg = String(err).replace(/\r?\n/g, " ");
259
- process.stderr.write(`verify_branch parity: harness error -- ${msg}\n`);
260
- process.exit(2);
261
- }
262
- }
263
- //# sourceMappingURL=branch-parity.js.map
156
+ //# sourceMappingURL=branch-fixtures.js.map
@@ -10,7 +10,7 @@ export interface DispatchIo {
10
10
  writeErr: (text: string) => void;
11
11
  }
12
12
  /** CLI modules in packages/cli/src (excluding parity harnesses and bin/index). */
13
- export declare const CLI_MODULE_VERBS: readonly ["agents-refresh", "cache", "check", "capacity-backfill", "capacity-show", "codebase-default-extractor", "codebase-map", "codebase-map-fresh", "codebase-projection-registry", "codebase-provider", "doctor", "install-upgrade", "install-uninstall", "migrate-preflight", "changelog-check", "change-init", "commit-lint", "parity", "policy", "pr-closing-keywords", "pr-merge-readiness", "pr-monitor", "pr-protected-issues", "pr-wait-mergeable", "preflight-cache", "preflight-gh", "probe-session", "release", "release-e2e", "release-publish", "release-rollback", "scope-lifecycle", "session-start", "slice", "subagent-monitor", "toolchain-check", "triage-actions", "triage-bootstrap", "triage-bulk", "triage-classify", "triage-help", "triage-queue", "triage-reconcile", "triage-refresh", "triage-scope", "triage-scope-drift", "triage-smoketest", "triage-subscribe", "triage-summary", "triage-welcome", "ts-check-lane", "vbrief-activate", "vbrief-build", "vbrief-preflight", "vbrief-reconcile", "vbrief-validate", "vbrief-validation", "verify-branch", "verify-encoding", "verify-hooks-installed", "verify-investigation", "verify-judgment-gates", "verify-no-task-runtime", "validate-links", "validate-strategy-output", "verify-bridge-drift", "verify-capacity", "verify-content-manifest", "verify-go-freeze", "verify-scm-boundary", "verify-session-ritual", "verify-stubs", "rule-ownership-lint", "verify-story-ready", "verify-tools", "verify-wip-cap"];
13
+ export declare const CLI_MODULE_VERBS: readonly ["agents-refresh", "cache", "check", "capacity-backfill", "capacity-show", "codebase-default-extractor", "codebase-map", "codebase-map-fresh", "codebase-projection-registry", "codebase-provider", "doctor", "install-upgrade", "install-uninstall", "migrate-preflight", "framework-check-updates", "umbrella-current-shape", "changelog-check", "change-init", "commit-lint", "policy", "pr-closing-keywords", "pr-merge-readiness", "pr-monitor", "pr-protected-issues", "pr-wait-mergeable", "preflight-cache", "preflight-gh", "probe-session", "release", "release-e2e", "release-publish", "release-rollback", "scope-lifecycle", "session-start", "slice", "subagent-monitor", "toolchain-check", "triage-actions", "triage-bootstrap", "triage-bulk", "triage-classify", "triage-help", "triage-queue", "triage-reconcile", "triage-refresh", "triage-scope", "triage-scope-drift", "triage-smoketest", "triage-subscribe", "triage-summary", "triage-welcome", "ts-check-lane", "vbrief-activate", "vbrief-build", "vbrief-preflight", "vbrief-reconcile", "vbrief-validate", "vbrief-validation", "verify-branch", "verify-encoding", "verify-hooks-installed", "verify-investigation", "verify-judgment-gates", "verify-no-task-runtime", "validate-links", "validate-strategy-output", "verify-bridge-drift", "verify-capacity", "verify-content-manifest", "verify-go-freeze", "verify-scm-boundary", "verify-session-ritual", "verify-stubs", "rule-ownership-lint", "verify-story-ready", "verify-tools", "verify-wip-cap"];
14
14
  /** Core-only CLI entrypoints without a packages/cli wrapper. */
15
15
  export declare const CORE_MODULE_VERBS: readonly ["scm", "github-auth-modes", "github-body", "issue-emit", "issue-ingest", "reconcile-issues", "swarm-launch", "swarm-complete-cohort", "swarm-readiness", "swarm-routing-verify", "swarm-routing-set", "swarm-verify-review-clean", "swarm-worktrees", "framework-commands", "pack-render", "packs-slice", "prd-render", "export-spec", "project-render", "roadmap-render", "spec-render", "spec-validate", "code-structure-validate", "pack-migrate-skills", "pack-migrate-rules", "pack-migrate-strategies", "pack-migrate-patterns", "pack-migrate-swarm-spec", "policy-set", "setup-ghx", "scope-undo", "scope-demote", "scope-decompose", "changelog-resolve-unreleased", "architecture-preflight-sor"];
16
16
  /** Task-style aliases (framework_commands / Taskfile names). */
package/dist/dispatch.js CHANGED
@@ -37,10 +37,11 @@ export const CLI_MODULE_VERBS = [
37
37
  "install-upgrade",
38
38
  "install-uninstall",
39
39
  "migrate-preflight",
40
+ "framework-check-updates",
41
+ "umbrella-current-shape",
40
42
  "changelog-check",
41
43
  "change-init",
42
44
  "commit-lint",
43
- "parity",
44
45
  "policy",
45
46
  "pr-closing-keywords",
46
47
  "pr-merge-readiness",
@@ -177,6 +178,8 @@ export const VERB_ALIASES = {
177
178
  "triage:status": "triage-actions",
178
179
  "agents:refresh": "agents-refresh",
179
180
  "migrate:preflight": "migrate-preflight",
181
+ "framework:check-updates": "framework-check-updates",
182
+ "umbrella:current-shape": "umbrella-current-shape",
180
183
  upgrade: "install-upgrade",
181
184
  "session:start": "session-start",
182
185
  "toolchain:check": "toolchain-check",
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ export interface ParsedCheckUpdatesArgs {
3
+ projectRoot: string;
4
+ deftRoot: string;
5
+ passthrough: string[];
6
+ error?: string;
7
+ }
8
+ export declare function parseArgs(argv: readonly string[]): ParsedCheckUpdatesArgs;
9
+ export declare function run(argv: readonly string[]): number;
10
+ //# sourceMappingURL=framework-check-updates.d.ts.map
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ import { resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { runCheckUpdates } from "@deftai/directive-core/check-updates";
5
+ export function parseArgs(argv) {
6
+ let projectRoot = process.cwd();
7
+ let deftRoot = resolve(import.meta.dirname, "..", "..", "..");
8
+ const passthrough = [];
9
+ for (let i = 0; i < argv.length; i += 1) {
10
+ const arg = argv[i] ?? "";
11
+ if (arg === "--project-root") {
12
+ const value = argv[i + 1];
13
+ if (value === undefined) {
14
+ return {
15
+ projectRoot,
16
+ deftRoot,
17
+ passthrough,
18
+ error: "argument --project-root: expected one argument",
19
+ };
20
+ }
21
+ projectRoot = value;
22
+ i += 1;
23
+ }
24
+ else if (arg.startsWith("--project-root=")) {
25
+ projectRoot = arg.slice("--project-root=".length);
26
+ }
27
+ else if (arg === "--deft-root") {
28
+ const value = argv[i + 1];
29
+ if (value === undefined) {
30
+ return {
31
+ projectRoot,
32
+ deftRoot,
33
+ passthrough,
34
+ error: "argument --deft-root: expected one argument",
35
+ };
36
+ }
37
+ deftRoot = value;
38
+ i += 1;
39
+ }
40
+ else if (arg.startsWith("--deft-root=")) {
41
+ deftRoot = arg.slice("--deft-root=".length);
42
+ }
43
+ else {
44
+ passthrough.push(arg);
45
+ }
46
+ }
47
+ if (process.env.DEFT_ROOT &&
48
+ process.env.DEFT_ROOT.length > 0 &&
49
+ !argv.some((a) => a.startsWith("--deft-root"))) {
50
+ deftRoot = process.env.DEFT_ROOT;
51
+ }
52
+ return { projectRoot, deftRoot, passthrough };
53
+ }
54
+ export function run(argv) {
55
+ const args = parseArgs(argv);
56
+ if (args.error !== undefined) {
57
+ process.stderr.write(`framework:check-updates: ${args.error}\n`);
58
+ return 2;
59
+ }
60
+ return runCheckUpdates(args.passthrough, {
61
+ projectRoot: args.projectRoot,
62
+ frameworkRoot: args.deftRoot,
63
+ });
64
+ }
65
+ if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
66
+ process.exit(run(process.argv.slice(2)));
67
+ }
68
+ //# sourceMappingURL=framework-check-updates.js.map
@@ -38,8 +38,9 @@ export const INSTALL_CLI_TAIL_COVERAGE_MAP = [
38
38
  },
39
39
  {
40
40
  pythonTest: "tests/cli/test_cmd_check_updates.py",
41
- classification: "retire-at-Wave-9",
42
- rationale: "Python run cmd_check_updates remote version probe — no TS port; retires with legacy run module.",
41
+ classification: "retarget",
42
+ rationale: "Python run cmd_check_updates remote version probe — retargeted to deft-ts framework-check-updates on consumer task path (#2069).",
43
+ vitestSpec: "packages/core/src/check-updates/index.test.ts, packages/cli/src/framework-check-updates-task-surface.test.ts",
43
44
  },
44
45
  {
45
46
  pythonTest: "tests/cli/test_cmd_doctor.py",
@@ -33,7 +33,7 @@ export const ORCHESTRATION_CLI_COVERAGE_MAP = [
33
33
  pythonTest: "test_pr_check_closing_keywords.py",
34
34
  kind: "existing-coverage",
35
35
  tsTarget: "packages/core/src/pr-closing-keywords/main.test.ts",
36
- notes: "Offline + gh argv parsing; parity in pr-closing-keywords-parity.test.ts",
36
+ notes: "Offline + gh argv parsing; covered by pr-closing-keywords unit tests.",
37
37
  },
38
38
  {
39
39
  pythonTest: "test_pr_check_protected_issues.py",
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  export interface CommandCapture {
3
2
  readonly exitCode: number;
4
3
  readonly stdout: string;
@@ -30,6 +29,5 @@ export declare function buildFixtureRepo(plan?: Record<string, unknown>): string
30
29
  export declare function diffCase(python: CommandCapture, ts: CommandCapture, caseName: string): ParityDiff;
31
30
  export declare const PARITY_CASES: readonly ParityCase[];
32
31
  /** Run all parity cases; returns aggregate result. */
33
- export declare function runParity(): ParityResult;
34
32
  export declare function renderReport(result: ParityResult): string;
35
- //# sourceMappingURL=policy-parity.d.ts.map
33
+ //# sourceMappingURL=policy-fixtures.d.ts.map
@@ -1,16 +1,7 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Golden-output parity harness (#1722): builds throwaway fixture repos, runs
4
- * BOTH the Python oracle (scripts/policy.py + shims) and the TS policy CLI,
5
- * and diffs resolution output + disclosure_line + exit codes.
6
- *
7
- * Exit codes: 0 parity / 1 divergence / 2 harness setup error.
8
- */
9
- import { execFileSync } from "node:child_process";
10
- import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
1
+ /** Test fixtures extracted from legacy parity harness (#2083). */
2
+ import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
11
3
  import { tmpdir } from "node:os";
12
- import { dirname, join, resolve } from "node:path";
13
- import { fileURLToPath } from "node:url";
4
+ import { join } from "node:path";
14
5
  /** Strip volatile ISO timestamps from audit / JSON envelopes before compare. */
15
6
  export function normalizeOutput(text) {
16
7
  return text
@@ -18,30 +9,6 @@ export function normalizeOutput(text) {
18
9
  .replace(/PROJECT-DEFINITION not found at [^\s)]+/g, "PROJECT-DEFINITION not found at <ROOT>")
19
10
  .replace(/fail-closed: PROJECT-DEFINITION not found at [^)]+/g, "fail-closed: PROJECT-DEFINITION not found at <ROOT>");
20
11
  }
21
- function runCapture(cmd, args, cwd, env = {}) {
22
- const merged = { ...process.env, ...env };
23
- for (const key of Object.keys(merged)) {
24
- if (merged[key] === undefined)
25
- delete merged[key];
26
- }
27
- try {
28
- const stdout = execFileSync(cmd, args, {
29
- cwd,
30
- encoding: "utf8",
31
- env: merged,
32
- stdio: ["ignore", "pipe", "pipe"],
33
- });
34
- return { status: 0, stdout, stderr: "" };
35
- }
36
- catch (err) {
37
- const e = err;
38
- return {
39
- status: typeof e.status === "number" ? e.status : 2,
40
- stdout: typeof e.stdout === "string" ? e.stdout : "",
41
- stderr: typeof e.stderr === "string" ? e.stderr : "",
42
- };
43
- }
44
- }
45
12
  function writeFixture(root, plan) {
46
13
  const dir = join(root, "vbrief");
47
14
  mkdirSync(dir, { recursive: true });
@@ -59,34 +26,6 @@ export function buildFixtureRepo(plan) {
59
26
  }
60
27
  return root;
61
28
  }
62
- function resolveDeftRoot() {
63
- if (process.env.DEFT_ROOT !== undefined && process.env.DEFT_ROOT.length > 0) {
64
- return resolve(process.env.DEFT_ROOT);
65
- }
66
- return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
67
- }
68
- function runPythonPolicy(deftRoot, repo, argv, env) {
69
- const sub = argv[0];
70
- if (sub === undefined) {
71
- throw new Error("missing policy subcommand");
72
- }
73
- const rest = argv.slice(1);
74
- const withRoot = [...rest, "--project-root", repo];
75
- if (sub === "show") {
76
- const cap = runCapture("uv", ["run", "python", join(deftRoot, "scripts", "_policy_show_cli.py"), ...withRoot], deftRoot, env);
77
- return { exitCode: cap.status, stdout: cap.stdout, stderr: cap.stderr };
78
- }
79
- if (sub === "resolve") {
80
- const cap = runCapture("uv", ["run", "python", join(deftRoot, "scripts", "policy.py"), "show", ...withRoot], deftRoot, env);
81
- return { exitCode: cap.status, stdout: cap.stdout, stderr: cap.stderr };
82
- }
83
- const cap = runCapture("uv", ["run", "python", join(deftRoot, "scripts", "policy_set.py"), sub, ...withRoot], deftRoot, env);
84
- return { exitCode: cap.status, stdout: cap.stdout, stderr: cap.stderr };
85
- }
86
- function runTsPolicy(deftRoot, repo, argv, env) {
87
- const cap = runCapture("node", [join(deftRoot, "packages", "cli", "dist", "policy.js"), ...argv, "--project-root", repo], deftRoot, env);
88
- return { exitCode: cap.status, stdout: cap.stdout, stderr: cap.stderr };
89
- }
90
29
  /** Diff one parity case between Python oracle and TS CLI. */
91
30
  export function diffCase(python, ts, caseName) {
92
31
  const pyOut = normalizeOutput(python.stdout);
@@ -158,26 +97,6 @@ export const PARITY_CASES = [
158
97
  },
159
98
  ];
160
99
  /** Run all parity cases; returns aggregate result. */
161
- export function runParity() {
162
- const deftRoot = resolveDeftRoot();
163
- const diffs = [];
164
- for (const testCase of PARITY_CASES) {
165
- const pyRepo = buildFixtureRepo(testCase.fixture);
166
- const tsRepo = buildFixtureRepo(testCase.fixture);
167
- try {
168
- const env = testCase.env ?? {};
169
- const python = runPythonPolicy(deftRoot, pyRepo, testCase.argv, env);
170
- const ts = runTsPolicy(deftRoot, tsRepo, testCase.argv, env);
171
- diffs.push(diffCase(python, ts, testCase.name));
172
- }
173
- finally {
174
- rmSync(pyRepo, { recursive: true, force: true });
175
- rmSync(tsRepo, { recursive: true, force: true });
176
- }
177
- }
178
- const ok = diffs.every((d) => !d.exitMismatch && !d.stdoutMismatch && !d.stderrMismatch);
179
- return { ok, diffs };
180
- }
181
100
  export function renderReport(result) {
182
101
  if (result.ok) {
183
102
  return `policy parity: CLEAN -- Python and TS agree on ${PARITY_CASES.length} cases.`;
@@ -196,19 +115,4 @@ export function renderReport(result) {
196
115
  }
197
116
  return lines.join("\n");
198
117
  }
199
- if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
200
- try {
201
- const result = runParity();
202
- if (result.ok) {
203
- process.stdout.write(`${renderReport(result)}\n`);
204
- process.exit(0);
205
- }
206
- process.stderr.write(`${renderReport(result)}\n`);
207
- process.exit(1);
208
- }
209
- catch (err) {
210
- process.stderr.write(`policy parity: harness error -- ${String(err)}\n`);
211
- process.exit(2);
212
- }
213
- }
214
- //# sourceMappingURL=policy-parity.js.map
118
+ //# sourceMappingURL=policy-fixtures.js.map
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  export interface CommandCapture {
3
2
  readonly exitCode: number;
4
3
  readonly stdout: string;
@@ -26,6 +25,5 @@ export interface ParityResult {
26
25
  export declare const PARITY_SCENARIOS: readonly ParityScenario[];
27
26
  /** Normalise volatile repo slugs and ISO dates in stderr while preserving semantics. */
28
27
  export declare function normaliseStderr(text: string): string;
29
- export declare function runParity(): ParityResult;
30
28
  export declare function renderReport(result: ParityResult): string;
31
- //# sourceMappingURL=release-e2e-parity.d.ts.map
29
+ //# sourceMappingURL=release-e2e-fixtures.d.ts.map
@@ -0,0 +1,38 @@
1
+ export const PARITY_SCENARIOS = [
2
+ { name: "help", argv: ["--help"], compareStdout: true },
3
+ { name: "dry-run", argv: ["--dry-run"] },
4
+ { name: "dry-run-keep-repo", argv: ["--dry-run", "--keep-repo"] },
5
+ {
6
+ name: "dry-run-project-root",
7
+ argv: ["--dry-run", "--owner", "deftai", "--project-root", "/tmp/deft-e2e-parity-root"],
8
+ },
9
+ ];
10
+ /** Normalise volatile repo slugs and ISO dates in stderr while preserving semantics. */
11
+ export function normaliseStderr(text) {
12
+ return text
13
+ .replace(/deftai-release-test-\d{14}-[0-9a-f]{6}/g, "deftai-release-test-YYYYMMDDHHMMSS-uuid6")
14
+ .replace(/\d{4}-\d{2}-\d{2}/g, "YYYY-MM-DD");
15
+ }
16
+ export function renderReport(result) {
17
+ if (result.ok) {
18
+ return `release-e2e parity: CLEAN -- Python and TS agree on ${result.diffs.length} scenario(s).`;
19
+ }
20
+ const lines = ["release-e2e parity: DIVERGENCE"];
21
+ for (const d of result.diffs) {
22
+ if (d.exitMismatch || d.outputMismatch) {
23
+ lines.push(` scenario: ${d.name}`);
24
+ if (d.exitMismatch) {
25
+ lines.push(` exit mismatch: python=${d.pythonExit} ts=${d.tsExit}`);
26
+ }
27
+ if (d.outputMismatch) {
28
+ lines.push(` stream: ${d.stream}`);
29
+ lines.push(` python (${d.pythonOutput.length} bytes):`);
30
+ lines.push(d.pythonOutput);
31
+ lines.push(` ts (${d.tsOutput.length} bytes):`);
32
+ lines.push(d.tsOutput);
33
+ }
34
+ }
35
+ }
36
+ return lines.join("\n");
37
+ }
38
+ //# sourceMappingURL=release-e2e-fixtures.js.map
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  export interface ScenarioResult {
3
2
  readonly name: string;
4
3
  readonly exitCode: number;
@@ -43,7 +42,6 @@ export declare function diffParity(python: ScenarioResult, ts: ScenarioResult):
43
42
  tsMessage: string;
44
43
  };
45
44
  /** Run all parity scenarios and return a structured result. */
46
- export declare function runParity(): ParityResult;
47
45
  /** Render a human-readable parity report (exported for unit tests). */
48
46
  export declare function renderReport(result: ParityResult): string;
49
- //# sourceMappingURL=story-ready-parity.d.ts.map
47
+ //# sourceMappingURL=story-ready-fixtures.d.ts.map
@@ -1,17 +1,8 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Golden-output parity harness (#1720): builds throwaway git fixture repos for
4
- * story-start Gate 0 scenarios, runs BOTH the Python oracle
5
- * (`scripts/preflight_story_start.py`) and the ported TS gate, and diffs exit
6
- * codes + normalised messages. Exit 0 only on identical results.
7
- *
8
- * Exit codes: 0 parity / 1 divergence / 2 harness setup error.
9
- */
1
+ /** Test fixtures extracted from legacy parity harness (#2083). */
10
2
  import { execFileSync } from "node:child_process";
11
- import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
+ import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
12
4
  import { tmpdir } from "node:os";
13
- import { dirname, join, resolve } from "node:path";
14
- import { fileURLToPath } from "node:url";
5
+ import { dirname, join } from "node:path";
15
6
  function writeVbrief(root, rel, status = "running", folder = "active") {
16
7
  const full = join(root, "vbrief", folder, rel);
17
8
  mkdirSync(dirname(full), { recursive: true });
@@ -78,24 +69,6 @@ function gitCommit(cwd, message) {
78
69
  },
79
70
  });
80
71
  }
81
- function runCapture(cmd, args, cwd) {
82
- try {
83
- const stdout = execFileSync(cmd, args, {
84
- cwd,
85
- encoding: "utf8",
86
- stdio: ["ignore", "pipe", "pipe"],
87
- });
88
- return { status: 0, stdout, stderr: "" };
89
- }
90
- catch (err) {
91
- const e = err;
92
- return {
93
- status: typeof e.status === "number" ? e.status : 2,
94
- stdout: typeof e.stdout === "string" ? e.stdout : "",
95
- stderr: typeof e.stderr === "string" ? e.stderr : "",
96
- };
97
- }
98
- }
99
72
  /** Normalise gate message for comparison (trim, collapse whitespace). */
100
73
  export function normaliseMessage(stdout, stderr, exitCode) {
101
74
  const raw = exitCode === 0 ? stdout : stderr;
@@ -129,60 +102,6 @@ export function buildScenarioRepo(scenario) {
129
102
  const vbriefPath = join(root, "vbrief", "active", vbriefName);
130
103
  return { root, vbriefPath, envelopePath };
131
104
  }
132
- function resolveDeftRoot() {
133
- if (process.env.DEFT_ROOT !== undefined && process.env.DEFT_ROOT.length > 0) {
134
- return resolve(process.env.DEFT_ROOT);
135
- }
136
- return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
137
- }
138
- function runScenario(deftRoot, scenario) {
139
- const { root, vbriefPath, envelopePath } = buildScenarioRepo(scenario);
140
- const pyArgs = [
141
- "run",
142
- "python",
143
- join(deftRoot, "scripts", "preflight_story_start.py"),
144
- "--vbrief-path",
145
- vbriefPath,
146
- "--project-root",
147
- root,
148
- ];
149
- if (envelopePath !== null) {
150
- pyArgs.push("--allocation-context", envelopePath);
151
- }
152
- if (scenario.allowDirty) {
153
- pyArgs.push("--allow-dirty");
154
- }
155
- const tsArgs = [
156
- join(deftRoot, "packages", "cli", "dist", "verify-story-ready.js"),
157
- "--vbrief-path",
158
- vbriefPath,
159
- "--project-root",
160
- root,
161
- ];
162
- if (envelopePath !== null) {
163
- tsArgs.push("--allocation-context", envelopePath);
164
- }
165
- if (scenario.allowDirty) {
166
- tsArgs.push("--allow-dirty");
167
- }
168
- const py = runCapture("uv", pyArgs, deftRoot);
169
- const ts = runCapture("node", tsArgs, deftRoot);
170
- return {
171
- root,
172
- python: {
173
- name: scenario.name,
174
- exitCode: py.status,
175
- stdout: py.stdout,
176
- stderr: py.stderr,
177
- },
178
- ts: {
179
- name: scenario.name,
180
- exitCode: ts.status,
181
- stdout: ts.stdout,
182
- stderr: ts.stderr,
183
- },
184
- };
185
- }
186
105
  /** Diff python vs TS gate outputs across all parity scenarios. */
187
106
  export function diffParity(python, ts) {
188
107
  const pythonMessage = normaliseMessage(python.stdout, python.stderr, python.exitCode);
@@ -195,27 +114,6 @@ export function diffParity(python, ts) {
195
114
  };
196
115
  }
197
116
  /** Run all parity scenarios and return a structured result. */
198
- export function runParity() {
199
- const deftRoot = resolveDeftRoot();
200
- const scenarios = [];
201
- for (const scenario of PARITY_SCENARIOS) {
202
- const { root, python, ts } = runScenario(deftRoot, scenario);
203
- try {
204
- const diff = diffParity(python, ts);
205
- scenarios.push({
206
- name: scenario.name,
207
- pythonExit: python.exitCode,
208
- tsExit: ts.exitCode,
209
- ...diff,
210
- });
211
- }
212
- finally {
213
- rmSync(root, { recursive: true, force: true });
214
- }
215
- }
216
- const ok = scenarios.every((s) => !s.exitMismatch && !s.messageMismatch);
217
- return { ok, scenarios };
218
- }
219
117
  /** Render a human-readable parity report (exported for unit tests). */
220
118
  export function renderReport(result) {
221
119
  if (result.ok) {
@@ -236,19 +134,4 @@ export function renderReport(result) {
236
134
  }
237
135
  return lines.join("\n");
238
136
  }
239
- if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
240
- try {
241
- const result = runParity();
242
- if (result.ok) {
243
- process.stdout.write(`${renderReport(result)}\n`);
244
- process.exit(0);
245
- }
246
- process.stderr.write(`${renderReport(result)}\n`);
247
- process.exit(1);
248
- }
249
- catch (err) {
250
- process.stderr.write(`verify_story_ready parity: harness error -- ${String(err)}\n`);
251
- process.exit(2);
252
- }
253
- }
254
- //# sourceMappingURL=story-ready-parity.js.map
137
+ //# sourceMappingURL=story-ready-fixtures.js.map