veristack 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +152 -2
- package/bin/vstack.mjs +11 -0
- package/dist/cli.mjs +11391 -0
- package/lint/oxlint-explicit-state-machine.mjs +244 -0
- package/lint/oxlint-no-comments.mjs +103 -0
- package/package.json +63 -4
- package/skill/SKILL.md +104 -0
- package/skill/agents/openai.yaml +3 -0
- package/skill/references/01-test-and-verification-index.md +103 -0
- package/skill/references/02-linter-and-antislop-stack.md +111 -0
- package/skill/references/03-pushdown-protocol-and-budgets.md +128 -0
- package/skill/references/04-source-patterns-digest.md +20 -0
- package/skill/references/05-formal-verification.md +54 -0
- package/skill/references/06-system1-circuits.md +66 -0
- package/skill/references/07-zero-defect-cross-discipline.md +63 -0
- package/skill/references/languages/csharp.md +86 -0
- package/skill/references/languages/python.md +77 -0
- package/skill/references/languages/rust.md +82 -0
- package/skill/references/languages/typescript.md +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 a1ter-nate
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,153 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Veristack (`vstack`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Replace test theater and silent regressions with deterministic verification gates.**
|
|
4
|
+
Warning, veristack is "slop" :)
|
|
5
|
+
|
|
6
|
+
Veristack is a deterministic **9-rung verification ladder (`R0 → R8`)**, cross-language static and invariant analyzer (`vstack`), native linter/analyzer kit, runnable formal proof suite (including **Bend 2**), and portable agent skill for **TypeScript/JS, C#/.NET, Rust, Python, Go, SQL, and Shell**.
|
|
7
|
+
|
|
8
|
+
> **Core rule:** Push every check as far down the ladder toward `R0` as possible while keeping the real failure mechanism intact. Checks run faster, flake masking disappears, and coding agents spend fewer tokens repairing broken code.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## The Problem It Solves
|
|
13
|
+
|
|
14
|
+
AI-assisted repositories fail in three recurring ways:
|
|
15
|
+
|
|
16
|
+
1. **Test theater:** heavily mocked unit tests and slow E2E suites that mirror buggy implementations, pass when behavior breaks, and hide failures behind `retries: 3`, `|| true`, or `continue-on-error: true`.
|
|
17
|
+
2. **Defects by omission:** boolean flag soup admitting impossible states, wall-clock duration math, release-stripped production assertions, unchecked slices, and swallowed errors.
|
|
18
|
+
3. **Silent invariant loss:** an agent fixes one issue while quietly deleting an earlier null guard, bounds check, `try/finally` cleanup, or comparison clause.
|
|
19
|
+
|
|
20
|
+
Veristack converts practices from software engineering, Lean/Toyota production systems, silicon verification, and safety-critical software into fast, repeatable CLI and CI gates.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## The 9-Rung Verification Ladder
|
|
25
|
+
|
|
26
|
+
Every check belongs on the lowest rung that still catches the defect:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
R0 Static Locks, Anti-Slop & Anti-Cheat (< 2 s | 100% files)
|
|
30
|
+
R1 Types, Explicit State Machines & Structure (1–10 s | 100% files)
|
|
31
|
+
R2 Pure Logic, Data Tables, MC/DC & PBT (10ms–2s | 15–40 specs)
|
|
32
|
+
R3 Stateful MBT, Cross-Coverage, Host & Twins (0.2–5 s | 5–15 suites)
|
|
33
|
+
R4 Real Engines, Migrations, 1..N Faults & DST (2–30 s | 3–8 slices)
|
|
34
|
+
R5 Formal Proofs (Bend 2 / Quint / Stateright) (30s–15m | diff/nightly)
|
|
35
|
+
R6 Empirical Big-O, SPC Drift, RTY & Load (2–30 m | 1–2 / svc)
|
|
36
|
+
R7 Thin Golden-Path E2E & Hardware Proof (2–15 m | 5–15 MAX)
|
|
37
|
+
R8 Live Production Verification & Boot BIST (Always | 3–10 probes)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
Runs on **Node.js `>= 18`** or **[Bun](https://bun.sh) `>= 1.2.0`** via npm, pnpm, or Bun. Optional native toolchains (`dotnet`, `cargo`, `uv`, `go`, `bend`) verify their matching reference suites.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Run immediately with npx or bunx
|
|
48
|
+
npx veristack scan .
|
|
49
|
+
bunx veristack scan .
|
|
50
|
+
|
|
51
|
+
# Or install as a dev dependency in your repo
|
|
52
|
+
npm install -D veristack # or: pnpm add -D veristack / bun add -d veristack
|
|
53
|
+
npx vstack scan . --json # Machine-readable report for coding agents
|
|
54
|
+
npx vstack diff-cheats . --base origin/main --fail
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Run `npx veristack --help` (or `vstack --help`) for the complete command and flag list. From a local clone, run `bun run check` to self-verify Veristack.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Per-Repo Configuration (`.vstack.json`)
|
|
62
|
+
|
|
63
|
+
Teams can turn off style rules that conflict with an existing ADR, adjust severities, or ignore directories by adding `.vstack.json` (or `.verification/vstack.json`) at the repo root:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"rules": {
|
|
68
|
+
"no-comments": "off",
|
|
69
|
+
"max-file-lines": "off",
|
|
70
|
+
"long-file": "off",
|
|
71
|
+
"rust-prod-unwrap-or-expect": "warn"
|
|
72
|
+
},
|
|
73
|
+
"ignore": ["spikes/**"]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Once committed, `vstack diff-cheats` watches `.vstack.json` (and `.verification/invariants.json` / `.vstackignore`) so future PRs cannot quietly disable rules without human review. You can also pass `--config <file>` or `--disable rule1,rule2` for ad-hoc scans.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Multi-Language Coverage (7 Benchmarked Languages)
|
|
82
|
+
|
|
83
|
+
Every language below is covered by a living `caught/` vs `clean/` precision benchmark under [examples/](examples/README.md) (`vstack bench . --fail`: **196/196 recall, 0 clean FPs, 0 adversarial comment/string-wrapped FPs**):
|
|
84
|
+
|
|
85
|
+
| Language | Static & Native Enforcement (`R0`–`R1`) | Runnable Reference & Formal Proof (`R2`–`R5`) | Guide |
|
|
86
|
+
| :--- | :--- | :--- | :--- |
|
|
87
|
+
| **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) |
|
|
88
|
+
| **C# / .NET 10** | Roslyn [VStack.Analyzers](lint/csharp/VStack.Analyzers/) (`VSTACK001`–`VSTACK004`), `TreatWarningsAsErrors` | [templates/csharp-reference/](templates/csharp-reference/) (BFS formal proof, Dafny, `FsCheck`, `Stryker.NET`) | [csharp.md](skill/references/languages/csharp.md) |
|
|
89
|
+
| **Rust (2024)** | `unsafe_code = "forbid"`, Clippy `unwrap_used`/`expect_used`/`wildcard_enum_match_arm = "deny"`, `rust-prod-unwrap-or-expect` | [templates/rust-reference/](templates/rust-reference/) (`stateright` BFS, Kani, `proptest`, `cargo-mutants`) | [rust.md](skill/references/languages/rust.md) |
|
|
90
|
+
| **Python (3.12+)** | `ruff` strict + `S101` prod assert ban, `mypy --strict`, `assert_never` | [templates/python-reference/](templates/python-reference/) (`hypothesis` PBT/MBT, BFS formal check, `mutmut`) | [python.md](skill/references/languages/python.md) |
|
|
91
|
+
| **Go (1.23+)** | Concurrency/channel/UTF-8/path guards + [.golangci.yml](templates/go-reference/.golangci.yml) (`errcheck`, `bodyclose`, `gosec`, `exhaustive`, `bidichk`) | [templates/go-reference/](templates/go-reference/) (JSON transition table, `testing/quick` PBT + stateful MBT, `go test -race`) | [templates/go-reference/](templates/go-reference/order.go) |
|
|
92
|
+
| **SQL & Shell** | Postgres lock-timeout, RLS fail-open, `LIMIT` without `ORDER BY`, `= NULL`, `pkill -f`, argv secret & `PATH` guards | [examples/sql/](examples/sql/manifest.json), [examples/shell/](examples/shell/manifest.json) | [examples/README.md](examples/README.md) |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Invariant Detection & Mechanical Proofs
|
|
97
|
+
|
|
98
|
+
Static pattern rules alone catch known footguns, not broken domain invariants. Veristack combines four complementary invariant layers:
|
|
99
|
+
|
|
100
|
+
1. **Diff Invariant-Loss & AST Predicate Weakening (`vstack diff-cheats`):** Detects dropped null/bounds/error/cleanup/lock/timeout/auth guards (`diff-invariant-guard-dropped`) and stripped `if` branches, `&&`/`||` clauses, or `<=`/`>=`/`===` bounds (`diff-predicate-weakened`) when a PR removes protection without adding matching test assertions. On a 320-pair historical OSS bug-fix replay corpus (`vstack bench --replay`), this catches **58.1% (`186/320`)** combined (**56.3%** regression immunity, **312/320** regression-free).
|
|
101
|
+
2. **Repo-Wide Statistical Belief Mining (`vstack scan`):** Infers the codebase's own invariants across call sites (`>= 75%` adherence, `N >= 4`) to flag outlier omitted null checks (`invariant-deviant-null-check`), missing `finally`/`defer`/`with` cleanups (`invariant-deviant-paired-cleanup`), and unprotected sibling route handlers (`invariant-deviant-route-auth`).
|
|
102
|
+
3. **Bend 2 Universal Laws (`vstack laws --verify`):** Pairs a CODEOWNERS-locked [LAWS.bend](templates/bend2-reference/LAWS.bend) spec with [PROOF.bend](templates/bend2-reference/PROOF.bend) over [Model.bend](templates/bend2-reference/Model.bend) (idempotency, monotonic terminal states, total saturating math, zero-cap bounds, codec round-trip, and stack unwind), verified directly by `bend --check-only` (and `--verdict` with the Lean BendTT kernel when `$BENDTT` is set) alongside [.verification/laws/universal-laws.laws.json](.verification/laws/universal-laws.laws.json) across all 6 toolchains.
|
|
103
|
+
4. **Daikon-Style Dynamic Invariants (`vstack invariants`):** Infers runtime bounds, non-null, enum-domain, sorted-array, and relational (`result <= args.amount`) invariants from JSON execution traces, diffs them against a locked `.verification/invariants.json` baseline, and fails CI when a behavioral invariant breaks.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Key Capabilities & Gates
|
|
108
|
+
|
|
109
|
+
- **Anti-cheat & supply-chain locks:** catches `continue-on-error: true`, `|| true`, `--no-verify`, test skips/retries, unpinned third-party GitHub Actions, missing `permissions:`/`timeout-minutes`/`concurrency`, blanket suppressions, and stealth edits to `.vstack.json` / `.verification/invariants.json`.
|
|
110
|
+
- **Brownfield ratchets & choke points:** auto-shrinking `--ratchet` baselines for legacy adoption, `.verification/chokepoints.json` for project-specific banned primitives, and `vstack formal-sync` commit-drift checks.
|
|
111
|
+
- **Zero-defect engineering utilities:** `red-before-fix`, `mcdc` independence vectors, `spc` drift control charts, empirical `big-o` scaling fits, and 4 deterministic-first 90/10 BYO System 1 circuits (`vstack circuit list`).
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Portable Agent Skill
|
|
116
|
+
|
|
117
|
+
Install [skill/](skill/) into `~/.agents/skills/veristack` or `~/.claude/skills/veristack` so coding agents run `vstack scan . --json` before designing or refactoring verification suites:
|
|
118
|
+
|
|
119
|
+
- [skill/SKILL.md](skill/SKILL.md) — 9-rung ladder, shared vocabulary, and 4-phase workflow
|
|
120
|
+
- [skill/references/01-test-and-verification-index.md](skill/references/01-test-and-verification-index.md) — All 42 mechanisms (`V01`–`V42`)
|
|
121
|
+
- [skill/references/02-linter-and-antislop-stack.md](skill/references/02-linter-and-antislop-stack.md) — `R0`–`R1` linter architecture & ratchets
|
|
122
|
+
- [skill/references/03-pushdown-protocol-and-budgets.md](skill/references/03-pushdown-protocol-and-budgets.md) — Routing matrix, budgets & CI speed
|
|
123
|
+
- [skill/references/05-formal-verification.md](skill/references/05-formal-verification.md) — Formal verification playbook (`R5 / V25`)
|
|
124
|
+
- [skill/references/06-system1-circuits.md](skill/references/06-system1-circuits.md) — 90/10 BYO System 1 circuit runtime
|
|
125
|
+
- [skill/references/07-zero-defect-cross-discipline.md](skill/references/07-zero-defect-cross-discipline.md) — Lean, Silicon & Safety-Critical verification
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Local Verification Across All Toolchains
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
bun run check # TS/JS/Bun + self-scan + 110 tests
|
|
133
|
+
bun run test:laws # Bend 2 proofs + Go + Rust + Python + C# + TS law witnesses
|
|
134
|
+
bun run test:go # go vet + go test -race (table, PBT, stateful MBT)
|
|
135
|
+
bun run test:rust # rustfmt + clippy -D warnings + proptest + stateright
|
|
136
|
+
bun run test:python # ruff + mypy --strict + pytest + hypothesis
|
|
137
|
+
bun run test:csharp # Roslyn VStack.Analyzers + .NET 10 reference solution
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Attribution & Clean-Room Notice
|
|
143
|
+
|
|
144
|
+
Veristack is an original, from-scratch MIT implementation synthesizing ideas from open-source tooling and reliability literature:
|
|
145
|
+
|
|
146
|
+
- **Open-source inspiration:** [`deterministic-machines/deslop-please`](https://github.com/deterministic-machines/deslop-please), [`dmmulroy/anti-slop`](https://github.com/dmmulroy/anti-slop), [`@interfere/landmines`](https://github.com/interfere-inc/landmines), [`mattpocock/skills`](https://github.com/mattpocock/skills), [`cursor/plugins` (`pstack`)](https://github.com/cursor/plugins/tree/main/pstack), [`bendlang/bend`](https://github.com/bendlang/bend), [`antithesishq/bombadil`](https://github.com/antithesishq/bombadil), and [`tigerbeetle/tigerbeetle`](https://github.com/tigerbeetle/tigerbeetle) (`TIGER_STYLE.md`).
|
|
147
|
+
- **Research & literature:** Dawson Engler et al. (*Bugs as Deviant Behavior*, SOSP 2001), Michael Ernst et al. (*Daikon Dynamic Invariant Detection*), Matteo Vaccari (*Tests as Data*), John Ousterhout (*A Philosophy of Software Design*), Meta Engineering (*Just-in-Time Catching Test Generation*, `arXiv:2601.22832`), TypeSafe AI (JEV), Shopify Packwerk, Shigeo Shingo (*Poka-Yoke*), Toyota (*Jidoka* / *A3*), Shewhart (*SPC*), NASA JPL (*Power of 10*), DO-178C (*MC/DC*), SQLite (*TH3*), and seL4.
|
|
148
|
+
|
|
149
|
+
See [skill/references/04-source-patterns-digest.md](skill/references/04-source-patterns-digest.md) for the full traceability map.
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
[MIT](LICENSE) © 2026 [a1ter-nate](https://github.com/a1ter-nate)
|
package/bin/vstack.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const distCli = path.join(rootDir, "dist", "cli.mjs");
|
|
8
|
+
const srcCli = path.join(rootDir, "src", "cli.ts");
|
|
9
|
+
const entry = fs.existsSync(distCli) ? distCli : srcCli;
|
|
10
|
+
|
|
11
|
+
await import(pathToFileURL(entry).href);
|