autoworkflow 2.2.1 → 3.0.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/.claude/commands/audit.md +7 -0
- package/.claude/hooks/post-edit.sh +21 -0
- package/.claude/hooks/pre-commit-check.sh +60 -0
- package/.claude/hooks/session-check.sh +58 -0
- package/.claude/settings.json +64 -82
- package/.claude/settings.local.json +2 -1
- package/CLAUDE.md +71 -295
- package/README.md +82 -242
- package/bin/cli.js +55 -9
- package/package.json +5 -3
- package/system/triggers.md +34 -12
package/CLAUDE.md
CHANGED
|
@@ -1,344 +1,120 @@
|
|
|
1
|
-
# AutoWorkflow
|
|
1
|
+
# AutoWorkflow
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Automated workflow enforcement via hooks + system prompts.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Session Start - FIRST THING
|
|
5
|
+
## How It Works
|
|
8
6
|
|
|
9
|
-
**Before ANY work, run this check:**
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
1. Check if instructions/BLUEPRINT.md exists
|
|
13
|
-
2. If NO → Run ONE audit → Update BOTH AI_RULES.md & BLUEPRINT.md
|
|
14
|
-
3. If YES → Read both files and proceed
|
|
15
7
|
```
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
Hooks (automatic) → Trigger checks on events
|
|
9
|
+
settings.json → Core instructions (system prompt)
|
|
10
|
+
This file → Workflow details + gates
|
|
11
|
+
instructions/ → AI_RULES.md + BLUEPRINT.md (project-specific)
|
|
19
12
|
```
|
|
20
|
-
⚠️ No BLUEPRINT.md found in this project.
|
|
21
|
-
|
|
22
|
-
I'll run ONE audit to update TWO files:
|
|
23
|
-
|
|
24
|
-
📄 AI_RULES.md → Tech Stack & File Structure (HOW to code)
|
|
25
|
-
📘 BLUEPRINT.md → Features, Routes, APIs (WHAT exists)
|
|
26
13
|
|
|
27
|
-
|
|
28
|
-
```
|
|
14
|
+
---
|
|
29
15
|
|
|
30
|
-
|
|
16
|
+
## Workflow
|
|
31
17
|
|
|
32
18
|
```
|
|
33
|
-
|
|
34
|
-
│ ONE AUDIT SCAN │
|
|
35
|
-
│ │
|
|
36
|
-
│ $ cat package.json → Detect tech stack │
|
|
37
|
-
│ $ find src -type d → Map file structure │
|
|
38
|
-
│ $ ls src/pages/ → Discover routes │
|
|
39
|
-
│ $ ls src/components/ → List components │
|
|
40
|
-
│ $ find src/api/ → Find API endpoints │
|
|
41
|
-
│ $ cat prisma/schema.prisma → Database models │
|
|
42
|
-
│ $ grep -r "fetch\|/api/" → Map connections │
|
|
43
|
-
│ │
|
|
44
|
-
└─────────────────────────┬────────────────────────────────────┘
|
|
45
|
-
│
|
|
46
|
-
┌─────────────┴─────────────┐
|
|
47
|
-
▼ ▼
|
|
48
|
-
┌─────────────────┐ ┌─────────────────┐
|
|
49
|
-
│ AI_RULES.md │ │ BLUEPRINT.md │
|
|
50
|
-
│ (Update) │ │ (Generate) │
|
|
51
|
-
│ │ │ │
|
|
52
|
-
│ ## Tech Stack │ │ ## Features │
|
|
53
|
-
│ - Framework: X │ │ - Feature 1 ✅ │
|
|
54
|
-
│ - Styling: Y │ │ - Feature 2 ⚠️ │
|
|
55
|
-
│ - Database: Z │ │ │
|
|
56
|
-
│ │ │ ## Routes │
|
|
57
|
-
│ ## File Struct │ │ - / → Home │
|
|
58
|
-
│ src/ │ │ - /about → ... │
|
|
59
|
-
│ ├── components │ │ │
|
|
60
|
-
│ ├── pages │ │ ## APIs │
|
|
61
|
-
│ └── ... │ │ - GET /api/x │
|
|
62
|
-
└─────────────────┘ └─────────────────┘
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**This prevents double audit runs - ONE scan updates BOTH files.**
|
|
66
|
-
|
|
67
|
-
### Audit Output Format
|
|
68
|
-
|
|
69
|
-
After scanning, present BOTH updates together:
|
|
70
|
-
|
|
19
|
+
ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
|
|
71
20
|
```
|
|
72
|
-
## 🔍 Audit Complete - Proposed Updates
|
|
73
|
-
|
|
74
|
-
### 📄 AI_RULES.md Updates
|
|
75
21
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
22
|
+
| Phase | Action |
|
|
23
|
+
|-------|--------|
|
|
24
|
+
| ANALYZE | Read relevant files, check BLUEPRINT.md |
|
|
25
|
+
| PLAN | Design approach, show suggestions |
|
|
26
|
+
| CONFIRM | Wait for user approval |
|
|
27
|
+
| IMPLEMENT | Make changes (after approval only) |
|
|
28
|
+
| VERIFY | Run `npm run verify` |
|
|
29
|
+
| AUDIT | Run `npm run audit:ui` + `audit:cycles` |
|
|
30
|
+
| COMMIT | Conventional commit format |
|
|
31
|
+
| UPDATE | Update BLUEPRINT.md if new feature/route/API |
|
|
85
32
|
|
|
86
33
|
---
|
|
87
34
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
**Features Discovered:**
|
|
91
|
-
| Feature | Frontend | Backend | Route | Status |
|
|
92
|
-
|---------|----------|---------|-------|--------|
|
|
93
|
-
| Auth | LoginForm.tsx | /api/auth | /login | ✅ |
|
|
94
|
-
| Dashboard | Dashboard.tsx | /api/stats | /dashboard | ✅ |
|
|
95
|
-
| Settings | ❌ None | /api/settings | ❌ None | ⚠️ ORPHAN |
|
|
35
|
+
## Task Types
|
|
96
36
|
|
|
97
|
-
|
|
98
|
-
|
|
37
|
+
| Type | Workflow | Audit? |
|
|
38
|
+
|------|----------|--------|
|
|
39
|
+
| feature | Full (9 phases) | Yes |
|
|
40
|
+
| fix | ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → COMMIT | No |
|
|
41
|
+
| refactor | ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT | Yes |
|
|
42
|
+
| docs | ANALYZE → IMPLEMENT → COMMIT | No |
|
|
43
|
+
| query | ANALYZE → RESPOND | No |
|
|
99
44
|
|
|
100
45
|
---
|
|
101
46
|
|
|
102
|
-
|
|
103
|
-
- AI_RULES.md → Update Tech Stack & File Structure sections
|
|
104
|
-
- BLUEPRINT.md → Create with discovered features
|
|
47
|
+
## Gates (Blocking)
|
|
105
48
|
|
|
106
|
-
|
|
107
|
-
|
|
49
|
+
### 1. Plan Approval Gate
|
|
50
|
+
**Before:** IMPLEMENT
|
|
51
|
+
**Requires:** User says "yes", "proceed", "approved", etc.
|
|
108
52
|
|
|
109
|
-
|
|
53
|
+
### 2. Verify Gate
|
|
54
|
+
**Before:** AUDIT/COMMIT
|
|
55
|
+
**Requires:** `npm run verify` passes (0 errors)
|
|
110
56
|
|
|
111
|
-
|
|
57
|
+
### 3. Audit Gate
|
|
58
|
+
**Before:** COMMIT (for features/refactors)
|
|
59
|
+
**Requires:**
|
|
60
|
+
- `npm run audit:ui` passes (no orphan features)
|
|
61
|
+
- `npm run audit:cycles` passes (no circular deps)
|
|
112
62
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
└───────────────────────────┬─────────────────────────────────┘
|
|
120
|
-
│
|
|
121
|
-
▼
|
|
122
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
123
|
-
│ system/ (Control Layer) │
|
|
124
|
-
│ │
|
|
125
|
-
│ triggers.md │ loops.md │ gates.md │ router.md │
|
|
126
|
-
│ (events) │ (cycles) │ (blocks) │ (routing) │
|
|
127
|
-
└───────────────────────────┬─────────────────────────────────┘
|
|
128
|
-
│
|
|
129
|
-
▼
|
|
130
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
131
|
-
│ instructions/ (Content Layer) │
|
|
132
|
-
│ │
|
|
133
|
-
│ CLAUDE.md │ AI_RULES.md │ BLUEPRINT.md │
|
|
134
|
-
│ (workflow) │ (standards) │ (project spec) │
|
|
135
|
-
└─────────────────────────────────────────────────────────────┘
|
|
136
|
-
```
|
|
63
|
+
### 4. Pre-Commit Gate
|
|
64
|
+
**Before:** git commit
|
|
65
|
+
**Blocks if:**
|
|
66
|
+
- TODO/FIXME comments in diff
|
|
67
|
+
- console.log statements in diff
|
|
68
|
+
- Invalid commit message format
|
|
137
69
|
|
|
138
70
|
---
|
|
139
71
|
|
|
140
|
-
##
|
|
141
|
-
|
|
142
|
-
When you receive ANY task, you MUST:
|
|
143
|
-
|
|
144
|
-
### 1. Route the Task
|
|
145
|
-
Read `system/router.md` to classify:
|
|
146
|
-
- Is this a feature, fix, refactor, query, etc.?
|
|
147
|
-
- What workflow applies?
|
|
148
|
-
- What gates are required?
|
|
149
|
-
|
|
150
|
-
### 2. Load Control Systems
|
|
151
|
-
- `system/triggers.md` - Event handling
|
|
152
|
-
- `system/loops.md` - Verification cycles
|
|
153
|
-
- `system/gates.md` - Blocking checkpoints
|
|
72
|
+
## Blocking Rules
|
|
154
73
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
74
|
+
| Rule | Description |
|
|
75
|
+
|------|-------------|
|
|
76
|
+
| No orphan features | Backend must have UI |
|
|
77
|
+
| No TODO/FIXME | Complete the work |
|
|
78
|
+
| No console.log | No debug logs |
|
|
79
|
+
| No circular deps | Clean imports |
|
|
80
|
+
| Conventional commits | `type(scope): description` |
|
|
159
81
|
|
|
160
82
|
---
|
|
161
83
|
|
|
162
|
-
##
|
|
163
|
-
|
|
164
|
-
```
|
|
165
|
-
ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
|
|
166
|
-
│ │ │ │ │ │ │ │
|
|
167
|
-
▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼
|
|
168
|
-
Read Design Wait for Write Run npm Check Create Update
|
|
169
|
-
files approach approval code verify orphans commit BLUEPRINT
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Conditional Flows
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
Session Start:
|
|
176
|
-
┌─────────────────────────────────────────────────┐
|
|
177
|
-
│ Check BLUEPRINT.md exists? │
|
|
178
|
-
├─────────────────────────────────────────────────┤
|
|
179
|
-
│ NO → Run /audit project → Generate both files │
|
|
180
|
-
│ YES → Read AI_RULES.md + BLUEPRINT.md → Proceed │
|
|
181
|
-
└─────────────────────────────────────────────────┘
|
|
84
|
+
## Commands
|
|
182
85
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
│ NO → Skip update phase │
|
|
189
|
-
└─────────────────────────────────────────────────┘
|
|
86
|
+
```bash
|
|
87
|
+
npm run verify # TypeScript + ESLint
|
|
88
|
+
npm run audit:ui # Check orphan features
|
|
89
|
+
npm run audit:cycles # Check circular deps
|
|
90
|
+
npm run format # Prettier
|
|
190
91
|
```
|
|
191
92
|
|
|
192
93
|
---
|
|
193
94
|
|
|
194
|
-
##
|
|
195
|
-
|
|
196
|
-
### Blocking Gates
|
|
197
|
-
| Gate | When | Blocks If |
|
|
198
|
-
|------|------|-----------|
|
|
199
|
-
| `plan_approval_gate` | Before implement | User hasn't approved |
|
|
200
|
-
| `verify_gate` | After implement | TypeScript/ESLint errors |
|
|
201
|
-
| `audit_gate` | Before commit (features) | Orphan features or cycles |
|
|
202
|
-
| `pre_commit_gate` | Before commit | TODO/FIXME, console.log, etc. |
|
|
203
|
-
|
|
204
|
-
### Blocking Rules
|
|
205
|
-
- **No orphan features** - Backend MUST have UI
|
|
206
|
-
- **No TODO/FIXME** - Complete the work
|
|
207
|
-
- **No console.log** - No debug logs in code
|
|
208
|
-
- **No circular deps** - Clean architecture
|
|
209
|
-
- **Conventional commits** - type(scope): description
|
|
210
|
-
|
|
211
|
-
---
|
|
95
|
+
## Instructions
|
|
212
96
|
|
|
213
|
-
|
|
97
|
+
Read `instructions/AI_RULES.md` for coding standards.
|
|
98
|
+
Read `instructions/BLUEPRINT.md` for project specification.
|
|
214
99
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
| `/analyze [task]` | Analyze codebase for a task |
|
|
218
|
-
| `/plan [task]` | Create implementation plan |
|
|
219
|
-
| `/build [feature]` | Full workflow for features |
|
|
220
|
-
| `/verify` | Run TypeScript + ESLint |
|
|
221
|
-
| `/fix` | Fix verification errors |
|
|
222
|
-
| `/audit` | Run UI + cycle audits |
|
|
223
|
-
| `/audit project` | Full project scan → update BLUEPRINT.md |
|
|
224
|
-
| `/suggest [task]` | Generate suggestions |
|
|
225
|
-
| `/commit [msg]` | Pre-commit check + commit |
|
|
100
|
+
If BLUEPRINT.md is missing, the session-check hook will trigger.
|
|
101
|
+
Run a project audit and generate it.
|
|
226
102
|
|
|
227
103
|
---
|
|
228
104
|
|
|
229
105
|
## Quick Reference
|
|
230
106
|
|
|
231
|
-
|
|
107
|
+
**New feature:**
|
|
232
108
|
```
|
|
233
|
-
|
|
234
|
-
├── NO → Run /audit project → Update AI_RULES.md + Create BLUEPRINT.md
|
|
235
|
-
└── YES → Read both → Proceed
|
|
109
|
+
Analyze → Plan+Suggest → [approval] → Implement → Verify → Audit → Commit → Update Blueprint
|
|
236
110
|
```
|
|
237
111
|
|
|
238
|
-
|
|
112
|
+
**Bug fix:**
|
|
239
113
|
```
|
|
240
|
-
|
|
241
|
-
→ Runs: ANALYZE → PLAN+SUGGEST → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
|
|
114
|
+
Analyze → Plan → [approval] → Implement → Verify → Commit
|
|
242
115
|
```
|
|
243
116
|
|
|
244
|
-
|
|
245
|
-
```
|
|
246
|
-
/analyze [issue] → /plan → [approval] → implement → /verify → /commit
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### For Questions
|
|
250
|
-
```
|
|
251
|
-
/analyze [question]
|
|
252
|
-
→ Returns information, no implementation
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
---
|
|
256
|
-
|
|
257
|
-
## File Map
|
|
258
|
-
|
|
117
|
+
**Question:**
|
|
259
118
|
```
|
|
260
|
-
|
|
261
|
-
├── CLAUDE.md ← YOU ARE HERE (Entry Point)
|
|
262
|
-
│
|
|
263
|
-
├── system/ ← Control Layer
|
|
264
|
-
│ ├── triggers.md Event → Action mappings
|
|
265
|
-
│ ├── loops.md Repeat-until definitions
|
|
266
|
-
│ ├── gates.md Blocking checkpoints
|
|
267
|
-
│ └── router.md Task type routing
|
|
268
|
-
│
|
|
269
|
-
├── instructions/ ← Content Layer
|
|
270
|
-
│ ├── CLAUDE.md Workflow steps
|
|
271
|
-
│ ├── AI_RULES.md Coding standards
|
|
272
|
-
│ └── BLUEPRINT.md Project specification
|
|
273
|
-
│
|
|
274
|
-
├── scripts/ ← Automation Scripts
|
|
275
|
-
│ ├── setup.sh One-command project setup
|
|
276
|
-
│ ├── autoworkflow.sh CLI orchestrator
|
|
277
|
-
│ ├── run-verification.sh Verification with output
|
|
278
|
-
│ ├── ensure-no-errors.sh Pre-commit check
|
|
279
|
-
│ └── check-ui-enforcement.sh Orphan feature detection
|
|
280
|
-
│
|
|
281
|
-
├── hooks/ ← Git Hooks
|
|
282
|
-
│ ├── pre-commit Blocks bad commits
|
|
283
|
-
│ └── commit-msg Validates commit format
|
|
284
|
-
│
|
|
285
|
-
├── .claude/ ← Claude Code Integration
|
|
286
|
-
│ ├── settings.json Settings + instructions
|
|
287
|
-
│ └── commands/ Slash command definitions
|
|
288
|
-
│ ├── analyze.md
|
|
289
|
-
│ ├── plan.md
|
|
290
|
-
│ ├── build.md
|
|
291
|
-
│ ├── verify.md
|
|
292
|
-
│ ├── fix.md
|
|
293
|
-
│ ├── audit.md
|
|
294
|
-
│ ├── suggest.md
|
|
295
|
-
│ └── commit.md
|
|
296
|
-
│
|
|
297
|
-
├── .vscode/ ← VS Code Integration
|
|
298
|
-
│ ├── settings.json Editor settings
|
|
299
|
-
│ ├── tasks.json Runnable tasks
|
|
300
|
-
│ └── extensions.json Recommended extensions
|
|
301
|
-
│
|
|
302
|
-
├── .prettierrc ← Prettier config
|
|
303
|
-
├── eslint.config.example.js ← ESLint reference
|
|
304
|
-
└── tsconfig.example.json ← TypeScript reference
|
|
119
|
+
Analyze → Respond
|
|
305
120
|
```
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## Enforcement Summary
|
|
310
|
-
|
|
311
|
-
**Claude is the PRIMARY enforcement engine.** These files control behavior:
|
|
312
|
-
|
|
313
|
-
1. **system/triggers.md** - WHEN to act
|
|
314
|
-
2. **system/loops.md** - HOW to repeat until success
|
|
315
|
-
3. **system/gates.md** - WHAT blocks progress
|
|
316
|
-
4. **system/router.md** - WHERE to route tasks
|
|
317
|
-
5. **instructions/CLAUDE.md** - THE workflow to follow
|
|
318
|
-
6. **instructions/AI_RULES.md** - THE standards to meet
|
|
319
|
-
|
|
320
|
-
**Backup enforcement via automation:**
|
|
321
|
-
|
|
322
|
-
7. **hooks/pre-commit** - Blocks commits with errors (git hook)
|
|
323
|
-
8. **hooks/commit-msg** - Validates commit format (git hook)
|
|
324
|
-
9. **scripts/check-ui-enforcement.sh** - Detects orphan features
|
|
325
|
-
10. **scripts/autoworkflow.sh** - CLI for manual workflow runs
|
|
326
|
-
|
|
327
|
-
Claude follows the instructions. Hooks catch anything that slips through.
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## Start Here
|
|
332
|
-
|
|
333
|
-
For every task:
|
|
334
|
-
1. Read this file (done)
|
|
335
|
-
2. Check if `instructions/BLUEPRINT.md` exists
|
|
336
|
-
- If NO → Run `/audit project` first
|
|
337
|
-
- If YES → Read it and proceed
|
|
338
|
-
3. Read `system/router.md` to classify task
|
|
339
|
-
4. Follow the appropriate workflow
|
|
340
|
-
5. Never skip gates
|
|
341
|
-
6. Complete features fully
|
|
342
|
-
7. Update BLUEPRINT.md after adding features
|
|
343
|
-
|
|
344
|
-
**VERIFY ALWAYS. CHECK BLUEPRINT. NO ORPHANS. ONE AUDIT → TWO FILES.**
|