@blundergoat/gruff-ts 0.3.1 → 0.4.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/CHANGELOG.md +19 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +20 -5
- package/SECURITY.md +1 -1
- package/docs/README.md +0 -1
- package/docs/agent-hook.md +14 -2
- package/docs/configuration.md +15 -0
- package/docs/reports-and-ci.md +21 -0
- package/docs/rules.md +22 -12
- package/package.json +17 -2
- package/src/analyser.ts +410 -122
- package/src/baseline-options.ts +90 -0
- package/src/blocks.ts +56 -9
- package/src/changed-regions.ts +46 -17
- package/src/cli-program.ts +103 -4
- package/src/cli.ts +3 -2
- package/src/constants.ts +1 -1
- package/src/dashboard.ts +1 -1
- package/src/dead-code-rules.ts +10 -3
- package/src/discovery.ts +27 -3
- package/src/findings.ts +2 -0
- package/src/hook-contract.ts +457 -0
- package/src/line-rules.ts +126 -19
- package/src/process-exec-metadata.ts +153 -0
- package/src/project-config-rules.ts +21 -8
- package/src/project-rules.ts +159 -42
- package/src/report-renderers.ts +3 -0
- package/src/rule-list.ts +1 -0
- package/src/rules.ts +5 -5
- package/src/sensitive-data-rules.ts +134 -12
- package/src/source-text.ts +47 -22
- package/src/static-analysis-redundant-rules.ts +46 -2
- package/src/types.ts +16 -1
- package/docs/releasing.md +0 -106
- package/fixtures/sample.ts +0 -21
- package/scripts/bump-version.sh +0 -210
- package/scripts/check.sh +0 -4
- package/scripts/dependency-install.sh +0 -96
- package/scripts/dependency-update.sh +0 -177
- package/scripts/npm-publish.sh +0 -258
- package/scripts/preflight-checks.sh +0 -395
- package/scripts/start-dev.sh +0 -8
- package/scripts/test-performance.sh +0 -695
- package/src/fixtures/rule-catalogue-security-doctrine.ts +0 -160
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.4.0 - 2026-06-11
|
|
4
|
+
|
|
5
|
+
- **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.
|
|
6
|
+
- **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.
|
|
7
|
+
- **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.
|
|
8
|
+
- **Generated-source policy** - explicit generation markers (`@generated`, `DO NOT EDIT`, ...) suppress documentation and naming findings only; every other pillar still runs.
|
|
9
|
+
- **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.
|
|
10
|
+
- **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.
|
|
11
|
+
- **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.
|
|
12
|
+
- **`dead-code.unused-private-method`** - bare `this.method` references count as usage; unrelated properties sharing the name no longer mask an unused private method.
|
|
13
|
+
- **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`.
|
|
14
|
+
- **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.
|
|
15
|
+
|
|
16
|
+
## v0.3.2 - 2026-06-09
|
|
17
|
+
|
|
18
|
+
- **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`)
|
|
19
|
+
- **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`)
|
|
20
|
+
- **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`)
|
|
21
|
+
|
|
3
22
|
## v0.3.1 - 2026-06-03
|
|
4
23
|
|
|
5
24
|
- **JSON finding path alias and stable identity** - `analyse --format=json` and `report --format=json` now emit canonical `findings[].file` alongside the existing `findings[].filePath`; `filePath` is deprecated and will be removed in the next release. Findings also carry `stableIdentity`, a line-insensitive 16-hex identity for external diff tooling. Existing `fingerprint` values, baselines, SARIF fingerprints, dashboard data, and in-memory `filePath` consumers are unchanged.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -47,7 +47,7 @@ The runtime lives under `src/`:
|
|
|
47
47
|
packs, fixtures, reports, and CLI surfaces.
|
|
48
48
|
|
|
49
49
|
Keep changes small and local. Do not add runtime dependencies beyond
|
|
50
|
-
`commander` and `
|
|
50
|
+
`commander`, `tsx`, and `typescript` unless that direction is explicitly accepted first.
|
|
51
51
|
|
|
52
52
|
## Rules For Rule Changes
|
|
53
53
|
|
package/README.md
CHANGED
|
@@ -20,11 +20,11 @@ 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.
|
|
23
|
+
| Release line | Published `0.3.2` package line |
|
|
24
24
|
| Runtime | Node.js `22+` |
|
|
25
25
|
| Package | `@blundergoat/gruff-ts` |
|
|
26
26
|
| Binary | `gruff-ts` |
|
|
27
|
-
| Rule catalogue |
|
|
27
|
+
| Rule catalogue | 120 rules across 11 pillars |
|
|
28
28
|
| Primary config | `.gruff-ts.yaml`; `.gruff.json`, `.gruff.yaml`, and `.gruff.yml` are fallback files |
|
|
29
29
|
| Analysis schema | `gruff.analysis.v2` |
|
|
30
30
|
| Baseline schema | `gruff.baseline.v1` |
|
|
@@ -223,7 +223,7 @@ Semantics:
|
|
|
223
223
|
|
|
224
224
|
## Rules And Pillars
|
|
225
225
|
|
|
226
|
-
The current catalogue contains
|
|
226
|
+
The current catalogue contains 120 rules:
|
|
227
227
|
|
|
228
228
|
| Pillar | Rules |
|
|
229
229
|
| --- | ---: |
|
|
@@ -237,12 +237,24 @@ The current catalogue contains 122 rules:
|
|
|
237
237
|
| `security` | 29 |
|
|
238
238
|
| `sensitive-data` | 10 |
|
|
239
239
|
| `size` | 3 |
|
|
240
|
-
| `test-quality` |
|
|
240
|
+
| `test-quality` | 14 |
|
|
241
241
|
|
|
242
242
|
Use `npx gruff-ts list-rules --format=json` for exact rule IDs, severities, confidence levels, remediation text, thresholds, and options.
|
|
243
243
|
|
|
244
244
|
## Baselines And Changed-Code Scans
|
|
245
245
|
|
|
246
|
+
For editor and coding-agent feedback, prefer the analyzer-owned hook contract:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
npx gruff-ts hook --format=json --changed-ranges "3-3,8-10" src/foo.ts
|
|
250
|
+
npx gruff-ts hook --capabilities --format=json
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
`hook` emits `gruff.hook.v1` JSON with normalized `file`, `scope`, `suppressed.count`,
|
|
254
|
+
`ignored.paths`, non-null `remediation`, stable identities, and threshold metadata. Hook mode is
|
|
255
|
+
advisory: findings exit `0`; operational failures such as invalid config exit `2` and are reported
|
|
256
|
+
in `config.error`.
|
|
257
|
+
|
|
246
258
|
Baselines suppress reviewed findings by stable fingerprint:
|
|
247
259
|
|
|
248
260
|
```bash
|
|
@@ -268,6 +280,10 @@ npx gruff-ts analyse --format=json --since HEAD src/foo.ts
|
|
|
268
280
|
git diff | npx gruff-ts analyse --format=json --diff -
|
|
269
281
|
```
|
|
270
282
|
|
|
283
|
+
Use `--changed-scope file` when a CI workflow intentionally wants every finding from touched
|
|
284
|
+
files, including file-wide metrics such as `size.file-length`. The default `symbol` scope keeps
|
|
285
|
+
the coding-agent feedback focused on the changed line or enclosing declaration.
|
|
286
|
+
|
|
271
287
|
JSON output keeps the normal `findings` array and adds `suppressedCount` when changed-region filtering is active.
|
|
272
288
|
|
|
273
289
|
## Dashboard
|
|
@@ -316,7 +332,6 @@ Source lives under `src/`: `src/cli.ts` is the bootstrap, `src/cli-program.ts` o
|
|
|
316
332
|
- [Configuration](docs/configuration.md)
|
|
317
333
|
- [Rules catalogue](docs/rules.md)
|
|
318
334
|
- [Reports and CI](docs/reports-and-ci.md)
|
|
319
|
-
- [Release checklist](docs/releasing.md)
|
|
320
335
|
- [Contributing](CONTRIBUTING.md)
|
|
321
336
|
- [Security](SECURITY.md)
|
|
322
337
|
|
package/SECURITY.md
CHANGED
package/docs/README.md
CHANGED
|
@@ -11,7 +11,6 @@ Use these docs with the top-level README for the stable user-facing surface.
|
|
|
11
11
|
- [Output Formats](output-formats.md) - text, JSON, HTML, Markdown, GitHub annotations, hotspot, and SARIF.
|
|
12
12
|
- [CI Integration](ci-integration.md) - GitHub Actions, SARIF upload, baselines, and diff scans.
|
|
13
13
|
- [Dashboard](dashboard.md) - local dashboard flags and safety model.
|
|
14
|
-
- [Releasing](releasing.md) - release checks and packaging notes.
|
|
15
14
|
|
|
16
15
|
## Extra Docs
|
|
17
16
|
|
package/docs/agent-hook.md
CHANGED
|
@@ -6,12 +6,24 @@ gruff-ts is built to govern AI-generated code (see [Philosophy](philosophy.md) f
|
|
|
6
6
|
|
|
7
7
|
A coding agent will rewrite code until the checks pass. gruff-ts turns that into leverage: run it on the agent's change and gate on the result, so the agent has to resolve findings - add the missing doc comment, cut the unverifiable branching, drop the unsafe call, replace the mock-only test - before the change reaches you. What lands is already shaped for sign-off.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
For CI-style gates, `analyse` owns the exit code:
|
|
10
10
|
|
|
11
11
|
- `0` - no finding met the `--fail-on` level; the change passes.
|
|
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:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
gruff-ts hook --format json --changed-ranges "12-40,88-90" src/foo.ts
|
|
19
|
+
gruff-ts hook --capabilities --format json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`hook` emits `gruff.hook.v1` JSON with normalized `file`, `scope`, `suppressed.count`,
|
|
23
|
+
`ignored.paths`, non-null `remediation`, stable identities, and machine-readable threshold
|
|
24
|
+
metadata. Hook mode is advisory: findings exit `0`; config failures are returned in
|
|
25
|
+
`config.error` and exit `2`.
|
|
26
|
+
|
|
15
27
|
## Scan the change, not the repo
|
|
16
28
|
|
|
17
29
|
> **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.
|
|
@@ -35,7 +47,7 @@ npx gruff-ts analyse --changed-ranges "12-40,88-90" src/foo.ts --fail-on=warning
|
|
|
35
47
|
git diff | npx gruff-ts analyse --diff - --fail-on=warning
|
|
36
48
|
```
|
|
37
49
|
|
|
38
|
-
Changed-region scans keep only findings attributable to the changed hunk
|
|
50
|
+
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.
|
|
39
51
|
|
|
40
52
|
## Respect the project's ignore policy
|
|
41
53
|
|
package/docs/configuration.md
CHANGED
|
@@ -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
|
package/docs/reports-and-ci.md
CHANGED
|
@@ -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
|
|
@@ -49,6 +53,23 @@ Schema strings:
|
|
|
49
53
|
- `gruff.baseline.v1` for baselines.
|
|
50
54
|
- `gruff.hotspot.v1` for hotspot output.
|
|
51
55
|
|
|
56
|
+
`gruff.analysis.v2` may include an optional `notes` array. Notes are non-fatal:
|
|
57
|
+
they explain scan-surface limits without changing exit codes. `diagnostics`
|
|
58
|
+
still owns exit `2`.
|
|
59
|
+
|
|
60
|
+
Current note types:
|
|
61
|
+
|
|
62
|
+
- `no-analysable-files` - a requested path existed but contributed no supported
|
|
63
|
+
files, usually because ignore rules excluded everything under it.
|
|
64
|
+
- `bounded-deep-scan` - a script file exceeded the deep-scan budget. It still
|
|
65
|
+
counts as analysed and text-level rules still run, but deep TypeScript passes,
|
|
66
|
+
parse diagnostics, and project-graph retention are skipped for that file.
|
|
67
|
+
|
|
68
|
+
The deep-scan budget is `20,000` lines or `2,000,000` UTF-8 bytes, whichever
|
|
69
|
+
limit is hit first. Text output prints notes in a `Notes:` block. JSON reports
|
|
70
|
+
omit `notes` when there are no notes, so ordinary scans keep the same report
|
|
71
|
+
shape.
|
|
72
|
+
|
|
52
73
|
## GitHub Actions
|
|
53
74
|
|
|
54
75
|
Use GitHub annotation output in a workflow step:
|
package/docs/rules.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Rules
|
|
2
2
|
|
|
3
|
-
`gruff-ts` exposes
|
|
3
|
+
`gruff-ts` exposes 120 rules across 11 pillars. This list is generated from the
|
|
4
4
|
public rule catalogue used by `gruff-ts list-rules`; severity, confidence,
|
|
5
5
|
thresholds, and option names are the defaults before project config overrides.
|
|
6
6
|
|
|
@@ -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
|
|
@@ -30,7 +37,7 @@ gruff-ts list-rules --format=json
|
|
|
30
37
|
- security: 29
|
|
31
38
|
- sensitive-data: 10
|
|
32
39
|
- size: 3
|
|
33
|
-
- test-quality:
|
|
40
|
+
- test-quality: 14
|
|
34
41
|
|
|
35
42
|
## Complexity
|
|
36
43
|
|
|
@@ -39,11 +46,11 @@ gruff-ts list-rules --format=json
|
|
|
39
46
|
|
|
40
47
|
## Dead Code
|
|
41
48
|
|
|
42
|
-
- `dead-code.unused-private-method` (advisory; low confidence): Flags private methods without an apparent same-file call site.
|
|
49
|
+
- `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
50
|
|
|
44
51
|
## Design
|
|
45
52
|
|
|
46
|
-
- `design.circular-import` (warning; medium confidence): Flags
|
|
53
|
+
- `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
54
|
- `design.deep-relative-import` (advisory; medium confidence; threshold 2): Flags relative imports that climb too many parent directories.
|
|
48
55
|
- `design.large-module-concentration` (advisory; medium confidence; threshold 55; options: minFiles, minLines): Flags a production module that dominates project source lines.
|
|
49
56
|
- `design.package-bin-missing` (warning; high confidence): Flags package bin entries that point at missing files.
|
|
@@ -54,9 +61,10 @@ gruff-ts list-rules --format=json
|
|
|
54
61
|
- `docs.fixture-purpose-missing` (advisory; medium confidence): Flags large or scanner-relevant fixtures without a nearby purpose comment.
|
|
55
62
|
- `docs.magic-threshold-without-rationale` (advisory; medium confidence): Flags threshold-like numeric values without a nearby rationale comment.
|
|
56
63
|
- `docs.missing-error-behavior-doc` (advisory; medium confidence): Flags commented functions whose error behavior is not described.
|
|
64
|
+
- `docs.missing-exported-function-doc` (warning; medium confidence): Flags exported functions without a leading maintainer comment.
|
|
57
65
|
- `docs.missing-file-overview` (advisory; medium confidence): Flags source files without a top-of-file purpose comment.
|
|
58
|
-
- `docs.missing-function-doc` (advisory; medium confidence): Flags functions without a leading maintainer comment.
|
|
59
66
|
- `docs.missing-interface-doc` (advisory; medium confidence): Flags interfaces without a leading maintainer comment.
|
|
67
|
+
- `docs.missing-internal-function-doc` (advisory; medium confidence): Flags internal helper functions without a leading maintainer comment.
|
|
60
68
|
- `docs.missing-invariant-doc` (advisory; medium confidence): Flags commented declarations that own schema, fingerprint, baseline, or determinism contracts without saying so.
|
|
61
69
|
- `docs.missing-param-tag` (advisory; medium confidence): Flags documented exports with parameters missing @param tags.
|
|
62
70
|
- `docs.missing-public-doc` (advisory; medium confidence): Flags exported class, type, and enum APIs without a nearby doc comment.
|
|
@@ -118,11 +126,11 @@ gruff-ts list-rules --format=json
|
|
|
118
126
|
- `security.new-function` (error; high confidence): Flags Function constructor dynamic code execution.
|
|
119
127
|
- `security.open-redirect-candidate` (warning; medium confidence): Flags external input sent to redirect or navigation sinks.
|
|
120
128
|
- `security.path-traversal-candidate` (warning; medium confidence): Flags external input sent to filesystem path sinks.
|
|
121
|
-
- `security.process-exec` (warning; high confidence): Flags child-process execution calls.
|
|
129
|
+
- `security.process-exec` (warning; high confidence): Flags child-process execution calls and annotates emitted findings with command-source and shell-mode hints.
|
|
122
130
|
- `security.proto-access` (warning; medium confidence): Flags direct __proto__ access that can enable prototype pollution.
|
|
123
131
|
- `security.remote-install-script` (error; medium confidence): Flags package scripts that pipe remote content to a shell.
|
|
124
|
-
- `security.risky-lifecycle-script` (warning; medium confidence): Flags
|
|
125
|
-
- `security.sql-concatenation` (warning; high confidence): Flags SQL text composed with runtime
|
|
132
|
+
- `security.risky-lifecycle-script` (warning; medium confidence): Flags install-time and side-effectful publish lifecycle scripts while allowing validation-only publish gates.
|
|
133
|
+
- `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.
|
|
126
134
|
- `security.ssrf-candidate` (warning; medium confidence): Flags external input sent to network request sinks.
|
|
127
135
|
- `security.string-timer` (warning; high confidence): Flags string callbacks passed to timers.
|
|
128
136
|
- `security.throw-non-error` (warning; medium confidence): Flags thrown non-Error values.
|
|
@@ -133,15 +141,17 @@ gruff-ts list-rules --format=json
|
|
|
133
141
|
|
|
134
142
|
## Sensitive Data
|
|
135
143
|
|
|
144
|
+
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.
|
|
145
|
+
|
|
136
146
|
- `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.
|
|
137
147
|
- `sensitive-data.aws-access-key` (error; high confidence): Flags AWS access key looking values.
|
|
138
148
|
- `sensitive-data.database-url-password` (error; high confidence): Flags database and HTTP(S) URLs that include passwords or embedded credentials.
|
|
139
149
|
- `sensitive-data.gcp-service-account-key` (error; high confidence): Flags GCP service-account key files (type service_account alongside a private key).
|
|
140
|
-
- `sensitive-data.hardcoded-env-value` (error; medium confidence; threshold 16): Flags environment-style secret values committed in text.
|
|
141
|
-
- `sensitive-data.high-entropy-string` (error; medium confidence; threshold 32): Flags high-entropy string literals that may be secrets.
|
|
150
|
+
- `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.
|
|
151
|
+
- `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.
|
|
142
152
|
- `sensitive-data.jwt-token` (error; high confidence): Flags JWT-looking token literals.
|
|
143
153
|
- `sensitive-data.phi-pattern` (error; high confidence): Flags PHI identifiers such as Medicare (MBI) and medical record numbers.
|
|
144
|
-
- `sensitive-data.pii-pattern` (error; high confidence): Flags PII-like identifier patterns including SSN-shaped values and Luhn-valid payment cards.
|
|
154
|
+
- `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.
|
|
145
155
|
- `sensitive-data.private-key` (error; high confidence): Flags private key block markers.
|
|
146
156
|
|
|
147
157
|
## Size
|
|
@@ -163,7 +173,7 @@ gruff-ts list-rules --format=json
|
|
|
163
173
|
- `test-quality.only-skip` (advisory; high confidence): Flags focused or skipped test markers.
|
|
164
174
|
- `test-quality.sleep-in-test` (advisory; high confidence): Flags sleeps in tests.
|
|
165
175
|
- `test-quality.snapshot-only-test` (advisory; high confidence): Flags tests that rely only on snapshots.
|
|
166
|
-
- `test-quality.static-analysis-redundant-test` (advisory; high confidence): Flags tests that primarily assert code shape rather than behavior.
|
|
176
|
+
- `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.
|
|
167
177
|
- `test-quality.trivial-assertion` (warning; high confidence): Flags tautological assertions.
|
|
168
178
|
- `test-quality.unused-mock` (advisory; medium confidence): Flags mocks created but not used.
|
|
169
179
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blundergoat/gruff-ts",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Governs AI-generated code so a human can verify it: a TypeScript/JavaScript static analyzer -
|
|
3
|
+
"version": "0.4.0",
|
|
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)",
|
|
7
7
|
"homepage": "https://github.com/blundergoat/gruff-ts#readme",
|
|
@@ -36,6 +36,21 @@
|
|
|
36
36
|
"node": ">=22"
|
|
37
37
|
},
|
|
38
38
|
"type": "module",
|
|
39
|
+
"files": [
|
|
40
|
+
"bin/",
|
|
41
|
+
"src/",
|
|
42
|
+
"!src/**/*.test.ts",
|
|
43
|
+
"!src/fixtures/",
|
|
44
|
+
"docs/",
|
|
45
|
+
"!docs/releasing.md",
|
|
46
|
+
"!docs/coding-standards/",
|
|
47
|
+
"tsconfig.json",
|
|
48
|
+
"README.md",
|
|
49
|
+
"LICENSE",
|
|
50
|
+
"CHANGELOG.md",
|
|
51
|
+
"CONTRIBUTING.md",
|
|
52
|
+
"SECURITY.md"
|
|
53
|
+
],
|
|
39
54
|
"bin": {
|
|
40
55
|
"gruff-ts": "bin/gruff-ts"
|
|
41
56
|
},
|