@voidh4x0r/slopgate 0.1.9 → 0.1.10

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 CHANGED
@@ -9,6 +9,16 @@ 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.10] - 2026-11-22
13
+
14
+ ### Fixed
15
+ - 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.
16
+ - Documented and tested that a rule set to `severity: "info"` stays visible but still fails CI; `off` or a baseline is the exemption mechanism.
17
+
18
+ ### Changed
19
+ - 257 tests, including single-file/subdirectory reporter paths, SARIF/GitHub annotations, and the `severity-override` fixture.
20
+ - 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: []`.
21
+
12
22
  ## [0.1.9] - 2026-11-22
13
23
 
14
24
  ### 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.9 · 4 files · 39ms
17
+ slopgate 0.1.10 · 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
@@ -146,11 +146,13 @@ 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
+ 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.
155
+
154
156
  `slopgate init` writes a minimal config plus a GitHub Actions workflow.
155
157
 
156
158
  ### Adopting it on an existing repository
@@ -206,7 +208,7 @@ jobs:
206
208
  - uses: actions/checkout@v4
207
209
  - uses: actions/setup-node@v4
208
210
  with: { node-version: 22 }
209
- - run: npx --yes @voidh4x0r/slopgate@0.1.9 . --fail-on high
211
+ - run: npx --yes @voidh4x0r/slopgate@0.1.10 . --fail-on high
210
212
  ```
211
213
 
212
214
  For GitHub code scanning, use `--format sarif` and upload with `github/codeql-action/upload-sarif`.
@@ -214,7 +216,7 @@ For GitHub code scanning, use `--format sarif` and upload with `github/codeql-ac
214
216
  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
217
 
216
218
  ```yaml
217
- - run: npx --yes @voidh4x0r/slopgate@0.1.9 . --format github --fail-on high
219
+ - run: npx --yes @voidh4x0r/slopgate@0.1.10 . --format github --fail-on high
218
220
  ```
219
221
 
220
222
  Each finding becomes an `error` / `warning` / `notice` annotation on the exact line, followed by a summary notice.
@@ -299,7 +301,7 @@ Issues and pull requests are welcome. Start with [CONTRIBUTING.md](https://githu
299
301
  git clone https://github.com/VoidH4x0r/slopgate
300
302
  cd slopgate
301
303
  npm install
302
- npm test # 255 tests; the tests themselves make no network or child-process calls
304
+ npm test # 257 tests; the tests themselves make no network or child-process calls
303
305
  npm run typecheck
304
306
  npm run verify # all release gates in one command
305
307
  ```
package/dist/cli.js CHANGED
@@ -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,
@@ -391,8 +411,23 @@ async function runScan(options, io) {
391
411
  : merged.failOn;
392
412
  const visible = fresh.filter((finding) => meetsConfidence(finding.confidence, displayConfidence));
393
413
  const hidden = fresh.length - visible.length;
414
+ // Reporters (SARIF, GitHub workflow commands) resolve paths from the repo
415
+ // root, not from the scan target. Prefix output findings only: baseline
416
+ // fingerprints and diff filtering keep using the raw target-relative paths.
417
+ const scanBase = targetInfo.isFile() ? path.dirname(target) : target;
418
+ const outputRoot = await findGitRoot(scanBase);
419
+ let outputPrefix = '';
420
+ if (outputRoot) {
421
+ const relative = path.relative(outputRoot, scanBase);
422
+ if (relative && !relative.startsWith('..') && !path.isAbsolute(relative)) {
423
+ outputPrefix = relative.replace(/\\/g, '/');
424
+ }
425
+ }
426
+ const outputVisible = outputPrefix
427
+ ? visible.map((finding) => ({ ...finding, file: `${outputPrefix}/${finding.file}` }))
428
+ : visible;
394
429
  const run = {
395
- visible,
430
+ visible: outputVisible,
396
431
  stats: result.stats,
397
432
  suppressed: result.suppressedCount,
398
433
  baselined: known.length,
@@ -402,7 +437,7 @@ async function runScan(options, io) {
402
437
  const version = await readVersion();
403
438
  if (options.format === 'json') {
404
439
  writeOut(io, renderJson({
405
- findings: visible,
440
+ findings: outputVisible,
406
441
  stats: run.stats,
407
442
  version,
408
443
  suppressedByComment: run.suppressed,
@@ -411,14 +446,14 @@ async function runScan(options, io) {
411
446
  }));
412
447
  }
413
448
  else if (options.format === 'sarif') {
414
- writeOut(io, renderSarif(visible, version));
449
+ writeOut(io, renderSarif(outputVisible, version));
415
450
  }
416
451
  else if (options.format === 'github') {
417
- writeOut(io, renderGithub(visible, run.stats));
452
+ writeOut(io, renderGithub(outputVisible, run.stats));
418
453
  }
419
454
  else {
420
455
  writeOut(io, renderPretty({
421
- findings: visible,
456
+ findings: outputVisible,
422
457
  stats: run.stats,
423
458
  suppressedByComment: run.suppressed,
424
459
  baselined: run.baselined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidh4x0r/slopgate",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "The slop gate for AI-written code. Precision-first structural linting for Python and TypeScript.",
5
5
  "type": "module",
6
6
  "license": "MIT",