@hearsay-tools/squawk 0.18.0-dev.7065 → 0.18.0-dev.7085

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.18.0-dev.7065",
3
+ "version": "0.18.0-dev.7085",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -63,8 +63,8 @@
63
63
  "devDependencies": {
64
64
  "@babel/parser": "^8.0.8",
65
65
  "@babel/types": "^8.0.8",
66
- "@open-mercato/cezar-api-client": "0.18.0-dev.7065",
67
- "@open-mercato/cezar-contract": "0.18.0-dev.7065",
66
+ "@open-mercato/cezar-api-client": "0.18.0-dev.7085",
67
+ "@open-mercato/cezar-contract": "0.18.0-dev.7085",
68
68
  "@types/node": "^24.19.1",
69
69
  "@types/ws": "^8.18.1",
70
70
  "esbuild": "^0.28.1",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "a78d9e79e7e678099456e6f733b70f595edee09b"
84
+ "gitHead": "a25bc29e06e870f5b82dd452cc8de13ad5ec8c72"
85
85
  }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Records the wait-rule oracle (hearsay-tools/squawk#3774, slice 6b): what the text scanners of
3
+ * main a78d9e79e reported for every cell of `src/lint/wait-matrix-cells.testkit.ts`. The scanners
4
+ * are read from git at that commit, so this runs after they are deleted from the tree.
5
+ *
6
+ * node packages/cezar/scripts/record-wait-oracle.ts [--out <dir>]
7
+ *
8
+ * It writes `src/lint/wait-matrix.oracle.json`, or the same file under `--out`.
9
+ */
10
+ import { execFileSync } from 'node:child_process';
11
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
12
+ import { tmpdir } from 'node:os';
13
+ import { join, resolve } from 'node:path';
14
+ import { pathToFileURL } from 'node:url';
15
+ import { matrixCells, type Cell } from '../src/lint/wait-matrix-cells.testkit.ts';
16
+ import { encodeRows, digest, ORACLE_BASE } from '../src/lint/wait-matrix-oracle.testkit.ts';
17
+
18
+ interface Site { rule: string; line: number }
19
+ interface ServerScanner { scanFile(file: string, source: string): { sites: Site[]; errors: { line: number }[] } }
20
+ interface UnitScanner { scanSource(file: string, source: string): Site[] }
21
+
22
+ const packageDir = resolve(import.meta.dirname, '..');
23
+ const repo = resolve(packageDir, '../..');
24
+ const outIndex = process.argv.indexOf('--out');
25
+ const out = outIndex === -1 ? join(packageDir, 'src/lint') : resolve(process.argv[outIndex + 1] ?? '.');
26
+
27
+ /** The base commit's lint directory, extracted so its `.ts` imports resolve against each other. */
28
+ function baseScanners(): { dir: string; server: Promise<ServerScanner>; unit: Promise<UnitScanner> } {
29
+ const dir = mkdtempSync(join(tmpdir(), 'wait-oracle-'));
30
+ const archive = execFileSync('git', ['archive', ORACLE_BASE, 'packages/cezar/src/lint'], { cwd: repo, maxBuffer: 64 * 1024 * 1024 });
31
+ execFileSync('tar', ['-x', '-C', dir], { input: archive });
32
+ const lint = join(dir, 'packages/cezar/src/lint');
33
+ // The unit scanner resolves @babel/parser from the package's node_modules.
34
+ execFileSync('ln', ['-s', join(packageDir, 'node_modules'), join(dir, 'packages/cezar/node_modules')]);
35
+ return {
36
+ dir,
37
+ server: import(pathToFileURL(join(lint, 'test-wait-discipline.ts')).href) as Promise<ServerScanner>,
38
+ unit: import(pathToFileURL(join(lint, 'unit-wait-discipline.ts')).href) as Promise<UnitScanner>,
39
+ };
40
+ }
41
+
42
+ /** One cell's findings as the oracle keeps them: `rule@line`, in report order; `error@line` for a scan error; `throws` for a crash. */
43
+ export function recordCell(cell: Cell, server: ServerScanner, unit: UnitScanner): string[] {
44
+ if (cell.file.startsWith('packages/cezar/src/')) {
45
+ const { sites, errors } = server.scanFile(cell.file.slice('packages/cezar/src/'.length), cell.code);
46
+ return [...sites.map(site => `${site.rule}@${site.line}`), ...errors.map(error => `error@${error.line}`)];
47
+ }
48
+ try {
49
+ return unit.scanSource(cell.file.slice('packages/web/src/'.length), cell.code).map(site => `${site.rule}@${site.line}`);
50
+ } catch {
51
+ return ['throws'];
52
+ }
53
+ }
54
+
55
+ const scanners = baseScanners();
56
+ try {
57
+ const [server, unit] = await Promise.all([scanners.server, scanners.unit]);
58
+ mkdirSync(out, { recursive: true });
59
+ const profiles: Record<string, { cells: number; digest: string; rows: string }> = {};
60
+ for (const [profile, cells] of Object.entries(matrixCells())) {
61
+ const rows = cells.map(cell => recordCell(cell, server, unit));
62
+ profiles[profile] = { cells: cells.length, digest: digest(cells), rows: encodeRows(rows) };
63
+ console.log(`${profile}: ${cells.length} cells, ${rows.filter(row => row.length > 0).length} with findings`);
64
+ }
65
+ writeFileSync(join(out, 'wait-matrix.oracle.json'), `${JSON.stringify({ base: ORACLE_BASE, profiles }, null, 1)}\n`);
66
+ } finally {
67
+ rmSync(scanners.dir, { recursive: true, force: true });
68
+ }