@deftai/directive 0.62.0 → 0.64.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 (99) 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 +3 -1
  5. package/dist/orchestration-cli/coverage-map.js +1 -1
  6. package/dist/{policy-parity.d.ts → policy-fixtures.d.ts} +1 -3
  7. package/dist/{policy-parity.js → policy-fixtures.js} +4 -100
  8. package/dist/{release-e2e-parity.d.ts → release-e2e-fixtures.d.ts} +1 -3
  9. package/dist/release-e2e-fixtures.js +38 -0
  10. package/dist/{story-ready-parity.d.ts → story-ready-fixtures.d.ts} +1 -3
  11. package/dist/{story-ready-parity.js → story-ready-fixtures.js} +4 -121
  12. package/dist/{triage-aux-a-parity.d.ts → triage-aux-a-fixtures.d.ts} +1 -3
  13. package/dist/{triage-aux-a-parity.js → triage-aux-a-fixtures.js} +3 -73
  14. package/dist/{triage-aux-b-parity.d.ts → triage-aux-b-fixtures.d.ts} +1 -3
  15. package/dist/triage-aux-b-fixtures.js +167 -0
  16. package/dist/{triage-bootstrap-parity.d.ts → triage-bootstrap-fixtures.d.ts} +1 -3
  17. package/dist/{triage-bootstrap-parity.js → triage-bootstrap-fixtures.js} +4 -91
  18. package/dist/{triage-classify-parity.d.ts → triage-classify-fixtures.d.ts} +1 -3
  19. package/dist/{triage-classify-parity.js → triage-classify-fixtures.js} +4 -94
  20. package/dist/{triage-queue-parity.d.ts → triage-queue-fixtures.d.ts} +1 -3
  21. package/dist/{triage-queue-parity.js → triage-queue-fixtures.js} +4 -86
  22. package/dist/{triage-scope-parity.d.ts → triage-scope-fixtures.d.ts} +1 -3
  23. package/dist/{triage-scope-parity.js → triage-scope-fixtures.js} +4 -91
  24. package/dist/{vbrief-preflight-parity.d.ts → vbrief-preflight-fixtures.d.ts} +1 -3
  25. package/dist/vbrief-preflight-fixtures.js +79 -0
  26. package/dist/verify-source-cli/verify-cursor-tier1.d.ts +12 -0
  27. package/dist/verify-source-cli/verify-cursor-tier1.js +51 -0
  28. package/dist/{wip-cap-parity.d.ts → wip-cap-fixtures.d.ts} +1 -3
  29. package/dist/{wip-cap-parity.js → wip-cap-fixtures.js} +4 -91
  30. package/package.json +4 -15
  31. package/dist/cache-parity.d.ts +0 -36
  32. package/dist/cache-parity.js +0 -165
  33. package/dist/codebase-parity.d.ts +0 -31
  34. package/dist/codebase-parity.js +0 -303
  35. package/dist/doc-cli-parity.d.ts +0 -29
  36. package/dist/doc-cli-parity.js +0 -159
  37. package/dist/doctor-parity.d.ts +0 -42
  38. package/dist/doctor-parity.js +0 -157
  39. package/dist/intake-parity.d.ts +0 -30
  40. package/dist/intake-parity.js +0 -203
  41. package/dist/lifecycle-packs-parity.d.ts +0 -30
  42. package/dist/lifecycle-packs-parity.js +0 -377
  43. package/dist/orchestration-parity.d.ts +0 -38
  44. package/dist/orchestration-parity.js +0 -364
  45. package/dist/parity.d.ts +0 -36
  46. package/dist/parity.js +0 -176
  47. package/dist/platform-parity.d.ts +0 -26
  48. package/dist/platform-parity.js +0 -309
  49. package/dist/pr-closing-keywords-parity.d.ts +0 -45
  50. package/dist/pr-closing-keywords-parity.js +0 -259
  51. package/dist/pr-merge-readiness-parity.d.ts +0 -44
  52. package/dist/pr-merge-readiness-parity.js +0 -296
  53. package/dist/pr-monitor-parity.d.ts +0 -44
  54. package/dist/pr-monitor-parity.js +0 -283
  55. package/dist/pr-protected-issues-parity.d.ts +0 -41
  56. package/dist/pr-protected-issues-parity.js +0 -220
  57. package/dist/pr-wait-mergeable-parity.d.ts +0 -45
  58. package/dist/pr-wait-mergeable-parity.js +0 -340
  59. package/dist/release-e2e-parity.js +0 -114
  60. package/dist/release-parity.d.ts +0 -40
  61. package/dist/release-parity.js +0 -226
  62. package/dist/release-publish-parity.d.ts +0 -36
  63. package/dist/release-publish-parity.js +0 -138
  64. package/dist/release-rollback-parity.d.ts +0 -37
  65. package/dist/release-rollback-parity.js +0 -161
  66. package/dist/render-parity.d.ts +0 -36
  67. package/dist/render-parity.js +0 -385
  68. package/dist/scm-parity.d.ts +0 -39
  69. package/dist/scm-parity.js +0 -181
  70. package/dist/scope-lifecycle-parity.d.ts +0 -35
  71. package/dist/scope-lifecycle-parity.js +0 -177
  72. package/dist/session-parity.d.ts +0 -39
  73. package/dist/session-parity.js +0 -262
  74. package/dist/slice-parity.d.ts +0 -36
  75. package/dist/slice-parity.js +0 -304
  76. package/dist/swarm-parity.d.ts +0 -28
  77. package/dist/swarm-parity.js +0 -327
  78. package/dist/triage-actions-parity.d.ts +0 -36
  79. package/dist/triage-actions-parity.js +0 -357
  80. package/dist/triage-aux-b-parity.js +0 -308
  81. package/dist/triage-summary-parity.d.ts +0 -50
  82. package/dist/triage-summary-parity.js +0 -306
  83. package/dist/validate-content-parity.d.ts +0 -33
  84. package/dist/validate-content-parity.js +0 -356
  85. package/dist/vbrief-activate-parity.d.ts +0 -39
  86. package/dist/vbrief-activate-parity.js +0 -216
  87. package/dist/vbrief-build-parity.d.ts +0 -28
  88. package/dist/vbrief-build-parity.js +0 -399
  89. package/dist/vbrief-preflight-parity.js +0 -163
  90. package/dist/vbrief-reconcile-parity.d.ts +0 -23
  91. package/dist/vbrief-reconcile-parity.js +0 -609
  92. package/dist/vbrief-validate-parity.d.ts +0 -27
  93. package/dist/vbrief-validate-parity.js +0 -122
  94. package/dist/vbrief-validation-parity.d.ts +0 -28
  95. package/dist/vbrief-validation-parity.js +0 -645
  96. package/dist/verify-env-parity.d.ts +0 -28
  97. package/dist/verify-env-parity.js +0 -272
  98. package/dist/verify-source-parity.d.ts +0 -26
  99. package/dist/verify-source-parity.js +0 -178
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env node
2
- export interface ScenarioResult {
3
- readonly name: string;
4
- readonly exitCode: number;
5
- readonly stdout: string;
6
- readonly stderr: string;
7
- }
8
- export interface ParityScenario {
9
- readonly name: string;
10
- readonly argv: readonly string[];
11
- readonly cwd?: string;
12
- readonly env?: Record<string, string | undefined>;
13
- readonly setup?: (root: string) => void;
14
- /** When true, stdout may diverge (TS-only consumer probes post #2022 Phase 3). */
15
- readonly exitCodeOnly?: boolean;
16
- }
17
- export interface ParityResult {
18
- readonly ok: boolean;
19
- readonly scenarios: Array<{
20
- readonly name: string;
21
- readonly exitMismatch: boolean;
22
- readonly pythonExit: number;
23
- readonly tsExit: number;
24
- readonly stdoutMismatch: boolean;
25
- readonly pythonStdout: string;
26
- readonly tsStdout: string;
27
- }>;
28
- }
29
- export declare const PARITY_SCENARIOS: readonly ParityScenario[];
30
- /** Normalise volatile lines while preserving doctor semantics. */
31
- export declare function normaliseStdout(text: string): string;
32
- export declare function diffParity(python: ScenarioResult, ts: ScenarioResult, options?: {
33
- exitCodeOnly?: boolean;
34
- }): {
35
- exitMismatch: boolean;
36
- stdoutMismatch: boolean;
37
- pythonStdout: string;
38
- tsStdout: string;
39
- };
40
- export declare function runParity(): ParityResult;
41
- export declare function renderReport(result: ParityResult): string;
42
- //# sourceMappingURL=doctor-parity.d.ts.map
@@ -1,157 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Golden-output parity harness (#1728): runs BOTH the Python oracle
4
- * (`scripts/doctor.py`) and the ported TS doctor CLI with identical argv,
5
- * then diffs exit codes and stdout. Exit 0 only on byte-identical results.
6
- *
7
- * Exit codes: 0 parity / 1 divergence / 2 harness setup error.
8
- */
9
- import { spawnSync } from "node:child_process";
10
- import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
11
- import { tmpdir } from "node:os";
12
- import { dirname, join, resolve } from "node:path";
13
- import { fileURLToPath } from "node:url";
14
- export const PARITY_SCENARIOS = [
15
- { name: "full-json-deft-root", argv: ["--full", "--json"] },
16
- { name: "full-quiet-deft-root", argv: ["--full", "--quiet"] },
17
- { name: "unknown-flag", argv: ["--not-a-real-flag"] },
18
- {
19
- name: "full-json-consumer-fixture",
20
- argv: ["--full", "--json"],
21
- exitCodeOnly: true,
22
- setup(root) {
23
- writeFileSync(join(root, "AGENTS.md"), "<!-- deft:managed-section v3 -->\nbody\n<!-- /deft:managed-section -->\n", "utf8");
24
- mkdirSync(join(root, ".deft", "core"), { recursive: true });
25
- writeFileSync(join(root, ".deft", "core", "VERSION"), "tag: v0.1.0\nsha: abcdef0123456789abcdef0123456789abcdef01\nref: v0.1.0\n", "utf8");
26
- },
27
- },
28
- ];
29
- function runCapture(cmd, args, cwd, env = {}) {
30
- const merged = {
31
- ...process.env,
32
- ...env,
33
- DEFT_CACHE_DISABLE: "1",
34
- };
35
- for (const key of Object.keys(merged)) {
36
- if (merged[key] === undefined)
37
- delete merged[key];
38
- }
39
- const result = spawnSync(cmd, args, {
40
- cwd,
41
- encoding: "utf8",
42
- env: merged,
43
- stdio: ["ignore", "pipe", "pipe"],
44
- });
45
- return {
46
- status: result.status ?? 2,
47
- stdout: typeof result.stdout === "string" ? result.stdout : "",
48
- stderr: typeof result.stderr === "string" ? result.stderr : "",
49
- };
50
- }
51
- function resolveDeftRoot() {
52
- if (process.env.DEFT_ROOT !== undefined && process.env.DEFT_ROOT.length > 0) {
53
- return resolve(process.env.DEFT_ROOT);
54
- }
55
- return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
56
- }
57
- /** Normalise volatile lines while preserving doctor semantics. */
58
- export function normaliseStdout(text) {
59
- return text
60
- .split("\n")
61
- .filter((line) => !line.startsWith("Using CPython") &&
62
- !line.startsWith("Creating virtual environment") &&
63
- !line.startsWith("Installed ") &&
64
- // #2022: the TS doctor emits a pre-cutover status line that the Python
65
- // oracle (scripts/doctor.py) never had ("without a Python port"). Filter
66
- // it so this intentional TS-only addition does not register as parity
67
- // divergence. Removed when scripts/doctor.py is purged with the gate.
68
- !line.startsWith("Pre-cutover:"))
69
- .join("\n");
70
- }
71
- function runScenario(deftRoot, scenario) {
72
- let cwd = scenario.cwd ?? deftRoot;
73
- let tempRoot;
74
- const argv = [...scenario.argv];
75
- if (scenario.setup) {
76
- tempRoot = mkdtempSync(join(tmpdir(), "deft-doctor-parity-"));
77
- scenario.setup(tempRoot);
78
- cwd = tempRoot;
79
- }
80
- try {
81
- const pyArgs = ["run", "python", join(deftRoot, "scripts", "doctor.py"), ...argv];
82
- const tsArgs = [join(deftRoot, "packages", "cli", "dist", "doctor.js"), ...argv];
83
- const env = { ...scenario.env, PYTHONUTF8: "1" };
84
- const py = runCapture("uv", pyArgs, cwd, env);
85
- const ts = runCapture("node", tsArgs, cwd, env);
86
- return {
87
- python: { name: scenario.name, exitCode: py.status, stdout: py.stdout, stderr: py.stderr },
88
- ts: { name: scenario.name, exitCode: ts.status, stdout: ts.stdout, stderr: ts.stderr },
89
- };
90
- }
91
- finally {
92
- if (tempRoot) {
93
- rmSync(tempRoot, { recursive: true, force: true });
94
- }
95
- }
96
- }
97
- export function diffParity(python, ts, options = {}) {
98
- const pythonStdout = normaliseStdout(python.stdout);
99
- const tsStdout = normaliseStdout(ts.stdout);
100
- return {
101
- exitMismatch: python.exitCode !== ts.exitCode,
102
- stdoutMismatch: options.exitCodeOnly ? false : pythonStdout !== tsStdout,
103
- pythonStdout,
104
- tsStdout,
105
- };
106
- }
107
- export function runParity() {
108
- const deftRoot = resolveDeftRoot();
109
- const scenarios = [];
110
- for (const scenario of PARITY_SCENARIOS) {
111
- const ran = runScenario(deftRoot, scenario);
112
- scenarios.push({
113
- name: scenario.name,
114
- pythonExit: ran.python.exitCode,
115
- tsExit: ran.ts.exitCode,
116
- ...diffParity(ran.python, ran.ts, { exitCodeOnly: scenario.exitCodeOnly }),
117
- });
118
- }
119
- const ok = scenarios.every((s) => !s.exitMismatch && !s.stdoutMismatch);
120
- return { ok, scenarios };
121
- }
122
- export function renderReport(result) {
123
- if (result.ok) {
124
- return `doctor parity: CLEAN -- Python and TS agree on ${result.scenarios.length} scenario(s).`;
125
- }
126
- const lines = ["doctor parity: DIVERGENCE"];
127
- for (const s of result.scenarios) {
128
- if (s.exitMismatch || s.stdoutMismatch) {
129
- lines.push(` scenario: ${s.name}`);
130
- if (s.exitMismatch) {
131
- lines.push(` exit mismatch: python=${s.pythonExit} ts=${s.tsExit}`);
132
- }
133
- if (s.stdoutMismatch) {
134
- lines.push(` python stdout (${s.pythonStdout.length} bytes)`);
135
- lines.push(` ts stdout (${s.tsStdout.length} bytes)`);
136
- }
137
- }
138
- }
139
- return lines.join("\n");
140
- }
141
- if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
142
- try {
143
- const result = runParity();
144
- if (result.ok) {
145
- process.stdout.write(`${renderReport(result)}\n`);
146
- process.exit(0);
147
- }
148
- process.stderr.write(`${renderReport(result)}\n`);
149
- process.exit(1);
150
- }
151
- catch (err) {
152
- const msg = String(err).replace(/\r?\n/g, " ");
153
- process.stderr.write(`doctor parity: harness error -- ${msg}\n`);
154
- process.exit(2);
155
- }
156
- }
157
- //# sourceMappingURL=doctor-parity.js.map
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
- import { PARITY_SCENARIO_NAMES, type ParityScenarioName } from "@deftai/directive-core/intake/parity-scenarios";
3
- export interface Capture {
4
- readonly exitCode: number;
5
- readonly stdout: string;
6
- readonly stderr: string;
7
- }
8
- export interface ParityCase {
9
- readonly name: ParityScenarioName;
10
- readonly runPython: (deftRoot: string) => Capture;
11
- readonly runTs: (deftRoot: string) => Capture;
12
- }
13
- export declare const PARITY_CASES: readonly ParityCase[];
14
- export interface ParityDiff {
15
- readonly name: string;
16
- readonly exitMismatch: boolean;
17
- readonly stdoutMismatch: boolean;
18
- readonly stderrMismatch: boolean;
19
- readonly pythonExit: number;
20
- readonly tsExit: number;
21
- }
22
- export interface ParityResult {
23
- readonly ok: boolean;
24
- readonly diffs: ParityDiff[];
25
- }
26
- export declare function diffCase(python: Capture, ts: Capture, name: string): ParityDiff;
27
- export declare function runParity(deftRoot?: string): ParityResult;
28
- export declare function renderReport(result: ParityResult): string;
29
- export { PARITY_SCENARIO_NAMES };
30
- //# sourceMappingURL=intake-parity.d.ts.map
@@ -1,203 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Golden-output parity harness (#1784): compares TS intake modules vs Python oracle via python -c.
4
- */
5
- import { spawnSync } from "node:child_process";
6
- import { dirname, resolve } from "node:path";
7
- import { fileURLToPath } from "node:url";
8
- import { buildIssueVbrief, CandidatesLogError, extractCrossRefs, IssueState, reconcile, renderIssueBody, resultToDict, validateCandidatesEntry, validateGithubAuth, } from "@deftai/directive-core/intake";
9
- import { PARITY_SCENARIO_NAMES, SAMPLE_ISSUE, SAMPLE_VBRIEF, } from "@deftai/directive-core/intake/parity-scenarios";
10
- import { pythonJsonStringify } from "@deftai/directive-core/scm";
11
- function capture(exitCode, stdout, stderr = "") {
12
- return { exitCode, stdout, stderr };
13
- }
14
- function sortKeysDeep(value) {
15
- if (Array.isArray(value)) {
16
- return value.map((item) => sortKeysDeep(item));
17
- }
18
- if (value !== null && typeof value === "object") {
19
- const obj = value;
20
- const sorted = {};
21
- for (const key of Object.keys(obj).sort()) {
22
- sorted[key] = sortKeysDeep(obj[key]);
23
- }
24
- return sorted;
25
- }
26
- return value;
27
- }
28
- function stableJson(value) {
29
- return `${pythonJsonStringify(sortKeysDeep(value))}\n`;
30
- }
31
- function runPythonScript(deftRoot, script) {
32
- const code = `import importlib.util, json, sys\nfrom pathlib import Path\nroot = Path(${JSON.stringify(deftRoot)})\nsys.path.insert(0, str(root / "scripts"))\n${script}`;
33
- const result = spawnSync("uv", ["run", "python", "-c", code], {
34
- cwd: deftRoot,
35
- encoding: "utf8",
36
- env: { ...process.env, DEFT_CACHE_DISABLE: "1", PYTHONUTF8: "1" },
37
- stdio: ["ignore", "pipe", "pipe"],
38
- });
39
- return {
40
- exitCode: result.status ?? 2,
41
- stdout: typeof result.stdout === "string" ? result.stdout : "",
42
- stderr: typeof result.stderr === "string" ? result.stderr : "",
43
- };
44
- }
45
- function loadModule(name, rel) {
46
- return `spec = importlib.util.spec_from_file_location(${JSON.stringify(name)}, root / ${JSON.stringify(rel)})
47
- mod = importlib.util.module_from_spec(spec)
48
- sys.modules[${JSON.stringify(name)}] = mod
49
- spec.loader.exec_module(mod)`;
50
- }
51
- export const PARITY_CASES = [
52
- {
53
- name: "issue-ingest-build-vbrief",
54
- runPython(deftRoot) {
55
- return runPythonScript(deftRoot, `${loadModule("issue_ingest", "scripts/issue_ingest.py")}
56
- issue = ${JSON.stringify(SAMPLE_ISSUE)}
57
- vbrief, folder = mod._build_issue_vbrief(issue, "proposed", "https://github.com/owner/repo")
58
- print(json.dumps({"folder": folder, "vbrief": vbrief}, ensure_ascii=False, sort_keys=True))
59
- sys.exit(0)`);
60
- },
61
- runTs() {
62
- const [vbrief, folder] = buildIssueVbrief(SAMPLE_ISSUE, "proposed", "https://github.com/owner/repo");
63
- return capture(0, stableJson({ folder, vbrief }));
64
- },
65
- },
66
- {
67
- name: "issue-ingest-cross-refs",
68
- runPython(deftRoot) {
69
- return runPythonScript(deftRoot, `${loadModule("issue_ingest", "scripts/issue_ingest.py")}
70
- body = "Closes #10\\nRefs #11\\nBlocked by #12"
71
- refs = mod._extract_cross_refs(body, "https://github.com/o/r", exclude={10})
72
- print(json.dumps(refs, ensure_ascii=False, sort_keys=True))
73
- sys.exit(0)`);
74
- },
75
- runTs() {
76
- const refs = extractCrossRefs("Closes #10\nRefs #11\nBlocked by #12", "https://github.com/o/r", new Set([10]));
77
- return capture(0, stableJson(refs));
78
- },
79
- },
80
- {
81
- name: "issue-emit-render-body",
82
- runPython(deftRoot) {
83
- return runPythonScript(deftRoot, `${loadModule("issue_emit", "scripts/issue_emit.py")}
84
- data = ${JSON.stringify(SAMPLE_VBRIEF)}
85
- print(mod.render_issue_body(data), end="")
86
- sys.exit(0)`);
87
- },
88
- runTs() {
89
- return capture(0, renderIssueBody(SAMPLE_VBRIEF));
90
- },
91
- },
92
- {
93
- name: "reconcile-classify",
94
- runPython(deftRoot) {
95
- return runPythonScript(deftRoot, `${loadModule("reconcile_issues", "scripts/reconcile_issues.py")}
96
- report = mod.reconcile({1: ["proposed/a.vbrief.json"]}, {1: mod.IssueState("OPEN")})
97
- print(json.dumps(report, ensure_ascii=False, sort_keys=True))
98
- sys.exit(0)`);
99
- },
100
- runTs() {
101
- const report = reconcile(new Map([[1, ["proposed/a.vbrief.json"]]]), new Map([[1, new IssueState("OPEN")]]));
102
- return capture(0, stableJson(report));
103
- },
104
- },
105
- {
106
- name: "candidates-validate-reject",
107
- runPython(deftRoot) {
108
- return runPythonScript(deftRoot, `${loadModule("candidates_log", "scripts/candidates_log.py")}
109
- try:
110
- mod._validate_entry({"decision": "accept"})
111
- except mod.CandidatesLogError as exc:
112
- print(str(exc))
113
- sys.exit(1)
114
- sys.exit(0)`);
115
- },
116
- runTs() {
117
- try {
118
- validateCandidatesEntry({ decision: "accept" });
119
- return capture(0, "");
120
- }
121
- catch (exc) {
122
- if (exc instanceof CandidatesLogError) {
123
- return capture(1, `${exc.message}\n`);
124
- }
125
- throw exc;
126
- }
127
- },
128
- },
129
- {
130
- name: "github-auth-invalid-mode",
131
- runPython(deftRoot) {
132
- return runPythonScript(deftRoot, `${loadModule("github_auth_modes", "scripts/github_auth_modes.py")}
133
- result = mod.validate_github_auth("bogus", environ={})
134
- print(json.dumps(result.to_dict(), ensure_ascii=False, sort_keys=True))
135
- sys.exit(0)`);
136
- },
137
- runTs() {
138
- const result = validateGithubAuth("bogus", { environ: {} });
139
- return capture(0, stableJson(resultToDict(result)));
140
- },
141
- },
142
- ];
143
- function resolveDeftRoot() {
144
- if (process.env.DEFT_ROOT) {
145
- return resolve(process.env.DEFT_ROOT);
146
- }
147
- return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
148
- }
149
- export function diffCase(python, ts, name) {
150
- return {
151
- name,
152
- exitMismatch: python.exitCode !== ts.exitCode,
153
- stdoutMismatch: python.stdout !== ts.stdout,
154
- stderrMismatch: python.stderr !== ts.stderr,
155
- pythonExit: python.exitCode,
156
- tsExit: ts.exitCode,
157
- };
158
- }
159
- export function runParity(deftRoot = resolveDeftRoot()) {
160
- const diffs = [];
161
- for (const testCase of PARITY_CASES) {
162
- diffs.push(diffCase(testCase.runPython(deftRoot), testCase.runTs(deftRoot), testCase.name));
163
- }
164
- return {
165
- ok: diffs.every((d) => !d.exitMismatch && !d.stdoutMismatch && !d.stderrMismatch),
166
- diffs,
167
- };
168
- }
169
- export function renderReport(result) {
170
- if (result.ok) {
171
- return `intake parity: CLEAN -- Python and TS agree on ${PARITY_CASES.length} case(s).`;
172
- }
173
- const lines = ["intake parity: DIVERGENCE"];
174
- for (const d of result.diffs) {
175
- if (d.exitMismatch || d.stdoutMismatch || d.stderrMismatch) {
176
- lines.push(` case: ${d.name}`);
177
- if (d.exitMismatch)
178
- lines.push(` exit: python=${d.pythonExit} ts=${d.tsExit}`);
179
- if (d.stdoutMismatch)
180
- lines.push(" stdout mismatch");
181
- if (d.stderrMismatch)
182
- lines.push(" stderr mismatch");
183
- }
184
- }
185
- return lines.join("\n");
186
- }
187
- if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
188
- try {
189
- const result = runParity();
190
- if (result.ok) {
191
- process.stdout.write(`${renderReport(result)}\n`);
192
- process.exit(0);
193
- }
194
- process.stderr.write(`${renderReport(result)}\n`);
195
- process.exit(1);
196
- }
197
- catch (err) {
198
- process.stderr.write(`intake parity: harness error -- ${String(err)}\n`);
199
- process.exit(2);
200
- }
201
- }
202
- export { PARITY_SCENARIO_NAMES };
203
- //# sourceMappingURL=intake-parity.js.map
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
- export interface CommandCapture {
3
- readonly exitCode: number;
4
- readonly stdout: string;
5
- readonly stderr: string;
6
- }
7
- export interface ParityCase {
8
- readonly name: string;
9
- readonly runPython: (deftRoot: string, repo: string) => CommandCapture;
10
- readonly runTs: (deftRoot: string, repo: string) => CommandCapture;
11
- readonly setup?: (deftRoot: string, repo: string) => void;
12
- }
13
- export interface ParityDiff {
14
- readonly caseName: string;
15
- readonly exitMismatch: boolean;
16
- readonly stdoutMismatch: boolean;
17
- readonly stderrMismatch: boolean;
18
- readonly pythonExit: number;
19
- readonly tsExit: number;
20
- }
21
- export interface ParityResult {
22
- readonly ok: boolean;
23
- readonly diffs: ParityDiff[];
24
- }
25
- export declare const PARITY_CASES: readonly ParityCase[];
26
- export declare function normalizeOutput(text: string): string;
27
- export declare function diffCase(python: CommandCapture, ts: CommandCapture, caseName: string): ParityDiff;
28
- export declare function runParity(): ParityResult;
29
- export declare function renderReport(result: ParityResult): string;
30
- //# sourceMappingURL=lifecycle-packs-parity.d.ts.map