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/README.md
CHANGED
|
@@ -1,91 +1,53 @@
|
|
|
1
|
-
# AutoWorkflow
|
|
1
|
+
# AutoWorkflow
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Automated workflow enforcement for Claude Code via hooks and system prompts.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
When you use Claude Code with AutoWorkflow, hooks automatically trigger checks and Claude follows a structured workflow for all coding tasks.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
-
### One Command Setup (Recommended)
|
|
12
|
-
|
|
13
11
|
```bash
|
|
14
12
|
npx autoworkflow init
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
Options:
|
|
18
16
|
- `npx autoworkflow init` - Required + recommended files
|
|
19
17
|
- `npx autoworkflow init --all` - Include .vscode and config templates
|
|
20
18
|
- `npx autoworkflow init --minimal` - Required files only
|
|
21
19
|
|
|
22
|
-
### Or Install as Dependency
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm install autoworkflow
|
|
26
|
-
npx autoworkflow init
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Or copy manually:**
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Copy all workflow files
|
|
33
|
-
cp -r node_modules/autoworkflow/CLAUDE.md .
|
|
34
|
-
cp -r node_modules/autoworkflow/system ./system
|
|
35
|
-
cp -r node_modules/autoworkflow/instructions ./instructions
|
|
36
|
-
cp -r node_modules/autoworkflow/.claude ./.claude
|
|
37
|
-
cp -r node_modules/autoworkflow/scripts ./scripts
|
|
38
|
-
cp -r node_modules/autoworkflow/hooks ./hooks
|
|
39
|
-
|
|
40
|
-
# Optional: Copy VS Code settings
|
|
41
|
-
cp -r node_modules/autoworkflow/.vscode ./.vscode
|
|
42
|
-
|
|
43
|
-
# Optional: Copy config examples
|
|
44
|
-
cp node_modules/autoworkflow/.prettierrc .
|
|
45
|
-
cp node_modules/autoworkflow/eslint.config.example.js ./eslint.config.js
|
|
46
|
-
cp node_modules/autoworkflow/tsconfig.example.json ./tsconfig.json
|
|
47
|
-
|
|
48
|
-
# Setup git hooks
|
|
49
|
-
npm run setup:hooks
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Manual Installation
|
|
53
|
-
|
|
54
|
-
Clone or download this repository and copy the files to your project.
|
|
55
|
-
|
|
56
20
|
---
|
|
57
21
|
|
|
58
22
|
## How It Works
|
|
59
23
|
|
|
60
24
|
```
|
|
61
25
|
┌─────────────────────────────────────────────────────────────┐
|
|
62
|
-
│
|
|
63
|
-
│ Loaded automatically by Claude Code │
|
|
64
|
-
└───────────────────────────┬─────────────────────────────────┘
|
|
65
|
-
│
|
|
66
|
-
▼
|
|
67
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
68
|
-
│ system/ (Control Layer) │
|
|
26
|
+
│ HOOKS (Automatic) │
|
|
69
27
|
│ │
|
|
70
|
-
│
|
|
71
|
-
│
|
|
72
|
-
│
|
|
73
|
-
|
|
28
|
+
│ UserPromptSubmit → session-check.sh │
|
|
29
|
+
│ PostToolUse → post-edit.sh (after Write/Edit) │
|
|
30
|
+
│ PreToolUse → pre-commit-check.sh (before git) │
|
|
31
|
+
│ │
|
|
32
|
+
│ Hooks output messages that Claude sees as instructions │
|
|
33
|
+
└─────────────────────────────────────────────────────────────┘
|
|
74
34
|
│
|
|
75
35
|
▼
|
|
76
36
|
┌─────────────────────────────────────────────────────────────┐
|
|
77
|
-
│
|
|
37
|
+
│ settings.json (System Prompt) │
|
|
78
38
|
│ │
|
|
79
|
-
│
|
|
80
|
-
│
|
|
81
|
-
|
|
39
|
+
│ "instructions": [ │
|
|
40
|
+
│ "SESSION START: If BLUEPRINT.md missing, scan codebase" │
|
|
41
|
+
│ "AFTER CODE CHANGES: Run npm run verify" │
|
|
42
|
+
│ "BEFORE COMMIT: Block if TODO/console.log found" │
|
|
43
|
+
│ ] │
|
|
44
|
+
└─────────────────────────────────────────────────────────────┘
|
|
82
45
|
│
|
|
83
46
|
▼
|
|
84
47
|
┌─────────────────────────────────────────────────────────────┐
|
|
85
|
-
│
|
|
48
|
+
│ CLAUDE.md + instructions/ │
|
|
86
49
|
│ │
|
|
87
|
-
│
|
|
88
|
-
│ Automation │ Git hooks │ Verification │
|
|
50
|
+
│ Workflow details, gates, task types, coding standards │
|
|
89
51
|
└─────────────────────────────────────────────────────────────┘
|
|
90
52
|
```
|
|
91
53
|
|
|
@@ -93,222 +55,117 @@ Clone or download this repository and copy the files to your project.
|
|
|
93
55
|
|
|
94
56
|
## The Workflow
|
|
95
57
|
|
|
96
|
-
When you ask Claude to do something, it follows this 9-phase workflow:
|
|
97
|
-
|
|
98
58
|
```
|
|
99
|
-
ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY →
|
|
59
|
+
ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE
|
|
100
60
|
```
|
|
101
61
|
|
|
102
|
-
| Phase | What
|
|
103
|
-
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
| **UPDATE** | Updates BLUEPRINT.md if new feature/route/API added |
|
|
113
|
-
|
|
114
|
-
### Session Start
|
|
115
|
-
|
|
116
|
-
At the start of every session, Claude:
|
|
117
|
-
1. Checks if `instructions/BLUEPRINT.md` exists
|
|
118
|
-
2. If missing → Runs `/audit project` to generate it
|
|
119
|
-
3. If exists → Reads AI_RULES.md + BLUEPRINT.md and proceeds
|
|
62
|
+
| Phase | What Happens |
|
|
63
|
+
|-------|--------------|
|
|
64
|
+
| ANALYZE | Read relevant files, check BLUEPRINT.md |
|
|
65
|
+
| PLAN | Design approach, show suggestions |
|
|
66
|
+
| CONFIRM | Wait for user approval |
|
|
67
|
+
| IMPLEMENT | Make changes (after approval only) |
|
|
68
|
+
| VERIFY | Run `npm run verify` (auto-triggered by hook) |
|
|
69
|
+
| AUDIT | Check orphan features + circular deps |
|
|
70
|
+
| COMMIT | Conventional commit format |
|
|
71
|
+
| UPDATE | Update BLUEPRINT.md if needed |
|
|
120
72
|
|
|
121
73
|
---
|
|
122
74
|
|
|
123
|
-
##
|
|
75
|
+
## Auto-Triggers (Hooks)
|
|
124
76
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
|
128
|
-
|
|
129
|
-
| `
|
|
130
|
-
| `verify_gate` | TypeScript or ESLint errors exist |
|
|
131
|
-
| `audit_gate` | Orphan features or circular dependencies |
|
|
132
|
-
| `pre_commit_gate` | TODO/FIXME, console.log, bad commit format |
|
|
77
|
+
| Hook | Trigger | Action |
|
|
78
|
+
|------|---------|--------|
|
|
79
|
+
| `session-check.sh` | Every user message | Check if BLUEPRINT.md exists, prompt audit if missing |
|
|
80
|
+
| `post-edit.sh` | After Write/Edit | Remind to run verification |
|
|
81
|
+
| `pre-commit-check.sh` | Before git commit | Block if TODO/FIXME/console.log found |
|
|
133
82
|
|
|
134
83
|
---
|
|
135
84
|
|
|
136
|
-
##
|
|
85
|
+
## Blocking Gates
|
|
137
86
|
|
|
138
|
-
|
|
|
139
|
-
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
| `/verify` | Run TypeScript + ESLint |
|
|
145
|
-
| `/fix` | Fix verification errors |
|
|
146
|
-
| `/audit` | Run UI + cycle audits |
|
|
147
|
-
| `/audit project` | Full project scan → generates BLUEPRINT.md |
|
|
148
|
-
| `/suggest [task]` | Generate suggestions |
|
|
149
|
-
| `/commit [msg]` | Pre-commit check + commit |
|
|
87
|
+
| Gate | Blocks If |
|
|
88
|
+
|------|-----------|
|
|
89
|
+
| Plan Approval | User hasn't approved the plan |
|
|
90
|
+
| Verify | TypeScript or ESLint errors exist |
|
|
91
|
+
| Audit | Orphan features or circular dependencies |
|
|
92
|
+
| Pre-Commit | TODO/FIXME, console.log, bad commit format |
|
|
150
93
|
|
|
151
94
|
---
|
|
152
95
|
|
|
153
|
-
##
|
|
154
|
-
|
|
155
|
-
Claude enforces these automatically:
|
|
96
|
+
## File Structure
|
|
156
97
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
98
|
+
```
|
|
99
|
+
project/
|
|
100
|
+
├── CLAUDE.md # Workflow + gates (auto-read)
|
|
101
|
+
│
|
|
102
|
+
├── .claude/
|
|
103
|
+
│ ├── settings.json # System prompt + hooks config
|
|
104
|
+
│ ├── hooks/ # Auto-trigger scripts
|
|
105
|
+
│ │ ├── session-check.sh
|
|
106
|
+
│ │ ├── post-edit.sh
|
|
107
|
+
│ │ └── pre-commit-check.sh
|
|
108
|
+
│ └── commands/ # Slash commands
|
|
109
|
+
│
|
|
110
|
+
├── instructions/
|
|
111
|
+
│ ├── AI_RULES.md # Your coding standards
|
|
112
|
+
│ └── BLUEPRINT.md # Project spec (auto-generated)
|
|
113
|
+
│
|
|
114
|
+
├── scripts/ # Automation scripts
|
|
115
|
+
├── hooks/ # Git hooks (backup enforcement)
|
|
116
|
+
└── .vscode/ # VS Code settings (optional)
|
|
117
|
+
```
|
|
162
118
|
|
|
163
119
|
---
|
|
164
120
|
|
|
165
|
-
##
|
|
121
|
+
## Commands
|
|
166
122
|
|
|
167
123
|
### Verification
|
|
168
124
|
```bash
|
|
169
125
|
npm run verify # TypeScript + ESLint
|
|
170
126
|
npm run typecheck # TypeScript only
|
|
171
127
|
npm run lint # ESLint only
|
|
172
|
-
npm run format # Prettier format
|
|
173
128
|
```
|
|
174
129
|
|
|
175
130
|
### Audits
|
|
176
131
|
```bash
|
|
177
|
-
npm run audit:ui # Check orphan features
|
|
178
|
-
npm run audit:cycles # Check circular deps
|
|
132
|
+
npm run audit:ui # Check orphan features
|
|
133
|
+
npm run audit:cycles # Check circular deps
|
|
179
134
|
npm run audit:all # Run all audits
|
|
180
135
|
```
|
|
181
136
|
|
|
182
|
-
###
|
|
183
|
-
|
|
184
|
-
npm run dyad:status # Show workflow status
|
|
185
|
-
npm run dyad:verify # Run verification
|
|
186
|
-
npm run dyad:commit # Commit with checks
|
|
187
|
-
npm run dyad:full # Full workflow
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Setup
|
|
191
|
-
```bash
|
|
192
|
-
npm run setup:hooks # Install git hooks
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## File Structure
|
|
198
|
-
|
|
199
|
-
```
|
|
200
|
-
autoworkflow/
|
|
201
|
-
├── CLAUDE.md # Entry point (Claude reads this first)
|
|
202
|
-
│
|
|
203
|
-
├── system/ # Control Layer
|
|
204
|
-
│ ├── triggers.md # Event → Action mappings
|
|
205
|
-
│ ├── loops.md # Verify/fix cycle definitions
|
|
206
|
-
│ ├── gates.md # Blocking checkpoints
|
|
207
|
-
│ └── router.md # Task type routing
|
|
208
|
-
│
|
|
209
|
-
├── instructions/ # Content Layer
|
|
210
|
-
│ ├── CLAUDE.md # Workflow steps (9 phases)
|
|
211
|
-
│ ├── AI_RULES.md # Coding standards
|
|
212
|
-
│ └── BLUEPRINT.md # Project specification
|
|
213
|
-
│
|
|
214
|
-
├── .claude/ # Claude Code Integration
|
|
215
|
-
│ ├── settings.json # Settings + hard rules
|
|
216
|
-
│ └── commands/ # Slash command definitions
|
|
217
|
-
│ ├── init.md
|
|
218
|
-
│ ├── analyze.md
|
|
219
|
-
│ ├── plan.md
|
|
220
|
-
│ ├── build.md
|
|
221
|
-
│ ├── verify.md
|
|
222
|
-
│ ├── fix.md
|
|
223
|
-
│ ├── audit.md
|
|
224
|
-
│ ├── suggest.md
|
|
225
|
-
│ └── commit.md
|
|
226
|
-
│
|
|
227
|
-
├── scripts/ # Automation Scripts
|
|
228
|
-
│ ├── setup.sh # Initial setup
|
|
229
|
-
│ ├── autoworkflow.sh # Workflow automation
|
|
230
|
-
│ ├── check-ui-enforcement.sh
|
|
231
|
-
│ ├── run-verification.sh
|
|
232
|
-
│ └── ensure-no-errors.sh
|
|
233
|
-
│
|
|
234
|
-
├── hooks/ # Git Hooks (backup enforcement)
|
|
235
|
-
│ ├── pre-commit # Blocks bad commits
|
|
236
|
-
│ └── commit-msg # Validates commit messages
|
|
237
|
-
│
|
|
238
|
-
├── .vscode/ # VS Code Integration (optional)
|
|
239
|
-
│ ├── settings.json # Editor settings
|
|
240
|
-
│ ├── tasks.json # Runnable tasks
|
|
241
|
-
│ └── extensions.json # Recommended extensions
|
|
242
|
-
│
|
|
243
|
-
├── .prettierrc # Prettier config
|
|
244
|
-
├── eslint.config.example.js # ESLint config template
|
|
245
|
-
└── tsconfig.example.json # TypeScript config template
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## Why This Approach?
|
|
251
|
-
|
|
252
|
-
### Dual Enforcement Strategy
|
|
253
|
-
|
|
254
|
-
**Primary: Claude as Enforcement Engine**
|
|
255
|
-
- Claude reads instructions from system prompts
|
|
256
|
-
- Claude follows the 9-phase workflow
|
|
257
|
-
- Claude enforces rules proactively as it works
|
|
258
|
-
- Claude explains what's happening
|
|
259
|
-
|
|
260
|
-
**Backup: Scripts & Git Hooks**
|
|
261
|
-
- Git hooks catch anything Claude misses
|
|
262
|
-
- Scripts automate verification
|
|
263
|
-
- Pre-commit blocks bad code from reaching the repo
|
|
264
|
-
|
|
265
|
-
### Benefits
|
|
266
|
-
|
|
267
|
-
| Feature | Benefit |
|
|
137
|
+
### Slash Commands
|
|
138
|
+
| Command | Purpose |
|
|
268
139
|
|---------|---------|
|
|
269
|
-
|
|
|
270
|
-
|
|
|
271
|
-
|
|
|
272
|
-
|
|
|
273
|
-
|
|
|
274
|
-
|
|
|
275
|
-
|
|
|
140
|
+
| `/analyze [task]` | Analyze codebase |
|
|
141
|
+
| `/plan [task]` | Create implementation plan |
|
|
142
|
+
| `/build [feature]` | Full workflow |
|
|
143
|
+
| `/verify` | Run verification |
|
|
144
|
+
| `/audit` | Run audits |
|
|
145
|
+
| `/audit project` | Full scan → generate BLUEPRINT.md |
|
|
146
|
+
| `/commit` | Pre-commit check + commit |
|
|
276
147
|
|
|
277
148
|
---
|
|
278
149
|
|
|
279
150
|
## Customization
|
|
280
151
|
|
|
281
|
-
###
|
|
152
|
+
### Your Coding Standards
|
|
282
153
|
Edit `instructions/AI_RULES.md`:
|
|
283
154
|
```markdown
|
|
284
155
|
## ALWAYS
|
|
285
156
|
- Use TypeScript strict mode
|
|
286
157
|
- Handle all error cases
|
|
287
|
-
- Add loading states for async
|
|
288
158
|
|
|
289
159
|
## NEVER
|
|
290
160
|
- Use `any` type
|
|
291
161
|
- Leave console.logs
|
|
292
|
-
- Skip error handling
|
|
293
162
|
```
|
|
294
163
|
|
|
295
|
-
###
|
|
296
|
-
Edit
|
|
297
|
-
```markdown
|
|
298
|
-
## Features
|
|
299
|
-
- [ ] User authentication
|
|
300
|
-
- [ ] Dashboard page
|
|
301
|
-
- [ ] Settings panel
|
|
302
|
-
|
|
303
|
-
## Data Model
|
|
304
|
-
User: id, email, name, role
|
|
305
|
-
```
|
|
164
|
+
### Adjust Gates
|
|
165
|
+
Edit `.claude/settings.json` gates section.
|
|
306
166
|
|
|
307
|
-
###
|
|
308
|
-
Edit
|
|
309
|
-
|
|
310
|
-
### Adjusting Loops
|
|
311
|
-
Edit `system/loops.md` to change retry behavior.
|
|
167
|
+
### Modify Hooks
|
|
168
|
+
Edit files in `.claude/hooks/` to change auto-trigger behavior.
|
|
312
169
|
|
|
313
170
|
---
|
|
314
171
|
|
|
@@ -320,23 +177,6 @@ Edit `system/loops.md` to change retry behavior.
|
|
|
320
177
|
|
|
321
178
|
---
|
|
322
179
|
|
|
323
|
-
## What Gets Copied
|
|
324
|
-
|
|
325
|
-
When you install via npm, these files are available to copy:
|
|
326
|
-
|
|
327
|
-
| Category | Files | Required? |
|
|
328
|
-
|----------|-------|-----------|
|
|
329
|
-
| Entry point | `CLAUDE.md` | ✅ Yes |
|
|
330
|
-
| Control layer | `system/` | ✅ Yes |
|
|
331
|
-
| Content layer | `instructions/` | ✅ Yes |
|
|
332
|
-
| Claude integration | `.claude/` | ✅ Yes |
|
|
333
|
-
| Automation | `scripts/` | Recommended |
|
|
334
|
-
| Git hooks | `hooks/` | Recommended |
|
|
335
|
-
| VS Code | `.vscode/` | Optional |
|
|
336
|
-
| Configs | `.prettierrc`, `*.example.*` | Optional |
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
180
|
## License
|
|
341
181
|
|
|
342
182
|
MIT
|
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { existsSync, cpSync, mkdirSync, chmodSync } from 'fs';
|
|
3
|
+
import { existsSync, cpSync, mkdirSync, chmodSync, renameSync } from 'fs';
|
|
4
4
|
import { dirname, join } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
|
|
@@ -17,6 +17,7 @@ const colors = {
|
|
|
17
17
|
red: (text) => `\x1b[31m${text}\x1b[0m`,
|
|
18
18
|
cyan: (text) => `\x1b[36m${text}\x1b[0m`,
|
|
19
19
|
bold: (text) => `\x1b[1m${text}\x1b[0m`,
|
|
20
|
+
dim: (text) => `\x1b[2m${text}\x1b[0m`,
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
function printHelp() {
|
|
@@ -31,14 +32,44 @@ Commands:
|
|
|
31
32
|
init --minimal Required files only
|
|
32
33
|
help Show this help message
|
|
33
34
|
|
|
35
|
+
Options:
|
|
36
|
+
--no-backup Overwrite existing files without backup
|
|
37
|
+
|
|
34
38
|
Examples:
|
|
35
39
|
npx autoworkflow init
|
|
36
40
|
npx autoworkflow init --all
|
|
37
41
|
`);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
function
|
|
44
|
+
function backupFile(dest, name) {
|
|
45
|
+
if (existsSync(dest)) {
|
|
46
|
+
const backupPath = `${dest}.backup`;
|
|
47
|
+
// If backup already exists, add timestamp
|
|
48
|
+
const finalBackupPath = existsSync(backupPath)
|
|
49
|
+
? `${dest}.backup.${Date.now()}`
|
|
50
|
+
: backupPath;
|
|
51
|
+
try {
|
|
52
|
+
renameSync(dest, finalBackupPath);
|
|
53
|
+
console.log(` ${colors.yellow('↪')} ${name} ${colors.dim(`→ backed up to ${finalBackupPath.split('/').pop()}`)}`);
|
|
54
|
+
return true;
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.log(` ${colors.red('✗')} Failed to backup ${name}: ${err.message}`);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return true; // No backup needed
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function copyFile(src, dest, name, options = {}) {
|
|
64
|
+
const noBackup = args.includes('--no-backup');
|
|
65
|
+
|
|
41
66
|
if (existsSync(src)) {
|
|
67
|
+
// Backup existing file/folder if it exists
|
|
68
|
+
if (!noBackup && existsSync(dest)) {
|
|
69
|
+
const backed = backupFile(dest, name);
|
|
70
|
+
if (!backed) return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
42
73
|
try {
|
|
43
74
|
cpSync(src, dest, { recursive: true });
|
|
44
75
|
console.log(` ${colors.green('✓')} ${name}`);
|
|
@@ -57,23 +88,38 @@ function init(options = {}) {
|
|
|
57
88
|
const cwd = process.cwd();
|
|
58
89
|
const all = options.all || args.includes('--all');
|
|
59
90
|
const minimal = options.minimal || args.includes('--minimal');
|
|
91
|
+
const noBackup = args.includes('--no-backup');
|
|
60
92
|
|
|
61
93
|
console.log(`\n${colors.bold('AutoWorkflow Setup')}\n`);
|
|
62
|
-
console.log(`Installing to: ${colors.cyan(cwd)}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
console.log(`${colors.yellow('⚠')}
|
|
67
|
-
console.log(` Use --force to overwrite (not implemented yet)\n`);
|
|
94
|
+
console.log(`Installing to: ${colors.cyan(cwd)}`);
|
|
95
|
+
if (!noBackup) {
|
|
96
|
+
console.log(`${colors.dim('Existing files will be backed up with .backup suffix')}\n`);
|
|
97
|
+
} else {
|
|
98
|
+
console.log(`${colors.yellow('⚠')} ${colors.dim('--no-backup: Existing files will be overwritten')}\n`);
|
|
68
99
|
}
|
|
69
100
|
|
|
70
101
|
// Required files
|
|
71
102
|
console.log(colors.bold('Required files:'));
|
|
72
103
|
copyFile(join(packageRoot, 'CLAUDE.md'), join(cwd, 'CLAUDE.md'), 'CLAUDE.md');
|
|
73
|
-
copyFile(join(packageRoot, 'system'), join(cwd, 'system'), 'system/');
|
|
74
104
|
copyFile(join(packageRoot, 'instructions'), join(cwd, 'instructions'), 'instructions/');
|
|
75
105
|
copyFile(join(packageRoot, '.claude'), join(cwd, '.claude'), '.claude/');
|
|
76
106
|
|
|
107
|
+
// Make Claude hooks executable
|
|
108
|
+
if (process.platform !== 'win32' && existsSync(join(cwd, '.claude', 'hooks'))) {
|
|
109
|
+
try {
|
|
110
|
+
const hookFiles = ['session-check.sh', 'post-edit.sh', 'pre-commit-check.sh'];
|
|
111
|
+
hookFiles.forEach(hook => {
|
|
112
|
+
const hookPath = join(cwd, '.claude', 'hooks', hook);
|
|
113
|
+
if (existsSync(hookPath)) {
|
|
114
|
+
chmodSync(hookPath, 0o755);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
console.log(` ${colors.green('✓')} Claude hooks made executable`);
|
|
118
|
+
} catch (e) {
|
|
119
|
+
// Ignore chmod errors
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
77
123
|
if (!minimal) {
|
|
78
124
|
// Recommended files
|
|
79
125
|
console.log(`\n${colors.bold('Recommended files:')}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoworkflow",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Automated workflow enforcement for Claude Code via hooks and system prompts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"autoworkflow": "bin/cli.js"
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"claude-code",
|
|
12
12
|
"workflow",
|
|
13
13
|
"system-prompts",
|
|
14
|
-
"ai-instructions"
|
|
14
|
+
"ai-instructions",
|
|
15
|
+
"hooks",
|
|
16
|
+
"automation"
|
|
15
17
|
],
|
|
16
18
|
"author": "",
|
|
17
19
|
"license": "MIT",
|
package/system/triggers.md
CHANGED
|
@@ -71,16 +71,22 @@ Or run `/init --all` to include .vscode and config templates.
|
|
|
71
71
|
### `on:blueprint_missing`
|
|
72
72
|
|
|
73
73
|
**When:** BLUEPRINT.md does not exist at session start
|
|
74
|
+
**Behavior:** AUTOMATIC - runs without asking permission
|
|
75
|
+
|
|
76
|
+
**IMPORTANT:** This trigger runs AUTOMATICALLY. Do NOT ask "Should I run the audit?" - just run it.
|
|
77
|
+
Only ask for approval when SAVING the generated files, not when starting the scan.
|
|
78
|
+
|
|
74
79
|
**Action:**
|
|
75
|
-
1.
|
|
76
|
-
2.
|
|
77
|
-
3.
|
|
78
|
-
4.
|
|
80
|
+
1. Notify user (brief message)
|
|
81
|
+
2. **RUN audit immediately** (no permission needed)
|
|
82
|
+
3. Generate BOTH AI_RULES.md updates AND BLUEPRINT.md
|
|
83
|
+
4. Present proposed updates to user
|
|
84
|
+
5. Ask approval to SAVE (not to start)
|
|
79
85
|
|
|
80
86
|
```
|
|
81
87
|
TRIGGER: blueprint_missing
|
|
82
|
-
├── Notify: "No BLUEPRINT.md found. Running project audit..."
|
|
83
|
-
├──
|
|
88
|
+
├── Notify: "No BLUEPRINT.md found. Running project audit..." ← Just notify
|
|
89
|
+
├── RUN IMMEDIATELY (no permission needed): ← Auto-run
|
|
84
90
|
│ ├── cat package.json → Tech stack
|
|
85
91
|
│ ├── find src -type d → File structure
|
|
86
92
|
│ ├── ls src/pages/ → Routes
|
|
@@ -91,19 +97,35 @@ TRIGGER: blueprint_missing
|
|
|
91
97
|
├── Generate: AI_RULES.md updates (Tech Stack, File Structure)
|
|
92
98
|
├── Generate: BLUEPRINT.md (Features, Routes, APIs)
|
|
93
99
|
├── Present: both updates to user
|
|
94
|
-
├── Await:
|
|
100
|
+
├── Await: approval TO SAVE (not to start) ← Only save needs approval
|
|
95
101
|
└── Save: both files after approval
|
|
96
102
|
```
|
|
97
103
|
|
|
104
|
+
**DO NOT:**
|
|
105
|
+
- Ask "Should I run the audit?"
|
|
106
|
+
- Ask "Do you want me to scan the project?"
|
|
107
|
+
- Wait for permission to start scanning
|
|
108
|
+
|
|
109
|
+
**DO:**
|
|
110
|
+
- Notify and immediately start scanning
|
|
111
|
+
- Only ask permission when presenting results to save
|
|
112
|
+
|
|
98
113
|
**Output Format:**
|
|
99
114
|
```
|
|
100
|
-
⚠️ No BLUEPRINT.md found
|
|
115
|
+
⚠️ No BLUEPRINT.md found.
|
|
116
|
+
|
|
117
|
+
Running project audit now...
|
|
118
|
+
|
|
119
|
+
[scanning happens automatically]
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 🔍 Audit Complete
|
|
101
124
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
- 📘 BLUEPRINT.md → Features, Routes, APIs
|
|
125
|
+
[present AI_RULES.md updates]
|
|
126
|
+
[present BLUEPRINT.md content]
|
|
105
127
|
|
|
106
|
-
|
|
128
|
+
**Should I save these files?** (yes/no/edit first)
|
|
107
129
|
```
|
|
108
130
|
|
|
109
131
|
---
|