@antelopejs/tooling-configs 0.7.3 → 0.7.5-next.356.g0d472b3

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 (48) hide show
  1. package/README.md +63 -80
  2. package/dist/bin/api-diff.mjs +29 -49
  3. package/dist/bin/capture.mjs +4 -4
  4. package/dist/bin/check-size.mjs +12 -3
  5. package/dist/bin/checks.mjs +2 -2
  6. package/dist/bin/comment-proof.mjs +3 -4
  7. package/dist/bin/garden.mjs +45 -170
  8. package/dist/bin/readme-strip.mjs +2 -2
  9. package/dist/bin/suppressions.mjs +212 -9
  10. package/dist/bin/sync.mjs +318 -210
  11. package/dist/bin/tsc.mjs +24 -0
  12. package/dist/bin/verify.mjs +91 -671
  13. package/dist/{checks-CSlWvky1.mjs → checks-C60vMFin.mjs} +155 -310
  14. package/dist/{docs-compat-BAZiPLZt.mjs → docs-compat-CdgBviGf.mjs} +2 -2
  15. package/dist/eslint.mjs +1 -1
  16. package/dist/{files-C-JJhExM.mjs → files-BbzJEk-L.mjs} +5 -4
  17. package/dist/formal/index.mjs +1 -1
  18. package/dist/{guardrails-nj7NTglr.mjs → guardrails-Dron1AbR.mjs} +67 -673
  19. package/dist/{installed-typescript-6MtIWlE4.mjs → installed-typescript-CF_FR9DV.mjs} +17 -17
  20. package/dist/{map-BYkmnvNw.mjs → map-CbNbypUa.mjs} +2 -2
  21. package/dist/oxc/anti-slop/index.mjs +22 -964
  22. package/dist/oxc/guardrails/index.d.mts +1 -1
  23. package/dist/oxc/guardrails/index.mjs +1 -1
  24. package/dist/oxc/lint.d.mts +2 -14
  25. package/dist/oxc/lint.mjs +3 -20
  26. package/dist/{package-DDG3YH7W.mjs → package-7oylgBeT.mjs} +6 -19
  27. package/dist/{workflow-C-oBwL2H.mjs → renovate-D0su_v9p.mjs} +191 -91
  28. package/dist/{suppression-budget-CPDSFg4X.mjs → suppression-budget-De9nUzlD.mjs} +33 -13
  29. package/dist/{suppressions-CxPnh4sC.mjs → suppressions-CfJwL0fN.mjs} +6 -2
  30. package/dist/{templates-HG0fel2S.mjs → templates-DLW0Ubfk.mjs} +26 -29
  31. package/dist/typescript-C7eU-cig.mjs +581 -0
  32. package/dist/typescript-version-CptQKjGz.mjs +18 -0
  33. package/dist/typescript6-BWqCcXGY.mjs +2 -0
  34. package/dist/typescript6-HdyOMBv3.mjs +8 -0
  35. package/dist/verify/index.d.mts +5 -24
  36. package/package.json +27 -7
  37. package/dist/bin/body-check.mjs +0 -350
  38. package/dist/bin/ratchet.d.mts +0 -1
  39. package/dist/bin/ratchet.mjs +0 -375
  40. package/dist/ceilings-B7KayYIG.mjs +0 -76
  41. package/dist/oxlint-CIeonWMB.mjs +0 -133
  42. package/dist/proof-stamp-BFV7JTZT.mjs +0 -342
  43. package/dist/ratchet-DLCfeaPY.mjs +0 -453
  44. package/dist/renames-L2owF5GD.mjs +0 -59
  45. package/dist/size-CCGLY4Ke.mjs +0 -18
  46. package/dist/suppression-base-CYaLZAq7.mjs +0 -120
  47. package/dist/typescript-QfxkJYzd.mjs +0 -292
  48. /package/dist/bin/{body-check.d.mts → tsc.d.mts} +0 -0
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as VERIFY_KINDS, c as isVerifyKind, l as skillFolder } from "../shared-BCFFyp3l.mjs";
3
+ import { t as typescript6_default } from "../typescript6-HdyOMBv3.mjs";
3
4
  import { a as isString, c as object, f as parseJson, i as isObject, n as children, p as str, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
4
5
  import { a as exitIs, c as interrupted, i as exists, r as equal, u as refused } from "../checks-CxkSu2E6.mjs";
5
6
  import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
6
- import { c as repositoryRoot } from "../files-C-JJhExM.mjs";
7
+ import { s as repositoryRoot } from "../files-BbzJEk-L.mjs";
7
8
  import { t as packSteps } from "../pack-tarball-Cn4zGKn7.mjs";
8
- import { C as pauseSync, S as writeWhole, _ as ownRun, a as readFeatures, b as saveRun, c as allocateRun, d as git, f as isolatedEnv, g as operatorTmpdir, h as operatorEnv, i as planFor, l as canonical, m as openWorkspace, n as SMOKE_FEATURE, o as CACHE_DIR, p as loadRun, r as checkMap, s as RUNS_DIR, u as commandRecords, v as recordProcesses, w as matchesPath, x as withLocalBins, y as removeTree } from "../map-BYkmnvNw.mjs";
9
+ import { C as matchesPath, S as pauseSync, _ as recordProcesses, a as readFeatures, b as withLocalBins, c as allocateRun, d as git, f as isolatedEnv, g as ownRun, h as operatorEnv, i as planFor, l as canonical, m as openWorkspace, n as SMOKE_FEATURE, o as CACHE_DIR, p as loadRun, r as checkMap, s as RUNS_DIR, u as commandRecords, v as removeTree, x as writeWhole, y as saveRun } from "../map-CbNbypUa.mjs";
9
10
  import { t as relativeSlashed } from "../slash-BEgSnfYw.mjs";
10
11
  import { n as launch, r as spawnLaunched, t as killTree } from "../launch-D5cylwvb.mjs";
11
12
  import { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, linkSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, symlinkSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";
12
- import { basename, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
13
- import { execFileSync, spawn, spawnSync } from "node:child_process";
13
+ import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
14
14
  import { pathToFileURL } from "node:url";
15
- import ts from "@typescript/typescript6";
15
+ import { execFileSync, spawn, spawnSync } from "node:child_process";
16
16
  import { createHash, randomBytes } from "node:crypto";
17
17
  import { availableParallelism, constants as constants$1 } from "node:os";
18
18
  import { parseArgs, stripVTControlCharacters } from "node:util";
@@ -75,388 +75,6 @@ function doorLine(doors) {
75
75
  return doors.length > 0 ? `One-way-door: ${doors.map((door) => door.kind).join(", ")}` : "";
76
76
  }
77
77
  //#endregion
78
- //#region src/verify/emit.ts
79
- const CODE_EXTENSIONS = /* @__PURE__ */ new Set([
80
- ".ts",
81
- ".mts",
82
- ".cts",
83
- ".tsx",
84
- ".js",
85
- ".mjs",
86
- ".cjs",
87
- ".jsx"
88
- ]);
89
- const OUTPUT_LIMIT$2 = 67108864;
90
- const TEXT_LENGTH = 160;
91
- function fileAt(repo, sha, path) {
92
- const shown = spawnSync("git", ["show", `${sha}:${path}`], {
93
- cwd: repo,
94
- encoding: "utf8",
95
- maxBuffer: OUTPUT_LIMIT$2
96
- });
97
- return shown.status === 0 ? shown.stdout : null;
98
- }
99
- const MODULE_EXTENSION = /\.(?:[cm]?[jt]s|[jt]sx)$/;
100
- function moduleKey(path, specifier) {
101
- if (!specifier.startsWith(".")) return specifier;
102
- return posix.join(dirname(path), specifier).replace(MODULE_EXTENSION, "");
103
- }
104
- function isPropertyName(node) {
105
- const parent = node.parent;
106
- return (ts.isPropertyAccessExpression(parent) || ts.isPropertyAssignment(parent) || ts.isMethodDeclaration(parent) || ts.isPropertyDeclaration(parent) || ts.isGetAccessor(parent) || ts.isSetAccessor(parent) || ts.isEnumMember(parent)) && parent.name === node;
107
- }
108
- /**
109
- * A binding is its name alone when that module declares it as a function
110
- * declaration no other covered file declares, which may move between covered
111
- * files, and `module#name` otherwise, so a variable or class of one file, or a
112
- * function of the same name in another, never reads as it.
113
- */
114
- function bindingOrigin(covered, module, name) {
115
- return covered.functions.get(module)?.has(name) && !covered.duplicated.has(name) ? name : `${module}#${name}`;
116
- }
117
- function importedBindings(clause, module, covered) {
118
- const named = clause.namedBindings;
119
- const bindings = [];
120
- if (clause.name) bindings.push([clause.name.text, bindingOrigin(covered, module, "default")]);
121
- if (named && ts.isNamespaceImport(named)) bindings.push([named.name.text, bindingOrigin(covered, module, "*")]);
122
- if (named && ts.isNamedImports(named)) for (const element of named.elements) bindings.push([element.name.text, bindingOrigin(covered, module, (element.propertyName ?? element.name).text)]);
123
- return bindings;
124
- }
125
- function reexportTexts(statement, module, covered) {
126
- const exported = statement.exportClause;
127
- if (exported === void 0) return [`export * from ${module}`];
128
- if (ts.isNamespaceExport(exported)) return [`export * as ${exported.name.text} from ${module}`];
129
- return exported.elements.flatMap((element) => {
130
- const origin = bindingOrigin(covered, module, (element.propertyName ?? element.name).text);
131
- return origin === element.name.text ? [] : [`export ${origin} as ${element.name.text}`];
132
- });
133
- }
134
- /**
135
- * The exports of a file that name a local or imported binding, keyed by the
136
- * origin of what they export. An export under its own name of a local needs no
137
- * entry, the same as an `export` keyword, so only a renamed local and any
138
- * imported binding does.
139
- */
140
- function localExportTexts(statement, bindings, locals) {
141
- const exported = statement.exportClause;
142
- if (exported === void 0 || !ts.isNamedExports(exported)) return [];
143
- return exported.elements.flatMap((element) => {
144
- const name = (element.propertyName ?? element.name).text;
145
- const imported = bindings.get(name);
146
- const origin = imported ?? locals.get(name) ?? name;
147
- return imported === void 0 && name === element.name.text || origin === element.name.text ? [] : [`export ${origin} as ${element.name.text}`];
148
- });
149
- }
150
- /**
151
- * Where each value-imported binding of a file comes from: the resolved
152
- * module and the imported name, so an alias or a swapped specifier changes
153
- * what a use refers to. A binding from a covered module is its name alone
154
- * when it is a function declaration, so moving the declaration between
155
- * covered files keeps every use the same; any other binding is keyed by its
156
- * module. A side-effect import keeps its order in the file relative to the binding imports before it, and `export *` is an entry like any re-export. Re-exports and
157
- * renamed or imported exports become entries keyed by the origin they export.
158
- */
159
- function originsOf(path, covered, file, locals) {
160
- const bindings = /* @__PURE__ */ new Map();
161
- const texts = [];
162
- const ordered = [];
163
- const earlier = [];
164
- const exports = [];
165
- for (const statement of file.statements) {
166
- if (!(ts.isImportDeclaration(statement) || ts.isExportDeclaration(statement))) continue;
167
- const specifier = statement.moduleSpecifier;
168
- if (specifier === void 0 && ts.isExportDeclaration(statement)) exports.push(statement);
169
- if (specifier === void 0 || !ts.isStringLiteral(specifier)) continue;
170
- const module = moduleKey(path, specifier.text);
171
- if (ts.isImportDeclaration(statement)) {
172
- if (statement.importClause === void 0) {
173
- ordered.push(`import ${module} after ${earlier.join(",")}`);
174
- continue;
175
- }
176
- earlier.push(module);
177
- for (const [name, origin] of importedBindings(statement.importClause, module, covered)) bindings.set(name, origin);
178
- } else texts.push(...reexportTexts(statement, module, covered));
179
- }
180
- for (const statement of exports) texts.push(...localExportTexts(statement, bindings, locals));
181
- const item = (text, hoisted) => ({
182
- structure: text,
183
- text,
184
- hoisted
185
- });
186
- return {
187
- bindings,
188
- entries: texts.map((text) => item(text, true)),
189
- ordered: ordered.map((text) => item(text, false))
190
- };
191
- }
192
- function leafOf(node, bindings) {
193
- if (ts.isIdentifier(node)) return isPropertyName(node) ? node.text : bindings.get(node.text) ?? node.text;
194
- if (ts.isPrivateIdentifier(node)) return node.text;
195
- if (ts.isNumericLiteral(node)) return String(Number(node.text));
196
- if (ts.isStringLiteralLike(node) || ts.isTemplateLiteralToken(node)) return JSON.stringify(node.text);
197
- if (ts.isBigIntLiteral(node) || ts.isRegularExpressionLiteral(node)) return node.text;
198
- if (ts.isPrefixUnaryExpression(node) || ts.isPostfixUnaryExpression(node)) return ts.SyntaxKind[node.operator];
199
- if (ts.isVariableDeclarationList(node)) return String(node.flags & (ts.NodeFlags.Let | ts.NodeFlags.Const));
200
- if (ts.isMetaProperty(node)) return ts.SyntaxKind[node.keywordToken];
201
- return "";
202
- }
203
- function dropped(node) {
204
- return node.kind === ts.SyntaxKind.ExportKeyword || node.kind === ts.SyntaxKind.DefaultKeyword;
205
- }
206
- /**
207
- * The structure of a node: its kind, its identifier name or literal value,
208
- * and its children's structure, with parentheses, positions, trivia, quote
209
- * style and line breaks left out, so formatting never changes it. An
210
- * imported binding stands for its origin.
211
- */
212
- function structureOf(node, bindings) {
213
- if (ts.isParenthesizedExpression(node)) return structureOf(node.expression, bindings);
214
- const children = [];
215
- ts.forEachChild(node, (child) => {
216
- if (!dropped(child)) children.push(structureOf(child, bindings));
217
- });
218
- return `${ts.SyntaxKind[node.kind]}(${leafOf(node, bindings)}|${children.join(",")})`;
219
- }
220
- function readable(text) {
221
- const flat = text.replace(/\s+/g, " ").trim();
222
- return flat.length > TEXT_LENGTH ? `${flat.slice(0, TEXT_LENGTH)}…` : flat;
223
- }
224
- function parseScript(path, source) {
225
- const { outputText } = ts.transpileModule(source, {
226
- fileName: path,
227
- compilerOptions: {
228
- target: ts.ScriptTarget.ES2022,
229
- module: ts.ModuleKind.ESNext,
230
- removeComments: true,
231
- experimentalDecorators: true
232
- }
233
- });
234
- return {
235
- path,
236
- file: ts.createSourceFile("emit.js", outputText, ts.ScriptTarget.ES2022, true, ts.ScriptKind.JS)
237
- };
238
- }
239
- function declaredNames$1(name) {
240
- return ts.isIdentifier(name) ? [name.text] : name.elements.flatMap((element) => ts.isOmittedExpression(element) ? [] : declaredNames$1(element.name));
241
- }
242
- function isFunctionDeclaration(statement) {
243
- return ts.isFunctionDeclaration(statement) && Boolean(statement.body) && statement.name !== void 0;
244
- }
245
- /** The top-level variables, classes and enums of a script, and its functions that another covered file also declares, each keyed by its file and name: what a function moved into another file must not pick up by name. */
246
- function localsOf(script, covered) {
247
- const file = script.path.replace(MODULE_EXTENSION, "");
248
- const names = script.file.statements.flatMap((statement) => {
249
- if (ts.isVariableStatement(statement)) return statement.declarationList.declarations.flatMap((declaration) => declaredNames$1(declaration.name));
250
- return (ts.isClassDeclaration(statement) || ts.isEnumDeclaration(statement)) && statement.name ? [statement.name.text] : [];
251
- });
252
- const clashing = [...covered.functions.get(file) ?? []].filter((name) => covered.duplicated.has(name));
253
- return new Map([...names, ...clashing].map((name) => [name, `${file}#${name}`]));
254
- }
255
- function scriptItems(script, covered) {
256
- const locals = localsOf(script, covered);
257
- const origins = originsOf(script.path, covered, script.file, locals);
258
- const inFunctions = new Map([...locals, ...origins.bindings]);
259
- const statements = script.file.statements.filter((statement) => !ts.isImportDeclaration(statement) && !ts.isExportDeclaration(statement)).map((statement) => {
260
- const hoisted = ts.isFunctionDeclaration(statement) && Boolean(statement.body);
261
- return {
262
- structure: structureOf(statement, hoisted ? inFunctions : origins.bindings),
263
- text: readable(statement.getText(script.file)),
264
- hoisted
265
- };
266
- });
267
- return [
268
- ...origins.entries,
269
- ...origins.ordered,
270
- ...statements
271
- ];
272
- }
273
- function parsedFile(path, source) {
274
- if (path.endsWith(".vue")) {
275
- const template = /<template\b[^>]*>([\s\S]*)<\/template>/.exec(source);
276
- const markup = template ? template[1].replace(/\s+/g, " ").trim() : null;
277
- return {
278
- path,
279
- scripts: [...source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/g)].map(([, body]) => parseScript(`${path}.ts`, body)),
280
- others: markup === null ? [] : [{
281
- structure: `template(${markup})`,
282
- text: readable(`<template> ${markup}`),
283
- hoisted: false
284
- }]
285
- };
286
- }
287
- if (CODE_EXTENSIONS.has(extname(path))) return {
288
- path,
289
- scripts: [parseScript(path, source)],
290
- others: []
291
- };
292
- const flat = source.replace(/\s+/g, " ").trim();
293
- return {
294
- path,
295
- scripts: [],
296
- others: [{
297
- structure: `file(${flat})`,
298
- text: readable(flat),
299
- hoisted: false
300
- }]
301
- };
302
- }
303
- /**
304
- * What the covered code does at a commit, as structure rather than text:
305
- * each covered file's top-level statements and side-effect imports in order,
306
- * and, apart, the function declarations and exports keyed by origin of every
307
- * covered file, which hoisting lets move freely. Each use of an imported
308
- * binding stands for its origin (resolved module and imported name), and a
309
- * function declaration refers to the top-level variables and classes of its
310
- * own file by file and name, so retargeting an import, an alias or an export,
311
- * or moving a function next to a different variable of the same name, changes
312
- * the fingerprint. Types, comments, formatting and export keywords are left
313
- * out, so a type-only edit, a reformat, or moving a function declaration to
314
- * another covered file keeps the same fingerprint, while reordering or moving
315
- * any other statement changes it.
316
- */
317
- function emitFingerprint(repo, sha, files) {
318
- const fingerprint = {
319
- functions: [],
320
- files: {}
321
- };
322
- const parsed = files.flatMap((path) => {
323
- const source = fileAt(repo, sha, path);
324
- return source === null ? [] : [parsedFile(path, source)];
325
- });
326
- const functions = new Map(parsed.map(({ path, scripts }) => [path.replace(MODULE_EXTENSION, ""), new Set(scripts.flatMap(({ file }) => file.statements.filter(isFunctionDeclaration).map(({ name }) => name.text)))]));
327
- const declarations = [...functions.values()].flatMap((names) => [...names]);
328
- const covered = {
329
- modules: new Set(files.map((path) => path.replace(MODULE_EXTENSION, ""))),
330
- functions,
331
- duplicated: new Set(declarations.filter((name, index) => declarations.indexOf(name) !== index))
332
- };
333
- for (const { path, scripts, others } of parsed) {
334
- const items = [...scripts.flatMap((script) => scriptItems(script, covered)), ...others];
335
- fingerprint.functions.push(...items.filter((item) => item.hoisted));
336
- fingerprint.files[path] = items.filter((item) => !item.hoisted);
337
- }
338
- return fingerprint;
339
- }
340
- //#endregion
341
- //#region src/verify/behaviour.ts
342
- const DETAIL_LIMIT = 5;
343
- const DETAIL_LENGTH = 160;
344
- const OUTPUT_LIMIT$1 = 67108864;
345
- /** Runs `action` in a throwaway worktree of `sha` whose `node_modules` links the checkout's, then removes it. */
346
- function inWorktree(repo, sha, action) {
347
- const dir = mkdtempSync(join(operatorTmpdir(), "antelopejs-verify-behaviour-"));
348
- git(repo, [
349
- "worktree",
350
- "add",
351
- "--quiet",
352
- "--detach",
353
- "--force",
354
- dir,
355
- sha
356
- ]);
357
- try {
358
- symlinkSync(join(repo, "node_modules"), join(dir, "node_modules"), "dir");
359
- return action(dir);
360
- } finally {
361
- git(repo, [
362
- "worktree",
363
- "remove",
364
- "--force",
365
- dir
366
- ]);
367
- rmSync(dir, {
368
- recursive: true,
369
- force: true
370
- });
371
- }
372
- }
373
- function probeFingerprint(repo, command, sha) {
374
- const [program, ...args] = command;
375
- return inWorktree(repo, sha, (dir) => {
376
- const run = spawnLaunched(program, [...args, dir], {
377
- cwd: repo,
378
- env: operatorEnv(),
379
- encoding: "utf8",
380
- maxBuffer: OUTPUT_LIMIT$1
381
- });
382
- if (run.status !== 0) throw new Error(`behaviour probe ${command.join(" ")} failed on ${sha}:\n${run.stderr}`);
383
- return run.stdout.split("\n").filter(Boolean);
384
- });
385
- }
386
- function difference(left, right, key) {
387
- const counts = /* @__PURE__ */ new Map();
388
- for (const item of right) counts.set(key(item), (counts.get(key(item)) ?? 0) + 1);
389
- return left.filter((item) => {
390
- const count = counts.get(key(item)) ?? 0;
391
- if (count === 0) return true;
392
- counts.set(key(item), count - 1);
393
- return false;
394
- });
395
- }
396
- function sample(lines) {
397
- return lines.slice(0, DETAIL_LIMIT).map((line) => line.length > DETAIL_LENGTH ? `${line.slice(0, DETAIL_LENGTH)}…` : line);
398
- }
399
- function sequenceChanges(path, base, head) {
400
- const length = Math.max(base.length, head.length);
401
- for (let index = 0; index < length; index += 1) if (base[index]?.structure !== head[index]?.structure) return {
402
- removed: [`${path} statement ${index + 1}: ${base[index]?.text ?? "(none)"}`],
403
- added: [`${path} statement ${index + 1}: ${head[index]?.text ?? "(none)"}`]
404
- };
405
- return {
406
- removed: [],
407
- added: []
408
- };
409
- }
410
- function compareEmit(base, head) {
411
- const structure = (item) => item.structure;
412
- const removed = difference(base.functions, head.functions, structure).map((item) => `hoisted ${item.text}`);
413
- const added = difference(head.functions, base.functions, structure).map((item) => `hoisted ${item.text}`);
414
- for (const path of /* @__PURE__ */ new Set([...Object.keys(base.files), ...Object.keys(head.files)])) {
415
- const change = sequenceChanges(path, base.files[path] ?? [], head.files[path] ?? []);
416
- removed.push(...change.removed);
417
- added.push(...change.added);
418
- }
419
- return {
420
- removed,
421
- added
422
- };
423
- }
424
- function compareProbe(base, head) {
425
- if (JSON.stringify(base) === JSON.stringify(head)) return {
426
- removed: [],
427
- added: []
428
- };
429
- const line = (item) => item;
430
- const removed = difference(base, head, line);
431
- const added = difference(head, base, line);
432
- return removed.length + added.length > 0 ? {
433
- removed,
434
- added
435
- } : {
436
- removed: ["(order)"],
437
- added: ["(order)"]
438
- };
439
- }
440
- /**
441
- * Whether a diff changed the behaviour of the code a formal check covers,
442
- * decided without judgement. For `emit` (the default), each covered file
443
- * keeps its top-level statements, in order, with the same structure, and the
444
- * covered function declarations stay the same wherever they live; for
445
- * `probe`, the check's probe prints the same lines on a checkout of the base
446
- * and of HEAD. The check's own output never enters the decision, so a model
447
- * that cannot see the code still gates it.
448
- */
449
- function behaviourChange(repo, check, commits) {
450
- const probe = check.behaviour?.kind === "probe" ? check.behaviour.command : void 0;
451
- const change = probe === void 0 ? compareEmit(emitFingerprint(repo, commits.baseSha, check.covers), emitFingerprint(repo, commits.headSha, check.covers)) : compareProbe(probeFingerprint(repo, probe, commits.baseSha), probeFingerprint(repo, probe, commits.headSha));
452
- return {
453
- method: probe === void 0 ? "emit" : `probe ${probe.join(" ")}`,
454
- changed: change.removed.length + change.added.length > 0,
455
- removed: sample(change.removed),
456
- added: sample(change.added)
457
- };
458
- }
459
- //#endregion
460
78
  //#region src/verify/timing.ts
461
79
  /** Starts a clock; the returned function gives the whole milliseconds elapsed since. */
462
80
  function stopwatch() {
@@ -525,33 +143,6 @@ function violatedRules(check, exitCode, output) {
525
143
  if (check.violation) return [...new Set([...output.matchAll(check.violation)].map((match) => match[1]))];
526
144
  return exitCode === 0 ? [] : ["property"];
527
145
  }
528
- function passingRules(check, exitCode, output) {
529
- if (check.passing) return [...new Set([...output.matchAll(check.passing)].map((match) => match[1]))];
530
- return !check.violation && exitCode === 0 ? ["property"] : [];
531
- }
532
- function withIndices(pattern) {
533
- return pattern.hasIndices ? pattern : new RegExp(pattern.source, `${pattern.flags}d`);
534
- }
535
- function counterexampleLengths(check, output) {
536
- if (!check.violation) return {};
537
- const seen = /* @__PURE__ */ new Map();
538
- for (const match of output.matchAll(withIndices(check.violation))) {
539
- const states = match.groups?.states;
540
- const rule = match[1];
541
- const statesIsRule = match.indices?.[1]?.[0] === match.indices?.groups?.states?.[0];
542
- const length = states === void 0 || !/^\d+$/.test(states) || statesIsRule ? null : Number(states);
543
- seen.set(rule, seen.has(rule) && seen.get(rule) !== length ? null : length);
544
- }
545
- return Object.fromEntries([...seen].filter((entry) => entry[1] !== null && Number.isSafeInteger(entry[1])));
546
- }
547
- function rulesOf(check, run) {
548
- return {
549
- exitCode: run.status,
550
- violated: violatedRules(check, run.status, run.stdout ?? ""),
551
- passing: passingRules(check, run.status, run.stdout ?? ""),
552
- lengths: counterexampleLengths(check, run.stdout ?? "")
553
- };
554
- }
555
146
  function runCommand(command, cwd) {
556
147
  const [program, ...args] = command;
557
148
  return spawnLaunched(program, args, {
@@ -561,209 +152,45 @@ function runCommand(command, cwd) {
561
152
  maxBuffer: OUTPUT_LIMIT
562
153
  });
563
154
  }
564
- function writeRun(folder, prefix, command, run) {
565
- writeFileSync(join(folder, `${prefix}command.txt`), `${command.join(" ")}\n`);
566
- writeFileSync(join(folder, `${prefix}stdout.txt`), run.stdout ?? "");
567
- writeFileSync(join(folder, `${prefix}stderr.txt`), `${run.stderr ?? ""}${run.error ? `\n${run.error.message}\n` : ""}`);
568
- writeFileSync(join(folder, `${prefix}exit-code.txt`), `${run.status}\n`);
569
- }
570
- function baseRun(workspace, check, baseSha, folder) {
571
- const command = check.baseCommand ?? check.command;
572
- const run = inWorktree(workspace.root, baseSha, (dir) => runCommand(command, dir));
573
- writeRun(folder, "base-", command, run);
574
- return rulesOf(check, run);
575
- }
576
- function gitOutput(root, args) {
577
- const run = spawnSync("git", args, {
578
- cwd: root,
579
- encoding: "utf8",
580
- maxBuffer: OUTPUT_LIMIT
581
- });
582
- return run.status === 0 ? run.stdout : null;
583
- }
584
- function namedOnBase(workspace, check, baseSha) {
585
- const config = relativeSlashed(workspace.root, join(workspace.skill, "verify.config.ts"));
586
- const text = gitOutput(workspace.root, ["show", `${baseSha}:${config}`]);
587
- if (text === null) return false;
588
- return [
589
- "\"",
590
- "'",
591
- "`"
592
- ].some((quote) => text.includes(`${quote}${check.name}${quote}`));
593
- }
594
- function renamedFromBase(root, check, diff) {
595
- const fields = (gitOutput(root, [
596
- "diff",
597
- "-M",
598
- "--name-status",
599
- "-z",
600
- diff.baseSha,
601
- diff.headSha
602
- ]) ?? "").split("\0");
603
- return fields.some((field, index) => field.startsWith("R") && (check.files ?? []).some((glob) => matchesPath(fields[index + 2] ?? "", glob)));
604
- }
605
- /**
606
- * Whether the diff adds the check: the base could not run it, its name
607
- * appears nowhere in the base's verify.config.ts, and no file of its own
608
- * `files` is a rename of a base file. A moved or renamed check, or one whose
609
- * base ran, is a changed check, gated against the base.
610
- */
611
- function addedByDiff(workspace, check, diff, base) {
612
- return base.exitCode !== 0 && !namedOnBase(workspace, check, diff.baseSha) && !renamedFromBase(workspace.root, check, diff);
613
- }
614
- function gateFields(workspace, check, diff, folder, head) {
615
- const behaviour = behaviourChange(workspace.root, check, diff);
616
- const checkChanged = changesCheckFiles(check, diff.changed);
617
- if (!behaviour.changed && !checkChanged) return {
618
- behaviour,
619
- checkChanged,
620
- base: null,
621
- fixed: [],
622
- missing: []
623
- };
624
- const base = baseRun(workspace, check, diff.baseSha, folder);
625
- const atHead = /* @__PURE__ */ new Set([...head.violated, ...head.passing]);
626
- return {
627
- behaviour,
628
- checkChanged,
629
- newCheck: checkChanged && addedByDiff(workspace, check, diff, base),
630
- base,
631
- fixed: base.violated.filter((rule) => head.passing.includes(rule) && !head.violated.includes(rule)),
632
- missing: base.violated.filter((rule) => !atHead.has(rule))
633
- };
155
+ function writeRun(folder, command, run) {
156
+ writeFileSync(join(folder, "command.txt"), `${command.join(" ")}\n`);
157
+ writeFileSync(join(folder, "stdout.txt"), run.stdout ?? "");
158
+ writeFileSync(join(folder, "stderr.txt"), `${run.stderr ?? ""}${run.error ? `\n${run.error.message}\n` : ""}`);
159
+ writeFileSync(join(folder, "exit-code.txt"), `${run.status}\n`);
634
160
  }
635
161
  /**
636
162
  * Runs one formal check from the repository root and writes its command,
637
- * output, exit code, violated rules and their counterexample lengths under
638
- * `evidence/formal/<name>/`.
639
- * When the check covers the diff (`diff` given), it also records whether the
640
- * diff changed the covered code's behaviour. When it did, or when the diff
641
- * changed the check's own `files`, it runs the check on the base: `fixed`
642
- * lists the rules the base broke that HEAD reports passing, and `missing`
643
- * the rules the base broke that HEAD reports neither failing nor passing.
163
+ * output, exit code and violated rules under `evidence/formal/<name>/`.
644
164
  */
645
- function runFormalCheck(workspace, state, check, diff) {
165
+ function runFormalCheck(workspace, state, check) {
646
166
  const elapsed = stopwatch();
647
167
  const folder = join(state.evidence, "formal", check.name);
648
168
  mkdirSync(folder, { recursive: true });
649
169
  const run = runCommand(check.command, workspace.root);
650
- writeRun(folder, "", check.command, run);
651
- const head = rulesOf(check, run);
170
+ writeRun(folder, check.command, run);
652
171
  const result = {
653
172
  name: check.name,
654
173
  exitCode: run.status,
655
- violated: head.violated,
656
- passing: head.passing,
657
- lengths: head.lengths,
658
- folder: relativeSlashed(state.evidence, folder)
174
+ violated: violatedRules(check, run.status, run.stdout ?? ""),
175
+ folder: relativeSlashed(state.evidence, folder),
176
+ ms: elapsed()
659
177
  };
660
- if (diff !== null) Object.assign(result, { commits: {
661
- baseSha: diff.baseSha,
662
- headSha: diff.headSha
663
- } }, gateFields(workspace, check, diff, folder, head));
664
- result.ms = elapsed();
665
178
  writeFileSync(join(folder, "result.json"), `${JSON.stringify(result, null, 2)}\n`);
666
179
  return result;
667
180
  }
668
- function lengthOf(lengths, rule) {
669
- return lengths !== void 0 && Object.hasOwn(lengths, rule) ? lengths[rule] : void 0;
670
- }
671
- function knownFindingsOfBase(result) {
672
- const { base } = result;
673
- if (!base || base.exitCode !== 0) return false;
674
- const atHead = new Set(result.violated);
675
- const fixed = new Set(result.fixed ?? []);
676
- return base.violated.every((rule) => atHead.has(rule) || fixed.has(rule)) && result.violated.every((rule) => {
677
- const length = lengthOf(result.lengths, rule);
678
- return base.violated.includes(rule) && length !== void 0 && length === lengthOf(base.lengths, rule);
679
- });
680
- }
681
- /**
682
- * The outcome a result's base run forces before the findings are weighed: a
683
- * check the diff adds, on a diff that leaves the covered behaviour unchanged,
684
- * passes its recorded findings, since its record is reviewed with it and the
685
- * base has nothing to compare, and fails with the advice to land it alone when
686
- * the covered code changed too; otherwise a failure
687
- * for a changed check with no base run recorded, a base run that exited non-zero
688
- * while HEAD breaks rules, or, when the covered behaviour is unchanged, a rule
689
- * HEAD breaks that the base did not. `null` when the base decides nothing.
690
- */
691
- function baseGate(result) {
692
- const { base, behaviour } = result;
693
- if (result.newCheck === true && base && base.exitCode !== 0 && behaviour?.changed === false) return {
694
- fails: false,
695
- outcome: `new check, absent from the base: ${result.violated.length > 0 ? `recorded findings ${result.violated.join(", ")}` : "no violated rule"}`
696
- };
697
- if (result.newCheck === true && behaviour?.changed === true && result.violated.length > 0) return {
698
- fails: true,
699
- outcome: "new check with a covered-code change: land the check in its own PR first"
181
+ /** Reads a recorded result as HOLDS, VIOLATED or ERROR. */
182
+ function formalOutcome(result) {
183
+ if (result.violated.length > 0) return {
184
+ status: "VIOLATED",
185
+ outcome: `violated ${result.violated.join(", ")} (exit ${result.exitCode})`
700
186
  };
701
- if (result.checkChanged === true && !base) return {
702
- fails: true,
703
- outcome: "the check's own files changed but no base run was recorded"
704
- };
705
- if (!base) return null;
706
- if (base.exitCode !== 0 && result.violated.length > 0) return {
707
- fails: true,
708
- outcome: `the base run exited ${base.exitCode}, so ${result.violated.join(", ")} cannot be compared with the base`
709
- };
710
- const added = result.violated.filter((rule) => !base.violated.includes(rule));
711
- if (behaviour?.changed === false && added.length > 0) return {
712
- fails: true,
713
- outcome: `covered behaviour unchanged (${behaviour.method}), but the check breaks rules the base did not: ${added.join(", ")}`
714
- };
715
- return null;
716
- }
717
- /**
718
- * How a formal check's result weighs on a verdict whose diff it covers. A
719
- * non-zero exit (a tool error, or a check that no longer matches its record)
720
- * fails, so every violated rule of a result that reaches the rest of the gate
721
- * is a recorded finding. A rule the base broke that HEAD does not report at
722
- * all fails. A base run that exited non-zero cannot vouch for HEAD's findings,
723
- * and a changed check with no base run recorded fails. A check the diff adds
724
- * (the base could not run it, never names it and holds none of its files
725
- * under another path) passes its recorded findings when the covered
726
- * behaviour is unchanged. Otherwise, when the covered behaviour is unchanged,
727
- * recorded findings are known, except a rule HEAD breaks that the base run
728
- * did not, which fails whatever the diff touched. When the behaviour
729
- * changed, they are known only when the base run exited 0 and broke every
730
- * one of them, each with the same counterexample length at HEAD as on the
731
- * base, and every other rule the base broke is fixed at HEAD; a new rule, a
732
- * changed length, or a length either run did not report fails. A rule the
733
- * base broke and HEAD reports passing is reported as fixed.
734
- */
735
- function formalGate(result) {
736
187
  if (result.exitCode !== 0) return {
737
- fails: true,
738
- outcome: `${result.violated.length > 0 ? `the check no longer matches its record: ${result.violated.join(", ")}` : "tool error"}, exit ${result.exitCode}`
739
- };
740
- if ((result.missing ?? []).length > 0) return {
741
- fails: true,
742
- outcome: `rules the base broke are absent at HEAD: ${(result.missing ?? []).join(", ")}`
743
- };
744
- if (result.behaviour === void 0) return {
745
- fails: result.violated.length > 0,
746
- outcome: `violated ${result.violated.join(", ") || "nothing"}`
747
- };
748
- const how = result.behaviour.method;
749
- const againstBase = baseGate(result);
750
- if (againstBase) return againstBase;
751
- if (!result.behaviour.changed) return {
752
- fails: false,
753
- outcome: `covered behaviour unchanged (${how}): ${result.violated.length > 0 ? `known findings ${result.violated.join(", ")}` : "no violated rule"}`
754
- };
755
- const fixed = (result.fixed ?? []).length > 0 ? `; fixed: ${(result.fixed ?? []).join(", ")}` : "";
756
- if (result.violated.length === 0) return {
757
- fails: false,
758
- outcome: `covered behaviour changed (${how}), no violated rule${fixed}`
759
- };
760
- if (knownFindingsOfBase(result)) return {
761
- fails: false,
762
- outcome: `covered behaviour changed (${how}), same known findings as base: ${result.violated.join(", ")}${fixed}`
188
+ status: "ERROR",
189
+ outcome: `tool error (exit ${result.exitCode})`
763
190
  };
764
191
  return {
765
- fails: true,
766
- outcome: `covered behaviour changed (${how}), violated ${result.violated.join(", ")}${fixed}`
192
+ status: "HOLDS",
193
+ outcome: "no violated rule (exit 0)"
767
194
  };
768
195
  }
769
196
  /** The recorded result of a formal check in a run, if it ran. */
@@ -1772,40 +1199,40 @@ function ajsEntry(root) {
1772
1199
  }
1773
1200
  //#endregion
1774
1201
  //#region src/verify/surface-types.ts
1775
- const NAMED = ts.SymbolFlags.Interface | ts.SymbolFlags.Class | ts.SymbolFlags.Enum | ts.SymbolFlags.TypeAlias;
1776
- const MODULE = ts.SymbolFlags.ValueModule | ts.SymbolFlags.NamespaceModule;
1777
- const INHERITING = ts.SymbolFlags.Class | ts.SymbolFlags.Interface;
1202
+ const NAMED = typescript6_default.SymbolFlags.Interface | typescript6_default.SymbolFlags.Class | typescript6_default.SymbolFlags.Enum | typescript6_default.SymbolFlags.TypeAlias;
1203
+ const MODULE = typescript6_default.SymbolFlags.ValueModule | typescript6_default.SymbolFlags.NamespaceModule;
1204
+ const INHERITING = typescript6_default.SymbolFlags.Class | typescript6_default.SymbolFlags.Interface;
1778
1205
  function isObjectType$1(type) {
1779
- return (type.flags & ts.TypeFlags.Object) !== 0;
1206
+ return (type.flags & typescript6_default.TypeFlags.Object) !== 0;
1780
1207
  }
1781
1208
  function isReference(type) {
1782
- return (type.objectFlags & ts.ObjectFlags.Reference) !== 0;
1209
+ return (type.objectFlags & typescript6_default.ObjectFlags.Reference) !== 0;
1783
1210
  }
1784
1211
  function isPublicMember(member) {
1785
- const hidden = ts.ModifierFlags.Private | ts.ModifierFlags.Protected;
1786
- return (ts.getCombinedModifierFlags(member) & hidden) === 0 && !(member.name !== void 0 && ts.isPrivateIdentifier(member.name));
1212
+ const hidden = typescript6_default.ModifierFlags.Private | typescript6_default.ModifierFlags.Protected;
1213
+ return (typescript6_default.getCombinedModifierFlags(member) & hidden) === 0 && !(member.name !== void 0 && typescript6_default.isPrivateIdentifier(member.name));
1787
1214
  }
1788
1215
  /** A class declaration reduced to the members a consumer can reach; any other declaration as it is. */
1789
1216
  function publicPart(declaration) {
1790
- if (!ts.isClassDeclaration(declaration)) return declaration;
1791
- return ts.factory.updateClassDeclaration(declaration, declaration.modifiers, declaration.name, declaration.typeParameters, declaration.heritageClauses, declaration.members.filter(isPublicMember));
1217
+ if (!typescript6_default.isClassDeclaration(declaration)) return declaration;
1218
+ return typescript6_default.factory.updateClassDeclaration(declaration, declaration.modifiers, declaration.name, declaration.typeParameters, declaration.heritageClauses, declaration.members.filter(isPublicMember));
1792
1219
  }
1793
1220
  /** Whether a heritage expression is a name such as `Base` or `ns.Base`, rather than a call. */
1794
1221
  function isEntityName(expression) {
1795
- return ts.isIdentifier(expression) || ts.isPropertyAccessExpression(expression) && isEntityName(expression.expression);
1222
+ return typescript6_default.isIdentifier(expression) || typescript6_default.isPropertyAccessExpression(expression) && isEntityName(expression.expression);
1796
1223
  }
1797
1224
  /** The name a written type reference resolves through, when the node is one. */
1798
1225
  function referencedName(node) {
1799
- if (ts.isTypeReferenceNode(node)) return node.typeName;
1800
- if (ts.isExpressionWithTypeArguments(node) && isEntityName(node.expression)) return node.expression;
1801
- if (ts.isTypeQueryNode(node)) return node.exprName;
1802
- if (!ts.isImportTypeNode(node)) return void 0;
1226
+ if (typescript6_default.isTypeReferenceNode(node)) return node.typeName;
1227
+ if (typescript6_default.isExpressionWithTypeArguments(node) && isEntityName(node.expression)) return node.expression;
1228
+ if (typescript6_default.isTypeQueryNode(node)) return node.exprName;
1229
+ if (!typescript6_default.isImportTypeNode(node)) return void 0;
1803
1230
  if (node.qualifier) return node.qualifier;
1804
- return ts.isLiteralTypeNode(node.argument) ? node.argument.literal : void 0;
1231
+ return typescript6_default.isLiteralTypeNode(node.argument) ? node.argument.literal : void 0;
1805
1232
  }
1806
1233
  /** Whether reading the declaration would read a whole module rather than one declaration. */
1807
1234
  function isModuleBody(declaration) {
1808
- return ts.isSourceFile(declaration) || ts.isModuleDeclaration(declaration);
1235
+ return typescript6_default.isSourceFile(declaration) || typescript6_default.isModuleDeclaration(declaration);
1809
1236
  }
1810
1237
  /**
1811
1238
  * Collects the package's declarations a function reaches. The written text of
@@ -1823,7 +1250,7 @@ var DeclarationWalk = class {
1823
1250
  seen = /* @__PURE__ */ new Set();
1824
1251
  unread = [];
1825
1252
  types = [];
1826
- printer = ts.createPrinter({ removeComments: true });
1253
+ printer = typescript6_default.createPrinter({ removeComments: true });
1827
1254
  checker;
1828
1255
  isLocalFile;
1829
1256
  constructor(checker, isLocalFile) {
@@ -1858,11 +1285,11 @@ var DeclarationWalk = class {
1858
1285
  return this.local(symbol).length > 0;
1859
1286
  }
1860
1287
  resolve(symbol) {
1861
- return symbol.flags & ts.SymbolFlags.Alias ? this.checker.getAliasedSymbol(symbol) : symbol;
1288
+ return symbol.flags & typescript6_default.SymbolFlags.Alias ? this.checker.getAliasedSymbol(symbol) : symbol;
1862
1289
  }
1863
1290
  record(symbol) {
1864
1291
  if ((symbol.flags & NAMED) === 0) return;
1865
- const texts = this.local(symbol).map((declaration) => this.printer.printNode(ts.EmitHint.Unspecified, publicPart(declaration), declaration.getSourceFile()).replace(/\s+/g, " ").replace(/^(?:export )?(?:declare )?/, ""));
1292
+ const texts = this.local(symbol).map((declaration) => this.printer.printNode(typescript6_default.EmitHint.Unspecified, publicPart(declaration), declaration.getSourceFile()).replace(/\s+/g, " ").replace(/^(?:export )?(?:declare )?/, ""));
1866
1293
  this.declarations.set(symbol, texts.join(" "));
1867
1294
  }
1868
1295
  open(found) {
@@ -1876,7 +1303,7 @@ var DeclarationWalk = class {
1876
1303
  if (this.inherited.has(symbol) || !this.isLocal(symbol)) return;
1877
1304
  this.inherited.add(symbol);
1878
1305
  for (const declaration of this.local(symbol)) {
1879
- if (!ts.isClassLike(declaration) && !ts.isInterfaceDeclaration(declaration)) continue;
1306
+ if (!typescript6_default.isClassLike(declaration) && !typescript6_default.isInterfaceDeclaration(declaration)) continue;
1880
1307
  for (const clause of declaration.heritageClauses ?? []) for (const base of clause.types) {
1881
1308
  this.typeArguments(base);
1882
1309
  for (const owner of this.bases(base.expression)) this.owner(owner);
@@ -1885,11 +1312,11 @@ var DeclarationWalk = class {
1885
1312
  }
1886
1313
  /** Reads the type arguments a heritage expression writes, including those inside a call such as `mix<A>(Base<B>)`. */
1887
1314
  typeArguments(node) {
1888
- if (ts.isExpressionWithTypeArguments(node)) {
1315
+ if (typescript6_default.isExpressionWithTypeArguments(node)) {
1889
1316
  for (const argument of node.typeArguments ?? []) this.references(argument);
1890
1317
  this.typeArguments(node.expression);
1891
- } else if (ts.isTypeNode(node)) this.references(node);
1892
- else ts.forEachChild(node, (child) => this.typeArguments(child));
1318
+ } else if (typescript6_default.isTypeNode(node)) this.references(node);
1319
+ else typescript6_default.forEachChild(node, (child) => this.typeArguments(child));
1893
1320
  }
1894
1321
  /** Records the symbol when it names an interface, class, enum or alias of the package, and queues its declarations to be read, once. */
1895
1322
  reach(found) {
@@ -1897,25 +1324,25 @@ var DeclarationWalk = class {
1897
1324
  if (this.reached.has(symbol) || !this.isLocal(symbol)) return;
1898
1325
  this.reached.add(symbol);
1899
1326
  for (const declaration of symbol.declarations ?? []) {
1900
- const owner = ts.isEnumMember(declaration) ? this.checker.getSymbolAtLocation(declaration.parent.name) : void 0;
1327
+ const owner = typescript6_default.isEnumMember(declaration) ? this.checker.getSymbolAtLocation(declaration.parent.name) : void 0;
1901
1328
  if (owner) this.reach(owner);
1902
1329
  }
1903
- const assigned = symbol.exports?.get(ts.InternalSymbolName.ExportEquals);
1330
+ const assigned = symbol.exports?.get(typescript6_default.InternalSymbolName.ExportEquals);
1904
1331
  if (assigned) this.reach(assigned);
1905
1332
  if (symbol.flags & MODULE) for (const member of this.checker.getExportsOfModule(symbol)) {
1906
1333
  const value = this.resolve(member);
1907
- if (value.flags & ts.SymbolFlags.Value) this.reach(value);
1334
+ if (value.flags & typescript6_default.SymbolFlags.Value) this.reach(value);
1908
1335
  }
1909
1336
  this.record(symbol);
1910
1337
  this.open(symbol);
1911
1338
  }
1912
1339
  /** The symbols a heritage expression names: the entity it is, or each name in a call such as `Mixin(Base)`. */
1913
1340
  bases(expression) {
1914
- const symbol = ts.isIdentifier(expression) || ts.isPropertyAccessExpression(expression) ? this.checker.getSymbolAtLocation(expression) : void 0;
1341
+ const symbol = typescript6_default.isIdentifier(expression) || typescript6_default.isPropertyAccessExpression(expression) ? this.checker.getSymbolAtLocation(expression) : void 0;
1915
1342
  if (symbol) return [symbol];
1916
1343
  const found = [];
1917
- ts.forEachChild(expression, (child) => {
1918
- if (!ts.isTypeNode(child)) found.push(...this.bases(child));
1344
+ typescript6_default.forEachChild(expression, (child) => {
1345
+ if (!typescript6_default.isTypeNode(child)) found.push(...this.bases(child));
1919
1346
  });
1920
1347
  return found;
1921
1348
  }
@@ -1923,8 +1350,8 @@ var DeclarationWalk = class {
1923
1350
  const name = referencedName(node);
1924
1351
  const symbol = name && this.checker.getSymbolAtLocation(name);
1925
1352
  if (symbol) this.reach(symbol);
1926
- if (ts.isExpressionWithTypeArguments(node) && !isEntityName(node.expression)) for (const base of this.bases(node.expression)) this.reach(base);
1927
- ts.forEachChild(node, (child) => this.references(child));
1353
+ if (typescript6_default.isExpressionWithTypeArguments(node) && !isEntityName(node.expression)) for (const base of this.bases(node.expression)) this.reach(base);
1354
+ typescript6_default.forEachChild(node, (child) => this.references(child));
1928
1355
  }
1929
1356
  type(type) {
1930
1357
  if (this.seen.has(type)) return;
@@ -1938,7 +1365,7 @@ var DeclarationWalk = class {
1938
1365
  this.types.push(...type.types);
1939
1366
  return;
1940
1367
  }
1941
- if (type.flags & ts.TypeFlags.TypeParameter) {
1368
+ if (type.flags & typescript6_default.TypeFlags.TypeParameter) {
1942
1369
  this.types.push(type.getConstraint() ?? type, type.getDefault() ?? type);
1943
1370
  return;
1944
1371
  }
@@ -1948,21 +1375,21 @@ var DeclarationWalk = class {
1948
1375
  }
1949
1376
  };
1950
1377
  function declaredNames(statement) {
1951
- if (ts.isVariableStatement(statement)) return statement.declarationList.declarations.map((declaration) => declaration.name);
1952
- if (ts.isInterfaceDeclaration(statement) || ts.isClassDeclaration(statement) || ts.isFunctionDeclaration(statement) || ts.isTypeAliasDeclaration(statement) || ts.isEnumDeclaration(statement) || ts.isModuleDeclaration(statement)) return statement.name ? [statement.name] : [];
1378
+ if (typescript6_default.isVariableStatement(statement)) return statement.declarationList.declarations.map((declaration) => declaration.name);
1379
+ if (typescript6_default.isInterfaceDeclaration(statement) || typescript6_default.isClassDeclaration(statement) || typescript6_default.isFunctionDeclaration(statement) || typescript6_default.isTypeAliasDeclaration(statement) || typescript6_default.isEnumDeclaration(statement) || typescript6_default.isModuleDeclaration(statement)) return statement.name ? [statement.name] : [];
1953
1380
  return [];
1954
1381
  }
1955
1382
  function moduleStatements(statement) {
1956
- const body = ts.isModuleDeclaration(statement) ? statement.body : void 0;
1957
- if (body && ts.isModuleBlock(body)) return body.statements;
1958
- return body && ts.isModuleDeclaration(body) ? [body] : [];
1383
+ const body = typescript6_default.isModuleDeclaration(statement) ? statement.body : void 0;
1384
+ if (body && typescript6_default.isModuleBlock(body)) return body.statements;
1385
+ return body && typescript6_default.isModuleDeclaration(body) ? [body] : [];
1959
1386
  }
1960
1387
  /** Whether a module file's statement opens a scope outside text can see: `declare global`, or `declare module` of a module that is not a package file. */
1961
1388
  function opensOutside(checker, statement, isLocalFile) {
1962
- if (!ts.isModuleDeclaration(statement)) return false;
1963
- if (statement.flags & ts.NodeFlags.GlobalAugmentation) return true;
1964
- if (!ts.isStringLiteral(statement.name)) return false;
1965
- return !(checker.getSymbolAtLocation(statement.name)?.declarations ?? []).some((declaration) => ts.isSourceFile(declaration) && isLocalFile(declaration));
1389
+ if (!typescript6_default.isModuleDeclaration(statement)) return false;
1390
+ if (statement.flags & typescript6_default.NodeFlags.GlobalAugmentation) return true;
1391
+ if (!typescript6_default.isStringLiteral(statement.name)) return false;
1392
+ return !(checker.getSymbolAtLocation(statement.name)?.declarations ?? []).some((declaration) => typescript6_default.isSourceFile(declaration) && isLocalFile(declaration));
1966
1393
  }
1967
1394
  /**
1968
1395
  * The symbols the package declares where text outside the package can name
@@ -1973,7 +1400,7 @@ function opensOutside(checker, statement, isLocalFile) {
1973
1400
  */
1974
1401
  function outsideVisible(checker, files, isLocalFile) {
1975
1402
  const visible = /* @__PURE__ */ new Set();
1976
- const pending = files.flatMap((file) => ts.isExternalModule(file) ? file.statements.filter((statement) => opensOutside(checker, statement, isLocalFile)).flatMap(moduleStatements) : [...file.statements]);
1403
+ const pending = files.flatMap((file) => typescript6_default.isExternalModule(file) ? file.statements.filter((statement) => opensOutside(checker, statement, isLocalFile)).flatMap(moduleStatements) : [...file.statements]);
1977
1404
  for (let statement = pending.pop(); statement; statement = pending.pop()) {
1978
1405
  pending.push(...moduleStatements(statement));
1979
1406
  for (const name of declaredNames(statement)) {
@@ -2002,7 +1429,7 @@ function referencedDeclarations(checker, isLocalFile, signatures, path, visible)
2002
1429
  //#endregion
2003
1430
  //#region src/verify/surface.ts
2004
1431
  const MAX_DEPTH = 4;
2005
- const SIGNATURE_FLAGS = ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteArrowStyleSignature;
1432
+ const SIGNATURE_FLAGS = typescript6_default.TypeFormatFlags.NoTruncation | typescript6_default.TypeFormatFlags.WriteArrowStyleSignature;
2006
1433
  const DECLARATION_FILE = /\.d\.[cm]?ts$/;
2007
1434
  function exportedDeclaration(value) {
2008
1435
  if (Array.isArray(value)) return value.map(exportedDeclaration).find((found) => found !== void 0);
@@ -2036,7 +1463,7 @@ function declaredHere(walk, symbol) {
2036
1463
  return (symbol.declarations ?? []).some((declaration) => inPackage(walk, declaration.getSourceFile().fileName));
2037
1464
  }
2038
1465
  function resolveAlias(walk, symbol) {
2039
- return symbol.flags & ts.SymbolFlags.Alias ? walk.checker.getAliasedSymbol(symbol) : symbol;
1466
+ return symbol.flags & typescript6_default.SymbolFlags.Alias ? walk.checker.getAliasedSymbol(symbol) : symbol;
2040
1467
  }
2041
1468
  function signatureTexts(walk, signatures, kind) {
2042
1469
  return signatures.map((signature) => walk.checker.signatureToString(signature, void 0, SIGNATURE_FLAGS, kind).replace(/\s+/g, " "));
@@ -2045,7 +1472,7 @@ function callableText(walk, type, path) {
2045
1472
  const callable = walk.checker.getNonNullableType(type);
2046
1473
  const calls = callable.getCallSignatures();
2047
1474
  const constructs = callable.getConstructSignatures();
2048
- const texts = [...signatureTexts(walk, calls, ts.SignatureKind.Call), ...signatureTexts(walk, constructs, ts.SignatureKind.Construct)];
1475
+ const texts = [...signatureTexts(walk, calls, typescript6_default.SignatureKind.Call), ...signatureTexts(walk, constructs, typescript6_default.SignatureKind.Construct)];
2049
1476
  if (texts.length === 0) return void 0;
2050
1477
  const reached = referencedDeclarations(walk.checker, (file) => inPackage(walk, file.fileName), [...calls, ...constructs], path, walk.visible);
2051
1478
  return reached.length === 0 ? texts.join(" | ") : `${texts.join(" | ")} where ${reached.join(" ")}`;
@@ -2054,8 +1481,8 @@ function typeOf(walk, symbol) {
2054
1481
  return walk.checker.getTypeOfSymbol(symbol);
2055
1482
  }
2056
1483
  function isPublic(property) {
2057
- const hidden = ts.ModifierFlags.Private | ts.ModifierFlags.Protected;
2058
- return (property.declarations ?? []).every((declaration) => (ts.getCombinedModifierFlags(declaration) & hidden) === 0);
1484
+ const hidden = typescript6_default.ModifierFlags.Private | typescript6_default.ModifierFlags.Protected;
1485
+ return (property.declarations ?? []).every((declaration) => (typescript6_default.getCombinedModifierFlags(declaration) & hidden) === 0);
2059
1486
  }
2060
1487
  function recordMembers(walk, type, prefix, skip, owners) {
2061
1488
  for (const property of walk.checker.getPropertiesOfType(type)) {
@@ -2070,26 +1497,26 @@ function recordClass(walk, symbol, path, owners) {
2070
1497
  recordMembers(walk, walk.checker.getDeclaredTypeOfSymbol(symbol), `${path}.prototype.`, "", owners);
2071
1498
  }
2072
1499
  function isObjectType(type) {
2073
- return (type.flags & ts.TypeFlags.Object) !== 0;
1500
+ return (type.flags & typescript6_default.TypeFlags.Object) !== 0;
2074
1501
  }
2075
1502
  function isObjectLiteralType(walk, type) {
2076
1503
  const owner = type.symbol;
2077
- return isObjectType(type) && (type.objectFlags & ts.ObjectFlags.Anonymous) !== 0 && owner !== void 0 && (owner.flags & ts.SymbolFlags.TypeLiteral) !== 0 && declaredHere(walk, owner);
1504
+ return isObjectType(type) && (type.objectFlags & typescript6_default.ObjectFlags.Anonymous) !== 0 && owner !== void 0 && (owner.flags & typescript6_default.SymbolFlags.TypeLiteral) !== 0 && declaredHere(walk, owner);
2078
1505
  }
2079
1506
  function visit(walk, exported, path, trail) {
2080
1507
  const symbol = resolveAlias(walk, exported);
2081
1508
  if (trail.includes(symbol)) return;
2082
1509
  const depth = path.split(":")[1]?.split(".").length ?? MAX_DEPTH;
2083
- const type = symbol.flags & ts.SymbolFlags.Value ? typeOf(walk, symbol) : void 0;
1510
+ const type = symbol.flags & typescript6_default.SymbolFlags.Value ? typeOf(walk, symbol) : void 0;
2084
1511
  const next = [...trail, symbol];
2085
1512
  const text = type && callableText(walk, type, next);
2086
1513
  if (text !== void 0) walk.surface.set(path, text);
2087
- if (symbol.flags & ts.SymbolFlags.Class && declaredHere(walk, symbol)) {
1514
+ if (symbol.flags & typescript6_default.SymbolFlags.Class && declaredHere(walk, symbol)) {
2088
1515
  recordClass(walk, symbol, path, next);
2089
1516
  return;
2090
1517
  }
2091
1518
  if (depth >= MAX_DEPTH || !declaredHere(walk, symbol)) return;
2092
- if (symbol.flags & ts.SymbolFlags.Module) for (const member of walk.checker.getExportsOfModule(symbol)) visit(walk, member, `${path}.${member.name}`, next);
1519
+ if (symbol.flags & typescript6_default.SymbolFlags.Module) for (const member of walk.checker.getExportsOfModule(symbol)) visit(walk, member, `${path}.${member.name}`, next);
2093
1520
  else if (type && text === void 0 && isObjectLiteralType(walk, type)) for (const member of walk.checker.getPropertiesOfType(type)) visit(walk, member, `${path}.${member.name}`, next);
2094
1521
  }
2095
1522
  function unresolvedImports(walk, program) {
@@ -2097,7 +1524,7 @@ function unresolvedImports(walk, program) {
2097
1524
  for (const file of program.getSourceFiles()) {
2098
1525
  if (!inPackage(walk, file.fileName)) continue;
2099
1526
  for (const statement of file.statements) {
2100
- const specifier = (ts.isImportDeclaration(statement) || ts.isExportDeclaration(statement)) && statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier) ? statement.moduleSpecifier : void 0;
1527
+ const specifier = (typescript6_default.isImportDeclaration(statement) || typescript6_default.isExportDeclaration(statement)) && statement.moduleSpecifier && typescript6_default.isStringLiteral(statement.moduleSpecifier) ? statement.moduleSpecifier : void 0;
2101
1528
  if (specifier && !walk.checker.getSymbolAtLocation(specifier)) missing.push(`${relative(walk.folder, file.fileName)} -> ${specifier.text}`);
2102
1529
  }
2103
1530
  }
@@ -2132,13 +1559,13 @@ function declaredSurface(packageFolder) {
2132
1559
  files.set(subpath, file);
2133
1560
  }
2134
1561
  const nodeTypes = nodeTypeRoot(folder);
2135
- const program = ts.createProgram([...files.values()], {
1562
+ const program = typescript6_default.createProgram([...files.values()], {
2136
1563
  noEmit: true,
2137
1564
  skipLibCheck: true,
2138
1565
  strict: true,
2139
- target: ts.ScriptTarget.ESNext,
2140
- module: ts.ModuleKind.ESNext,
2141
- moduleResolution: ts.ModuleResolutionKind.Bundler,
1566
+ target: typescript6_default.ScriptTarget.ESNext,
1567
+ module: typescript6_default.ModuleKind.ESNext,
1568
+ moduleResolution: typescript6_default.ModuleResolutionKind.Bundler,
2142
1569
  ...nodeTypes === void 0 ? { types: [] } : {
2143
1570
  typeRoots: [nodeTypes],
2144
1571
  types: ["node"]
@@ -4832,11 +4259,9 @@ function formalSection(workspace, state, plan) {
4832
4259
  continue;
4833
4260
  }
4834
4261
  ran.push(result);
4835
- if (gate && result.behaviour === void 0 && result.exitCode === 0) reasons.push(`formal check ${check.name} covers the diff but its run did not compare the covered behaviour with the base`);
4836
- const weight = formalGate(result);
4837
- if (gate && weight.fails) reasons.push(`formal check ${check.name}: ${weight.outcome}`);
4838
- const summary = gate ? weight.outcome : result.violated.length > 0 ? `violated: ${result.violated.join(", ")}` : `exit ${result.exitCode}, no violated rule`;
4839
- lines.push(`\`${check.name}\` (${gate ? "covers the diff, gates the verdict" : "does not cover the diff, informational"}): ${summary}. [evidence](${result.folder})`);
4262
+ const { status, outcome } = formalOutcome(result);
4263
+ if (gate && status !== "HOLDS") reasons.push(`formal check ${check.name}: ${status} ${outcome}`);
4264
+ lines.push(`\`${check.name}\` (${gate ? "covers the diff, gates the verdict" : "does not cover the diff, informational"}): ${status} ${outcome}. [evidence](${result.folder})`);
4840
4265
  }
4841
4266
  return {
4842
4267
  reasons,
@@ -4901,7 +4326,7 @@ function renderVerdict(workspace, state, pr, judgement) {
4901
4326
  "### One-way doors",
4902
4327
  ...doorsSection(judgement),
4903
4328
  "",
4904
- `**Head** \`${short(plan.headSha)}\` · **Skill** \`verify-${workspace.kind}\` @ \`${short(skillSha)}\` (not trusted yet) · **Verifier** ${judgement.verifier}`,
4329
+ `**Head** \`${short(plan.headSha)}\` · **Skill** \`verify-${workspace.kind}\` @ \`${short(skillSha)}\` · **Verifier** ${judgement.verifier}`,
4905
4330
  "",
4906
4331
  "### Touched features",
4907
4332
  ...bullets(touched, "none"),
@@ -4969,7 +4394,7 @@ const USAGE = `Usage: antelopejs-verify <command>
4969
4394
  run the named features, each whole, in that order;
4970
4395
  --jobs runs up to n features at once, each in its own process,
4971
4396
  at most half the cores, never with services
4972
- formal <run> [--all] run the formal checks that cover the diff and gate them on changed behaviour
4397
+ formal <run> [--all] run the formal checks that cover the diff and print HOLDS, VIOLATED or ERROR for each
4973
4398
  doors [patch] [--base <ref>] print the One-way-door line for a patch, or for the diff
4974
4399
  clean <run> stop what the run started, keep only the evidence
4975
4400
  verdict <run> --pr <n> [--judgement <file>]
@@ -5104,19 +4529,14 @@ function jobsFor(workspace, runs, flags) {
5104
4529
  }
5105
4530
  function runFormal(workspace, dir, all) {
5106
4531
  const state = loadRun(dir);
5107
- const plan = planFor(workspace, state.baseRef);
5108
- const touched = touchedFormalChecks(workspace, plan.changed);
4532
+ const touched = touchedFormalChecks(workspace, planFor(workspace, state.baseRef).changed);
5109
4533
  const checks = all ? workspace.config.formal ?? [] : touched;
5110
4534
  let fails = false;
5111
4535
  for (const check of checks) {
4536
+ const { status, outcome } = formalOutcome(runFormalCheck(workspace, state, check));
5112
4537
  const gates = touched.includes(check);
5113
- const weight = formalGate(runFormalCheck(workspace, state, check, gates ? {
5114
- baseSha: plan.baseSha,
5115
- headSha: plan.headSha,
5116
- changed: plan.changed
5117
- } : null));
5118
- fails ||= gates && weight.fails;
5119
- print(`${gates ? weight.fails ? "FAIL" : "PASS" : "INFO"} ${check.name}: ${weight.outcome}`);
4538
+ fails ||= gates && status !== "HOLDS";
4539
+ print(`${status} ${check.name}: ${outcome}${gates ? "" : ", informational: does not cover the diff"}`);
5120
4540
  }
5121
4541
  if (checks.length === 0) print("no formal check covers the diff");
5122
4542
  return fails ? 1 : 0;