@deftai/directive 0.57.0 → 0.58.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.
@@ -24,6 +24,7 @@ export interface ParityResult {
24
24
  readonly diffs: ParityDiff[];
25
25
  }
26
26
  export declare const PARITY_CASES: readonly ParityCase[];
27
+ export declare function normalizeOutput(text: string): string;
27
28
  export declare function diffCase(python: CommandCapture, ts: CommandCapture, caseName: string): ParityDiff;
28
29
  export declare function runParity(): ParityResult;
29
30
  export declare function renderReport(result: ParityResult): string;
@@ -229,12 +229,21 @@ export const PARITY_CASES = [
229
229
  setup: writeCapacityProject,
230
230
  },
231
231
  ];
232
+ export function normalizeOutput(text) {
233
+ return text
234
+ .replace(/(?:\/private)?\/var\/folders\/[^\s"')]+\/deft-codebase-parity-[^\s"')]+/g, "<TMP>")
235
+ .replace(/\/tmp\/deft-codebase-parity-[^\s"')]+/g, "<TMP>");
236
+ }
232
237
  export function diffCase(python, ts, caseName) {
238
+ const pythonStdout = normalizeOutput(python.stdout);
239
+ const pythonStderr = normalizeOutput(python.stderr);
240
+ const tsStdout = normalizeOutput(ts.stdout);
241
+ const tsStderr = normalizeOutput(ts.stderr);
233
242
  return {
234
243
  caseName,
235
244
  exitMismatch: python.exitCode !== ts.exitCode,
236
- stdoutMismatch: python.stdout !== ts.stdout,
237
- stderrMismatch: python.stderr !== ts.stderr,
245
+ stdoutMismatch: pythonStdout !== tsStdout,
246
+ stderrMismatch: pythonStderr !== tsStderr,
238
247
  pythonExit: python.exitCode,
239
248
  tsExit: ts.exitCode,
240
249
  };
@@ -174,7 +174,7 @@ export const PARITY_CASES = [
174
174
  const script = `import sys
175
175
  from pathlib import Path
176
176
  root = Path(${JSON.stringify(deftRoot)})
177
- repo = Path(${JSON.stringify(repo)})
177
+ repo = Path(${JSON.stringify(repo)}).resolve()
178
178
  sys.path.insert(0, str(root / "scripts"))
179
179
  import packs_slice
180
180
  packs_slice.REPO_ROOT = repo
@@ -199,7 +199,7 @@ raise SystemExit(0)`;
199
199
  const script = `import sys
200
200
  from pathlib import Path
201
201
  root = Path(${JSON.stringify(deftRoot)})
202
- repo = Path(${JSON.stringify(repo)})
202
+ repo = Path(${JSON.stringify(repo)}).resolve()
203
203
  sys.path.insert(0, str(root / "scripts"))
204
204
  import packs_slice
205
205
  packs_slice.REPO_ROOT = repo
@@ -116,7 +116,10 @@ function resolveDeftRoot() {
116
116
  }
117
117
  /** Normalise volatile ISO dates in stderr while preserving semantics. */
118
118
  export function normaliseStderr(text) {
119
- return text.replace(/\d{4}-\d{2}-\d{2}/g, "YYYY-MM-DD");
119
+ return text
120
+ .replace(/\d{4}-\d{2}-\d{2}/g, "YYYY-MM-DD")
121
+ .replace(/(?:\/private)?\/var\/folders\/[^\s)]+\/deft-release-parity-[^\s)]+/g, "<TMP>")
122
+ .replace(/\/tmp\/deft-release-parity-[^\s)]+/g, "<TMP>");
120
123
  }
121
124
  export function pickOutput(result, stream) {
122
125
  return stream === "stdout" ? result.stdout : result.stderr;
@@ -29,6 +29,7 @@ export interface ParityResult {
29
29
  readonly diffs: ParityDiff[];
30
30
  }
31
31
  export declare const PARITY_CASES: readonly ParityCase[];
32
+ export declare function normalizeMessage(text: string): string;
32
33
  export declare function diffCase(python: CommandCapture, ts: CommandCapture, gate: string, caseName: string): ParityDiff;
33
34
  export declare function runParity(): ParityResult;
34
35
  export declare function renderReport(result: ParityResult): string;
@@ -296,8 +296,10 @@ function normalizeProjectBytes(bytes) {
296
296
  text = text.replace(/"created": "[^"]+"/g, '"created": "<TS>"');
297
297
  return Buffer.from(text, "utf8");
298
298
  }
299
- function normalizeMessage(text) {
300
- return text.replace(/\/tmp\/deft-render-parity-(py|ts)-[^/\s]+/g, "<TMP>");
299
+ export function normalizeMessage(text) {
300
+ return text
301
+ .replace(/(?:\/private)?\/var\/folders\/[^\s"')]+\/deft-render-parity-(py|ts)-[^/\s"')]+/g, "<TMP>")
302
+ .replace(/\/tmp\/deft-render-parity-(py|ts)-[^/\s"')]+/g, "<TMP>");
301
303
  }
302
304
  export function diffCase(python, ts, gate, caseName) {
303
305
  let bytesMismatch = false;
@@ -5,7 +5,7 @@
5
5
  * shared fixtures (cache-off) and diffs JSON stdout + exit codes.
6
6
  */
7
7
  import { execFileSync, spawnSync } from "node:child_process";
8
- import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
8
+ import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
9
9
  import { tmpdir } from "node:os";
10
10
  import { dirname, join, resolve } from "node:path";
11
11
  import { fileURLToPath } from "node:url";
@@ -53,10 +53,11 @@ function fakeGitRunner(head, worktree) {
53
53
  }
54
54
  function writeFreshState(fixture, startedAt, gated = {}) {
55
55
  const now = new Date(startedAt);
56
+ const worktree = realpathSync(fixture.root);
56
57
  writeRitualState(fixture.root, newRitualStatePayload({
57
58
  sessionId: "parity-session",
58
59
  gitHead: fixture.head,
59
- worktreePath: resolve(fixture.root),
60
+ worktreePath: worktree,
60
61
  startedAt: now,
61
62
  quickSteps: {
62
63
  alignment: ritualStep({ ok: true, ts: now }),
@@ -107,7 +108,7 @@ function runTsVerify(fixture, scenario) {
107
108
  tier: scenario.tier,
108
109
  now: new Date(scenario.nowIso),
109
110
  bypass: scenario.bypass,
110
- runGit: fakeGitRunner(fixture.head, resolve(fixture.root)),
111
+ runGit: fakeGitRunner(fixture.head, realpathSync(fixture.root)),
111
112
  runner: scenario.runner,
112
113
  });
113
114
  return {
@@ -161,10 +162,11 @@ export const PARITY_CASES = [
161
162
  setup() {
162
163
  const fixture = initGitRepo();
163
164
  const now = new Date(FIXED_NOW);
165
+ const worktree = realpathSync(fixture.root);
164
166
  writeRitualState(fixture.root, newRitualStatePayload({
165
167
  sessionId: "parity-session",
166
168
  gitHead: fixture.head,
167
- worktreePath: resolve(fixture.root),
169
+ worktreePath: worktree,
168
170
  startedAt: now,
169
171
  quickSteps: {
170
172
  alignment: ritualStep({ ok: true, ts: now }),
@@ -44,6 +44,7 @@ export function normalizeOutput(text) {
44
44
  return text
45
45
  .replace(/--project-root [^\s]+/g, "--project-root <ROOT>")
46
46
  .replace(/--repo-root [^\s]+/g, "--repo-root <ROOT>")
47
+ .replace(/(?:\/private)?\/var\/folders\/[^\s"')]+\/swarm-[^\s"')]+/g, "<TMP>")
47
48
  .replace(/\/tmp\/[^\s]+/g, "<TMP>")
48
49
  .replace(/\/home\/[^\s]+/g, "<PATH>")
49
50
  .trim()
@@ -15,6 +15,7 @@ import { cachePut } from "@deftai/directive-core/dist/cache/operations.js";
15
15
  /** Strip volatile UUIDs and timestamps before compare. */
16
16
  export function normalizeOutput(text) {
17
17
  return text
18
+ .replace(/(?:\/private)?\/(?:tmp|var\/folders\/[^\s"']+\/T)\/deft-triage-actions-parity-[^/\s"']+/g, "<FIXTURE>")
18
19
  .replace(/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/g, "<UUID>")
19
20
  .replace(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/g, "<TS>")
20
21
  .replace(/Using CPython[^\n]*\n/g, "")
@@ -16,7 +16,12 @@ export function normalizeOutput(text) {
16
16
  return text
17
17
  .replace(/project_root=[^\s)"]+/g, "project_root=<ROOT>")
18
18
  .replace(/"project_root": "[^"]+"/g, '"project_root": "<ROOT>"')
19
- .replace(/\/tmp\/[^\s"']+/g, "<TMP>");
19
+ .replace(/\/tmp\/[^\s"']+/g, "<TMP>")
20
+ .replace(/(?:\/private)?\/var\/folders\/[^\s"']+/g, "<TMP>")
21
+ .replace(/^WARN [^\n]*\n/gm, "")
22
+ .replace(/Using CPython[^\n]*\n/g, "")
23
+ .replace(/Creating virtual environment[^\n]*\n/g, "")
24
+ .replace(/Installed \d+ packages[^\n]*\n/g, "");
20
25
  }
21
26
  function runCapture(cmd, args, cwd) {
22
27
  const result = spawnSync(cmd, args, {
@@ -39,7 +44,7 @@ function resolveDeftRoot() {
39
44
  }
40
45
  export { resolveDeftRoot };
41
46
  function runPython(deftRoot, script, repo, argv) {
42
- const cap = runCapture("python3", [join(deftRoot, "scripts", script), ...argv, "--project-root", repo], deftRoot);
47
+ const cap = runCapture("uv", ["run", "python", join(deftRoot, "scripts", script), ...argv, "--project-root", repo], deftRoot);
43
48
  return { exitCode: cap.status, stdout: cap.stdout, stderr: cap.stderr };
44
49
  }
45
50
  function runTs(deftRoot, cli, repo, argv) {
@@ -14,7 +14,9 @@ import { fileURLToPath } from "node:url";
14
14
  const DEFAULT_REPO = "owner/repo";
15
15
  /** Strip volatile absolute paths before compare. */
16
16
  export function normalizeOutput(text) {
17
- return text.replace(/project_root=[^\s)]+/g, "project_root=<ROOT>");
17
+ return text
18
+ .replace(/^WARN [^\n]*\n/gm, "")
19
+ .replace(/project_root=[^\s)]+/g, "project_root=<ROOT>");
18
20
  }
19
21
  function runCapture(cmd, args, cwd, env = {}) {
20
22
  const merged = { ...process.env, ...env };
@@ -17,6 +17,7 @@ export interface ParityResult {
17
17
  readonly tsOutput: string;
18
18
  }>;
19
19
  }
20
+ export declare function normalizeOutput(text: string): string;
20
21
  export declare function runParity(): ParityResult;
21
22
  export declare function renderReport(result: ParityResult): string;
22
23
  //# sourceMappingURL=vbrief-reconcile-parity.d.ts.map
@@ -241,6 +241,11 @@ function resolveDeftRoot() {
241
241
  return resolve(process.env.DEFT_ROOT);
242
242
  return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
243
243
  }
244
+ export function normalizeOutput(text) {
245
+ return text
246
+ .replace(/(?:\/private)?\/var\/folders\/[^\s"')]+\/deft-vbrief-reconcile-[^\s"')]+/g, "<TMP>")
247
+ .replace(/\/tmp\/deft-vbrief-reconcile-[^\s"')]+/g, "<TMP>");
248
+ }
244
249
  function installPythonDriver() {
245
250
  const dir = mkdtempSync(join(tmpdir(), "deft-vbrief-reconcile-driver-"));
246
251
  const driverPath = join(dir, "vbrief_reconcile_parity_driver.py");
@@ -543,14 +548,18 @@ export function runParity() {
543
548
  else {
544
549
  ran = runLabelsUmbrellasParity(deftRoot, name, env);
545
550
  }
551
+ const pythonStdout = normalizeOutput(ran.python.stdout);
552
+ const pythonStderr = normalizeOutput(ran.python.stderr);
553
+ const tsStdout = normalizeOutput(ran.ts.stdout);
554
+ const tsStderr = normalizeOutput(ran.ts.stderr);
546
555
  scenarios.push({
547
556
  name,
548
557
  pythonExit: ran.python.exitCode,
549
558
  tsExit: ran.ts.exitCode,
550
559
  exitMismatch: ran.python.exitCode !== ran.ts.exitCode,
551
- outputMismatch: ran.python.stdout !== ran.ts.stdout || ran.python.stderr !== ran.ts.stderr,
552
- pythonOutput: ran.python.stdout || ran.python.stderr,
553
- tsOutput: ran.ts.stdout || ran.ts.stderr,
560
+ outputMismatch: pythonStdout !== tsStdout || pythonStderr !== tsStderr,
561
+ pythonOutput: pythonStdout || pythonStderr,
562
+ tsOutput: tsStdout || tsStderr,
554
563
  });
555
564
  }
556
565
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "description": "Directive CLI — npm install path for the Deft Directive framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,8 +42,8 @@
42
42
  "provenance": true
43
43
  },
44
44
  "dependencies": {
45
- "@deftai/directive-core": "^0.57.0",
46
- "@deftai/directive-content": "^0.57.0"
45
+ "@deftai/directive-core": "^0.58.0",
46
+ "@deftai/directive-content": "^0.58.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsc -b"