autoworkflow 3.0.0 → 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.md CHANGED
@@ -1,16 +1,53 @@
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**
4
5
 
5
6
  ## How It Works
6
7
 
7
8
  ```
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)
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
+ └─────────────────────────────────────────────────────────────┘
12
20
  ```
13
21
 
22
+ **Key:** Hooks OUTPUT instructions → Claude READS them → Claude DOES the work
23
+
24
+ ---
25
+
26
+ ## Architecture
27
+
28
+ ```
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.)
32
+ CLAUDE.md (this file) → WORKFLOW SUMMARY
33
+ instructions/ → AI_RULES.md + BLUEPRINT.md
34
+ system/ → DETAILED REFERENCE (gates, loops, triggers, router)
35
+ ```
36
+
37
+ **Priority:** Hooks → settings.json → This file → system/*.md
38
+
39
+ ---
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
+
14
51
  ---
15
52
 
16
53
  ## Workflow
@@ -19,69 +56,102 @@ instructions/ → AI_RULES.md + BLUEPRINT.md (project-specific)
19
56
  ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
20
57
  ```
21
58
 
22
- | Phase | Action |
23
- |-------|--------|
59
+ | Phase | What Claude Does |
60
+ |-------|------------------|
24
61
  | ANALYZE | Read relevant files, check BLUEPRINT.md |
25
62
  | PLAN | Design approach, show suggestions |
26
- | CONFIRM | Wait for user approval |
63
+ | CONFIRM | **Wait for user approval** |
27
64
  | IMPLEMENT | Make changes (after approval only) |
28
- | VERIFY | Run `npm run verify` |
65
+ | VERIFY | Run `npm run verify` - **AUTO-TRIGGERED** |
29
66
  | AUDIT | Run `npm run audit:ui` + `audit:cycles` |
30
- | COMMIT | Conventional commit format |
67
+ | COMMIT | Conventional commit format - **BLOCKED if checks fail** |
31
68
  | UPDATE | Update BLUEPRINT.md if new feature/route/API |
32
69
 
33
70
  ---
34
71
 
72
+ ## Auto-Verification Loop
73
+
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)
79
+
80
+ ```
81
+ EDIT → HOOK RUNS VERIFY → ERRORS? → CLAUDE FIXES → VERIFY AGAIN → ...
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Pre-Commit Gate (7 Checks)
87
+
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)**
101
+
102
+ ---
103
+
35
104
  ## Task Types
36
105
 
37
106
  | Type | Workflow | Audit? |
38
107
  |------|----------|--------|
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 | ANALYZERESPOND | No |
108
+ | feature | Full (all phases) | Yes |
109
+ | fix | Standard (no audit) | No |
110
+ | refactor | With audit | Yes |
111
+ | docs | Simple | No |
112
+ | query | AnalyzeRespond | No |
44
113
 
45
114
  ---
46
115
 
47
- ## Gates (Blocking)
116
+ ## State Tracking
48
117
 
49
- ### 1. Plan Approval Gate
50
- **Before:** IMPLEMENT
51
- **Requires:** User says "yes", "proceed", "approved", etc.
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
52
124
 
53
- ### 2. Verify Gate
54
- **Before:** AUDIT/COMMIT
55
- **Requires:** `npm run verify` passes (0 errors)
125
+ ---
56
126
 
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)
127
+ ## Blocking Rules
62
128
 
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
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`
69
134
 
70
135
  ---
71
136
 
72
- ## Blocking Rules
73
-
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` |
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 |
81
151
 
82
152
  ---
83
153
 
84
- ## Commands
154
+ ## NPM Commands
85
155
 
86
156
  ```bash
87
157
  npm run verify # TypeScript + ESLint
@@ -92,13 +162,39 @@ npm run format # Prettier
92
162
 
93
163
  ---
94
164
 
95
- ## Instructions
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
+
179
+ ## Required Reading
180
+
181
+ | File | Purpose |
182
+ |------|---------|
183
+ | `instructions/AI_RULES.md` | Your coding standards |
184
+ | `instructions/BLUEPRINT.md` | Project specification |
185
+
186
+ If BLUEPRINT.md is missing → Hook triggers AUTO-AUDIT (no permission needed)
187
+
188
+ ---
96
189
 
97
- Read `instructions/AI_RULES.md` for coding standards.
98
- Read `instructions/BLUEPRINT.md` for project specification.
190
+ ## Detailed Reference
99
191
 
100
- If BLUEPRINT.md is missing, the session-check hook will trigger.
101
- Run a project audit and generate it.
192
+ | File | Contains |
193
+ |------|----------|
194
+ | `system/triggers.md` | Event → Hook → Claude action mappings |
195
+ | `system/gates.md` | Blocking checkpoint definitions |
196
+ | `system/loops.md` | Verify/fix cycle definitions |
197
+ | `system/router.md` | Task type classification |
102
198
 
103
199
  ---
104
200
 
@@ -106,12 +202,12 @@ Run a project audit and generate it.
106
202
 
107
203
  **New feature:**
108
204
  ```
109
- Analyze → Plan+Suggest → [approval] → Implement → Verify → Audit → Commit → Update Blueprint
205
+ Analyze → Plan+Suggest → [approval] → Implement → VERIFY(auto) → Audit → Commit(blocked) → Update
110
206
  ```
111
207
 
112
208
  **Bug fix:**
113
209
  ```
114
- Analyze → Plan → [approval] → Implement → Verify → Commit
210
+ Analyze → Plan → [approval] → Implement → VERIFY(auto) → Commit(blocked)
115
211
  ```
116
212
 
117
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 = ['session-check.sh', 'post-edit.sh', 'pre-commit-check.sh'];
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)) {
@@ -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
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoworkflow",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Automated workflow enforcement for Claude Code via hooks and system prompts",
5
5
  "type": "module",
6
6
  "bin": {