@blundergoat/gruff-ts 0.3.2 → 0.5.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +54 -1
  2. package/README.md +16 -6
  3. package/SECURITY.md +2 -1
  4. package/docs/README.md +1 -4
  5. package/docs/agent-hook.md +15 -3
  6. package/docs/configuration.md +47 -1
  7. package/docs/dashboard.md +3 -3
  8. package/docs/reports-and-ci.md +36 -0
  9. package/docs/rules.md +52 -37
  10. package/package.json +1 -1
  11. package/src/analyser.ts +540 -154
  12. package/src/baseline-options.ts +90 -0
  13. package/src/baseline.ts +39 -3
  14. package/src/blocks.ts +116 -77
  15. package/src/changed-regions.ts +80 -11
  16. package/src/class-rules.ts +226 -76
  17. package/src/cli-program.ts +65 -15
  18. package/src/cli.ts +4 -2
  19. package/src/comment-rules.ts +58 -13
  20. package/src/comment-scanner.ts +27 -0
  21. package/src/complexity-metrics.ts +244 -0
  22. package/src/config.ts +56 -16
  23. package/src/constants.ts +1 -1
  24. package/src/context-doc-rules.ts +9 -10
  25. package/src/dead-code-rules.ts +10 -3
  26. package/src/discovery.ts +66 -22
  27. package/src/doc-rules.ts +22 -53
  28. package/src/findings-helpers.ts +127 -1
  29. package/src/findings.ts +4 -0
  30. package/src/fixture-purpose-rules.ts +39 -5
  31. package/src/github-actions-rules.ts +24 -1
  32. package/src/hook-contract.ts +120 -27
  33. package/src/init-config.ts +15 -5
  34. package/src/line-rules.ts +175 -19
  35. package/src/naming-pushers.ts +26 -5
  36. package/src/parsed-script.ts +652 -0
  37. package/src/process-exec-metadata.ts +163 -0
  38. package/src/profiles.ts +14 -0
  39. package/src/project-config-rules.ts +36 -18
  40. package/src/project-rules.ts +159 -42
  41. package/src/public-exports.ts +220 -0
  42. package/src/report-renderers.ts +58 -4
  43. package/src/rules.ts +15 -15
  44. package/src/scoring.ts +13 -4
  45. package/src/security-flow-rules.ts +169 -24
  46. package/src/sensitive-data-rules.ts +256 -80
  47. package/src/source-text.ts +9 -26
  48. package/src/static-analysis-redundant-rules.ts +46 -2
  49. package/src/test-block-rules.ts +118 -14
  50. package/src/test-fixtures.ts +4 -1
  51. package/src/text-scans.ts +8 -1
  52. package/src/types.ts +17 -0
package/CHANGELOG.md CHANGED
@@ -1,8 +1,61 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.5.0 - 2026-08-16
4
+
5
+ 120 rules across 11 pillars on Node 22+. Every script rule now reads one shared syntax-only AST parse instead of walking lines, scoring changes shape, config and CLI validation fail instead of coercing, and the release gains gates that fail the build when a documented count or the scan surface drifts from the source.
6
+
7
+ **Analysis.** Complexity, naming, docblock, and redirect rules read the shared parse, so generic, multi-line, and parenless-arrow declarations are analysed for the first time and complexity findings carry a per-kind `breakdown`. Findings narrow to real evidence: name-only `redirect` helpers, lockfile integrity digests, and bodyless overload signatures stop reporting, while tainted input reaching a response sink and a credential in a `resolved` URL still do. A false-positive sweep took the analyser's own scan to zero findings, which CI now enforces.
8
+ **Scoring.** The composite averages all 11 rule-backed pillars and counts a clean pillar as 100 (ADR-019), so fixing a pillar's last finding cannot lower the score. It stays volume-sensitive and is not yet a cross-project grade: vulnerable nodejs-goof scores 77.9 against clean zod at 18.8.
9
+ **Guardrails and release.** The Claude, Codex, and Copilot agent surfaces move to goat-flow 1.15.1, and three deny-hook bypasses are fixed locally ahead of the upstream template. Packaging is gated by a tarball smoke test that installs the pack fresh and runs the binary, with read-only CI across Node 22, 24, and 26.
10
+ **Needs action before upgrading.** Outside-root scans emit absolute paths, so regenerate any baseline built from a different working directory. `cb` and `fn` now trigger `naming.short-variable` unless listed in `allowlists.acceptedAbbreviations`. `size.file-length` is an error at 1000 substantive lines, which moves `--fail-on` exit codes.
11
+
12
+ - **BREAKING: External finding paths** - outside-root scans emit absolute paths; regenerate baselines made from a different working directory.
13
+ - **BREAKING: Family abbreviations** - `cb`/`fn` now trigger `naming.short-variable`; add them to `allowlists.acceptedAbbreviations` to retain them.
14
+ - **file-length raised to error at 1000 (family ratification)** - only the threshold and severity moved; `--fail-on` consumers see exit-code changes.
15
+ - **Shared AST discovery (one parse per script)** - generics, multi-line, and parenless arrows analysed; anchors and fingerprints preserved.
16
+ - **Complexity follows control flow** - syntax nodes drive cyclomatic/cognitive; findings gain a `breakdown`; thresholds and identities unchanged.
17
+ - **Docblock rules require the shared parse** - AST signatures only, so paren types cannot fake stale @param tags; bounded files skip the pack.
18
+ - **Composite counts clean pillars as 100** - the mean spans all 11 pillars; fixing a pillar's last finding cannot lower it (ADR-019).
19
+ - **Known scoring limitation** - composite scores remain volume-sensitive: vulnerable nodejs-goof scores 77.9 (C), NodeGoat 52.2 and clean zod 18.8.
20
+ - **Casing consistency follows owners** - variants compare within one module/function/interface owner; DTO vs UI fields no longer conflict.
21
+ - **Re-opened namespaces are one contract** - the merge scope keys on the namespace path, so casing drift between `namespace Api` blocks now reports.
22
+ - **Open-redirect needs a real sink** - name-only `redirect` helpers stay quiet; tainted input to response/location sinks still reports.
23
+ - **React Router redirects are open-redirect sinks** - `react-router` and `react-router-dom` join next/navigation and remix; local helpers stay quiet.
24
+ - **A method named after a redirect import cannot hide it** - only declarations and named function expressions shadow by name; a method name is a key.
25
+ - **process-exec severity follows evidence** - warning only for shell-enabled dynamic commands; fixed vectors advisory; ids churn once (ADR-018).
26
+ - **Lockfiles drop only the entropy detector** - integrity digests stop reporting (NodeGoat 1,292 to 0); a credential in `resolved` still errors.
27
+ - **Short secret previews masked** - under 24 chars shows mask+length; an allowlist cannot hide a same-length secret; hook ids churn once (ADR-017).
28
+ - **Quoted env secrets keep embedded hashes** - quoted values read whole so `#` cannot truncate a credential; unquoted still stop at `#`.
29
+ - **Same-line secrets stay distinct** - column discriminates same-line findings and ships in the hook payload (ADR-017); fingerprints unchanged.
30
+ - **Markdown reports escape repo text** - fenced labels/paths and escaped messages block injection into PR comments. (`src/report-renderers.ts`)
31
+ - **Actions write-permission scopes match GitHub's 2026-07-12 table** - `discussions` and `pages` count as write; `id-token` mints tokens, not writes.
32
+ - **Config validation fails loudly** - unknown rules, non-boolean enabled, bad option keys exit 2 naming accepted forms; compat tightening.
33
+ - **Invalid CLI values fail fast** - format/fail-on/changed-scope validated at parse as usage errors; compat tightening. (`src/cli-program.ts`)
34
+ - **Severity overrides reach every scanner** - one central pass applies rules.<id>.severity everywhere; fingerprints stay severity-free.
35
+ - **Filtered scans cannot record history** - `--history-file` with diff/since/ranges exits 2 before any write; full scans still append.
36
+ - **Diff scoping works from nested directories** - relative-path git diffs; nested runs cannot match siblings; root runs byte-identical.
37
+ - **Parser errors collapse per file** - reports retain the first message plus raw count; angular drops 1,854 diagnostics to 476 affected files.
38
+ - **Non-text scripts skip parsing** - invalid UTF-8 or NUL-bearing files produce a non-fatal `non-text-file` note instead of a parse error.
39
+ - **Guardrail hooks deliberately diverge from the goat-flow template** - `install`/`hooks sync` reverts them; re-apply after any upgrade.
40
+ - **Naming and size false positives cut** - aliased class exports, parameter defaults, short locals, acronym pairs, and bodyless signatures go quiet.
41
+ - **Docs and test false positives cut** - decorator comments, stacked fixture-purpose headers, quoted task markers, and labeled data loops stay quiet.
42
+
43
+ ## v0.4.0 - 2026-06-11
44
+
45
+ - **Circular imports group by SCC** - `design.circular-import` reports one finding per strongly connected component (member list in `metadata.files`); circular-import fingerprints and hook identities intentionally churn (ADR-015). OpenUI dropped from 108 findings to 3.
46
+ - **Cycles stay visible in scoped scans** - narrow path scans build root graph context for the circular rule only, and changed-region and hook runs keep a cycle when any member file changed.
47
+ - **Scan-surface notes** - reports gain an additive `notes` field: `no-analysable-files` for paths with nothing analysable, `bounded-deep-scan` for huge files that keep text rules but skip deep passes. Notes name their file; diagnostics still own exit 2.
48
+ - **Generated-source policy** - explicit generation markers (`@generated`, `DO NOT EDIT`, ...) suppress documentation and naming findings only; every other pillar still runs.
49
+ - **Real TypeScript parse diagnostics** - the TypeScript syntax parser replaces the delimiter heuristic, so valid TSX no longer false-positives and real syntax errors keep exit 2.
50
+ - **Sensitive-data precision** - exempts word-segment identifiers, character-set alphabets, code-expression env values, Luhn digit runs without card vocabulary, and explicit fake markers (`EXAMPLE`, `REDACTED`, ...); real secrets still flag.
51
+ - **Security and test-quality tuning** - `security.sql-concatenation` covers `prepare(...)`, validation-only publish gates stop flagging `security.risky-lifecycle-script`, `security.process-exec` carries `callName`/`argumentSource`/`shellEnabled` hints, and static-import test sentinels downgrade to review guidance.
52
+ - **`dead-code.unused-private-method`** - bare `this.method` references count as usage; unrelated properties sharing the name no longer mask an unused private method.
53
+ - **Execution-level rule gating** - rules disabled by config or profile now skip their scanner passes instead of filtering findings afterwards, and the comment-quality gate no longer silently disables `docs.fixture-purpose-missing`.
54
+ - **Hook efficiency** - changed-region hook runs reuse one analysis pass; the diff/since new-only replay stays a second pass and materializes every SCC member, so pre-existing cycles are not reported as new. vscode-scale repos still need the minimal profile.
55
+
3
56
  ## v0.3.2 - 2026-06-09
