veristack 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -63,7 +63,7 @@ R8 Live Production Verification & Boot BIST (Always | 3–10 probes)
63
63
  ### 1. Invariant Detection & Mechanical Proofs
64
64
  - **Diff Invariant-Loss & AST Predicate Weakening (`vstack diff-cheats`):** catches dropped null/bounds/error/cleanup/lock/timeout/auth guards (`diff-invariant-guard-dropped`) and weakened `if`/`&&`/`||`/bound predicates (`diff-predicate-weakened`) when a diff drops protection without matching test assertions. On a 320-pair historical OSS bug-fix replay corpus (`vstack bench --replay`), this catches **58.1% (`186/320`)** combined (**312/320** regression-free).
65
65
  - **Repo-Wide Statistical Belief Mining (`vstack scan`):** infers the codebase's own invariants (`>= 75%` adherence, `N >= 4`) to flag outlier omitted null checks, missing `finally`/`defer`/`with` cleanups, and unprotected sibling routes.
66
- - **Bend 2 Universal Laws (`vstack laws --verify`):** pairs CODEOWNERS-locked [LAWS.bend](templates/bend2-reference/LAWS.bend) with [PROOF.bend](templates/bend2-reference/PROOF.bend) over [Model.bend](templates/bend2-reference/Model.bend), verified by `bend --check-only` alongside [.verification/laws/universal-laws.laws.json](.verification/laws/universal-laws.laws.json) across all 6 toolchains.
66
+ - **Bend 2 Universal Laws (`vstack laws --verify` + `vstack scan`):** pairs CODEOWNERS-locked [LAWS.bend](templates/bend2-reference/LAWS.bend) with [PROOF.bend](templates/bend2-reference/PROOF.bend) over [Model.bend](templates/bend2-reference/Model.bend), verified by `bend --check-only` alongside [.verification/laws/universal-laws.laws.json](.verification/laws/universal-laws.laws.json) **and** statically projected across TS/JS, C#, Rust, Python, and Go (`law-monotonic-terminal-state`, `law-saturating-underflow`, `law-zero-cap-clamp`, `law-codec-roundtrip-asymmetry`, `law-unwind-unpaired`).
67
67
  - **Daikon-Style Dynamic Invariants (`vstack invariants`):** infers runtime bounds, non-null, enum-domain, sorted-array, and relational invariants from JSON traces and fails CI when a locked `.verification/invariants.json` invariant breaks.
68
68
 
69
69
  ### 2. Anti-Slop Review & Knowledge-Base Hygiene
@@ -98,7 +98,7 @@ Every language is verified by a living `caught/` vs `clean/` precision benchmark
98
98
 
99
99
  | Language | Static & Native Enforcement (`R0`–`R1`) | Runnable Reference & Formal Proof (`R2`–`R5`) | Guide |
100
100
  | :--- | :--- | :--- | :--- |
101
- | **TypeScript / JS** | `oxc-parser` AST, cross-file import graph, [oxlint-no-comments.mjs](lint/oxlint-no-comments.mjs), [oxlint-explicit-state-machine.mjs](lint/oxlint-explicit-state-machine.mjs) | `src/` + `tests/` ([formal-verification.test.ts](tests/formal-verification.test.ts)) | [typescript.md](skill/references/languages/typescript.md) |
101
+ | **TypeScript / JS** | `oxc-parser` AST (`anti-slop`, `landmines`, `internal/` boundaries, cross-file graph) + unified Oxlint plugin (`veristack/lint`) | `src/` + `tests/` ([formal-verification.test.ts](tests/formal-verification.test.ts)) | [typescript.md](skill/references/languages/typescript.md) |
102
102
  | **C# / .NET 10** | Roslyn [VStack.Analyzers](lint/csharp/VStack.Analyzers/) (`VSTACK001`–`VSTACK004`), `TreatWarningsAsErrors` | [templates/csharp-reference/](templates/csharp-reference/) (BFS proof, Dafny, `FsCheck`, `Stryker.NET`) | [csharp.md](skill/references/languages/csharp.md) |
103
103
  | **Rust (2024)** | `unsafe_code = "forbid"`, Clippy `unwrap_used`/`expect_used`/`wildcard_enum_match_arm = "deny"` | [templates/rust-reference/](templates/rust-reference/) (`stateright`, Kani, `proptest`, `cargo-mutants`) | [rust.md](skill/references/languages/rust.md) |
104
104
  | **Python (3.12+)** | `ruff` strict + `S101` prod assert ban, `mypy --strict`, `assert_never` | [templates/python-reference/](templates/python-reference/) (`hypothesis` PBT/MBT, BFS proof, `mutmut`) | [python.md](skill/references/languages/python.md) |
