agent-roast 0.3.0 → 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.
package/README.md CHANGED
@@ -5,11 +5,10 @@
5
5
  <img src="docs/assets/logo.svg" alt="agent-roast" width="380">
6
6
  </picture>
7
7
 
8
- <h2>Audit your git history for AI coding agent infractions and panic loops</h2>
8
+ <h2>Catch coding shortcuts before they ship</h2>
9
9
 
10
10
  <p>
11
- <a href="https://github.com/Nari-Ab/agent-roast/actions"><img src="https://img.shields.io/badge/CI-passing-2ea44f?logo=github&logoColor=white" alt="CI"></a>
12
- <a href="https://github.com/Nari-Ab/agent-roast"><img src="https://img.shields.io/badge/roast%20audit-verified-2ea44f" alt="Roast Audit"></a>
11
+ <a href="https://github.com/Nari-Ab/agent-roast/actions/workflows/test.yml"><img src="https://github.com/Nari-Ab/agent-roast/actions/workflows/test.yml/badge.svg" alt="CLI tests"></a>
13
12
  <a href="https://www.npmjs.com/package/agent-roast"><img src="https://img.shields.io/npm/v/agent-roast?color=cb3837&logo=npm&logoColor=white" alt="npm"></a>
14
13
  <a href="https://www.npmjs.com/package/agent-roast"><img src="https://img.shields.io/npm/dt/agent-roast?label=downloads&color=0969da" alt="downloads"></a>
15
14
  <a href="https://nari-ab.github.io/agent-roast/"><img src="https://img.shields.io/badge/site-live-1f9d55" alt="site"></a>
@@ -18,25 +17,63 @@
18
17
 
19
18
  </div>
20
19
 
21
- `agent-roast` scans recorded git diffs for shortcuts taken by AI coding assistants (Claude Code, Cursor, Codex, Antigravity, Aider). It checks for skipped tests, fake tautological assertions, abandoned stubs, compiler type escapes (`as any`), swallowed errors, and panic revert loops, then outputs a discipline score and line proofs. 100% offline, zero API keys, zero telemetry.
20
+ `agent-roast` is an offline review aid for skipped tests, fake assertions, swallowed
21
+ errors, unfinished stubs and type-check bypasses. Start with the code you have now;
22
+ no AI commit tags, cloud account, API key or commit history are required for `check`.
23
+ A Git repository is required; `git init` is sufficient.
22
24
 
23
25
  ```bash
24
- # Initialize in your repository (creates .agentroastrc.json)
25
- npx agent-roast init
26
- npx agent-roast init --ci # generate .github/workflows/agent-roast.yml
27
- npx agent-roast init --hook # install .git/hooks/pre-commit
26
+ # Inspect current tracked + non-ignored untracked source files
27
+ npx agent-roast check
28
28
 
29
- # Audit repository history
30
- npx agent-roast # scan AI-attributed commits (last 90 days)
31
- npx agent-roast --all # scan entire repository history
32
- npx agent-roast --verbose # show commit SHAs and line proofs
33
- npx agent-roast --fail-under 70 # exit code 1 if score is below 70
29
+ # Understand a finding and what to do next
30
+ npx agent-roast explain swallowed-error
31
+
32
+ # Adopt it in an existing project without blocking on all historical debt
33
+ npx agent-roast check --write-baseline .agentroast-baseline.json
34
+ # Review the findings and commit this policy file, then gate only new problems
35
+ npx agent-roast check --baseline .agentroast-baseline.json
36
+
37
+ # Verify precisely what you are about to commit
38
+ npx agent-roast --staged
34
39
 
35
40
  # Audit pull request diffs (CI gate)
36
- npx agent-roast --base origin/main --head HEAD
37
- npx agent-roast --base origin/main --head HEAD --fail-on test-skip,trivial-assert,stub-abandonment --format github
41
+ npx agent-roast --base origin/main --head HEAD --format github
42
+
43
+ # Optional historical audit
44
+ npx agent-roast --all --verbose
38
45
  ```
39
46
 
47
+ A finding includes its file and line, the source snippet, and a concrete next step.
48
+ To see the complete machine-readable result, use `check --format json`; terminal
49
+ output shows the first 20 findings. `check --format markdown` produces a review table.
50
+
51
+ ### Baseline adoption
52
+
53
+ A baseline explicitly accepts the findings present at adoption time. It does not fix
54
+ or hide new code. Fingerprints use the rule, repository-relative filename and source
55
+ snippet; line numbers are excluded so adding clean code above a finding does not
56
+ break it. Occurrence counts ensure a second identical shortcut is still new. Moving
57
+ a finding to another file or changing its snippet requires a fresh review. Baselines
58
+ contain hashes and counts, not source code. The report shows both accepted and new
59
+ findings and counts accepted findings no longer present.
60
+
61
+ Baseline use is explicit (`--baseline`), and writes refuse to overwrite existing
62
+ files. To refresh accepted debt, inspect the full scan and write a **new** baseline
63
+ file for review. Treat baseline changes as policy changes in code review. Do not
64
+ silently regenerate one in CI. Input/output baseline paths are relative to the
65
+ directory passed to `check` (or the current directory if omitted).
66
+
67
+ `check` scans the repository containing the supplied path, applies its root config,
68
+ respects Git ignores for untracked files, and excludes generated dependencies/build
69
+ outputs. It checks working files, while `--staged` checks the index. Git submodules
70
+ are not recursively scanned. A supported file that is binary, too large, unreadable
71
+ or a symlink makes the scan incomplete (exit 2); incomplete scans cannot create a
72
+ baseline. Limits are 2 MiB per source file and 50 MiB per scan. Intentional generated
73
+ or unsupported input should be excluded in `ignorePaths`, not silently counted clean.
74
+
75
+ History auditing remains available when you want an overview of prior shortcuts:
76
+
40
77
  What a report looks like (a real repository audit, trimmed):