4
57
 
5
- - **Agent-hook contract v1** - adds `gruff-ts hook` and `gruff-ts hook --capabilities --format=json`, advertising `gruff.hook.v1` with `flagOrder:"any"`. Hook JSON uses the cross-analyzer contract fields (`file`, `scope`, `suppressed.count`, `ignored.paths`, `config.error`) with non-null remediation, stable hook identities, and machine-readable threshold metadata. Hook mode exits `0` when analysis runs, omits file/project-scope findings under changed-region attribution, and uses stable identity for baseline/diff new-only filtering (`--diff unstaged` compares against the index, `suppressed.count` never double-counts a re-emitted finding, and distinct project-scope findings such as separate import cycles anchored to one file keep distinct identities so baselining one never suppresses another). Operational failures (missing/malformed baseline, `--diff`/`--since` outside a git repo) report in-band as `config.error` with exit `2` rather than crashing. The conformance tests cover capabilities, scopes/enums, remediation, threshold metadata, stable identity across line/value changes (including multiple same-rule findings in one file and distinct import cycles sharing an anchor file), baseline and diff new-only, operational-failure JSON, flag ordering, advisory exit, ignored paths, and config-error JSON. Existing `analyse` / `summary` / `report` schema versions and exit semantics are unchanged. (`src/hook-contract.ts`, `src/cli-program.ts`, `src/hook-contract.test.ts`)
58
+ - **Agent-hook contract v1** - adds `gruff-ts hook` and `gruff-ts hook --capabilities --format=json`, advertising `gruff.hook.v1` with `flagOrder:"any"`. Hook JSON uses the cross-analyser contract fields (`file`, `scope`, `suppressed.count`, `ignored.paths`, `config.error`) with non-null remediation, stable hook identities, and machine-readable threshold metadata. Hook mode exits `0` when analysis runs, omits file/project-scope findings under changed-region attribution, and uses stable identity for baseline/diff new-only filtering (`--diff unstaged` compares against the index, `suppressed.count` never double-counts a re-emitted finding, and distinct project-scope findings such as separate import cycles anchored to one file keep distinct identities so baselining one never suppresses another). Operational failures (missing/malformed baseline, `--diff`/`--since` outside a git repo) report in-band as `config.error` with exit `2` rather than crashing. The conformance tests cover capabilities, scopes/enums, remediation, threshold metadata, stable identity across line/value changes (including multiple same-rule findings in one file and distinct import cycles sharing an anchor file), baseline and diff new-only, operational-failure JSON, flag ordering, advisory exit, ignored paths, and config-error JSON. Existing `analyse` / `summary` / `report` schema versions and exit semantics are unchanged. (`src/hook-contract.ts`, `src/cli-program.ts`, `src/hook-contract.test.ts`)
6
59
  - **Changed-region symbol scope drops inherited file-wide findings** - `--changed-scope symbol` now suppresses file-wide and file-aggregate findings when the changed range does not touch their anchor/span, so inherited debt such as `size.file-length` is counted in `suppressedCount` instead of reported on unrelated edits. Use `--changed-scope file` for CI workflows that intentionally want every finding from a touched file, including deletion-only edits. Full scans still report every file-wide finding. No severity, threshold, rule-id, or pillar change. (`src/changed-regions.ts`, `src/changed-region-scope.test.ts`, `src/changed-region-contract.test.ts`)
