autoworkflow 1.2.0 → 2.0.1

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,390 @@
1
+ # System Gates
2
+
3
+ > Blocking checkpoints that MUST pass before proceeding.
4
+ > Gates enforce hard rules that cannot be bypassed.
5
+
6
+ ---
7
+
8
+ ## Gate Philosophy
9
+
10
+ Gates are **BLOCKING**. If a gate fails:
11
+ 1. Claude MUST stop
12
+ 2. Claude MUST report the failure
13
+ 3. Claude MUST NOT proceed until resolved
14
+ 4. User CANNOT override blocking gates (only fix the issue)
15
+
16
+ ---
17
+
18
+ ## Gate Definitions
19
+
20
+ ### `analyze_gate`
21
+
22
+ **Phase:** Before ANALYZE → PLAN transition
23
+ **Purpose:** Ensure adequate analysis was performed
24
+
25
+ ```
26
+ GATE: analyze_gate
27
+ ├── REQUIRES:
28
+ │ ✓ Read relevant source files
29
+ │ ✓ Understood existing code patterns
30
+ │ ✓ Identified affected files
31
+ │ ✓ Checked BLUEPRINT.md for requirements
32
+ │ ✓ Checked AI_RULES.md for standards
33
+
34
+ ├── ON_PASS:
35
+ │ └── Proceed to: PLAN phase
36
+
37
+ └── ON_FAIL:
38
+ └── BLOCK: "Insufficient analysis"
39
+ └── Report: what's missing
40
+ └── Return to: ANALYZE phase
41
+ ```
42
+
43
+ ---
44
+
45
+ ### `plan_approval_gate`
46
+
47
+ **Phase:** Before PLAN → IMPLEMENT transition
48
+ **Purpose:** User must approve the plan before implementation
49
+
50
+ ```
51
+ GATE: plan_approval_gate
52
+ ├── REQUIRES:
53
+ │ ✓ Plan has been presented to user
54
+ │ ✓ Suggestions (if applicable) have been shown
55
+ │ ✓ User has explicitly approved
56
+ │ - "yes", "proceed", "go ahead", "approved", etc.
57
+ │ - OR selected which suggestions to include
58
+
59
+ ├── ON_PASS:
60
+ │ └── Record: approved suggestions
61
+ │ └── Proceed to: IMPLEMENT phase
62
+
63
+ ├── ON_FAIL (no approval):
64
+ │ └── BLOCK: "Awaiting user approval"
65
+ │ └── State: "Should I proceed with this plan?"
66
+ │ └── Wait for: user response
67
+
68
+ └── ON_REJECT (user says no):
69
+ └── Ask: "What should I change?"
70
+ └── Return to: PLAN phase
71
+ └── Revise: based on feedback
72
+ ```
73
+
74
+ **Approval Detection:**
75
+ ```
76
+ APPROVED if user says:
77
+ - "yes" / "y" / "yeah" / "yep"
78
+ - "proceed" / "go ahead" / "do it"
79
+ - "approved" / "lgtm" / "looks good"
80
+ - "all" / "include all" (for suggestions)
81
+ - "required" / "required only"
82
+ - Specific numbers: "1, 3, 5" (for suggestions)
83
+
84
+ NOT APPROVED if user says:
85
+ - "no" / "n" / "nope"
86
+ - "wait" / "hold on"
87
+ - "change" / "modify"
88
+ - Question asking for clarification
89
+ ```
90
+
91
+ ---
92
+
93
+ ### `verify_gate`
94
+
95
+ **Phase:** After IMPLEMENT, before AUDIT/COMMIT
96
+ **Purpose:** Code must pass TypeScript and ESLint checks
97
+
98
+ ```
99
+ GATE: verify_gate
100
+ ├── REQUIRES:
101
+ │ ✓ npm run typecheck → exit code 0
102
+ │ ✓ npm run lint → exit code 0 (0 warnings)
103
+ │ ✓ No TypeScript errors in any file
104
+ │ ✓ No ESLint errors or warnings
105
+
106
+ ├── COMMANDS:
107
+ │ npm run verify
108
+ │ (which runs: npm run typecheck && npm run lint)
109
+
110
+ ├── ON_PASS:
111
+ │ └── Report: "✅ Verification passed"
112
+ │ └── Proceed to: AUDIT phase (if feature) or COMMIT gate
113
+
114
+ └── ON_FAIL:
115
+ └── BLOCK: "⛔ Verification failed"
116
+ └── Report: all errors with file:line
117
+ └── Enter: fix_loop (from system/loops.md)
118
+ └── After fix: re-check gate
119
+ ```
120
+
121
+ **Output Format:**
122
+ ```
123
+ ## Verify Gate Check
124
+
125
+ | Check | Status | Details |
126
+ |-------|--------|---------|
127
+ | TypeScript | ✅/⛔ | X errors found |
128
+ | ESLint | ✅/⛔ | X warnings found |
129
+
130
+ Gate Status: ✅ PASSED / ⛔ BLOCKED
131
+ ```
132
+
133
+ ---
134
+
135
+ ### `audit_gate`
136
+
137
+ **Phase:** After VERIFY, before COMMIT (for features)
138
+ **Purpose:** No orphan features, no circular dependencies
139
+
140
+ ```
141
+ GATE: audit_gate
142
+ ├── REQUIRES:
143
+ │ ✓ npm run audit:ui → no orphan features
144
+ │ ✓ npm run audit:cycles → no circular dependencies
145
+
146
+ ├── CHECKS:
147
+ │ 1. UI Enforcement:
148
+ │ - Every API endpoint has a UI that calls it
149
+ │ - Every hook is used by a component
150
+ │ - Every utility is imported somewhere
151
+ │ - User can access every feature
152
+
153
+ │ 2. Circular Dependencies:
154
+ │ - No A → B → A import cycles
155
+ │ - No longer chains (A → B → C → A)
156
+
157
+ ├── ON_PASS:
158
+ │ └── Report: "✅ All audits passed"
159
+ │ └── Proceed to: pre_commit_gate
160
+
161
+ ├── ON_UI_FAIL:
162
+ │ └── BLOCK: "⛔ Orphan feature detected"
163
+ │ └── Report: features missing UI
164
+ │ └── Enter: ui_fix_loop
165
+ │ └── After fix: re-check gate
166
+
167
+ └── ON_CYCLE_FAIL:
168
+ └── BLOCK: "⛔ Circular dependency detected"
169
+ └── Report: cycle paths
170
+ └── Enter: cycle_fix_loop
171
+ └── After fix: re-check gate
172
+ ```
173
+
174
+ ---
175
+
176
+ ### `pre_commit_gate`
177
+
178
+ **Phase:** Before COMMIT
179
+ **Purpose:** Final check before committing - ALL rules enforced
180
+
181
+ ```
182
+ GATE: pre_commit_gate
183
+ ├── REQUIRES:
184
+ │ ✓ verify_gate passed (TypeScript + ESLint clean)
185
+ │ ✓ audit_gate passed (no orphans, no cycles)
186
+ │ ✓ No TODO comments in changed files
187
+ │ ✓ No FIXME comments in changed files
188
+ │ ✓ No console.log in changed files
189
+ │ ✓ No console.debug in changed files
190
+ │ ✓ No console.info in changed files
191
+ │ ✓ Commit message follows conventional format
192
+
193
+ ├── CHECKS:
194
+ │ 1. Re-verify: npm run verify
195
+ │ 2. Check diff: grep -E "TODO|FIXME"
196
+ │ 3. Check diff: grep "console\.(log|debug|info)"
197
+ │ 4. Validate: commit message format
198
+
199
+ ├── COMMIT_MESSAGE_FORMAT:
200
+ │ type(scope): description
201
+
202
+ │ Valid types: feat, fix, docs, style, refactor,
203
+ │ perf, test, build, ci, chore, revert
204
+
205
+ │ Examples:
206
+ │ - feat(auth): add login page
207
+ │ - fix(api): handle null response
208
+ │ - refactor(utils): extract date helpers
209
+
210
+ ├── ON_PASS:
211
+ │ └── Report: "✅ All pre-commit checks passed"
212
+ │ └── Show: commit preview (files + message)
213
+ │ └── Ask: "Should I commit?"
214
+ │ └── Wait for: user confirmation
215
+
216
+ └── ON_FAIL:
217
+ └── BLOCK: "⛔ Cannot commit"
218
+ └── Report: ALL blocking issues
219
+ └── Route to: appropriate fix action
220
+ └── After fix: re-check gate
221
+ ```
222
+
223
+ **Output Format:**
224
+ ```
225
+ ## Pre-Commit Gate Check
226
+
227
+ | Check | Status | Details |
228
+ |-------|--------|---------|
229
+ | TypeScript | ✅ | No errors |
230
+ | ESLint | ✅ | No warnings |
231
+ | UI Enforcement | ✅ | All features have UI |
232
+ | Circular Deps | ✅ | No cycles |
233
+ | TODO/FIXME | ✅ | None in diff |
234
+ | console.log | ✅ | None in diff |
235
+ | Commit Message | ✅ | Valid format |
236
+
237
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
238
+ ✅ ALL GATES PASSED
239
+
240
+ Ready to commit:
241
+ - 3 files changed
242
+ - Message: "feat(auth): add login page"
243
+
244
+ Should I proceed with this commit?
245
+ ```
246
+
247
+ ---
248
+
249
+ ### `destructive_action_gate`
250
+
251
+ **Phase:** Before any destructive action
252
+ **Purpose:** User must confirm dangerous operations
253
+
254
+ ```
255
+ GATE: destructive_action_gate
256
+ ├── TRIGGERS_ON:
257
+ │ - Deleting files
258
+ │ - Removing significant code (>50 lines)
259
+ │ - Changing database schema
260
+ │ - Modifying authentication logic
261
+ │ - Changing API contracts
262
+ │ - Force operations (git push --force, etc.)
263
+
264
+ ├── REQUIRES:
265
+ │ ✓ User explicitly confirms the action
266
+ │ ✓ Impact has been clearly explained
267
+
268
+ ├── FORMAT:
269
+ │ ⚠️ **Warning:** This will [describe impact].
270
+
271
+ │ Files affected:
272
+ │ - [file1]
273
+ │ - [file2]
274
+
275
+ │ This action [is/is not] reversible.
276
+
277
+ │ **Should I proceed?**
278
+
279
+ └── ON_CONFIRM:
280
+ └── Proceed with: action
281
+ └── On reject: cancel action
282
+ ```
283
+
284
+ ---
285
+
286
+ ## Gate Hierarchy
287
+
288
+ Gates are checked in order. Later gates assume earlier gates passed.
289
+
290
+ ```
291
+ 1. analyze_gate
292
+
293
+
294
+ 2. plan_approval_gate
295
+
296
+
297
+ 3. [IMPLEMENT]
298
+
299
+
300
+ 4. verify_gate
301
+
302
+
303
+ 5. audit_gate (if feature/component)
304
+
305
+
306
+ 6. pre_commit_gate
307
+
308
+
309
+ 7. [COMMIT]
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Gate Override Policy
315
+
316
+ **CANNOT be overridden by user:**
317
+ - `verify_gate` - TypeScript/ESLint errors
318
+ - `audit_gate` - Orphan features
319
+ - `pre_commit_gate` - Blocking rule violations
320
+
321
+ **CAN be acknowledged by user:**
322
+ - `destructive_action_gate` - With explicit "yes, delete it"
323
+
324
+ **User controls:**
325
+ - `plan_approval_gate` - User decides when to proceed
326
+
327
+ ---
328
+
329
+ ## Reporting Gate Status
330
+
331
+ Claude MUST show gate status at phase transitions:
332
+
333
+ ```
334
+ ## Gate: pre_commit_gate
335
+
336
+ Checking requirements...
337
+
338
+ [1/7] TypeScript errors: ✅ PASS (0 errors)
339
+ [2/7] ESLint warnings: ✅ PASS (0 warnings)
340
+ [3/7] UI Enforcement: ✅ PASS (no orphans)
341
+ [4/7] Circular deps: ✅ PASS (no cycles)
342
+ [5/7] TODO/FIXME: ✅ PASS (none found)
343
+ [6/7] console.log: ✅ PASS (none found)
344
+ [7/7] Commit format: ✅ PASS (valid)
345
+
346
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
347
+ ✅ GATE PASSED - Ready to proceed
348
+ ```
349
+
350
+ Or on failure:
351
+
352
+ ```
353
+ ## Gate: pre_commit_gate
354
+
355
+ Checking requirements...
356
+
357
+ [1/7] TypeScript errors: ✅ PASS
358
+ [2/7] ESLint warnings: ✅ PASS
359
+ [3/7] UI Enforcement: ⛔ FAIL
360
+ └── Missing UI for: /api/users endpoint
361
+ [4/7] Circular deps: ✅ PASS
362
+ [5/7] TODO/FIXME: ⛔ FAIL
363
+ └── Found: src/utils.ts:42 "TODO: implement"
364
+ [6/7] console.log: ✅ PASS
365
+ [7/7] Commit format: ✅ PASS
366
+
367
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
368
+ ⛔ GATE BLOCKED - Cannot proceed
369
+
370
+ Issues to resolve:
371
+ 1. Add UI component for /api/users
372
+ 2. Remove TODO comment at src/utils.ts:42
373
+
374
+ Fixing now...
375
+ ```
376
+
377
+ ---
378
+
379
+ ## Quick Reference
380
+
381
+ | Gate | When | Blocking Rule |
382
+ |------|------|---------------|
383
+ | `analyze_gate` | Before planning | Must read relevant files |
384
+ | `plan_approval_gate` | Before implementing | User must approve |
385
+ | `verify_gate` | After implementing | Zero TS/ESLint errors |
386
+ | `audit_gate` | Before committing features | No orphans, no cycles |
387
+ | `pre_commit_gate` | Before any commit | All rules enforced |
388
+ | `destructive_action_gate` | Before dangerous ops | User must confirm |
389
+
390
+ **Gates are non-negotiable. Fix issues, don't bypass gates.**