package/dist/cli.mjs CHANGED
@@ -1841,7 +1841,7 @@ function scanGitDiffCheats(repoPath, baseRef = "HEAD") {
1841
1841
 
1842
1842
  // src/circuits/index.ts
1843
1843
  import { spawnSync as spawnSync3 } from "node:child_process";
1844
- import path7 from "node:path";
1844
+ import path8 from "node:path";
1845
1845
 
1846
1846
  // src/discover.ts
1847
1847
  import fs3 from "node:fs";
@@ -2236,10 +2236,176 @@ function discoverRepo(repoPath) {
2236
2236
 
2237
2237
  // src/system1-classifier.ts
2238
2238
  import { createHash } from "node:crypto";
2239
- import path6 from "node:path";
2239
+ import path7 from "node:path";
2240
2240
 
2241
2241
  // src/test-analyzer.ts
2242
+ import path6 from "node:path";
2243
+
2244
+ // src/anti-slop/oxc-antislop-landmines.ts
2242
2245
  import path5 from "node:path";
2246
+ var UNSAFE_DICT_CS = /\b(?:I?Dictionary|ConcurrentDictionary)\s*<\s*string\s*,\s*(?:object|dynamic)\s*>/g;
2247
+ var UNSAFE_DICT_PY = /\b(?:dict|Dict|Mapping)\s*\[\s*str\s*,\s*Any\s*\]/g;
2248
+ var UNSAFE_DICT_GO = /\bmap\s*\[\s*string\s*\]\s*(?:any|interface\s*\{\s*\})/g;
2249
+ var IMPORT_SPEC_PY = /^\s*(?:from\s+([A-Za-z0-9_.]+)\s+import|import\s+([A-Za-z0-9_.]+))/gm;
2250
+ var UNSIGNALED_POLL_LOOP = /\bwhile\s*\(\s*(?:Date\.now\s*\(\s*\)|performance\.now\s*\(\s*\)|Stopwatch\.GetTimestamp|[A-Za-z_][A-Za-z0-9_.]*\.Elapsed(?:Milliseconds)?)\s*</g;
2251
+ var UNSIGNALED_POLL_PY = /\bwhile\s+(?:time\.time|time\.monotonic)\s*\(\s*\)\s*</g;
2252
+ var UNSIGNALED_POLL_EXPECT = /\bexpect\.poll\s*\(\s*\(\s*\)\s*=>\s*[A-Za-z_$][A-Za-z0-9_$.]*\.mock\b/g;
2253
+ var COLD_IMPORT_IN_TEST = /\b(?:it|test)\s*\([^{]*\{[\s\S]{0,400}?\bawait\s+import\s*\(/g;
2254
+ var STRICT_MSW_UNCONFIGURED = /\b(?:server|mswServer)\s*\.\s*listen\s*\(\s*\)/g;
2255
+ function pushFinding(findings, file, offset, rule, category, rung, severity, message, fix) {
2256
+ const line = lineOf(file.content, offset);
2257
+ findings.push({
2258
+ id: `AS:${rule}:${file.rel}:${line}`,
2259
+ rule,
2260
+ category,
2261
+ rung,
2262
+ severity,
2263
+ file: file.rel,
2264
+ line,
2265
+ message,
2266
+ fix
2267
+ });
2268
+ }
2269
+ function violatesInternalBoundary(fromRel, targetRel) {
2270
+ const normFrom = fromRel.replace(/\\/g, "/");
2271
+ const normTarget = targetRel.replace(/\\/g, "/");
2272
+ const parts = normTarget.split("/");
2273
+ const internalIdx = parts.lastIndexOf("internal");
2274
+ if (internalIdx <= 0)
2275
+ return null;
2276
+ const ownerPrefix = parts.slice(0, internalIdx).join("/");
2277
+ if (normFrom === ownerPrefix || normFrom.startsWith(`${ownerPrefix}/`))
2278
+ return null;
2279
+ return ownerPrefix;
2280
+ }
2281
+ function checkInternalBoundaryImports(file, code, ast, findings) {
2282
+ if ((file.language === "typescript" || file.language === "javascript") && ast) {
2283
+ const dir = path5.posix.dirname(file.rel.replace(/\\/g, "/"));
2284
+ const checkSpec = (spec, offset) => {
2285
+ if (!spec.startsWith("."))
2286
+ return;
2287
+ if (!spec.includes("/internal/") && !spec.endsWith("/internal"))
2288
+ return;
2289
+ const resolved = path5.posix.normalize(path5.posix.join(dir, spec));
2290
+ const owner = violatesInternalBoundary(file.rel, resolved);
2291
+ if (owner) {
2292
+ pushFinding(findings, file, offset, "no-cross-feature-internal-import", "structure", "R1", "error", `Cross-feature import '${spec}' reaches into '${owner}/internal/' from outside '${owner}/'.`, `Import from '${owner}' public entry point instead of reaching into '${owner}/internal/'.`);
2293
+ }
2294
+ };
2295
+ walkAst(ast, (node) => {
2296
+ if ((node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration") && isAstNode(node.source) && node.source.type === "Literal" && typeof node.source.value === "string") {
2297
+ checkSpec(node.source.value, node.start ?? 0);
2298
+ } else if (node.type === "CallExpression" && isAstNode(node.callee) && node.callee.type === "Identifier" && node.callee.name === "require" && Array.isArray(node.arguments) && isAstNode(node.arguments[0]) && node.arguments[0].type === "Literal" && typeof node.arguments[0].value === "string") {
2299
+ checkSpec(node.arguments[0].value, node.start ?? 0);
2300
+ }
2301
+ });
2302
+ } else if (file.language === "python") {
2303
+ for (const m of code.matchAll(IMPORT_SPEC_PY)) {
2304
+ const mod = m[1] ?? m[2] ?? "";
2305
+ if (!mod.includes(".internal.") && !mod.endsWith(".internal"))
2306
+ continue;
2307
+ if (mod.startsWith("."))
2308
+ continue;
2309
+ const targetRel = mod.replace(/\./g, "/");
2310
+ const owner = violatesInternalBoundary(file.rel, targetRel);
2311
+ if (owner) {
2312
+ pushFinding(findings, file, m.index ?? 0, "no-cross-feature-internal-import", "structure", "R1", "error", `Cross-package Python import '${mod}' reaches into '${owner}/internal/' from outside '${owner}/'.`, `Import from '${owner.replace(/\//g, ".")}' public API instead of internal modules.`);
2313
+ }
2314
+ }
2315
+ }
2316
+ }
2317
+ function analyzeUniversalAntiSlopProd(file, ast) {
2318
+ if (!file.language || file.isTest)
2319
+ return [];
2320
+ const findings = [];
2321
+ const raw = file.content;
2322
+ const code = maskCode(raw, file.language);
2323
+ checkInternalBoundaryImports(file, code, ast, findings);
2324
+ if (ast && (file.language === "typescript" || file.language === "javascript")) {
2325
+ let dictCount = 0;
2326
+ let objParamCount = 0;
2327
+ walkAst(ast, (node) => {
2328
+ if (node.type === "CallExpression" && isAstNode(node.callee) && node.callee.type === "MemberExpression") {
2329
+ const obj = isAstNode(node.callee.object) ? node.callee.object : null;
2330
+ const prop = isAstNode(node.callee.property) ? node.callee.property : null;
2331
+ if (obj?.type === "Identifier" && obj.name === "Reflect" && prop?.type === "Identifier" && (prop.name === "apply" || prop.name === "get" || prop.name === "set")) {
2332
+ pushFinding(findings, file, node.start ?? 0, "no-reflect-dynamic-invoke", "structure", "R0", "error", `Dynamic Reflect.${prop.name}() bypasses static typing and hides property/call contracts.`, "Use direct typed function calls or explicit property access / Map lookups.");
2333
+ }
2334
+ }
2335
+ if (file.language === "typescript") {
2336
+ if (node.type === "TSTypeAliasDeclaration" && isAstNode(node.typeAnnotation)) {
2337
+ if (node.typeAnnotation.type === "TSUnknownKeyword" || node.typeAnnotation.type === "TSAnyKeyword") {
2338
+ const name = isAstNode(node.id) && typeof node.id.name === "string" ? node.id.name : "alias";
2339
+ pushFinding(findings, file, node.start ?? 0, "no-unknown-type-alias", "structure", "R1", "warn", `Type alias '${name}' masks '${node.typeAnnotation.type === "TSAnyKeyword" ? "any" : "unknown"}' behind a domain-sounding name.`, "Model the actual discriminated union, interface, or schema-inferred type instead of aliasing unknown/any.");
2340
+ }
2341
+ }
2342
+ if (node.type === "TSTypeReference" && isAstNode(node.typeName) && node.typeName.type === "Identifier") {
2343
+ const refName = typeof node.typeName.name === "string" ? node.typeName.name : "";
2344
+ if (refName === "Record" && isAstNode(node.typeArguments) && Array.isArray(node.typeArguments.params)) {
2345
+ const valType = node.typeArguments.params[1];
2346
+ if (isAstNode(valType) && valType.type === "TSAnyKeyword" && ++dictCount <= 5) {
2347
+ pushFinding(findings, file, node.start ?? 0, "no-unsafe-dictionary-type", "structure", "R1", "warn", "Record<string, any> disables value type checking across every lookup.", "Use an explicit interface, Map<K, V>, or Record<K, unknown> parsed at the boundary.");
2348
+ }
2349
+ }
2350
+ if ((refName === "Object" || refName === "Function") && ++objParamCount <= 5) {
2351
+ pushFinding(findings, file, node.start ?? 0, "no-object-type-escape", "structure", "R1", "warn", `Boxed '${refName}' type accepts almost any value and disables structural type checking.`, refName === "Function" ? "Declare an explicit callable signature '(arg: A) => B' instead of 'Function'." : "Declare an explicit interface, record type, or generic constraint instead of 'Object'.");
2352
+ }
2353
+ }
2354
+ }
2355
+ });
2356
+ }
2357
+ const dictRe = file.language === "csharp" ? UNSAFE_DICT_CS : file.language === "python" ? UNSAFE_DICT_PY : file.language === "go" ? UNSAFE_DICT_GO : null;
2358
+ if (dictRe) {
2359
+ let count = 0;
2360
+ for (const m of code.matchAll(dictRe)) {
2361
+ if (++count > 5)
2362
+ break;
2363
+ pushFinding(findings, file, m.index ?? 0, "no-unsafe-dictionary-type", "structure", "R1", "warn", `Untyped string dictionary '${m[0].trim()}' discards value contracts.`, "Replace with a typed struct/record/TypedDict/dataclass or a strongly typed map value.");
2364
+ }
2365
+ }
2366
+ return findings;
2367
+ }
2368
+ function analyzeUniversalLandminesTest(file, code, ast) {
2369
+ if (!file.language || !file.isTest)
2370
+ return [];
2371
+ const findings = [];
2372
+ for (const m of code.matchAll(UNSIGNALED_POLL_LOOP)) {
2373
+ pushFinding(findings, file, m.index ?? 0, "no-unsignaled-poll", "test-smell", "R0", "error", "Clock-driven busy-poll loop in test races wall-clock deadlines and causes CI flakes.", "Await an explicit completion signal, promise, channel, or web-first locator assertion.");
2374
+ }
2375
+ if (file.language === "python") {
2376
+ for (const m of code.matchAll(UNSIGNALED_POLL_PY)) {
2377
+ pushFinding(findings, file, m.index ?? 0, "no-unsignaled-poll", "test-smell", "R0", "error", "Clock-driven busy-poll loop in Python test causes flaky timeouts.", "Wait on an asyncio.Event, threading.Event, or explicit queue completion instead.");
2378
+ }
2379
+ }
2380
+ if (file.language === "typescript" || file.language === "javascript") {
2381
+ for (const m of code.matchAll(UNSIGNALED_POLL_EXPECT)) {
2382
+ pushFinding(findings, file, m.index ?? 0, "no-unsignaled-poll", "test-smell", "R0", "error", "Polling mock call state with expect.poll masks race conditions.", "Await the observable async operation or explicit event directly.");
2383
+ }
2384
+ for (const m of code.matchAll(STRICT_MSW_UNCONFIGURED)) {
2385
+ pushFinding(findings, file, m.index ?? 0, "strict-msw", "test-smell", "R0", "warn", "MSW server.listen() called without { onUnhandledRequest: 'error' }; unexpected HTTP calls pass silently.", "Pass server.listen({ onUnhandledRequest: 'error' }) so unhandled network calls fail immediately.");
2386
+ }
2387
+ for (const m of code.matchAll(COLD_IMPORT_IN_TEST)) {
2388
+ if (/\bresetModules\b/.test(m[0]))
2389
+ continue;
2390
+ pushFinding(findings, file, m.index ?? 0, "no-cold-import-in-test", "test-smell", "R0", "warn", "Dynamic await import() inside a test body pays cold-module startup cost inside the test timer.", "Move static imports to module scope so test bodies measure only behavior.");
2391
+ }
2392
+ if (ast && Array.isArray(ast.body)) {
2393
+ for (const stmt of ast.body) {
2394
+ if (!isAstNode(stmt) || stmt.type !== "VariableDeclaration" || !Array.isArray(stmt.declarations))
2395
+ continue;
2396
+ for (const decl of stmt.declarations) {
2397
+ if (!isAstNode(decl) || !isAstNode(decl.init))
2398
+ continue;
2399
+ const initSrc = file.content.slice(decl.init.start ?? 0, decl.init.end ?? 0);
2400
+ if (/\bAbortSignal\.timeout\s*\(|\bnew\s+AbortController\s*\(/.test(initSrc)) {
2401
+ pushFinding(findings, file, decl.start ?? 0, "no-shared-abort-signal", "test-smell", "R0", "warn", "Module-scoped AbortSignal/AbortController shares timeout and cancellation state across tests.", "Create a fresh AbortController or AbortSignal.timeout() inside each test case.");
2402
+ }
2403
+ }
2404
+ }
2405
+ }
2406
+ }
2407
+ return findings;
2408
+ }
2243
2409
 
2244
2410
  // src/ast/t3-immune-rules.ts
2245
2411
  var SH_PKILL_PATTERN = /\bpkill\s+-[a-zA-Z]*f\b|\bpgrep\b[^\n|]*\|\s*(?:xargs\s+)?kill\b/g;
@@ -2479,7 +2645,7 @@ function scanSingleTestFile(file, repoHasEmulator) {
2479
2645
  }
2480
2646
  return count;
2481
2647
  };
2482
- const baseName = path5.posix.basename(file.rel);
2648
+ const baseName = path6.posix.basename(file.rel);
2483
2649
  if (COVERAGE_FARM_NAME.test(baseName) && !COVERAGE_POLICY_TOOLING.test(baseName)) {
2484
2650
  findings.push({
2485
2651
  id: `TS:coverage-farm:${file.rel}:1`,
@@ -2554,6 +2720,7 @@ function scanSingleTestFile(file, repoHasEmulator) {
2554
2720
  });
2555
2721
  }
2556
2722
  findings.push(...scanTestHarnessGuards(file, raw, code, repoHasEmulator));
2723
+ findings.push(...analyzeUniversalLandminesTest(file, code, parseTsAst(file)));
2557
2724
  if (boundary === "e2e" && hasNetworkMock) {
2558
2725
  pushDowns.push({
2559
2726
  file: file.rel,
@@ -2785,7 +2952,7 @@ function selectRoundRobin(items, maxCandidates) {
2785
2952
  function buildTestFacts(file, ordinal, boundary, testCaseCount, hasTableOrPbt, networkMock) {
2786
2953
  const code = maskStrings(file.content);
2787
2954
  const hasSutImport = hasNonFrameworkImport(file.content, file.language);
2788
- const coverageFarmName = COVERAGE_FARM.test(path6.posix.basename(file.rel));
2955
+ const coverageFarmName = COVERAGE_FARM.test(path7.posix.basename(file.rel));
2789
2956
  const literalOnlyAssertion = LITERAL_EXPECT.test(file.content);
2790
2957
  const selfDerivedExpectation = SELF_DERIVED.test(code);
2791
2958
  const multiStatusCount = code.match(MULTI_STATUS)?.length ?? 0;
@@ -4026,7 +4193,7 @@ function collectInstructionInputs(repoPath) {
4026
4193
  const repo = discoverRepo(repoPath);
4027
4194
  const items = [];
4028
4195
  for (const file of repo.files) {
4029
- const base = path7.posix.basename(file.rel).toLowerCase();
4196
+ const base = path8.posix.basename(file.rel).toLowerCase();
4030
4197
  if (base !== "agents.md" && base !== "claude.md" && base !== "skill.md")
4031
4198
  continue;
4032
4199
  const lines = file.content.split(/\r?\n/);
@@ -4556,10 +4723,10 @@ function lintNoComments(file, source, language, options = {}) {
4556
4723
  }
4557
4724
 
4558
4725
  // src/structure.ts
4559
- import path14 from "node:path";
4726
+ import path15 from "node:path";
4560
4727
 
4561
4728
  // src/oracle-audit.ts
4562
- import path8 from "node:path";
4729
+ import path9 from "node:path";
4563
4730
  var INSTRUCTION_NAMES = new Set(["agents.md", "claude.md", "gemini.md", "skill.md"]);
4564
4731
  var ORACLE_NO_EDIT_TOPIC = /\b(?:oracle|gherkin|feature files?|acceptance tests?|contracts\.lock)\b|(?:features|tests\/acceptance)\/|\.feature\b/i;
4565
4732
  var ORACLE_LOCK_VERB = /\b(?:read[- ]only|locked|immutable)\b|\b(?:do not|don't|must not|never)\s+(?:be\s+)?(?:edit|modify|change|rewrite|delete|touch)(?:ed)?\b/i;
@@ -4614,7 +4781,7 @@ function parseCodeowners(text) {
4614
4781
  }
4615
4782
  function analyzeOracleAndInstructions(repo) {
4616
4783
  const findings = [];
4617
- const codeownersFiles = repo.files.filter((f) => path8.posix.basename(f.rel).toLowerCase() === "codeowners");
4784
+ const codeownersFiles = repo.files.filter((f) => path9.posix.basename(f.rel).toLowerCase() === "codeowners");
4618
4785
  const ownerRules = codeownersFiles.flatMap((f) => parseCodeowners(f.content));
4619
4786
  const oracleArtifacts = repo.allRelPaths.filter((rel) => /\.feature$/i.test(rel) || /(?:^|\/)tests\/acceptance\//i.test(rel) || /(?:^|\/)contracts\.lock\.json$/i.test(rel));
4620
4787
  if (oracleArtifacts.length > 0 && ownerRules.length > 0) {
@@ -4636,7 +4803,7 @@ function analyzeOracleAndInstructions(repo) {
4636
4803
  }
4637
4804
  }
4638
4805
  }
4639
- const instructionFiles = repo.files.filter((f) => INSTRUCTION_NAMES.has(path8.posix.basename(f.rel).toLowerCase()));
4806
+ const instructionFiles = repo.files.filter((f) => INSTRUCTION_NAMES.has(path9.posix.basename(f.rel).toLowerCase()));
4640
4807
  let forbidFile;
4641
4808
  let allowFile;
4642
4809
  let allowLine = 1;
@@ -4685,6 +4852,150 @@ function analyzeOracleAndInstructions(repo) {
4685
4852
  return findings;
4686
4853
  }
4687
4854
 
4855
+ // src/anti-slop/universal-laws.ts
4856
+ var TERMINAL_STATES = "(?:Shipped|Completed|Cancelled|Canceled|Closed|Refunded|Archived|Settled|Terminated|Finalized|Deleted|Disposed)";
4857
+ var NON_TERMINAL_STATES = "(?:Pending|Draft|Open|Queued|Processing|Active|Running|InProgress|Created|Submitted|New)";
4858
+ var TERMINAL_CASE_RESURRECT = new RegExp(`\\bcase\\b[^\\n:;{=>]{0,40}["']?\\b${TERMINAL_STATES}\\b["']?[^\\n{]{0,30}[:=>]\\s*(?:return\\s+)?(?:new\\s+)?["']?[A-Za-z0-9_.:]*(?:\\.|::)?${NON_TERMINAL_STATES}\\b["']?`, "g");
4859
+ var RUST_MATCH_TERMINAL_RESURRECT = new RegExp(`\\b[A-Za-z0-9_:]*::${TERMINAL_STATES}\\b[^\\n=>]{0,30}=>\\s*(?:Ok\\s*\\(\\s*)?[A-Za-z0-9_:]*::${NON_TERMINAL_STATES}\\b`, "g");
4860
+ var NON_NEG_COUNTER = "(?:balance|credits|creditBalance|stock|inventory|remaining|quota|allowance|available|budget|availableStock|remainingBudget|remainingQuota)";
4861
+ var UNGUARDED_COUNTER_SUB = new RegExp(`\\b(${NON_NEG_COUNTER})\\s*(?:-=|=\\s*\\1\\s*-)\\s*([A-Za-z_][A-Za-z0-9_.]*)`, "g");
4862
+ var SATURATING_OR_GUARD = /\b(?:Math\.max\s*\(\s*0|Math\.Clamp|saturating_sub|checked_sub|max\s*\(\s*0|clamp|>=|<=|>|<|throw\b|raise\b|return\s+(?:Err|null|false|undefined)|InvalidOperationException|ArgumentOutOfRangeException)\b/;
4863
+ var ZERO_CAP_OR_FALLBACK_JS = /\b(cap|limit|maxRetries|maxAttempts|maxItems|maxCount|maxConcurrency|quota|budget|pageSize)\s*\|\|\s*(?:[1-9]\d*|[A-Za-z_][A-Za-z0-9_]*)\b/g;
4864
+ var ZERO_CAP_OR_FALLBACK_PY = /\b(cap|limit|max_retries|max_attempts|max_items|max_count|quota|budget|page_size)\s+or\s+(?:[1-9]\d*|[A-Za-z_][A-Za-z0-9_]*)\b/g;
4865
+ var ENCODE_FN = /\b(?:function|def|fn|func|public\s+(?:static\s+)?[A-Za-z0-9_<>,.?]+\s+)\s*(encode[A-Za-z0-9_]*|serialize[A-Za-z0-9_]*|to_wire[A-Za-z0-9_]*|toWire[A-Za-z0-9_]*)\s*\(/g;
4866
+ var DECODE_FN = /\b(?:function|def|fn|func|public\s+(?:static\s+)?[A-Za-z0-9_<>,.?]+\s+)\s*(decode[A-Za-z0-9_]*|deserialize[A-Za-z0-9_]*|from_wire[A-Za-z0-9_]*|fromWire[A-Za-z0-9_]*)\s*\(/g;
4867
+ var UNPAIRED_LOCK_CS_GO_PY = [
4868
+ { open: /\b([A-Za-z_][A-Za-z0-9_.]*)\.(?:EnterWriteLock|EnterReadLock|Acquire|Wait)\s*\(/g, close: /\.(?:ExitWriteLock|ExitReadLock|Release)\s*\(/, label: "lock/semaphore" },
4869
+ { open: /\b([A-Za-z_][A-Za-z0-9_.]*)\.(?:Lock|RLock)\s*\(\s*\)/g, close: /\.(?:Unlock|RUnlock)\s*\(\s*\)/, label: "mutex" },
4870
+ { open: /\b([A-Za-z_][A-Za-z0-9_.]*)\.acquire\s*\(/g, close: /\.release\s*\(/, label: "lock" }
4871
+ ];
4872
+ var GO_WALL_CLOCK_SUB = /\btime\.Now\s*\(\s*\)\s*\.\s*Unix(?:Milli|Micro|Nano)?\s*\(\s*\)\s*-\s*[A-Za-z_][A-Za-z0-9_.]*/g;
4873
+ var GO_TEST_ONLY_EXPORT = /\bfunc\s+[A-Z][A-Za-z0-9_]*(?:ForTesting|TestOnly)\s*\(/g;
4874
+ function pushLaw(findings, file, offset, rule, rung, severity, message, fix) {
4875
+ const line = lineOf(file.content, offset);
4876
+ findings.push({
4877
+ id: `LAW:${rule}:${file.rel}:${line}`,
4878
+ rule,
4879
+ category: "structure",
4880
+ rung,
4881
+ severity,
4882
+ file: file.rel,
4883
+ line,
4884
+ message,
4885
+ fix
4886
+ });
4887
+ }
4888
+ function extractBodySlice(code, startIdx) {
4889
+ const openBrace = code.indexOf("{", startIdx);
4890
+ if (openBrace >= 0 && openBrace - startIdx < 160) {
4891
+ let depth = 0;
4892
+ for (let i = openBrace;i < Math.min(code.length, openBrace + 3000); i++) {
4893
+ if (code[i] === "{")
4894
+ depth += 1;
4895
+ else if (code[i] === "}") {
4896
+ depth -= 1;
4897
+ if (depth === 0)
4898
+ return code.slice(openBrace, i + 1);
4899
+ }
4900
+ }
4901
+ }
4902
+ return code.slice(startIdx, Math.min(code.length, startIdx + 1200));
4903
+ }
4904
+ function countSwitchArms(body, lang) {
4905
+ if (lang === "rust") {
4906
+ return (body.match(/=>/g)?.length ?? 0) - (body.match(/\b_\s*=>/g)?.length ?? 0);
4907
+ }
4908
+ const cases = body.match(/\bcase\b/g)?.length ?? 0;
4909
+ if (cases > 0)
4910
+ return cases;
4911
+ if (lang === "csharp") {
4912
+ return (body.match(/=>/g)?.length ?? 0) - (body.match(/\b_\s*=>/g)?.length ?? 0);
4913
+ }
4914
+ return 0;
4915
+ }
4916
+ function stripLineAndBlockComments(raw, lang) {
4917
+ const re = lang === "python" ? /#[^\r\n]*/g : /\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g;
4918
+ return raw.replace(re, (m) => m.replace(/[^\r\n]/g, " "));
4919
+ }
4920
+ function analyzeUniversalBendLaws(file) {
4921
+ if (!file.language || file.isTest)
4922
+ return [];
4923
+ const findings = [];
4924
+ const raw = file.content;
4925
+ const maskedAll = maskCode(raw, file.language);
4926
+ const cfgTestIdx = file.language === "rust" ? raw.search(/#\[cfg\(test\)\]/) : -1;
4927
+ const code = cfgTestIdx >= 0 ? maskedAll.slice(0, cfgTestIdx) : maskedAll;
4928
+ const uncommentedAll = stripLineAndBlockComments(raw, file.language);
4929
+ const uncommented = cfgTestIdx >= 0 ? uncommentedAll.slice(0, cfgTestIdx) : uncommentedAll;
4930
+ const resurrectRe = file.language === "rust" ? RUST_MATCH_TERMINAL_RESURRECT : TERMINAL_CASE_RESURRECT;
4931
+ for (const m of uncommented.matchAll(resurrectRe)) {
4932
+ pushLaw(findings, file, m.index ?? 0, "law-monotonic-terminal-state", "R1", "error", "Transition reverts a terminal state back to a non-terminal state (violates Bend 2 monotonic terminal-state law).", "Keep terminal states absorbing (return the terminal state unchanged or return a typed rejection error).");
4933
+ }
4934
+ for (const m of code.matchAll(UNGUARDED_COUNTER_SUB)) {
4935
+ const idx = m.index ?? 0;
4936
+ const window = code.slice(Math.max(0, idx - 220), idx + 180);
4937
+ if (SATURATING_OR_GUARD.test(window))
4938
+ continue;
4939
+ pushLaw(findings, file, idx, "law-saturating-underflow", "R1", "warn", `Unguarded subtraction on non-negative counter '${m[1]}' can underflow below zero (violates Bend 2 sat_sub_zero_left law).`, "Use total saturating arithmetic (Math.max(0, ...), saturating_sub, Math.Clamp) or validate amount <= available first.");
4940
+ }
4941
+ const zeroCapRe = file.language === "python" ? ZERO_CAP_OR_FALLBACK_PY : file.language === "typescript" || file.language === "javascript" ? ZERO_CAP_OR_FALLBACK_JS : null;
4942
+ if (zeroCapRe) {
4943
+ for (const m of code.matchAll(zeroCapRe)) {
4944
+ const idx = m.index ?? 0;
4945
+ const lineStart = code.lastIndexOf(`
4946
+ `, idx) + 1;
4947
+ const lineEnd = code.indexOf(`
4948
+ `, idx);
4949
+ const lineText = code.slice(lineStart, lineEnd >= 0 ? lineEnd : code.length);
4950
+ if (/\b(?:if|while)\s*\(/.test(lineText) || /\breturn\s+[^\n]*[=<>!]/.test(lineText))
4951
+ continue;
4952
+ if (file.language === "python" && /^\s*(?:if|elif|while|assert)\b/.test(lineText))
4953
+ continue;
4954
+ pushLaw(findings, file, idx, "law-zero-cap-clamp", "R1", "warn", `Truthy fallback on cap/limit '${m[1]}' silently overrides an explicit 0 cap (violates Bend 2 clamp_respects_zero_cap law).`, file.language === "python" ? `Check 'if ${m[1]} is None:' instead of '${m[1]} or ...' so 0 stays 0.` : `Use nullish coalescing ('${m[1]} ?? defaultVal') instead of '${m[1]} || defaultVal' so 0 stays 0.`);
4955
+ }
4956
+ }
4957
+ const encodeMatches = [...code.matchAll(ENCODE_FN)];
4958
+ const decodeMatches = [...code.matchAll(DECODE_FN)];
4959
+ const enc = encodeMatches.length === 1 ? encodeMatches[0] : undefined;
4960
+ const dec = decodeMatches.length === 1 ? decodeMatches[0] : undefined;
4961
+ if (enc && dec) {
4962
+ const encBody = extractBodySlice(code, enc.index ?? 0);
4963
+ const decBody = extractBodySlice(code, dec.index ?? 0);
4964
+ const encArms = countSwitchArms(encBody, file.language);
4965
+ const decArms = countSwitchArms(decBody, file.language);
4966
+ if (Math.max(encArms, decArms) >= 3 && encArms > 0 && decArms > 0 && encArms !== decArms) {
4967
+ pushLaw(findings, file, dec.index ?? 0, "law-codec-roundtrip-asymmetry", "R1", "warn", `Codec pair '${enc[1]}' (${encArms} branches) and '${dec[1]}' (${decArms} branches) handle different variant counts (violates Bend 2 status_roundtrip law).`, "Handle identical variant sets in encode and decode (or derive both from one lookup table) and add a round-trip test.");
4968
+ }
4969
+ }
4970
+ if (file.language === "csharp" || file.language === "go" || file.language === "python") {
4971
+ for (const pair of UNPAIRED_LOCK_CS_GO_PY) {
4972
+ for (const m of code.matchAll(pair.open)) {
4973
+ const idx = m.index ?? 0;
4974
+ const target = m[1] ?? "";
4975
+ const after = code.slice(idx, Math.min(code.length, idx + 900));
4976
+ if (!pair.close.test(after))
4977
+ continue;
4978
+ if (file.language === "go" && /\bdefer\b/.test(after))
4979
+ continue;
4980
+ if ((file.language === "csharp" || file.language === "python") && /\b(?:finally|using|with)\b/.test(code.slice(Math.max(0, idx - 60), idx + 900))) {
4981
+ continue;
4982
+ }
4983
+ pushLaw(findings, file, idx, "law-unwind-unpaired", "R1", "warn", `Paired ${pair.label} acquisition on '${target}' lacks try/finally or defer cleanup (violates Bend 2 unwind_restores_empty law).`, file.language === "go" ? `Call 'defer ${target}.Unlock()' immediately after acquiring the lock.` : "Wrap the critical section in try/finally (or a scoped using/with guard) so cleanup runs on every unwind path.");
4984
+ break;
4985
+ }
4986
+ }
4987
+ }
4988
+ if (file.language === "go") {
4989
+ for (const m of code.matchAll(GO_WALL_CLOCK_SUB)) {
4990
+ pushLaw(findings, file, m.index ?? 0, "cdc-wall-clock-duration", "R1", "warn", `Wall-clock Unix timestamp subtraction (${m[0].trim()}) breaks on NTP clock jumps (V30 Clock CDC).`, "Use time.Since(start) or time.Now().Sub(start) which reads Go's monotonic clock.");
4991
+ }
4992
+ for (const m of code.matchAll(GO_TEST_ONLY_EXPORT)) {
4993
+ pushLaw(findings, file, m.index ?? 0, "no-test-only-production-seam", "R1", "warn", `Test-only exported function in Go production file: ${m[0].trim()}.`, "Remove test-only exports and verify behavior through the public package interface.");
4994
+ }
4995
+ }
4996
+ return findings;
4997
+ }
4998
+
4688
4999
  // src/ast/blackhole-replay-guards.ts
4689
5000
  var GO_ERR_TYPE_ASSERT = /\b([A-Za-z_][A-Za-z0-9_]*[Ee]rr[A-Za-z0-9_]*|err)\.\(\s*\*?[A-Za-z_][A-Za-z0-9_.]*(?:Error|Err)\b/g;
4690
5001
  var GO_SLICE_LEN_PLUS = /\[len\(\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\)\s*\+\s*[1-9]\d*\s*:/g;
@@ -4870,7 +5181,7 @@ function analyzeBlackHoleReplayGuards(file, ast) {
4870
5181
  }
4871
5182
 
4872
5183
  // src/ast/cross-file-graph.ts
4873
- import path9 from "node:path";
5184
+ import path10 from "node:path";
4874
5185
  var DANGEROUS_SINKS = new Set([
4875
5186
  "eval",
4876
5187
  "Function",
@@ -4905,8 +5216,8 @@ function push5(findings, file, line, rule, rung, severity, message, fix) {
4905
5216
  function resolveImport(fromRel, spec, allFiles) {
4906
5217
  if (!spec.startsWith("."))
4907
5218
  return null;
4908
- const dir = path9.posix.dirname(fromRel);
4909
- const base = path9.posix.normalize(path9.posix.join(dir, spec));
5219
+ const dir = path10.posix.dirname(fromRel);
5220
+ const base = path10.posix.normalize(path10.posix.join(dir, spec));
4910
5221
  const candidates = [
4911
5222
  base,
4912
5223
  `${base}.ts`,
@@ -5218,7 +5529,7 @@ function analyzeBlackHoleArchGates(repo) {
5218
5529
  }
5219
5530
 
5220
5531
  // src/ast/deviant-invariants.ts
5221
- import path10 from "node:path";
5532
+ import path11 from "node:path";
5222
5533
  var GENERATED_PATH2 = /(?:^|\/)(?:generated|generated-clients?|codegen|__snapshots__)\/|\.(?:gen|generated)\.[cm]?[jt]sx?$/i;
5223
5534
  var SKIP_NULL_CALLEE = new Set([
5224
5535
  "get",
@@ -5413,10 +5724,10 @@ function minePairedCleanupBeliefs(files, findings) {
5413
5724
  function mineRouteAuthBeliefs(files, findings) {
5414
5725
  const routeGroups = new Map;
5415
5726
  for (const file of files) {
5416
- const dir = path10.posix.dirname(file.rel);
5727
+ const dir = path11.posix.dirname(file.rel);
5417
5728
  if (!ROUTE_DIR_RE.test(dir))
5418
5729
  continue;
5419
- const base = path10.posix.basename(file.rel, path10.posix.extname(file.rel));
5730
+ const base = path11.posix.basename(file.rel, path11.posix.extname(file.rel));
5420
5731
  if (PUBLIC_ROUTE_FILE.test(base))
5421
5732
  continue;
5422
5733
  const list = routeGroups.get(dir) ?? [];
@@ -6610,7 +6921,7 @@ function analyzeCveAndPostmortemGuards(file) {
6610
6921
  }
6611
6922
 
6612
6923
  // src/zero-defect/ecosystem-guards.ts
6613
- import path11 from "node:path";
6924
+ import path12 from "node:path";
6614
6925
  var TS_ANY_ANNOTATION = /(?:[,({]\s*[A-Za-z_$][A-Za-z0-9_$]*\??\s*:\s*any\b|\)\s*:\s*any\b|<\s*any\s*>)/g;
6615
6926
  var UNBOUNDED_FETCH = /\bfetch\s*\(\s*[^,)\n]+\s*\)/g;
6616
6927
  var DYNAMIC_IMPORT_VAR = /\bimport\s*\(\s*([A-Za-z_$][A-Za-z0-9_$.]*)\s*\)/g;
@@ -6641,8 +6952,8 @@ function scanMigrationDuplicates(repo, findings) {
6641
6952
  for (const rel of repo.allRelPaths) {
6642
6953
  if (!/(?:^|\/)migrations?\//i.test(rel) || !/\.sql$/i.test(rel))
6643
6954
  continue;
6644
- const dir = path11.posix.dirname(rel);
6645
- const base = path11.posix.basename(rel);
6955
+ const dir = path12.posix.dirname(rel);
6956
+ const base = path12.posix.basename(rel);
6646
6957
  const prefixMatch = /^(\d{2,})[_-]/.exec(base);
6647
6958
  if (!prefixMatch?.[1])
6648
6959
  continue;
@@ -6663,7 +6974,7 @@ function scanMigrationDuplicates(repo, findings) {
6663
6974
  }
6664
6975
  function scanFileEcosystemGuards(file, hasTsRepo, findings) {
6665
6976
  const raw = file.content;
6666
- const baseLower = path11.posix.basename(file.rel).toLowerCase();
6977
+ const baseLower = path12.posix.basename(file.rel).toLowerCase();
6667
6978
  if (/^\.env\.(?:example|sample|template|dist)$/i.test(baseLower)) {
6668
6979
  for (const m of raw.matchAll(ENV_REAL_SECRET)) {
6669
6980
  const tok = m[0] ?? "";
@@ -7695,6 +8006,8 @@ function analyzeProdZeroDefectRules(repo) {
7695
8006
  findings.push(...analyzeWave6TitansAGuards(file));
7696
8007
  findings.push(...analyzeWave7TitansBGuards(file));
7697
8008
  const ast = parseTsAst(file);
8009
+ findings.push(...analyzeUniversalBendLaws(file));
8010
+ findings.push(...analyzeUniversalAntiSlopProd(file, ast));
7698
8011
  findings.push(...analyzeTsAstGuards(file, ast));
7699
8012
  findings.push(...analyzeLinearObligations(file, ast));
7700
8013
  findings.push(...analyzeBlackHoleReplayGuards(file, ast));
@@ -8953,7 +9266,7 @@ function analyzeStateMachines(repo) {
8953
9266
  import { spawnSync as spawnSync6 } from "node:child_process";
8954
9267
  import fs5 from "node:fs";
8955
9268
  import os2 from "node:os";
8956
- import path13 from "node:path";
9269
+ import path14 from "node:path";
8957
9270
 
8958
9271
  // src/zero-defect/formal-sync.ts
8959
9272
  import { spawnSync as spawnSync4 } from "node:child_process";
@@ -9087,18 +9400,18 @@ function formatFormalSyncReport(findings) {
9087
9400
  import { spawnSync as spawnSync5 } from "node:child_process";
9088
9401
  import fs4 from "node:fs";
9089
9402
  import os from "node:os";
9090
- import path12 from "node:path";
9403
+ import path13 from "node:path";
9091
9404
  var BEND_LAW_DECL = /^\s*(?:law|theorem)\s+([A-Za-z_][A-Za-z0-9_]*)\b/gm;
9092
9405
  var BEND_DEF_DECL = /^\s*def\s+(?:[A-Za-z_][A-Za-z0-9_]*\.)?([A-Za-z_][A-Za-z0-9_]*)\b/gm;
9093
9406
  var BEND_UNSAFE_ESCAPE = /(?:@unsafe\b|\?[A-Za-z_][A-Za-z0-9_]*|\b(?:unsafe|sorry|admit|todo!|panic!)\b)/g;
9094
9407
  function resolveBendBinary() {
9095
- const localBin = path12.join(os.homedir(), ".bend", "bin", "bend");
9408
+ const localBin = path13.join(os.homedir(), ".bend", "bin", "bend");
9096
9409
  if (fs4.existsSync(localBin))
9097
9410
  return localBin;
9098
9411
  return "bend";
9099
9412
  }
9100
9413
  function isLawFile(rel) {
9101
- const base = path12.posix.basename(rel);
9414
+ const base = path13.posix.basename(rel);
9102
9415
  return base === "LAWS.bend" || base === "PROOF.bend" || base.endsWith(".laws.bend") || base.endsWith(".laws.json") || /(?:^|\/)\.verification\/laws\//.test(rel);
9103
9416
  }
9104
9417
  function hasCodeownersCoverage(repo, lawRel) {
@@ -9168,11 +9481,11 @@ ${pairedProof.content}` : file.content;
9168
9481
  }
9169
9482
  function runBendVerdict(repoRoot, relPath, findings, verifiedBackends) {
9170
9483
  const bendBin = resolveBendBinary();
9171
- const absFile = path12.join(repoRoot, relPath);
9484
+ const absFile = path13.join(repoRoot, relPath);
9172
9485
  const useKernel = Boolean(process.env.BENDTT);
9173
9486
  const flag = useKernel ? "--verdict" : "--check-only";
9174
9487
  const probe = spawnSync5(bendBin, [absFile, flag], {
9175
- cwd: path12.dirname(absFile),
9488
+ cwd: path13.dirname(absFile),
9176
9489
  encoding: "utf8",
9177
9490
  timeout: 30000
9178
9491
  });
@@ -9227,7 +9540,7 @@ function auditJsonLawFile(file, repo, findings, verifiedBackends, verify) {
9227
9540
  runBendVerdict(repo.root, ref, findings, verifiedBackends);
9228
9541
  continue;
9229
9542
  }
9230
- const cmdArgs = Array.isArray(law.verifyArgs) && law.verifyArgs.length > 0 && typeof law.verifyArgs[0] === "string" ? [law.verifyArgs[0], law.verifyArgs.slice(1), repo.root] : /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(ref) ? ["bun", ["test", path12.join(repo.root, ref)], repo.root] : /(?:^|\/)test_[^/]+\.py$|_test\.py$/.test(ref) ? ["pytest", [path12.join(repo.root, ref)], repo.root] : ref.endsWith("_test.go") ? ["go", ["test", "."], path12.dirname(path12.join(repo.root, ref))] : null;
9543
+ const cmdArgs = Array.isArray(law.verifyArgs) && law.verifyArgs.length > 0 && typeof law.verifyArgs[0] === "string" ? [law.verifyArgs[0], law.verifyArgs.slice(1), repo.root] : /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(ref) ? ["bun", ["test", path13.join(repo.root, ref)], repo.root] : /(?:^|\/)test_[^/]+\.py$|_test\.py$/.test(ref) ? ["pytest", [path13.join(repo.root, ref)], repo.root] : ref.endsWith("_test.go") ? ["go", ["test", "."], path13.dirname(path13.join(repo.root, ref))] : null;
9231
9544
  if (cmdArgs) {
9232
9545
  const run = spawnSync5(cmdArgs[0], cmdArgs[1], { cwd: cmdArgs[2], encoding: "utf8", timeout: 45000 });
9233
9546
  if (run.error) {
@@ -9280,8 +9593,8 @@ function auditLaws(repo, options) {
9280
9593
  for (const file of repo.files) {
9281
9594
  if (!isLawFile(file.rel))
9282
9595
  continue;
9283
- const base = path12.posix.basename(file.rel);
9284
- const dir = path12.posix.dirname(file.rel);
9596
+ const base = path13.posix.basename(file.rel);
9597
+ const dir = path13.posix.dirname(file.rel);
9285
9598
  const siblingLaws = dir === "." ? "LAWS.bend" : `${dir}/LAWS.bend`;
9286
9599
  if (base === "PROOF.bend" && filesByRel.has(siblingLaws)) {
9287
9600
  continue;
@@ -9706,7 +10019,7 @@ function runRedBeforeFix(repoPath, baseRef, testCmd) {
9706
10019
  if (!baseRef || baseRef.startsWith("-")) {
9707
10020
  throw new Error(`Invalid git baseRef "${baseRef}".`);
9708
10021
  }
9709
- const root = path13.resolve(repoPath);
10022
+ const root = path14.resolve(repoPath);
9710
10023
  const changed = spawnSync6("git", ["status", "--porcelain"], { cwd: root, encoding: "utf8" });
9711
10024
  const diffNames = spawnSync6("git", ["diff", "--name-only", baseRef, "--"], { cwd: root, encoding: "utf8" });
9712
10025
  const candidates = new Set;
@@ -9719,7 +10032,7 @@ ${diffNames.stdout ?? ""}`.split(/\r?\n/)) {
9719
10032
  candidates.add(cleaned);
9720
10033
  }
9721
10034
  }
9722
- const copiedTestFiles = [...candidates].filter((rel) => fs5.existsSync(path13.join(root, rel)));
10035
+ const copiedTestFiles = [...candidates].filter((rel) => fs5.existsSync(path14.join(root, rel)));
9723
10036
  if (copiedTestFiles.length === 0) {
9724
10037
  return {
9725
10038
  passed: false,
@@ -9730,8 +10043,8 @@ ${diffNames.stdout ?? ""}`.split(/\r?\n/)) {
9730
10043
  reason: "No modified or added test files found to prove red-before-fix."
9731
10044
  };
9732
10045
  }
9733
- const tmpDir = fs5.mkdtempSync(path13.join(os2.tmpdir(), "vstack-rbf-"));
9734
- const worktreeDir = path13.join(tmpDir, "base");
10046
+ const tmpDir = fs5.mkdtempSync(path14.join(os2.tmpdir(), "vstack-rbf-"));
10047
+ const worktreeDir = path14.join(tmpDir, "base");
9735
10048
  try {
9736
10049
  const addWt = spawnSync6("git", ["worktree", "add", "--detach", worktreeDir, baseRef], {
9737
10050
  cwd: root,
@@ -9747,14 +10060,14 @@ ${diffNames.stdout ?? ""}`.split(/\r?\n/)) {
9747
10060
  reason: `Failed to create base worktree at ${baseRef}: ${(addWt.stderr ?? "").trim()}`
9748
10061
  };
9749
10062
  }
9750
- const resolvedWorktree = path13.resolve(worktreeDir);
10063
+ const resolvedWorktree = path14.resolve(worktreeDir);
9751
10064
  for (const rel of copiedTestFiles) {
9752
- const dest = path13.resolve(resolvedWorktree, rel);
9753
- if (!dest.startsWith(`${resolvedWorktree}${path13.sep}`)) {
10065
+ const dest = path14.resolve(resolvedWorktree, rel);
10066
+ if (!dest.startsWith(`${resolvedWorktree}${path14.sep}`)) {
9754
10067
  throw new Error(`Refusing to copy test file outside worktree: ${rel}`);
9755
10068
  }
9756
- fs5.mkdirSync(path13.dirname(dest), { recursive: true });
9757
- fs5.copyFileSync(path13.join(root, rel), dest);
10069
+ fs5.mkdirSync(path14.dirname(dest), { recursive: true });
10070
+ fs5.copyFileSync(path14.join(root, rel), dest);
9758
10071
  }
9759
10072
  const baseRun = spawnSync6(testCmd, [], { cwd: worktreeDir, shell: true, encoding: "utf8", timeout: 120000 });
9760
10073
  const headRun = spawnSync6(testCmd, [], { cwd: root, shell: true, encoding: "utf8", timeout: 120000 });
@@ -9813,8 +10126,8 @@ function analyzeStructure(repo) {
9813
10126
  const dirMembers = new Map;
9814
10127
  const dirSourceFiles = new Map;
9815
10128
  for (const rel of repo.allRelPaths) {
9816
- const dir = path14.posix.dirname(rel);
9817
- const base = path14.posix.basename(rel);
10129
+ const dir = path15.posix.dirname(rel);
10130
+ const base = path15.posix.basename(rel);
9818
10131
  const members = dirMembers.get(dir) ?? new Set;
9819
10132
  members.add(base);
9820
10133
  dirMembers.set(dir, members);
@@ -9822,9 +10135,9 @@ function analyzeStructure(repo) {
9822
10135
  for (const file of repo.files) {
9823
10136
  const isGenerated = GENERATED_PATH5.test(file.rel);
9824
10137
  if (file.language && !file.isTest && !isGenerated) {
9825
- const dir = path14.posix.dirname(file.rel);
10138
+ const dir = path15.posix.dirname(file.rel);
9826
10139
  const list = dirSourceFiles.get(dir) ?? [];
9827
- list.push(path14.posix.basename(file.rel));
10140
+ list.push(path15.posix.basename(file.rel));
9828
10141
  dirSourceFiles.set(dir, list);
9829
10142
  }
9830
10143
  if (file.language && !file.isTest && !isGenerated && file.lines > WARN_FILE_LINES) {
@@ -10074,7 +10387,7 @@ function analyzeStructure(repo) {
10074
10387
  }
10075
10388
  }
10076
10389
  }
10077
- const baseLower = path14.posix.basename(file.rel).toLowerCase();
10390
+ const baseLower = path15.posix.basename(file.rel).toLowerCase();
10078
10391
  if (baseLower.endsWith(".csproj") || baseLower === "directory.build.props") {
10079
10392
  for (const match of file.content.matchAll(CSPROJ_WARN_FALSE)) {
10080
10393
  const line = lineOf5(file.content, match.index ?? 0);
@@ -10193,7 +10506,7 @@ function analyzeStructure(repo) {
10193
10506
 
10194
10507
  // src/anti-slop/agent-docs.ts
10195
10508
  import fs6 from "node:fs";
10196
- import path15 from "node:path";
10509
+ import path16 from "node:path";
10197
10510
  var AGENT_DOC_BASENAME = /^(?:agents\.md|claude\.md|gemini\.md|review\.md|\.cursorrules|copilot-instructions\.md)$/i;
10198
10511
  var MAX_AGENT_DOC_LINES = 400;
10199
10512
  var BACKTICK_TOKEN = /`([^`\r\n]+)`/g;
@@ -10203,7 +10516,7 @@ function isAgentInstructionFile(rel) {
10203
10516
  const norm = rel.replace(/\\/g, "/");
10204
10517
  if (/^(?:examples|templates|tests\/fixtures)\//i.test(norm))
10205
10518
  return false;
10206
- const base = path15.posix.basename(norm);
10519
+ const base = path16.posix.basename(norm);
10207
10520
  return AGENT_DOC_BASENAME.test(base);
10208
10521
  }
10209
10522
  function collectTopLevelDirs(repoRoot) {
@@ -10273,13 +10586,13 @@ function auditAgentDocs(repo) {
10273
10586
  continue;
10274
10587
  if (seenStale.has(clean))
10275
10588
  continue;
10276
- const resolved = path15.resolve(repo.root, clean);
10277
- if (!resolved.startsWith(`${repo.root}${path15.sep}`))
10589
+ const resolved = path16.resolve(repo.root, clean);
10590
+ if (!resolved.startsWith(`${repo.root}${path16.sep}`))
10278
10591
  continue;
10279
10592
  if (fs6.existsSync(resolved))
10280
10593
  continue;
10281
- const siblingResolved = path15.resolve(path15.dirname(file.abs), clean);
10282
- if (siblingResolved.startsWith(`${repo.root}${path15.sep}`) && fs6.existsSync(siblingResolved))
10594
+ const siblingResolved = path16.resolve(path16.dirname(file.abs), clean);
10595
+ if (siblingResolved.startsWith(`${repo.root}${path16.sep}`) && fs6.existsSync(siblingResolved))
10283
10596
  continue;
10284
10597
  seenStale.add(clean);
10285
10598
  staleCount += 1;
@@ -10578,7 +10891,7 @@ function scanRepo(repoPath, options = {}) {
10578
10891
 
10579
10892
  // src/ratchet.ts
10580
10893
  import fs7 from "node:fs";
10581
- import path16 from "node:path";
10894
+ import path17 from "node:path";
10582
10895
  function buildRatchetBaseline(findings) {
10583
10896
  const counts = new Map;
10584
10897
  for (const f of findings) {
@@ -10614,8 +10927,8 @@ function evaluateRatchet(findings, baseline) {
10614
10927
  };
10615
10928
  }
10616
10929
  function writeRatchetBaseline(filePath, baseline) {
10617
- const resolved = path16.resolve(filePath);
10618
- fs7.mkdirSync(path16.dirname(resolved), { recursive: true });
10930
+ const resolved = path17.resolve(filePath);
10931
+ fs7.mkdirSync(path17.dirname(resolved), { recursive: true });
10619
10932
  fs7.writeFileSync(resolved, `${JSON.stringify(baseline, null, 2)}
10620
10933
  `, "utf8");
10621
10934
  }
@@ -10623,7 +10936,7 @@ function writeRatchetBaseline(filePath, baseline) {
10623
10936
  // src/zero-defect/bench.ts
10624
10937
  import fs8 from "node:fs";
10625
10938
  import os3 from "node:os";
10626
- import path17 from "node:path";
10939
+ import path18 from "node:path";
10627
10940
  function commentPrefix(lang) {
10628
10941
  if (lang === "python" || lang === "shell")
10629
10942
  return "# ";
@@ -10657,11 +10970,11 @@ const Doc = "${escaped}"
10657
10970
  `;
10658
10971
  }
10659
10972
  function runInTempDir(files) {
10660
- const dir = fs8.mkdtempSync(path17.join(os3.tmpdir(), "vstack-bench-"));
10973
+ const dir = fs8.mkdtempSync(path18.join(os3.tmpdir(), "vstack-bench-"));
10661
10974
  try {
10662
10975
  for (const [rel, content] of Object.entries(files)) {
10663
- const full = path17.join(dir, rel);
10664
- fs8.mkdirSync(path17.dirname(full), { recursive: true });
10976
+ const full = path18.join(dir, rel);
10977
+ fs8.mkdirSync(path18.dirname(full), { recursive: true });
10665
10978
  fs8.writeFileSync(full, content, "utf8");
10666
10979
  }
10667
10980
  return scanRepo(dir);
@@ -10680,11 +10993,11 @@ function countRuleMap(findings) {
10680
10993
  return m;
10681
10994
  }
10682
10995
  function runHistoricalReplayBench(replayDir) {
10683
- const manifestPath = path17.join(replayDir, "manifest.json");
10996
+ const manifestPath = path18.join(replayDir, "manifest.json");
10684
10997
  const entries = JSON.parse(fs8.readFileSync(manifestPath, "utf8"));
10685
10998
  const t0 = performance.now();
10686
- const beforeScan = scanRepo(path17.join(replayDir, "before"));
10687
- const afterScan = scanRepo(path17.join(replayDir, "after"));
10999
+ const beforeScan = scanRepo(path18.join(replayDir, "before"));
11000
+ const afterScan = scanRepo(path18.join(replayDir, "after"));
10688
11001
  const scanMs = Number((performance.now() - t0).toFixed(2));
10689
11002
  const beforeByFile = new Map;
10690
11003
  for (const f of beforeScan.findings) {
@@ -10722,8 +11035,8 @@ function runHistoricalReplayBench(replayDir) {
10722
11035
  if (aCnt > (bMap.get(rule) ?? 0))
10723
11036
  regressedRules.push(rule);
10724
11037
  }
10725
- const beforeRaw = fs8.readFileSync(path17.join(replayDir, "before", entry.beforeRel), "utf8");
10726
- const afterRaw = fs8.readFileSync(path17.join(replayDir, "after", entry.afterRel), "utf8");
11038
+ const beforeRaw = fs8.readFileSync(path18.join(replayDir, "before", entry.beforeRel), "utf8");
11039
+ const afterRaw = fs8.readFileSync(path18.join(replayDir, "after", entry.afterRel), "utf8");
10727
11040
  const revertEvents = buildSyntheticRevertEvents(entry.afterRel, afterRaw, beforeRaw);
10728
11041
  const revertFindings = [
10729
11042
  ...auditDiffInvariantLoss(revertEvents),
@@ -10790,17 +11103,17 @@ function runHistoricalReplayBench(replayDir) {
10790
11103
  };
10791
11104
  }
10792
11105
  function runPrecisionBench(repoRoot, corpusDir, replayDir) {
10793
- const examplesRoot = path17.join(repoRoot, "examples");
11106
+ const examplesRoot = path18.join(repoRoot, "examples");
10794
11107
  const langs = ["typescript", "csharp", "rust", "python", "go", "sql", "shell"];
10795
11108
  const languages = [];
10796
11109
  for (const lang of langs) {
10797
- const langDir = path17.join(examplesRoot, lang);
10798
- const manifestPath = path17.join(langDir, "manifest.json");
11110
+ const langDir = path18.join(examplesRoot, lang);
11111
+ const manifestPath = path18.join(langDir, "manifest.json");
10799
11112
  if (!fs8.existsSync(manifestPath))
10800
11113
  continue;
10801
11114
  const manifest = JSON.parse(fs8.readFileSync(manifestPath, "utf8"));
10802
- const caughtDir = path17.join(langDir, "caught");
10803
- const cleanDir = path17.join(langDir, "clean");
11115
+ const caughtDir = path18.join(langDir, "caught");
11116
+ const cleanDir = path18.join(langDir, "clean");
10804
11117
  const t0 = performance.now();
10805
11118
  const caughtScan = scanRepo(caughtDir);
10806
11119
  const cleanScan = scanRepo(cleanDir);
@@ -10829,7 +11142,7 @@ function runPrecisionBench(repoRoot, corpusDir, replayDir) {
10829
11142
  for (const relFile of Object.keys(manifest.caught)) {
10830
11143
  if (/test|spec/i.test(relFile))
10831
11144
  continue;
10832
- const content = fs8.readFileSync(path17.join(caughtDir, relFile), "utf8");
11145
+ const content = fs8.readFileSync(path18.join(caughtDir, relFile), "utf8");
10833
11146
  commentedFiles[relFile] = wrapInComments(content, lang);
10834
11147
  const wrappedStr = wrapInStringLiteral(content, lang);
10835
11148
  if (wrappedStr !== null)
@@ -10863,7 +11176,7 @@ function runPrecisionBench(repoRoot, corpusDir, replayDir) {
10863
11176
  const totalCleanFps = languages.reduce((s, l) => s + l.cleanFalsePositives.length, 0);
10864
11177
  const totalAdversarialFps = languages.reduce((s, l) => s + l.commentWrappedFps.length + l.stringWrappedFps.length, 0);
10865
11178
  const totalScanMs = Number(languages.reduce((s, l) => s + l.scanMs, 0).toFixed(2));
10866
- const replay = replayDir && fs8.existsSync(path17.join(replayDir, "manifest.json")) ? runHistoricalReplayBench(replayDir) : undefined;
11179
+ const replay = replayDir && fs8.existsSync(path18.join(replayDir, "manifest.json")) ? runHistoricalReplayBench(replayDir) : undefined;
10867
11180
  return {
10868
11181
  passed: totalExpectedRules === totalMatchedRules && totalCleanFps === 0 && totalAdversarialFps === 0,
10869
11182
  totalExpectedRules,
@@ -11000,7 +11313,7 @@ function fitEmpiricalBigO(samples, thresholds = { maxTimeExponent: 1.45 }) {
11000
11313
 
11001
11314
  // src/zero-defect/daikon-invariants.ts
11002
11315
  import fs9 from "node:fs";
11003
- import path18 from "node:path";
11316
+ import path19 from "node:path";
11004
11317
  function runtimeType(val) {
11005
11318
  if (val === null)
11006
11319
  return "null";
@@ -11161,8 +11474,8 @@ function compareInvariantSnapshots(baseline, current, baselineFile = ".verificat
11161
11474
  };
11162
11475
  }
11163
11476
  function writeInvariantSnapshot(filePath, snapshot) {
11164
- const resolved = path18.resolve(filePath);
11165
- fs9.mkdirSync(path18.dirname(resolved), { recursive: true });
11477
+ const resolved = path19.resolve(filePath);
11478
+ fs9.mkdirSync(path19.dirname(resolved), { recursive: true });
11166
11479
  fs9.writeFileSync(resolved, `${JSON.stringify(snapshot, null, 2)}
11167
11480
  `, "utf8");
11168
11481
  }
@@ -11191,7 +11504,7 @@ function formatInvariantDiffReport(snapshot, diff) {
11191
11504
 
11192
11505
  // src/anti-slop/review-brief.ts
11193
11506
  import { spawnSync as spawnSync7 } from "node:child_process";
11194
- import path19 from "node:path";
11507
+ import path20 from "node:path";
11195
11508
  var LOCK_OR_GENERATED = /(?:^|\/)(?:pnpm-lock\.yaml|package-lock\.json|yarn\.lock|bun\.lockb?|cargo\.lock|uv\.lock|poetry\.lock|go\.sum)$|\.(?:snap|generated\.[a-z]+)$/i;
11196
11509
  var DOC_FILE = /\.(?:md|mdx|txt|rst)$/i;
11197
11510
  var CRITICAL_PATH = /(?:^|\/)(?:\.github\/workflows\/|codeowners$|migrations\/|schema|rls|policies\/|auth|security|billing|payment|permission|crypto|token|secret|openapi|contracts|state-machines?\/|tsconfig(?:\.[^/]+)?\.json$|\.?vstack\.json$|\.verification\/|package\.json$|cargo\.toml$|pyproject\.toml$|directory\.build\.props$)/i;
@@ -11276,7 +11589,7 @@ function buildBlindSpots(files, docLinesAdded, additionBias) {
11276
11589
  return spots;
11277
11590
  }
11278
11591
  function buildReviewBrief(repoPath, options = {}) {
11279
- const repoRoot = path19.resolve(repoPath);
11592
+ const repoRoot = path20.resolve(repoPath);
11280
11593
  const baseRef = options.baseRef ?? "HEAD";
11281
11594
  validateBaseRef(baseRef);
11282
11595
  const maxLines = options.maxLines ?? 600;
@@ -11317,7 +11630,7 @@ function buildReviewBrief(repoPath, options = {}) {
11317
11630
  linesDeleted += deleted;
11318
11631
  if (!LOCK_OR_GENERATED.test(file)) {
11319
11632
  nonLockfileLinesAdded += added;
11320
- const dir = path19.posix.dirname(file);
11633
+ const dir = path20.posix.dirname(file);
11321
11634
  dirs.add(dir === "." ? "<root>" : dir);
11322
11635
  }
11323
11636
  if (DOC_FILE.test(file))
@@ -11516,7 +11829,7 @@ function usage() {
11516
11829
  "vstack — Deterministic Verification Stack, Push-Down Analyzer, Formal Checks & JEV-Style System 1 Circuits",
11517
11830
  "",
11518
11831
  "Commands:",
11519
- " vstack scan [dir] [--json | --md] [--config <file>] [--disable <rules>] [--ratchet <file>] [--update-ratchet] [--fail-on-cheats] [--fail-on-errors]",
11832
+ " vstack scan [dir] [--json | --md] [--config <file>] [--disable <rules>] [--ratchet <file>] [--update-ratchet] [--strict] [--fail-on-cheats] [--fail-on-errors]",
11520
11833
  " vstack no-comments [dir] [--json] [--fail]",
11521
11834
  " vstack state-machines [dir] [--json] [--fail]",
11522
11835
  " vstack diff-cheats [dir] [--base <ref>] [--json] [--fail]",
@@ -11601,12 +11914,21 @@ async function run() {
11601
11914
  const asJson = rest.includes("--json");
11602
11915
  const asMd = rest.includes("--md");
11603
11916
  if (cmd === "scan") {
11917
+ const strict = rest.includes("--strict");
11604
11918
  const configPath = parseFlagValue(rest, "--config");
11605
11919
  const disableRaw = parseFlagValue(rest, "--disable");
11606
11920
  const disableRules = disableRaw ? disableRaw.split(",").map((r) => r.trim()).filter(Boolean) : undefined;
11607
- const report = scanRepo(target, { configPath, disableRules });
11608
11921
  const ratchetPath = parseFlagValue(rest, "--ratchet");
11609
11922
  const updateRatchet = rest.includes("--update-ratchet");
11923
+ if (strict && (ratchetPath || updateRatchet)) {
11924
+ console.error("vstack scan --strict forbids --ratchet and --update-ratchet baselines.");
11925
+ return 1;
11926
+ }
11927
+ if (strict && (configPath || disableRules && disableRules.length > 0)) {
11928
+ console.error("vstack scan --strict forbids --config and --disable rule overrides.");
11929
+ return 1;
11930
+ }
11931
+ const report = scanRepo(target, { configPath, disableRules });
11610
11932
  let ratchetEval;
11611
11933
  if (ratchetPath) {
11612
11934
  if (updateRatchet || !fs10.existsSync(ratchetPath)) {
@@ -11635,6 +11957,17 @@ RATCHET (${ratchetPath}): ${ratchetEval.passed ? "PASS" : "FAIL"}`);
11635
11957
  }
11636
11958
  }
11637
11959
  }
11960
+ if (strict) {
11961
+ if (report.config && (report.config.disabledRules.length > 0 || report.config.suppressedCount > 0)) {
11962
+ console.error("vstack scan --strict failed: .vstack.json disables or suppresses rules.");
11963
+ return 1;
11964
+ }
11965
+ const s = report.summary;
11966
+ if (s.totalFindings > 0 || s.errorCount > 0 || s.warnCount > 0 || s.cheatCount > 0 || s.noCommentCount > 0 || s.holeCount > 0 || s.pushDownCount > 0) {
11967
+ return 1;
11968
+ }
11969
+ return 0;
11970
+ }
11638
11971
  if (ratchetEval && !ratchetEval.passed)
11639
11972
  return 1;
11640
11973
  if (rest.includes("--fail-on-errors") && report.summary.errorCount > 0)
package/lint/index.mjs ADDED
@@ -0,0 +1,91 @@
1
+ import noCommentsPlugin from "./oxlint-no-comments.mjs";
2
+ import explicitStateMachinePlugin from "./oxlint-explicit-state-machine.mjs";
3
+
4
+ const reflectRule = {
5
+ meta: {
6
+ type: "problem",
7
+ docs: { description: "Disallow dynamic Reflect.apply/get/set bypasses." },
8
+ schema: [],
9
+ },
10
+ create(context) {
11
+ return {
12
+ CallExpression(node) {
13
+ const callee = node.callee;
14
+ if (
15
+ callee &&
16
+ callee.type === "MemberExpression" &&
17
+ callee.object?.type === "Identifier" &&
18
+ callee.object.name === "Reflect" &&
19
+ callee.property?.type === "Identifier" &&
20
+ (callee.property.name === "apply" || callee.property.name === "get" || callee.property.name === "set")
21
+ ) {
22
+ context.report({
23
+ node,
24
+ message: `Avoid Reflect.${callee.property.name}(); use direct typed calls or explicit property access.`,
25
+ });
26
+ }
27
+ },
28
+ };
29
+ },
30
+ };
31
+
32
+ const unknownAliasRule = {
33
+ meta: {
34
+ type: "suggestion",
35
+ docs: { description: "Disallow type aliases to unknown or any." },
36
+ schema: [],
37
+ },
38
+ create(context) {
39
+ return {
40
+ TSTypeAliasDeclaration(node) {
41
+ const ann = node.typeAnnotation;
42
+ if (ann && (ann.type === "TSUnknownKeyword" || ann.type === "TSAnyKeyword")) {
43
+ context.report({
44
+ node,
45
+ message: `Type alias '${node.id?.name ?? "alias"}' hides '${ann.type === "TSAnyKeyword" ? "any" : "unknown"}'; define a real contract type.`,
46
+ });
47
+ }
48
+ },
49
+ };
50
+ },
51
+ };
52
+
53
+ const unsafeDictRule = {
54
+ meta: {
55
+ type: "suggestion",
56
+ docs: { description: "Disallow Record<string, any> and boxed Object/Function types." },
57
+ schema: [],
58
+ },
59
+ create(context) {
60
+ return {
61
+ TSTypeReference(node) {
62
+ const name = node.typeName?.type === "Identifier" ? node.typeName.name : "";
63
+ if (name === "Object" || name === "Function") {
64
+ context.report({
65
+ node,
66
+ message: `Avoid boxed '${name}' type; declare an explicit interface or callable signature.`,
67
+ });
68
+ return;
69
+ }
70
+ const params = node.typeArguments?.params ?? node.typeParameters?.params;
71
+ if (name === "Record" && Array.isArray(params) && params[1]?.type === "TSAnyKeyword") {
72
+ context.report({
73
+ node,
74
+ message: "Avoid Record<string, any>; use an explicit interface, Map, or Record<K, unknown> parsed at the boundary.",
75
+ });
76
+ }
77
+ },
78
+ };
79
+ },
80
+ };
81
+
82
+ export default {
83
+ meta: { name: "veristack" },
84
+ rules: {
85
+ ...noCommentsPlugin.rules,
86
+ ...explicitStateMachinePlugin.rules,
87
+ "no-reflect-dynamic-invoke": reflectRule,
88
+ "no-unknown-type-alias": unknownAliasRule,
89
+ "no-unsafe-dictionary-type": unsafeDictRule,
90
+ },
91
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veristack",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Deterministic 9-rung zero-defect verification ladder, cross-language static and invariant analyzer, Bend 2 formal laws, and anti-cheat CI gates for TypeScript, C#, Rust, Python, Go, SQL, and Shell.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/a1ter-nate/veristack#readme",
@@ -29,6 +29,7 @@
29
29
  "files": [
30
30
  "bin/",
31
31
  "dist/",
32
+ "lint/index.mjs",
32
33
  "lint/oxlint-no-comments.mjs",
33
34
  "lint/oxlint-explicit-state-machine.mjs",
34
35
  "skill/",
@@ -36,6 +37,7 @@
36
37
  "README.md"
37
38
  ],
38
39
  "exports": {
40
+ "./lint": "./lint/index.mjs",
39
41
  "./lint/no-comments": "./lint/oxlint-no-comments.mjs",
40
42
  "./lint/explicit-state-machine": "./lint/oxlint-explicit-state-machine.mjs"
41
43
  },
@@ -45,6 +47,8 @@
45
47
  "test": "bun test ./tests/",
46
48
  "test:examples": "bun test ./tests/examples-accuracy.test.ts ./examples/typescript/clean/check-coverage-policy.test.ts",
47
49
  "scan": "bun src/cli.ts scan .",
50
+ "scan:strict": "bun src/cli.ts scan . --strict",
51
+ "check:max-lines": "node scripts/check-max-lines.mjs",
48
52
  "lint:no-comments": "bun src/cli.ts no-comments . --fail",
49
53
  "lint:state-machines": "bun src/cli.ts state-machines . --fail",
50
54
  "test:csharp": "dotnet test lint/csharp/VStack.Analyzers.Tests/VStack.Analyzers.Tests.csproj && dotnet test templates/csharp-reference/OrderLifecycle.slnx",
@@ -52,7 +56,7 @@
52
56
  "test:go": "cd templates/go-reference && go vet ./... && go test -race -v ./...",
53
57
  "test:laws": "bun src/cli.ts laws . --verify --fail",
54
58
  "test:python": "uv run --project templates/python-reference ruff check templates/python-reference examples/python/clean && uv run --project templates/python-reference ruff format --check templates/python-reference examples/python/clean && uv run --project templates/python-reference mypy templates/python-reference/src templates/python-reference/tests examples/python/clean && PYTHONPATH=examples/python/clean uv run --project templates/python-reference pytest templates/python-reference examples/python/clean",
55
- "check": "bun run lint:no-comments && bun run lint:state-machines && bun test ./tests/ ./examples/typescript/clean/ && bun src/cli.ts scan . --fail-on-cheats"
59
+ "check": "bun run check:max-lines && bun run lint:no-comments && bun run lint:state-machines && bun src/cli.ts formal-sync . --fail && bun src/cli.ts laws . --fail && bun test ./tests/ ./examples/typescript/clean/ && bun src/cli.ts scan . --strict"
56
60
  },
57
61
  "engines": {
58
62
  "node": ">=18.0.0",