7
60
  - **Threshold findings expose reviewable measurements** - `size.file-length`, `size.function-length`, `size.parameter-count`, `complexity.cyclomatic`, `complexity.cognitive`, `sensitive-data.high-entropy-string`, and `sensitive-data.hardcoded-env-value` now carry additive `measured`/`threshold` measurement metadata, and block-anchored findings carry `endLine` spans so hook output can attribute symbol-scope findings without message parsing. `size.file-length` also gets finding-level remediation from the descriptor text. Existing fingerprints stay stable. (`src/analyser.ts`, `src/blocks.ts`, `src/findings.ts`, `src/sensitive-data-rules.ts`)
8
61
 
package/README.md CHANGED
@@ -20,14 +20,19 @@ Used as a hook on an agent's output, gruff-ts is a forcing function rather than
20
20
 
21
21
  | Field | Value |
22
22
  | --- | --- |
23
- | Release line | Published `0.3.2` package line |
24
- | Runtime | Node.js `22+` |
23
+ | Release line | `0.5.0` |
24
+ | Runtime | Node.js `22+`; release CI covers 22, 24, and 26 |
25
+ | Runtime dependencies | `commander`, `tsx`, and `typescript` |
25
26
  | Package | `@blundergoat/gruff-ts` |
26
27
  | Binary | `gruff-ts` |
27
28
  | Rule catalogue | 120 rules across 11 pillars |
28
29
  | Primary config | `.gruff-ts.yaml`; `.gruff.json`, `.gruff.yaml`, and `.gruff.yml` are fallback files |
29
30
  | Analysis schema | `gruff.analysis.v2` |
31
+ | Summary schema | `gruff.summary.v2` |
30
32
  | Baseline schema | `gruff.baseline.v1` |
33
+ | Hotspot schema | `gruff.hotspot.v1` |
34
+ | Agent-hook schema | `gruff.hook.v1` |
35
+ | Config schema | `gruff-ts.config.v0.1` |
31
36
  | Severity gate | `--fail-on` with `none`, `advisory`, `warning`, `error` |
32
37
  | Dashboard | `127.0.0.1:8767` by default |
33
38
 
@@ -94,9 +99,10 @@ Open `http://127.0.0.1:8767/` for the dashboard.
94
99
  | `list-rules` | Print rule metadata as text or JSON. |
95
100
  | `list-profiles` | Print the built-in profiles (`gruff.minimal`, `gruff.recommended`, `gruff.strict`) with their rule-count summary, as text or JSON. |
96
101
  | `check-ignore <paths...>` | Report whether each path is ignored (config, gitignore, or default) with the matching source and pattern; runs no analysis. |
102
+ | `hook [paths...]` | Emit the `gruff.hook.v1` coding-agent contract and capability metadata. |
97
103
  | `dashboard` | Serve the local browser dashboard. |
98
104
  | `completion [shell]` | Print a shell completion script for `bash`, `zsh`, or `fish`. |
99
- | `list`, `help` | Show command lists and command-specific help. |
105
+ | `list` | Show the registered command catalogue. Use `--help` on the root or a command for detailed help. |
100
106
 
101
107
  Global console options match the broader gruff CLI surface: `--silent`, `--quiet`, `--ansi` / `--no-ansi`, `--no-interaction`, and `-v` / `-vv` / `-vvv`.
102
108
 
@@ -158,6 +164,8 @@ npx gruff-ts analyse . --no-baseline --fail-on=error
158
164
  Use `--config <path>` for an explicit file or `--no-config` to skip config loading. Recursive scans respect root and nested `.gitignore` files; `--include-ignored` includes default and Git-ignored paths for one run, but `paths.ignore` entries still apply as project policy.
159
165
 
160
166
  ```yaml
167
+ schemaVersion: gruff-ts.config.v0.1
168
+
161
169
  paths:
162
170
  ignore:
163
171
  - "generated/**"
@@ -243,7 +251,7 @@ Use `npx gruff-ts list-rules --format=json` for exact rule IDs, severities, conf
243
251
 
244
252
  ## Baselines And Changed-Code Scans
245
253
 
246
- For editor and coding-agent feedback, prefer the analyzer-owned hook contract:
254
+ For editor and coding-agent feedback, prefer the analyser-owned hook contract:
247
255
 
248
256
  ```bash
249
257
  npx gruff-ts hook --format=json --changed-ranges "3-3,8-10" src/foo.ts
@@ -298,11 +306,13 @@ In polyglot repositories, `gruff-ts` defaults to port `8767`, `gruff-rs` default
298
306
 
299
307
  ## Trust Boundary
300
308
 
301
- Default scans are local source inspections. `gruff-ts` parses supported source, config, and package metadata files; it does not execute target application code, run tests, invoke the TypeScript compiler, query package registries, or read vulnerability feeds. Git is used only for explicit diff modes. Secret-like findings use redacted previews; raw secret values should not appear in terminal, JSON, SARIF, GitHub, Markdown, hotspot, or HTML output.
309
+ Default scans are local source inspections. `gruff-ts` parses supported source, config, and package metadata files; it does not execute target application code, run tests, type-check or emit through the TypeScript compiler, query package registries, or read vulnerability feeds. The runtime `typescript` dependency is used only for syntax parsing, while `tsx` launches the shipped TypeScript source and `commander` owns the CLI. Git is used only for explicit diff modes. Secret-like findings use redacted previews; raw secret values should not appear in terminal, JSON, SARIF, GitHub, Markdown, hotspot, or HTML output.
302
310
 
303
311
  ## Stability Contract
304
312
 
305
- The `0.3.x` line treats rule IDs, finding fingerprints, baseline identity, `gruff.analysis.v2`, `gruff.baseline.v1`, `gruff.hotspot.v1`, SARIF rendering, and CLI exit semantics as compatibility-sensitive. Breaking changes should be tagged as a future minor release and recorded in [`CHANGELOG.md`](CHANGELOG.md).
313
+ The `0.5.x` line treats rule IDs, finding fingerprints, baseline identity, `gruff.analysis.v2`, `gruff.summary.v2`, `gruff.baseline.v1`, `gruff.hotspot.v1`, `gruff.hook.v1`, `gruff-ts.config.v0.1`, SARIF rendering, and CLI exit semantics as compatibility-sensitive. Breaking changes belong in a coordinated future release and must be recorded in [`CHANGELOG.md`](CHANGELOG.md).
314
+
315
+ Analysis JSON continues to emit canonical `file` alongside legacy `filePath` for findings and top offenders. The v0.3.1 plan to remove `filePath` in the next release was superseded when v0.4.0 retained the alias. Consumers should read `file` now; removing `filePath` waits for the coordinated family JSON unification instead of happening in this port alone.
306
316
 
307
317
  ## How It Compares
308
318
 
package/SECURITY.md CHANGED
@@ -4,7 +4,8 @@
4
4
 
5
5
  | Version | Supported |
