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
|
@@ -5,6 +5,7 @@ Run UI enforcement and circular dependency checks.
|
|
|
5
5
|
## Trigger
|
|
6
6
|
- User invokes `/audit`
|
|
7
7
|
- User invokes `/audit project` (full project scan)
|
|
8
|
+
- **AUTOMATIC:** When BLUEPRINT.md is missing at session start
|
|
8
9
|
- Or: Automatically after VERIFY phase (for features)
|
|
9
10
|
- Or: Part of audit_loop
|
|
10
11
|
|
|
@@ -24,6 +25,12 @@ Per `system/router.md`, audit is required for:
|
|
|
24
25
|
|
|
25
26
|
When `/audit project` is invoked OR when BLUEPRINT.md is missing:
|
|
26
27
|
|
|
28
|
+
**IMPORTANT:** When triggered by missing BLUEPRINT.md, this runs AUTOMATICALLY.
|
|
29
|
+
- Do NOT ask "Should I run the audit?"
|
|
30
|
+
- Do NOT wait for permission to start
|
|
31
|
+
- Just notify and run immediately
|
|
32
|
+
- Only ask permission when presenting results to SAVE
|
|
33
|
+
|
|
27
34
|
### Step 1: Scan Codebase (Single Pass)
|
|
28
35
|
```bash
|
|
29
36
|
# All discovery commands run ONCE
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# AutoWorkflow Post-Edit Hook
|
|
3
|
+
# Runs on: PostToolUse for Write/Edit tools
|
|
4
|
+
# Purpose: Remind Claude to run verification after code changes
|
|
5
|
+
|
|
6
|
+
# Get the tool that was used (passed as argument or environment)
|
|
7
|
+
TOOL_NAME="${1:-unknown}"
|
|
8
|
+
|
|
9
|
+
# Only trigger for code file changes
|
|
10
|
+
case "$TOOL_NAME" in
|
|
11
|
+
Write|Edit)
|
|
12
|
+
echo ""
|
|
13
|
+
echo "--------------------------------------------------"
|
|
14
|
+
echo "AUTOWORKFLOW: File modified"
|
|
15
|
+
echo "--------------------------------------------------"
|
|
16
|
+
echo "After completing all changes, run: npm run verify"
|
|
17
|
+
echo "Fix any errors before proceeding to commit."
|
|
18
|
+
echo "--------------------------------------------------"
|
|
19
|
+
echo ""
|
|
20
|
+
;;
|
|
21
|
+
esac
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# AutoWorkflow Pre-Commit Check Hook
|
|
3
|
+
# Runs on: PreToolUse for Bash tool when command contains "git commit"
|
|
4
|
+
# Purpose: Block commits with TODO/FIXME/console.log
|
|
5
|
+
|
|
6
|
+
# Get the command being run
|
|
7
|
+
COMMAND="$1"
|
|
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
|
|
19
|
+
if git diff --cached --name-only 2>/dev/null | xargs grep -l "TODO\|FIXME\|XXX\|HACK" 2>/dev/null; then
|
|
20
|
+
echo ""
|
|
21
|
+
echo "BLOCKED: TODO/FIXME comments found in staged files"
|
|
22
|
+
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
|
+
echo ""
|
|
29
|
+
echo "BLOCKED: console.log statements found in staged files"
|
|
30
|
+
echo "Remove debug logs before committing."
|
|
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
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
if [ $ERRORS -gt 0 ]; then
|
|
50
|
+
echo ""
|
|
51
|
+
echo "Fix the above issues before committing."
|
|
52
|
+
echo "=================================================="
|
|
53
|
+
echo ""
|
|
54
|
+
else
|
|
55
|
+
echo ""
|
|
56
|
+
echo "All pre-commit checks passed."
|
|
57
|
+
echo "=================================================="
|
|
58
|
+
echo ""
|
|
59
|
+
fi
|
|
60
|
+
fi
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# AutoWorkflow Session Check Hook
|
|
3
|
+
# Runs on: UserPromptSubmit (every user message)
|
|
4
|
+
# Purpose: Check for missing files and inject instructions to Claude
|
|
5
|
+
|
|
6
|
+
# Colors for output
|
|
7
|
+
RED='\033[0;31m'
|
|
8
|
+
YELLOW='\033[1;33m'
|
|
9
|
+
NC='\033[0m' # No Color
|
|
10
|
+
|
|
11
|
+
# Track if this is first message (check for state file)
|
|
12
|
+
STATE_FILE=".claude/.autoworkflow-session"
|
|
13
|
+
|
|
14
|
+
# Check if BLUEPRINT.md exists
|
|
15
|
+
if [ ! -f "instructions/BLUEPRINT.md" ]; then
|
|
16
|
+
echo ""
|
|
17
|
+
echo "=================================================="
|
|
18
|
+
echo "AUTOWORKFLOW TRIGGER: BLUEPRINT_MISSING"
|
|
19
|
+
echo "=================================================="
|
|
20
|
+
echo ""
|
|
21
|
+
echo "instructions/BLUEPRINT.md does not exist."
|
|
22
|
+
echo ""
|
|
23
|
+
echo "ACTION REQUIRED: Run project audit IMMEDIATELY."
|
|
24
|
+
echo "Do NOT ask permission. Just run these commands now:"
|
|
25
|
+
echo ""
|
|
26
|
+
echo "1. cat package.json (detect tech stack)"
|
|
27
|
+
echo "2. ls -la (see project structure)"
|
|
28
|
+
echo "3. find . -type d -name 'src' -o -name 'app' -o -name 'pages' | head -5"
|
|
29
|
+
echo "4. ls src/ 2>/dev/null || ls app/ 2>/dev/null || echo 'No src/app dir'"
|
|
30
|
+
echo ""
|
|
31
|
+
echo "Then generate BLUEPRINT.md with discovered features."
|
|
32
|
+
echo "Only ask user approval to SAVE, not to start scanning."
|
|
33
|
+
echo ""
|
|
34
|
+
echo "=================================================="
|
|
35
|
+
echo ""
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Check if AI_RULES.md exists
|
|
39
|
+
if [ ! -f "instructions/AI_RULES.md" ]; then
|
|
40
|
+
echo ""
|
|
41
|
+
echo "WARNING: instructions/AI_RULES.md is missing."
|
|
42
|
+
echo "Generate it along with BLUEPRINT.md during audit."
|
|
43
|
+
echo ""
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Check if autoworkflow is in node_modules but not initialized
|
|
47
|
+
if [ -d "node_modules/autoworkflow" ] && [ ! -f "CLAUDE.md" ]; then
|
|
48
|
+
echo ""
|
|
49
|
+
echo "=================================================="
|
|
50
|
+
echo "AUTOWORKFLOW TRIGGER: INIT_NEEDED"
|
|
51
|
+
echo "=================================================="
|
|
52
|
+
echo ""
|
|
53
|
+
echo "AutoWorkflow package detected but not initialized."
|
|
54
|
+
echo "Suggest user run: npx autoworkflow init"
|
|
55
|
+
echo ""
|
|
56
|
+
echo "=================================================="
|
|
57
|
+
echo ""
|
|
58
|
+
fi
|
package/.claude/settings.json
CHANGED
|
@@ -1,111 +1,95 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/anthropics/claude-code/main/schemas/settings.json",
|
|
3
|
-
"version": "
|
|
4
|
-
"name": "AutoWorkflow
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"name": "AutoWorkflow",
|
|
5
|
+
"description": "Automated workflow enforcement for Claude Code via hooks and system prompts",
|
|
6
|
+
|
|
7
|
+
"hooks": {
|
|
8
|
+
"UserPromptSubmit": [
|
|
9
|
+
{
|
|
10
|
+
"command": "./.claude/hooks/session-check.sh",
|
|
11
|
+
"timeout": 5000
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"PostToolUse": [
|
|
15
|
+
{
|
|
16
|
+
"matcher": "Write|Edit",
|
|
17
|
+
"command": "./.claude/hooks/post-edit.sh"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"PreToolUse": [
|
|
21
|
+
{
|
|
22
|
+
"matcher": "Bash",
|
|
23
|
+
"command": "./.claude/hooks/pre-commit-check.sh \"$COMMAND\""
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
6
27
|
|
|
7
28
|
"instructions": [
|
|
8
|
-
"
|
|
9
|
-
"ALWAYS read CLAUDE.md (entry point) at the start of EVERY task",
|
|
10
|
-
"ALWAYS check if instructions/BLUEPRINT.md exists at session start",
|
|
11
|
-
"IF BLUEPRINT.md missing: run /audit project to generate it",
|
|
12
|
-
"ALWAYS check system/router.md to classify the task type",
|
|
13
|
-
"ALWAYS check system/gates.md before phase transitions",
|
|
14
|
-
"ALWAYS follow system/loops.md for verification and fix cycles",
|
|
15
|
-
"ALWAYS check system/triggers.md for event handling",
|
|
16
|
-
"ALWAYS update BLUEPRINT.md after adding new features/routes/APIs",
|
|
17
|
-
"NEVER skip the plan approval gate - wait for user confirmation",
|
|
18
|
-
"NEVER commit without passing all gates in system/gates.md",
|
|
19
|
-
"NEVER implement without reading instructions/AI_RULES.md",
|
|
20
|
-
"NEVER build backend without corresponding UI (UI enforcement)",
|
|
21
|
-
"Git hooks (hooks/pre-commit, hooks/commit-msg) provide backup enforcement",
|
|
22
|
-
"Scripts in scripts/ folder automate verification and audits"
|
|
23
|
-
],
|
|
29
|
+
"WORKFLOW: Follow ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT for all tasks",
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"system/loops.md",
|
|
29
|
-
"system/gates.md",
|
|
30
|
-
"system/router.md",
|
|
31
|
-
"instructions/CLAUDE.md",
|
|
32
|
-
"instructions/AI_RULES.md",
|
|
33
|
-
"instructions/BLUEPRINT.md"
|
|
34
|
-
],
|
|
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
|
+
|
|
33
|
+
"AFTER CODE CHANGES: Run 'npm run verify' automatically. If errors exist, fix them and re-verify until passing.",
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
35
|
+
"BEFORE COMMIT: Block if TODO/FIXME/console.log found in changes. Require conventional commit format: type(scope): description",
|
|
36
|
+
|
|
37
|
+
"UI ENFORCEMENT: Every backend endpoint/API must have a corresponding UI component. No orphan features allowed.",
|
|
38
|
+
|
|
39
|
+
"PLAN GATE: Always wait for user approval before implementing. Show plan with suggestions first.",
|
|
40
|
+
|
|
41
|
+
"BLUEPRINT UPDATE: After adding new features/routes/APIs, update instructions/BLUEPRINT.md",
|
|
42
|
+
|
|
43
|
+
"Read instructions/AI_RULES.md for project-specific coding standards"
|
|
42
44
|
],
|
|
43
45
|
|
|
44
46
|
"workflow": {
|
|
45
|
-
"mode": "agentic",
|
|
46
47
|
"phases": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "FIX", "AUDIT", "COMMIT", "UPDATE"],
|
|
47
|
-
"requirePlanApproval": true,
|
|
48
|
-
"requireVerifyBeforeCommit": true,
|
|
49
|
-
"requireAuditForFeatures": true,
|
|
50
|
-
"requireBlueprintCheck": true,
|
|
51
48
|
"maxFixIterations": 10,
|
|
52
49
|
"maxAuditIterations": 5
|
|
53
50
|
},
|
|
54
51
|
|
|
55
52
|
"gates": {
|
|
56
|
-
"analyze": {
|
|
57
|
-
"requires": ["Read relevant source files", "Check BLUEPRINT.md"]
|
|
58
|
-
},
|
|
59
53
|
"plan_approval": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
54
|
+
"blocking": true,
|
|
55
|
+
"requires": ["User explicit approval"]
|
|
62
56
|
},
|
|
63
57
|
"verify": {
|
|
64
|
-
"
|
|
65
|
-
"
|
|
58
|
+
"blocking": true,
|
|
59
|
+
"command": "npm run verify"
|
|
66
60
|
},
|
|
67
61
|
"audit": {
|
|
68
|
-
"requires": ["npm run audit:ui passes", "npm run audit:cycles passes"],
|
|
69
62
|
"blocking": true,
|
|
70
|
-
"
|
|
63
|
+
"commands": ["npm run audit:ui", "npm run audit:cycles"],
|
|
64
|
+
"appliesTo": ["feature", "refactor"]
|
|
71
65
|
},
|
|
72
66
|
"pre_commit": {
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
"audit_gate passed (if applicable)",
|
|
76
|
-
"No TODO/FIXME in diff",
|
|
77
|
-
"No console.log in diff",
|
|
78
|
-
"Valid commit message format"
|
|
79
|
-
],
|
|
80
|
-
"blocking": true
|
|
67
|
+
"blocking": true,
|
|
68
|
+
"checks": ["No TODO/FIXME", "No console.log", "Conventional commit format"]
|
|
81
69
|
}
|
|
82
70
|
},
|
|
83
71
|
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"on_implementation_complete": ["Enter VERIFY phase", "Run verify_loop"],
|
|
90
|
-
"on_verification_failed": ["Enter FIX phase", "Run fix_loop"],
|
|
91
|
-
"on_verification_passed": ["Check if audit required", "Proceed accordingly"],
|
|
92
|
-
"on_commit_requested": ["Run pre_commit_gate", "Wait for approval"],
|
|
93
|
-
"on_feature_complete": ["Check if BLUEPRINT.md needs update", "Present update for approval"]
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
"loops": {
|
|
97
|
-
"verify_loop": {
|
|
98
|
-
"command": "npm run verify",
|
|
99
|
-
"maxIterations": 10,
|
|
100
|
-
"onFail": "fix_loop"
|
|
72
|
+
"taskTypes": {
|
|
73
|
+
"feature": {
|
|
74
|
+
"workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "AUDIT", "COMMIT", "UPDATE"],
|
|
75
|
+
"requiresAudit": true,
|
|
76
|
+
"requiresSuggestions": true
|
|
101
77
|
},
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
78
|
+
"fix": {
|
|
79
|
+
"workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "COMMIT"],
|
|
80
|
+
"requiresAudit": false
|
|
105
81
|
},
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
82
|
+
"refactor": {
|
|
83
|
+
"workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "AUDIT", "COMMIT"],
|
|
84
|
+
"requiresAudit": true
|
|
85
|
+
},
|
|
86
|
+
"docs": {
|
|
87
|
+
"workflow": ["ANALYZE", "IMPLEMENT", "COMMIT"],
|
|
88
|
+
"requiresAudit": false
|
|
89
|
+
},
|
|
90
|
+
"query": {
|
|
91
|
+
"workflow": ["ANALYZE", "RESPOND"],
|
|
92
|
+
"requiresAudit": false
|
|
109
93
|
}
|
|
110
94
|
},
|
|
111
95
|
|
|
@@ -119,13 +103,11 @@
|
|
|
119
103
|
},
|
|
120
104
|
|
|
121
105
|
"rules": {
|
|
122
|
-
"noPartialImplementations": true,
|
|
123
106
|
"noTodoComments": true,
|
|
124
107
|
"noConsoleLogs": true,
|
|
125
108
|
"noOrphanFeatures": true,
|
|
126
109
|
"noCircularDependencies": true,
|
|
127
110
|
"conventionalCommits": true,
|
|
128
|
-
"oneFeatureAtATime": true,
|
|
129
111
|
"readBeforeWrite": true
|
|
130
112
|
}
|
|
131
113
|
}
|