@voidh4x0r/slopgate 0.1.16 → 0.1.18
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/CHANGELOG.md +21 -0
- package/README.md +20 -4
- package/dist/cli.js +21 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,27 @@ All notable changes to this project are documented here. The format follows [Kee
|
|
|
9
9
|
- Go and Rust grammars.
|
|
10
10
|
- VS Code diagnostics.
|
|
11
11
|
|
|
12
|
+
## [0.1.18] - 2026-11-22
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- README “Auditing AI-written code” now states the scope of the medium threshold: `pass` / `...` / `throw not implemented` stubs are covered; a bare `return None` is `low`, while `return []` / `{}` / `""` / `False` and empty classes are not reported because they are indistinguishable from legitimate default returns.
|
|
16
|
+
- `--strict` on a scan/rules/MCP command prints a stderr hint that it only affects `init` and points to `--confidence medium`; behavior is otherwise unchanged.
|
|
17
|
+
|
|
18
|
+
### Tests
|
|
19
|
+
- 272 tests, including the `--strict` misuse warning.
|
|
20
|
+
- Benchmark unchanged at **29 high-confidence findings across 991,705 lines of CPython, 96.6% labeled precision (28/29), 14/14 seeded defects, 0 high findings on 601 JavaScript files**; `staleLabels: []`, `unlabeledHigh: []`.
|
|
21
|
+
|
|
22
|
+
## [0.1.17] - 2026-11-22
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- `slopgate init --strict` writes `confidence: "medium"` and `failOn: "medium"` into `.slopgate.json` and generates a workflow with `--confidence medium --fail-on medium`, matching the AI-code audit recipe. Default `init` remains high/high for human-maintained repositories.
|
|
26
|
+
- README “Auditing AI-written code” section with the baseline-first medium recipe, explaining that implementation stubs are medium by design while test theatre is high.
|
|
27
|
+
- `py/stub-body` and `ts/stub-function` docs now state that most real AI-stub findings are at medium confidence.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- 271 tests, including `init --strict` config and workflow assertions.
|
|
31
|
+
- Benchmark unchanged at **29 high-confidence findings across 991,705 lines of CPython, 96.6% labeled precision (28/29), 14/14 seeded defects, 0 high findings on 601 JavaScript files**; `staleLabels: []`, `unlabeledHigh: []`.
|
|
32
|
+
|
|
12
33
|
## [0.1.16] - 2026-11-22
|
|
13
34
|
|
|
14
35
|
### Fixed
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ AI writes code that *looks* right. `slopgate` finds the parts that only look rig
|
|
|
14
14
|
```console
|
|
15
15
|
$ npx @voidh4x0r/slopgate .
|
|
16
16
|
|
|
17
|
-
slopgate 0.1.
|
|
17
|
+
slopgate 0.1.18 · 4 files · 39ms
|
|
18
18
|
|
|
19
19
|
app.py
|
|
20
20
|
4:1 error high py/phantom-import `helper` is imported but not declared in any manifest and not present in this repository
|
|
@@ -172,6 +172,22 @@ npx @voidh4x0r/slopgate . --fail-on high
|
|
|
172
172
|
npx @voidh4x0r/slopgate . --diff origin/main --fail-on high
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
+
### Auditing AI-written code
|
|
176
|
+
|
|
177
|
+
The defaults are tuned for human-maintained code: an interface stub in a library is often deliberate, so class-method stubs and documented `pass` bodies are `medium`. AI-generated code has the opposite prior — an unimplemented method is usually unfinished — so audit it with the medium threshold:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# 1. Absorb the existing medium-confidence debt once.
|
|
181
|
+
npx @voidh4x0r/slopgate . --confidence medium --fail-on medium --write-baseline
|
|
182
|
+
|
|
183
|
+
# 2. Gate NEW implementation stubs and test theatre at medium.
|
|
184
|
+
npx @voidh4x0r/slopgate . --confidence medium --fail-on medium
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`slopgate init --strict` writes this policy into `.slopgate.json` and the generated GitHub Actions workflow. Keep the default `init` for human-maintained repositories.
|
|
188
|
+
|
|
189
|
+
**Scope of medium:** the medium threshold covers stubs whose entire body is `pass`, `...` or `throw new Error("not implemented")`. A bare `return None` is reported at `low`; `return []`, `{}`, `""`, `False` and empty classes are **not reported**, because they are indistinguishable from legitimate default return values. Do not expect strict mode to catch those placeholder returns.
|
|
190
|
+
|
|
175
191
|
### Use it from a coding agent (MCP)
|
|
176
192
|
|
|
177
193
|
`slopgate` ships a Model Context Protocol server over stdio, so Claude Code, Codex and other MCP clients can check their own diff **before** saying "done".
|
|
@@ -210,7 +226,7 @@ jobs:
|
|
|
210
226
|
- uses: actions/checkout@v4
|
|
211
227
|
- uses: actions/setup-node@v4
|
|
212
228
|
with: { node-version: 22 }
|
|
213
|
-
- run: npx --yes @voidh4x0r/slopgate@0.1.
|
|
229
|
+
- run: npx --yes @voidh4x0r/slopgate@0.1.18 . --fail-on high
|
|
214
230
|
```
|
|
215
231
|
|
|
216
232
|
For GitHub code scanning, use `--format sarif` and upload with `github/codeql-action/upload-sarif`.
|
|
@@ -218,7 +234,7 @@ For GitHub code scanning, use `--format sarif` and upload with `github/codeql-ac
|
|
|
218
234
|
For inline pull-request annotations **without** code scanning, use `--format github`, which emits [workflow commands](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions):
|
|
219
235
|
|
|
220
236
|
```yaml
|
|
221
|
-
- run: npx --yes @voidh4x0r/slopgate@0.1.
|
|
237
|
+
- run: npx --yes @voidh4x0r/slopgate@0.1.18 . --format github --fail-on high
|
|
222
238
|
```
|
|
223
239
|
|
|
224
240
|
Each finding becomes an `error` / `warning` / `notice` annotation on the exact line, followed by a summary notice.
|
|
@@ -303,7 +319,7 @@ Issues and pull requests are welcome. Start with [CONTRIBUTING.md](https://githu
|
|
|
303
319
|
git clone https://github.com/VoidH4x0r/slopgate
|
|
304
320
|
cd slopgate
|
|
305
321
|
npm install
|
|
306
|
-
npm test #
|
|
322
|
+
npm test # 272 tests; the tests themselves make no network or child-process calls
|
|
307
323
|
npm run typecheck
|
|
308
324
|
npm run verify # all release gates in one command
|
|
309
325
|
```
|
package/dist/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ Usage:
|
|
|
24
24
|
slopgate [path] [options] scan a directory or file (default: .)
|
|
25
25
|
slopgate rules list every rule
|
|
26
26
|
slopgate mcp [path] run as an MCP server on stdio
|
|
27
|
-
slopgate init
|
|
27
|
+
slopgate init [--strict] add config + GitHub Action
|
|
28
28
|
slopgate --version | --help
|
|
29
29
|
|
|
30
30
|
Options:
|
|
@@ -41,6 +41,7 @@ Options:
|
|
|
41
41
|
--quiet only print the summary
|
|
42
42
|
--verbose print warnings and per-file details
|
|
43
43
|
--force overwrite files in \`init\`
|
|
44
|
+
--strict \`init\`: medium confidence + fail-on medium
|
|
44
45
|
-h, --help show this help
|
|
45
46
|
-V, --version print the version
|
|
46
47
|
|
|
@@ -77,6 +78,7 @@ function defaultOptions() {
|
|
|
77
78
|
quiet: false,
|
|
78
79
|
verbose: false,
|
|
79
80
|
force: false,
|
|
81
|
+
strict: false,
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
const VALUE_FLAGS = new Set([
|
|
@@ -137,6 +139,10 @@ function parseArgs(argv) {
|
|
|
137
139
|
options.force = true;
|
|
138
140
|
continue;
|
|
139
141
|
}
|
|
142
|
+
if (token === '--strict') {
|
|
143
|
+
options.strict = true;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
140
146
|
const equals = token.indexOf('=');
|
|
141
147
|
const rawName = (equals === -1 ? token : token.slice(0, equals)).replace(/^--?/, '');
|
|
142
148
|
if (!VALUE_FLAGS.has(rawName))
|
|
@@ -265,7 +271,10 @@ const INIT_CONFIG = {
|
|
|
265
271
|
confidence: 'high',
|
|
266
272
|
failOn: 'high',
|
|
267
273
|
};
|
|
268
|
-
|
|
274
|
+
function initConfig(strict) {
|
|
275
|
+
return strict ? { ...INIT_CONFIG, confidence: 'medium', failOn: 'medium' } : INIT_CONFIG;
|
|
276
|
+
}
|
|
277
|
+
const INIT_WORKFLOW = (version, target, strict) => `name: slopgate
|
|
269
278
|
|
|
270
279
|
on:
|
|
271
280
|
push:
|
|
@@ -285,7 +294,7 @@ jobs:
|
|
|
285
294
|
with:
|
|
286
295
|
node-version: 22
|
|
287
296
|
- name: Scan for AI slop
|
|
288
|
-
run: npx --yes @voidh4x0r/slopgate@${version} ${target} --fail-on high --format pretty
|
|
297
|
+
run: npx --yes @voidh4x0r/slopgate@${version} ${target} ${strict ? '--confidence medium --fail-on medium' : '--fail-on high'} --format pretty
|
|
289
298
|
`;
|
|
290
299
|
async function runInit(options, io, version) {
|
|
291
300
|
const requested = path.resolve(options.paths[0] ?? '.');
|
|
@@ -303,7 +312,7 @@ async function runInit(options, io, version) {
|
|
|
303
312
|
warn(io, options, `${path.relative(process.cwd(), configPath)} already exists (use --force to overwrite)`);
|
|
304
313
|
}
|
|
305
314
|
else {
|
|
306
|
-
await writeFile(configPath, JSON.stringify(
|
|
315
|
+
await writeFile(configPath, JSON.stringify(initConfig(options.strict), null, 2) + '\n', 'utf8');
|
|
307
316
|
writeOut(io, `created ${path.relative(process.cwd(), configPath)}`);
|
|
308
317
|
}
|
|
309
318
|
if (!options.force && (await exists(workflowPath))) {
|
|
@@ -311,10 +320,13 @@ async function runInit(options, io, version) {
|
|
|
311
320
|
}
|
|
312
321
|
else {
|
|
313
322
|
await mkdir(path.dirname(workflowPath), { recursive: true });
|
|
314
|
-
await writeFile(workflowPath, INIT_WORKFLOW(version, workflowTarget), 'utf8');
|
|
323
|
+
await writeFile(workflowPath, INIT_WORKFLOW(version, workflowTarget, options.strict), 'utf8');
|
|
315
324
|
writeOut(io, `created ${path.relative(process.cwd(), workflowPath)}`);
|
|
316
325
|
}
|
|
317
|
-
|
|
326
|
+
const policy = options.strict
|
|
327
|
+
? '--confidence medium --fail-on medium'
|
|
328
|
+
: '--fail-on high';
|
|
329
|
+
writeOut(io, `next: npx @voidh4x0r/slopgate ${workflowTarget} ${policy} --write-baseline, then commit the baseline`);
|
|
318
330
|
return 0;
|
|
319
331
|
}
|
|
320
332
|
async function runMcp(options) {
|
|
@@ -473,6 +485,9 @@ export async function main(argv, io = defaultIo()) {
|
|
|
473
485
|
io.err(`slopgate: ${error}\n\n${HELP}`);
|
|
474
486
|
return 2;
|
|
475
487
|
}
|
|
488
|
+
if (options.strict && options.command !== 'init' && options.command !== 'help' && options.command !== 'version') {
|
|
489
|
+
warn(io, options, '--strict only affects `init`; use `--confidence medium` for scans');
|
|
490
|
+
}
|
|
476
491
|
try {
|
|
477
492
|
switch (options.command) {
|
|
478
493
|
case 'help':
|