6
6
  | --- | --- |
7
- | 0.3.x | Yes |
7
+ | 0.5.x | Yes |
8
+ | 0.4.x and earlier | No |
8
9
 
9
10
  ## Reporting A Vulnerability
10
11
 
package/docs/README.md CHANGED
@@ -18,7 +18,4 @@ Use these docs with the top-level README for the stable user-facing surface.
18
18
 
19
19
  ## Shared Contract
20
20
 
21
- Cross-language naming and CLI expectations live in
22
- [`../../CONTRACT.md`](../../CONTRACT.md). TypeScript keeps `summary` analysis
23
- flags as documented extensions while also supporting the common `--format` and
24
- `--top` summary surface.
21
+ `gruff-ts` follows the cross-language naming and CLI expectations shared across the gruff family (`gruff-go`, `gruff-php`, `gruff-py`, `gruff-rs`). It keeps its `summary` analysis flags as documented extensions while also supporting the common `--format` and `--top` summary surface.
@@ -12,7 +12,7 @@ For CI-style gates, `analyse` owns the exit code:
12
12
  - `1` - at least one finding met `--fail-on`; the agent must fix and re-run.
13
13
  - `2` - fatal (bad input, parse or config error); stop and surface it.
14
14
 
15
- For editor or PostToolUse feedback, use the analyzer-owned hook contract instead:
15
+ For editor or PostToolUse feedback, use the analyser-owned hook contract instead:
16
16
 
17
17
  ```bash
18
18
  gruff-ts hook --format json --changed-ranges "12-40,88-90" src/foo.ts
@@ -24,11 +24,23 @@ gruff-ts hook --capabilities --format json
24
24
  metadata. Hook mode is advisory: findings exit `0`; config failures are returned in
25
25
  `config.error` and exit `2`.
26
26
 
27
+ Parse and read diagnostics are file-scoped and reported in-band via the additive
28
+ `diagnostics` array (`{ type, message, file, line }`): a full scan carries every
29
+ analysed file's diagnostics, a `--diff`/`--since` run carries only diagnostics
30
+ from changed target files, and `--changed-ranges` carries every diagnostic of
31
+ each requested file (a syntax error breaks parsing of the whole file, so ranges
32
+ never filter diagnostics). The default hook exit stays `0` with diagnostics
33
+ in-band; pass the explicit consumer request flag `--fail-on-diagnostics` to exit
34
+ `2` when relevant diagnostics exist. The capability handshake advertises this via
35
+ `supports.diagnostics` and `flags.failOnDiagnostics` - the capability is a
36
+ producer advertisement only and never changes behavior by itself. Fatal failures
37
+ (analysis could not run at all) keep operational-error exit `2` semantics.
38
+
27
39
  ## Scan the change, not the repo
28
40
 
29
41
  > **Goal:** govern only the code the agent changed, not the whole repo - so the agent resolves findings in its own diff and a clean change is never blocked by pre-existing findings elsewhere.
30
42
 
31
- Gate the agent on what it actually touched, so a clean diff is not blocked by pre-existing findings elsewhere:
43
+ Gate the agent on what it actually touched:
32
44
 
33
45
  ```bash
34
46
  # Uncommitted working-tree changes (typical agent loop)
@@ -47,7 +59,7 @@ npx gruff-ts analyse --changed-ranges "12-40,88-90" src/foo.ts --fail-on=warning
47
59
  git diff | npx gruff-ts analyse --diff - --fail-on=warning
48
60
  ```
49
61
 
50
- Changed-region scans keep only findings attributable to the changed hunk or its enclosing symbol, so the agent fixes its own work instead of inheriting the whole backlog. In `hook` mode, whole-file metrics such as `size.file-length` are omitted under changed-region attribution and counted in `suppressed.count`; they return only in full-scan hook output or when `--baseline` / `--diff` shows their stable identity is new. In `analyse`, use `--changed-scope file` for CI jobs that intentionally want every finding from a touched file.
62
+ Changed-region scans keep only findings attributable to the changed hunk, its enclosing symbol, or a project relationship that includes the requested file, so the agent fixes its own work instead of inheriting the whole backlog. In `hook` mode, whole-file metrics such as `size.file-length` are omitted under changed-region attribution and counted in `suppressed.count`; they return only in full-scan hook output or when `--baseline` / `--diff` shows their stable identity is new. Circular-import findings can appear as project-scope findings when the requested file participates in the SCC; they keep the canonical SCC anchor rather than re-anchoring to the edited file. In `analyse`, use `--changed-scope file` for CI jobs that intentionally want every finding from a touched file.
51
63
 
52
64
  ## Respect the project's ignore policy
53
65
 
@@ -133,6 +133,21 @@ gruff-ts check-ignore src/generated-client.ts --format json
133
133
  # [ { "path": "src/generated-client.ts", "ignored": true, "source": "config", "pattern": "src/generated-client.ts" } ]
134
134
  ```
135
135
 
136
+ ## Generated Markers
137
+
138
+ Use `paths.ignore` when a generated or vendored surface should not be scanned at
139
+ all. If the file should stay in the scan, gruff treats a source file as generated
140
+ only when one of these explicit markers appears in the first 10 lines:
141
+ `AUTO-GENERATED`, `@generated`, `GENERATED FILE`, `Code generated`,
142
+ `Generated by`, `DO NOT EDIT`, or `Copied from`.
143
+
144
+ Generated files skip documentation and naming findings only. Security,
145
+ sensitive-data, size, complexity, maintainability, modernisation, and
146
+ test-quality checks still run, so a generated file can still report a leaked
147
+ credential, unsafe execution, or a file-size finding. Path names such as
148
+ `fixtures/`, `testdata/`, or `perf-tests/` do not by themselves suppress any
149
+ rule family.
150
+
136
151
  ## Allowlists
137
152
 
138
153
  `allowlists.acceptedAbbreviations` lowers naming-rule noise for project-specific
@@ -155,6 +170,11 @@ allowlists:
155
170
  - "abcd...wxyz (redacted, 32 chars)"
