autoworkflow 1.1.0 → 2.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.
@@ -0,0 +1,369 @@
1
+ # System Triggers
2
+
3
+ > Event-driven actions that control Claude's workflow behavior.
4
+ > These triggers fire automatically based on context and events.
5
+
6
+ ---
7
+
8
+ ## Trigger Definitions
9
+
10
+ ### `on:conversation_start`
11
+
12
+ **When:** Claude begins a new conversation or task
13
+ **Action:**
14
+ 1. Read root `CLAUDE.md` (entry point)
15
+ 2. Check if `instructions/BLUEPRINT.md` exists
16
+ 3. If NO → Trigger `on:blueprint_missing`
17
+ 4. If YES → Load blueprint and proceed
18
+ 5. Load `system/router.md` to determine task type
19
+ 6. Load `system/gates.md` for blocking rules
20
+ 7. Await user request
21
+
22
+ ```
23
+ TRIGGER: conversation_start
24
+ ├── Read: CLAUDE.md
25
+ ├── Check: instructions/BLUEPRINT.md exists?
26
+ │ ├── NO → Trigger: on:blueprint_missing
27
+ │ └── YES → Read: instructions/BLUEPRINT.md
28
+ ├── Read: system/router.md
29
+ ├── Read: system/gates.md
30
+ └── State: READY
31
+ ```
32
+
33
+ ---
34
+
35
+ ### `on:blueprint_missing`
36
+
37
+ **When:** BLUEPRINT.md does not exist at session start
38
+ **Action:**
39
+ 1. Run single audit scan of codebase
40
+ 2. Generate BOTH AI_RULES.md updates AND BLUEPRINT.md
41
+ 3. Present proposed updates to user
42
+ 4. Save after approval
43
+
44
+ ```
45
+ TRIGGER: blueprint_missing
46
+ ├── Notify: "No BLUEPRINT.md found. Running project audit..."
47
+ ├── Scan: codebase (single pass)
48
+ │ ├── cat package.json → Tech stack
49
+ │ ├── find src -type d → File structure
50
+ │ ├── ls src/pages/ → Routes
51
+ │ ├── ls src/components/ → Components
52
+ │ ├── find src/api/ → API endpoints
53
+ │ └── grep -r "fetch\|/api/" → Connections
54
+
55
+ ├── Generate: AI_RULES.md updates (Tech Stack, File Structure)
56
+ ├── Generate: BLUEPRINT.md (Features, Routes, APIs)
57
+ ├── Present: both updates to user
58
+ ├── Await: user approval
59
+ └── Save: both files after approval
60
+ ```
61
+
62
+ **Output Format:**
63
+ ```
64
+ ⚠️ No BLUEPRINT.md found in this project.
65
+
66
+ Running ONE audit to update TWO files:
67
+ - 📄 AI_RULES.md → Tech Stack & File Structure
68
+ - 📘 BLUEPRINT.md → Features, Routes, APIs
69
+
70
+ Scanning codebase...
71
+ ```
72
+
73
+ ---
74
+
75
+ ### `on:task_received`
76
+
77
+ **When:** User provides a task or request
78
+ **Action:**
79
+ 1. Route task through `system/router.md`
80
+ 2. Identify task type (feature, fix, refactor, etc.)
81
+ 3. Load appropriate workflow from `instructions/CLAUDE.md`
82
+ 4. Enter ANALYZE phase
83
+
84
+ ```
85
+ TRIGGER: task_received
86
+ ├── Parse: user request
87
+ ├── Route: system/router.md → task_type
88
+ ├── Load: instructions/CLAUDE.md#workflow
89
+ └── Enter: ANALYZE phase
90
+ ```
91
+
92
+ ---
93
+
94
+ ### `on:phase_transition`
95
+
96
+ **When:** Moving from one workflow phase to another
97
+ **Action:**
98
+ 1. Check `system/gates.md` for phase gate
99
+ 2. If gate passes → proceed to next phase
100
+ 3. If gate fails → BLOCK and report
101
+
102
+ ```
103
+ TRIGGER: phase_transition(from, to)
104
+ ├── Check: system/gates.md#{to}_gate
105
+ ├── If PASS → Enter: {to} phase
106
+ └── If FAIL → BLOCK: report gate failure
107
+ ```
108
+
109
+ ---
110
+
111
+ ### `on:implementation_complete`
112
+
113
+ **When:** Claude finishes writing/modifying code
114
+ **Action:**
115
+ 1. Enter VERIFY phase automatically
116
+ 2. Start `verify_loop` from `system/loops.md`
117
+ 3. Report results
118
+
119
+ ```
120
+ TRIGGER: implementation_complete
121
+ ├── Enter: VERIFY phase
122
+ ├── Start: system/loops.md#verify_loop
123
+ └── Report: verification results
124
+ ```
125
+
126
+ ---
127
+
128
+ ### `on:verification_failed`
129
+
130
+ **When:** `npm run verify` returns errors
131
+ **Action:**
132
+ 1. Parse error output
133
+ 2. Enter FIX phase
134
+ 3. Start `fix_loop` from `system/loops.md`
135
+
136
+ ```
137
+ TRIGGER: verification_failed
138
+ ├── Parse: error output
139
+ ├── Enter: FIX phase
140
+ ├── Start: system/loops.md#fix_loop
141
+ └── Return to: VERIFY phase when fixed
142
+ ```
143
+
144
+ ---
145
+
146
+ ### `on:verification_passed`
147
+
148
+ **When:** `npm run verify` returns success
149
+ **Action:**
150
+ 1. Check if audits required (new feature/component)
151
+ 2. If yes → enter AUDIT phase
152
+ 3. If no → proceed to COMMIT gate
153
+
154
+ ```
155
+ TRIGGER: verification_passed
156
+ ├── Check: is_audit_required?
157
+ ├── If YES → Enter: AUDIT phase
158
+ ├── If NO → Check: system/gates.md#pre_commit_gate
159
+ └── Report: ready status
160
+ ```
161
+
162
+ ---
163
+
164
+ ### `on:commit_requested`
165
+
166
+ **When:** User asks to commit or workflow reaches commit phase
167
+ **Action:**
168
+ 1. Check `system/gates.md#pre_commit_gate`
169
+ 2. All gates must pass
170
+ 3. If blocked → report and await fix
171
+ 4. If passed → ask for commit confirmation
172
+
173
+ ```
174
+ TRIGGER: commit_requested
175
+ ├── Check: system/gates.md#pre_commit_gate
176
+ ├── If BLOCKED → Report: blocking issues
177
+ ├── If PASSED → Show: commit preview
178
+ └── Await: user confirmation
179
+ ```
180
+
181
+ ---
182
+
183
+ ### `on:error_detected`
184
+
185
+ **When:** Any error occurs during execution
186
+ **Action:**
187
+ 1. Identify error type
188
+ 2. Route to appropriate fix strategy
189
+ 3. Enter FIX phase if code error
190
+ 4. Report if environmental error
191
+
192
+ ```
193
+ TRIGGER: error_detected(error_type)
194
+ ├── Identify: error_type
195
+ ├── If code_error → Enter: FIX phase
196
+ ├── If env_error → Report: to user
197
+ └── If unknown → Ask: user for guidance
198
+ ```
199
+
200
+ ---
201
+
202
+ ### `on:file_changed`
203
+
204
+ **When:** Claude modifies a file
205
+ **Action:**
206
+ 1. Mark file as changed
207
+ 2. Queue for verification
208
+ 3. If in IMPLEMENT phase → continue
209
+ 4. If outside phase → trigger verification
210
+
211
+ ```
212
+ TRIGGER: file_changed(file_path)
213
+ ├── Track: changed_files.add(file_path)
214
+ ├── If IMPLEMENT phase → Continue
215
+ ├── If other phase → Queue: verification
216
+ └── Update: state
217
+ ```
218
+
219
+ ---
220
+
221
+ ### `on:user_approval`
222
+
223
+ **When:** User approves a plan or action
224
+ **Action:**
225
+ 1. Record approval
226
+ 2. Proceed to next phase
227
+ 3. If plan approval → enter IMPLEMENT
228
+ 4. If commit approval → execute commit
229
+
230
+ ```
231
+ TRIGGER: user_approval(approval_type)
232
+ ├── Record: approval
233
+ ├── If plan_approval → Enter: IMPLEMENT phase
234
+ ├── If commit_approval → Execute: git commit
235
+ └── Continue: workflow
236
+ ```
237
+
238
+ ---
239
+
240
+ ### `on:user_rejection`
241
+
242
+ **When:** User rejects a plan or action
243
+ **Action:**
244
+ 1. Record rejection
245
+ 2. Ask for feedback
246
+ 3. Return to PLAN phase
247
+ 4. Revise based on feedback
248
+
249
+ ```
250
+ TRIGGER: user_rejection
251
+ ├── Record: rejection
252
+ ├── Ask: "What should I change?"
253
+ ├── Return to: PLAN phase
254
+ └── Incorporate: user feedback
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Trigger Priority
260
+
261
+ When multiple triggers could fire, use this priority:
262
+
263
+ | Priority | Trigger | Reason |
264
+ |----------|---------|--------|
265
+ | 1 | `on:error_detected` | Errors must be handled immediately |
266
+ | 2 | `on:user_approval/rejection` | User input takes precedence |
267
+ | 3 | `on:phase_transition` | Workflow control |
268
+ | 4 | `on:verification_*` | Quality gates |
269
+ | 5 | `on:file_changed` | Tracking |
270
+ | 6 | `on:task_received` | New work |
271
+
272
+ ---
273
+
274
+ ## Trigger State Machine
275
+
276
+ ```
277
+ [IDLE] ─────on:task_received────→ [ANALYZE]
278
+
279
+
280
+ [PLAN]
281
+
282
+ on:user_rejection │ on:user_approval
283
+ ◄─────────┴─────────►
284
+ │ │
285
+ ▼ ▼
286
+ [PLAN] [IMPLEMENT]
287
+
288
+ on:implementation_complete
289
+
290
+
291
+ [VERIFY]
292
+
293
+ on:verification_failed │ on:verification_passed
294
+ ◄─────────────────┴─────────────────►
295
+ │ │
296
+ ▼ ▼
297
+ [FIX] [AUDIT]
298
+ │ │
299
+ └──────────► [VERIFY] ◄─────────────┘
300
+
301
+ on:commit_requested
302
+
303
+
304
+ [PRE_COMMIT_GATE]
305
+
306
+ blocked │ passed
307
+ ◄─────────────────┴─────────────────►
308
+ │ │
309
+ ▼ ▼
310
+ [FIX] [COMMIT]
311
+
312
+
313
+ [IDLE]
314
+ ```
315
+
316
+ ---
317
+
318
+ ### `on:feature_complete`
319
+
320
+ **When:** A new feature, route, or API is successfully committed
321
+ **Action:**
322
+ 1. Check if BLUEPRINT.md needs updating
323
+ 2. Present proposed updates
324
+ 3. Update after approval
325
+
326
+ ```
327
+ TRIGGER: feature_complete
328
+ ├── Check: was new feature/route/api added?
329
+ ├── If YES:
330
+ │ ├── Generate: BLUEPRINT.md update
331
+ │ ├── Present: proposed changes
332
+ │ ├── Await: approval
333
+ │ └── Update: BLUEPRINT.md
334
+ └── If NO:
335
+ └── Skip: no update needed
336
+ ```
337
+
338
+ **Update Triggers:**
339
+ | Event | Action |
340
+ |-------|--------|
341
+ | New feature added | Add to Features section |
342
+ | New route created | Add to Routes section |
343
+ | New API endpoint | Add to API section |
344
+ | Feature removed | Mark as deprecated or remove |
345
+
346
+ **Output Format:**
347
+ ```
348
+ ## 📘 Blueprint Update
349
+
350
+ Adding to BLUEPRINT.md:
351
+ - Feature: [name] - [description]
352
+ - Route: [path] → [Component]
353
+ - API: [method] [endpoint]
354
+
355
+ **Should I update BLUEPRINT.md?**
356
+ ```
357
+
358
+ ---
359
+
360
+ ## Usage
361
+
362
+ Claude MUST check this file when:
363
+ 1. Starting any task
364
+ 2. Transitioning between phases
365
+ 3. Encountering errors
366
+ 4. Receiving user input
367
+ 5. Completing a feature (for blueprint updates)
368
+
369
+ Triggers ensure consistent, predictable workflow behavior.
@@ -0,0 +1,52 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ // ─────────────────────────────────────────────────────────────
5
+ // Language & Environment
6
+ // ─────────────────────────────────────────────────────────────
7
+ "target": "ES2020",
8
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
9
+ "module": "ESNext",
10
+ "jsx": "react-jsx",
11
+
12
+ // ─────────────────────────────────────────────────────────────
13
+ // Module Resolution
14
+ // ─────────────────────────────────────────────────────────────
15
+ "moduleResolution": "bundler",
16
+ "allowImportingTsExtensions": true,
17
+ "isolatedModules": true,
18
+ "moduleDetection": "force",
19
+ "noEmit": true,
20
+ "useDefineForClassFields": true,
21
+ "skipLibCheck": true,
22
+
23
+ // ─────────────────────────────────────────────────────────────
24
+ // STRICT MODE - All enabled for maximum type safety
25
+ // Per AI_RULES.md: "Never use any type"
26
+ // ─────────────────────────────────────────────────────────────
27
+ "strict": true,
28
+ "noUnusedLocals": true,
29
+ "noUnusedParameters": true,
30
+ "noFallthroughCasesInSwitch": true,
31
+ "noUncheckedIndexedAccess": true,
32
+ "noImplicitReturns": true,
33
+ "noImplicitOverride": true,
34
+ "exactOptionalPropertyTypes": true,
35
+ "forceConsistentCasingInFileNames": true,
36
+
37
+ // ─────────────────────────────────────────────────────────────
38
+ // Path Aliases (optional)
39
+ // ─────────────────────────────────────────────────────────────
40
+ "baseUrl": ".",
41
+ "paths": {
42
+ "@/*": ["./src/*"],
43
+ "@/components/*": ["./src/components/*"],
44
+ "@/hooks/*": ["./src/hooks/*"],
45
+ "@/lib/*": ["./src/lib/*"],
46
+ "@/types/*": ["./src/types/*"]
47
+ }
48
+ },
49
+ "include": ["src"],
50
+ "exclude": ["node_modules", "dist", "coverage"],
51
+ "references": [{ "path": "./tsconfig.node.json" }]
52
+ }