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,137 @@
1
+ #!/bin/bash
2
+ # commit-msg
3
+ # Git commit-msg hook that enforces conventional commit format
4
+ # Install: cp hooks/commit-msg .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg
5
+
6
+ # Colors
7
+ RED='\033[0;31m'
8
+ GREEN='\033[0;32m'
9
+ YELLOW='\033[1;33m'
10
+ NC='\033[0m'
11
+
12
+ COMMIT_MSG_FILE=$1
13
+ COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
14
+
15
+ # Skip merge commits
16
+ if echo "$COMMIT_MSG" | grep -qE "^Merge"; then
17
+ exit 0
18
+ fi
19
+
20
+ # Skip revert commits
21
+ if echo "$COMMIT_MSG" | grep -qE "^Revert"; then
22
+ exit 0
23
+ fi
24
+
25
+ echo ""
26
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
27
+ echo "🔍 COMMIT MESSAGE VALIDATION"
28
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
29
+ echo ""
30
+
31
+ # ─────────────────────────────────────────────────────────────
32
+ # Conventional Commit Format
33
+ # ─────────────────────────────────────────────────────────────
34
+ # type(scope): description
35
+ #
36
+ # Valid types:
37
+ # feat - New feature
38
+ # fix - Bug fix
39
+ # docs - Documentation only
40
+ # style - Formatting, no code change
41
+ # refactor - Code change, no feature/fix
42
+ # perf - Performance improvement
43
+ # test - Adding tests
44
+ # build - Build system changes
45
+ # ci - CI/CD changes
46
+ # chore - Maintenance
47
+ # revert - Revert commit
48
+
49
+ VALID_TYPES="feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert"
50
+
51
+ # Pattern: type(scope): description
52
+ # - type is required
53
+ # - scope is optional (in parentheses)
54
+ # - colon and space are required
55
+ # - description is required
56
+
57
+ PATTERN="^($VALID_TYPES)(\([a-z0-9_-]+\))?: .+"
58
+
59
+ # Get first line (subject)
60
+ SUBJECT=$(echo "$COMMIT_MSG" | head -1)
61
+
62
+ echo "Message: \"$SUBJECT\""
63
+ echo ""
64
+
65
+ # ─────────────────────────────────────────────────────────────
66
+ # Validation
67
+ # ─────────────────────────────────────────────────────────────
68
+
69
+ VALID=1
70
+ ERRORS=""
71
+
72
+ # Check 1: Matches conventional format
73
+ if ! echo "$SUBJECT" | grep -qE "$PATTERN"; then
74
+ VALID=0
75
+ ERRORS="${ERRORS} ❌ Does not match format: type(scope): description\n"
76
+ fi
77
+
78
+ # Check 2: Subject length (max 72 characters)
79
+ SUBJECT_LENGTH=${#SUBJECT}
80
+ if [ $SUBJECT_LENGTH -gt 72 ]; then
81
+ VALID=0
82
+ ERRORS="${ERRORS} ❌ Subject too long: ${SUBJECT_LENGTH}/72 characters\n"
83
+ fi
84
+
85
+ # Check 3: Subject doesn't end with period
86
+ if echo "$SUBJECT" | grep -qE "\.$"; then
87
+ VALID=0
88
+ ERRORS="${ERRORS} ❌ Subject should not end with a period\n"
89
+ fi
90
+
91
+ # Check 4: Subject starts with lowercase (after type)
92
+ if echo "$SUBJECT" | grep -qE "^[a-z]+(\([a-z0-9_-]+\))?: [A-Z]"; then
93
+ ERRORS="${ERRORS} ⚠️ Description should start with lowercase (optional)\n"
94
+ fi
95
+
96
+ # ─────────────────────────────────────────────────────────────
97
+ # Result
98
+ # ─────────────────────────────────────────────────────────────
99
+
100
+ if [ $VALID -eq 0 ]; then
101
+ echo -e "${RED}╔══════════════════════════════════════════════════════════════╗${NC}"
102
+ echo -e "${RED}║ ⛔ INVALID COMMIT MESSAGE ⛔ ║${NC}"
103
+ echo -e "${RED}╚══════════════════════════════════════════════════════════════╝${NC}"
104
+ echo ""
105
+ echo "Issues found:"
106
+ echo -e "$ERRORS"
107
+ echo ""
108
+ echo "Expected format:"
109
+ echo -e " ${YELLOW}type(scope): description${NC}"
110
+ echo ""
111
+ echo "Valid types:"
112
+ echo " feat New feature"
113
+ echo " fix Bug fix"
114
+ echo " docs Documentation"
115
+ echo " style Formatting"
116
+ echo " refactor Code restructure"
117
+ echo " perf Performance"
118
+ echo " test Tests"
119
+ echo " build Build system"
120
+ echo " ci CI/CD"
121
+ echo " chore Maintenance"
122
+ echo " revert Revert"
123
+ echo ""
124
+ echo "Examples:"
125
+ echo " feat(auth): add login page"
126
+ echo " fix(api): handle null response"
127
+ echo " refactor(utils): extract date helpers"
128
+ echo " docs: update README"
129
+ echo ""
130
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
131
+ exit 1
132
+ fi
133
+
134
+ echo -e "${GREEN}✅ Commit message is valid${NC}"
135
+ echo ""
136
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
137
+ exit 0
@@ -0,0 +1,152 @@
1
+ #!/bin/bash
2
+ # pre-commit
3
+ # Git pre-commit hook that enforces AutoWorkflow rules
4
+ # Install: cp hooks/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
5
+
6
+ # Colors
7
+ RED='\033[0;31m'
8
+ GREEN='\033[0;32m'
9
+ YELLOW='\033[1;33m'
10
+ NC='\033[0m'
11
+
12
+ echo ""
13
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
14
+ echo "🔒 AUTOWORKFLOW PRE-COMMIT CHECK"
15
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
16
+ echo ""
17
+
18
+ BLOCKED=0
19
+
20
+ # Get list of staged files
21
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(ts|tsx|js|jsx)$" || true)
22
+
23
+ # ─────────────────────────────────────────────────────────────
24
+ # Check 1: TypeScript Errors
25
+ # ─────────────────────────────────────────────────────────────
26
+
27
+ echo "📋 [1/5] TypeScript check..."
28
+
29
+ TSC_OUTPUT=$(npm run typecheck 2>&1) || true
30
+
31
+ if echo "$TSC_OUTPUT" | grep -q "error TS"; then
32
+ ERROR_COUNT=$(echo "$TSC_OUTPUT" | grep -c "error TS" || echo "0")
33
+ echo -e "${RED} ⛔ Found $ERROR_COUNT TypeScript error(s)${NC}"
34
+ echo ""
35
+ echo "$TSC_OUTPUT" | grep "error TS" | head -10
36
+ if [ "$ERROR_COUNT" -gt 10 ]; then
37
+ echo " ... and $(($ERROR_COUNT - 10)) more"
38
+ fi
39
+ BLOCKED=1
40
+ else
41
+ echo -e "${GREEN} ✓ No TypeScript errors${NC}"
42
+ fi
43
+
44
+ # ─────────────────────────────────────────────────────────────
45
+ # Check 2: ESLint Warnings
46
+ # ─────────────────────────────────────────────────────────────
47
+
48
+ echo ""
49
+ echo "📋 [2/5] ESLint check..."
50
+
51
+ LINT_OUTPUT=$(npm run lint 2>&1) || true
52
+
53
+ if echo "$LINT_OUTPUT" | grep -qE "[0-9]+ error|[0-9]+ warning"; then
54
+ echo -e "${RED} ⛔ ESLint issues found${NC}"
55
+ echo "$LINT_OUTPUT" | grep -E "error|warning" | head -10
56
+ BLOCKED=1
57
+ else
58
+ echo -e "${GREEN} ✓ No ESLint issues${NC}"
59
+ fi
60
+
61
+ # ─────────────────────────────────────────────────────────────
62
+ # Check 3: TODO/FIXME Comments
63
+ # ─────────────────────────────────────────────────────────────
64
+
65
+ echo ""
66
+ echo "📋 [3/5] TODO/FIXME check..."
67
+
68
+ if [ -n "$STAGED_FILES" ]; then
69
+ TODO_FILES=$(echo "$STAGED_FILES" | xargs grep -l "TODO\|FIXME\|XXX\|HACK" 2>/dev/null || true)
70
+ if [ -n "$TODO_FILES" ]; then
71
+ echo -e "${RED} ⛔ Found TODO/FIXME comments in:${NC}"
72
+ echo "$TODO_FILES" | while read file; do
73
+ echo " - $file"
74
+ grep -n "TODO\|FIXME\|XXX\|HACK" "$file" 2>/dev/null | head -3 | sed 's/^/ /'
75
+ done
76
+ BLOCKED=1
77
+ else
78
+ echo -e "${GREEN} ✓ No TODO/FIXME comments${NC}"
79
+ fi
80
+ else
81
+ echo -e "${GREEN} ✓ No TODO/FIXME comments${NC}"
82
+ fi
83
+
84
+ # ─────────────────────────────────────────────────────────────
85
+ # Check 4: Console.log Statements
86
+ # ─────────────────────────────────────────────────────────────
87
+
88
+ echo ""
89
+ echo "📋 [4/5] console.log check..."
90
+
91
+ if [ -n "$STAGED_FILES" ]; then
92
+ CONSOLE_FILES=$(echo "$STAGED_FILES" | xargs grep -l "console\.\(log\|debug\|info\)" 2>/dev/null || true)
93
+ if [ -n "$CONSOLE_FILES" ]; then
94
+ echo -e "${RED} ⛔ Found console.log statements in:${NC}"
95
+ echo "$CONSOLE_FILES" | while read file; do
96
+ echo " - $file"
97
+ grep -n "console\.\(log\|debug\|info\)" "$file" 2>/dev/null | head -3 | sed 's/^/ /'
98
+ done
99
+ BLOCKED=1
100
+ else
101
+ echo -e "${GREEN} ✓ No console.log statements${NC}"
102
+ fi
103
+ else
104
+ echo -e "${GREEN} ✓ No console.log statements${NC}"
105
+ fi
106
+
107
+ # ─────────────────────────────────────────────────────────────
108
+ # Check 5: Circular Dependencies (if madge available)
109
+ # ─────────────────────────────────────────────────────────────
110
+
111
+ echo ""
112
+ echo "📋 [5/5] Circular dependencies check..."
113
+
114
+ if command -v npx &> /dev/null && [ -d "src" ]; then
115
+ CYCLES=$(npx madge --circular --extensions ts,tsx src/ 2>/dev/null || true)
116
+ if [ -n "$CYCLES" ] && ! echo "$CYCLES" | grep -q "No circular"; then
117
+ echo -e "${RED} ⛔ Circular dependencies found:${NC}"
118
+ echo "$CYCLES" | head -10
119
+ BLOCKED=1
120
+ else
121
+ echo -e "${GREEN} ✓ No circular dependencies${NC}"
122
+ fi
123
+ else
124
+ echo -e "${YELLOW} ○ Skipped (madge not available or no src/)${NC}"
125
+ fi
126
+
127
+ # ─────────────────────────────────────────────────────────────
128
+ # Result
129
+ # ─────────────────────────────────────────────────────────────
130
+
131
+ echo ""
132
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
133
+
134
+ if [ $BLOCKED -eq 1 ]; then
135
+ echo -e "${RED}╔══════════════════════════════════════════════════════════════╗${NC}"
136
+ echo -e "${RED}║ ⛔ COMMIT BLOCKED ⛔ ║${NC}"
137
+ echo -e "${RED}╠══════════════════════════════════════════════════════════════╣${NC}"
138
+ echo -e "${RED}║ Fix the issues above before committing. ║${NC}"
139
+ echo -e "${RED}║ ║${NC}"
140
+ echo -e "${RED}║ Quick fixes: ║${NC}"
141
+ echo -e "${RED}║ npm run lint:fix Auto-fix ESLint issues ║${NC}"
142
+ echo -e "${RED}║ npm run typecheck See all TypeScript errors ║${NC}"
143
+ echo -e "${RED}╚══════════════════════════════════════════════════════════════╝${NC}"
144
+ echo ""
145
+ exit 1
146
+ fi
147
+
148
+ echo -e "${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
149
+ echo -e "${GREEN}║ ✅ ALL CHECKS PASSED ║${NC}"
150
+ echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}"
151
+ echo ""
152
+ exit 0
@@ -0,0 +1,284 @@
1
+ # AI Rules - Project Standards
2
+
3
+ > Coding standards and conventions that Claude MUST follow.
4
+ > This defines WHAT quality looks like for this project.
5
+
6
+ ---
7
+
8
+ ## Project Configuration
9
+
10
+ **Name:** [Your Project Name]
11
+ **Description:** [One-line description]
12
+ **Target Users:** [Who uses this?]
13
+ **Core Value:** [What problem does it solve?]
14
+
15
+ > Full specification in `instructions/BLUEPRINT.md`
16
+
17
+ ---
18
+
19
+ ## Tech Stack
20
+
21
+ - React 18 + TypeScript + Vite
22
+ - Tailwind CSS + shadcn/ui
23
+ - lucide-react icons
24
+ - React Router DOM
25
+
26
+ ---
27
+
28
+ ## File Structure
29
+
30
+ ```
31
+ src/
32
+ ├── components/ # Reusable UI (PascalCase.tsx)
33
+ ├── pages/ # Route pages
34
+ ├── hooks/ # Custom hooks (use*.ts)
35
+ ├── lib/ # Utilities
36
+ ├── types/ # TypeScript types (*.types.ts)
37
+ └── api/ # API functions
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Naming Conventions
43
+
44
+ | Type | Convention | Example |
45
+ |------|------------|---------|
46
+ | Components | PascalCase.tsx | `UserCard.tsx` |
47
+ | Hooks | use*.ts | `useAuth.ts` |
48
+ | Utilities | camelCase.ts | `formatDate.ts` |
49
+ | Types | *.types.ts | `user.types.ts` |
50
+ | Constants | UPPER_SNAKE | `MAX_ITEMS` |
51
+
52
+ ---
53
+
54
+ ## Component Rules
55
+
56
+ ### Structure
57
+ - Max 150 lines per file
58
+ - Extract hooks for logic
59
+ - Use TypeScript interfaces (not types)
60
+ - Handle loading/error/empty states
61
+
62
+ ### Required States
63
+ Every component with async data MUST have:
64
+ - Loading state (skeleton/spinner)
65
+ - Error state (error message)
66
+ - Empty state (no data message)
67
+
68
+ ### Props Interface
69
+ ```typescript
70
+ interface ComponentProps {
71
+ // Required props first
72
+ id: string
73
+ data: DataType
74
+
75
+ // Optional props after
76
+ className?: string
77
+ onAction?: () => void
78
+ }
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Styling Rules
84
+
85
+ - Tailwind utilities only
86
+ - Use `cn()` for conditional classes
87
+ - Mobile-first responsive design
88
+ - No inline styles
89
+ - No CSS files (use Tailwind)
90
+
91
+ ```typescript
92
+ // Good
93
+ <div className={cn("p-4 bg-white", isActive && "bg-blue-500")} />
94
+
95
+ // Bad
96
+ <div style={{ padding: 16 }} />
97
+ ```
98
+
99
+ ---
100
+
101
+ ## API Patterns
102
+
103
+ ### Response Type
104
+ ```typescript
105
+ interface ApiResponse<T> {
106
+ data: T | null
107
+ error: string | null
108
+ loading: boolean
109
+ }
110
+ ```
111
+
112
+ ### Error Handling
113
+ ```typescript
114
+ try {
115
+ const data = await fetchData()
116
+ return { data, error: null }
117
+ } catch (error) {
118
+ toast.error('Failed to load data')
119
+ return { data: null, error: error.message }
120
+ }
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Quality Standards
126
+
127
+ ### Every New Page MUST Have:
128
+ - [ ] Loading skeleton
129
+ - [ ] Error boundary
130
+ - [ ] Empty state
131
+ - [ ] SEO meta tags
132
+ - [ ] Mobile layout
133
+
134
+ ### Every New Form MUST Have:
135
+ - [ ] Client validation
136
+ - [ ] Server error display
137
+ - [ ] Submit loading state
138
+ - [ ] Success feedback
139
+ - [ ] Disabled state while submitting
140
+
141
+ ### Every New Component MUST Have:
142
+ - [ ] TypeScript props interface
143
+ - [ ] Default props where sensible
144
+ - [ ] Loading prop (if async)
145
+
146
+ ---
147
+
148
+ ## ALWAYS / NEVER Rules
149
+
150
+ ### ALWAYS:
151
+ - Handle API errors gracefully
152
+ - Show loading states for async operations
153
+ - Validate user input
154
+ - Use semantic HTML
155
+ - Add aria-labels for icons
156
+ - Complete features fully (UI + Backend)
157
+
158
+ ### NEVER:
159
+ - Use `any` type
160
+ - Leave console.log statements
161
+ - Skip error handling
162
+ - Hardcode strings (use constants)
163
+ - Commit with TypeScript errors
164
+ - Build backend WITHOUT UI
165
+ - Create API WITHOUT UI that calls it
166
+ - Add database table WITHOUT UI
167
+ - Commit orphan features
168
+
169
+ ---
170
+
171
+ ## UI Enforcement
172
+
173
+ ### Definition of Done
174
+
175
+ A feature is **NOT COMPLETE** until:
176
+
177
+ | Requirement | Must Exist |
178
+ |-------------|------------|
179
+ | Backend/API | Logic implemented |
180
+ | UI Component | User-facing component |
181
+ | Connection | UI calls the backend |
182
+ | Navigation | User can access it |
183
+
184
+ ### Self-Check Before Commit
185
+ ```
186
+ □ Can a user SEE this feature in the app?
187
+ □ Can a user INTERACT with this feature?
188
+ □ Is the UI CONNECTED to the backend?
189
+ □ Is there a WAY to navigate to it?
190
+
191
+ ALL must be YES to commit.
192
+ ```
193
+
194
+ ---
195
+
196
+ ## ESLint Rules (Enforced)
197
+
198
+ | Rule | Setting | Purpose |
199
+ |------|---------|---------|
200
+ | `no-console` | error | No debug logs |
201
+ | `max-lines` | 300 | Files focused |
202
+ | `max-lines-per-function` | 75 | Functions small |
203
+ | `complexity` | 15 | Prevent complexity |
204
+ | `no-nested-ternary` | error | Readable code |
205
+ | `eqeqeq` | error | Strict equality |
206
+ | `@typescript-eslint/no-explicit-any` | error | Type safety |
207
+ | `@typescript-eslint/no-non-null-assertion` | error | Safe nulls |
208
+
209
+ ---
210
+
211
+ ## Coverage Thresholds
212
+
213
+ ```
214
+ Lines: 80%
215
+ Functions: 80%
216
+ Branches: 70%
217
+ Statements: 80%
218
+ ```
219
+
220
+ ---
221
+
222
+ ## Commit Message Format
223
+
224
+ ```
225
+ type(scope): description
226
+
227
+ Types:
228
+ - feat: New feature
229
+ - fix: Bug fix
230
+ - docs: Documentation
231
+ - style: Formatting
232
+ - refactor: Code restructure
233
+ - perf: Performance
234
+ - test: Tests
235
+ - build: Build system
236
+ - ci: CI/CD
237
+ - chore: Maintenance
238
+ - revert: Revert commit
239
+ ```
240
+
241
+ Examples:
242
+ - `feat(auth): add login page`
243
+ - `fix(api): handle null response`
244
+ - `refactor(utils): extract date helpers`
245
+
246
+ ---
247
+
248
+ ## Commands
249
+
250
+ ```bash
251
+ npm run dev # Start dev server
252
+ npm run typecheck # TypeScript check
253
+ npm run lint # ESLint check
254
+ npm run verify # TypeScript + ESLint
255
+ npm run test # Run tests
256
+ npm run audit:ui # Check orphan features
257
+ npm run audit:cycles # Check circular deps
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Feature Completeness Checklist
263
+
264
+ When Claude suggests improvements, check against:
265
+
266
+ - [ ] Error state UI
267
+ - [ ] Loading state UI
268
+ - [ ] Empty state UI
269
+ - [ ] Success feedback (toast/notification)
270
+ - [ ] Form validation messages
271
+ - [ ] Keyboard navigation
272
+ - [ ] Mobile layout
273
+
274
+ ---
275
+
276
+ ## Notes for Claude
277
+
278
+ When building features:
279
+ 1. Check `BLUEPRINT.md` for requirements
280
+ 2. Follow these standards for quality
281
+ 3. Match existing patterns in codebase
282
+ 4. Complete features fully before commit
283
+
284
+ **Feature completeness = BLUEPRINT requirements + these standards**