156
171
  ```
157
172
 
173
+ Only previews for values of at least 24 characters can be allowlisted. Shorter
174
+ previews are fully masked and identify only the value length, so gruff continues
175
+ to report them even if the same mask appears in `secretPreviews`. This prevents
176
+ one entry from hiding unrelated secrets of the same length.
177
+
158
178
  Prefer fixing false positives with a narrow config entry instead of disabling an
159
179
  entire sensitive-data rule.
160
180
 
@@ -164,7 +184,9 @@ fingerprints:
164
184
  | Key | Used by | Default behavior |
165
185
  | --- | --- | --- |
166
186
  | `acceptedAbbreviations` | `naming.short-variable` | Adds short names that should not be flagged. |
167
- | `acceptedBooleanNames` | `naming.boolean-prefix` | Replaces exact public/CLI/DTO boolean names such as `verbose`, `enabled`, `ok`, and `force`. |
187
+ | `acceptedBooleanNames` | `naming.boolean-prefix` | Replaces the complete set of exact interface/type contract-field names, such as `verbose`, `enabled`, `ok`, and `force`. |
188
+ | `acceptedClassFilePairs` | `naming.class-file-mismatch` | Replaces the exact case-insensitive `fileBase:ClassName` pairs that may use feature-file and class-role naming. Defaults to empty. |
189
+ | `acceptedCasingPairs` | `naming.inconsistent-casing` | Replaces the exact case-insensitive `wire_name:internalName` pairs allowed within one declaration or lexical owner. Either pair order matches. Defaults to empty. |
168
190
  | `bannedGenericNames` | `naming.generic-function` | Replaces the built-in generic function-name denylist. |
169
191
  | `booleanPrefixes` | `naming.boolean-prefix` | Replaces the accepted boolean-name prefixes such as `is`, `has`, `should`, `may`, `supports`, and `requires`. |
170
192
  | `hungarianPrefixes` | `naming.hungarian-notation` | Replaces type-style prefixes to flag. |
@@ -175,6 +197,25 @@ fingerprints:
175
197
  For replace-style allowlists, use an empty list (`[]`) when you intentionally
176
198
  want no entries.
177
199
 
200
+ When a boolean-prefix finding names `allowlists.acceptedBooleanNames`, copy any
201
+ defaults the project still needs into the configured list before adding the
202
+ external key - the configured list replaces defaults rather than extending
203
+ them. If renaming a JSON, CLI, or DTO key would break consumers, keep a clearer
204
+ internal field and map the external key explicitly at the serialization boundary.
205
+
206
+ Use exact pair allowlists when both names must coexist:
207
+
208
+ ```yaml
209
+ allowlists:
210
+ acceptedClassFilePairs: ["focusModeTranscript:TranscriptFocusController"]
211
+ acceptedCasingPairs: ["note_id:noteId"]
212
+ ```
213
+
214
+ The class/file entry uses the extensionless file base before the colon. Casing
215
+ pairs may be written in either order. Both lists are case-insensitive, replace
216
+ the complete configured list, and suppress only the exact pair rather than every
217
+ name sharing the same canonical form.
218
+
178
219
  ## Rule Controls
179
220
 
180
221
  Disable a rule:
@@ -221,7 +262,12 @@ See [Rules](./rules.md) for the full rule catalogue grouped by pillar.
221
262
 
222
263
  ## Example Project Config
223
264
 
265
+ A complete file. The shorter snippets above omit `schemaVersion` because they
266
+ show a single key in isolation; every real `.gruff-ts.yaml` needs it.
267
+
224
268
  ```yaml
269
+ schemaVersion: gruff-ts.config.v0.1
270
+
225
271
  paths:
226
272
  ignore:
227
273
  - "generated/**"
package/docs/dashboard.md CHANGED
@@ -31,6 +31,6 @@ is a deferred design question; raise it as an issue if your workflow needs it.
31
31
 
32
32
  ## Polyglot Repos
33
33
 
34
- `gruff-ts` defaults to port `8767`, `gruff-rs` defaults to `8766`, and Go, PHP,
35
- and Python default to `8765`. Use `--port` when running multiple dashboards at
36
- once.
34
+ `gruff-ts` defaults to port `8767`, `gruff-rs` defaults to `8766`, and
35
+ `gruff-go`, `gruff-php`, and `gruff-py` default to `8765`. Use `--port` when
36
+ running multiple dashboards at once.
@@ -12,6 +12,10 @@ the local dashboard.
12
12
  - `2` when diagnostics were produced, such as missing inputs or parse/config
13
13
  diagnostics.
14
14
 
15
+ Parse diagnostics for TypeScript and JavaScript source use TypeScript's
16
+ syntax-only parser, including TSX and JSX modes by extension. They do not run
17
+ semantic typechecking.
18
+
15
19
  Examples:
16
20
 
17
21
  ```bash
@@ -46,9 +50,27 @@ per-pillar counts, top rules, and top file offenders.
46
50
  Schema strings:
47
51
 
48
52
  - `gruff.analysis.v2` for full analysis reports.
53
+ - `gruff.summary.v2` for `summary --format=json`.
49
54
  - `gruff.baseline.v1` for baselines.
50
55
  - `gruff.hotspot.v1` for hotspot output.
51
56
 
57
+ `gruff.analysis.v2` may include an optional `notes` array. Notes are non-fatal:
58
+ they explain scan-surface limits without changing exit codes. `diagnostics`
59
+ still owns exit `2`.
60
+
61
+ Current note types:
62
+
63
+ - `no-analysable-files` - a requested path existed but contributed no supported
64
+ files, usually because ignore rules excluded everything under it.
65
+ - `bounded-deep-scan` - a script file exceeded the deep-scan budget. It still
66
+ counts as analysed and text-level rules still run, but deep TypeScript passes,
67
+ parse diagnostics, and project-graph retention are skipped for that file.
68
+
69
+ The deep-scan budget is `20,000` lines or `2,000,000` UTF-8 bytes, whichever
70
+ limit is hit first. Text output prints notes in a `Notes:` block. JSON reports
71
+ omit `notes` when there are no notes, so ordinary scans keep the same report
72
+ shape.
73
+
52
74
  ## GitHub Actions
53
75
 
54
76
  Use GitHub annotation output in a workflow step:
@@ -107,6 +129,16 @@ gruff-ts analyse . --no-baseline --fail-on=none
107
129
  Review baseline diffs carefully. A baseline suppresses matching fingerprints, so
108
130
  unexpected additions can hide findings.
109
131
 
132
+ Known `gruff.baseline.v1` limitation: entries match on `(fingerprint, ruleId,
133
+ filePath)`, and the fingerprint hashes the line, not the column. Two distinct
134
+ same-line findings from one rule (for example two secrets on one line) are
135
+ reported separately since 0.5.0, but they still share a fingerprint and a
136
+ baseline matches them as one identity. Pure code movement changes the
137
+ fingerprint and resurfaces baselined findings as new. Both are addressed by
138
+ the count-based `gruff.baseline.v2` planned for the coordinated cross-analyser
139
+ schema release (ADR-013, ADR-017); until then, regenerate the baseline after
140
+ moves instead of hand-editing entries.
141
+
110
142
  `report` intentionally renders raw scan results and does not accept a
111
143
  `--baseline` option. Use `analyse` for baseline-aware machine output.
112
144
 
@@ -155,5 +187,9 @@ Append score history to a JSON file:
155
187
  gruff-ts analyse . --history-file .gruff-history.json --fail-on=none
156
188
  ```
157
189
 
190
+ `--history-file` requires a full scan. Combining it with `--diff`, `--since`, or
191
+ `--changed-ranges` exits `2` before anything is written, so a filtered scan can
192
+ never append a partial trend point.
193
+
158
194
  History files are local artifacts. Commit them only if your project explicitly
159
195
  wants trend data in version control.
package/docs/rules.md CHANGED
@@ -18,6 +18,13 @@ Use the CLI when you need machine-readable metadata:
18
18
  gruff-ts list-rules --format=json
