@deftai/directive 0.62.0 → 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 (97) 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 +0 -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/{wip-cap-parity.d.ts → wip-cap-fixtures.d.ts} +1 -3
  27. package/dist/{wip-cap-parity.js → wip-cap-fixtures.js} +4 -91
  28. package/package.json +4 -15
  29. package/dist/cache-parity.d.ts +0 -36
  30. package/dist/cache-parity.js +0 -165
  31. package/dist/codebase-parity.d.ts +0 -31
  32. package/dist/codebase-parity.js +0 -303
  33. package/dist/doc-cli-parity.d.ts +0 -29
  34. package/dist/doc-cli-parity.js +0 -159
  35. package/dist/doctor-parity.d.ts +0 -42
  36. package/dist/doctor-parity.js +0 -157
  37. package/dist/intake-parity.d.ts +0 -30
  38. package/dist/intake-parity.js +0 -203
  39. package/dist/lifecycle-packs-parity.d.ts +0 -30
  40. package/dist/lifecycle-packs-parity.js +0 -377
  41. package/dist/orchestration-parity.d.ts +0 -38
  42. package/dist/orchestration-parity.js +0 -364
  43. package/dist/parity.d.ts +0 -36
  44. package/dist/parity.js +0 -176
  45. package/dist/platform-parity.d.ts +0 -26
  46. package/dist/platform-parity.js +0 -309
  47. package/dist/pr-closing-keywords-parity.d.ts +0 -45
  48. package/dist/pr-closing-keywords-parity.js +0 -259
  49. package/dist/pr-merge-readiness-parity.d.ts +0 -44
  50. package/dist/pr-merge-readiness-parity.js +0 -296
  51. package/dist/pr-monitor-parity.d.ts +0 -44
  52. package/dist/pr-monitor-parity.js +0 -283
  53. package/dist/pr-protected-issues-parity.d.ts +0 -41
  54. package/dist/pr-protected-issues-parity.js +0 -220
  55. package/dist/pr-wait-mergeable-parity.d.ts +0 -45
  56. package/dist/pr-wait-mergeable-parity.js +0 -340
  57. package/dist/release-e2e-parity.js +0 -114
  58. package/dist/release-parity.d.ts +0 -40
  59. package/dist/release-parity.js +0 -226
  60. package/dist/release-publish-parity.d.ts +0 -36
  61. package/dist/release-publish-parity.js +0 -138
  62. package/dist/release-rollback-parity.d.ts +0 -37
  63. package/dist/release-rollback-parity.js +0 -161
  64. package/dist/render-parity.d.ts +0 -36
  65. package/dist/render-parity.js +0 -385
  66. package/dist/scm-parity.d.ts +0 -39
  67. package/dist/scm-parity.js +0 -181
  68. package/dist/scope-lifecycle-parity.d.ts +0 -35
  69. package/dist/scope-lifecycle-parity.js +0 -177
  70. package/dist/session-parity.d.ts +0 -39
  71. package/dist/session-parity.js +0 -262
  72. package/dist/slice-parity.d.ts +0 -36
  73. package/dist/slice-parity.js +0 -304
  74. package/dist/swarm-parity.d.ts +0 -28
  75. package/dist/swarm-parity.js +0 -327
  76. package/dist/triage-actions-parity.d.ts +0 -36
  77. package/dist/triage-actions-parity.js +0 -357
  78. package/dist/triage-aux-b-parity.js +0 -308
  79. package/dist/triage-summary-parity.d.ts +0 -50
  80. package/dist/triage-summary-parity.js +0 -306
  81. package/dist/validate-content-parity.d.ts +0 -33
  82. package/dist/validate-content-parity.js +0 -356
  83. package/dist/vbrief-activate-parity.d.ts +0 -39
  84. package/dist/vbrief-activate-parity.js +0 -216
  85. package/dist/vbrief-build-parity.d.ts +0 -28
  86. package/dist/vbrief-build-parity.js +0 -399
  87. package/dist/vbrief-preflight-parity.js +0 -163
  88. package/dist/vbrief-reconcile-parity.d.ts +0 -23
  89. package/dist/vbrief-reconcile-parity.js +0 -609
  90. package/dist/vbrief-validate-parity.d.ts +0 -27
  91. package/dist/vbrief-validate-parity.js +0 -122
  92. package/dist/vbrief-validation-parity.d.ts +0 -28
  93. package/dist/vbrief-validation-parity.js +0 -645
  94. package/dist/verify-env-parity.d.ts +0 -28
  95. package/dist/verify-env-parity.js +0 -272
  96. package/dist/verify-source-parity.d.ts +0 -26
  97. package/dist/verify-source-parity.js +0 -178