41
78
 
42
79
  ```text
@@ -77,7 +114,7 @@ Configure custom ignore paths, rule severities, and CI thresholds with a `.agent
77
114
 
78
115
  ```json
79
116
  {
80
- "$schema": "https://raw.githubusercontent.com/sidzuya/agent-roast/main/schema.json",
117
+ "$schema": "https://raw.githubusercontent.com/Nari-Ab/agent-roast/main/schema.json",
81
118
  "ignorePaths": [
82
119
  "**/*.min.js",
83
120
  "**/vendor/**",
@@ -97,6 +134,51 @@ Configure custom ignore paths, rule severities, and CI thresholds with a `.agent
97
134
 
98
135
  ---
99
136
 
137
+ ### Check code before committing
138
+
139
+ ```bash
140
+ npm install --save-dev agent-roast
141
+ npx agent-roast --staged
142
+ npx agent-roast init --hook
143
+ ```
144
+
145
+ `--staged` audits exactly the Git index, including an initial commit without HEAD.
146
+ Unstaged edits and untracked files are excluded. The generated hook uses the locally
147
+ installed CLI (`--no-install`) and blocks on configured error rules instead of scoring
148
+ old commits. It preserves an existing pre-commit hook.
149
+
150
+ ### Configure what blocks a change
151
+
152
+ Create `.agentroastrc.json` (or run `npx agent-roast init`):
153
+
154
+ ```json
155
+ {
156
+ "rules": {
157
+ "test-skip": "error",
158
+ "trivial-assert": "error",
159
+ "swallowed-error": "warn",
160
+ "type-escape": "off"
161
+ },
162
+ "ignorePaths": ["**/generated/**", "**/vendor/**"],
163
+ "panicLoopWindowMinutes": 10,
164
+ "scoreThreshold": 70
165
+ }
166
+ ```
167
+
168
+ `off` removes findings and score penalties; `warn` reports without blocking a diff;
169
+ `error` blocks PR/staged checks. An explicit `failOn` array overrides which enabled
170
+ rules block (`[]` makes the audit advisory). CLI `--fail-on` takes precedence over
171
+ that array. History and badge audits honor disabled rules and the panic-loop window.
172
+ History exit status is controlled by `scoreThreshold` or `--fail-under`.
173
+ Invalid JSON, unknown rule names and invalid settings stop the audit with exit code 2.
174
+ Configurations generated by older versions may contain unsupported rules such as
175
+ `hallucinated-package`, `empty-catch` or `mock-leak`; remove these entries and use
176
+ `swallowed-error` for empty catches.
177
+
178
+ Exit codes: `0` passed, `1` blocking findings/score threshold, `2` invalid audit
179
+ configuration or Git refs. `--format json` also works for history audits. A history
180
+ sample below 200 added lines has no score, but its findings are still shown.
181
+
100
182
  ### GitHub Actions Integration
101
183
 
102
184
  Add `agent-roast` as a gate in your pull request workflow (`.github/workflows/agent-roast.yml`):
@@ -160,6 +242,28 @@ Only **added lines** (`+`) in source code files are scanned — deleted lines, f
160
242
 
161
243
  ---
162
244
 
245
+ ### Scope and limitations
246
+
247
+ Use this as a focused review aid for skipped tests, compiler suppressions and obvious
248
+ stubs, alongside a compiler, test runner and language-aware linter. Findings identify
249
+ patterns, not proof of AI authorship or developer intent. Deliberate skips and abstract
250
+ methods can be legitimate. Contiguous block comments, Python docstrings and multi-line empty handlers are
251
+ recognized. Template interpolation, complex language syntax and context outside
252
+ the added diff are not fully parsed. Panic loops are an observational history heuristic.
253
+ The discipline score summarizes added history; it does not certify current code quality.
254
+ `check` reports actionable findings without assigning a personality or quality score.
255
+
256
+ ### Development
257
+
258
+ ```bash
259
+ npm ci
260
+ npm run typecheck
261
+ npm test
262
+ ```
263
+
264
+ `npm test` builds the distribution first so CLI integration and bundle checks run
265
+ against current code. Regression tests use disposable Git repositories.
266
+
163
267
  ### Author & Support
164
268
 
165
269
  Created by Nariman Abdukarimov ([abdukarimov.nariman07@gmail.com](mailto:abdukarimov.nariman07@gmail.com)).