autoworkflow 1.2.0 → 2.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.
@@ -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**
@@ -0,0 +1,170 @@
1
+ # Project Blueprint
2
+
3
+ > This is your project's source of truth.
4
+ > Claude reads this to understand WHAT to build.
5
+
6
+ ---
7
+
8
+ ## Project Overview
9
+
10
+ **Name:** [Project Name]
11
+ **Tagline:** [One-line description]
12
+ **Domain:** [e.g., yourproject.com]
13
+
14
+ ### Problem Statement
15
+ [What problem does this solve? Who has this problem?]
16
+
17
+ ### Solution
18
+ [How does your project solve it?]
19
+
20
+ ### Target Users
21
+ - **Primary:** [Main user type]
22
+ - **Secondary:** [Other users]
23
+
24
+ ---
25
+
26
+ ## Features
27
+
28
+ ### Phase 1: MVP (Current)
29
+ - [ ] **Feature 1** - [Description]
30
+ - Sub-requirement 1
31
+ - Sub-requirement 2
32
+ - [ ] **Feature 2** - [Description]
33
+ - [ ] **Feature 3** - [Description]
34
+
35
+ ### Phase 2: Growth
36
+ - [ ] **Feature 4** - [Description]
37
+ - [ ] **Feature 5** - [Description]
38
+
39
+ ### Phase 3: Scale
40
+ - [ ] **Feature 6** - [Description]
41
+
42
+ ---
43
+
44
+ ## Data Model
45
+
46
+ ### Core Entities
47
+
48
+ ```
49
+ User
50
+ ├── id: string (UUID)
51
+ ├── email: string (unique)
52
+ ├── name: string
53
+ ├── role: enum (user, admin)
54
+ ├── createdAt: timestamp
55
+ └── updatedAt: timestamp
56
+
57
+ [Entity 2]
58
+ ├── id: string (UUID)
59
+ ├── [field]: [type]
60
+ └── userId: string (FK → User)
61
+ ```
62
+
63
+ ### Relationships
64
+ - User → [Entity] (one-to-many)
65
+ - [Entity] → [Entity] (many-to-many)
66
+
67
+ ---
68
+
69
+ ## API Endpoints
70
+
71
+ ### Public Routes
72
+ | Method | Endpoint | Description |
73
+ |--------|----------|-------------|
74
+ | GET | /api/[resource] | List all |
75
+ | GET | /api/[resource]/:id | Get one |
76
+ | POST | /api/[resource] | Create |
77
+
78
+ ### Protected Routes (Auth Required)
79
+ | Method | Endpoint | Description |
80
+ |--------|----------|-------------|
81
+ | PUT | /api/[resource]/:id | Update |
82
+ | DELETE | /api/[resource]/:id | Delete |
83
+
84
+ ### Admin Routes
85
+ | Method | Endpoint | Description |
86
+ |--------|----------|-------------|
87
+ | GET | /api/admin/[resource] | Admin list |
88
+
89
+ ---
90
+
91
+ ## Pages & Routes
92
+
93
+ | Route | Page | Auth | Description |
94
+ |-------|------|------|-------------|
95
+ | `/` | HomePage | No | Landing page |
96
+ | `/[resource]` | ListPage | No | Browse items |
97
+ | `/[resource]/:id` | DetailPage | No | View item |
98
+ | `/dashboard` | Dashboard | Yes | User dashboard |
99
+ | `/admin` | AdminPanel | Admin | Admin controls |
100
+
101
+ ---
102
+
103
+ ## Authentication & Authorization
104
+
105
+ ### Auth Method
106
+ [e.g., JWT, Session, OAuth]
107
+
108
+ ### Roles
109
+ | Role | Permissions |
110
+ |------|-------------|
111
+ | guest | View public content |
112
+ | user | + Create, edit own content |
113
+ | admin | + Manage all content, users |
114
+
115
+ ---
116
+
117
+ ## UI/UX Requirements
118
+
119
+ ### Design System
120
+ - **Colors:** [Primary, Secondary, Accent]
121
+ - **Typography:** [Font family]
122
+ - **Components:** [shadcn/ui, custom]
123
+
124
+ ### Key UI Patterns
125
+ - [ ] Mobile-first responsive
126
+ - [ ] Dark mode support
127
+ - [ ] Loading skeletons
128
+ - [ ] Toast notifications
129
+ - [ ] Form validation feedback
130
+
131
+ ---
132
+
133
+ ## Third-Party Integrations
134
+
135
+ | Service | Purpose | Priority |
136
+ |---------|---------|----------|
137
+ | [Service 1] | [Purpose] | Required |
138
+ | [Service 2] | [Purpose] | Optional |
139
+
140
+ ---
141
+
142
+ ## Success Metrics
143
+
144
+ - [ ] [Metric 1]: [Target]
145
+ - [ ] [Metric 2]: [Target]
146
+
147
+ ---
148
+
149
+ ## Out of Scope (v1)
150
+
151
+ Things we're NOT building initially:
152
+ - [Feature X] - Deferred to v2
153
+ - [Feature Y] - Requires more research
154
+
155
+ ---
156
+
157
+ ## Notes for Claude
158
+
159
+ ### When building features:
160
+ 1. Check this blueprint for requirements
161
+ 2. Reference the Data Model for types
162
+ 3. Follow the API patterns established
163
+ 4. Match the UI/UX requirements
164
+
165
+ ### Feature completeness:
166
+ - Blueprint requirements (this file)
167
+ - Quality standards (`AI_RULES.md`)
168
+ - Workflow process (`CLAUDE.md`)
169
+
170
+ **Build what's specified. Build it completely.**