autoworkflow 3.1.1 → 3.1.3
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/.claude/commands/audit.md +151 -70
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# /audit - Audit Command
|
|
2
2
|
|
|
3
|
-
Run
|
|
3
|
+
Run code quality, security, and architecture audits.
|
|
4
4
|
|
|
5
5
|
## Trigger
|
|
6
6
|
- User invokes `/audit`
|
|
7
7
|
- User invokes `/audit project` (full project scan)
|
|
8
|
+
- User invokes `/audit [feature]` (audit specific feature)
|
|
8
9
|
- **AUTOMATIC:** When BLUEPRINT.md is missing at session start
|
|
9
10
|
- Or: Automatically after VERIFY phase (for features)
|
|
10
11
|
- Or: Part of audit_loop
|
|
@@ -16,12 +17,127 @@ Per `system/router.md`, audit is required for:
|
|
|
16
17
|
- `perf` - Performance changes
|
|
17
18
|
|
|
18
19
|
## Arguments
|
|
19
|
-
- `/audit` - Run standard UI +
|
|
20
|
-
- `/audit project` - Full project scan (generates
|
|
20
|
+
- `/audit` - Run standard checks (UI + cycles)
|
|
21
|
+
- `/audit project` - Full project scan (generates BLUEPRINT.md)
|
|
22
|
+
- `/audit [feature name]` - Deep audit of specific feature
|
|
21
23
|
|
|
22
24
|
---
|
|
23
25
|
|
|
24
|
-
##
|
|
26
|
+
## Audit Types
|
|
27
|
+
|
|
28
|
+
### Type 1: Feature Audit (`/audit [feature]`)
|
|
29
|
+
|
|
30
|
+
Deep code review of a specific feature. Check for:
|
|
31
|
+
|
|
32
|
+
**Security:**
|
|
33
|
+
- [ ] Authentication/authorization on all endpoints
|
|
34
|
+
- [ ] CSRF protection on POST/PUT/DELETE
|
|
35
|
+
- [ ] Input validation (length, type, format)
|
|
36
|
+
- [ ] SQL injection prevention (parameterized queries)
|
|
37
|
+
- [ ] XSS prevention (output encoding)
|
|
38
|
+
- [ ] Sensitive data exposure
|
|
39
|
+
|
|
40
|
+
**Code Quality:**
|
|
41
|
+
- [ ] Error handling and logging
|
|
42
|
+
- [ ] Consistent response formats
|
|
43
|
+
- [ ] No hardcoded values (use constants/config)
|
|
44
|
+
- [ ] No TODO/FIXME comments
|
|
45
|
+
- [ ] No console.log/debug statements
|
|
46
|
+
|
|
47
|
+
**Architecture:**
|
|
48
|
+
- [ ] Follows existing patterns
|
|
49
|
+
- [ ] No circular dependencies
|
|
50
|
+
- [ ] Proper separation of concerns
|
|
51
|
+
|
|
52
|
+
**Feature Completeness (AI Analysis):**
|
|
53
|
+
|
|
54
|
+
Claude analyzes the code itself to determine what's missing. No BLUEPRINT needed.
|
|
55
|
+
|
|
56
|
+
| If You Find... | Check For... |
|
|
57
|
+
|----------------|--------------|
|
|
58
|
+
| API endpoint | Frontend component that calls it |
|
|
59
|
+
| Form component | Validation, error states, loading state, success feedback |
|
|
60
|
+
| CRUD operations | All 4 operations? Delete confirmation modal? |
|
|
61
|
+
| Auth-protected route | Auth check? Redirect on unauthorized? |
|
|
62
|
+
| Data fetching | Loading skeleton? Error state? Empty state? Retry? |
|
|
63
|
+
| User action | Optimistic UI? Rollback on failure? Toast feedback? |
|
|
64
|
+
| List/table | Pagination? Search/filter? Sort? Empty state? |
|
|
65
|
+
| File upload | Progress indicator? Size/type validation? Error handling? |
|
|
66
|
+
| Modal/dialog | Close on escape? Click outside to close? Focus trap? |
|
|
67
|
+
| Navigation | Active state? Mobile menu? Breadcrumbs where needed? |
|
|
68
|
+
|
|
69
|
+
**Completeness Score:**
|
|
70
|
+
```
|
|
71
|
+
Feature: [Name]
|
|
72
|
+
├── Backend: ✅ API exists
|
|
73
|
+
├── Frontend: ✅ UI calls API
|
|
74
|
+
├── States: ⚠️ Missing error handling
|
|
75
|
+
├── UX: ⚠️ No loading indicator
|
|
76
|
+
└── Score: 75% complete
|
|
77
|
+
|
|
78
|
+
Missing for 100%:
|
|
79
|
+
1. Add error boundary around component
|
|
80
|
+
2. Add loading skeleton during fetch
|
|
81
|
+
3. Add empty state for no results
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Output Format (Feature Audit):
|
|
85
|
+
```
|
|
86
|
+
## Audit Report: [Feature Name]
|
|
87
|
+
|
|
88
|
+
### Files Reviewed
|
|
89
|
+
| File | Lines | Purpose |
|
|
90
|
+
|------|-------|---------|
|
|
91
|
+
| [file] | [count] | [purpose] |
|
|
92
|
+
|
|
93
|
+
### Status: [PASS/PASS with recommendations/FAIL]
|
|
94
|
+
|
|
95
|
+
### Strengths
|
|
96
|
+
| Item | Location | Status |
|
|
97
|
+
|------|----------|--------|
|
|
98
|
+
| [good thing] | [where] | ✅ |
|
|
99
|
+
|
|
100
|
+
### Issues Found
|
|
101
|
+
| Severity | Issue | Location | Recommendation |
|
|
102
|
+
|----------|-------|----------|----------------|
|
|
103
|
+
| 🔴 High | [issue] | [where] | [fix] |
|
|
104
|
+
| 🟡 Medium | [issue] | [where] | [fix] |
|
|
105
|
+
| 🟢 Low | [issue] | [where] | [fix] |
|
|
106
|
+
| ℹ️ Info | [issue] | [where] | [fix] |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 🔧 Suggested Fixes
|
|
111
|
+
|
|
112
|
+
Based on the issues found, I recommend:
|
|
113
|
+
|
|
114
|
+
1. **[Issue 1]** - [Detailed fix description]
|
|
115
|
+
- File: [path]
|
|
116
|
+
- Change: [what to change]
|
|
117
|
+
|
|
118
|
+
2. **[Issue 2]** - [Detailed fix description]
|
|
119
|
+
- File: [path]
|
|
120
|
+
- Change: [what to change]
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
**Should I implement these fixes?**
|
|
125
|
+
- `yes` - Fix all issues
|
|
126
|
+
- `high only` - Fix only high/medium severity
|
|
127
|
+
- `1, 2, 4` - Fix specific issues by number
|
|
128
|
+
- `no` - Skip fixes, proceed to next audit
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**IMPORTANT:** When issues are found:
|
|
132
|
+
1. ALWAYS offer to fix them
|
|
133
|
+
2. WAIT for user approval
|
|
134
|
+
3. Implement approved fixes
|
|
135
|
+
4. Re-run audit to verify
|
|
136
|
+
5. ONLY THEN ask about next feature
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Type 2: Project Audit (`/audit project`)
|
|
25
141
|
|
|
26
142
|
When `/audit project` is invoked OR when BLUEPRINT.md is missing:
|
|
27
143
|
|
|
@@ -31,7 +147,7 @@ When `/audit project` is invoked OR when BLUEPRINT.md is missing:
|
|
|
31
147
|
- Just notify and run immediately
|
|
32
148
|
- Only ask permission when presenting results to SAVE
|
|
33
149
|
|
|
34
|
-
|
|
150
|
+
#### Step 1: Scan Codebase (Single Pass)
|
|
35
151
|
```bash
|
|
36
152
|
# All discovery commands run ONCE
|
|
37
153
|
cat package.json | grep -A 30 "dependencies"
|
|
@@ -46,7 +162,7 @@ ls -la src/
|
|
|
46
162
|
grep -r "/api/" src/ | head -30
|
|
47
163
|
```
|
|
48
164
|
|
|
49
|
-
|
|
165
|
+
#### Step 2: Present Dual Updates
|
|
50
166
|
```
|
|
51
167
|
## 🔍 Project Audit Complete
|
|
52
168
|
|
|
@@ -81,16 +197,16 @@ src/
|
|
|
81
197
|
- BLUEPRINT.md → Create/update with discoveries
|
|
82
198
|
```
|
|
83
199
|
|
|
84
|
-
|
|
200
|
+
#### Step 3: Save After Approval
|
|
85
201
|
Update both files with discovered information.
|
|
86
202
|
|
|
87
203
|
---
|
|
88
204
|
|
|
89
|
-
|
|
205
|
+
### Type 3: Standard Audit (`/audit`)
|
|
90
206
|
|
|
91
|
-
|
|
207
|
+
Quick check for UI enforcement and circular dependencies.
|
|
92
208
|
|
|
93
|
-
|
|
209
|
+
#### Step 1: Run UI Enforcement
|
|
94
210
|
```bash
|
|
95
211
|
npm run audit:ui
|
|
96
212
|
```
|
|
@@ -101,7 +217,7 @@ Check for orphan features:
|
|
|
101
217
|
- Utilities not imported anywhere
|
|
102
218
|
- Routes without page components
|
|
103
219
|
|
|
104
|
-
|
|
220
|
+
#### Step 2: Run Circular Dependency Check
|
|
105
221
|
```bash
|
|
106
222
|
npm run audit:cycles
|
|
107
223
|
```
|
|
@@ -111,7 +227,7 @@ Check for import cycles:
|
|
|
111
227
|
- A → B → C → A
|
|
112
228
|
- Longer chains
|
|
113
229
|
|
|
114
|
-
|
|
230
|
+
#### Step 3: Report Results
|
|
115
231
|
|
|
116
232
|
**On Success:**
|
|
117
233
|
```
|
|
@@ -129,86 +245,49 @@ Check for import cycles:
|
|
|
129
245
|
Ready to proceed to COMMIT.
|
|
130
246
|
```
|
|
131
247
|
|
|
132
|
-
**On
|
|
248
|
+
**On Failure:**
|
|
133
249
|
```
|
|
134
250
|
## Audit
|
|
135
251
|
|
|
136
252
|
| Check | Status | Details |
|
|
137
253
|
|-------|--------|---------|
|
|
138
254
|
| UI Enforcement | ⛔ | Orphan features found |
|
|
139
|
-
| Circular Deps |
|
|
140
|
-
|
|
141
|
-
### Orphan Features Detected
|
|
142
|
-
|
|
143
|
-
**API without UI:**
|
|
144
|
-
- `/api/users` - No component calls this endpoint
|
|
145
|
-
|
|
146
|
-
**Unused Hooks:**
|
|
147
|
-
- `useAuth` - Not used by any component
|
|
255
|
+
| Circular Deps | ⛔ | Cycles detected |
|
|
148
256
|
|
|
149
|
-
|
|
150
|
-
- `/settings` - No navigation leads here
|
|
257
|
+
### Issues Found
|
|
151
258
|
|
|
152
|
-
|
|
259
|
+
[List all issues with locations]
|
|
153
260
|
|
|
154
261
|
---
|
|
155
262
|
|
|
156
|
-
|
|
263
|
+
## 🔧 Suggested Fixes
|
|
157
264
|
|
|
158
|
-
|
|
265
|
+
1. **[Issue 1]** - [Fix description]
|
|
266
|
+
2. **[Issue 2]** - [Fix description]
|
|
159
267
|
|
|
160
|
-
|
|
161
|
-
1. Create `UserList.tsx` component for `/api/users`
|
|
162
|
-
2. Use `useAuth` hook in `AuthProvider.tsx`
|
|
163
|
-
3. Add navigation link to `/settings`
|
|
164
|
-
|
|
165
|
-
Building missing UI components...
|
|
268
|
+
**Should I implement these fixes?**
|
|
166
269
|
```
|
|
167
270
|
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
## Audit
|
|
171
|
-
|
|
172
|
-
| Check | Status | Details |
|
|
173
|
-
|-------|--------|---------|
|
|
174
|
-
| UI Enforcement | ✅ | No orphans |
|
|
175
|
-
| Circular Deps | ⛔ | Cycles detected |
|
|
271
|
+
---
|
|
176
272
|
|
|
177
|
-
|
|
273
|
+
## Critical Rule: Always Offer to Fix
|
|
178
274
|
|
|
179
|
-
**
|
|
180
|
-
```
|
|
181
|
-
src/hooks/useAuth.ts
|
|
182
|
-
→ src/api/auth.ts
|
|
183
|
-
→ src/hooks/useAuth.ts (CYCLE)
|
|
184
|
-
```
|
|
275
|
+
**NEVER** just report issues and move on. The workflow is:
|
|
185
276
|
|
|
186
|
-
**Cycle 2:**
|
|
187
277
|
```
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
278
|
+
1. AUDIT → Find issues
|
|
279
|
+
2. REPORT → Show issues with severity
|
|
280
|
+
3. SUGGEST → Offer specific fixes
|
|
281
|
+
4. WAIT → Get user approval
|
|
282
|
+
5. FIX → Implement approved fixes
|
|
283
|
+
6. RE-AUDIT → Verify fixes worked
|
|
284
|
+
7. THEN → Proceed to next item
|
|
192
285
|
```
|
|
193
286
|
|
|
194
|
-
|
|
287
|
+
If user says "no" to fixes, log it and proceed. But ALWAYS offer.
|
|
195
288
|
|
|
196
289
|
---
|
|
197
290
|
|
|
198
|
-
⛔ **BLOCKED: Cannot commit with circular dependencies**
|
|
199
|
-
|
|
200
|
-
### Required Actions
|
|
201
|
-
1. Extract shared code from `useAuth` and `auth.ts`
|
|
202
|
-
2. Break Button → Icon dependency
|
|
203
|
-
|
|
204
|
-
Resolving cycles...
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Step 4: Fix Loop (if issues)
|
|
208
|
-
Per `system/loops.md`:
|
|
209
|
-
- `ui_fix_loop` - Build missing UI
|
|
210
|
-
- `cycle_fix_loop` - Resolve import cycles
|
|
211
|
-
|
|
212
291
|
## Gate
|
|
213
292
|
`audit_gate` - Must pass before COMMIT for features.
|
|
214
293
|
|
|
@@ -223,5 +302,7 @@ npm run audit:all # Run all audits
|
|
|
223
302
|
See `system/loops.md#audit_loop` for loop definition.
|
|
224
303
|
|
|
225
304
|
## Examples
|
|
226
|
-
- `/audit` -
|
|
227
|
-
-
|
|
305
|
+
- `/audit` - Quick UI + cycles check
|
|
306
|
+
- `/audit project` - Full project scan
|
|
307
|
+
- `/audit authentication` - Deep audit of auth feature
|
|
308
|
+
- `/audit EntityController` - Audit specific file/class
|