unslop 0.1.3 → 0.1.5

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.
Files changed (2) hide show
  1. package/README.md +74 -41
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -42,6 +42,9 @@ unslop --format json .
42
42
  # SARIF output (for CI integration)
43
43
  unslop --format sarif .
44
44
 
45
+ # List built-in rules and defaults
46
+ unslop --list-rules
47
+
45
48
  # With config file
46
49
  unslop --config .unslop.yaml .
47
50
  ```
@@ -68,18 +71,20 @@ Use `--changed-only` to focus on uncommitted files and prioritize reuse against
68
71
  | Dead exports | Clone | 95% |
69
72
  | Complexity budget breaches | Practices | 90% |
70
73
  | Boundary violations (`packages -> apps`, cross-app deps, cycles) | Practices | 90-98% |
71
- | Generic naming entropy | Practices | 74% |
72
74
  | Ignored Go errors | Practices | 93% |
73
75
  | Go context leaks | Practices | 87% |
74
76
  | React broad barrel re-exports | Practices | 78-86% |
75
77
 
76
78
  ## Architecture
77
79
 
78
- Three engines run in parallel:
80
+ Four artifact engines run in parallel and are evaluated through a rule catalog:
79
81
 
80
82
  1. **Clone Detection** (in-process) — tree-sitter parsing → pre-normalization (cached) → alpha-renaming → hash/suffix-tree/PQ-gram comparison
81
- 2. **Semantic Analysis** (subprocess) — delegates to oxlint, clippy, ruff, etc. for language-specific pattern detection
82
- 3. **Best Practices** (in-process) — deterministic clean-code and architecture checks (complexity, boundaries, naming, Go hygiene, React barrels)
83
+ 2. **Semantic Analysis** (subprocess) — external linter diagnostics
84
+ 3. **Best Practices** (in-process) — deterministic clean-code and architecture checks
85
+ 4. **Repo Policy** (in-process) — repository policy signals
86
+
87
+ Each rule is now a first-class catalog entry with defaults and per-rule controls.
83
88
 
84
89
  Built on Semgrep's model: **tree-sitter CST → language-specific normalizer → generic normalized tree → language-agnostic analysis**.
85
90
 
@@ -106,52 +111,74 @@ SDK stability policy: `pkg/sdk/STABILITY.md`.
106
111
 
107
112
  ## Configuration
108
113
 
109
- Create `.unslop.yaml` in your project root:
114
+ Create `.unslop.yaml` in your project root. v2 requires `version: 2`:
110
115
 
111
116
  ```yaml
112
- # Minimum token count for clone detection
113
- min_tokens: 50
114
-
115
- # Similarity threshold for near-miss detection (0.0-1.0)
116
- similarity_threshold: 0.8
117
-
118
- # Max near-miss comparisons
119
- max_suffix_pairs: 10000
120
-
121
- # Max structural (PQ-gram) comparisons
122
- max_pqgram_pairs: 50000
123
-
124
- # External linters
125
- linters:
126
- oxlint:
117
+ version: 2
118
+
119
+ analysis:
120
+ ignore:
121
+ - "vendor/"
122
+ - "node_modules/"
123
+ extensions: [".ts", ".tsx", ".go"]
124
+ languages: ["typescript", "go"]
125
+ changed_only: false
126
+
127
+ engines:
128
+ clone:
129
+ min_tokens: 50
130
+ similarity_threshold: 0.8
131
+ max_suffix_pairs: 10000
132
+ max_pqgram_pairs: 50000
133
+ linters:
134
+ oxlint:
135
+ enabled: true
136
+ command: oxlint
137
+ args: ["--format", "json"]
138
+ timeout: "60s"
139
+ practices:
127
140
  enabled: true
128
- command: oxlint
129
- args: ["--format", "json"]
141
+ profile: balanced
142
+ ignore_tests: true
143
+ max_findings_per_rule: 200
144
+
145
+ rules:
146
+ defaults:
147
+ severity: warning
148
+ gateable: false
149
+ exact-clone:
150
+ severity: error
151
+ gateable: true
152
+ barrel-import:
153
+ enabled: false
154
+ complexity-budget:
155
+ paths:
156
+ include: ["apps/**"]
157
+ exclude: ["scripts/**"]
158
+
159
+ gates:
160
+ max_score: 35
161
+ fail_on_rules: ["exact-clone", "boundary-violation-cycle"]
162
+ fail_on_tiers: ["A"]
130
163
 
131
- # Paths to ignore (in addition to .gitignore)
132
- ignore:
133
- - "vendor/"
134
- - "node_modules/"
135
- - "*.generated.ts"
136
-
137
- # Slop score configuration
138
164
  slop_score:
139
- # strict | balanced | lenient
140
165
  profile: balanced
141
- # number of top contributors shown in terminal output (1-10)
142
166
  top_contributors: 5
143
-
144
- # Best-practices configuration
145
- best_practices:
146
- enabled: true
147
- # strict | balanced | lenient
148
- profile: balanced
149
- # ignore test-like paths for best-practices findings
150
- ignore_tests: true
151
- # deterministic per-rule cap (20-1000)
152
- max_findings_per_rule: 200
153
167
  ```
154
168
 
169
+ See `/Users/danieledeling/projects/go/unslop/docs/config-v2.md` and `/Users/danieledeling/projects/go/unslop/docs/rules.md` for full details.
170
+
171
+ ## v2 Breaking Change
172
+
173
+ Configuration is now strict v2:
174
+
175
+ - `version: 2` is required when using a config file
176
+ - unknown top-level keys fail parsing
177
+ - unknown non-legacy rule IDs fail parsing
178
+ - removed legacy rule IDs are silently ignored in config/CLI rule selectors
179
+ - unknown fields under `rules.<id>` fail parsing
180
+ - there is no v1 compatibility bridge
181
+
155
182
  Example terminal section (`--verbose`):
156
183
 
157
184
  ```text
@@ -182,6 +209,12 @@ make test # Run all tests with race detector
182
209
  make bench # Run benchmarks
183
210
  make lint # Run golangci-lint
184
211
  make build # Build binary to bin/unslop
212
+
213
+ # Full npm release (version sync + tests + all-platform build + publish)
214
+ make release-npm VERSION=0.1.3
215
+
216
+ # Same flow without publishing (sanity check)
217
+ make release-npm VERSION=0.1.3 RELEASE_ARGS="--dry-run"
185
218
  ```
186
219
 
187
220
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unslop",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Detect duplicated code, dead code, and anti-patterns in AI-generated codebases",
5
5
  "bin": {
6
6
  "unslop": "bin.js"
@@ -9,11 +9,11 @@
9
9
  "bin.js"
10
10
  ],
11
11
  "optionalDependencies": {
12
- "@unslop/darwin-arm64": "0.1.3",
13
- "@unslop/darwin-x64": "0.1.3",
14
- "@unslop/linux-arm64": "0.1.3",
15
- "@unslop/linux-x64": "0.1.3",
16
- "@unslop/win32-x64": "0.1.3"
12
+ "@unslop/darwin-arm64": "0.1.5",
13
+ "@unslop/darwin-x64": "0.1.5",
14
+ "@unslop/linux-arm64": "0.1.5",
15
+ "@unslop/linux-x64": "0.1.5",
16
+ "@unslop/win32-x64": "0.1.5"
17
17
  },
18
18
  "license": "Apache-2.0",
19
19
  "repository": {