19
19
  ```
20
20
 
21
+ Generated source policy: a file whose first 10 lines include an explicit marker
22
+ such as `AUTO-GENERATED`, `@generated`, `Generated by`, `DO NOT EDIT`, or
23
+ `Copied from` skips documentation and naming findings only. All other pillars,
24
+ including security, sensitive-data, size, complexity, and test-quality, still
25
+ run. A path segment such as `fixtures`, `testdata`, or `perf-tests` does not by
26
+ itself suppress any rule family.
27
+
21
28
  ## Pillar Counts
22
29
 
23
30
  - complexity: 2
@@ -34,16 +41,18 @@ gruff-ts list-rules --format=json
34
41
 
35
42
  ## Complexity
36
43
 
37
- - `complexity.cognitive` (warning; high confidence; threshold 15): Flags functions with high combined branch and nesting complexity.
38
- - `complexity.cyclomatic` (warning; high confidence; threshold 15): Flags functions with many independent branch paths.
44
+ - `complexity.cognitive` (warning; high confidence; threshold 15): Flags syntax-aware decisions plus nested `if`, loop, `switch`, `catch`, and ternary depth. Object literals, callback wrappers, classes, and ordinary blocks do not add nesting; `else if` remains at peer depth and switch cases do not stack.
45
+ - `complexity.cyclomatic` (warning; high confidence; threshold 15): Starts at one, then counts each `if`, loop, `catch`, non-default `case`, ternary, `&&`, and `||` syntax node once. The `switch` wrapper, `default`, `??`, optional property/element/call chains, and non-null assertions add zero.
46
+
47
+ Both rules consume the same parsed callable measurement as `docs.missing-why-for-complex-code`. A nested callable already reported as its own block is measured separately; an anonymous callback without its own block stays part of the nearest reported owner. Complexity findings retain `metadata.complexity` and `metadata.threshold` and add a fixed `metadata.breakdown` object with `if`, `loop`, `catch`, `case`, `ternary`, `logicalAnd`, `logicalOr`, and `maxNesting` counts.
39
48
 
40
49
  ## Dead Code
41
50
 
42
- - `dead-code.unused-private-method` (advisory; low confidence): Flags private methods without an apparent same-file call site.
51
+ - `dead-code.unused-private-method` (advisory; low confidence): Flags private methods without an apparent same-file call site. Bare method references (`items.map(this.double)`, `onClick={this.handler}`) count as usage. Low confidence by design - tests, decorators, framework hooks, and reflection can still reach a method invisibly. Pre-existing scope boundary: `private async`/`private static` declarations and `#name` ECMAScript-private members are not matched by the declaration scan.
43
52
 
44
53
  ## Design
45
54
 
46
- - `design.circular-import` (warning; medium confidence): Flags simple relative import cycles inside the discovered source set.
55
+ - `design.circular-import` (warning; medium confidence): Flags strongly connected relative import components. Each component reports once, anchored on the lexicographically first member path, with sorted member paths and a representative cycle path in metadata. Narrow path scans build root graph context for this rule only, then emit SCCs that include a requested file; per-file rules and `paths.analysedFiles` remain scoped to the requested paths.
47
56
  - `design.deep-relative-import` (advisory; medium confidence; threshold 2): Flags relative imports that climb too many parent directories.
48
57
  - `design.large-module-concentration` (advisory; medium confidence; threshold 55; options: minFiles, minLines): Flags a production module that dominates project source lines.
49
58
  - `design.package-bin-missing` (warning; high confidence): Flags package bin entries that point at missing files.
@@ -51,7 +60,7 @@ gruff-ts list-rules --format=json
51
60
 
52
61
  ## Documentation
53
62
 
54
- - `docs.fixture-purpose-missing` (advisory; medium confidence): Flags large or scanner-relevant fixtures without a nearby purpose comment.
63
+ - `docs.fixture-purpose-missing` (advisory; medium confidence): Flags large or scanner-relevant fixtures without a nearby purpose comment. A comment on or directly above the fixture (or above the test declaration for setup findings) clears it when it uses the purpose vocabulary or is a substantive explanation of eight or more words; stacked `//` headers count as one comment.
55
64
  - `docs.magic-threshold-without-rationale` (advisory; medium confidence): Flags threshold-like numeric values without a nearby rationale comment.
56
65
  - `docs.missing-error-behavior-doc` (advisory; medium confidence): Flags commented functions whose error behavior is not described.
57
66
  - `docs.missing-exported-function-doc` (warning; medium confidence): Flags exported functions without a leading maintainer comment.
@@ -63,13 +72,34 @@ gruff-ts list-rules --format=json
63
72
  - `docs.missing-public-doc` (advisory; medium confidence): Flags exported class, type, and enum APIs without a nearby doc comment.
64
73
  - `docs.missing-return-tag` (advisory; medium confidence): Flags documented non-void exports without @returns.
65
74
  - `docs.missing-side-effect-doc` (advisory; medium confidence): Flags commented functions that perform observable side effects without naming them.
66
- - `docs.missing-why-for-complex-code` (advisory; medium confidence): Flags comments on complex functions that do not explain why the shape exists.
75
+ - `docs.missing-why-for-complex-code` (advisory; medium confidence): Flags comments on complex functions that do not explain why the shape exists. Accepted rationale vocabulary includes `because`, `why`, `intentional`, `tradeoff`/`trade-off`, `compat`/`compatible`/`compatibility`, `avoid`, and `preserve`, plus the phrases `due to`, `so that`, `in order to`, and `required by`. A contiguous run of leading `//` lines is evaluated as one comment; block comments are already evaluated as one body.
67
76
  - `docs.stale-comment` (advisory; medium confidence): Flags comments that reference missing files, unknown rules, stale CLI flags, or the wrong declaration.
68
77
  - `docs.stale-param-tag` (advisory; medium confidence): Flags @param tags for parameters no longer in the signature.
69
78
  - `docs.suppression-without-rationale` (advisory; medium confidence): Flags lint, formatter, coverage, or tool suppressions without a maintainer rationale.
70
- - `docs.todo-without-tracking` (advisory; high confidence): Flags TODO, FIXME, HACK, and XXX comments without tracking context.
79
+ - `docs.todo-without-tracking` (advisory; high confidence): Flags comments introduced by a TODO, FIXME, HACK, or XXX marker without tracking context. The marker must start a comment body line (followed by `:`, `(`, `-`, whitespace, or end of line); quoted, backticked, mid-sentence, and fenced-example mentions are prose and stay quiet.
71
80
  - `docs.useless-docblock` (advisory; medium confidence): Flags comments or docblocks that only restate the symbol name.
72
81
 
