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.
@@ -0,0 +1,116 @@
1
+ #!/bin/bash
2
+ # ensure-no-errors.sh
3
+ # Pre-commit verification - blocks commits if errors exist
4
+
5
+ set -e
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
9
+
10
+ # Colors
11
+ RED='\033[0;31m'
12
+ GREEN='\033[0;32m'
13
+ YELLOW='\033[1;33m'
14
+ NC='\033[0m'
15
+
16
+ cd "$PROJECT_ROOT"
17
+
18
+ echo "🔒 Pre-commit verification..."
19
+ echo ""
20
+
21
+ BLOCKED=0
22
+
23
+ # ─────────────────────────────────────────────────────────────
24
+ # TypeScript Check
25
+ # ─────────────────────────────────────────────────────────────
26
+
27
+ echo "📋 TypeScript check..."
28
+ TSC_OUTPUT=$(npm run typecheck 2>&1) || true
29
+
30
+ if echo "$TSC_OUTPUT" | grep -q "error TS"; then
31
+ ERROR_COUNT=$(echo "$TSC_OUTPUT" | grep -c "error TS" || echo "0")
32
+ echo -e "${RED}❌ Found $ERROR_COUNT TypeScript error(s)${NC}"
33
+ echo "$TSC_OUTPUT" | grep "error TS" | head -10
34
+ BLOCKED=1
35
+ else
36
+ echo -e "${GREEN}✓ TypeScript: OK${NC}"
37
+ fi
38
+
39
+ # ─────────────────────────────────────────────────────────────
40
+ # ESLint Check
41
+ # ─────────────────────────────────────────────────────────────
42
+
43
+ echo ""
44
+ echo "📋 ESLint check..."
45
+ LINT_OUTPUT=$(npm run lint 2>&1) || true
46
+
47
+ if echo "$LINT_OUTPUT" | grep -qE "[0-9]+ error|[0-9]+ warning"; then
48
+ echo -e "${RED}❌ ESLint issues found${NC}"
49
+ echo "$LINT_OUTPUT" | tail -5
50
+ BLOCKED=1
51
+ else
52
+ echo -e "${GREEN}✓ ESLint: OK${NC}"
53
+ fi
54
+
55
+ # ─────────────────────────────────────────────────────────────
56
+ # TODO/FIXME Check
57
+ # ─────────────────────────────────────────────────────────────
58
+
59
+ echo ""
60
+ echo "📋 Checking for TODO/FIXME..."
61
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM 2>/dev/null | grep -E "\.(ts|tsx|js|jsx)$" || true)
62
+
63
+ if [ -n "$STAGED_FILES" ]; then
64
+ TODO_FOUND=$(echo "$STAGED_FILES" | xargs grep -l "TODO\|FIXME\|XXX\|HACK" 2>/dev/null || true)
65
+ if [ -n "$TODO_FOUND" ]; then
66
+ echo -e "${RED}❌ Found TODO/FIXME in:${NC}"
67
+ echo "$TODO_FOUND"
68
+ BLOCKED=1
69
+ else
70
+ echo -e "${GREEN}✓ No TODO/FIXME${NC}"
71
+ fi
72
+ else
73
+ echo -e "${GREEN}✓ No TODO/FIXME${NC}"
74
+ fi
75
+
76
+ # ─────────────────────────────────────────────────────────────
77
+ # Console.log Check
78
+ # ─────────────────────────────────────────────────────────────
79
+
80
+ echo ""
81
+ echo "📋 Checking for console.log..."
82
+
83
+ if [ -n "$STAGED_FILES" ]; then
84
+ CONSOLE_FOUND=$(echo "$STAGED_FILES" | xargs grep -l "console\.\(log\|debug\|info\)" 2>/dev/null || true)
85
+ if [ -n "$CONSOLE_FOUND" ]; then
86
+ echo -e "${RED}❌ Found console.log in:${NC}"
87
+ echo "$CONSOLE_FOUND"
88
+ BLOCKED=1
89
+ else
90
+ echo -e "${GREEN}✓ No console.log${NC}"
91
+ fi
92
+ else
93
+ echo -e "${GREEN}✓ No console.log${NC}"
94
+ fi
95
+
96
+ # ─────────────────────────────────────────────────────────────
97
+ # Result
98
+ # ─────────────────────────────────────────────────────────────
99
+
100
+ echo ""
101
+
102
+ if [ $BLOCKED -eq 1 ]; then
103
+ echo -e "${RED}╔══════════════════════════════════════════════════════════════╗${NC}"
104
+ echo -e "${RED}║ COMMIT BLOCKED ║${NC}"
105
+ echo -e "${RED}╠══════════════════════════════════════════════════════════════╣${NC}"
106
+ echo -e "${RED}║ Fix the issues above before committing. ║${NC}"
107
+ echo -e "${RED}║ ║${NC}"
108
+ echo -e "${RED}║ Commands: ║${NC}"
109
+ echo -e "${RED}║ npm run typecheck - Check TypeScript errors ║${NC}"
110
+ echo -e "${RED}║ npm run lint:fix - Auto-fix ESLint issues ║${NC}"
111
+ echo -e "${RED}╚══════════════════════════════════════════════════════════════╝${NC}"
112
+ exit 1
113
+ fi
114
+
115
+ echo -e "${GREEN}✅ All pre-commit checks passed${NC}"
116
+ exit 0
@@ -0,0 +1,112 @@
1
+ #!/bin/bash
2
+ # run-verification.sh
3
+ # Runs TypeScript + ESLint verification with structured output
4
+
5
+ set -o pipefail
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
9
+
10
+ # Colors
11
+ RED='\033[0;31m'
12
+ GREEN='\033[0;32m'
13
+ YELLOW='\033[1;33m'
14
+ NC='\033[0m'
15
+
16
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
17
+ echo "🔍 VERIFICATION PHASE"
18
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
19
+
20
+ cd "$PROJECT_ROOT"
21
+
22
+ ERRORS_FOUND=0
23
+ TS_ERRORS=0
24
+ LINT_ERRORS=0
25
+
26
+ # ─────────────────────────────────────────────────────────────
27
+ # TypeScript Check
28
+ # ─────────────────────────────────────────────────────────────
29
+
30
+ echo ""
31
+ echo "📋 Running TypeScript check..."
32
+ echo ""
33
+
34
+ TSC_OUTPUT=$(npm run typecheck 2>&1) || true
35
+
36
+ if echo "$TSC_OUTPUT" | grep -q "error TS"; then
37
+ TS_ERRORS=$(echo "$TSC_OUTPUT" | grep -c "error TS" || echo "0")
38
+ ERRORS_FOUND=1
39
+
40
+ echo -e "${RED}❌ TypeScript: $TS_ERRORS error(s) found${NC}"
41
+ echo ""
42
+ echo "$TSC_OUTPUT" | grep "error TS" | head -20
43
+
44
+ if [ "$TS_ERRORS" -gt 20 ]; then
45
+ echo ""
46
+ echo "... and $(($TS_ERRORS - 20)) more errors"
47
+ fi
48
+ else
49
+ echo -e "${GREEN}✅ TypeScript: No errors${NC}"
50
+ fi
51
+
52
+ # ─────────────────────────────────────────────────────────────
53
+ # ESLint Check
54
+ # ─────────────────────────────────────────────────────────────
55
+
56
+ echo ""
57
+ echo "📋 Running ESLint check..."
58
+ echo ""
59
+
60
+ LINT_OUTPUT=$(npm run lint 2>&1) || true
61
+
62
+ if echo "$LINT_OUTPUT" | grep -qE "error|warning"; then
63
+ LINT_ERRORS=$(echo "$LINT_OUTPUT" | grep -cE "error|warning" || echo "0")
64
+ ERRORS_FOUND=1
65
+
66
+ echo -e "${RED}❌ ESLint: Issues found${NC}"
67
+ echo ""
68
+ echo "$LINT_OUTPUT" | head -30
69
+ else
70
+ echo -e "${GREEN}✅ ESLint: No warnings${NC}"
71
+ fi
72
+
73
+ # ─────────────────────────────────────────────────────────────
74
+ # Summary
75
+ # ─────────────────────────────────────────────────────────────
76
+
77
+ echo ""
78
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
79
+
80
+ if [ $ERRORS_FOUND -eq 0 ]; then
81
+ echo -e "${GREEN}✅ VERIFICATION PASSED${NC}"
82
+ echo ""
83
+ echo "No TypeScript errors."
84
+ echo "No ESLint warnings."
85
+ echo ""
86
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
87
+ echo -e "${GREEN}✓ Ready to commit${NC}"
88
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
89
+
90
+ echo ""
91
+ echo "VERIFICATION_STATUS=PASSED"
92
+ echo "TS_ERRORS=0"
93
+ echo "LINT_ERRORS=0"
94
+
95
+ exit 0
96
+ else
97
+ echo -e "${RED}❌ VERIFICATION FAILED${NC}"
98
+ echo ""
99
+ echo "TypeScript errors: $TS_ERRORS"
100
+ echo "ESLint issues: $LINT_ERRORS"
101
+ echo ""
102
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
103
+ echo -e "${YELLOW}⚠️ Fix errors before proceeding${NC}"
104
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
105
+
106
+ echo ""
107
+ echo "VERIFICATION_STATUS=FAILED"
108
+ echo "TS_ERRORS=$TS_ERRORS"
109
+ echo "LINT_ERRORS=$LINT_ERRORS"
110
+
111
+ exit 1
112
+ fi
@@ -0,0 +1,201 @@
1
+ #!/bin/bash
2
+ # setup.sh
3
+ # AutoWorkflow - Full Setup Script
4
+ # This script sets up the complete workflow system for any project
5
+
6
+ set -e
7
+
8
+ # Colors
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ CYAN='\033[0;36m'
14
+ NC='\033[0m'
15
+
16
+ print_banner() {
17
+ echo ""
18
+ echo -e "${CYAN}╔══════════════════════════════════════════════════════════════╗${NC}"
19
+ echo -e "${CYAN}║ ║${NC}"
20
+ echo -e "${CYAN}║ AUTOWORKFLOW SETUP ║${NC}"
21
+ echo -e "${CYAN}║ System Prompt Layer for Claude Code ║${NC}"
22
+ echo -e "${CYAN}║ ║${NC}"
23
+ echo -e "${CYAN}╚══════════════════════════════════════════════════════════════╝${NC}"
24
+ echo ""
25
+ }
26
+
27
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
29
+ TARGET_DIR="${1:-.}"
30
+
31
+ print_banner
32
+
33
+ echo -e "${BLUE}Target directory: $TARGET_DIR${NC}"
34
+ echo ""
35
+
36
+ # Navigate to target
37
+ cd "$TARGET_DIR"
38
+
39
+ # Step 1: Check prerequisites
40
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
41
+ echo "Step 1: Checking prerequisites"
42
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
43
+
44
+ if [ ! -f "package.json" ]; then
45
+ echo -e "${YELLOW}⚠️ No package.json found. Creating minimal one...${NC}"
46
+ echo '{"name": "my-project", "version": "1.0.0", "private": true, "type": "module", "scripts": {}}' > package.json
47
+ fi
48
+ echo -e "${GREEN}✓ package.json exists${NC}"
49
+
50
+ # Step 2: Create directory structure
51
+ echo ""
52
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
53
+ echo "Step 2: Creating directory structure"
54
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
55
+
56
+ mkdir -p .claude/commands scripts hooks src
57
+ echo -e "${GREEN}✓ Created directories${NC}"
58
+
59
+ # Step 3: Copy workflow files if source exists
60
+ echo ""
61
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
62
+ echo "Step 3: Installing workflow files"
63
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
64
+
65
+ # Copy from project root if available
66
+ if [ -f "$PROJECT_ROOT/CLAUDE.md" ]; then
67
+ cp "$PROJECT_ROOT/CLAUDE.md" ./CLAUDE.md 2>/dev/null && echo -e "${GREEN}✓ Installed CLAUDE.md${NC}"
68
+ fi
69
+
70
+ if [ -d "$PROJECT_ROOT/system" ]; then
71
+ cp -r "$PROJECT_ROOT/system" ./ 2>/dev/null && echo -e "${GREEN}✓ Installed system/ folder${NC}"
72
+ fi
73
+
74
+ if [ -d "$PROJECT_ROOT/instructions" ]; then
75
+ cp -r "$PROJECT_ROOT/instructions" ./ 2>/dev/null && echo -e "${GREEN}✓ Installed instructions/ folder${NC}"
76
+ fi
77
+
78
+ if [ -d "$PROJECT_ROOT/.claude" ]; then
79
+ cp -r "$PROJECT_ROOT/.claude/"* ./.claude/ 2>/dev/null && echo -e "${GREEN}✓ Installed .claude/ commands${NC}"
80
+ fi
81
+
82
+ if [ -d "$PROJECT_ROOT/.vscode" ]; then
83
+ mkdir -p .vscode
84
+ cp -r "$PROJECT_ROOT/.vscode/"* ./.vscode/ 2>/dev/null && echo -e "${GREEN}✓ Installed .vscode/ settings${NC}"
85
+ fi
86
+
87
+ # Step 4: Install Git hooks
88
+ echo ""
89
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
90
+ echo "Step 4: Installing Git hooks"
91
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
92
+
93
+ # Initialize git if needed
94
+ if [ ! -d ".git" ]; then
95
+ git init
96
+ echo -e "${GREEN}✓ Initialized git repository${NC}"
97
+ fi
98
+
99
+ # Copy hooks
100
+ mkdir -p .git/hooks
101
+ if [ -d "$PROJECT_ROOT/hooks" ]; then
102
+ cp "$PROJECT_ROOT/hooks/"* .git/hooks/ 2>/dev/null
103
+ chmod +x .git/hooks/* 2>/dev/null
104
+ echo -e "${GREEN}✓ Installed pre-commit hook${NC}"
105
+ echo -e "${GREEN}✓ Installed commit-msg hook${NC}"
106
+ fi
107
+
108
+ # Step 5: Add npm scripts
109
+ echo ""
110
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
111
+ echo "Step 5: Adding npm scripts"
112
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
113
+
114
+ # Add scripts using Node.js
115
+ node -e "
116
+ const fs = require('fs');
117
+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
118
+ pkg.scripts = pkg.scripts || {};
119
+
120
+ // Verification commands
121
+ pkg.scripts['typecheck'] = pkg.scripts['typecheck'] || 'tsc --noEmit';
122
+ pkg.scripts['lint'] = pkg.scripts['lint'] || 'eslint . --max-warnings 0';
123
+ pkg.scripts['lint:fix'] = pkg.scripts['lint:fix'] || 'eslint . --fix';
124
+ pkg.scripts['verify'] = 'npm run typecheck && npm run lint';
125
+ pkg.scripts['verify:full'] = 'npm run verify && npm run test';
126
+
127
+ // Formatting
128
+ pkg.scripts['format'] = pkg.scripts['format'] || 'prettier --write .';
129
+ pkg.scripts['format:check'] = pkg.scripts['format:check'] || 'prettier --check .';
130
+
131
+ // Audit commands
132
+ pkg.scripts['audit:ui'] = './scripts/check-ui-enforcement.sh';
133
+ pkg.scripts['audit:cycles'] = 'npx madge --circular --extensions ts,tsx src/ 2>/dev/null || echo \"No circular dependencies found\"';
134
+ pkg.scripts['audit:all'] = 'npm run audit:ui && npm run audit:cycles';
135
+
136
+ // Workflow commands
137
+ pkg.scripts['dyad:status'] = './scripts/autoworkflow.sh status';
138
+ pkg.scripts['dyad:verify'] = './scripts/autoworkflow.sh verify';
139
+ pkg.scripts['dyad:commit'] = './scripts/autoworkflow.sh commit';
140
+ pkg.scripts['dyad:full'] = './scripts/autoworkflow.sh full';
141
+
142
+ // Hook setup
143
+ pkg.scripts['setup:hooks'] = 'cp hooks/* .git/hooks/ 2>/dev/null && chmod +x .git/hooks/* 2>/dev/null || true';
144
+ pkg.scripts['postinstall'] = 'npm run setup:hooks 2>/dev/null || true';
145
+
146
+ fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
147
+ " 2>/dev/null && echo -e "${GREEN}✓ Added npm scripts${NC}" || echo -e "${YELLOW}⚠️ Could not auto-update package.json${NC}"
148
+
149
+ # Step 6: Copy scripts
150
+ echo ""
151
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
152
+ echo "Step 6: Installing automation scripts"
153
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
154
+
155
+ if [ -d "$PROJECT_ROOT/scripts" ]; then
156
+ cp "$PROJECT_ROOT/scripts/"*.sh ./scripts/ 2>/dev/null
157
+ chmod +x ./scripts/*.sh 2>/dev/null
158
+ echo -e "${GREEN}✓ Installed automation scripts${NC}"
159
+ fi
160
+
161
+ # Step 7: Final verification
162
+ echo ""
163
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
164
+ echo "Step 7: Verifying installation"
165
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
166
+
167
+ echo "Checking installed files:"
168
+ [ -f "CLAUDE.md" ] && echo -e " ${GREEN}✓${NC} CLAUDE.md" || echo -e " ${YELLOW}○${NC} CLAUDE.md (optional)"
169
+ [ -d "system" ] && echo -e " ${GREEN}✓${NC} system/" || echo -e " ${YELLOW}○${NC} system/ (optional)"
170
+ [ -d "instructions" ] && echo -e " ${GREEN}✓${NC} instructions/" || echo -e " ${YELLOW}○${NC} instructions/ (optional)"
171
+ [ -d ".claude/commands" ] && echo -e " ${GREEN}✓${NC} .claude/commands/" || echo -e " ${YELLOW}○${NC} .claude/commands/"
172
+ [ -f ".git/hooks/pre-commit" ] && echo -e " ${GREEN}✓${NC} pre-commit hook" || echo -e " ${YELLOW}○${NC} pre-commit hook"
173
+ [ -f ".git/hooks/commit-msg" ] && echo -e " ${GREEN}✓${NC} commit-msg hook" || echo -e " ${YELLOW}○${NC} commit-msg hook"
174
+ [ -d "scripts" ] && echo -e " ${GREEN}✓${NC} scripts/" || echo -e " ${YELLOW}○${NC} scripts/"
175
+
176
+ echo ""
177
+ echo -e "${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
178
+ echo -e "${GREEN}║ ║${NC}"
179
+ echo -e "${GREEN}║ ✅ SETUP COMPLETE ║${NC}"
180
+ echo -e "${GREEN}║ ║${NC}"
181
+ echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}"
182
+ echo ""
183
+ echo "Next steps:"
184
+ echo ""
185
+ echo " 1. Install dependencies:"
186
+ echo " ${CYAN}npm install${NC}"
187
+ echo ""
188
+ echo " 2. Start developing with Claude Code:"
189
+ echo " ${CYAN}code .${NC}"
190
+ echo ""
191
+ echo " 3. Claude will automatically:"
192
+ echo " • Follow the workflow in CLAUDE.md"
193
+ echo " • Verify after every change"
194
+ echo " • Fix errors before committing"
195
+ echo " • Enforce UI completeness"
196
+ echo ""
197
+ echo "Available commands:"
198
+ echo " ${CYAN}npm run verify${NC} - TypeScript + ESLint check"
199
+ echo " ${CYAN}npm run audit:all${NC} - UI enforcement + circular deps"
200
+ echo " ${CYAN}npm run dyad:full${NC} - Full workflow"
201
+ echo ""