autoworkflow 2.2.2 → 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.
@@ -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,65 @@
1
+ #!/bin/bash
2
+ # AutoWorkflow Pre-Commit Check Hook
3
+ # Runs on: PreToolUse for Bash tool
4
+ # Purpose: Check for issues before commands execute
5
+
6
+ # Check for TODO/FIXME in staged files
7
+ check_staged_todos() {
8
+ if git diff --cached --name-only 2>/dev/null | xargs grep -l "TODO\|FIXME\|XXX\|HACK" 2>/dev/null; then
9
+ echo ""
10
+ echo "=================================================="
11
+ echo "AUTOWORKFLOW: TODO/FIXME DETECTED"
12
+ echo "=================================================="
13
+ echo ""
14
+ echo "Found TODO/FIXME comments in staged files."
15
+ echo "Remove all TODO/FIXME comments before committing."
16
+ echo ""
17
+ echo "=================================================="
18
+ return 1
19
+ fi
20
+ return 0
21
+ }
22
+
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
26
+ echo ""
27
+ echo "=================================================="
28
+ echo "AUTOWORKFLOW: CONSOLE.LOG DETECTED"
29
+ echo "=================================================="
30
+ echo ""
31
+ echo "Found console.log statements in staged files."
32
+ echo "Remove debug logs before committing."
33
+ echo ""
34
+ echo "=================================================="
35
+ return 1
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))
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
@@ -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
@@ -1,111 +1,107 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/anthropics/claude-code/main/schemas/settings.json",
3
- "version": "1.0.0",
4
- "name": "AutoWorkflow - Full Architecture",
5
- "description": "System prompt layer that controls Claude's workflow with triggers, loops, and gates",
3
+ "version": "2.0.0",
4
+ "name": "AutoWorkflow",
5
+ "description": "Automated workflow enforcement for Claude Code via hooks and system prompts",
6
6
 
7
- "instructions": [
8
- "IF autoworkflow in node_modules but CLAUDE.md missing: suggest running /init",
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
- ],
24
-
25
- "requiredFiles": [
26
- "CLAUDE.md",
27
- "system/triggers.md",
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
- ],
7
+ "hooks": {
8
+ "UserPromptSubmit": [
9
+ {
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
+ ]
19
+ }
20
+ ],
21
+ "PostToolUse": [
22
+ {
23
+ "matcher": "Write|Edit",
24
+ "hooks": [
25
+ {
26
+ "type": "command",
27
+ "command": "./.claude/hooks/post-edit.sh"
28
+ }
29
+ ]
30
+ }
31
+ ],
32
+ "PreToolUse": [
33
+ {
34
+ "matcher": "Bash",
35
+ "hooks": [
36
+ {
37
+ "type": "command",
38
+ "command": "./.claude/hooks/pre-commit-check.sh"
39
+ }
40
+ ]
41
+ }
42
+ ]
43
+ },
35
44
 
36
- "automationFiles": [
37
- "scripts/setup.sh",
38
- "scripts/autoworkflow.sh",
39
- "scripts/check-ui-enforcement.sh",
40
- "hooks/pre-commit",
41
- "hooks/commit-msg"
45
+ "instructions": [
46
+ "WORKFLOW: Follow ANALYZE → PLAN → CONFIRM → IMPLEMENT → VERIFY → AUDIT → COMMIT for all tasks",
47
+ "SESSION START: If instructions/BLUEPRINT.md missing, immediately scan codebase and generate it. Do not ask to start - only ask to save.",
48
+ "AFTER CODE CHANGES: Run 'npm run verify' automatically. If errors exist, fix them and re-verify until passing.",
49
+ "BEFORE COMMIT: Block if TODO/FIXME/console.log found in changes. Require conventional commit format: type(scope): description",
50
+ "UI ENFORCEMENT: Every backend endpoint/API must have a corresponding UI component. No orphan features allowed.",
51
+ "PLAN GATE: Always wait for user approval before implementing. Show plan with suggestions first.",
52
+ "BLUEPRINT UPDATE: After adding new features/routes/APIs, update instructions/BLUEPRINT.md",
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"
42
56
  ],
43
57
 
44
58
  "workflow": {
45
- "mode": "agentic",
46
59
  "phases": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "FIX", "AUDIT", "COMMIT", "UPDATE"],
47
- "requirePlanApproval": true,
48
- "requireVerifyBeforeCommit": true,
49
- "requireAuditForFeatures": true,
50
- "requireBlueprintCheck": true,
51
60
  "maxFixIterations": 10,
52
61
  "maxAuditIterations": 5
53
62
  },