82
+ ## Maintainability
83
+
84
+ Rule IDs in this pillar keep the `waste.` prefix. The pillar was renamed from
85
+ `waste` to `maintainability` in 0.1.1 and the IDs deliberately stayed put, so
86
+ existing config overrides and baselines keep matching.
87
+
88
+ - `waste.any-type` (warning; high confidence): Flags any type usage.
89
+ - `waste.broad-runtime-version` (advisory; medium confidence): Flags broad runtime dependency version ranges.
90
+ - `waste.commented-out-code` (advisory; high confidence): Flags comments that appear to contain disabled code.
91
+ - `waste.console-log` (advisory; high confidence): Flags console log/debug calls in source.
92
+ - `waste.empty-function` (advisory; high confidence): Flags functions with no executable body.
93
+ - `waste.exported-any` (warning; medium confidence): Flags exported APIs exposing any.
94
+ - `waste.redundant-boolean-cast` (advisory; medium confidence): Flags redundant boolean casts in condition expressions.
95
+ - `waste.redundant-variable` (advisory; medium confidence): Flags variables returned immediately after assignment.
96
+ - `waste.swallowed-catch` (warning; medium confidence): Flags empty catch blocks.
97
+ - `waste.unreachable-code` (warning; high confidence): Flags statements after terminating statements.
98
+ - `waste.unused-import` (advisory; medium confidence): Flags named imports with no apparent usage.
99
+ - `waste.unused-parameter` (advisory; medium confidence): Flags parameters with no apparent usage.
100
+ - `waste.useless-catch` (advisory; high confidence): Flags catch blocks that only rethrow the caught value.
101
+ - `waste.useless-return` (advisory; medium confidence): Flags terminal bare return statements in void functions.
102
+
73
103
  ## Modernisation
74
104
 
75
105
  - `modernisation.date-now-candidate` (advisory; high confidence): Flags verbose current-time expressions that can use Date.now().
@@ -89,14 +119,14 @@ gruff-ts list-rules --format=json
89
119
 
90
120
  ## Naming
91
121
 
92
- - `naming.acronym-case` (advisory; medium confidence): Flags mixed casings of a known acronym in one file.
93
- - `naming.boolean-prefix` (advisory; medium confidence; allowlists: booleanPrefixes, acceptedBooleanNames): Flags boolean names without intent-revealing prefixes on declarations, function parameters (typed `: boolean` or with `= true|false` default), and interface/type-literal fields.
94
- - `naming.class-file-mismatch` (advisory; medium confidence): Flags exported classes whose name differs from the file name.
122
+ - `naming.acronym-case` (advisory; medium confidence): Flags a known acronym cased inconsistently across a file's chosen-case names (camelCase/PascalCase and other mixed-case forms). SCREAMING_SNAKE constants and all-lower names are convention-forced surfaces and do not count.
123
+ - `naming.boolean-prefix` (advisory; medium confidence; allowlists: booleanPrefixes, acceptedBooleanNames): Flags boolean names without intent-revealing prefixes on declarations, function parameters (typed `: boolean` or with `= true|false` default), and interface/type-literal fields. Local and parameter findings recommend a safe rename (`remediationAction: APPLY`). Contract-field findings use `CONFIGURE` with `configurationKey: allowlists.acceptedBooleanNames` and explain that users may instead preserve an external key through explicit serialization mapping; configuration replaces the complete accepted-name list rather than merging one entry into the defaults.
124
+ - `naming.class-file-mismatch` (advisory; medium confidence; allowlist: acceptedClassFilePairs): Flags a named class whose normalized name differs from the file only when it is the module's sole supported public declaration. Direct exports, named default exports, and bottom re-exports share one syntax inventory; a public class beside an interface, type, enum, function, default value, or external re-export stays quiet. Exact case-insensitive `fileBase:ClassName` entries preserve intentional feature-file/class-role conventions. Retained findings include `candidatePrimaryExport: true` and sorted `publicExports` metadata.
95
125
  - `naming.generic-function` (advisory; high confidence): Flags generic function names that hide intent.
96
126
  - `naming.generic-parameter` (advisory; medium confidence; options: minCyclomatic, minLineCount, minParameters): Flags placeholder parameter names in multi-parameter, long, exported, or complex functions.
97
127
  - `naming.hungarian-notation` (advisory; medium confidence): Flags identifiers named after storage type prefixes.
98
128
  - `naming.identifier-quality` (advisory; medium confidence): Flags placeholder or numbered identifiers on declarations, function parameters, and destructured locals.
99
- - `naming.inconsistent-casing` (advisory; medium confidence): Flags the same canonical identifier appearing in two different surface forms (for example CONSTANT_CASE and camelCase) in one file.
129
+ - `naming.inconsistent-casing` (advisory; medium confidence; allowlist: acceptedCasingPairs): Flags one canonical identifier appearing in different forms within the same module, function, interface, or named type-literal owner. Separate raw DTO and normalized UI model contracts may keep their own conventions; same-name interface declaration blocks in one lexical scope are treated as one merged owner. Exact case-insensitive pairs such as `note_id:noteId` preserve documented wire aliases inside one owner without hiding other variants.
100
130
  - `naming.negative-boolean` (advisory; medium confidence): Flags boolean identifiers framed as a negation on declarations, parameters, and interface fields.
101
131
  - `naming.short-variable` (advisory; medium confidence): Flags very short variable names outside common loop counters; covers declarations, function parameters, and destructured locals.
102
132
 
@@ -119,11 +149,11 @@ gruff-ts list-rules --format=json
119
149
  - `security.new-function` (error; high confidence): Flags Function constructor dynamic code execution.
120
150
  - `security.open-redirect-candidate` (warning; medium confidence): Flags external input sent to redirect or navigation sinks.
121
151
  - `security.path-traversal-candidate` (warning; medium confidence): Flags external input sent to filesystem path sinks.
122
- - `security.process-exec` (warning; high confidence): Flags child-process execution calls.
152
+ - `security.process-exec` (warning; high confidence): Flags child-process execution calls, grading severity from command-source and shell-mode evidence: warning only when a shell-enabled call takes a dynamic command.
123
153
  - `security.proto-access` (warning; medium confidence): Flags direct __proto__ access that can enable prototype pollution.
124
154
  - `security.remote-install-script` (error; medium confidence): Flags package scripts that pipe remote content to a shell.
125
- - `security.risky-lifecycle-script` (warning; medium confidence): Flags package lifecycle scripts that run automatically.
126
- - `security.sql-concatenation` (warning; high confidence): Flags SQL text composed with runtime string interpolation.
155
+ - `security.risky-lifecycle-script` (warning; medium confidence): Flags install-time and side-effectful publish lifecycle scripts while allowing validation-only publish gates.
156
+ - `security.sql-concatenation` (warning; high confidence): Flags SQL text composed with runtime interpolation or concatenation in `query`, `execute`, `raw`, or `prepare` calls. Parameterized value placeholders stay quiet, but unknown runtime identifier interpolation such as table prefixes remains visible unless a project proves and documents a trusted source. The scanner is line-local and does not inspect multi-line SQL templates.
127
157
  - `security.ssrf-candidate` (warning; medium confidence): Flags external input sent to network request sinks.
128
158
  - `security.string-timer` (warning; high confidence): Flags string callbacks passed to timers.
129
159
  - `security.throw-non-error` (warning; medium confidence): Flags thrown non-Error values.
@@ -134,20 +164,22 @@ gruff-ts list-rules --format=json
134
164
 
135
165
  ## Sensitive Data
136
166
 
