autoworkflow 3.5.0 → 3.6.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/post-edit.sh +190 -17
- package/.claude/hooks/pre-edit.sh +92 -0
- package/.claude/hooks/session-check.sh +11 -0
- package/.claude/settings.json +16 -0
- package/.claude/settings.local.json +4 -1
- package/README.md +39 -8
- package/package.json +1 -1
- package/system/triggers.md +105 -7
|
@@ -86,27 +86,42 @@ print_header() {
|
|
|
86
86
|
echo ""
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
#
|
|
90
|
-
|
|
89
|
+
# Detect project type
|
|
90
|
+
detect_project_type() {
|
|
91
|
+
if [ -f "package.json" ]; then
|
|
92
|
+
echo "node"
|
|
93
|
+
elif [ -f "composer.json" ]; then
|
|
94
|
+
echo "php"
|
|
95
|
+
elif [ -f "pyproject.toml" ] || [ -f "requirements.txt" ] || [ -f "setup.py" ]; then
|
|
96
|
+
echo "python"
|
|
97
|
+
elif [ -f "Cargo.toml" ]; then
|
|
98
|
+
echo "rust"
|
|
99
|
+
elif [ -f "go.mod" ]; then
|
|
100
|
+
echo "go"
|
|
101
|
+
elif [ -f "Gemfile" ]; then
|
|
102
|
+
echo "ruby"
|
|
103
|
+
elif [ -f "build.gradle" ] || [ -f "pom.xml" ]; then
|
|
104
|
+
echo "java"
|
|
105
|
+
else
|
|
106
|
+
echo "unknown"
|
|
107
|
+
fi
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
# Run verification for Node.js projects
|
|
111
|
+
run_verify_node() {
|
|
91
112
|
local has_verify=false
|
|
92
113
|
local has_typecheck=false
|
|
93
114
|
local has_lint=false
|
|
94
115
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
grep -q '"typecheck"' package.json 2>/dev/null && has_typecheck=true
|
|
99
|
-
grep -q '"lint"' package.json 2>/dev/null && has_lint=true
|
|
100
|
-
fi
|
|
116
|
+
grep -q '"verify"' package.json 2>/dev/null && has_verify=true
|
|
117
|
+
grep -q '"typecheck"' package.json 2>/dev/null && has_typecheck=true
|
|
118
|
+
grep -q '"lint"' package.json 2>/dev/null && has_lint=true
|
|
101
119
|
|
|
102
120
|
if [ "$has_verify" = true ]; then
|
|
103
121
|
echo -e "${CYAN}Running:${NC} npm run verify"
|
|
104
122
|
echo ""
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
else
|
|
108
|
-
return 1
|
|
109
|
-
fi
|
|
123
|
+
npm run verify 2>&1
|
|
124
|
+
return $?
|
|
110
125
|
elif [ "$has_typecheck" = true ] || [ "$has_lint" = true ]; then
|
|
111
126
|
local exit_code=0
|
|
112
127
|
|
|
@@ -126,11 +141,169 @@ run_verify() {
|
|
|
126
141
|
fi
|
|
127
142
|
|
|
128
143
|
return $exit_code
|
|
129
|
-
else
|
|
130
|
-
echo -e "${YELLOW}⚠${NC} No verify/typecheck/lint scripts found in package.json"
|
|
131
|
-
echo " Skipping verification."
|
|
132
|
-
return 0
|
|
133
144
|
fi
|
|
145
|
+
return 0
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
# Run verification for PHP projects
|
|
149
|
+
run_verify_php() {
|
|
150
|
+
local exit_code=0
|
|
151
|
+
|
|
152
|
+
# Check for PHPStan
|
|
153
|
+
if [ -f "phpstan.neon" ] || [ -f "phpstan.neon.dist" ] || grep -q '"phpstan"' composer.json 2>/dev/null; then
|
|
154
|
+
echo -e "${CYAN}Running:${NC} ./vendor/bin/phpstan analyse"
|
|
155
|
+
if ! ./vendor/bin/phpstan analyse 2>&1; then
|
|
156
|
+
exit_code=1
|
|
157
|
+
fi
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Check for PHP CS Fixer or PHP_CodeSniffer
|
|
161
|
+
if [ -f ".php-cs-fixer.php" ] || [ -f ".php-cs-fixer.dist.php" ]; then
|
|
162
|
+
echo ""
|
|
163
|
+
echo -e "${CYAN}Running:${NC} ./vendor/bin/php-cs-fixer fix --dry-run --diff"
|
|
164
|
+
if ! ./vendor/bin/php-cs-fixer fix --dry-run --diff 2>&1; then
|
|
165
|
+
exit_code=1
|
|
166
|
+
fi
|
|
167
|
+
elif [ -f "phpcs.xml" ] || [ -f "phpcs.xml.dist" ]; then
|
|
168
|
+
echo ""
|
|
169
|
+
echo -e "${CYAN}Running:${NC} ./vendor/bin/phpcs"
|
|
170
|
+
if ! ./vendor/bin/phpcs 2>&1; then
|
|
171
|
+
exit_code=1
|
|
172
|
+
fi
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
# Check for composer scripts
|
|
176
|
+
if grep -q '"test"' composer.json 2>/dev/null; then
|
|
177
|
+
echo ""
|
|
178
|
+
echo -e "${CYAN}Running:${NC} composer test"
|
|
179
|
+
if ! composer test 2>&1; then
|
|
180
|
+
exit_code=1
|
|
181
|
+
fi
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
if [ $exit_code -eq 0 ] && ! grep -q '"phpstan"' composer.json 2>/dev/null && ! [ -f ".php-cs-fixer.php" ] && ! [ -f "phpcs.xml" ]; then
|
|
185
|
+
echo -e "${YELLOW}⚠${NC} No PHP verification tools detected (PHPStan, PHP-CS-Fixer, PHPCS)"
|
|
186
|
+
echo " Consider adding: composer require --dev phpstan/phpstan"
|
|
187
|
+
fi
|
|
188
|
+
|
|
189
|
+
return $exit_code
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
# Run verification for Python projects
|
|
193
|
+
run_verify_python() {
|
|
194
|
+
local exit_code=0
|
|
195
|
+
|
|
196
|
+
# Check for mypy
|
|
197
|
+
if [ -f "mypy.ini" ] || [ -f "setup.cfg" ] || [ -f "pyproject.toml" ]; then
|
|
198
|
+
if command -v mypy &> /dev/null; then
|
|
199
|
+
echo -e "${CYAN}Running:${NC} mypy ."
|
|
200
|
+
if ! mypy . 2>&1; then
|
|
201
|
+
exit_code=1
|
|
202
|
+
fi
|
|
203
|
+
fi
|
|
204
|
+
fi
|
|
205
|
+
|
|
206
|
+
# Check for ruff or flake8
|
|
207
|
+
if command -v ruff &> /dev/null; then
|
|
208
|
+
echo ""
|
|
209
|
+
echo -e "${CYAN}Running:${NC} ruff check ."
|
|
210
|
+
if ! ruff check . 2>&1; then
|
|
211
|
+
exit_code=1
|
|
212
|
+
fi
|
|
213
|
+
elif command -v flake8 &> /dev/null; then
|
|
214
|
+
echo ""
|
|
215
|
+
echo -e "${CYAN}Running:${NC} flake8 ."
|
|
216
|
+
if ! flake8 . 2>&1; then
|
|
217
|
+
exit_code=1
|
|
218
|
+
fi
|
|
219
|
+
fi
|
|
220
|
+
|
|
221
|
+
if [ $exit_code -eq 0 ] && ! command -v mypy &> /dev/null && ! command -v ruff &> /dev/null; then
|
|
222
|
+
echo -e "${YELLOW}⚠${NC} No Python verification tools detected (mypy, ruff, flake8)"
|
|
223
|
+
echo " Consider adding: pip install mypy ruff"
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
return $exit_code
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
# Run verification for Rust projects
|
|
230
|
+
run_verify_rust() {
|
|
231
|
+
local exit_code=0
|
|
232
|
+
|
|
233
|
+
echo -e "${CYAN}Running:${NC} cargo check"
|
|
234
|
+
if ! cargo check 2>&1; then
|
|
235
|
+
exit_code=1
|
|
236
|
+
fi
|
|
237
|
+
|
|
238
|
+
echo ""
|
|
239
|
+
echo -e "${CYAN}Running:${NC} cargo clippy"
|
|
240
|
+
if ! cargo clippy -- -D warnings 2>&1; then
|
|
241
|
+
exit_code=1
|
|
242
|
+
fi
|
|
243
|
+
|
|
244
|
+
return $exit_code
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
# Run verification for Go projects
|
|
248
|
+
run_verify_go() {
|
|
249
|
+
local exit_code=0
|
|
250
|
+
|
|
251
|
+
echo -e "${CYAN}Running:${NC} go build ./..."
|
|
252
|
+
if ! go build ./... 2>&1; then
|
|
253
|
+
exit_code=1
|
|
254
|
+
fi
|
|
255
|
+
|
|
256
|
+
echo ""
|
|
257
|
+
echo -e "${CYAN}Running:${NC} go vet ./..."
|
|
258
|
+
if ! go vet ./... 2>&1; then
|
|
259
|
+
exit_code=1
|
|
260
|
+
fi
|
|
261
|
+
|
|
262
|
+
if command -v golangci-lint &> /dev/null; then
|
|
263
|
+
echo ""
|
|
264
|
+
echo -e "${CYAN}Running:${NC} golangci-lint run"
|
|
265
|
+
if ! golangci-lint run 2>&1; then
|
|
266
|
+
exit_code=1
|
|
267
|
+
fi
|
|
268
|
+
fi
|
|
269
|
+
|
|
270
|
+
return $exit_code
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
# Run verification based on project type
|
|
274
|
+
run_verify() {
|
|
275
|
+
local project_type=$(detect_project_type)
|
|
276
|
+
|
|
277
|
+
echo -e "${DIM}Detected project type: ${project_type}${NC}"
|
|
278
|
+
echo ""
|
|
279
|
+
|
|
280
|
+
case "$project_type" in
|
|
281
|
+
node)
|
|
282
|
+
run_verify_node
|
|
283
|
+
return $?
|
|
284
|
+
;;
|
|
285
|
+
php)
|
|
286
|
+
run_verify_php
|
|
287
|
+
return $?
|
|
288
|
+
;;
|
|
289
|
+
python)
|
|
290
|
+
run_verify_python
|
|
291
|
+
return $?
|
|
292
|
+
;;
|
|
293
|
+
rust)
|
|
294
|
+
run_verify_rust
|
|
295
|
+
return $?
|
|
296
|
+
;;
|
|
297
|
+
go)
|
|
298
|
+
run_verify_go
|
|
299
|
+
return $?
|
|
300
|
+
;;
|
|
301
|
+
*)
|
|
302
|
+
echo -e "${YELLOW}⚠${NC} Unknown project type - no verification available"
|
|
303
|
+
echo " Supported: Node.js, PHP, Python, Rust, Go"
|
|
304
|
+
return 0
|
|
305
|
+
;;
|
|
306
|
+
esac
|
|
134
307
|
}
|
|
135
308
|
|
|
136
309
|
# Main execution
|
|
@@ -22,6 +22,9 @@ STATE_DIR=".claude/.autoworkflow"
|
|
|
22
22
|
PHASE_FILE="$STATE_DIR/phase"
|
|
23
23
|
TASK_TYPE_FILE="$STATE_DIR/task-type"
|
|
24
24
|
PLAN_APPROVED_FILE="$STATE_DIR/plan-approved"
|
|
25
|
+
SUGGESTIONS_SHOWN_FILE="$STATE_DIR/suggestions-shown"
|
|
26
|
+
CURRENT_TURN_EDITS_FILE="$STATE_DIR/current-turn-edits"
|
|
27
|
+
SELECTED_ITEMS_FILE="$STATE_DIR/selected-items"
|
|
25
28
|
|
|
26
29
|
# Get current phase
|
|
27
30
|
get_phase() {
|
|
@@ -50,6 +53,41 @@ is_plan_approved() {
|
|
|
50
53
|
return 1
|
|
51
54
|
}
|
|
52
55
|
|
|
56
|
+
# Check if suggestions were shown (for feature tasks)
|
|
57
|
+
suggestions_shown() {
|
|
58
|
+
if [ -f "$SUGGESTIONS_SHOWN_FILE" ]; then
|
|
59
|
+
local status=$(cat "$SUGGESTIONS_SHOWN_FILE")
|
|
60
|
+
[ "$status" = "true" ] && return 0
|
|
61
|
+
fi
|
|
62
|
+
return 1
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
# Get number of edits in current turn
|
|
66
|
+
get_turn_edit_count() {
|
|
67
|
+
if [ -f "$CURRENT_TURN_EDITS_FILE" ]; then
|
|
68
|
+
cat "$CURRENT_TURN_EDITS_FILE"
|
|
69
|
+
else
|
|
70
|
+
echo "0"
|
|
71
|
+
fi
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Increment turn edit count
|
|
75
|
+
increment_turn_edits() {
|
|
76
|
+
local current=$(get_turn_edit_count)
|
|
77
|
+
local next=$((current + 1))
|
|
78
|
+
echo "$next" > "$CURRENT_TURN_EDITS_FILE"
|
|
79
|
+
echo "$next"
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
# Check if user has selected items to implement
|
|
83
|
+
has_selected_items() {
|
|
84
|
+
if [ -f "$SELECTED_ITEMS_FILE" ]; then
|
|
85
|
+
local content=$(cat "$SELECTED_ITEMS_FILE")
|
|
86
|
+
[ -n "$content" ] && return 0
|
|
87
|
+
fi
|
|
88
|
+
return 1
|
|
89
|
+
}
|
|
90
|
+
|
|
53
91
|
# Check if task type requires approval
|
|
54
92
|
requires_approval() {
|
|
55
93
|
local task_type="$1"
|
|
@@ -122,6 +160,60 @@ main() {
|
|
|
122
160
|
fi
|
|
123
161
|
fi
|
|
124
162
|
|
|
163
|
+
# CHECK: Suggestions must be shown for feature tasks before implementing
|
|
164
|
+
if [ "$task_type" = "feature" ] && [ "$phase" = "IMPLEMENT" ]; then
|
|
165
|
+
if ! suggestions_shown; then
|
|
166
|
+
echo ""
|
|
167
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
168
|
+
echo -e "${RED}${BOLD}⛔ AUTOWORKFLOW: SUGGESTIONS REQUIRED${NC}"
|
|
169
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
170
|
+
echo ""
|
|
171
|
+
echo -e "${CYAN}Task Type:${NC} feature"
|
|
172
|
+
echo ""
|
|
173
|
+
echo "For feature tasks, you MUST show 3-tier suggestions first:"
|
|
174
|
+
echo ""
|
|
175
|
+
echo " 🔴 Required - Must implement"
|
|
176
|
+
echo " 🟡 Recommended - Should implement"
|
|
177
|
+
echo " 🟢 Optional - Nice to have"
|
|
178
|
+
echo ""
|
|
179
|
+
echo "Show suggestions, let user select items, THEN implement."
|
|
180
|
+
echo ""
|
|
181
|
+
echo -e "${DIM}To mark suggestions shown: echo 'true' > $SUGGESTIONS_SHOWN_FILE${NC}"
|
|
182
|
+
echo ""
|
|
183
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
184
|
+
echo ""
|
|
185
|
+
exit 1
|
|
186
|
+
fi
|
|
187
|
+
fi
|
|
188
|
+
|
|
189
|
+
# CHECK: One fix at a time (max 1 edit per turn in FIX phase)
|
|
190
|
+
if [ "$phase" = "FIX" ]; then
|
|
191
|
+
local edit_count=$(get_turn_edit_count)
|
|
192
|
+
if [ "$edit_count" -ge 1 ]; then
|
|
193
|
+
echo ""
|
|
194
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
195
|
+
echo -e "${YELLOW}${BOLD}⚠ AUTOWORKFLOW: ONE FIX AT A TIME${NC}"
|
|
196
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
197
|
+
echo ""
|
|
198
|
+
echo -e "${CYAN}Edits this turn:${NC} $edit_count"
|
|
199
|
+
echo ""
|
|
200
|
+
echo "Fix ONE issue at a time, then verify."
|
|
201
|
+
echo ""
|
|
202
|
+
echo "This ensures:"
|
|
203
|
+
echo " 1. Easier to track what changed"
|
|
204
|
+
echo " 2. Errors caught early"
|
|
205
|
+
echo " 3. User can review incrementally"
|
|
206
|
+
echo ""
|
|
207
|
+
echo "Wait for verification to complete before next fix."
|
|
208
|
+
echo ""
|
|
209
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
210
|
+
echo ""
|
|
211
|
+
exit 1
|
|
212
|
+
fi
|
|
213
|
+
# Track this edit
|
|
214
|
+
increment_turn_edits > /dev/null
|
|
215
|
+
fi
|
|
216
|
+
|
|
125
217
|
# All checks passed, allow edit
|
|
126
218
|
exit 0
|
|
127
219
|
}
|
|
@@ -31,6 +31,8 @@ TASK_DESCRIPTION_FILE="$STATE_DIR/task-description"
|
|
|
31
31
|
PLAN_APPROVED_FILE="$STATE_DIR/plan-approved"
|
|
32
32
|
CHANGED_FILES_FILE="$STATE_DIR/changed-files"
|
|
33
33
|
SESSION_RESUMED_FILE="$STATE_DIR/session-resumed"
|
|
34
|
+
CURRENT_TURN_EDITS_FILE="$STATE_DIR/current-turn-edits"
|
|
35
|
+
SUGGESTIONS_SHOWN_FILE="$STATE_DIR/suggestions-shown"
|
|
34
36
|
|
|
35
37
|
# Check for resumable session state
|
|
36
38
|
check_session_resume() {
|
|
@@ -395,6 +397,12 @@ show_state() {
|
|
|
395
397
|
fi
|
|
396
398
|
}
|
|
397
399
|
|
|
400
|
+
# Reset turn-based state (called each user turn)
|
|
401
|
+
reset_turn_state() {
|
|
402
|
+
# Reset edit counter for this turn
|
|
403
|
+
echo "0" > "$CURRENT_TURN_EDITS_FILE"
|
|
404
|
+
}
|
|
405
|
+
|
|
398
406
|
# Main execution
|
|
399
407
|
main() {
|
|
400
408
|
local is_new_session=false
|
|
@@ -404,6 +412,9 @@ main() {
|
|
|
404
412
|
is_new_session=true
|
|
405
413
|
fi
|
|
406
414
|
|
|
415
|
+
# Reset turn state on each user message
|
|
416
|
+
reset_turn_state
|
|
417
|
+
|
|
407
418
|
# Check if init is needed (package installed but not set up)
|
|
408
419
|
if check_init_needed; then
|
|
409
420
|
exit 0
|
package/.claude/settings.json
CHANGED
|
@@ -78,6 +78,22 @@
|
|
|
78
78
|
"ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → UPDATE",
|
|
79
79
|
"```",
|
|
80
80
|
"",
|
|
81
|
+
"### CRITICAL: ONE FIX AT A TIME RULE",
|
|
82
|
+
"**This is NON-NEGOTIABLE and applies to ALL projects (TypeScript, PHP, Python, Go, Rust, etc.):**",
|
|
83
|
+
"",
|
|
84
|
+
"1. **NEVER batch multiple fixes** - Fix ONE issue, verify, then move to next",
|
|
85
|
+
"2. **MUST show 3-tier suggestions FIRST** before any fix:",
|
|
86
|
+
" - 🔴 Required (must fix)",
|
|
87
|
+
" - 🟡 Recommended (should fix)",
|
|
88
|
+
" - 🟢 Optional (nice to have)",
|
|
89
|
+
"3. **MUST WAIT for user to select** which items to implement",
|
|
90
|
+
"4. **After user selects**, implement ONE item at a time",
|
|
91
|
+
"5. **Verify after EACH fix** before moving to the next",
|
|
92
|
+
"",
|
|
93
|
+
"❌ WRONG: 'I found 14 issues, let me fix them all'",
|
|
94
|
+
"✅ RIGHT: 'I found 14 issues. Here are my suggestions: [show tiers]. Which would you like me to fix first?'",
|
|
95
|
+
"",
|
|
96
|
+
"",
|
|
81
97
|
"### Skill Loading (CRITICAL)",
|
|
82
98
|
"When executing ANY command from .claude/commands/:",
|
|
83
99
|
"1. Read the command's YAML frontmatter",
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"Bash(git commit -m \"$\\(cat <<''EOF''\nfeat\\(hooks\\): implement full auto-trigger system with blocking gates\n\n- Add 7 new hook scripts for workflow automation:\n - session-check.sh: Init, blueprint check, task classification\n - post-edit.sh: Auto-verify with loop tracking \\(max 10 iterations\\)\n - pre-tool-router.sh: Route Bash commands to appropriate checks\n - pre-commit-check.sh: All 7 gate checks with blocking \\(exit 1\\)\n - phase-transition.sh: State management and gate enforcement\n - audit-runner.sh: UI enforcement + circular dependency checks\n - blueprint-generator.sh: Auto-scan project structure\n\n- Pre-commit gate now checks:\n - TypeScript errors\n - ESLint warnings\n - TODO/FIXME comments\n - console.log statements\n - Orphan features \\(UI enforcement\\)\n - Circular dependencies\n - Conventional commit format\n\n- State tracking in .claude/.autoworkflow/:\n - phase, task-type, verify-iteration, audit-iteration\n - verify-status, audit-status, plan-approved\n\n- Updated CLAUDE.md files with:\n - Slash commands table\n - Hook files reference\n - Hook integration section\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
|
|
14
14
|
"Bash(git commit:*)",
|
|
15
15
|
"Bash(unzip:*)",
|
|
16
|
-
"Bash(node:*)"
|
|
16
|
+
"Bash(node:*)",
|
|
17
|
+
"Bash(echo:*)",
|
|
18
|
+
"Bash(ls:*)",
|
|
19
|
+
"Bash(npm view:*)"
|
|
17
20
|
]
|
|
18
21
|
}
|
|
19
22
|
}
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Automated workflow enforcement for Claude Code via hooks and system prompts.
|
|
4
4
|
|
|
5
|
-
**v3.
|
|
5
|
+
**v3.6.0** - Multi-language support, one-fix-at-a-time enforcement, suggestions gate.
|
|
6
6
|
|
|
7
7
|
When you use Claude Code with AutoWorkflow, hooks automatically enforce workflow phases, block unauthorized edits, and guide Claude through a structured process for all coding tasks.
|
|
8
8
|
|
|
@@ -21,6 +21,34 @@ Options:
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
+
## What's New in v3.6.0
|
|
25
|
+
|
|
26
|
+
### Multi-Language Project Support
|
|
27
|
+
Automatic verification for any project type:
|
|
28
|
+
|
|
29
|
+
| Project Type | Detection | Verification |
|
|
30
|
+
|--------------|-----------|--------------|
|
|
31
|
+
| Node.js | `package.json` | TypeScript + ESLint |
|
|
32
|
+
| PHP | `composer.json` | PHPStan, PHP-CS-Fixer |
|
|
33
|
+
| Python | `pyproject.toml` | mypy, ruff, flake8 |
|
|
34
|
+
| Rust | `Cargo.toml` | cargo check + clippy |
|
|
35
|
+
| Go | `go.mod` | go vet + golangci-lint |
|
|
36
|
+
|
|
37
|
+
### One-Fix-At-A-Time Enforcement
|
|
38
|
+
Claude MUST fix issues incrementally:
|
|
39
|
+
- ❌ "I found 14 issues, fixing them all now..."
|
|
40
|
+
- ✅ "I found 14 issues. Here are my suggestions. Which first?"
|
|
41
|
+
|
|
42
|
+
### 3-Tier Suggestions Gate
|
|
43
|
+
For feature tasks, Claude MUST show categorized suggestions:
|
|
44
|
+
- 🔴 **Required** - Must implement
|
|
45
|
+
- 🟡 **Recommended** - Should implement
|
|
46
|
+
- 🟢 **Optional** - Nice to have
|
|
47
|
+
|
|
48
|
+
Hook blocks implementation until suggestions are shown and user selects items.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
24
52
|
## What's New in v3.5.0
|
|
25
53
|
|
|
26
54
|
### Hook-Based Enforcement (Not Just Instructions)
|
|
@@ -60,10 +88,11 @@ guardrails:
|
|
|
60
88
|
┌─────────────────────────────────────────────────────────────┐
|
|
61
89
|
│ HOOKS (Automatic) │
|
|
62
90
|
│ │
|
|
63
|
-
│ UserPromptSubmit → session-check.sh (resume,
|
|
64
|
-
│ PreToolUse → pre-edit.sh (
|
|
91
|
+
│ UserPromptSubmit → session-check.sh (resume, turn reset) │
|
|
92
|
+
│ PreToolUse → pre-edit.sh (3 gates: approval, │
|
|
93
|
+
│ suggestions, one-fix-at-a-time) │
|
|
65
94
|
│ PreToolUse → pre-commit-check.sh (BLOCKS bad code) │
|
|
66
|
-
│ PostToolUse → post-edit.sh (
|
|
95
|
+
│ PostToolUse → post-edit.sh (multi-lang verify) │
|
|
67
96
|
│ PostToolUse → post-commit.sh (BLUEPRINT reminder) │
|
|
68
97
|
│ │
|
|
69
98
|
│ Hooks ENFORCE workflow - they physically block actions │
|
|
@@ -112,9 +141,9 @@ ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → U
|
|
|
112
141
|
|
|
113
142
|
| Hook | Trigger | Action |
|
|
114
143
|
|------|---------|--------|
|
|
115
|
-
| `session-check.sh` | Every user message | Resume
|
|
116
|
-
| `pre-edit.sh` | Before Write/Edit | **BLOCK if
|
|
117
|
-
| `post-edit.sh` | After Write/Edit |
|
|
144
|
+
| `session-check.sh` | Every user message | Resume session, reset turn counter |
|
|
145
|
+
| `pre-edit.sh` | Before Write/Edit | **BLOCK** if: no approval, no suggestions, or multiple fixes |
|
|
146
|
+
| `post-edit.sh` | After Write/Edit | Detect project type, run verification |
|
|
118
147
|
| `pre-commit-check.sh` | Before git commit | **BLOCK if TODO/console.log/errors** |
|
|
119
148
|
| `post-commit.sh` | After git commit | Remind to update BLUEPRINT.md |
|
|
120
149
|
|
|
@@ -125,7 +154,9 @@ ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT → U
|
|
|
125
154
|
| Gate | Blocks If | Enforced By |
|
|
126
155
|
|------|-----------|-------------|
|
|
127
156
|
| Plan Approval | User hasn't approved the plan | `pre-edit.sh` (exit 1) |
|
|
128
|
-
|
|
|
157
|
+
| Suggestions | Feature task without 3-tier suggestions shown | `pre-edit.sh` (exit 1) |
|
|
158
|
+
| One-Fix-At-A-Time | Multiple edits in FIX phase per turn | `pre-edit.sh` (exit 1) |
|
|
159
|
+
| Verify | TypeScript/ESLint/language-specific errors | `post-edit.sh` loop |
|
|
129
160
|
| Audit | Orphan features or circular dependencies | Required before commit |
|
|
130
161
|
| Pre-Commit | TODO/FIXME, console.log, bad format | `pre-commit-check.sh` (exit 1) |
|
|
131
162
|
|
package/package.json
CHANGED
package/system/triggers.md
CHANGED
|
@@ -13,11 +13,14 @@
|
|
|
13
13
|
|---------|-------------|-------|
|
|
14
14
|
| `on:conversation_start` | `session-check.sh` | UserPromptSubmit |
|
|
15
15
|
| `on:session_resume` | `session-check.sh` | UserPromptSubmit |
|
|
16
|
+
| `on:turn_start` | `session-check.sh` | UserPromptSubmit |
|
|
16
17
|
| `on:blueprint_missing` | `session-check.sh` + `blueprint-generator.sh` | UserPromptSubmit |
|
|
17
18
|
| `on:init_needed` | `session-check.sh` | UserPromptSubmit |
|
|
18
19
|
| `on:task_received` | `session-check.sh` | UserPromptSubmit |
|
|
19
20
|
| `on:phase_transition` | `phase-transition.sh` | Manual call |
|
|
20
21
|
| `on:pre_implementation_check` | `pre-edit.sh` | PreToolUse (Write\|Edit) |
|
|
22
|
+
| `on:suggestions_required` | `pre-edit.sh` | PreToolUse (Write\|Edit) |
|
|
23
|
+
| `on:one_fix_at_a_time` | `pre-edit.sh` | PreToolUse (Write\|Edit) |
|
|
21
24
|
| `on:implementation_complete` | `post-edit.sh` | PostToolUse (Write\|Edit) |
|
|
22
25
|
| `on:verification_failed` | `post-edit.sh` | PostToolUse (Write\|Edit) |
|
|
23
26
|
| `on:verification_passed` | `post-edit.sh` | PostToolUse (Write\|Edit) |
|
|
@@ -44,7 +47,10 @@ All workflow state is stored in `.claude/.autoworkflow/`:
|
|
|
44
47
|
├── plan-approved # Plan approval status (true/false)
|
|
45
48
|
├── changed-files # List of modified files
|
|
46
49
|
├── blueprint-checked # Blueprint check done flag
|
|
47
|
-
|
|
50
|
+
├── session-resumed # Session resume prompt shown flag
|
|
51
|
+
├── suggestions-shown # 3-tier suggestions displayed (true/false)
|
|
52
|
+
├── current-turn-edits # Number of edits in current user turn
|
|
53
|
+
└── selected-items # User-selected items to implement
|
|
48
54
|
```
|
|
49
55
|
|
|
50
56
|
---
|
|
@@ -172,6 +178,83 @@ Required workflow:
|
|
|
172
178
|
|
|
173
179
|
---
|
|
174
180
|
|
|
181
|
+
### `on:suggestions_required`
|
|
182
|
+
|
|
183
|
+
**When:** Claude attempts to implement a feature without showing suggestions
|
|
184
|
+
**Hook:** `.claude/hooks/pre-edit.sh`
|
|
185
|
+
**Event:** `PreToolUse` for `Write|Edit`
|
|
186
|
+
|
|
187
|
+
**Purpose:** ENFORCE 3-tier suggestions for feature tasks
|
|
188
|
+
|
|
189
|
+
**Gate Check:**
|
|
190
|
+
1. Check if task type is `feature`
|
|
191
|
+
2. Check if phase is `IMPLEMENT`
|
|
192
|
+
3. Check if `suggestions-shown` is "true"
|
|
193
|
+
4. If NOT → **BLOCK the edit** (exit code 1)
|
|
194
|
+
|
|
195
|
+
**Output on BLOCK:**
|
|
196
|
+
```
|
|
197
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
198
|
+
⛔ AUTOWORKFLOW: SUGGESTIONS REQUIRED
|
|
199
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
200
|
+
|
|
201
|
+
Task Type: feature
|
|
202
|
+
|
|
203
|
+
For feature tasks, you MUST show 3-tier suggestions first:
|
|
204
|
+
|
|
205
|
+
🔴 Required - Must implement
|
|
206
|
+
🟡 Recommended - Should implement
|
|
207
|
+
🟢 Optional - Nice to have
|
|
208
|
+
|
|
209
|
+
Show suggestions, let user select items, THEN implement.
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Required Workflow:**
|
|
213
|
+
1. Analyze codebase and identify issues/improvements
|
|
214
|
+
2. Show categorized suggestions (Required/Recommended/Optional)
|
|
215
|
+
3. Wait for user to select items
|
|
216
|
+
4. Set `suggestions-shown` to "true"
|
|
217
|
+
5. THEN implement ONE item at a time
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### `on:one_fix_at_a_time`
|
|
222
|
+
|
|
223
|
+
**When:** Claude attempts multiple edits in FIX phase during single turn
|
|
224
|
+
**Hook:** `.claude/hooks/pre-edit.sh`
|
|
225
|
+
**Event:** `PreToolUse` for `Write|Edit`
|
|
226
|
+
|
|
227
|
+
**Purpose:** ENFORCE one fix per turn
|
|
228
|
+
|
|
229
|
+
**Gate Check:**
|
|
230
|
+
1. Check if phase is `FIX`
|
|
231
|
+
2. Check `current-turn-edits` count
|
|
232
|
+
3. If count >= 1 → **BLOCK additional edits** (exit code 1)
|
|
233
|
+
4. If count < 1 → Increment counter, allow edit
|
|
234
|
+
|
|
235
|
+
**Output on BLOCK:**
|
|
236
|
+
```
|
|
237
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
238
|
+
⚠ AUTOWORKFLOW: ONE FIX AT A TIME
|
|
239
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
240
|
+
|
|
241
|
+
Edits this turn: 1
|
|
242
|
+
|
|
243
|
+
Fix ONE issue at a time, then verify.
|
|
244
|
+
|
|
245
|
+
This ensures:
|
|
246
|
+
1. Easier to track what changed
|
|
247
|
+
2. Errors caught early
|
|
248
|
+
3. User can review incrementally
|
|
249
|
+
|
|
250
|
+
Wait for verification to complete before next fix.
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Reset Condition:**
|
|
254
|
+
- Counter resets on each new UserPromptSubmit (session-check.sh)
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
175
258
|
### `on:blueprint_missing`
|
|
176
259
|
|
|
177
260
|
**When:** BLUEPRINT.md does not exist at session start
|
|
@@ -268,11 +351,24 @@ Required workflow:
|
|
|
268
351
|
**Event:** `PostToolUse` for `Write|Edit`
|
|
269
352
|
|
|
270
353
|
**Actions:**
|
|
271
|
-
1.
|
|
272
|
-
2.
|
|
273
|
-
3.
|
|
274
|
-
4.
|
|
275
|
-
5. If
|
|
354
|
+
1. Detect project type (multi-language support)
|
|
355
|
+
2. Enter VERIFY phase automatically
|
|
356
|
+
3. Run appropriate verification commands
|
|
357
|
+
4. Track iteration count (max 10)
|
|
358
|
+
5. If PASS → Reset counter, proceed to AUDIT or COMMIT
|
|
359
|
+
6. If FAIL → Enter FIX phase, report errors
|
|
360
|
+
|
|
361
|
+
**Multi-Language Support:**
|
|
362
|
+
|
|
363
|
+
| Project Type | Detection | Verification Commands |
|
|
364
|
+
|--------------|-----------|----------------------|
|
|
365
|
+
| Node.js | `package.json` | `npm run verify` or `npm run typecheck && npm run lint` |
|
|
366
|
+
| PHP | `composer.json` | PHPStan, PHP-CS-Fixer, PHPCS |
|
|
367
|
+
| Python | `pyproject.toml`, `requirements.txt` | mypy, ruff, flake8 |
|
|
368
|
+
| Rust | `Cargo.toml` | `cargo check`, `cargo clippy` |
|
|
369
|
+
| Go | `go.mod` | `go build`, `go vet`, golangci-lint |
|
|
370
|
+
| Ruby | `Gemfile` | Rubocop |
|
|
371
|
+
| Java | `build.gradle`, `pom.xml` | Checkstyle, SpotBugs |
|
|
276
372
|
|
|
277
373
|
**Output:**
|
|
278
374
|
```
|
|
@@ -280,7 +376,9 @@ Required workflow:
|
|
|
280
376
|
AUTOWORKFLOW: VERIFY LOOP (Iteration 1/10)
|
|
281
377
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
282
378
|
|
|
283
|
-
|
|
379
|
+
Detected project type: php
|
|
380
|
+
|
|
381
|
+
Running: ./vendor/bin/phpstan analyse
|
|
284
382
|
|
|
285
383
|
✅ VERIFICATION PASSED
|
|
286
384
|
```
|