autoworkflow 3.1.0 â 3.1.2
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 +119 -70
- package/.claude/settings.local.json +2 -1
- package/bin/cli.js +19 -6
- 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,95 @@ 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
|
+
### Output Format (Feature Audit):
|
|
53
|
+
```
|
|
54
|
+
## Audit Report: [Feature Name]
|
|
55
|
+
|
|
56
|
+
### Files Reviewed
|
|
57
|
+
| File | Lines | Purpose |
|
|
58
|
+
|------|-------|---------|
|
|
59
|
+
| [file] | [count] | [purpose] |
|
|
60
|
+
|
|
61
|
+
### Status: [PASS/PASS with recommendations/FAIL]
|
|
62
|
+
|
|
63
|
+
### Strengths
|
|
64
|
+
| Item | Location | Status |
|
|
65
|
+
|------|----------|--------|
|
|
66
|
+
| [good thing] | [where] | â
|
|
|
67
|
+
|
|
68
|
+
### Issues Found
|
|
69
|
+
| Severity | Issue | Location | Recommendation |
|
|
70
|
+
|----------|-------|----------|----------------|
|
|
71
|
+
| đ´ High | [issue] | [where] | [fix] |
|
|
72
|
+
| đĄ Medium | [issue] | [where] | [fix] |
|
|
73
|
+
| đĸ Low | [issue] | [where] | [fix] |
|
|
74
|
+
| âšī¸ Info | [issue] | [where] | [fix] |
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## đ§ Suggested Fixes
|
|
79
|
+
|
|
80
|
+
Based on the issues found, I recommend:
|
|
81
|
+
|
|
82
|
+
1. **[Issue 1]** - [Detailed fix description]
|
|
83
|
+
- File: [path]
|
|
84
|
+
- Change: [what to change]
|
|
85
|
+
|
|
86
|
+
2. **[Issue 2]** - [Detailed fix description]
|
|
87
|
+
- File: [path]
|
|
88
|
+
- Change: [what to change]
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
**Should I implement these fixes?**
|
|
93
|
+
- `yes` - Fix all issues
|
|
94
|
+
- `high only` - Fix only high/medium severity
|
|
95
|
+
- `1, 2, 4` - Fix specific issues by number
|
|
96
|
+
- `no` - Skip fixes, proceed to next audit
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**IMPORTANT:** When issues are found:
|
|
100
|
+
1. ALWAYS offer to fix them
|
|
101
|
+
2. WAIT for user approval
|
|
102
|
+
3. Implement approved fixes
|
|
103
|
+
4. Re-run audit to verify
|
|
104
|
+
5. ONLY THEN ask about next feature
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### Type 2: Project Audit (`/audit project`)
|
|
25
109
|
|
|
26
110
|
When `/audit project` is invoked OR when BLUEPRINT.md is missing:
|
|
27
111
|
|
|
@@ -31,7 +115,7 @@ When `/audit project` is invoked OR when BLUEPRINT.md is missing:
|
|
|
31
115
|
- Just notify and run immediately
|
|
32
116
|
- Only ask permission when presenting results to SAVE
|
|
33
117
|
|
|
34
|
-
|
|
118
|
+
#### Step 1: Scan Codebase (Single Pass)
|
|
35
119
|
```bash
|
|
36
120
|
# All discovery commands run ONCE
|
|
37
121
|
cat package.json | grep -A 30 "dependencies"
|
|
@@ -46,7 +130,7 @@ ls -la src/
|
|
|
46
130
|
grep -r "/api/" src/ | head -30
|
|
47
131
|
```
|
|
48
132
|
|
|
49
|
-
|
|
133
|
+
#### Step 2: Present Dual Updates
|
|
50
134
|
```
|
|
51
135
|
## đ Project Audit Complete
|
|
52
136
|
|
|
@@ -81,16 +165,16 @@ src/
|
|
|
81
165
|
- BLUEPRINT.md â Create/update with discoveries
|
|
82
166
|
```
|
|
83
167
|
|
|
84
|
-
|
|
168
|
+
#### Step 3: Save After Approval
|
|
85
169
|
Update both files with discovered information.
|
|
86
170
|
|
|
87
171
|
---
|
|
88
172
|
|
|
89
|
-
|
|
173
|
+
### Type 3: Standard Audit (`/audit`)
|
|
90
174
|
|
|
91
|
-
|
|
175
|
+
Quick check for UI enforcement and circular dependencies.
|
|
92
176
|
|
|
93
|
-
|
|
177
|
+
#### Step 1: Run UI Enforcement
|
|
94
178
|
```bash
|
|
95
179
|
npm run audit:ui
|
|
96
180
|
```
|
|
@@ -101,7 +185,7 @@ Check for orphan features:
|
|
|
101
185
|
- Utilities not imported anywhere
|
|
102
186
|
- Routes without page components
|
|
103
187
|
|
|
104
|
-
|
|
188
|
+
#### Step 2: Run Circular Dependency Check
|
|
105
189
|
```bash
|
|
106
190
|
npm run audit:cycles
|
|
107
191
|
```
|
|
@@ -111,7 +195,7 @@ Check for import cycles:
|
|
|
111
195
|
- A â B â C â A
|
|
112
196
|
- Longer chains
|
|
113
197
|
|
|
114
|
-
|
|
198
|
+
#### Step 3: Report Results
|
|
115
199
|
|
|
116
200
|
**On Success:**
|
|
117
201
|
```
|
|
@@ -129,86 +213,49 @@ Check for import cycles:
|
|
|
129
213
|
Ready to proceed to COMMIT.
|
|
130
214
|
```
|
|
131
215
|
|
|
132
|
-
**On
|
|
216
|
+
**On Failure:**
|
|
133
217
|
```
|
|
134
218
|
## Audit
|
|
135
219
|
|
|
136
220
|
| Check | Status | Details |
|
|
137
221
|
|-------|--------|---------|
|
|
138
222
|
| 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
|
|
223
|
+
| Circular Deps | â | Cycles detected |
|
|
148
224
|
|
|
149
|
-
|
|
150
|
-
- `/settings` - No navigation leads here
|
|
225
|
+
### Issues Found
|
|
151
226
|
|
|
152
|
-
|
|
227
|
+
[List all issues with locations]
|
|
153
228
|
|
|
154
229
|
---
|
|
155
230
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Must add UI for each backend feature.
|
|
231
|
+
## đ§ Suggested Fixes
|
|
159
232
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
2. Use `useAuth` hook in `AuthProvider.tsx`
|
|
163
|
-
3. Add navigation link to `/settings`
|
|
233
|
+
1. **[Issue 1]** - [Fix description]
|
|
234
|
+
2. **[Issue 2]** - [Fix description]
|
|
164
235
|
|
|
165
|
-
|
|
236
|
+
**Should I implement these fixes?**
|
|
166
237
|
```
|
|
167
238
|
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
## Audit
|
|
171
|
-
|
|
172
|
-
| Check | Status | Details |
|
|
173
|
-
|-------|--------|---------|
|
|
174
|
-
| UI Enforcement | â
| No orphans |
|
|
175
|
-
| Circular Deps | â | Cycles detected |
|
|
239
|
+
---
|
|
176
240
|
|
|
177
|
-
|
|
241
|
+
## Critical Rule: Always Offer to Fix
|
|
178
242
|
|
|
179
|
-
**
|
|
180
|
-
```
|
|
181
|
-
src/hooks/useAuth.ts
|
|
182
|
-
â src/api/auth.ts
|
|
183
|
-
â src/hooks/useAuth.ts (CYCLE)
|
|
184
|
-
```
|
|
243
|
+
**NEVER** just report issues and move on. The workflow is:
|
|
185
244
|
|
|
186
|
-
**Cycle 2:**
|
|
187
245
|
```
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
246
|
+
1. AUDIT â Find issues
|
|
247
|
+
2. REPORT â Show issues with severity
|
|
248
|
+
3. SUGGEST â Offer specific fixes
|
|
249
|
+
4. WAIT â Get user approval
|
|
250
|
+
5. FIX â Implement approved fixes
|
|
251
|
+
6. RE-AUDIT â Verify fixes worked
|
|
252
|
+
7. THEN â Proceed to next item
|
|
192
253
|
```
|
|
193
254
|
|
|
194
|
-
|
|
255
|
+
If user says "no" to fixes, log it and proceed. But ALWAYS offer.
|
|
195
256
|
|
|
196
257
|
---
|
|
197
258
|
|
|
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
259
|
## Gate
|
|
213
260
|
`audit_gate` - Must pass before COMMIT for features.
|
|
214
261
|
|
|
@@ -223,5 +270,7 @@ npm run audit:all # Run all audits
|
|
|
223
270
|
See `system/loops.md#audit_loop` for loop definition.
|
|
224
271
|
|
|
225
272
|
## Examples
|
|
226
|
-
- `/audit` -
|
|
227
|
-
-
|
|
273
|
+
- `/audit` - Quick UI + cycles check
|
|
274
|
+
- `/audit project` - Full project scan
|
|
275
|
+
- `/audit authentication` - Deep audit of auth feature
|
|
276
|
+
- `/audit EntityController` - Audit specific file/class
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"Bash(chmod:*)",
|
|
11
11
|
"Bash(npm run typecheck:*)",
|
|
12
12
|
"Bash(git add:*)",
|
|
13
|
-
"Bash(git commit -m \"$\\(cat <<''EOF''\nfeat\\(hooks\\): implement full auto-trigger system with blocking gates\n\n- Add 7 new hook scripts for workflow automation:\n - session-check.sh: Init, blueprint check, task classification\n - post-edit.sh: Auto-verify with loop tracking \\(max 10 iterations\\)\n - pre-tool-router.sh: Route Bash commands to appropriate checks\n - pre-commit-check.sh: All 7 gate checks with blocking \\(exit 1\\)\n - phase-transition.sh: State management and gate enforcement\n - audit-runner.sh: UI enforcement + circular dependency checks\n - blueprint-generator.sh: Auto-scan project structure\n\n- Pre-commit gate now checks:\n - TypeScript errors\n - ESLint warnings\n - TODO/FIXME comments\n - console.log statements\n - Orphan features \\(UI enforcement\\)\n - Circular dependencies\n - Conventional commit format\n\n- State tracking in .claude/.autoworkflow/:\n - phase, task-type, verify-iteration, audit-iteration\n - verify-status, audit-status, plan-approved\n\n- Updated CLAUDE.md files with:\n - Slash commands table\n - Hook files reference\n - Hook integration section\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")"
|
|
13
|
+
"Bash(git commit -m \"$\\(cat <<''EOF''\nfeat\\(hooks\\): implement full auto-trigger system with blocking gates\n\n- Add 7 new hook scripts for workflow automation:\n - session-check.sh: Init, blueprint check, task classification\n - post-edit.sh: Auto-verify with loop tracking \\(max 10 iterations\\)\n - pre-tool-router.sh: Route Bash commands to appropriate checks\n - pre-commit-check.sh: All 7 gate checks with blocking \\(exit 1\\)\n - phase-transition.sh: State management and gate enforcement\n - audit-runner.sh: UI enforcement + circular dependency checks\n - blueprint-generator.sh: Auto-scan project structure\n\n- Pre-commit gate now checks:\n - TypeScript errors\n - ESLint warnings\n - TODO/FIXME comments\n - console.log statements\n - Orphan features \\(UI enforcement\\)\n - Circular dependencies\n - Conventional commit format\n\n- State tracking in .claude/.autoworkflow/:\n - phase, task-type, verify-iteration, audit-iteration\n - verify-status, audit-status, plan-approved\n\n- Updated CLAUDE.md files with:\n - Slash commands table\n - Hook files reference\n - Hook integration section\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
|
|
14
|
+
"Bash(git commit:*)"
|
|
14
15
|
]
|
|
15
16
|
}
|
|
16
17
|
}
|
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { existsSync, cpSync, mkdirSync, chmodSync, renameSync } from 'fs';
|
|
3
|
+
import { existsSync, cpSync, mkdirSync, chmodSync, renameSync, unlinkSync } from 'fs';
|
|
4
4
|
import { dirname, join } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
|
|
@@ -101,9 +101,21 @@ function init(options = {}) {
|
|
|
101
101
|
// Required files
|
|
102
102
|
console.log(colors.bold('Required files:'));
|
|
103
103
|
copyFile(join(packageRoot, 'CLAUDE.md'), join(cwd, 'CLAUDE.md'), 'CLAUDE.md');
|
|
104
|
-
copyFile(join(packageRoot, '
|
|
104
|
+
copyFile(join(packageRoot, 'system'), join(cwd, 'system'), 'system/');
|
|
105
105
|
copyFile(join(packageRoot, '.claude'), join(cwd, '.claude'), '.claude/');
|
|
106
106
|
|
|
107
|
+
// Copy instructions folder but remove BLUEPRINT.md (hook will auto-generate it)
|
|
108
|
+
copyFile(join(packageRoot, 'instructions'), join(cwd, 'instructions'), 'instructions/');
|
|
109
|
+
const blueprintPath = join(cwd, 'instructions', 'BLUEPRINT.md');
|
|
110
|
+
if (existsSync(blueprintPath)) {
|
|
111
|
+
try {
|
|
112
|
+
unlinkSync(blueprintPath);
|
|
113
|
+
console.log(` ${colors.cyan('âš')} BLUEPRINT.md removed (will be auto-generated on first run)`);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
// Ignore
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
107
119
|
// Make Claude hooks executable
|
|
108
120
|
if (process.platform !== 'win32' && existsSync(join(cwd, '.claude', 'hooks'))) {
|
|
109
121
|
try {
|
|
@@ -173,11 +185,12 @@ function init(options = {}) {
|
|
|
173
185
|
console.log(`\n${colors.green('â')} ${colors.bold('AutoWorkflow initialized!')}\n`);
|
|
174
186
|
|
|
175
187
|
console.log(`${colors.bold('Next steps:')}`);
|
|
176
|
-
console.log(` 1.
|
|
177
|
-
console.log(` 2.
|
|
178
|
-
console.log(` 3. Claude
|
|
188
|
+
console.log(` 1. Open VS Code with Claude Code extension`);
|
|
189
|
+
console.log(` 2. Send any message - Claude will ${colors.cyan('auto-scan')} your project`);
|
|
190
|
+
console.log(` 3. Claude generates ${colors.cyan('BLUEPRINT.md')} with your features/routes/APIs`);
|
|
191
|
+
console.log(` 4. Review and approve the generated blueprint\n`);
|
|
179
192
|
|
|
180
|
-
console.log(
|
|
193
|
+
console.log(`${colors.dim('Optional: Edit instructions/AI_RULES.md to customize coding standards')}\n`);
|
|
181
194
|
}
|
|
182
195
|
|
|
183
196
|
// Main
|