ts-reviewer 1.2.0 → 1.2.1
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 +32 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,17 +14,20 @@ Three modes, one skill:
|
|
|
14
14
|
| **fix** | Reads the report and applies fixes file-by-file with tsc/lint/test verification |
|
|
15
15
|
| **auto** | Runs scan, asks you to confirm, fixes everything, deletes the report if clean |
|
|
16
16
|
|
|
17
|
-
The review covers
|
|
17
|
+
The review covers nine domains by default, each with its own detailed checklist. Add `--arch` or `--full` to include architecture analysis:
|
|
18
18
|
|
|
19
19
|
| Domain | Examples | Default |
|
|
20
20
|
|---|---|---|
|
|
21
|
-
| **Type Safety** | `any` abuse, unsafe casts, non-null assertions, missing exhaustive checks | ✓ |
|
|
22
|
-
| **Security** | Injection, prototype pollution, ReDoS, path traversal, hardcoded secrets | ✓ |
|
|
23
|
-
| **Async Patterns** | Floating promises, race conditions, missing
|
|
24
|
-
| **Modernization** |
|
|
25
|
-
| **Code Quality** | Dead code, complexity, duplication,
|
|
26
|
-
| **Config** | tsconfig.json strict flags, module resolution, deprecated options | ✓ |
|
|
27
|
-
| **
|
|
21
|
+
| **Type Safety** | `any` abuse, unsafe casts, non-null assertions, `unknown` discipline, missing exhaustive checks | ✓ |
|
|
22
|
+
| **Security** | Injection, SSRF, prototype pollution, ReDoS, path traversal, hardcoded secrets | ✓ |
|
|
23
|
+
| **Async Patterns** | Floating promises, race conditions, missing timeouts, unbounded concurrency, `forEach(async...)` | ✓ |
|
|
24
|
+
| **Modernization** | Numeric enums, `\|\|` vs `??`, mutating array methods, `satisfies`, `using` keyword | ✓ |
|
|
25
|
+
| **Code Quality** | Dead code, complexity, duplication, debug artifacts, import-time side effects, testability | ✓ |
|
|
26
|
+
| **Config** | tsconfig.json strict flags, target/lib, module resolution, deprecated options | ✓ |
|
|
27
|
+
| **Boundary Validation** | `as T` on `JSON.parse`/`fetch`/env, DTO vs domain model separation, contract drift | ✓ |
|
|
28
|
+
| **Error Handling** | Silent failures, throw hygiene, `cause` chaining, failure design at API seams | ✓ |
|
|
29
|
+
| **Dependency Hygiene** | Lockfiles, wildcard versions, `npm audit`, duplicate-purpose and trivial deps | ✓ |
|
|
30
|
+
| **Architecture** | Shallow modules, scattered concepts, tight coupling, dependency direction, layering | `--arch` / `--full` |
|
|
28
31
|
|
|
29
32
|
## Installation
|
|
30
33
|
|
|
@@ -40,7 +43,7 @@ The installer prints a short summary before installation:
|
|
|
40
43
|
|
|
41
44
|
```text
|
|
42
45
|
TypeScript Code Reviewer
|
|
43
|
-
Checks: type safety, async patterns,
|
|
46
|
+
Checks: type safety, security, async patterns, boundary validation, error handling, modernization, code quality, tsconfig, dependency hygiene
|
|
44
47
|
Target TypeScript: 5.9+
|
|
45
48
|
```
|
|
46
49
|
|
|
@@ -51,9 +54,11 @@ Supported targets:
|
|
|
51
54
|
| AI agent | Install path |
|
|
52
55
|
|---|---|
|
|
53
56
|
| Claude Code | `.claude/skills/ts-reviewer/` |
|
|
54
|
-
| Codex | `.
|
|
57
|
+
| Codex | `.agents/skills/ts-reviewer/` |
|
|
55
58
|
| Antigravity | `.agent/skills/ts-reviewer/` |
|
|
56
59
|
|
|
60
|
+
> **Note on Codex:** project-local skills belong in `.agents/` per the Codex docs; `~/.codex/` is the *global* per-user directory. Codex also reads a project-local `.codex/` implicitly, so installs from older versions of this installer keep working — but `.agents/` is the correct location going forward.
|
|
61
|
+
|
|
57
62
|
In non-interactive terminals, the installer selects all supported targets.
|
|
58
63
|
|
|
59
64
|
### Manual Install
|
|
@@ -80,13 +85,13 @@ Claude will analyze the project and write a report to `code-smells.md` in the pr
|
|
|
80
85
|
|
|
81
86
|
#### Domain flags
|
|
82
87
|
|
|
83
|
-
By default, only the
|
|
88
|
+
By default, only the nine core domains run. Use flags to control which domains are active:
|
|
84
89
|
|
|
85
90
|
| Flag | What runs |
|
|
86
91
|
|---|---|
|
|
87
|
-
| *(none)* | Type Safety, Security, Async, Modernization, Code Quality, Config |
|
|
88
|
-
| `--arch` | Architecture only (shallow modules, coupling, dependency seams) |
|
|
89
|
-
| `--full` | All
|
|
92
|
+
| *(none)* | Type Safety, Security, Async, Modernization, Code Quality, Config, Boundary Validation, Error Handling, Dependency Hygiene |
|
|
93
|
+
| `--arch` | Architecture only (shallow modules, coupling, dependency direction, seams) |
|
|
94
|
+
| `--full` | All ten domains |
|
|
90
95
|
|
|
91
96
|
Examples:
|
|
92
97
|
|
|
@@ -140,7 +145,7 @@ By default the entire codebase is reviewed. You can narrow the scope:
|
|
|
140
145
|
| What you say | What gets reviewed |
|
|
141
146
|
|---|---|
|
|
142
147
|
| *"review my code"* | Full codebase |
|
|
143
|
-
| *"review my changes"*, *"check uncommitted"* | Staged + unstaged + untracked `.ts` files |
|
|
148
|
+
| *"review my changes"*, *"check uncommitted"* | Staged + unstaged + untracked `.ts`/`.mts`/`.cts` files |
|
|
144
149
|
| *"review my PR"*, *"diff against main"* | All changes on current branch vs base |
|
|
145
150
|
| *"review last commit"*, *"check last 3 commits"* | Last N commits |
|
|
146
151
|
|
|
@@ -178,13 +183,16 @@ src/ # npm/npx installer source
|
|
|
178
183
|
ts-reviewer/
|
|
179
184
|
├── SKILL.md # Main skill file — mode routing, workflow orchestration
|
|
180
185
|
└── references/
|
|
181
|
-
├── type-safety.md # Checklist: any, casts, !, exhaustiveness,
|
|
182
|
-
├── security.md # Checklist: injection, pollution, ReDoS
|
|
183
|
-
├── async-patterns.md # Checklist: floating promises, races, cancellation
|
|
184
|
-
├──
|
|
185
|
-
├──
|
|
186
|
-
├──
|
|
187
|
-
├──
|
|
186
|
+
├── type-safety.md # Checklist: any, unknown, casts, !, exhaustiveness, branded types
|
|
187
|
+
├── security.md # Checklist: trust boundaries, injection, SSRF, pollution, ReDoS
|
|
188
|
+
├── async-patterns.md # Checklist: floating promises, races, timeouts, retries, cancellation
|
|
189
|
+
├── boundary-validation.md # Checklist: runtime validation at edges, DTO/domain separation
|
|
190
|
+
├── error-handling.md # Checklist: silent failures, throw hygiene, failure design
|
|
191
|
+
├── modernization.md # Checklist: TS 5.9+ idioms, ??/?. , satisfies, using, toSorted
|
|
192
|
+
├── code-quality.md # Checklist: complexity, dead code, debug artifacts, testability
|
|
193
|
+
├── tsconfig.md # Checklist: strict flags, target/lib, module resolution, deprecated
|
|
194
|
+
├── dependency-hygiene.md # Checklist: lockfiles, versions, npm audit, dependency choice
|
|
195
|
+
├── architecture.md # Checklist: shallow modules, coupling, dependency direction, seams
|
|
188
196
|
└── fix-workflow.md # Complete fix protocol: tests, verification, rollback
|
|
189
197
|
```
|
|
190
198
|
|
|
@@ -198,8 +206,8 @@ ts-reviewer/
|
|
|
198
206
|
|
|
199
207
|
1. **Discovery** — detects domain flags, maps the project, reads tsconfig.json, detects linter and test runner. If architecture is active, also maps module relationships and checks for `docs/adr/`.
|
|
200
208
|
2. **Diagnostics** — runs `tsc --noEmit`, linter, and LSP diagnostics (if available)
|
|
201
|
-
3. **Analysis** — specialized passes for each active domain (sub-agents in Claude Code, sequential in Claude.ai), each with its own checklist
|
|
202
|
-
4. **Report** — deduplicates, applies severity boost (scoped modes), consolidates recurring patterns, writes `code-smells.md`. Architecture findings appear in a separate `## Architecture Opportunities` section at the end.
|
|
209
|
+
3. **Analysis** — specialized passes for each active domain (sub-agents in Claude Code, sequential in Claude.ai), each with its own checklist. Every finding passes an Evidence Protocol: verified against the actual file content, confidence-gated, version-gated against the project's TS/runtime.
|
|
210
|
+
4. **Report** — deduplicates, applies severity boost (scoped modes), consolidates recurring patterns, enforces a noise budget, writes `code-smells.md`. Architecture findings appear in a separate `## Architecture Opportunities` section at the end.
|
|
203
211
|
|
|
204
212
|
### Fix mode
|
|
205
213
|
|