167
+ Pattern detectors (AWS keys, API keys, credential URLs, JWTs) skip values carrying explicit fake markers inside the matched value itself (`EXAMPLE`, `REDACTED`, `PLACEHOLDER`, `CHANGEME`, or masked `****`/`XXXX` runs) - the canonical AWS documentation keys end in `EXAMPLE`. A test or fixture file path alone never suppresses a production-shaped secret.
168
+
137
169
  - `sensitive-data.api-key-pattern` (error; high confidence): Flags vendor API key patterns including GitHub, GitLab, npm, Google API, Slack, Discord, and Stripe/OpenAI-style keys.
138
170
  - `sensitive-data.aws-access-key` (error; high confidence): Flags AWS access key looking values.
139
171
  - `sensitive-data.database-url-password` (error; high confidence): Flags database and HTTP(S) URLs that include passwords or embedded credentials.
140
172
  - `sensitive-data.gcp-service-account-key` (error; high confidence): Flags GCP service-account key files (type service_account alongside a private key).
141
- - `sensitive-data.hardcoded-env-value` (error; medium confidence; threshold 16): Flags environment-style secret values committed in text.
142
- - `sensitive-data.high-entropy-string` (error; medium confidence; threshold 32): Flags high-entropy string literals that may be secrets.
173
+ - `sensitive-data.hardcoded-env-value` (error; medium confidence; threshold 16): Flags environment-style secret values committed in text. In script files (TS/JS) only quoted values count: an unquoted right-hand side is a code expression (schema builder, secret-provider plumbing), not an embedded literal.
174
+ - `sensitive-data.high-entropy-string` (error; medium confidence; threshold 32): Flags high-entropy string literals that may be secrets. Identifier-shaped values that decompose entirely into short dictionary-like word segments (dotted namespaces such as `Com.Example2.Services.TokenProvider`, underscored constants, slug-like catalog names) are exempt because credential alphabets interleave case and digits rather than forming words; JWTs and 20+ char mixed-case segments never earn the exemption. Character-set enumerations (a 10+ run of consecutive code points, e.g. base64 translation alphabets) are also exempt.
143
175
  - `sensitive-data.jwt-token` (error; high confidence): Flags JWT-looking token literals.
144
176
  - `sensitive-data.phi-pattern` (error; high confidence): Flags PHI identifiers such as Medicare (MBI) and medical record numbers.
145
- - `sensitive-data.pii-pattern` (error; high confidence): Flags PII-like identifier patterns including SSN-shaped values and Luhn-valid payment cards.
177
+ - `sensitive-data.pii-pattern` (error; high confidence): Flags PII-like identifier patterns including SSN-shaped values and Luhn-valid payment cards. A bare unseparated digit run additionally needs card vocabulary on its line (statistics can pass Luhn by coincidence); separator-grouped numbers flag without context.
146
178
  - `sensitive-data.private-key` (error; high confidence): Flags private key block markers.
147
179
 
148
180
  ## Size
149
181
 
150
- - `size.file-length` (warning; high confidence; threshold 750): Flags files longer than the configured threshold.
182
+ - `size.file-length` (error; high confidence; threshold 1000): Flags files with more than 1000 substantive lines by default. Blank lines and comment-only lines (`//`, `/* */`, XML comments, and the leading comment markers used by supported YAML/TOML/env/INI/npmrc files) do not count; lines containing code or data still count. `metadata.lines` is the substantive count.
151
183
  - `size.function-length` (warning; high confidence; threshold 200): Flags functions longer than the configured threshold.
152
184
  - `size.parameter-count` (warning; high confidence; threshold 7): Flags functions with too many parameters.
153
185
 
@@ -156,7 +188,7 @@ gruff-ts list-rules --format=json
156
188
  - `test-quality.conditional-logic` (advisory; high confidence): Flags tests with conditional logic.
157
189
  - `test-quality.exception-type-only` (advisory; high confidence): Flags tests that only assert exception type.
158
190
  - `test-quality.global-state-mutation` (warning; high confidence): Flags tests mutating process or global runtime state.
159
- - `test-quality.loop-in-test` (advisory; high confidence): Flags loops inside test bodies.
191
+ - `test-quality.loop-in-test` (advisory; medium confidence): Flags test-body loops whose assertions do not identify the failing iteration.
160
192
  - `test-quality.magic-number-assertion` (advisory; medium confidence): Flags assertions against unexplained numeric literals.
161
193
  - `test-quality.mock-only-test` (advisory; high confidence): Flags tests that only verify mock interaction.
162
194
  - `test-quality.no-assertions` (warning; high confidence): Flags tests without apparent assertions.
@@ -164,23 +196,6 @@ gruff-ts list-rules --format=json
164
196
  - `test-quality.only-skip` (advisory; high confidence): Flags focused or skipped test markers.
165
197
  - `test-quality.sleep-in-test` (advisory; high confidence): Flags sleeps in tests.
166
198
  - `test-quality.snapshot-only-test` (advisory; high confidence): Flags tests that rely only on snapshots.
167
- - `test-quality.static-analysis-redundant-test` (advisory; high confidence): Flags tests that primarily assert code shape rather than behavior.
199
+ - `test-quality.static-analysis-redundant-test` (advisory; high confidence): Flags tests that primarily assert code shape rather than behavior, with review guidance for importability sentinels.
168
200
  - `test-quality.trivial-assertion` (warning; high confidence): Flags tautological assertions.
169
201
  - `test-quality.unused-mock` (advisory; medium confidence): Flags mocks created but not used.
170
-
171
- ## Maintainability
172
-
173
- - `waste.any-type` (warning; high confidence): Flags any type usage.
174
- - `waste.broad-runtime-version` (advisory; medium confidence): Flags broad runtime dependency version ranges.
175
- - `waste.commented-out-code` (advisory; high confidence): Flags comments that appear to contain disabled code.
176
- - `waste.console-log` (advisory; high confidence): Flags console log/debug calls in source.
177
- - `waste.empty-function` (advisory; high confidence): Flags functions with no executable body.
178
- - `waste.exported-any` (warning; medium confidence): Flags exported APIs exposing any.
179
- - `waste.redundant-boolean-cast` (advisory; medium confidence): Flags redundant boolean casts in condition expressions.
180
- - `waste.redundant-variable` (advisory; medium confidence): Flags variables returned immediately after assignment.
181
- - `waste.swallowed-catch` (warning; medium confidence): Flags empty catch blocks.
182
- - `waste.unreachable-code` (warning; high confidence): Flags statements after terminating statements.
183
- - `waste.unused-import` (advisory; medium confidence): Flags named imports with no apparent usage.
184
- - `waste.unused-parameter` (advisory; medium confidence): Flags parameters with no apparent usage.
185
- - `waste.useless-catch` (advisory; high confidence): Flags catch blocks that only rethrow the caught value.
186
- - `waste.useless-return` (advisory; medium confidence): Flags terminal bare return statements in void functions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blundergoat/gruff-ts",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
4
4
  "description": "Governs AI-generated code so a human can verify it: a TypeScript/JavaScript static analyzer - 120 rules across 11 quality pillars, SARIF output, baselines, and a local dashboard.",
5
5
  "license": "MIT",
6
6
  "author": "Matthew Hansen (https://www.blundergoat.com/about)",