@@ -1,327 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Golden-diff parity harness (#1788): runs TS swarm cohort verbs vs the FROZEN
4
- * Python oracle (cache-off) across launch-manifest, worktree-map collision,
5
- * readiness three-state, and review-clean fixtures.
6
- */
7
- import { execFileSync, spawnSync } from "node:child_process";
8
- import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
9
- import { tmpdir } from "node:os";
10
- import { dirname, join, resolve } from "node:path";
11
- import { fileURLToPath } from "node:url";
12
- const HEAD_SHA = "abc1234567890def1234567890abcdef12345678";
13
- const FAKE_GH_PY = `import json, os, sys
14
- responses = json.loads(os.environ.get("DEFT_FAKE_GH_RESPONSES", "{}"))
15
- cmd = " ".join(sys.argv[1:])
16
- label = "unknown"
17
- if "headRefOid" in cmd: label = "head-sha"
18
- elif "/issues/" in cmd and "/comments" in cmd and "--jq" in cmd: label = "comments-jq"
19
- resp = responses.get(label, {"returncode": 1, "stderr": f"unexpected: {label}", "stdout": ""})
20
- if resp.get("stdout"): sys.stdout.write(resp["stdout"])
21
- if resp.get("stderr"): sys.stderr.write(resp["stderr"])
22
- sys.exit(int(resp.get("returncode", 0)))
23
- `;
24
- function runCapture(cmd, args, cwd, env) {
25
- const result = spawnSync(cmd, args, {
26
- cwd,
27
- encoding: "utf8",
28
- env: env ?? process.env,
29
- stdio: ["ignore", "pipe", "pipe"],
30
- });
31
- return {
32
- exitCode: result.status ?? 2,
33
- stdout: typeof result.stdout === "string" ? result.stdout : "",
34
- stderr: typeof result.stderr === "string" ? result.stderr : "",
35
- };
36
- }
37
- function resolveDeftRoot() {
38
- if (process.env.DEFT_ROOT !== undefined && process.env.DEFT_ROOT.length > 0) {
39
- return resolve(process.env.DEFT_ROOT);
40
- }
41
- return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
42
- }
43
- export function normalizeOutput(text) {
44
- return text
45
- .replace(/--project-root [^\s]+/g, "--project-root <ROOT>")
46
- .replace(/--repo-root [^\s]+/g, "--repo-root <ROOT>")
47
- .replace(/(?:\/private)?\/var\/folders\/[^\s"')]+\/swarm-[^\s"')]+/g, "<TMP>")
48
- .replace(/\/tmp\/[^\s]+/g, "<TMP>")
49
- .replace(/\/home\/[^\s]+/g, "<PATH>")
50
- .trim()
51
- .replace(/\s+/g, " ");
52
- }
53
- function gitInit(repo) {
54
- execFileSync("git", ["init", "-q", "-b", "master", repo], { encoding: "utf8" });
55
- execFileSync("git", ["config", "user.email", "parity@test.local"], {
56
- cwd: repo,
57
- encoding: "utf8",
58
- });
59
- execFileSync("git", ["config", "user.name", "deft-parity"], { cwd: repo, encoding: "utf8" });
60
- writeFileSync(join(repo, "f.txt"), "x\n", "utf8");
61
- execFileSync("git", ["add", "-A"], { cwd: repo, encoding: "utf8" });
62
- execFileSync("git", ["commit", "-q", "-m", "init"], { cwd: repo, encoding: "utf8" });
63
- }
64
- function writeReadyStory(project, filename, storyId, issue) {
65
- const full = join(project, "vbrief", "active", filename);
66
- mkdirSync(dirname(full), { recursive: true });
67
- const acceptanceValues = [
68
- `Given ${storyId} input, when the story runs, then it returns a scoped result.`,
69
- `Given ${storyId} failure input, when the story runs, then it rejects the request.`,
70
- ];
71
- const payload = {
72
- vBRIEFInfo: { version: "0.6" },
73
- plan: {
74
- id: storyId,
75
- title: storyId,
76
- status: "running",
77
- references: [
78
- {
79
- uri: `https://github.com/deftai/directive/issues/${issue}`,
80
- type: "x-vbrief/github-issue",
81
- },
82
- ],
83
- narratives: {
84
- Description: `${storyId} implements a focused product behavior for the active workflow. The story stays within a narrow code path and includes targeted tests for success and failure behavior.`,
85
- ImplementationPlan: `1. Update the ${storyId} source path to implement the focused workflow behavior.\n2. Add targeted tests for ${storyId} success and failure outcomes.`,
86
- Traces: "FR-1",
87
- UserStory: `As a product user, I want ${storyId} behavior, so that I can complete the workflow.`,
88
- },
89
- items: acceptanceValues.map((criterion, index) => ({
90
- id: `${storyId}-a${index + 1}`,
91
- title: `Acceptance item ${index + 1}`,
92
- status: "pending",
93
- narrative: { Acceptance: criterion, Traces: "FR-1" },
94
- })),
95
- metadata: {
96
- kind: "story",
97
- swarm: {
98
- readiness: "ready",
99
- parallel_safe: true,
100
- file_scope: [`src/${storyId}.ts`],
101
- verify_commands: [`npm test -- ${storyId}`],
102
- expected_outputs: ["focused tests pass"],
103
- depends_on: [],
104
- conflict_group: "auth",
105
- size: "small",
106
- file_scope_confidence: "high",
107
- model_tier: "medium",
108
- },
109
- },
110
- },
111
- };
112
- writeFileSync(full, `${JSON.stringify(payload, null, 2)}\n`, "utf8");
113
- }
114
- function writeProjectDef(project) {
115
- const full = join(project, "vbrief", "PROJECT-DEFINITION.vbrief.json");
116
- mkdirSync(dirname(full), { recursive: true });
117
- writeFileSync(full, `${JSON.stringify({ vBRIEFInfo: { version: "0.6" }, plan: { policy: { swarmSubagentBackend: "grok-build" } } }, null, 2)}\n`, "utf8");
118
- }
119
- function writeBlockedStory(project) {
120
- const full = join(project, "vbrief", "active", "blocked.vbrief.json");
121
- mkdirSync(dirname(full), { recursive: true });
122
- writeFileSync(full, `${JSON.stringify({
123
- vBRIEFInfo: { version: "0.6" },
124
- plan: {
125
- id: "blocked-story",
126
- title: "blocked",
127
- status: "running",
128
- metadata: { kind: "story", swarm: { readiness: "not-ready" } },
129
- },
130
- }, null, 2)}\n`, "utf8");
131
- }
132
- function setupFakeGh(tmp) {
133
- const fakeGh = join(tmp, "fake-gh");
134
- writeFileSync(fakeGh, FAKE_GH_PY, "utf8");
135
- chmodSync(fakeGh, 0o755);
136
- return fakeGh;
137
- }
138
- function cleanGreptileBody(sha = HEAD_SHA, confidence = 5) {
139
- return ("## Greptile Summary\n\nNo P0 or P1 issues.\n\n" +
140
- `**Confidence Score: ${confidence}/5**\n\n` +
141
- `Last reviewed commit: [fix](https://github.com/deftai/directive/commit/${sha})\n`);
142
- }
143
- export const PARITY_CASES = [
144
- {
145
- name: "worktree-map-collision-reject",
146
- run: (deftRoot) => {
147
- const repo = mkdtempSync(join(tmpdir(), "swarm-wt-"));
148
- gitInit(repo);
149
- const mapPath = join(repo, "map.json");
150
- const wt = join(repo, "wt-shared");
151
- writeFileSync(mapPath, JSON.stringify([
152
- { story_id: "alpha", worktree_path: wt },
153
- { story_id: "beta", worktree_path: wt },
154
- ]), "utf8");
155
- const pyArgs = [
156
- "run",
157
- "python",
158
- join(deftRoot, "scripts", "swarm_worktrees.py"),
159
- "--map",
160
- mapPath,
161
- "--base-branch",
162
- "master",
163
- "--repo-root",
164
- repo,
165
- "--no-create-missing",
166
- ];
167
- const tsArgs = [
168
- join(deftRoot, "packages", "core", "dist", "swarm", "worktrees-cli.js"),
169
- "--map",
170
- mapPath,
171
- "--base-branch",
172
- "master",
173
- "--repo-root",
174
- repo,
175
- "--no-create-missing",
176
- ];
177
- const python = runCapture("uv", pyArgs, deftRoot);
178
- const ts = runCapture("node", tsArgs, deftRoot);
179
- rmSync(repo, { recursive: true, force: true });
180
- return { python, ts };
181
- },
182
- },
183
- {
184
- name: "readiness-ready-story",
185
- run: (deftRoot) => {
186
- const project = mkdtempSync(join(tmpdir(), "swarm-ready-"));
187
- mkdirSync(join(project, "vbrief", "active"), { recursive: true });
188
- writeReadyStory(project, "ready.vbrief.json", "ready-a", 9001);
189
- const storyPath = join(project, "vbrief", "active", "ready.vbrief.json");
190
- const py = runCapture("uv", [
191
- "run",
192
- "python",
193
- join(deftRoot, "scripts", "swarm_readiness.py"),
194
- storyPath,
195
- "--project-root",
196
- project,
197
- ], deftRoot);
198
- const ts = runCapture("node", [
199
- join(deftRoot, "packages", "core", "dist", "swarm", "readiness-cli.js"),
200
- storyPath,
201
- "--project-root",
202
- project,
203
- ], deftRoot);
204
- rmSync(project, { recursive: true, force: true });
205
- return { python: py, ts };
206
- },
207
- },
208
- {
209
- name: "readiness-blocked-story",
210
- run: (deftRoot) => {
211
- const project = mkdtempSync(join(tmpdir(), "swarm-block-"));
212
- writeBlockedStory(project);
213
- const storyPath = join(project, "vbrief", "active", "blocked.vbrief.json");
214
- const py = runCapture("uv", [
215
- "run",
216
- "python",
217
- join(deftRoot, "scripts", "swarm_readiness.py"),
218
- storyPath,
219
- "--project-root",
220
- project,
221
- ], deftRoot);
222
- const ts = runCapture("node", [
223
- join(deftRoot, "packages", "core", "dist", "swarm", "readiness-cli.js"),
224
- storyPath,
225
- "--project-root",
226
- project,
227
- ], deftRoot);
228
- rmSync(project, { recursive: true, force: true });
229
- return { python: py, ts };
230
- },
231
- },
232
- {
233
- name: "review-clean-cohort-clean",
234
- run: (deftRoot) => {
235
- const tmp = mkdtempSync(join(tmpdir(), "swarm-rc-"));
236
- const fakeGh = setupFakeGh(tmp);
237
- const env = {
238
- ...process.env,
239
- PATH: `${dirname(fakeGh)}:${process.env.PATH ?? ""}`,
240
- DEFT_FAKE_GH_RESPONSES: JSON.stringify({
241
- "head-sha": { returncode: 0, stdout: `${HEAD_SHA}\n` },
242
- "comments-jq": { returncode: 0, stdout: cleanGreptileBody() },
243
- }),
244
- };
245
- const argv = ["1370", "--repo", "deftai/directive"];
246
- const py = runCapture("uv", ["run", "python", join(deftRoot, "scripts", "swarm_verify_review_clean.py"), ...argv], deftRoot, env);
247
- const ts = runCapture("node", [
248
- join(deftRoot, "packages", "core", "dist", "swarm", "verify-review-clean-cli.js"),
249
- ...argv,
250
- ], deftRoot, env);
251
- rmSync(tmp, { recursive: true, force: true });
252
- return { python: py, ts };
253
- },
254
- },
255
- {
256
- name: "launch-manifest-solo",
257
- run: (deftRoot) => {
258
- const project = mkdtempSync(join(tmpdir(), "swarm-launch-"));
259
- mkdirSync(join(project, "vbrief", "active"), { recursive: true });
260
- writeReadyStory(project, "solo.vbrief.json", "solo-a", 8801);
261
- writeProjectDef(project);
262
- const env = { ...process.env, DEFT_PROBE_GROK_BUILD: "yes" };
263
- const argv = ["--stories", "8801", "--project-root", project, "--autonomous"];
264
- const py = runCapture("uv", ["run", "python", join(deftRoot, "scripts", "swarm_launch.py"), ...argv], deftRoot, env);
265
- const ts = runCapture("node", [join(deftRoot, "packages", "core", "dist", "swarm", "launch-cli.js"), ...argv], deftRoot, env);
266
- rmSync(project, { recursive: true, force: true });
267
- return { python: py, ts };
268
- },
269
- },
270
- ];
271
- export function diffCase(name, python, ts) {
272
- const pyStdout = normalizeOutput(python.stdout);
273
- const tsStdout = normalizeOutput(ts.stdout);
274
- const pyStderr = normalizeOutput(python.stderr);
275
- const tsStderr = normalizeOutput(ts.stderr);
276
- const exitMismatch = python.exitCode !== ts.exitCode;
277
- const stdoutMismatch = pyStdout !== tsStdout;
278
- const stderrMismatch = pyStderr !== tsStderr;
279
- return {
280
- name,
281
- ok: !exitMismatch && !stdoutMismatch && !stderrMismatch,
282
- exitMismatch,
283
- stdoutMismatch,
284
- stderrMismatch,
285
- };
286
- }
287
- export function runParity() {
288
- const deftRoot = resolveDeftRoot();
289
- const cases = PARITY_CASES.map((c) => {
290
- const { python, ts } = c.run(deftRoot);
291
- return diffCase(c.name, python, ts);
292
- });
293
- return { ok: cases.every((c) => c.ok), cases };
294
- }
295
- export function runParityCli() {
296
- try {
297
- const result = runParity();
298
- if (result.ok) {
299
- process.stdout.write(`swarm parity: CLEAN -- Python and TS agree on ${result.cases.length} case(s).\n`);
300
- return 0;
301
- }
302
- process.stderr.write("swarm parity: DIVERGENCE\n");
303
- for (const c of result.cases) {
304
- if (!c.ok) {
305
- process.stderr.write(` case: ${c.name}\n`);
306
- if (c.exitMismatch) {
307
- process.stderr.write(" exit code mismatch\n");
308
- }
309
- if (c.stdoutMismatch) {
310
- process.stderr.write(" stdout mismatch\n");
311
- }
312
- if (c.stderrMismatch) {
313
- process.stderr.write(" stderr mismatch\n");
314
- }
315
- }
316
- }
317
- return 1;
318
- }
319
- catch (err) {
320
- process.stderr.write(`swarm parity: harness error -- ${String(err)}\n`);
321
- return 2;
322
- }
323
- }
324
- if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
325
- process.exit(runParityCli());
326
- }
327
- //# sourceMappingURL=swarm-parity.js.map
@@ -1,36 +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 argv: readonly string[];
10
- readonly seed?: string;
11
- }
12
- export interface ParityDiff {
13
- readonly caseName: string;
14
- readonly exitMismatch: boolean;
15
- readonly stdoutMismatch: boolean;
16
- readonly stderrMismatch: boolean;
17
- readonly pythonExit: number;
18
- readonly tsExit: number;
19
- }
20
- export interface ParityResult {
21
- readonly ok: boolean;
22
- readonly diffs: ParityDiff[];
23
- }
24
- /** Strip volatile UUIDs and timestamps before compare. */
25
- export declare function normalizeOutput(text: string): string;
26
- /** Keep only operator-facing triage stderr; drop uv/tooling noise from Python spawns. */
27
- export declare function normalizeStderr(text: string): string;
28
- /** Build a throwaway project root with an empty audit-log parent directory. */
29
- export declare function buildFixtureRepo(): string;
30
- /** Diff one parity case between Python oracle and TS CLI. */
31
- export declare function diffCase(python: CommandCapture, ts: CommandCapture, caseName: string): ParityDiff;
32
- export declare const PARITY_CASES: readonly ParityCase[];
33
- /** Run all parity cases; returns aggregate result. */
34
- export declare function runParity(): ParityResult;
35
- export declare function renderReport(result: ParityResult): string;
36
- //# sourceMappingURL=triage-actions-parity.d.ts.map