autoworkflow 3.0.1 → 3.1.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/hooks/audit-runner.sh +191 -0
- package/.claude/hooks/blueprint-generator.sh +253 -0
- package/.claude/hooks/phase-transition.sh +279 -0
- package/.claude/hooks/post-edit.sh +218 -14
- package/.claude/hooks/pre-commit-check.sh +223 -47
- package/.claude/hooks/pre-tool-router.sh +67 -0
- package/.claude/hooks/session-check.sh +328 -41
- package/.claude/settings.json +60 -15
- package/.claude/settings.local.json +5 -1
- package/CLAUDE.md +119 -47
- package/bin/cli.js +9 -1
- package/instructions/CLAUDE.md +22 -0
- package/package.json +1 -1
- package/system/triggers.md +243 -235
package/CLAUDE.md
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
# AutoWorkflow
|
|
2
2
|
|
|
3
3
|
> Automated workflow enforcement via hooks + system prompts.
|
|
4
|
+
> **All automation is hook-driven → Claude executes the actual work**
|
|
5
|
+
|
|
6
|
+
## How It Works
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
10
|
+
│ USER MESSAGE │
|
|
11
|
+
│ ↓ │
|
|
12
|
+
│ HOOK TRIGGERS (shell scripts) │
|
|
13
|
+
│ ↓ │
|
|
14
|
+
│ HOOK OUTPUT (instructions/prompts for Claude) │
|
|
15
|
+
│ ↓ │
|
|
16
|
+
│ CLAUDE READS OUTPUT + ACTS │
|
|
17
|
+
│ ↓ │
|
|
18
|
+
│ RESPONSE TO USER │
|
|
19
|
+
└─────────────────────────────────────────────────────────────┘
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Key:** Hooks OUTPUT instructions → Claude READS them → Claude DOES the work
|
|
23
|
+
|
|
24
|
+
---
|
|
4
25
|
|
|
5
26
|
## Architecture
|
|
6
27
|
|
|
7
28
|
```
|
|
8
|
-
.claude/hooks/ → AUTO-TRIGGERS (
|
|
9
|
-
.claude/settings.json →
|
|
29
|
+
.claude/hooks/ → AUTO-TRIGGERS (output prompts to Claude)
|
|
30
|
+
.claude/settings.json → HOOK CONFIG + SYSTEM INSTRUCTIONS
|
|
31
|
+
.claude/.autoworkflow/ → STATE FILES (phase, iterations, etc.)
|
|
10
32
|
CLAUDE.md (this file) → WORKFLOW SUMMARY
|
|
11
33
|
instructions/ → AI_RULES.md + BLUEPRINT.md
|
|
12
34
|
system/ → DETAILED REFERENCE (gates, loops, triggers, router)
|
|
@@ -16,83 +38,120 @@ system/ → DETAILED REFERENCE (gates, loops, triggers, router
|
|
|
16
38
|
|
|
17
39
|
---
|
|
18
40
|
|
|
41
|
+
## Auto-Triggers (Hooks)
|
|
42
|
+
|
|
43
|
+
| Event | Hook | Output to Claude |
|
|
44
|
+
|-------|------|------------------|
|
|
45
|
+
| User message | `session-check.sh` | "BLUEPRINT missing - run audit NOW" |
|
|
46
|
+
| After Write/Edit | `post-edit.sh` | Runs `npm run verify`, shows errors |
|
|
47
|
+
| Before git commit | `pre-tool-router.sh` | Runs all 7 gate checks, BLOCKS if fail |
|
|
48
|
+
|
|
49
|
+
**Hooks don't do the work - they tell Claude what to do!**
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
19
53
|
## Workflow
|
|
20
54
|
|
|
21
55
|
```
|
|
22
56
|
ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
|
|
23
57
|
```
|
|
24
58
|
|
|
25
|
-
| Phase |
|
|
26
|
-
|
|
59
|
+
| Phase | What Claude Does |
|
|
60
|
+
|-------|------------------|
|
|
27
61
|
| ANALYZE | Read relevant files, check BLUEPRINT.md |
|
|
28
62
|
| PLAN | Design approach, show suggestions |
|
|
29
63
|
| CONFIRM | **Wait for user approval** |
|
|
30
64
|
| IMPLEMENT | Make changes (after approval only) |
|
|
31
|
-
| VERIFY | Run `npm run verify` |
|
|
65
|
+
| VERIFY | Run `npm run verify` - **AUTO-TRIGGERED** |
|
|
32
66
|
| AUDIT | Run `npm run audit:ui` + `audit:cycles` |
|
|
33
|
-
| COMMIT | Conventional commit format |
|
|
67
|
+
| COMMIT | Conventional commit format - **BLOCKED if checks fail** |
|
|
34
68
|
| UPDATE | Update BLUEPRINT.md if new feature/route/API |
|
|
35
69
|
|
|
36
70
|
---
|
|
37
71
|
|
|
38
|
-
##
|
|
72
|
+
## Auto-Verification Loop
|
|
39
73
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
| docs | ANALYZE → IMPLEMENT → COMMIT | No |
|
|
46
|
-
| query | ANALYZE → RESPOND | No |
|
|
74
|
+
After EVERY code edit, `post-edit.sh` automatically:
|
|
75
|
+
1. Runs `npm run verify`
|
|
76
|
+
2. Shows errors to Claude
|
|
77
|
+
3. Claude fixes them
|
|
78
|
+
4. Repeats until passing (max 10 iterations)
|
|
47
79
|
|
|
48
|
-
|
|
80
|
+
```
|
|
81
|
+
EDIT → HOOK RUNS VERIFY → ERRORS? → CLAUDE FIXES → VERIFY AGAIN → ...
|
|
82
|
+
```
|
|
49
83
|
|
|
50
84
|
---
|
|
51
85
|
|
|
52
|
-
##
|
|
86
|
+
## Pre-Commit Gate (7 Checks)
|
|
53
87
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
|
57
|
-
|
|
58
|
-
|
|
|
59
|
-
|
|
|
88
|
+
Before `git commit`, `pre-commit-check.sh` runs:
|
|
89
|
+
|
|
90
|
+
| Check | Pass Condition |
|
|
91
|
+
|-------|----------------|
|
|
92
|
+
| TypeScript | 0 errors |
|
|
93
|
+
| ESLint | 0 warnings |
|
|
94
|
+
| TODO/FIXME | None in staged files |
|
|
95
|
+
| console.log | None in staged files |
|
|
96
|
+
| UI Enforcement | No orphan features |
|
|
97
|
+
| Circular Deps | No import cycles |
|
|
98
|
+
| Commit Format | `type(scope): description` |
|
|
99
|
+
|
|
100
|
+
**If ANY check fails → Commit is BLOCKED (exit 1)**
|
|
60
101
|
|
|
61
102
|
---
|
|
62
103
|
|
|
63
|
-
##
|
|
104
|
+
## Task Types
|
|
64
105
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
106
|
+
| Type | Workflow | Audit? |
|
|
107
|
+
|------|----------|--------|
|
|
108
|
+
| feature | Full (all phases) | Yes |
|
|
109
|
+
| fix | Standard (no audit) | No |
|
|
110
|
+
| refactor | With audit | Yes |
|
|
111
|
+
| docs | Simple | No |
|
|
112
|
+
| query | Analyze → Respond | No |
|
|
70
113
|
|
|
71
114
|
---
|
|
72
115
|
|
|
73
|
-
##
|
|
74
|
-
|
|
75
|
-
| Event | Hook | Action |
|
|
76
|
-
|-------|------|--------|
|
|
77
|
-
| User message | `session-check.sh` | Check BLUEPRINT.md exists |
|
|
78
|
-
| After Write/Edit | `post-edit.sh` | Remind to verify |
|
|
79
|
-
| Before git commit | `pre-commit-check.sh` | Block bad commits |
|
|
116
|
+
## State Tracking
|
|
80
117
|
|
|
81
|
-
|
|
118
|
+
All state stored in `.claude/.autoworkflow/`:
|
|
119
|
+
- `phase` - Current workflow phase
|
|
120
|
+
- `task-type` - Classified task type
|
|
121
|
+
- `verify-iteration` - Loop count (max 10)
|
|
122
|
+
- `verify-status` - PASSED/FAILED
|
|
123
|
+
- `plan-approved` - User approval status
|
|
82
124
|
|
|
83
125
|
---
|
|
84
126
|
|
|
85
|
-
##
|
|
127
|
+
## Blocking Rules
|
|
86
128
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
129
|
+
- **No orphan features** - Backend must have UI
|
|
130
|
+
- **No TODO/FIXME** - Complete the work
|
|
131
|
+
- **No console.log** - No debug logs
|
|
132
|
+
- **No circular deps** - Clean imports
|
|
133
|
+
- **Conventional commits** - `type(scope): description`
|
|
134
|
+
|
|
135
|
+
---
|
|
90
136
|
|
|
91
|
-
|
|
137
|
+
## Slash Commands
|
|
138
|
+
|
|
139
|
+
| Command | Purpose |
|
|
140
|
+
|---------|---------|
|
|
141
|
+
| `/analyze [topic]` | Analyze codebase for a task |
|
|
142
|
+
| `/plan [task]` | Create implementation plan |
|
|
143
|
+
| `/verify` | Run TypeScript + ESLint |
|
|
144
|
+
| `/audit` | Run UI + cycle audits |
|
|
145
|
+
| `/audit project` | Full project scan → generate BLUEPRINT.md |
|
|
146
|
+
| `/commit [msg]` | Pre-commit gate + commit |
|
|
147
|
+
| `/init` | Set up AutoWorkflow files |
|
|
148
|
+
| `/fix` | Fix verification errors |
|
|
149
|
+
| `/suggest` | Show suggestions for current task |
|
|
150
|
+
| `/build` | Build a feature end-to-end |
|
|
92
151
|
|
|
93
152
|
---
|
|
94
153
|
|
|
95
|
-
## Commands
|
|
154
|
+
## NPM Commands
|
|
96
155
|
|
|
97
156
|
```bash
|
|
98
157
|
npm run verify # TypeScript + ESLint
|
|
@@ -103,6 +162,20 @@ npm run format # Prettier
|
|
|
103
162
|
|
|
104
163
|
---
|
|
105
164
|
|
|
165
|
+
## Hook Files
|
|
166
|
+
|
|
167
|
+
| Hook | Trigger Event | Purpose |
|
|
168
|
+
|------|---------------|---------|
|
|
169
|
+
| `session-check.sh` | UserPromptSubmit | Init, blueprint check, task classify |
|
|
170
|
+
| `post-edit.sh` | PostToolUse (Write\|Edit) | Auto-verify with loop tracking |
|
|
171
|
+
| `pre-tool-router.sh` | PreToolUse (Bash) | Route to appropriate check |
|
|
172
|
+
| `pre-commit-check.sh` | Before git commit | All 7 gate checks, BLOCKS |
|
|
173
|
+
| `phase-transition.sh` | Manual call | State management |
|
|
174
|
+
| `audit-runner.sh` | Manual call | Run UI + cycle audits |
|
|
175
|
+
| `blueprint-generator.sh` | Manual call | Scan project |
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
106
179
|
## Required Reading
|
|
107
180
|
|
|
108
181
|
| File | Purpose |
|
|
@@ -110,7 +183,7 @@ npm run format # Prettier
|
|
|
110
183
|
| `instructions/AI_RULES.md` | Your coding standards |
|
|
111
184
|
| `instructions/BLUEPRINT.md` | Project specification |
|
|
112
185
|
|
|
113
|
-
If BLUEPRINT.md is missing
|
|
186
|
+
If BLUEPRINT.md is missing → Hook triggers AUTO-AUDIT (no permission needed)
|
|
114
187
|
|
|
115
188
|
---
|
|
116
189
|
|
|
@@ -118,11 +191,10 @@ If BLUEPRINT.md is missing, the session-check hook will trigger an automatic aud
|
|
|
118
191
|
|
|
119
192
|
| File | Contains |
|
|
120
193
|
|------|----------|
|
|
121
|
-
| `system/triggers.md` | Event →
|
|
194
|
+
| `system/triggers.md` | Event → Hook → Claude action mappings |
|
|
122
195
|
| `system/gates.md` | Blocking checkpoint definitions |
|
|
123
196
|
| `system/loops.md` | Verify/fix cycle definitions |
|
|
124
197
|
| `system/router.md` | Task type classification |
|
|
125
|
-
| `instructions/CLAUDE.md` | Full 9-phase workflow details |
|
|
126
198
|
|
|
127
199
|
---
|
|
128
200
|
|
|
@@ -130,12 +202,12 @@ If BLUEPRINT.md is missing, the session-check hook will trigger an automatic aud
|
|
|
130
202
|
|
|
131
203
|
**New feature:**
|
|
132
204
|
```
|
|
133
|
-
Analyze → Plan+Suggest → [approval] → Implement →
|
|
205
|
+
Analyze → Plan+Suggest → [approval] → Implement → VERIFY(auto) → Audit → Commit(blocked) → Update
|
|
134
206
|
```
|
|
135
207
|
|
|
136
208
|
**Bug fix:**
|
|
137
209
|
```
|
|
138
|
-
Analyze → Plan → [approval] → Implement →
|
|
210
|
+
Analyze → Plan → [approval] → Implement → VERIFY(auto) → Commit(blocked)
|
|
139
211
|
```
|
|
140
212
|
|
|
141
213
|
**Question:**
|
package/bin/cli.js
CHANGED
|
@@ -107,7 +107,15 @@ function init(options = {}) {
|
|
|
107
107
|
// Make Claude hooks executable
|
|
108
108
|
if (process.platform !== 'win32' && existsSync(join(cwd, '.claude', 'hooks'))) {
|
|
109
109
|
try {
|
|
110
|
-
const hookFiles = [
|
|
110
|
+
const hookFiles = [
|
|
111
|
+
'session-check.sh',
|
|
112
|
+
'post-edit.sh',
|
|
113
|
+
'pre-commit-check.sh',
|
|
114
|
+
'pre-tool-router.sh',
|
|
115
|
+
'phase-transition.sh',
|
|
116
|
+
'audit-runner.sh',
|
|
117
|
+
'blueprint-generator.sh'
|
|
118
|
+
];
|
|
111
119
|
hookFiles.forEach(hook => {
|
|
112
120
|
const hookPath = join(cwd, '.claude', 'hooks', hook);
|
|
113
121
|
if (existsSync(hookPath)) {
|
package/instructions/CLAUDE.md
CHANGED
|
@@ -5,6 +5,28 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## Hook Integration
|
|
9
|
+
|
|
10
|
+
Hooks automatically trigger workflow phases:
|
|
11
|
+
|
|
12
|
+
| Hook | Triggers On | Phase Triggered |
|
|
13
|
+
|------|-------------|-----------------|
|
|
14
|
+
| `session-check.sh` | Every user message | ANALYZE (init, blueprint check) |
|
|
15
|
+
| `post-edit.sh` | After Write/Edit | VERIFY (auto-runs npm run verify) |
|
|
16
|
+
| `pre-commit-check.sh` | Before git commit | COMMIT gate (blocks if fails) |
|
|
17
|
+
|
|
18
|
+
**State tracked in:** `.claude/.autoworkflow/`
|
|
19
|
+
|
|
20
|
+
| File | Purpose | Max |
|
|
21
|
+
|------|---------|-----|
|
|
22
|
+
| `phase` | Current workflow phase | - |
|
|
23
|
+
| `task-type` | Classified task type | - |
|
|
24
|
+
| `verify-iteration` | Verify loop count | 10 |
|
|
25
|
+
| `audit-iteration` | Audit loop count | 5 |
|
|
26
|
+
| `plan-approved` | User approval status | - |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
8
30
|
## Workflow Phases
|
|
9
31
|
|
|
10
32
|
```
|