autoworkflow 3.0.0 → 3.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/hooks/pre-commit-check.sh +49 -44
- package/.claude/settings.json +25 -13
- package/CLAUDE.md +65 -41
- package/package.json +1 -1
|
@@ -1,60 +1,65 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# AutoWorkflow Pre-Commit Check Hook
|
|
3
|
-
# Runs on: PreToolUse for Bash tool
|
|
4
|
-
# Purpose:
|
|
3
|
+
# Runs on: PreToolUse for Bash tool
|
|
4
|
+
# Purpose: Check for issues before commands execute
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# Check if this is a git commit command
|
|
10
|
-
if echo "$COMMAND" | grep -q "git commit"; then
|
|
11
|
-
echo ""
|
|
12
|
-
echo "=================================================="
|
|
13
|
-
echo "AUTOWORKFLOW: PRE-COMMIT CHECK"
|
|
14
|
-
echo "=================================================="
|
|
15
|
-
|
|
16
|
-
ERRORS=0
|
|
17
|
-
|
|
18
|
-
# Check for TODO/FIXME in staged files
|
|
6
|
+
# Check for TODO/FIXME in staged files
|
|
7
|
+
check_staged_todos() {
|
|
19
8
|
if git diff --cached --name-only 2>/dev/null | xargs grep -l "TODO\|FIXME\|XXX\|HACK" 2>/dev/null; then
|
|
20
9
|
echo ""
|
|
21
|
-
echo "
|
|
10
|
+
echo "=================================================="
|
|
11
|
+
echo "AUTOWORKFLOW: TODO/FIXME DETECTED"
|
|
12
|
+
echo "=================================================="
|
|
13
|
+
echo ""
|
|
14
|
+
echo "Found TODO/FIXME comments in staged files."
|
|
22
15
|
echo "Remove all TODO/FIXME comments before committing."
|
|
23
|
-
ERRORS=$((ERRORS + 1))
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
# Check for console.log in staged files (excluding test files)
|
|
27
|
-
if git diff --cached --name-only 2>/dev/null | grep -v "\.test\.\|\.spec\.\|__tests__" | xargs grep -l "console\.log\|console\.debug\|console\.info" 2>/dev/null; then
|
|
28
16
|
echo ""
|
|
29
|
-
echo "
|
|
30
|
-
|
|
31
|
-
ERRORS=$((ERRORS + 1))
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
# Check commit message format (if provided)
|
|
35
|
-
if echo "$COMMAND" | grep -q '\-m'; then
|
|
36
|
-
MSG=$(echo "$COMMAND" | sed -n 's/.*-m ["\x27]\([^"\x27]*\)["\x27].*/\1/p')
|
|
37
|
-
if [ -n "$MSG" ]; then
|
|
38
|
-
# Check conventional commit format
|
|
39
|
-
if ! echo "$MSG" | grep -qE "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9-]+\))?: .+"; then
|
|
40
|
-
echo ""
|
|
41
|
-
echo "BLOCKED: Invalid commit message format"
|
|
42
|
-
echo "Use: type(scope): description"
|
|
43
|
-
echo "Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert"
|
|
44
|
-
ERRORS=$((ERRORS + 1))
|
|
45
|
-
fi
|
|
46
|
-
fi
|
|
17
|
+
echo "=================================================="
|
|
18
|
+
return 1
|
|
47
19
|
fi
|
|
20
|
+
return 0
|
|
21
|
+
}
|
|
48
22
|
|
|
49
|
-
|
|
23
|
+
# Check for console.log in staged files
|
|
24
|
+
check_staged_logs() {
|
|
25
|
+
if git diff --cached --name-only 2>/dev/null | grep -v "\.test\.\|\.spec\.\|__tests__" | xargs grep -l "console\.log\|console\.debug\|console\.info" 2>/dev/null; then
|
|
50
26
|
echo ""
|
|
51
|
-
echo "
|
|
27
|
+
echo "=================================================="
|
|
28
|
+
echo "AUTOWORKFLOW: CONSOLE.LOG DETECTED"
|
|
52
29
|
echo "=================================================="
|
|
53
30
|
echo ""
|
|
54
|
-
|
|
31
|
+
echo "Found console.log statements in staged files."
|
|
32
|
+
echo "Remove debug logs before committing."
|
|
55
33
|
echo ""
|
|
56
|
-
echo "All pre-commit checks passed."
|
|
57
34
|
echo "=================================================="
|
|
58
|
-
|
|
35
|
+
return 1
|
|
59
36
|
fi
|
|
37
|
+
return 0
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Only run checks if there are staged changes
|
|
41
|
+
if git diff --cached --quiet 2>/dev/null; then
|
|
42
|
+
# No staged changes, skip checks
|
|
43
|
+
exit 0
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Run checks
|
|
47
|
+
ERRORS=0
|
|
48
|
+
|
|
49
|
+
check_staged_todos
|
|
50
|
+
if [ $? -ne 0 ]; then
|
|
51
|
+
ERRORS=$((ERRORS + 1))
|
|
60
52
|
fi
|
|
53
|
+
|
|
54
|
+
check_staged_logs
|
|
55
|
+
if [ $? -ne 0 ]; then
|
|
56
|
+
ERRORS=$((ERRORS + 1))
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
if [ $ERRORS -gt 0 ]; then
|
|
60
|
+
echo ""
|
|
61
|
+
echo "Fix the above issues before committing."
|
|
62
|
+
echo ""
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
exit 0
|
package/.claude/settings.json
CHANGED
|
@@ -7,40 +7,52 @@
|
|
|
7
7
|
"hooks": {
|
|
8
8
|
"UserPromptSubmit": [
|
|
9
9
|
{
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"matcher": "",
|
|
11
|
+
"hooks": [
|
|
12
|
+
{
|
|
13
|
+
"type": "command",
|
|
14
|
+
"command": "./.claude/hooks/session-check.sh",
|
|
15
|
+
"timeout": 5,
|
|
16
|
+
"statusMessage": "Checking project state..."
|
|
17
|
+
}
|
|
18
|
+
]
|
|
12
19
|
}
|
|
13
20
|
],
|
|
14
21
|
"PostToolUse": [
|
|
15
22
|
{
|
|
16
23
|
"matcher": "Write|Edit",
|
|
17
|
-
"
|
|
24
|
+
"hooks": [
|
|
25
|
+
{
|
|
26
|
+
"type": "command",
|
|
27
|
+
"command": "./.claude/hooks/post-edit.sh"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
18
30
|
}
|
|
19
31
|
],
|
|
20
32
|
"PreToolUse": [
|
|
21
33
|
{
|
|
22
34
|
"matcher": "Bash",
|
|
23
|
-
"
|
|
35
|
+
"hooks": [
|
|
36
|
+
{
|
|
37
|
+
"type": "command",
|
|
38
|
+
"command": "./.claude/hooks/pre-commit-check.sh"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
24
41
|
}
|
|
25
42
|
]
|
|
26
43
|
},
|
|
27
44
|
|
|
28
45
|
"instructions": [
|
|
29
46
|
"WORKFLOW: Follow ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT for all tasks",
|
|
30
|
-
|
|
31
|
-
"SESSION START: If instructions/BLUEPRINT.md missing, immediately scan codebase (cat package.json, ls src/, find directories) and generate it. Do not ask to start - only ask to save.",
|
|
32
|
-
|
|
47
|
+
"SESSION START: If instructions/BLUEPRINT.md missing, immediately scan codebase and generate it. Do not ask to start - only ask to save.",
|
|
33
48
|
"AFTER CODE CHANGES: Run 'npm run verify' automatically. If errors exist, fix them and re-verify until passing.",
|
|
34
|
-
|
|
35
49
|
"BEFORE COMMIT: Block if TODO/FIXME/console.log found in changes. Require conventional commit format: type(scope): description",
|
|
36
|
-
|
|
37
50
|
"UI ENFORCEMENT: Every backend endpoint/API must have a corresponding UI component. No orphan features allowed.",
|
|
38
|
-
|
|
39
51
|
"PLAN GATE: Always wait for user approval before implementing. Show plan with suggestions first.",
|
|
40
|
-
|
|
41
52
|
"BLUEPRINT UPDATE: After adding new features/routes/APIs, update instructions/BLUEPRINT.md",
|
|
42
|
-
|
|
43
|
-
"Read
|
|
53
|
+
"Read instructions/AI_RULES.md for project-specific coding standards",
|
|
54
|
+
"Read system/router.md to classify task type",
|
|
55
|
+
"Read system/gates.md for blocking rules"
|
|
44
56
|
],
|
|
45
57
|
|
|
46
58
|
"workflow": {
|
package/CLAUDE.md
CHANGED
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
> Automated workflow enforcement via hooks + system prompts.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Architecture
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
|
|
9
|
-
settings.json
|
|
10
|
-
|
|
11
|
-
instructions/
|
|
8
|
+
.claude/hooks/ → AUTO-TRIGGERS (run on events)
|
|
9
|
+
.claude/settings.json → SYSTEM PROMPT (core instructions)
|
|
10
|
+
CLAUDE.md (this file) → WORKFLOW SUMMARY
|
|
11
|
+
instructions/ → AI_RULES.md + BLUEPRINT.md
|
|
12
|
+
system/ → DETAILED REFERENCE (gates, loops, triggers, router)
|
|
12
13
|
```
|
|
13
14
|
|
|
15
|
+
**Priority:** Hooks → settings.json → This file → system/*.md
|
|
16
|
+
|
|
14
17
|
---
|
|
15
18
|
|
|
16
19
|
## Workflow
|
|
@@ -23,7 +26,7 @@ ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → U
|
|
|
23
26
|
|-------|--------|
|
|
24
27
|
| ANALYZE | Read relevant files, check BLUEPRINT.md |
|
|
25
28
|
| PLAN | Design approach, show suggestions |
|
|
26
|
-
| CONFIRM | Wait for user approval |
|
|
29
|
+
| CONFIRM | **Wait for user approval** |
|
|
27
30
|
| IMPLEMENT | Make changes (after approval only) |
|
|
28
31
|
| VERIFY | Run `npm run verify` |
|
|
29
32
|
| AUDIT | Run `npm run audit:ui` + `audit:cycles` |
|
|
@@ -34,50 +37,58 @@ ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → U
|
|
|
34
37
|
|
|
35
38
|
## Task Types
|
|
36
39
|
|
|
37
|
-
| Type | Workflow | Audit? |
|
|
38
|
-
|
|
39
|
-
| feature | Full
|
|
40
|
+
| Type | Workflow | Audit Required? |
|
|
41
|
+
|------|----------|-----------------|
|
|
42
|
+
| feature | Full 9 phases | Yes |
|
|
40
43
|
| fix | ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → COMMIT | No |
|
|
41
|
-
| refactor | ANALYZE →
|
|
44
|
+
| refactor | ANALYZE → ... → VERIFY → AUDIT → COMMIT | Yes |
|
|
42
45
|
| docs | ANALYZE → IMPLEMENT → COMMIT | No |
|
|
43
46
|
| query | ANALYZE → RESPOND | No |
|
|
44
47
|
|
|
48
|
+
See `system/router.md` for detailed task classification.
|
|
49
|
+
|
|
45
50
|
---
|
|
46
51
|
|
|
47
|
-
## Gates
|
|
52
|
+
## Blocking Gates
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
| Gate | Blocks If | Reference |
|
|
55
|
+
|------|-----------|-----------|
|
|
56
|
+
| Plan Approval | User hasn't approved | `system/gates.md` |
|
|
57
|
+
| Verify | TypeScript/ESLint errors | `system/gates.md` |
|
|
58
|
+
| Audit | Orphan features or circular deps | `system/gates.md` |
|
|
59
|
+
| Pre-Commit | TODO/FIXME, console.log, bad format | `system/gates.md` |
|
|
52
60
|
|
|
53
|
-
|
|
54
|
-
**Before:** AUDIT/COMMIT
|
|
55
|
-
**Requires:** `npm run verify` passes (0 errors)
|
|
61
|
+
---
|
|
56
62
|
|
|
57
|
-
|
|
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)
|
|
63
|
+
## Blocking Rules
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
**
|
|
65
|
-
**
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
- Invalid commit message format
|
|
65
|
+
- **No orphan features** - Backend must have UI
|
|
66
|
+
- **No TODO/FIXME** - Complete the work
|
|
67
|
+
- **No console.log** - No debug logs
|
|
68
|
+
- **No circular deps** - Clean imports
|
|
69
|
+
- **Conventional commits** - `type(scope): description`
|
|
69
70
|
|
|
70
71
|
---
|
|
71
72
|
|
|
72
|
-
##
|
|
73
|
+
## Auto-Triggers (Hooks)
|
|
73
74
|
|
|
74
|
-
|
|
|
75
|
-
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
| Event | Hook | Action |
|
|
76
|
+
|-------|------|--------|
|
|
77
|
+
| User message | `session-check.sh` | Check BLUEPRINT.md exists |
|
|
78
|
+
| After Write/Edit | `post-edit.sh` | Remind to verify |
|
|
79
|
+
| Before git commit | `pre-commit-check.sh` | Block bad commits |
|
|
80
|
+
|
|
81
|
+
See `system/triggers.md` for all trigger definitions.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Verification Loop
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
VERIFY → Failed? → FIX → VERIFY → Failed? → FIX → ... (max 10 iterations)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
See `system/loops.md` for loop definitions.
|
|
81
92
|
|
|
82
93
|
---
|
|
83
94
|
|
|
@@ -92,13 +103,26 @@ npm run format # Prettier
|
|
|
92
103
|
|
|
93
104
|
---
|
|
94
105
|
|
|
95
|
-
##
|
|
106
|
+
## Required Reading
|
|
107
|
+
|
|
108
|
+
| File | Purpose |
|
|
109
|
+
|------|---------|
|
|
110
|
+
| `instructions/AI_RULES.md` | Your coding standards |
|
|
111
|
+
| `instructions/BLUEPRINT.md` | Project specification |
|
|
112
|
+
|
|
113
|
+
If BLUEPRINT.md is missing, the session-check hook will trigger an automatic audit.
|
|
114
|
+
|
|
115
|
+
---
|
|
96
116
|
|
|
97
|
-
|
|
98
|
-
Read `instructions/BLUEPRINT.md` for project specification.
|
|
117
|
+
## Detailed Reference
|
|
99
118
|
|
|
100
|
-
|
|
101
|
-
|
|
119
|
+
| File | Contains |
|
|
120
|
+
|------|----------|
|
|
121
|
+
| `system/triggers.md` | Event → Action mappings |
|
|
122
|
+
| `system/gates.md` | Blocking checkpoint definitions |
|
|
123
|
+
| `system/loops.md` | Verify/fix cycle definitions |
|
|
124
|
+
| `system/router.md` | Task type classification |
|
|
125
|
+
| `instructions/CLAUDE.md` | Full 9-phase workflow details |
|
|
102
126
|
|
|
103
127
|
---
|
|
104
128
|
|