54
63
 
55
64
  "gates": {
56
- "analyze": {
57
- "requires": ["Read relevant source files", "Check BLUEPRINT.md"]
58
- },
59
65
  "plan_approval": {
60
- "requires": ["User explicit approval"],
61
- "blocking": true
66
+ "blocking": true,
67
+ "requires": ["User explicit approval"]
62
68
  },
63
69
  "verify": {
64
- "requires": ["npm run verify passes"],
65
- "blocking": true
70
+ "blocking": true,
71
+ "command": "npm run verify"
66
72
  },
67
73
  "audit": {
68
- "requires": ["npm run audit:ui passes", "npm run audit:cycles passes"],
69
74
  "blocking": true,
70
- "appliesTo": ["feature", "refactor", "perf"]
75
+ "commands": ["npm run audit:ui", "npm run audit:cycles"],
76
+ "appliesTo": ["feature", "refactor"]
71
77
  },
72
78
  "pre_commit": {
73
- "requires": [
74
- "verify_gate passed",
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
79
+ "blocking": true,
80
+ "checks": ["No TODO/FIXME", "No console.log", "Conventional commit format"]
81
81
  }
82
82
  },
83
83
 
84
- "triggers": {
85
- "on_conversation_start": ["Check if /init needed", "Read CLAUDE.md", "Check BLUEPRINT.md exists", "Route via system/router.md"],
86
- "on_init_needed": ["Notify autoworkflow detected", "Suggest running /init"],
87
- "on_blueprint_missing": ["Run project audit", "Generate AI_RULES.md + BLUEPRINT.md", "Present for approval"],
88
- "on_task_start": ["Read CLAUDE.md", "Route via system/router.md"],
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"
84
+ "taskTypes": {
85
+ "feature": {
86
+ "workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "AUDIT", "COMMIT", "UPDATE"],
87
+ "requiresAudit": true,
88
+ "requiresSuggestions": true
101
89
  },
102
- "fix_loop": {
103
- "maxIterations": 10,
104
- "onComplete": "verify_loop"
90
+ "fix": {
91
+ "workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "COMMIT"],
92
+ "requiresAudit": false
105
93
  },
106
- "audit_loop": {
107
- "commands": ["npm run audit:ui", "npm run audit:cycles"],
108
- "maxIterations": 5
94
+ "refactor": {
95
+ "workflow": ["ANALYZE", "PLAN", "CONFIRM", "IMPLEMENT", "VERIFY", "AUDIT", "COMMIT"],
96
+ "requiresAudit": true
97
+ },
98
+ "docs": {
99
+ "workflow": ["ANALYZE", "IMPLEMENT", "COMMIT"],
100
+ "requiresAudit": false
101
+ },
102
+ "query": {
103
+ "workflow": ["ANALYZE", "RESPOND"],
104
+ "requiresAudit": false
109
105
  }
110
106
  },
111
107
 
@@ -119,13 +115,11 @@
119
115
  },
120
116
 
121
117
  "rules": {
122
- "noPartialImplementations": true,
123
118
  "noTodoComments": true,
124
119
  "noConsoleLogs": true,
125
120
  "noOrphanFeatures": true,
126
121
  "noCircularDependencies": true,
127
122
  "conventionalCommits": true,
128
- "oneFeatureAtATime": true,
129
123
  "readBeforeWrite": true
130
124
  }
131
125
  }
@@ -5,7 +5,8 @@
5
5
  "Bash(npm publish:*)",
6
6
  "Bash(npm version:*)",
7
7
  "Bash(node bin/cli.js:*)",
8
- "Bash(npm pkg:*)"
8
+ "Bash(npm pkg:*)",
9
+ "Bash(wc:*)"
9
10
  ]
10
11
  }
11
12
  }