@voidh4x0r/slopgate 0.1.10 → 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 CHANGED
@@ -9,6 +9,19 @@ 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
+
12
25
  ## [0.1.10] - 2026-11-22
13
26
 
14
27
  ### 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.10 · 4 files · 39ms
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 project root. Every key is optional:
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
  {
@@ -151,6 +151,8 @@ slopgate [path] [options]
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
+
154
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.
155
157
 
156
158
  `slopgate init` writes a minimal config plus a GitHub Actions workflow.
@@ -208,7 +210,7 @@ jobs:
208
210
  - uses: actions/checkout@v4
209
211
  - uses: actions/setup-node@v4
210
212
  with: { node-version: 22 }
211
- - run: npx --yes @voidh4x0r/slopgate@0.1.10 . --fail-on high
213
+ - run: npx --yes @voidh4x0r/slopgate@0.1.11 . --fail-on high
212
214
  ```
213
215
 
214
216
  For GitHub code scanning, use `--format sarif` and upload with `github/codeql-action/upload-sarif`.
@@ -216,7 +218,7 @@ For GitHub code scanning, use `--format sarif` and upload with `github/codeql-ac
216
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):
217
219
 
218
220
  ```yaml
219
- - run: npx --yes @voidh4x0r/slopgate@0.1.10 . --format github --fail-on high
221
+ - run: npx --yes @voidh4x0r/slopgate@0.1.11 . --format github --fail-on high
220
222
  ```
221
223
 
222
224
  Each finding becomes an `error` / `warning` / `notice` annotation on the exact line, followed by a summary notice.
@@ -301,7 +303,7 @@ Issues and pull requests are welcome. Start with [CONTRIBUTING.md](https://githu
301
303
  git clone https://github.com/VoidH4x0r/slopgate
302
304
  cd slopgate
303
305
  npm install
304
- npm test # 257 tests; the tests themselves make no network or child-process calls
306
+ npm test # 259 tests; the tests themselves make no network or child-process calls
305
307
  npm run typecheck
306
308
  npm run verify # all release gates in one command
307
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)
@@ -349,7 +349,10 @@ async function runScan(options, io) {
349
349
  throw new Error(`path not found: ${target}`);
350
350
  }
351
351
  const projectRoot = targetInfo.isFile() ? path.dirname(target) : target;
352
- const { config, file: configFile } = await loadConfig(projectRoot);
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);
353
356
  if (options.rules.length > 0) {
354
357
  const unknown = options.rules.filter((id) => !RULE_BY_ID.has(id));
355
358
  if (unknown.length > 0) {
@@ -379,10 +382,10 @@ async function runScan(options, io) {
379
382
  if (result.stats.files === 0) {
380
383
  throw new Error(`no files matched under ${path.relative(process.cwd(), target) || '.'} (check include/exclude patterns)`);
381
384
  }
382
- const baselinePath = path.resolve(projectRoot, options.baseline ?? DEFAULT_BASELINE);
385
+ const baselinePath = path.resolve(configRoot, options.baseline ?? DEFAULT_BASELINE);
383
386
  const explicitWrite = options.writeBaseline;
384
387
  if (explicitWrite) {
385
- const writeTarget = path.resolve(projectRoot, explicitWrite);
388
+ const writeTarget = path.resolve(configRoot, explicitWrite);
386
389
  // Record the current findings, not the diff-filtered subset.
387
390
  await writeBaseline(writeTarget, result.findings);
388
391
  writeOut(io, `wrote ${result.findings.length} findings to ${path.relative(process.cwd(), writeTarget)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidh4x0r/slopgate",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
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",