@allthingsclaude/blueprints 0.1.3 → 0.3.0-beta.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 +8 -5
- package/content/agents/audit.md +39 -24
- package/content/agents/bootstrap.md +4 -4
- package/content/agents/cleanup.md +153 -0
- package/content/agents/debug.md +198 -0
- package/content/agents/{optimize.md → dry.md} +36 -15
- package/content/agents/finalize.md +18 -4
- package/content/agents/handoff.md +10 -4
- package/content/agents/imagine.md +36 -14
- package/content/agents/implement.md +27 -7
- package/content/agents/parallelize.md +20 -3
- package/content/agents/plan.md +28 -4
- package/content/agents/refactor.md +208 -0
- package/content/agents/research-codebase.md +1 -1
- package/content/agents/research-docs.md +1 -1
- package/content/agents/research-web.md +1 -1
- package/content/agents/storyboard.md +10 -4
- package/content/agents/test.md +181 -0
- package/content/commands/audit.md +14 -25
- package/content/commands/bootstrap.md +2 -2
- package/content/commands/cleanup.md +11 -300
- package/content/commands/debug.md +8 -250
- package/content/commands/dry.md +46 -0
- package/content/commands/finalize.md +2 -2
- package/content/commands/flush.md +9 -13
- package/content/commands/handoff.md +1 -1
- package/content/commands/implement.md +4 -4
- package/content/commands/kickoff.md +6 -3
- package/content/commands/parallelize.md +1 -1
- package/content/commands/pickup.md +1 -1
- package/content/commands/plan.md +2 -2
- package/content/commands/refactor.md +20 -379
- package/content/commands/research.md +1 -1
- package/content/commands/storyboard.md +3 -3
- package/content/commands/test.md +14 -200
- package/dist/cli.js +9 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts +10 -0
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +70 -2
- package/dist/installer.js.map +1 -1
- package/package.json +5 -1
- package/content/commands/optimize.md +0 -338
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test
|
|
3
|
+
description: Run tests with intelligent analysis and fix suggestions
|
|
4
|
+
tools: Bash, Read, Grep, Glob
|
|
5
|
+
model: sonnet
|
|
6
|
+
author: "@markoradak"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are a testing specialist. Your role is to run tests, analyze failures intelligently, and provide actionable fix suggestions. You can also generate missing test coverage.
|
|
10
|
+
|
|
11
|
+
## Your Mission
|
|
12
|
+
|
|
13
|
+
Based on arguments, determine the appropriate workflow:
|
|
14
|
+
1. Run tests and analyze results
|
|
15
|
+
2. Generate missing test coverage
|
|
16
|
+
3. Diagnose and fix test failures
|
|
17
|
+
|
|
18
|
+
## Execution Steps
|
|
19
|
+
|
|
20
|
+
### 1. Detect Toolchain
|
|
21
|
+
|
|
22
|
+
Before running anything, detect the project's test setup:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Check package.json for test runner and scripts
|
|
26
|
+
cat package.json 2>/dev/null
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Look for `vitest`, `jest`, `mocha`, `ava`, `playwright`, `cypress` in dependencies
|
|
30
|
+
- Identify available test scripts (`test`, `test:run`, `test:watch`, `test:e2e`)
|
|
31
|
+
- Detect test config files: `vitest.config.*`, `jest.config.*`, `playwright.config.*`
|
|
32
|
+
- Determine package manager from lock files
|
|
33
|
+
|
|
34
|
+
### 2. Determine Workflow
|
|
35
|
+
|
|
36
|
+
Parse arguments:
|
|
37
|
+
- (none) or `run` → Run full test suite, analyze failures
|
|
38
|
+
- File pattern (e.g., `auth`, `user.test.ts`) → Run targeted tests
|
|
39
|
+
- `generate` or `coverage` → Identify files without tests, generate templates
|
|
40
|
+
- `watch` → Start test watcher
|
|
41
|
+
|
|
42
|
+
### 3. Run Tests
|
|
43
|
+
|
|
44
|
+
Execute tests using the detected toolchain:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Full suite (adapt command to detected runner)
|
|
48
|
+
[package-manager] [test-script]
|
|
49
|
+
|
|
50
|
+
# Targeted (adapt to runner)
|
|
51
|
+
[package-manager] [test-script] [pattern]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Capture full output including:
|
|
55
|
+
- Pass/fail counts
|
|
56
|
+
- Error messages and stack traces
|
|
57
|
+
- Duration
|
|
58
|
+
|
|
59
|
+
### 4. Analyze Failures
|
|
60
|
+
|
|
61
|
+
For each failing test:
|
|
62
|
+
|
|
63
|
+
**Categorize the failure**:
|
|
64
|
+
- **Assertion Failure**: Expected vs actual mismatch
|
|
65
|
+
- **Runtime Error**: Import issues, missing mocks, type errors
|
|
66
|
+
- **Environment Issue**: Missing env vars, database, external services
|
|
67
|
+
- **Timeout**: Async operations not resolving
|
|
68
|
+
|
|
69
|
+
**Root cause analysis**:
|
|
70
|
+
1. Read the test file to understand intent
|
|
71
|
+
2. Read the implementation being tested
|
|
72
|
+
3. Identify the gap between expected and actual behavior
|
|
73
|
+
4. Determine if it's a test bug or implementation bug
|
|
74
|
+
|
|
75
|
+
**Fix suggestion**:
|
|
76
|
+
- Provide specific code changes
|
|
77
|
+
- Indicate whether to fix the test or the implementation
|
|
78
|
+
- Include rationale
|
|
79
|
+
|
|
80
|
+
### 5. Generate Tests (if requested)
|
|
81
|
+
|
|
82
|
+
When generating tests:
|
|
83
|
+
|
|
84
|
+
1. **Find untested files**:
|
|
85
|
+
- Use Glob to find source files
|
|
86
|
+
- Check which have corresponding test files
|
|
87
|
+
- Prioritize by complexity and importance
|
|
88
|
+
|
|
89
|
+
2. **Analyze the code**:
|
|
90
|
+
- Read the source file
|
|
91
|
+
- Identify functions, components, and their contracts
|
|
92
|
+
- Determine inputs, outputs, and side effects
|
|
93
|
+
|
|
94
|
+
3. **Generate test structure**:
|
|
95
|
+
- Use the project's testing conventions (import style, describe/it pattern)
|
|
96
|
+
- Follow AAA pattern (Arrange, Act, Assert)
|
|
97
|
+
- Cover: happy path, edge cases, error cases
|
|
98
|
+
|
|
99
|
+
4. **Coverage priorities**:
|
|
100
|
+
- Happy path (normal expected usage)
|
|
101
|
+
- Edge cases (empty inputs, boundaries, nulls)
|
|
102
|
+
- Error cases (invalid inputs, network failures)
|
|
103
|
+
- Integration points (API calls, database operations)
|
|
104
|
+
|
|
105
|
+
### Mocking Strategy
|
|
106
|
+
- Mock external dependencies (APIs, databases, file system)
|
|
107
|
+
- Use real implementations for pure functions
|
|
108
|
+
- Mock time-sensitive operations (dates, timers)
|
|
109
|
+
- Use spy functions for verifying calls without replacing behavior
|
|
110
|
+
|
|
111
|
+
## Output Format
|
|
112
|
+
|
|
113
|
+
### After Running Tests
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
# Test Results
|
|
117
|
+
|
|
118
|
+
**Suite**: [test suite name or pattern]
|
|
119
|
+
**Runner**: [vitest/jest/etc.]
|
|
120
|
+
**Status**: PASS / FAIL
|
|
121
|
+
**Duration**: [time]
|
|
122
|
+
|
|
123
|
+
## Summary
|
|
124
|
+
|
|
125
|
+
- Total: [X] tests
|
|
126
|
+
- Passed: [Y]
|
|
127
|
+
- Failed: [Z]
|
|
128
|
+
- Skipped: [N]
|
|
129
|
+
|
|
130
|
+
## Failures
|
|
131
|
+
|
|
132
|
+
### 1. `path/to/test.ts:42` - [Test Name]
|
|
133
|
+
|
|
134
|
+
**Error**:
|
|
135
|
+
[Error output]
|
|
136
|
+
|
|
137
|
+
**Analysis**: [Root cause explanation]
|
|
138
|
+
|
|
139
|
+
**Suggested Fix**:
|
|
140
|
+
[Specific code change - either in the test or implementation]
|
|
141
|
+
|
|
142
|
+
**Recommendation**: [Fix test / Fix implementation / Both]
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Recommendations
|
|
147
|
+
|
|
148
|
+
- [Action items]
|
|
149
|
+
|
|
150
|
+
## Next Steps
|
|
151
|
+
|
|
152
|
+
1. Fix failing tests
|
|
153
|
+
2. Re-run to verify
|
|
154
|
+
3. [Additional suggestions]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### After Generating Tests
|
|
158
|
+
|
|
159
|
+
```markdown
|
|
160
|
+
# Test Generation Report
|
|
161
|
+
|
|
162
|
+
**Files without tests**: [X]
|
|
163
|
+
**Tests generated**: [Y]
|
|
164
|
+
|
|
165
|
+
## Generated Test Files
|
|
166
|
+
|
|
167
|
+
### `src/__tests__/[name].test.ts`
|
|
168
|
+
|
|
169
|
+
**Testing**: `src/[name].ts`
|
|
170
|
+
**Coverage**: [X] test cases covering [Y] functions
|
|
171
|
+
|
|
172
|
+
[Generated test code]
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Guidelines
|
|
176
|
+
|
|
177
|
+
- **Don't blindly fix tests to pass**: If the test is correct and the implementation is wrong, say so
|
|
178
|
+
- **Detect the toolchain**: Never assume vitest/jest/pnpm — always check first
|
|
179
|
+
- **Match project conventions**: Look at existing test files for patterns before generating
|
|
180
|
+
- **Be practical**: Focus on tests that catch real bugs, not just increase coverage numbers
|
|
181
|
+
- **Explain failures clearly**: The developer should understand WHY it failed, not just WHAT failed
|
|
@@ -27,28 +27,17 @@ $ARGUMENTS
|
|
|
27
27
|
|
|
28
28
|
## Launching Code Auditor
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- ✅ Verify multi-tenant isolation (site-specific)
|
|
45
|
-
- ✅ Provide specific, actionable recommendations
|
|
46
|
-
- ✅ Give final verdict: safe to commit or issues to fix
|
|
47
|
-
|
|
48
|
-
**After the audit completes**, the agent will ask:
|
|
49
|
-
|
|
50
|
-
1. **Just review** (default) - Show the audit report only
|
|
51
|
-
2. **Auto-fix** - Attempt to automatically fix important and critical issues
|
|
52
|
-
3. **Create fix plan** - Generate a PLAN_AUDIT_FIXES.md with systematic fixes
|
|
53
|
-
|
|
54
|
-
Use the Task tool to launch the audit agent (subagent_type="general-purpose") which will autonomously analyze your code changes, generate a comprehensive audit report, and optionally fix issues.
|
|
30
|
+
The audit agent will:
|
|
31
|
+
- Detect your toolchain and project conventions
|
|
32
|
+
- Review all staged and unstaged changes
|
|
33
|
+
- Check for security vulnerabilities, breaking changes, and data loss risks
|
|
34
|
+
- Identify DRY violations, type safety issues, and error handling gaps
|
|
35
|
+
- Verify consistency with project patterns (CLAUDE.md)
|
|
36
|
+
- Provide a structured report with severity levels and specific fixes
|
|
37
|
+
|
|
38
|
+
**After the audit**, the agent will offer:
|
|
39
|
+
1. **Just review** — Show the audit report only
|
|
40
|
+
2. **Auto-fix** — Attempt to fix critical and important issues
|
|
41
|
+
3. **Create fix plan** — Generate `tasks/plans/PLAN_AUDIT_FIXES.md`
|
|
42
|
+
|
|
43
|
+
Use the Task tool to launch the audit agent (subagent_type="audit") which will autonomously analyze your code changes, generate a comprehensive audit report, and optionally fix issues.
|
|
@@ -26,7 +26,7 @@ $ARGUMENTS
|
|
|
26
26
|
## Generating Plan & Bootstrap Script
|
|
27
27
|
|
|
28
28
|
Launching the bootstrap agent to analyze our brainstorming conversation and generate:
|
|
29
|
-
1.
|
|
29
|
+
1. `tasks/plans/PLAN_{NAME}.md` (via `/plan` command)
|
|
30
30
|
2. `./bootstrap.sh` (executable setup script)
|
|
31
31
|
|
|
32
32
|
The agent will:
|
|
@@ -43,4 +43,4 @@ The agent will:
|
|
|
43
43
|
- Git initialization
|
|
44
44
|
- Error handling and progress indicators
|
|
45
45
|
|
|
46
|
-
Use the Task tool to launch the bootstrap agent (subagent_type="
|
|
46
|
+
Use the Task tool to launch the bootstrap agent (subagent_type="bootstrap") which will autonomously generate both the plan and bootstrap script.
|
|
@@ -4,9 +4,9 @@ argument-hint: [optional: "imports" | "dead-code" | "types" | "todos" | focus ar
|
|
|
4
4
|
author: "@markoradak"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Code Cleanup
|
|
7
|
+
# Code Cleanup
|
|
8
8
|
|
|
9
|
-
I'll
|
|
9
|
+
I'll scan your codebase for dead code, unused imports, and technical debt.
|
|
10
10
|
|
|
11
11
|
## Current State
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ I'll help identify and clean up dead code, unused imports, and technical debt in
|
|
|
15
15
|
**Branch**: !`git branch --show-current`
|
|
16
16
|
|
|
17
17
|
**Files to Analyze**:
|
|
18
|
-
!`find
|
|
18
|
+
!`find . -maxdepth 5 -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" 2>/dev/null | grep -v node_modules | wc -l` source files
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
@@ -25,302 +25,13 @@ $ARGUMENTS
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
-
## Cleanup
|
|
28
|
+
## Launching Cleanup Agent
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
The cleanup agent will:
|
|
31
|
+
- Detect your toolchain (package manager, available scripts)
|
|
32
|
+
- Scan for unused imports, dead code, `any` types, stale TODOs, console statements, and commented-out code
|
|
33
|
+
- Generate a structured report with file:line references
|
|
34
|
+
- Offer auto-fix for safe changes (with your approval)
|
|
35
|
+
- Validate that nothing breaks after cleanup
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
- Find and remove unused imports
|
|
34
|
-
- Organize import order
|
|
35
|
-
- Remove duplicate imports
|
|
36
|
-
|
|
37
|
-
### If "dead-code":
|
|
38
|
-
- Find unreferenced exports
|
|
39
|
-
- Identify unused functions/components
|
|
40
|
-
- Detect unreachable code
|
|
41
|
-
|
|
42
|
-
### If "types":
|
|
43
|
-
- Audit `any` usage
|
|
44
|
-
- Find implicit any
|
|
45
|
-
- Identify redundant type assertions
|
|
46
|
-
|
|
47
|
-
### If "todos":
|
|
48
|
-
- Inventory all TODO/FIXME/HACK comments
|
|
49
|
-
- Categorize by priority
|
|
50
|
-
- Suggest which to address or remove
|
|
51
|
-
|
|
52
|
-
### If specific file/folder provided:
|
|
53
|
-
- Deep cleanup of that area only
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Cleanup Categories
|
|
58
|
-
|
|
59
|
-
### 1. Unused Imports
|
|
60
|
-
|
|
61
|
-
**Detection**:
|
|
62
|
-
```bash
|
|
63
|
-
# ESLint can find these
|
|
64
|
-
pnpm eslint src --rule '@typescript-eslint/no-unused-vars: error' --format compact 2>&1 | grep "no-unused-vars"
|
|
65
|
-
|
|
66
|
-
# Or check specific file
|
|
67
|
-
grep -E "^import" path/to/file.ts
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Cleanup Strategy**:
|
|
71
|
-
- Remove imports not referenced in the file
|
|
72
|
-
- Remove type-only imports if types aren't used
|
|
73
|
-
- Consolidate multiple imports from same module
|
|
74
|
-
|
|
75
|
-
### 2. Dead Code
|
|
76
|
-
|
|
77
|
-
**Detection Patterns**:
|
|
78
|
-
|
|
79
|
-
**Unreferenced Exports**:
|
|
80
|
-
```bash
|
|
81
|
-
# Find all exports
|
|
82
|
-
grep -rn "export " src/ --include="*.ts" --include="*.tsx"
|
|
83
|
-
|
|
84
|
-
# Check if each is imported anywhere
|
|
85
|
-
grep -rn "import.*{.*ExportName" src/
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**Unused Functions**:
|
|
89
|
-
- Functions defined but never called
|
|
90
|
-
- Event handlers attached to removed elements
|
|
91
|
-
- Utility functions from old features
|
|
92
|
-
|
|
93
|
-
**Unreachable Code**:
|
|
94
|
-
- Code after return/throw statements
|
|
95
|
-
- Conditions that can never be true
|
|
96
|
-
- Catch blocks for errors that can't occur
|
|
97
|
-
|
|
98
|
-
### 3. Type Cleanup
|
|
99
|
-
|
|
100
|
-
**`any` Audit**:
|
|
101
|
-
```bash
|
|
102
|
-
# Find explicit any
|
|
103
|
-
grep -rn ": any" src/ --include="*.ts" --include="*.tsx"
|
|
104
|
-
|
|
105
|
-
# Find any in function parameters
|
|
106
|
-
grep -rn "(.*any.*)" src/ --include="*.ts"
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**Categories**:
|
|
110
|
-
- **Justified**: External library types, truly dynamic data
|
|
111
|
-
- **Lazy**: Should be properly typed
|
|
112
|
-
- **Accidental**: Implicit any from missing types
|
|
113
|
-
|
|
114
|
-
### 4. TODO/FIXME Inventory
|
|
115
|
-
|
|
116
|
-
**Detection**:
|
|
117
|
-
```bash
|
|
118
|
-
# Find all TODOs
|
|
119
|
-
grep -rn "TODO\|FIXME\|HACK\|XXX" src/ --include="*.ts" --include="*.tsx"
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**Categories**:
|
|
123
|
-
- **Stale**: Old TODOs that are no longer relevant
|
|
124
|
-
- **Completed**: Work is done but comment remains
|
|
125
|
-
- **Valid**: Still needs to be done
|
|
126
|
-
- **Won't Do**: Decided against implementing
|
|
127
|
-
|
|
128
|
-
### 5. Console Statements
|
|
129
|
-
|
|
130
|
-
**Detection**:
|
|
131
|
-
```bash
|
|
132
|
-
# Find console.log/warn/error
|
|
133
|
-
grep -rn "console\." src/ --include="*.ts" --include="*.tsx"
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
**Categories**:
|
|
137
|
-
- **Debug**: Should be removed
|
|
138
|
-
- **Intentional**: Error logging, should use proper logger
|
|
139
|
-
- **Temporary**: Left from debugging session
|
|
140
|
-
|
|
141
|
-
### 6. Commented Code
|
|
142
|
-
|
|
143
|
-
**Detection**:
|
|
144
|
-
- Large blocks of commented-out code
|
|
145
|
-
- Commented function definitions
|
|
146
|
-
- "Old" or "backup" comments
|
|
147
|
-
|
|
148
|
-
**Policy**:
|
|
149
|
-
- If it's in git history, delete it
|
|
150
|
-
- If it might be needed, create a branch
|
|
151
|
-
- Never commit commented-out code
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Cleanup Report Format
|
|
156
|
-
|
|
157
|
-
```markdown
|
|
158
|
-
# Cleanup Report
|
|
159
|
-
|
|
160
|
-
**Scanned**: [X] files in [path]
|
|
161
|
-
**Date**: [timestamp]
|
|
162
|
-
**Focus**: [area or "all"]
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## Summary
|
|
167
|
-
|
|
168
|
-
| Category | Found | Auto-fixable | Manual Review |
|
|
169
|
-
|----------|-------|--------------|---------------|
|
|
170
|
-
| Unused Imports | X | X | 0 |
|
|
171
|
-
| Dead Code | X | 0 | X |
|
|
172
|
-
| `any` Types | X | 0 | X |
|
|
173
|
-
| TODOs | X | N/A | X |
|
|
174
|
-
| Console Statements | X | X | 0 |
|
|
175
|
-
| Commented Code | X | X | 0 |
|
|
176
|
-
|
|
177
|
-
**Estimated Impact**: -[X] lines of code
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Unused Imports
|
|
182
|
-
|
|
183
|
-
### `src/components/Example.tsx`
|
|
184
|
-
|
|
185
|
-
**Remove**:
|
|
186
|
-
```typescript
|
|
187
|
-
// Line 3: unused
|
|
188
|
-
import { unusedFunction } from '@/lib/utils'
|
|
189
|
-
|
|
190
|
-
// Line 5: only 'used' is used, remove 'unused'
|
|
191
|
-
import { used, unused } from '@/lib/helpers'
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**After**:
|
|
195
|
-
```typescript
|
|
196
|
-
import { used } from '@/lib/helpers'
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
## Dead Code
|
|
202
|
-
|
|
203
|
-
### Unreferenced Exports
|
|
204
|
-
|
|
205
|
-
| Export | File | Last Modified | Recommendation |
|
|
206
|
-
|--------|------|---------------|----------------|
|
|
207
|
-
| `oldHelper` | `src/lib/utils.ts:45` | 3 months ago | Remove |
|
|
208
|
-
| `deprecatedFn` | `src/lib/api.ts:123` | 6 months ago | Remove |
|
|
209
|
-
|
|
210
|
-
### Unused Functions
|
|
211
|
-
|
|
212
|
-
**`src/lib/helpers.ts:78`** - `formatOldDate()`
|
|
213
|
-
- Not imported anywhere
|
|
214
|
-
- Last modified: [date]
|
|
215
|
-
- **Recommendation**: Remove
|
|
216
|
-
|
|
217
|
-
---
|
|
218
|
-
|
|
219
|
-
## Type Issues
|
|
220
|
-
|
|
221
|
-
### `any` Usage
|
|
222
|
-
|
|
223
|
-
| Location | Context | Recommendation |
|
|
224
|
-
|----------|---------|----------------|
|
|
225
|
-
| `src/api/route.ts:23` | API response | Type as `ApiResponse` |
|
|
226
|
-
| `src/utils/parse.ts:45` | JSON parse | Use `unknown` + validation |
|
|
227
|
-
| `src/lib/external.ts:12` | 3rd party | Justified - add comment |
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## TODO Inventory
|
|
232
|
-
|
|
233
|
-
### Stale (Remove)
|
|
234
|
-
|
|
235
|
-
- `src/old.ts:45`: "TODO: refactor this" (file deleted 2 months ago)
|
|
236
|
-
- `src/api.ts:23`: "FIXME: temporary" (been there 6 months)
|
|
237
|
-
|
|
238
|
-
### Valid (Keep/Address)
|
|
239
|
-
|
|
240
|
-
- `src/auth.ts:89`: "TODO: add rate limiting" - Still needed
|
|
241
|
-
- `src/db.ts:34`: "FIXME: optimize query" - Performance issue
|
|
242
|
-
|
|
243
|
-
### Completed (Remove)
|
|
244
|
-
|
|
245
|
-
- `src/user.ts:56`: "TODO: add validation" - Validation exists
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
## Console Statements
|
|
250
|
-
|
|
251
|
-
| Location | Type | Action |
|
|
252
|
-
|----------|------|--------|
|
|
253
|
-
| `src/debug.ts:12` | `console.log` | Remove (debug) |
|
|
254
|
-
| `src/api.ts:45` | `console.error` | Replace with logger |
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
## Commented Code
|
|
259
|
-
|
|
260
|
-
| Location | Lines | Age | Action |
|
|
261
|
-
|----------|-------|-----|--------|
|
|
262
|
-
| `src/old.tsx:34-56` | 22 | 4 months | Remove |
|
|
263
|
-
| `src/utils.ts:78-89` | 11 | 2 months | Remove |
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
|
-
## Recommended Actions
|
|
268
|
-
|
|
269
|
-
### Auto-fix (Safe)
|
|
270
|
-
|
|
271
|
-
These can be automatically cleaned up:
|
|
272
|
-
|
|
273
|
-
1. [ ] Remove unused imports
|
|
274
|
-
2. [ ] Remove console.log statements
|
|
275
|
-
3. [ ] Remove commented-out code
|
|
276
|
-
|
|
277
|
-
Run: "Would you like me to auto-fix these?"
|
|
278
|
-
|
|
279
|
-
### Manual Review Required
|
|
280
|
-
|
|
281
|
-
These need human decision:
|
|
282
|
-
|
|
283
|
-
1. [ ] Review dead code exports before removal
|
|
284
|
-
2. [ ] Decide on TODO items
|
|
285
|
-
3. [ ] Type the `any` usages appropriately
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
## Next Steps
|
|
290
|
-
|
|
291
|
-
1. Review this report
|
|
292
|
-
2. Approve auto-fixes
|
|
293
|
-
3. Address manual review items
|
|
294
|
-
4. Run `pnpm typecheck && pnpm lint` to verify
|
|
295
|
-
5. Commit cleanup: `git commit -m "chore: code cleanup"`
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
---
|
|
299
|
-
|
|
300
|
-
## Auto-Fix Capabilities
|
|
301
|
-
|
|
302
|
-
When user approves, I can automatically:
|
|
303
|
-
|
|
304
|
-
- **Remove unused imports**: Edit files to remove
|
|
305
|
-
- **Remove console statements**: Edit to remove (except console.error in catch blocks)
|
|
306
|
-
- **Remove commented code**: Edit to remove blocks
|
|
307
|
-
- **Organize imports**: Sort and group imports
|
|
308
|
-
|
|
309
|
-
I will NOT automatically:
|
|
310
|
-
- Remove functions (might have dynamic usage)
|
|
311
|
-
- Change `any` types (needs proper typing)
|
|
312
|
-
- Remove TODOs (needs human decision)
|
|
313
|
-
- Remove exports (might be used externally)
|
|
314
|
-
|
|
315
|
-
---
|
|
316
|
-
|
|
317
|
-
## Safety Guidelines
|
|
318
|
-
|
|
319
|
-
1. **Always validate after cleanup**: Run typecheck and lint
|
|
320
|
-
2. **Review before committing**: Show git diff
|
|
321
|
-
3. **Don't break functionality**: When in doubt, leave it
|
|
322
|
-
4. **Track what was removed**: Clear commit message
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
Begin cleanup analysis based on the focus area provided. Use Grep to find patterns, Read to analyze context, and Edit to apply fixes (with user approval).
|
|
37
|
+
Use the Task tool to launch the cleanup agent (subagent_type="cleanup") with the focus area and any additional context from arguments.
|