@alexcodeplace/slopgate 0.1.1 → 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/README.md +2 -1
- package/package.json +1 -1
- package/rules/baseline/ast/empty-catch-block-ts.yml +3 -0
- package/rules/baseline/ast/empty-catch-block-tsx.yml +3 -0
- package/rules/baseline/ast/inner-html.yml +4 -1
- package/rules/baseline/ast/target-blank-norel.yml +3 -0
- package/rules/baseline/ast/window-in-render.yml +2 -0
- package/rules/baseline/selftest.config.toml +2 -1
- package/skills/slopgate-improve/SKILL.md +14 -0
- package/skills/slopgate-ux/SKILL.md +14 -0
- package/vendor/darwin-arm64/slopgate-rs +0 -0
- package/vendor/darwin-x64/slopgate-rs +0 -0
- package/vendor/linux-arm64/slopgate-rs +0 -0
- package/vendor/linux-x64/slopgate-rs +0 -0
- package/vendor/win32-x64/slopgate-rs.exe +0 -0
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ A global code-quality / anti-slop gate for Claude Code and git. Engine is shared
|
|
|
23
23
|
- **diff-shape** — wide commits spanning too many directories (encourages focused changes)
|
|
24
24
|
|
|
25
25
|
- **Shared regex + AST rule packs** — fast-tier and commit-tier both run these
|
|
26
|
-
- Convention: `no-stubs`, `ts-suppress`, `as-any`, `raw-hex` (design tokens), `sql-safety`
|
|
26
|
+
- Convention: `no-stubs`, `ts-suppress`, `as-any`, `no-narration-comments`, `raw-hex` (design tokens), `sql-safety`
|
|
27
27
|
- Security: `live-secrets`, `eval-ban`, `pii-logs`, `weak-hash`
|
|
28
28
|
- Cloudflare boundary: `kv-ban` (plus the opt-in `stack = ["cloudflare"]` pack)
|
|
29
29
|
- Built-in AST rules: empty-catch, unsafe `innerHTML`/`dangerouslySetInnerHTML`, `target="_blank"` without `rel`, `window` access during render
|
|
@@ -388,6 +388,7 @@ All are opt-in via the `baseline` array in config. Severity drives the gate thre
|
|
|
388
388
|
| `no-stubs` | critical | convention | Stub / placeholder / "not implemented" / deferred-work markers |
|
|
389
389
|
| `ts-suppress` | high | convention | `@ts-ignore` / `@ts-expect-error` — suppressing tsc instead of fixing the cause |
|
|
390
390
|
| `as-any` | high | convention | `as any` casts that disable type safety |
|
|
391
|
+
| `no-narration-comments` | high | convention | Comments that narrate a diff/history/removal (`changed from`, `used to`, `no longer needed`, `track later`) instead of explaining a non-obvious constraint |
|
|
391
392
|
| `raw-hex` | high | convention | Hardcoded hex / `rgb()` colors + raw multi-digit `px` — use design tokens |
|
|
392
393
|
| `sql-safety` | critical | convention | `SELECT … FOR UPDATE` with an aggregate (Postgres rejects this at runtime) |
|
|
393
394
|
| `kv-ban` | critical | boundary | Cloudflare KV in read-after-write paths (eventually-consistent) |
|
package/package.json
CHANGED
|
@@ -5,3 +5,6 @@ message: Empty catch block swallows error silently
|
|
|
5
5
|
note: '{"severity":"high","category":"convention","resolution":"Handle or rethrow. Minimum: log with context (console.error). Comment-only bodies count as empty."}'
|
|
6
6
|
rule:
|
|
7
7
|
pattern: 'try { $A } catch ($E) {}'
|
|
8
|
+
ignores:
|
|
9
|
+
- '**/*.test.ts'
|
|
10
|
+
- '**/*.test.tsx'
|
|
@@ -5,3 +5,6 @@ message: Empty catch block swallows error silently
|
|
|
5
5
|
note: '{"severity":"high","category":"convention","resolution":"Handle or rethrow. Minimum: log with context (console.error). Comment-only bodies count as empty."}'
|
|
6
6
|
rule:
|
|
7
7
|
pattern: 'try { $A } catch ($E) {}'
|
|
8
|
+
ignores:
|
|
9
|
+
- '**/*.test.ts'
|
|
10
|
+
- '**/*.test.tsx'
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
roots = ["rules/baseline/fixtures/src"]
|
|
7
7
|
exts = [".ts", ".tsx"]
|
|
8
8
|
skipDirs = ["node_modules"]
|
|
9
|
-
baseline = ["no-stubs", "ts-suppress", "as-any", "raw-hex", "kv-ban", "live-secrets", "eval-ban", "pii-logs", "weak-hash", "sql-safety"]
|
|
9
|
+
baseline = ["no-stubs", "ts-suppress", "as-any", "no-narration-comments", "markers", "raw-hex", "kv-ban", "live-secrets", "eval-ban", "pii-logs", "weak-hash", "sql-safety"]
|
|
10
|
+
stack = ["debug"]
|
|
10
11
|
rules = []
|
|
11
12
|
suppressions = "./fixtures/suppressions.json"
|
|
12
13
|
fixtures = "./fixtures"
|
|
@@ -9,6 +9,20 @@ description: Mine a project's institutional memory (skills, agents, commands, CL
|
|
|
9
9
|
|
|
10
10
|
Scope / focus area (optional): $ARGUMENTS — blank = all sources.
|
|
11
11
|
|
|
12
|
+
## Step 0 — Ensure gate initialized (run FIRST)
|
|
13
|
+
|
|
14
|
+
A `/slopgate-*` skill MUST NOT operate on an un-gated repo. Verify the gate; init if absent. Idempotent — `slopgate init` preserves an existing config and only fills what is missing (it also installs the fail-closed pre-commit hook). Single source of truth = the CLI's own idempotency; this step just calls it.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || { echo "slopgate: not a git repo — cannot init gate"; exit 1; }
|
|
18
|
+
if [ ! -f "$ROOT/.slopgate/config.toml" ]; then
|
|
19
|
+
echo "slopgate: gate not initialized — running 'slopgate init' first"
|
|
20
|
+
( cd "$ROOT" && slopgate init ) || { echo "slopgate: init failed"; exit 1; }
|
|
21
|
+
fi
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`config.toml` present → proceed. For richer project-specific rule mining on a fresh repo, run `/slopgate-init` separately.
|
|
25
|
+
|
|
12
26
|
## Rule tier model
|
|
13
27
|
|
|
14
28
|
| Tier | Pack location | Who opts in |
|
|
@@ -14,6 +14,20 @@ answer is NO, revise before emitting.
|
|
|
14
14
|
> Mission: generate human-centric, intuitive, **complete** interfaces. Avoid "UX slop": lazy, incomplete,
|
|
15
15
|
> or cognitively overwhelming designs optimized only for the happy path.
|
|
16
16
|
|
|
17
|
+
## Step 0 — Ensure gate initialized (run FIRST)
|
|
18
|
+
|
|
19
|
+
A `/slopgate-*` skill MUST NOT operate on an un-gated repo. Verify the gate; init if absent, so the `ux:{}` static module backs these prompt-time directives. Idempotent — `slopgate init` preserves an existing config and only fills what is missing (it also installs the fail-closed pre-commit hook). Single source of truth = the CLI's own idempotency; this step just calls it.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || { echo "slopgate: not a git repo — cannot init gate"; exit 1; }
|
|
23
|
+
if [ ! -f "$ROOT/.slopgate/config.toml" ]; then
|
|
24
|
+
echo "slopgate: gate not initialized — running 'slopgate init' first"
|
|
25
|
+
( cd "$ROOT" && slopgate init ) || { echo "slopgate: init failed"; exit 1; }
|
|
26
|
+
fi
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`config.toml` present → proceed with the checklist below.
|
|
30
|
+
|
|
17
31
|
## 0. Generic-AI-slop alarm bells — reject on sight
|
|
18
32
|
Centered hero + two stacked CTAs over a gradient · "Trusted by" logo strip under the hero · bento-box
|
|
19
33
|
grids (3–4 icon/heading/paragraph cards) · emoji as bullets/section markers/icons · decorative
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|