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.
- package/.claude/commands/analyze.md +77 -0
- package/.claude/commands/audit.md +220 -0
- package/.claude/commands/build.md +159 -0
- package/.claude/commands/commit.md +165 -0
- package/.claude/commands/fix.md +119 -0
- package/.claude/commands/plan.md +101 -0
- package/.claude/commands/suggest.md +195 -0
- package/.claude/commands/verify.md +113 -0
- package/.claude/settings.json +129 -0
- package/.claude/settings.local.json +9 -0
- package/.prettierrc +11 -0
- package/.vscode/extensions.json +27 -0
- package/.vscode/settings.json +69 -0
- package/.vscode/tasks.json +161 -0
- package/CLAUDE.md +344 -0
- package/README.md +262 -185
- package/eslint.config.example.js +83 -0
- package/hooks/commit-msg +137 -0
- package/hooks/pre-commit +152 -0
- package/instructions/AI_RULES.md +284 -0
- package/instructions/BLUEPRINT.md +170 -0
- package/instructions/CLAUDE.md +472 -0
- package/package.json +45 -45
- package/scripts/autoworkflow.sh +324 -0
- package/scripts/check-ui-enforcement.sh +177 -0
- package/scripts/ensure-no-errors.sh +116 -0
- package/scripts/run-verification.sh +112 -0
- package/scripts/setup.sh +201 -0
- package/system/gates.md +390 -0
- package/system/loops.md +348 -0
- package/system/router.md +415 -0
- package/system/triggers.md +369 -0
- package/tsconfig.example.json +52 -0
- package/bin/cli.js +0 -299
- package/lib/index.js +0 -9
- package/lib/install.js +0 -745
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# /analyze - Analyze Command
|
|
2
|
+
|
|
3
|
+
Analyze the codebase for a given task or question.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
- User invokes `/analyze [topic]`
|
|
7
|
+
- Or: Start of any new task (automatic)
|
|
8
|
+
|
|
9
|
+
## Workflow
|
|
10
|
+
|
|
11
|
+
### Step 1: Load Context
|
|
12
|
+
```
|
|
13
|
+
1. Read: CLAUDE.md (entry point)
|
|
14
|
+
2. Read: system/router.md (task classification)
|
|
15
|
+
3. Read: instructions/AI_RULES.md (standards)
|
|
16
|
+
4. Read: instructions/BLUEPRINT.md (requirements)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Step 2: Classify Task
|
|
20
|
+
Route through `system/router.md`:
|
|
21
|
+
- Is this a feature, fix, refactor, query, etc.?
|
|
22
|
+
- What workflow applies?
|
|
23
|
+
- What gates are required?
|
|
24
|
+
|
|
25
|
+
### Step 3: Analyze Codebase
|
|
26
|
+
```
|
|
27
|
+
1. Search for relevant files
|
|
28
|
+
2. Read affected code
|
|
29
|
+
3. Note existing patterns
|
|
30
|
+
4. Identify dependencies
|
|
31
|
+
5. Check BLUEPRINT for requirements
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Step 4: Report Findings
|
|
35
|
+
|
|
36
|
+
**Output Format:**
|
|
37
|
+
```
|
|
38
|
+
## Analysis: [topic]
|
|
39
|
+
|
|
40
|
+
### Task Classification
|
|
41
|
+
**Type:** [feature/fix/refactor/query/etc.]
|
|
42
|
+
**Workflow:** [phases that apply]
|
|
43
|
+
**Gates:** [required gates]
|
|
44
|
+
|
|
45
|
+
### Relevant Files
|
|
46
|
+
- `path/to/file1.tsx` - [why relevant]
|
|
47
|
+
- `path/to/file2.ts` - [why relevant]
|
|
48
|
+
|
|
49
|
+
### Existing Patterns
|
|
50
|
+
- [Pattern 1 observed]
|
|
51
|
+
- [Pattern 2 observed]
|
|
52
|
+
|
|
53
|
+
### Blueprint Requirements
|
|
54
|
+
- [Relevant requirement 1]
|
|
55
|
+
- [Relevant requirement 2]
|
|
56
|
+
|
|
57
|
+
### Dependencies
|
|
58
|
+
- [Dependency 1]
|
|
59
|
+
- [Dependency 2]
|
|
60
|
+
|
|
61
|
+
### Notes
|
|
62
|
+
[Any concerns or observations]
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
Proceeding to PLAN phase...
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Gate
|
|
69
|
+
`analyze_gate` - Must have read relevant files before proceeding to PLAN.
|
|
70
|
+
|
|
71
|
+
## Arguments
|
|
72
|
+
`$ARGUMENTS` - The topic or task to analyze
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
- `/analyze user authentication` - Analyze auth implementation
|
|
76
|
+
- `/analyze how routing works` - Analyze routing patterns
|
|
77
|
+
- `/analyze add dark mode` - Analyze requirements for dark mode feature
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# /audit - Audit Command
|
|
2
|
+
|
|
3
|
+
Run UI enforcement and circular dependency checks.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
- User invokes `/audit`
|
|
7
|
+
- User invokes `/audit project` (full project scan)
|
|
8
|
+
- Or: Automatically after VERIFY phase (for features)
|
|
9
|
+
- Or: Part of audit_loop
|
|
10
|
+
|
|
11
|
+
## When Required
|
|
12
|
+
Per `system/router.md`, audit is required for:
|
|
13
|
+
- `feature` - New functionality
|
|
14
|
+
- `refactor` - Code restructuring
|
|
15
|
+
- `perf` - Performance changes
|
|
16
|
+
|
|
17
|
+
## Arguments
|
|
18
|
+
- `/audit` - Run standard UI + cycle checks
|
|
19
|
+
- `/audit project` - Full project scan (generates/updates BLUEPRINT.md)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Mode 1: Project Audit (Full Scan)
|
|
24
|
+
|
|
25
|
+
When `/audit project` is invoked OR when BLUEPRINT.md is missing:
|
|
26
|
+
|
|
27
|
+
### Step 1: Scan Codebase (Single Pass)
|
|
28
|
+
```bash
|
|
29
|
+
# All discovery commands run ONCE
|
|
30
|
+
cat package.json | grep -A 30 "dependencies"
|
|
31
|
+
find src -type d | head -30
|
|
32
|
+
ls -la src/
|
|
33
|
+
[ -d src/pages ] && ls src/pages/
|
|
34
|
+
[ -d src/app ] && ls src/app/
|
|
35
|
+
[ -d src/components ] && ls src/components/
|
|
36
|
+
[ -d src/api ] && find src/api -name "*.ts"
|
|
37
|
+
[ -d src/hooks ] && ls src/hooks/
|
|
38
|
+
[ -f prisma/schema.prisma ] && cat prisma/schema.prisma
|
|
39
|
+
grep -r "/api/" src/ | head -30
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 2: Present Dual Updates
|
|
43
|
+
```
|
|
44
|
+
## 🔍 Project Audit Complete
|
|
45
|
+
|
|
46
|
+
### 📄 AI_RULES.md Updates
|
|
47
|
+
|
|
48
|
+
**Tech Stack** (detected):
|
|
49
|
+
- Framework: [detected]
|
|
50
|
+
- Styling: [detected]
|
|
51
|
+
- Database: [detected]
|
|
52
|
+
|
|
53
|
+
**File Structure** (discovered):
|
|
54
|
+
src/
|
|
55
|
+
├── [directories found]
|
|
56
|
+
└── [file counts]
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### 📘 BLUEPRINT.md (will create/update)
|
|
61
|
+
|
|
62
|
+
**Features Discovered:**
|
|
63
|
+
| Feature | Frontend | Backend | Route | Status |
|
|
64
|
+
|---------|----------|---------|-------|--------|
|
|
65
|
+
| [name] | [component] | [api] | [route] | ✅/⚠️ |
|
|
66
|
+
|
|
67
|
+
**⚠️ Issues Found:**
|
|
68
|
+
- [Orphan APIs, unused hooks, etc.]
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
**Should I save these updates?**
|
|
73
|
+
- AI_RULES.md → Update Tech Stack & File Structure
|
|
74
|
+
- BLUEPRINT.md → Create/update with discoveries
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Step 3: Save After Approval
|
|
78
|
+
Update both files with discovered information.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Mode 2: Standard Audit (Default)
|
|
83
|
+
|
|
84
|
+
## Workflow
|
|
85
|
+
|
|
86
|
+
### Step 1: Run UI Enforcement
|
|
87
|
+
```bash
|
|
88
|
+
npm run audit:ui
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Check for orphan features:
|
|
92
|
+
- API endpoints without UI
|
|
93
|
+
- Hooks not used by components
|
|
94
|
+
- Utilities not imported anywhere
|
|
95
|
+
- Routes without page components
|
|
96
|
+
|
|
97
|
+
### Step 2: Run Circular Dependency Check
|
|
98
|
+
```bash
|
|
99
|
+
npm run audit:cycles
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Check for import cycles:
|
|
103
|
+
- A → B → A
|
|
104
|
+
- A → B → C → A
|
|
105
|
+
- Longer chains
|
|
106
|
+
|
|
107
|
+
### Step 3: Report Results
|
|
108
|
+
|
|
109
|
+
**On Success:**
|
|
110
|
+
```
|
|
111
|
+
## Audit
|
|
112
|
+
|
|
113
|
+
✅ **ALL AUDITS PASSED**
|
|
114
|
+
|
|
115
|
+
| Check | Status | Details |
|
|
116
|
+
|-------|--------|---------|
|
|
117
|
+
| UI Enforcement | ✅ | No orphan features |
|
|
118
|
+
| Circular Deps | ✅ | No cycles detected |
|
|
119
|
+
|
|
120
|
+
**Gate Status:** `audit_gate` ✅ PASSED
|
|
121
|
+
|
|
122
|
+
Ready to proceed to COMMIT.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**On UI Failure:**
|
|
126
|
+
```
|
|
127
|
+
## Audit
|
|
128
|
+
|
|
129
|
+
| Check | Status | Details |
|
|
130
|
+
|-------|--------|---------|
|
|
131
|
+
| UI Enforcement | ⛔ | Orphan features found |
|
|
132
|
+
| Circular Deps | ✅ | No cycles |
|
|
133
|
+
|
|
134
|
+
### Orphan Features Detected
|
|
135
|
+
|
|
136
|
+
**API without UI:**
|
|
137
|
+
- `/api/users` - No component calls this endpoint
|
|
138
|
+
|
|
139
|
+
**Unused Hooks:**
|
|
140
|
+
- `useAuth` - Not used by any component
|
|
141
|
+
|
|
142
|
+
**Unreachable Routes:**
|
|
143
|
+
- `/settings` - No navigation leads here
|
|
144
|
+
|
|
145
|
+
**Gate Status:** `audit_gate` ⛔ BLOCKED
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
⛔ **BLOCKED: Cannot commit orphan features**
|
|
150
|
+
|
|
151
|
+
Must add UI for each backend feature.
|
|
152
|
+
|
|
153
|
+
### Required Actions
|
|
154
|
+
1. Create `UserList.tsx` component for `/api/users`
|
|
155
|
+
2. Use `useAuth` hook in `AuthProvider.tsx`
|
|
156
|
+
3. Add navigation link to `/settings`
|
|
157
|
+
|
|
158
|
+
Building missing UI components...
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**On Cycle Failure:**
|
|
162
|
+
```
|
|
163
|
+
## Audit
|
|
164
|
+
|
|
165
|
+
| Check | Status | Details |
|
|
166
|
+
|-------|--------|---------|
|
|
167
|
+
| UI Enforcement | ✅ | No orphans |
|
|
168
|
+
| Circular Deps | ⛔ | Cycles detected |
|
|
169
|
+
|
|
170
|
+
### Circular Dependencies Found
|
|
171
|
+
|
|
172
|
+
**Cycle 1:**
|
|
173
|
+
```
|
|
174
|
+
src/hooks/useAuth.ts
|
|
175
|
+
→ src/api/auth.ts
|
|
176
|
+
→ src/hooks/useAuth.ts (CYCLE)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Cycle 2:**
|
|
180
|
+
```
|
|
181
|
+
src/components/Button.tsx
|
|
182
|
+
→ src/utils/helpers.ts
|
|
183
|
+
→ src/components/Icon.tsx
|
|
184
|
+
→ src/components/Button.tsx (CYCLE)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Gate Status:** `audit_gate` ⛔ BLOCKED
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
⛔ **BLOCKED: Cannot commit with circular dependencies**
|
|
192
|
+
|
|
193
|
+
### Required Actions
|
|
194
|
+
1. Extract shared code from `useAuth` and `auth.ts`
|
|
195
|
+
2. Break Button → Icon dependency
|
|
196
|
+
|
|
197
|
+
Resolving cycles...
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Step 4: Fix Loop (if issues)
|
|
201
|
+
Per `system/loops.md`:
|
|
202
|
+
- `ui_fix_loop` - Build missing UI
|
|
203
|
+
- `cycle_fix_loop` - Resolve import cycles
|
|
204
|
+
|
|
205
|
+
## Gate
|
|
206
|
+
`audit_gate` - Must pass before COMMIT for features.
|
|
207
|
+
|
|
208
|
+
## Commands Used
|
|
209
|
+
```bash
|
|
210
|
+
npm run audit:ui # UI enforcement check
|
|
211
|
+
npm run audit:cycles # Circular dependency check
|
|
212
|
+
npm run audit:all # Run all audits
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Loop Reference
|
|
216
|
+
See `system/loops.md#audit_loop` for loop definition.
|
|
217
|
+
|
|
218
|
+
## Examples
|
|
219
|
+
- `/audit` - Run all audit checks
|
|
220
|
+
- Automatic after verify passes (for features)
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# /build - Build Feature Command
|
|
2
|
+
|
|
3
|
+
Execute the full workflow to build a feature from start to finish.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
- User invokes `/build [feature description]`
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
This command runs the **complete workflow** as defined in the system:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
ANALYZE → PLAN+SUGGEST → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Phase 1: ANALYZE
|
|
17
|
+
```
|
|
18
|
+
1. Read: CLAUDE.md (entry point)
|
|
19
|
+
2. Route: system/router.md → classify as "feature"
|
|
20
|
+
3. Read: instructions/AI_RULES.md
|
|
21
|
+
4. Read: instructions/BLUEPRINT.md
|
|
22
|
+
5. Search: relevant existing code
|
|
23
|
+
6. Report: analysis findings
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Trigger:** `on:task_received`
|
|
27
|
+
|
|
28
|
+
### Phase 2: PLAN + SUGGEST
|
|
29
|
+
```
|
|
30
|
+
1. Design: implementation approach
|
|
31
|
+
2. List: files to create/modify
|
|
32
|
+
3. Generate: suggestions (required for features)
|
|
33
|
+
4. Present: plan to user
|
|
34
|
+
5. Ask: "Should I proceed? Which suggestions?"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Gate:** `plan_approval_gate` - Wait for approval
|
|
38
|
+
|
|
39
|
+
### Phase 3: IMPLEMENT
|
|
40
|
+
```
|
|
41
|
+
1. Create/modify: planned files
|
|
42
|
+
2. Include: approved suggestions
|
|
43
|
+
3. Follow: AI_RULES.md standards
|
|
44
|
+
4. Ensure: no TODO/FIXME
|
|
45
|
+
5. Ensure: no console.log
|
|
46
|
+
6. Complete: UI + Backend together
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Trigger:** `on:implementation_complete`
|
|
50
|
+
|
|
51
|
+
### Phase 4: VERIFY
|
|
52
|
+
```
|
|
53
|
+
1. Run: npm run verify
|
|
54
|
+
2. Check: TypeScript errors
|
|
55
|
+
3. Check: ESLint warnings
|
|
56
|
+
4. If errors: enter fix_loop
|
|
57
|
+
5. Repeat: until pass or max iterations
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Loop:** `verify_loop` (max 10 iterations)
|
|
61
|
+
**Gate:** `verify_gate`
|
|
62
|
+
|
|
63
|
+
### Phase 5: AUDIT
|
|
64
|
+
```
|
|
65
|
+
1. Run: npm run audit:ui
|
|
66
|
+
2. Check: no orphan features
|
|
67
|
+
3. Run: npm run audit:cycles
|
|
68
|
+
4. Check: no circular dependencies
|
|
69
|
+
5. If issues: fix and re-audit
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Loop:** `audit_loop` (max 5 iterations)
|
|
73
|
+
**Gate:** `audit_gate`
|
|
74
|
+
|
|
75
|
+
### Phase 6: COMMIT
|
|
76
|
+
```
|
|
77
|
+
1. Run: pre_commit_gate checks
|
|
78
|
+
2. Show: commit preview
|
|
79
|
+
3. Ask: user confirmation
|
|
80
|
+
4. Execute: git commit
|
|
81
|
+
5. Report: success
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Gate:** `pre_commit_gate`
|
|
85
|
+
|
|
86
|
+
## Output Format
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
## Build: [feature description]
|
|
90
|
+
|
|
91
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
92
|
+
|
|
93
|
+
### Phase 1: ANALYZE ✓
|
|
94
|
+
[analysis findings]
|
|
95
|
+
|
|
96
|
+
### Phase 2: PLAN
|
|
97
|
+
[proposed changes + suggestions]
|
|
98
|
+
|
|
99
|
+
**Should I proceed? Which suggestions?**
|
|
100
|
+
|
|
101
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
102
|
+
|
|
103
|
+
(after approval)
|
|
104
|
+
|
|
105
|
+
### Phase 3: IMPLEMENT ✓
|
|
106
|
+
[changes made]
|
|
107
|
+
|
|
108
|
+
### Phase 4: VERIFY
|
|
109
|
+
[verification results]
|
|
110
|
+
Status: ✅ PASSED
|
|
111
|
+
|
|
112
|
+
### Phase 5: AUDIT
|
|
113
|
+
[audit results]
|
|
114
|
+
Status: ✅ PASSED
|
|
115
|
+
|
|
116
|
+
### Phase 6: COMMIT
|
|
117
|
+
[pre-commit check]
|
|
118
|
+
|
|
119
|
+
**Should I commit: "feat(scope): description"?**
|
|
120
|
+
|
|
121
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
122
|
+
|
|
123
|
+
(after approval)
|
|
124
|
+
|
|
125
|
+
### Summary
|
|
126
|
+
✅ Feature complete
|
|
127
|
+
- Files created: X
|
|
128
|
+
- Files modified: X
|
|
129
|
+
- Suggestions included: [list]
|
|
130
|
+
- Commit: [hash]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Blocking Points
|
|
134
|
+
|
|
135
|
+
The workflow will pause at:
|
|
136
|
+
1. **Plan approval** - User must approve before implementing
|
|
137
|
+
2. **Commit approval** - User must approve before committing
|
|
138
|
+
|
|
139
|
+
The workflow will block (not pause) at:
|
|
140
|
+
1. **Verification failures** - Must fix errors
|
|
141
|
+
2. **Audit failures** - Must resolve issues
|
|
142
|
+
3. **Pre-commit failures** - Must fix blocking items
|
|
143
|
+
|
|
144
|
+
## Rules
|
|
145
|
+
- MUST read instructions/AI_RULES.md before implementing
|
|
146
|
+
- MUST show suggestions for new features
|
|
147
|
+
- MUST ask which suggestions to include
|
|
148
|
+
- CANNOT skip verification
|
|
149
|
+
- CANNOT commit with errors
|
|
150
|
+
- CANNOT commit orphan features (backend without UI)
|
|
151
|
+
|
|
152
|
+
## Arguments
|
|
153
|
+
`$ARGUMENTS` - Description of the feature to build
|
|
154
|
+
|
|
155
|
+
## Examples
|
|
156
|
+
- `/build user authentication with login and signup`
|
|
157
|
+
- `/build dark mode toggle in settings`
|
|
158
|
+
- `/build contact form with validation`
|
|
159
|
+
- `/build dashboard with user stats`
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# /commit - Commit Command
|
|
2
|
+
|
|
3
|
+
Run pre-commit gate and create a conventional commit.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
- User invokes `/commit [message]`
|
|
7
|
+
- Or: After AUDIT phase passes
|
|
8
|
+
|
|
9
|
+
## Workflow
|
|
10
|
+
|
|
11
|
+
### Step 1: Pre-Commit Gate
|
|
12
|
+
Per `system/gates.md#pre_commit_gate`, check ALL requirements:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
1. verify_gate passed (TypeScript + ESLint clean)
|
|
16
|
+
2. audit_gate passed (if feature/refactor)
|
|
17
|
+
3. No TODO/FIXME comments in changed files
|
|
18
|
+
4. No console.log/debug/info in changed files
|
|
19
|
+
5. Commit message follows conventional format
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Step 2: Check Changed Files
|
|
23
|
+
```bash
|
|
24
|
+
git diff --cached --name-only # Staged files
|
|
25
|
+
git diff --name-only # Unstaged changes
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Search for blocking patterns:
|
|
29
|
+
```bash
|
|
30
|
+
# Check for TODO/FIXME
|
|
31
|
+
grep -rn "TODO\|FIXME\|XXX\|HACK" [changed files]
|
|
32
|
+
|
|
33
|
+
# Check for console.log
|
|
34
|
+
grep -rn "console\.\(log\|debug\|info\)" [changed files]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Step 3: Validate Commit Message
|
|
38
|
+
Format: `type(scope): description`
|
|
39
|
+
|
|
40
|
+
Valid types:
|
|
41
|
+
- `feat` - New feature
|
|
42
|
+
- `fix` - Bug fix
|
|
43
|
+
- `docs` - Documentation
|
|
44
|
+
- `style` - Formatting
|
|
45
|
+
- `refactor` - Code restructure
|
|
46
|
+
- `perf` - Performance
|
|
47
|
+
- `test` - Tests
|
|
48
|
+
- `build` - Build system
|
|
49
|
+
- `ci` - CI/CD
|
|
50
|
+
- `chore` - Maintenance
|
|
51
|
+
- `revert` - Revert commit
|
|
52
|
+
|
|
53
|
+
### Step 4: Report Gate Status
|
|
54
|
+
|
|
55
|
+
**On All Pass:**
|
|
56
|
+
```
|
|
57
|
+
## Pre-Commit Gate
|
|
58
|
+
|
|
59
|
+
| Check | Status |
|
|
60
|
+
|-------|--------|
|
|
61
|
+
| TypeScript | ✅ 0 errors |
|
|
62
|
+
| ESLint | ✅ 0 warnings |
|
|
63
|
+
| UI Enforcement | ✅ No orphans |
|
|
64
|
+
| Circular Deps | ✅ No cycles |
|
|
65
|
+
| TODO/FIXME | ✅ None found |
|
|
66
|
+
| console.log | ✅ None found |
|
|
67
|
+
| Commit Format | ✅ Valid |
|
|
68
|
+
|
|
69
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
70
|
+
|
|
71
|
+
✅ **ALL GATES PASSED**
|
|
72
|
+
|
|
73
|
+
### Ready to Commit
|
|
74
|
+
|
|
75
|
+
**Files:**
|
|
76
|
+
- `src/components/Button.tsx` (modified)
|
|
77
|
+
- `src/hooks/useAuth.ts` (new)
|
|
78
|
+
- `src/pages/Login.tsx` (new)
|
|
79
|
+
|
|
80
|
+
**Message:** `feat(auth): add login page with authentication hook`
|
|
81
|
+
|
|
82
|
+
**Should I proceed with this commit?**
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**On Any Failure:**
|
|
86
|
+
```
|
|
87
|
+
## Pre-Commit Gate
|
|
88
|
+
|
|
89
|
+
| Check | Status |
|
|
90
|
+
|-------|--------|
|
|
91
|
+
| TypeScript | ✅ |
|
|
92
|
+
| ESLint | ✅ |
|
|
93
|
+
| UI Enforcement | ✅ |
|
|
94
|
+
| Circular Deps | ✅ |
|
|
95
|
+
| TODO/FIXME | ⛔ Found |
|
|
96
|
+
| console.log | ⛔ Found |
|
|
97
|
+
| Commit Format | ✅ |
|
|
98
|
+
|
|
99
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
100
|
+
|
|
101
|
+
⛔ **COMMIT BLOCKED**
|
|
102
|
+
|
|
103
|
+
### Issues Found
|
|
104
|
+
|
|
105
|
+
**TODO/FIXME Comments:**
|
|
106
|
+
- `src/utils/helpers.ts:42` - "TODO: implement validation"
|
|
107
|
+
|
|
108
|
+
**Console Statements:**
|
|
109
|
+
- `src/hooks/useAuth.ts:15` - console.log("debug")
|
|
110
|
+
|
|
111
|
+
### Required Actions
|
|
112
|
+
1. Remove TODO at helpers.ts:42
|
|
113
|
+
2. Remove console.log at useAuth.ts:15
|
|
114
|
+
|
|
115
|
+
Fixing blocking issues...
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Step 5: Execute Commit (after approval)
|
|
119
|
+
```bash
|
|
120
|
+
git add -A
|
|
121
|
+
git commit -m "type(scope): description"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Step 6: Confirm Success
|
|
125
|
+
```
|
|
126
|
+
## Commit Complete
|
|
127
|
+
|
|
128
|
+
✅ **COMMITTED**
|
|
129
|
+
|
|
130
|
+
**Hash:** abc1234
|
|
131
|
+
**Message:** feat(auth): add login page
|
|
132
|
+
**Files:** 3 changed
|
|
133
|
+
|
|
134
|
+
**Branch:** main
|
|
135
|
+
**Status:** Ready to push (if desired)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Gate
|
|
139
|
+
`pre_commit_gate` - All checks must pass. Non-negotiable.
|
|
140
|
+
|
|
141
|
+
## Arguments
|
|
142
|
+
`$ARGUMENTS` - The commit message
|
|
143
|
+
|
|
144
|
+
If no message provided, Claude will suggest one based on changes.
|
|
145
|
+
|
|
146
|
+
## Commit Message Examples
|
|
147
|
+
- `feat(auth): add login page with OAuth support`
|
|
148
|
+
- `fix(api): handle null response in user fetch`
|
|
149
|
+
- `refactor(utils): extract date formatting helpers`
|
|
150
|
+
- `docs(readme): add installation instructions`
|
|
151
|
+
- `style(button): update hover state colors`
|
|
152
|
+
|
|
153
|
+
## Rules
|
|
154
|
+
- NEVER commit if typecheck fails
|
|
155
|
+
- NEVER commit if ESLint has warnings
|
|
156
|
+
- NEVER commit with TODO/FIXME comments
|
|
157
|
+
- NEVER commit with console.log statements
|
|
158
|
+
- NEVER commit orphan features (backend without UI)
|
|
159
|
+
- ALWAYS run verification first
|
|
160
|
+
- ALWAYS ask for confirmation before committing
|
|
161
|
+
- ALWAYS use conventional commit format
|
|
162
|
+
|
|
163
|
+
## Examples
|
|
164
|
+
- `/commit feat(auth): add login page` - Commit with message
|
|
165
|
+
- `/commit` - Claude suggests message based on changes
|