@voidh4x0r/slopgate 0.1.9 → 0.1.11
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 +23 -0
- package/README.md +11 -7
- package/dist/cli.js +47 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,29 @@ 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.11] - 2026-11-22
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- `.slopgate.json` and `.slopgate-baseline.json` are now loaded from the nearest git repository root, not from the scan target. `slopgate src` and `slopgate src/a.py` see the same `rules` / `include` / `exclude` / `ignoreModules` / `confidence` / `failOn` settings as `slopgate .`, matching MCP.
|
|
16
|
+
- Default and explicit baseline paths resolve from the repository root. `--write-baseline` started from `src` now writes `<repo>/.slopgate-baseline.json`, and later scans from any subdirectory read it.
|
|
17
|
+
- Manifest and local-module resolution remains target-scoped, so monorepo packages still use their own `package.json` / `pyproject.toml`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- **Behavior change:** a baseline written by an older version inside a scanned subdirectory is no longer found automatically; move it to the repository root or pass `--baseline`.
|
|
21
|
+
- 259 tests, including repo-root config applying to directory/file scans and default-baseline read/write at the root.
|
|
22
|
+
- The performance guard now ignores corpora under 500 ms, so 5% comparisons target the CPython/ESLint-scale scans rather than startup noise.
|
|
23
|
+
- 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: []`.
|
|
24
|
+
|
|
25
|
+
## [0.1.10] - 2026-11-22
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- Reporter output paths are repository-relative when the scan target is inside a git repository. `slopgate src`, `slopgate src/a.py` and absolute targets now emit `src/a.py` in JSON, pretty, SARIF and GitHub annotations instead of `a.py`. The prefix comes from the nearest `.git` marker (filesystem walk, no subprocess); non-git targets keep target-relative paths. Baseline fingerprints and diff filtering continue to use the raw target-relative paths.
|
|
29
|
+
- Documented and tested that a rule set to `severity: "info"` stays visible but still fails CI; `off` or a baseline is the exemption mechanism.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
- 257 tests, including single-file/subdirectory reporter paths, SARIF/GitHub annotations, and the `severity-override` fixture.
|
|
33
|
+
- Benchmark findings 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: []`.
|
|
34
|
+
|
|
12
35
|
## [0.1.9] - 2026-11-22
|
|
13
36
|
|
|
14
37
|
### Changed
|
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.11 · 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
|
|
@@ -116,7 +116,7 @@ slopgate [path] [options]
|
|
|
116
116
|
--confidence high|medium|low minimum confidence to report (default: high)
|
|
117
117
|
--fail-on high|medium|low|none minimum confidence that fails CI (default: high)
|
|
118
118
|
(a lower value also lowers what is displayed)
|
|
119
|
-
--baseline [path] ignore findings recorded in a file (default: .slopgate-baseline.json)
|
|
119
|
+
--baseline [path] ignore findings recorded in a file (default: .slopgate-baseline.json at the repo root)
|
|
120
120
|
--write-baseline [path] record current findings, then exit 0
|
|
121
121
|
--diff [ref] only report findings on changed lines (default: HEAD)
|
|
122
122
|
--include/--exclude <glob> adjust the file set
|
|
@@ -128,7 +128,7 @@ slopgate [path] [options]
|
|
|
128
128
|
|
|
129
129
|
### Configuration
|
|
130
130
|
|
|
131
|
-
`slopgate` reads `.slopgate.json` (or `slopgate.config.json`) from the
|
|
131
|
+
`slopgate` reads `.slopgate.json` (or `slopgate.config.json`) from the **nearest git repository root** (falling back to the scan target’s directory outside git). Every key is optional:
|
|
132
132
|
|
|
133
133
|
```json
|
|
134
134
|
{
|
|
@@ -146,11 +146,15 @@ slopgate [path] [options]
|
|
|
146
146
|
|
|
147
147
|
- `include` / `exclude` — globs relative to the project root. **A config `include` replaces the default pattern set** (the ten Python/TS/JS globs); list every extension you still want. The CLI `--include` **appends** to the effective set, so `--include "src/**"` keeps the defaults.
|
|
148
148
|
- `ignoreModules` — top-level modules to always treat as declared (dynamic imports, private packages).
|
|
149
|
-
- `rules` — `"off"` or an explicit severity (`"error"`, `"warning"`, `"info"`).
|
|
149
|
+
- `rules` — `"off"` or an explicit severity (`"error"`, `"warning"`, `"info"`). Severity changes display and annotation level only; **CI failure is controlled by confidence and `--fail-on`**. A rule set to `"info"` stays visible and still fails when its confidence meets `--fail-on`; use `"off"` or a baseline to exempt it.
|
|
150
150
|
- `confidence` / `failOn` — same meaning as the CLI flags; CLI flags win.
|
|
151
151
|
|
|
152
152
|
For example, `{"include": ["src/**"]}` scans only files under `src/`; it does **not** keep the default Python/TS/JS coverage. Add the patterns you need, or use the CLI flag to append one pattern to the defaults.
|
|
153
153
|
|
|
154
|
+
The default `.slopgate-baseline.json` also lives at the repository root. `--baseline` and `--write-baseline` paths resolve there, so scanning `src` and then the repository root share one baseline.
|
|
155
|
+
|
|
156
|
+
Reported paths (including SARIF and GitHub annotations) are relative to the nearest git repository root. If the target is outside a git repository, paths stay relative to the scan target.
|
|
157
|
+
|
|
154
158
|
`slopgate init` writes a minimal config plus a GitHub Actions workflow.
|
|
155
159
|
|
|
156
160
|
### Adopting it on an existing repository
|
|
@@ -206,7 +210,7 @@ jobs:
|
|
|
206
210
|
- uses: actions/checkout@v4
|
|
207
211
|
- uses: actions/setup-node@v4
|
|
208
212
|
with: { node-version: 22 }
|
|
209
|
-
- run: npx --yes @voidh4x0r/slopgate@0.1.
|
|
213
|
+
- run: npx --yes @voidh4x0r/slopgate@0.1.11 . --fail-on high
|
|
210
214
|
```
|
|
211
215
|
|
|
212
216
|
For GitHub code scanning, use `--format sarif` and upload with `github/codeql-action/upload-sarif`.
|
|
@@ -214,7 +218,7 @@ For GitHub code scanning, use `--format sarif` and upload with `github/codeql-ac
|
|
|
214
218
|
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):
|
|
215
219
|
|
|
216
220
|
```yaml
|
|
217
|
-
- run: npx --yes @voidh4x0r/slopgate@0.1.
|
|
221
|
+
- run: npx --yes @voidh4x0r/slopgate@0.1.11 . --format github --fail-on high
|
|
218
222
|
```
|
|
219
223
|
|
|
220
224
|
Each finding becomes an `error` / `warning` / `notice` annotation on the exact line, followed by a summary notice.
|
|
@@ -299,7 +303,7 @@ Issues and pull requests are welcome. Start with [CONTRIBUTING.md](https://githu
|
|
|
299
303
|
git clone https://github.com/VoidH4x0r/slopgate
|
|
300
304
|
cd slopgate
|
|
301
305
|
npm install
|
|
302
|
-
npm test #
|
|
306
|
+
npm test # 259 tests; the tests themselves make no network or child-process calls
|
|
303
307
|
npm run typecheck
|
|
304
308
|
npm run verify # all release gates in one command
|
|
305
309
|
```
|
package/dist/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ Options:
|
|
|
31
31
|
--format <pretty|json|sarif|github> output format (default: pretty)
|
|
32
32
|
--confidence <high|medium|low> minimum confidence to show (default: high)
|
|
33
33
|
--fail-on <high|medium|low|none> minimum confidence that fails the run (default: high)
|
|
34
|
-
--baseline [path] findings file to ignore (default: ${DEFAULT_BASELINE})
|
|
34
|
+
--baseline [path] findings file to ignore (default: ${DEFAULT_BASELINE} at the repo root)
|
|
35
35
|
--write-baseline [path] record current findings as the baseline, then exit 0
|
|
36
36
|
--diff [ref] only report findings on lines changed since ref (default: HEAD)
|
|
37
37
|
--include <glob> extra include pattern (repeatable)
|
|
@@ -216,6 +216,26 @@ function warn(io, options, message) {
|
|
|
216
216
|
if (!options.quiet)
|
|
217
217
|
io.err(`slopgate: ${message}\n`);
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Nearest ancestor containing `.git`, without spawning git. A `.git` file
|
|
221
|
+
* (worktree/submodule) counts as a repository marker too.
|
|
222
|
+
*/
|
|
223
|
+
async function findGitRoot(start) {
|
|
224
|
+
let dir = path.resolve(start);
|
|
225
|
+
for (;;) {
|
|
226
|
+
try {
|
|
227
|
+
await stat(path.join(dir, '.git'));
|
|
228
|
+
return dir;
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
// keep walking towards the filesystem root
|
|
232
|
+
}
|
|
233
|
+
const parent = path.dirname(dir);
|
|
234
|
+
if (parent === dir)
|
|
235
|
+
return undefined;
|
|
236
|
+
dir = parent;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
219
239
|
async function runRules(options, io) {
|
|
220
240
|
const rows = ALL_RULES.map((rule) => ({
|
|
221
241
|
id: rule.meta.id,
|
|
@@ -329,7 +349,10 @@ async function runScan(options, io) {
|
|
|
329
349
|
throw new Error(`path not found: ${target}`);
|
|
330
350
|
}
|
|
331
351
|
const projectRoot = targetInfo.isFile() ? path.dirname(target) : target;
|
|
332
|
-
|
|
352
|
+
// Config and the default baseline belong to the repository, not to the
|
|
353
|
+
// directory being scanned. Manifests stay target-scoped inside scanProject.
|
|
354
|
+
const configRoot = (await findGitRoot(projectRoot)) ?? projectRoot;
|
|
355
|
+
const { config, file: configFile } = await loadConfig(configRoot);
|
|
333
356
|
if (options.rules.length > 0) {
|
|
334
357
|
const unknown = options.rules.filter((id) => !RULE_BY_ID.has(id));
|
|
335
358
|
if (unknown.length > 0) {
|
|
@@ -359,10 +382,10 @@ async function runScan(options, io) {
|
|
|
359
382
|
if (result.stats.files === 0) {
|
|
360
383
|
throw new Error(`no files matched under ${path.relative(process.cwd(), target) || '.'} (check include/exclude patterns)`);
|
|
361
384
|
}
|
|
362
|
-
const baselinePath = path.resolve(
|
|
385
|
+
const baselinePath = path.resolve(configRoot, options.baseline ?? DEFAULT_BASELINE);
|
|
363
386
|
const explicitWrite = options.writeBaseline;
|
|
364
387
|
if (explicitWrite) {
|
|
365
|
-
const writeTarget = path.resolve(
|
|
388
|
+
const writeTarget = path.resolve(configRoot, explicitWrite);
|
|
366
389
|
// Record the current findings, not the diff-filtered subset.
|
|
367
390
|
await writeBaseline(writeTarget, result.findings);
|
|
368
391
|
writeOut(io, `wrote ${result.findings.length} findings to ${path.relative(process.cwd(), writeTarget)}`);
|
|
@@ -391,8 +414,23 @@ async function runScan(options, io) {
|
|
|
391
414
|
: merged.failOn;
|
|
392
415
|
const visible = fresh.filter((finding) => meetsConfidence(finding.confidence, displayConfidence));
|
|
393
416
|
const hidden = fresh.length - visible.length;
|
|
417
|
+
// Reporters (SARIF, GitHub workflow commands) resolve paths from the repo
|
|
418
|
+
// root, not from the scan target. Prefix output findings only: baseline
|
|
419
|
+
// fingerprints and diff filtering keep using the raw target-relative paths.
|
|
420
|
+
const scanBase = targetInfo.isFile() ? path.dirname(target) : target;
|
|
421
|
+
const outputRoot = await findGitRoot(scanBase);
|
|
422
|
+
let outputPrefix = '';
|
|
423
|
+
if (outputRoot) {
|
|
424
|
+
const relative = path.relative(outputRoot, scanBase);
|
|
425
|
+
if (relative && !relative.startsWith('..') && !path.isAbsolute(relative)) {
|
|
426
|
+
outputPrefix = relative.replace(/\\/g, '/');
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const outputVisible = outputPrefix
|
|
430
|
+
? visible.map((finding) => ({ ...finding, file: `${outputPrefix}/${finding.file}` }))
|
|
431
|
+
: visible;
|
|
394
432
|
const run = {
|
|
395
|
-
visible,
|
|
433
|
+
visible: outputVisible,
|
|
396
434
|
stats: result.stats,
|
|
397
435
|
suppressed: result.suppressedCount,
|
|
398
436
|
baselined: known.length,
|
|
@@ -402,7 +440,7 @@ async function runScan(options, io) {
|
|
|
402
440
|
const version = await readVersion();
|
|
403
441
|
if (options.format === 'json') {
|
|
404
442
|
writeOut(io, renderJson({
|
|
405
|
-
findings:
|
|
443
|
+
findings: outputVisible,
|
|
406
444
|
stats: run.stats,
|
|
407
445
|
version,
|
|
408
446
|
suppressedByComment: run.suppressed,
|
|
@@ -411,14 +449,14 @@ async function runScan(options, io) {
|
|
|
411
449
|
}));
|
|
412
450
|
}
|
|
413
451
|
else if (options.format === 'sarif') {
|
|
414
|
-
writeOut(io, renderSarif(
|
|
452
|
+
writeOut(io, renderSarif(outputVisible, version));
|
|
415
453
|
}
|
|
416
454
|
else if (options.format === 'github') {
|
|
417
|
-
writeOut(io, renderGithub(
|
|
455
|
+
writeOut(io, renderGithub(outputVisible, run.stats));
|
|
418
456
|
}
|
|
419
457
|
else {
|
|
420
458
|
writeOut(io, renderPretty({
|
|
421
|
-
findings:
|
|
459
|
+
findings: outputVisible,
|
|
422
460
|
stats: run.stats,
|
|
423
461
|
suppressedByComment: run.suppressed,
|
|
424
462
|
baselined: run.baselined,
|