@tayomi/deterministic-gates 0.0.0-stage → 0.3.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/.claude-plugin/marketplace.json +15 -0
- package/.claude-plugin/plugin.json +13 -0
- package/.codex-plugin/plugin.json +20 -0
- package/LICENSE +21 -0
- package/README.md +127 -2
- package/catalog/go.json +92 -0
- package/catalog/index.html +398 -0
- package/catalog/python.json +46 -0
- package/catalog/typescript.json +125 -0
- package/hooks/hooks.json +38 -0
- package/package.json +43 -4
- package/src/catalog/catalog.ts +168 -0
- package/src/cli.ts +53 -0
- package/src/core/check.ts +209 -0
- package/src/core/config.ts +225 -0
- package/src/core/json.ts +36 -0
- package/src/core/report-cache.ts +51 -0
- package/src/core/report.ts +159 -0
- package/src/core/run.ts +211 -0
- package/src/core/send-back.ts +96 -0
- package/src/core/snapshot.ts +105 -0
- package/src/core/turn-state.ts +153 -0
- package/src/helpers/new-clones.ts +58 -0
- package/src/helpers/new-suppressions.ts +44 -0
- package/src/helpers/related-tests.ts +118 -0
- package/src/helpers/test-reporter.ts +71 -0
- package/src/hook/hook.ts +144 -0
- package/src/testing.ts +39 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Gate catalog</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root { --bg: #fafaf9; --panel: #ffffff; --text: #1c1917; --muted: #57534e; --line: #e7e5e4; --code: #f5f5f4;
|
|
9
|
+
--link: #1d4ed8; }
|
|
10
|
+
@media (prefers-color-scheme: dark) {
|
|
11
|
+
:root { --bg: #1c1917; --panel: #262321; --text: #f5f5f4; --muted: #a8a29e; --line: #3f3a36; --code: #2f2a27;
|
|
12
|
+
--link: #93c5fd; }
|
|
13
|
+
}
|
|
14
|
+
* { box-sizing: border-box; }
|
|
15
|
+
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, sans-serif; }
|
|
16
|
+
main { max-width: 860px; margin: 0 auto; padding: 32px 16px 64px; }
|
|
17
|
+
h1 { margin: 0 0 8px; font-size: 1.9rem; }
|
|
18
|
+
h2 { margin: 48px 0 4px; font-size: 1.4rem; }
|
|
19
|
+
h3 { margin: 0; font-size: 1rem; }
|
|
20
|
+
p, dd, li { color: var(--muted); }
|
|
21
|
+
a { color: var(--link); }
|
|
22
|
+
nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
|
|
23
|
+
nav a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
|
|
24
|
+
article { margin: 16px 0; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
|
|
25
|
+
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0; }
|
|
26
|
+
dt { font-weight: 600; }
|
|
27
|
+
dd { margin: 0; min-width: 0; }
|
|
28
|
+
dd ul { margin: 0; padding-left: 18px; }
|
|
29
|
+
code { font: 0.88em/1.4 ui-monospace, monospace; background: var(--code); padding: 1px 5px; border-radius: 4px;
|
|
30
|
+
overflow-wrap: anywhere; }
|
|
31
|
+
pre { overflow-x: auto; background: var(--code); padding: 12px; border-radius: 8px; }
|
|
32
|
+
pre code { padding: 0; }
|
|
33
|
+
summary { cursor: pointer; color: var(--muted); }
|
|
34
|
+
@media (max-width: 560px) { dl { grid-template-columns: 1fr; } dd { margin-bottom: 8px; } }
|
|
35
|
+
</style>
|
|
36
|
+
</head>
|
|
37
|
+
<body>
|
|
38
|
+
<main>
|
|
39
|
+
<header>
|
|
40
|
+
<h1>Gate catalog</h1>
|
|
41
|
+
<p>The gates worth copying into a repo. Nothing here runs by itself: the engine reads only the repo's <code>.gates.json</code>. Copy the definition of a gate there, install what it requires, and adapt its <code>files</code> to the layout of the repo.</p>
|
|
42
|
+
<p>Generated from <code>catalog/*.json</code> by <code>pnpm catalog</code>: edit those files, never this page.</p>
|
|
43
|
+
<nav><a href="#go">Go (6)</a><a href="#python">Python (3)</a><a href="#typescript">TypeScript (8)</a></nav>
|
|
44
|
+
</header>
|
|
45
|
+
<section id="go">
|
|
46
|
+
<h2>Go</h2>
|
|
47
|
+
<p>Gates for a Go module. The toolchain comes from the PATH. The first build of a cold cache is slow, which is why these gates allow 60 seconds.</p>
|
|
48
|
+
<article id="go/build">
|
|
49
|
+
<h3><code>go/build</code></h3>
|
|
50
|
+
<p>Builds every package of the module.</p>
|
|
51
|
+
<dl>
|
|
52
|
+
<dt>Runs</dt><dd><code>go build ./...</code></dd>
|
|
53
|
+
<dt>When the turn changes</dt><dd><code>(\.go|(^|/)go\.(mod|sum))$</code></dd>
|
|
54
|
+
<dt>Requires</dt><dd><ul><li><code>go</code>: <a href="https://go.dev/doc/install">https://go.dev/doc/install</a></li></ul></dd>
|
|
55
|
+
</dl>
|
|
56
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
57
|
+
"name": "build",
|
|
58
|
+
"severity": "error",
|
|
59
|
+
"files": "(\\.go|(^|/)go\\.(mod|sum))$",
|
|
60
|
+
"run": [
|
|
61
|
+
"go",
|
|
62
|
+
"build",
|
|
63
|
+
"./..."
|
|
64
|
+
]
|
|
65
|
+
}</code></pre></details>
|
|
66
|
+
</article>
|
|
67
|
+
<article id="go/vet">
|
|
68
|
+
<h3><code>go/vet</code></h3>
|
|
69
|
+
<p>Runs go vet on every package: the suspicious constructs the compiler accepts.</p>
|
|
70
|
+
<dl>
|
|
71
|
+
<dt>Runs</dt><dd><code>go vet ./...</code></dd>
|
|
72
|
+
<dt>When the turn changes</dt><dd><code>(\.go|(^|/)go\.(mod|sum))$</code></dd>
|
|
73
|
+
<dt>Requires</dt><dd><ul><li><code>go</code>: <a href="https://go.dev/doc/install">https://go.dev/doc/install</a></li></ul></dd>
|
|
74
|
+
</dl>
|
|
75
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
76
|
+
"name": "vet",
|
|
77
|
+
"severity": "error",
|
|
78
|
+
"files": "(\\.go|(^|/)go\\.(mod|sum))$",
|
|
79
|
+
"run": [
|
|
80
|
+
"go",
|
|
81
|
+
"vet",
|
|
82
|
+
"./..."
|
|
83
|
+
]
|
|
84
|
+
}</code></pre></details>
|
|
85
|
+
</article>
|
|
86
|
+
<article id="go/format">
|
|
87
|
+
<h3><code>go/format</code></h3>
|
|
88
|
+
<p>Fails on the files the turn left unformatted. gofmt -l lists them and exits with 0, so the gate compares its list with the one as the turn started.</p>
|
|
89
|
+
<dl>
|
|
90
|
+
<dt>Runs</dt><dd><code>gofmt -l .</code></dd>
|
|
91
|
+
<dt>When the turn changes</dt><dd><code>\.go$</code></dd>
|
|
92
|
+
<dt>Fails on</dt><dd>only the output lines the turn added</dd><dt>Requires</dt><dd><ul><li><code>gofmt</code>: comes with Go: <a href="https://go.dev/doc/install">https://go.dev/doc/install</a></li></ul></dd>
|
|
93
|
+
</dl>
|
|
94
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
95
|
+
"name": "format",
|
|
96
|
+
"severity": "error",
|
|
97
|
+
"files": "\\.go$",
|
|
98
|
+
"run": [
|
|
99
|
+
"gofmt",
|
|
100
|
+
"-l",
|
|
101
|
+
"."
|
|
102
|
+
],
|
|
103
|
+
"compare": "turn-start"
|
|
104
|
+
}</code></pre></details>
|
|
105
|
+
</article>
|
|
106
|
+
<article id="go/test">
|
|
107
|
+
<h3><code>go/test</code></h3>
|
|
108
|
+
<p>Runs the tests of every package. Go caches the result of a package that did not change, so only the packages the turn touched run again.</p>
|
|
109
|
+
<dl>
|
|
110
|
+
<dt>Runs</dt><dd><code>go test ./...</code></dd>
|
|
111
|
+
<dt>When the turn changes</dt><dd><code>(\.go|(^|/)go\.(mod|sum))$</code></dd>
|
|
112
|
+
<dt>Requires</dt><dd><ul><li><code>go</code>: <a href="https://go.dev/doc/install">https://go.dev/doc/install</a></li></ul></dd>
|
|
113
|
+
</dl>
|
|
114
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
115
|
+
"name": "test",
|
|
116
|
+
"severity": "error",
|
|
117
|
+
"files": "(\\.go|(^|/)go\\.(mod|sum))$",
|
|
118
|
+
"run": [
|
|
119
|
+
"go",
|
|
120
|
+
"test",
|
|
121
|
+
"./..."
|
|
122
|
+
]
|
|
123
|
+
}</code></pre></details>
|
|
124
|
+
</article>
|
|
125
|
+
<article id="go/lint">
|
|
126
|
+
<h3><code>go/lint</code></h3>
|
|
127
|
+
<p>Lints with golangci-lint, and reports only the issues created since the turn started (--new-from-rev).</p>
|
|
128
|
+
<dl>
|
|
129
|
+
<dt>Runs</dt><dd><code>golangci-lint run --new-from-rev {turn}</code></dd>
|
|
130
|
+
<dt>When the turn changes</dt><dd><code>\.go$</code></dd>
|
|
131
|
+
<dt>Requires</dt><dd><ul><li><code>golangci-lint</code>: <a href="https://golangci-lint.run/docs/welcome/install/">https://golangci-lint.run/docs/welcome/install/</a></li></ul></dd>
|
|
132
|
+
</dl>
|
|
133
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
134
|
+
"name": "lint",
|
|
135
|
+
"severity": "error",
|
|
136
|
+
"files": "\\.go$",
|
|
137
|
+
"run": [
|
|
138
|
+
"golangci-lint",
|
|
139
|
+
"run",
|
|
140
|
+
"--new-from-rev",
|
|
141
|
+
"{turn}"
|
|
142
|
+
]
|
|
143
|
+
}</code></pre></details>
|
|
144
|
+
</article>
|
|
145
|
+
<article id="go/no-new-suppressions">
|
|
146
|
+
<h3><code>go/no-new-suppressions</code></h3>
|
|
147
|
+
<p>Fails on the rule suppressions the turn added, never on the ones already there: nolint and go:nolint. The cheapest green is to silence the rule, and this is the gate that refuses it.</p>
|
|
148
|
+
<dl>
|
|
149
|
+
<dt>Runs</dt><dd><code>{engine}/src/helpers/new-suppressions.ts {turn} {files}</code></dd>
|
|
150
|
+
<dt>When the turn changes</dt><dd><code>\.go$</code></dd>
|
|
151
|
+
<dt>Requires</dt><dd><ul></ul></dd>
|
|
152
|
+
</dl>
|
|
153
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
154
|
+
"name": "no-new-suppressions",
|
|
155
|
+
"severity": "error",
|
|
156
|
+
"files": "\\.go$",
|
|
157
|
+
"run": [
|
|
158
|
+
"{engine}/src/helpers/new-suppressions.ts",
|
|
159
|
+
"{turn}",
|
|
160
|
+
"{files}"
|
|
161
|
+
]
|
|
162
|
+
}</code></pre></details>
|
|
163
|
+
</article>
|
|
164
|
+
</section>
|
|
165
|
+
<section id="python">
|
|
166
|
+
<h2>Python</h2>
|
|
167
|
+
<p>Gates for Python files, such as the scripts of skills. Ruff comes from the PATH. In a project managed by uv, write uv run ruff instead, to run the version the project pins.</p>
|
|
168
|
+
<article id="python/lint">
|
|
169
|
+
<h3><code>python/lint</code></h3>
|
|
170
|
+
<p>Lints the changed files with Ruff.</p>
|
|
171
|
+
<dl>
|
|
172
|
+
<dt>Runs</dt><dd><code>ruff check {files}</code></dd>
|
|
173
|
+
<dt>When the turn changes</dt><dd><code>\.py$</code></dd>
|
|
174
|
+
<dt>Requires</dt><dd><ul><li><code>ruff</code>: uv tool install ruff, pipx install ruff, or brew install ruff</li></ul></dd>
|
|
175
|
+
</dl>
|
|
176
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
177
|
+
"name": "lint",
|
|
178
|
+
"severity": "error",
|
|
179
|
+
"files": "\\.py$",
|
|
180
|
+
"run": [
|
|
181
|
+
"ruff",
|
|
182
|
+
"check",
|
|
183
|
+
"{files}"
|
|
184
|
+
]
|
|
185
|
+
}</code></pre></details>
|
|
186
|
+
</article>
|
|
187
|
+
<article id="python/format">
|
|
188
|
+
<h3><code>python/format</code></h3>
|
|
189
|
+
<p>Checks that the Ruff formatter leaves the changed files as they are.</p>
|
|
190
|
+
<dl>
|
|
191
|
+
<dt>Runs</dt><dd><code>ruff format --check {files}</code></dd>
|
|
192
|
+
<dt>When the turn changes</dt><dd><code>\.py$</code></dd>
|
|
193
|
+
<dt>Requires</dt><dd><ul><li><code>ruff</code>: uv tool install ruff, pipx install ruff, or brew install ruff</li></ul></dd>
|
|
194
|
+
</dl>
|
|
195
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
196
|
+
"name": "format",
|
|
197
|
+
"severity": "error",
|
|
198
|
+
"files": "\\.py$",
|
|
199
|
+
"run": [
|
|
200
|
+
"ruff",
|
|
201
|
+
"format",
|
|
202
|
+
"--check",
|
|
203
|
+
"{files}"
|
|
204
|
+
]
|
|
205
|
+
}</code></pre></details>
|
|
206
|
+
</article>
|
|
207
|
+
<article id="python/no-new-suppressions">
|
|
208
|
+
<h3><code>python/no-new-suppressions</code></h3>
|
|
209
|
+
<p>Fails on the rule suppressions the turn added, never on the ones already there: noqa, type: ignore, pylint: disable, fmt: off, nosec, no cover. The cheapest green is to silence the rule, and this is the gate that refuses it.</p>
|
|
210
|
+
<dl>
|
|
211
|
+
<dt>Runs</dt><dd><code>{engine}/src/helpers/new-suppressions.ts {turn} {files}</code></dd>
|
|
212
|
+
<dt>When the turn changes</dt><dd><code>\.py$</code></dd>
|
|
213
|
+
<dt>Requires</dt><dd><ul></ul></dd>
|
|
214
|
+
</dl>
|
|
215
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
216
|
+
"name": "no-new-suppressions",
|
|
217
|
+
"severity": "error",
|
|
218
|
+
"files": "\\.py$",
|
|
219
|
+
"run": [
|
|
220
|
+
"{engine}/src/helpers/new-suppressions.ts",
|
|
221
|
+
"{turn}",
|
|
222
|
+
"{files}"
|
|
223
|
+
]
|
|
224
|
+
}</code></pre></details>
|
|
225
|
+
</article>
|
|
226
|
+
</section>
|
|
227
|
+
<section id="typescript">
|
|
228
|
+
<h2>TypeScript</h2>
|
|
229
|
+
<p>Gates for a TypeScript or JavaScript repo. Each tool comes from the repo's node_modules, so its version is the one the lockfile pins.</p>
|
|
230
|
+
<article id="typescript/lint">
|
|
231
|
+
<h3><code>typescript/lint</code></h3>
|
|
232
|
+
<p>Lints the changed files with ESLint, warnings included: a warning nobody is sent back for is never fixed.</p>
|
|
233
|
+
<dl>
|
|
234
|
+
<dt>Runs</dt><dd><code>eslint --max-warnings 0 --no-warn-ignored {files}</code></dd>
|
|
235
|
+
<dt>When the turn changes</dt><dd><code>\.(ts|tsx|js|mjs)$</code></dd>
|
|
236
|
+
<dt>Requires</dt><dd><ul><li><code>eslint</code>: npm install --save-dev eslint</li></ul></dd>
|
|
237
|
+
</dl>
|
|
238
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
239
|
+
"name": "lint",
|
|
240
|
+
"severity": "error",
|
|
241
|
+
"files": "\\.(ts|tsx|js|mjs)$",
|
|
242
|
+
"run": [
|
|
243
|
+
"eslint",
|
|
244
|
+
"--max-warnings",
|
|
245
|
+
"0",
|
|
246
|
+
"--no-warn-ignored",
|
|
247
|
+
"{files}"
|
|
248
|
+
]
|
|
249
|
+
}</code></pre></details>
|
|
250
|
+
</article>
|
|
251
|
+
<article id="typescript/typecheck">
|
|
252
|
+
<h3><code>typescript/typecheck</code></h3>
|
|
253
|
+
<p>Type-checks the project with tsc, since a change in one file can break the types of another. Incremental: tsc keeps what it learnt under node_modules/.cache and re-checks only what the changed files reach.</p>
|
|
254
|
+
<dl>
|
|
255
|
+
<dt>Runs</dt><dd><code>typescript --pretty false --incremental --tsBuildInfoFile node_modules/.cache/gates/tsbuildinfo</code></dd>
|
|
256
|
+
<dt>When the turn changes</dt><dd><code>(\.(ts|tsx)|^tsconfig\.json)$</code></dd>
|
|
257
|
+
<dt>Requires</dt><dd><ul><li><code>typescript</code>: npm install --save-dev typescript</li></ul></dd>
|
|
258
|
+
</dl>
|
|
259
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
260
|
+
"name": "typecheck",
|
|
261
|
+
"severity": "error",
|
|
262
|
+
"files": "(\\.(ts|tsx)|^tsconfig\\.json)$",
|
|
263
|
+
"run": [
|
|
264
|
+
"typescript",
|
|
265
|
+
"--pretty",
|
|
266
|
+
"false",
|
|
267
|
+
"--incremental",
|
|
268
|
+
"--tsBuildInfoFile",
|
|
269
|
+
"node_modules/.cache/gates/tsbuildinfo"
|
|
270
|
+
]
|
|
271
|
+
}</code></pre></details>
|
|
272
|
+
</article>
|
|
273
|
+
<article id="typescript/format">
|
|
274
|
+
<h3><code>typescript/format</code></h3>
|
|
275
|
+
<p>Checks that Prettier leaves the changed files as they are.</p>
|
|
276
|
+
<dl>
|
|
277
|
+
<dt>Runs</dt><dd><code>prettier --check --log-level warn --no-error-on-unmatched-pattern {files}</code></dd>
|
|
278
|
+
<dt>When the turn changes</dt><dd><code>\.(ts|tsx|js|mjs|json|md|css|ya?ml)$</code></dd>
|
|
279
|
+
<dt>Requires</dt><dd><ul><li><code>prettier</code>: npm install --save-dev prettier</li></ul></dd>
|
|
280
|
+
</dl>
|
|
281
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
282
|
+
"name": "format",
|
|
283
|
+
"severity": "error",
|
|
284
|
+
"files": "\\.(ts|tsx|js|mjs|json|md|css|ya?ml)$",
|
|
285
|
+
"run": [
|
|
286
|
+
"prettier",
|
|
287
|
+
"--check",
|
|
288
|
+
"--log-level",
|
|
289
|
+
"warn",
|
|
290
|
+
"--no-error-on-unmatched-pattern",
|
|
291
|
+
"{files}"
|
|
292
|
+
]
|
|
293
|
+
}</code></pre></details>
|
|
294
|
+
</article>
|
|
295
|
+
<article id="typescript/related-tests">
|
|
296
|
+
<h3><code>typescript/related-tests</code></h3>
|
|
297
|
+
<p>Runs only the Vitest tests that import a changed file, directly or not.</p>
|
|
298
|
+
<dl>
|
|
299
|
+
<dt>Runs</dt><dd><code>vitest related --run --passWithNoTests --reporter=minimal {files}</code></dd>
|
|
300
|
+
<dt>When the turn changes</dt><dd><code>\.(ts|tsx)$</code></dd>
|
|
301
|
+
<dt>Requires</dt><dd><ul><li><code>vitest</code>: npm install --save-dev vitest</li></ul></dd>
|
|
302
|
+
</dl>
|
|
303
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
304
|
+
"name": "related-tests",
|
|
305
|
+
"severity": "error",
|
|
306
|
+
"files": "\\.(ts|tsx)$",
|
|
307
|
+
"run": [
|
|
308
|
+
"vitest",
|
|
309
|
+
"related",
|
|
310
|
+
"--run",
|
|
311
|
+
"--passWithNoTests",
|
|
312
|
+
"--reporter=minimal",
|
|
313
|
+
"{files}"
|
|
314
|
+
]
|
|
315
|
+
}</code></pre></details>
|
|
316
|
+
</article>
|
|
317
|
+
<article id="typescript/related-node-tests">
|
|
318
|
+
<h3><code>typescript/related-node-tests</code></h3>
|
|
319
|
+
<p>Runs only the node:test tests that import a changed file, directly or not, for a repo that tests with Node itself. Node has no related mode: the helper follows the imports. It finds the tests by Node's own naming; --tests <regex> narrows it, and --require-tests also fails on a changed file no test reaches, which the related tests alone pass in silence.</p>
|
|
320
|
+
<dl>
|
|
321
|
+
<dt>Runs</dt><dd><code>{engine}/src/helpers/related-tests.ts {files}</code></dd>
|
|
322
|
+
<dt>When the turn changes</dt><dd><code>\.(ts|mts|cts|js|mjs|cjs)$</code></dd>
|
|
323
|
+
<dt>Requires</dt><dd><ul></ul></dd>
|
|
324
|
+
</dl>
|
|
325
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
326
|
+
"name": "related-node-tests",
|
|
327
|
+
"severity": "error",
|
|
328
|
+
"files": "\\.(ts|mts|cts|js|mjs|cjs)$",
|
|
329
|
+
"run": [
|
|
330
|
+
"{engine}/src/helpers/related-tests.ts",
|
|
331
|
+
"{files}"
|
|
332
|
+
]
|
|
333
|
+
}</code></pre></details>
|
|
334
|
+
</article>
|
|
335
|
+
<article id="typescript/no-new-clones">
|
|
336
|
+
<h3><code>typescript/no-new-clones</code></h3>
|
|
337
|
+
<p>Fails on the copy-pasted blocks the turn added, never on the ones already there. An agent that misses an existing helper writes a second one, and the two drift apart.</p>
|
|
338
|
+
<dl>
|
|
339
|
+
<dt>Runs</dt><dd><code>{engine}/src/helpers/new-clones.ts {turn}</code></dd>
|
|
340
|
+
<dt>When the turn changes</dt><dd><code>\.(ts|tsx)$</code></dd>
|
|
341
|
+
<dt>Requires</dt><dd><ul><li><code>jscpd</code>: npm install --save-dev jscpd</li></ul></dd>
|
|
342
|
+
</dl>
|
|
343
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
344
|
+
"name": "no-new-clones",
|
|
345
|
+
"severity": "error",
|
|
346
|
+
"files": "\\.(ts|tsx)$",
|
|
347
|
+
"run": [
|
|
348
|
+
"{engine}/src/helpers/new-clones.ts",
|
|
349
|
+
"{turn}"
|
|
350
|
+
]
|
|
351
|
+
}</code></pre></details>
|
|
352
|
+
</article>
|
|
353
|
+
<article id="typescript/no-new-dead-code">
|
|
354
|
+
<h3><code>typescript/no-new-dead-code</code></h3>
|
|
355
|
+
<p>Fails on the unused files, exports and dependencies the turn added, never on the ones already there, so it works on a repo that already has some.</p>
|
|
356
|
+
<dl>
|
|
357
|
+
<dt>Runs</dt><dd><code>knip --reporter compact --no-exit-code --no-progress</code></dd>
|
|
358
|
+
<dt>When the turn changes</dt><dd><code>(\.(ts|tsx)|^package\.json|^knip\.json)$</code></dd>
|
|
359
|
+
<dt>Fails on</dt><dd>only the output lines the turn added</dd><dt>Requires</dt><dd><ul><li><code>knip</code>: npm install --save-dev knip</li></ul></dd>
|
|
360
|
+
</dl>
|
|
361
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
362
|
+
"name": "no-new-dead-code",
|
|
363
|
+
"severity": "error",
|
|
364
|
+
"files": "(\\.(ts|tsx)|^package\\.json|^knip\\.json)$",
|
|
365
|
+
"run": [
|
|
366
|
+
"knip",
|
|
367
|
+
"--reporter",
|
|
368
|
+
"compact",
|
|
369
|
+
"--no-exit-code",
|
|
370
|
+
"--no-progress"
|
|
371
|
+
],
|
|
372
|
+
"compare": "turn-start",
|
|
373
|
+
"ignoreLines": "\\(\\d+\\)$"
|
|
374
|
+
}</code></pre></details>
|
|
375
|
+
</article>
|
|
376
|
+
<article id="typescript/no-new-suppressions">
|
|
377
|
+
<h3><code>typescript/no-new-suppressions</code></h3>
|
|
378
|
+
<p>Fails on the rule suppressions the turn added, never on the ones already there: eslint-disable, @ts-ignore, @ts-expect-error, @ts-nocheck, prettier-ignore, biome-ignore. The cheapest green is to silence the rule, and this is the gate that refuses it.</p>
|
|
379
|
+
<dl>
|
|
380
|
+
<dt>Runs</dt><dd><code>{engine}/src/helpers/new-suppressions.ts {turn} {files}</code></dd>
|
|
381
|
+
<dt>When the turn changes</dt><dd><code>\.(ts|tsx|js|jsx|mjs|cjs)$</code></dd>
|
|
382
|
+
<dt>Requires</dt><dd><ul></ul></dd>
|
|
383
|
+
</dl>
|
|
384
|
+
<details><summary>Definition to copy into .gates.json</summary><pre><code>{
|
|
385
|
+
"name": "no-new-suppressions",
|
|
386
|
+
"severity": "error",
|
|
387
|
+
"files": "\\.(ts|tsx|js|jsx|mjs|cjs)$",
|
|
388
|
+
"run": [
|
|
389
|
+
"{engine}/src/helpers/new-suppressions.ts",
|
|
390
|
+
"{turn}",
|
|
391
|
+
"{files}"
|
|
392
|
+
]
|
|
393
|
+
}</code></pre></details>
|
|
394
|
+
</article>
|
|
395
|
+
</section>
|
|
396
|
+
</main>
|
|
397
|
+
</body>
|
|
398
|
+
</html>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Python",
|
|
3
|
+
"description": "Gates for Python files, such as the scripts of skills. Ruff comes from the PATH. In a project managed by uv, write uv run ruff instead, to run the version the project pins.",
|
|
4
|
+
"gates": [
|
|
5
|
+
{
|
|
6
|
+
"description": "Lints the changed files with Ruff.",
|
|
7
|
+
"requires": [
|
|
8
|
+
{
|
|
9
|
+
"tool": "ruff",
|
|
10
|
+
"install": "uv tool install ruff, pipx install ruff, or brew install ruff"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"gate": {
|
|
14
|
+
"name": "lint",
|
|
15
|
+
"severity": "error",
|
|
16
|
+
"files": "\\.py$",
|
|
17
|
+
"run": ["ruff", "check", "{files}"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"description": "Checks that the Ruff formatter leaves the changed files as they are.",
|
|
22
|
+
"requires": [
|
|
23
|
+
{
|
|
24
|
+
"tool": "ruff",
|
|
25
|
+
"install": "uv tool install ruff, pipx install ruff, or brew install ruff"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"gate": {
|
|
29
|
+
"name": "format",
|
|
30
|
+
"severity": "error",
|
|
31
|
+
"files": "\\.py$",
|
|
32
|
+
"run": ["ruff", "format", "--check", "{files}"]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"description": "Fails on the rule suppressions the turn added, never on the ones already there: noqa, type: ignore, pylint: disable, fmt: off, nosec, no cover. The cheapest green is to silence the rule, and this is the gate that refuses it.",
|
|
37
|
+
"requires": [],
|
|
38
|
+
"gate": {
|
|
39
|
+
"name": "no-new-suppressions",
|
|
40
|
+
"severity": "error",
|
|
41
|
+
"files": "\\.py$",
|
|
42
|
+
"run": ["{engine}/src/helpers/new-suppressions.ts", "{turn}", "{files}"]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "TypeScript",
|
|
3
|
+
"description": "Gates for a TypeScript or JavaScript repo. Each tool comes from the repo's node_modules, so its version is the one the lockfile pins.",
|
|
4
|
+
"gates": [
|
|
5
|
+
{
|
|
6
|
+
"description": "Lints the changed files with ESLint, warnings included: a warning nobody is sent back for is never fixed.",
|
|
7
|
+
"requires": [
|
|
8
|
+
{
|
|
9
|
+
"tool": "eslint",
|
|
10
|
+
"install": "npm install --save-dev eslint"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"gate": {
|
|
14
|
+
"name": "lint",
|
|
15
|
+
"severity": "error",
|
|
16
|
+
"files": "\\.(ts|tsx|js|mjs)$",
|
|
17
|
+
"run": ["eslint", "--max-warnings", "0", "--no-warn-ignored", "{files}"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"description": "Type-checks the project with tsc, since a change in one file can break the types of another. Incremental: tsc keeps what it learnt under node_modules/.cache and re-checks only what the changed files reach.",
|
|
22
|
+
"requires": [
|
|
23
|
+
{
|
|
24
|
+
"tool": "typescript",
|
|
25
|
+
"install": "npm install --save-dev typescript"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"gate": {
|
|
29
|
+
"name": "typecheck",
|
|
30
|
+
"severity": "error",
|
|
31
|
+
"files": "(\\.(ts|tsx)|^tsconfig\\.json)$",
|
|
32
|
+
"run": [
|
|
33
|
+
"typescript",
|
|
34
|
+
"--pretty",
|
|
35
|
+
"false",
|
|
36
|
+
"--incremental",
|
|
37
|
+
"--tsBuildInfoFile",
|
|
38
|
+
"node_modules/.cache/gates/tsbuildinfo"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"description": "Checks that Prettier leaves the changed files as they are.",
|
|
44
|
+
"requires": [
|
|
45
|
+
{
|
|
46
|
+
"tool": "prettier",
|
|
47
|
+
"install": "npm install --save-dev prettier"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"gate": {
|
|
51
|
+
"name": "format",
|
|
52
|
+
"severity": "error",
|
|
53
|
+
"files": "\\.(ts|tsx|js|mjs|json|md|css|ya?ml)$",
|
|
54
|
+
"run": ["prettier", "--check", "--log-level", "warn", "--no-error-on-unmatched-pattern", "{files}"]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"description": "Runs only the Vitest tests that import a changed file, directly or not.",
|
|
59
|
+
"requires": [
|
|
60
|
+
{
|
|
61
|
+
"tool": "vitest",
|
|
62
|
+
"install": "npm install --save-dev vitest"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"gate": {
|
|
66
|
+
"name": "related-tests",
|
|
67
|
+
"severity": "error",
|
|
68
|
+
"files": "\\.(ts|tsx)$",
|
|
69
|
+
"run": ["vitest", "related", "--run", "--passWithNoTests", "--reporter=minimal", "{files}"]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"description": "Runs only the node:test tests that import a changed file, directly or not, for a repo that tests with Node itself. Node has no related mode: the helper follows the imports. It finds the tests by Node's own naming; --tests <regex> narrows it, and --require-tests also fails on a changed file no test reaches, which the related tests alone pass in silence.",
|
|
74
|
+
"requires": [],
|
|
75
|
+
"gate": {
|
|
76
|
+
"name": "related-node-tests",
|
|
77
|
+
"severity": "error",
|
|
78
|
+
"files": "\\.(ts|mts|cts|js|mjs|cjs)$",
|
|
79
|
+
"run": ["{engine}/src/helpers/related-tests.ts", "{files}"]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"description": "Fails on the copy-pasted blocks the turn added, never on the ones already there. An agent that misses an existing helper writes a second one, and the two drift apart.",
|
|
84
|
+
"requires": [
|
|
85
|
+
{
|
|
86
|
+
"tool": "jscpd",
|
|
87
|
+
"install": "npm install --save-dev jscpd"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"gate": {
|
|
91
|
+
"name": "no-new-clones",
|
|
92
|
+
"severity": "error",
|
|
93
|
+
"files": "\\.(ts|tsx)$",
|
|
94
|
+
"run": ["{engine}/src/helpers/new-clones.ts", "{turn}"]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"description": "Fails on the unused files, exports and dependencies the turn added, never on the ones already there, so it works on a repo that already has some.",
|
|
99
|
+
"requires": [
|
|
100
|
+
{
|
|
101
|
+
"tool": "knip",
|
|
102
|
+
"install": "npm install --save-dev knip"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"gate": {
|
|
106
|
+
"name": "no-new-dead-code",
|
|
107
|
+
"severity": "error",
|
|
108
|
+
"files": "(\\.(ts|tsx)|^package\\.json|^knip\\.json)$",
|
|
109
|
+
"run": ["knip", "--reporter", "compact", "--no-exit-code", "--no-progress"],
|
|
110
|
+
"compare": "turn-start",
|
|
111
|
+
"ignoreLines": "\\(\\d+\\)$"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"description": "Fails on the rule suppressions the turn added, never on the ones already there: eslint-disable, @ts-ignore, @ts-expect-error, @ts-nocheck, prettier-ignore, biome-ignore. The cheapest green is to silence the rule, and this is the gate that refuses it.",
|
|
116
|
+
"requires": [],
|
|
117
|
+
"gate": {
|
|
118
|
+
"name": "no-new-suppressions",
|
|
119
|
+
"severity": "error",
|
|
120
|
+
"files": "\\.(ts|tsx|js|jsx|mjs|cjs)$",
|
|
121
|
+
"run": ["{engine}/src/helpers/new-suppressions.ts", "{turn}", "{files}"]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Run the deterministic gates on what each turn changed, and send the agent back until they pass",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/src/cli.ts\" hook session-start",
|
|
10
|
+
"timeout": 10
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"UserPromptSubmit": [
|
|
16
|
+
{
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/src/cli.ts\" hook turn-start",
|
|
21
|
+
"timeout": 60
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"Stop": [
|
|
27
|
+
{
|
|
28
|
+
"hooks": [
|
|
29
|
+
{
|
|
30
|
+
"type": "command",
|
|
31
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/src/cli.ts\" hook check",
|
|
32
|
+
"timeout": 300
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tayomi/deterministic-gates",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Deterministic backpressure for coding agents: gates that run on what each turn changed and send the agent back until they pass.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Pierre Moati",
|
|
9
|
+
"url": "https://github.com/mopi1402"
|
|
10
|
+
},
|
|
11
|
+
"repository": "git+https://github.com/mopi1402/tayomi-deterministic-gates.git",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"coding-agents",
|
|
14
|
+
"quality-gates",
|
|
15
|
+
"backpressure",
|
|
16
|
+
"claude-code",
|
|
17
|
+
"codex",
|
|
18
|
+
"hooks"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=24.2"
|
|
22
|
+
},
|
|
23
|
+
"packageManager": "pnpm@10.4.0",
|
|
24
|
+
"files": [
|
|
25
|
+
".claude-plugin",
|
|
26
|
+
".codex-plugin",
|
|
27
|
+
"catalog",
|
|
28
|
+
"hooks",
|
|
29
|
+
"src",
|
|
30
|
+
"!src/**/*.test.ts"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"catalog": "node src/catalog/catalog.ts",
|
|
34
|
+
"check": "tsc && prettier --check . && node --test \"src/**/*.test.ts\"",
|
|
35
|
+
"test": "node --test \"src/**/*.test.ts\"",
|
|
36
|
+
"integration": "node --test \"integration/*.test.ts\""
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "24.19.2",
|
|
40
|
+
"jscpd": "5.4.2",
|
|
41
|
+
"knip": "6.44.1",
|
|
42
|
+
"prettier": "3.9.10",
|
|
43
|
+
"typescript": "6.0.3"
|
|
44
|
+
}
|
|
45
|
+
}
|