autoworkflow 3.8.3 → 3.9.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.
- package/.claude/.autoworkflow/memories/.gitkeep +2 -0
- package/.claude/.autoworkflow/memories/blockers.md +23 -0
- package/.claude/.autoworkflow/memories/decisions.md +23 -0
- package/.claude/.autoworkflow/memories/patterns.md +24 -0
- package/.claude/commands/audit.md +27 -29
- package/.claude/commands/init.md +5 -4
- package/.claude/hooks/blueprint-generator.sh +284 -22
- package/.claude/hooks/phase-transition.sh +200 -0
- package/.claude/hooks/pre-tool-router.sh +139 -1
- package/.claude/hooks/session-check.sh +74 -18
- package/.claude/settings.json +2 -2
- package/.claude/settings.local.json +7 -1
- package/CLAUDE.md +118 -8
- package/README.md +59 -125
- package/bin/cli.js +6 -6
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Blockers Memory
|
|
2
|
+
|
|
3
|
+
> Document known issues, workarounds, and gotchas.
|
|
4
|
+
> Saves time by not rediscovering the same problems.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Template Entry
|
|
9
|
+
|
|
10
|
+
*Recorded: YYYY-MM-DD HH:MM:SS*
|
|
11
|
+
|
|
12
|
+
**Issue:** What is the problem?
|
|
13
|
+
|
|
14
|
+
**Symptoms:** How does it manifest?
|
|
15
|
+
|
|
16
|
+
**Root Cause:** Why does this happen? (if known)
|
|
17
|
+
|
|
18
|
+
**Workaround:** How to work around it?
|
|
19
|
+
|
|
20
|
+
**Status:** Open / Resolved / Won't Fix
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Decisions Memory
|
|
2
|
+
|
|
3
|
+
> Document important architectural and implementation decisions here.
|
|
4
|
+
> This helps maintain context across sessions and explains "why" for future reference.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Template Entry
|
|
9
|
+
|
|
10
|
+
*Recorded: YYYY-MM-DD HH:MM:SS*
|
|
11
|
+
|
|
12
|
+
**Context:** What was the situation or requirement?
|
|
13
|
+
|
|
14
|
+
**Options Considered:**
|
|
15
|
+
1. Option A - pros/cons
|
|
16
|
+
2. Option B - pros/cons
|
|
17
|
+
|
|
18
|
+
**Decision:** What was chosen and why?
|
|
19
|
+
|
|
20
|
+
**Implications:** What does this mean going forward?
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Patterns Memory
|
|
2
|
+
|
|
3
|
+
> Document discovered patterns in this codebase.
|
|
4
|
+
> Helps maintain consistency and avoid reinventing solutions.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Template Entry
|
|
9
|
+
|
|
10
|
+
*Recorded: YYYY-MM-DD HH:MM:SS*
|
|
11
|
+
|
|
12
|
+
**Pattern Name:** What is this pattern called?
|
|
13
|
+
|
|
14
|
+
**Where Used:** Which files/components use this?
|
|
15
|
+
|
|
16
|
+
**How It Works:**
|
|
17
|
+
```
|
|
18
|
+
// Code example or description
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**When to Use:** What situations call for this pattern?
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
@@ -32,10 +32,11 @@ Run code quality, security, and architecture audits.
|
|
|
32
32
|
- User invokes `/audit`
|
|
33
33
|
- User invokes `/audit project` (full project scan)
|
|
34
34
|
- User invokes `/audit [feature]` (audit specific feature)
|
|
35
|
-
- **AUTOMATIC:** When BLUEPRINT.md is missing at session start
|
|
36
35
|
- Or: Automatically after VERIFY phase (for features)
|
|
37
36
|
- Or: Part of audit_loop
|
|
38
37
|
|
|
38
|
+
**Note:** When BLUEPRINT.md is missing, the system prompts user for documentation first.
|
|
39
|
+
|
|
39
40
|
## When Required
|
|
40
41
|
Per `system/router.md`, audit is required for:
|
|
41
42
|
- `feature` - New functionality
|
|
@@ -44,8 +45,8 @@ Per `system/router.md`, audit is required for:
|
|
|
44
45
|
|
|
45
46
|
## Arguments
|
|
46
47
|
- `/audit` - Run standard checks (UI + cycles)
|
|
47
|
-
- `/audit project` - Full project scan (
|
|
48
|
-
- `/audit sync` - Compare
|
|
48
|
+
- `/audit project` - Full project scan (technical context)
|
|
49
|
+
- `/audit sync` - Compare user's documentation vs code, one feature at a time
|
|
49
50
|
- `/audit [feature name]` - Deep audit of specific feature
|
|
50
51
|
|
|
51
52
|
---
|
|
@@ -194,13 +195,12 @@ Based on the issues found, I recommend:
|
|
|
194
195
|
|
|
195
196
|
### Type 2: Project Audit (`/audit project`)
|
|
196
197
|
|
|
197
|
-
When `/audit project
|
|
198
|
+
When user explicitly invokes `/audit project`:
|
|
198
199
|
|
|
199
|
-
**IMPORTANT:**
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
- Only ask permission when presenting results to SAVE
|
|
200
|
+
**IMPORTANT:** This is a user-initiated scan for technical context.
|
|
201
|
+
- Scans codebase structure, tech stack, routes, components, APIs
|
|
202
|
+
- Outputs technical context to supplement user-provided documentation
|
|
203
|
+
- Does NOT auto-generate BLUEPRINT.md - user must provide their docs first
|
|
204
204
|
|
|
205
205
|
#### Step 1: Scan Codebase (Single Pass)
|
|
206
206
|
```bash
|
|
@@ -235,9 +235,8 @@ src/
|
|
|
235
235
|
|
|
236
236
|
---
|
|
237
237
|
|
|
238
|
-
###
|
|
238
|
+
### 📋 Features Discovered
|
|
239
239
|
|
|
240
|
-
**Features Discovered:**
|
|
241
240
|
| Feature | Frontend | Backend | Route | Status |
|
|
242
241
|
|---------|----------|---------|-------|--------|
|
|
243
242
|
| [name] | [component] | [api] | [route] | ✅/⚠️ |
|
|
@@ -247,33 +246,32 @@ src/
|
|
|
247
246
|
|
|
248
247
|
---
|
|
249
248
|
|
|
250
|
-
**Should I save
|
|
251
|
-
|
|
252
|
-
- BLUEPRINT.md → Create/update with discoveries
|
|
249
|
+
**Should I save AI_RULES.md updates?**
|
|
250
|
+
(Tech Stack & File Structure)
|
|
253
251
|
```
|
|
254
252
|
|
|
255
253
|
#### Step 3: Save After Approval
|
|
256
|
-
Update
|
|
254
|
+
Update AI_RULES.md with discovered technical context.
|
|
257
255
|
|
|
258
256
|
---
|
|
259
257
|
|
|
260
|
-
### Type 3:
|
|
258
|
+
### Type 3: Documentation Sync (`/audit sync`)
|
|
261
259
|
|
|
262
|
-
Compare
|
|
260
|
+
Compare user's documentation against actual code, **one feature at a time**.
|
|
263
261
|
|
|
264
|
-
#### Step 1: Parse
|
|
265
|
-
Extract features list from the
|
|
262
|
+
#### Step 1: Parse User's Documentation
|
|
263
|
+
Extract features list from the user's PRD/spec/userflow.
|
|
266
264
|
|
|
267
265
|
#### Step 2: For EACH Feature (Serial)
|
|
268
266
|
|
|
269
267
|
```
|
|
270
268
|
Feature 1: [Name]
|
|
271
269
|
↓
|
|
272
|
-
Read
|
|
270
|
+
Read requirements from user's documentation
|
|
273
271
|
↓
|
|
274
272
|
Scan code for this feature's implementation
|
|
275
273
|
↓
|
|
276
|
-
Compare:
|
|
274
|
+
Compare: Documentation ↔ Code
|
|
277
275
|
↓
|
|
278
276
|
Report gaps (one feature only)
|
|
279
277
|
↓
|
|
@@ -289,11 +287,11 @@ THEN → Feature 2
|
|
|
289
287
|
#### Step 3: Report Format (Per Feature)
|
|
290
288
|
|
|
291
289
|
```
|
|
292
|
-
##
|
|
290
|
+
## Documentation Sync: Feature 1 of 5
|
|
293
291
|
|
|
294
292
|
### 📘 User Authentication
|
|
295
293
|
|
|
296
|
-
**
|
|
294
|
+
**Documentation says:**
|
|
297
295
|
- Login with email/password
|
|
298
296
|
- OAuth (Google, GitHub)
|
|
299
297
|
- Password reset flow
|
|
@@ -314,8 +312,8 @@ THEN → Feature 2
|
|
|
314
312
|
|
|
315
313
|
| Gap | Direction | Action |
|
|
316
314
|
|-----|-----------|--------|
|
|
317
|
-
| OAuth GitHub |
|
|
318
|
-
| Password reset email |
|
|
315
|
+
| OAuth GitHub | 📄→💻 | In docs, not in code |
|
|
316
|
+
| Password reset email | 📄→💻 | Incomplete implementation |
|
|
319
317
|
|
|
320
318
|
### Suggested Actions
|
|
321
319
|
|
|
@@ -326,23 +324,23 @@ THEN → Feature 2
|
|
|
326
324
|
|
|
327
325
|
**Options:**
|
|
328
326
|
- `implement` - Build missing code
|
|
329
|
-
- `
|
|
327
|
+
- `descope` - Mark as out of scope for now
|
|
330
328
|
- `skip` - Move to next feature
|
|
331
329
|
- `1` - Only action 1
|
|
332
330
|
```
|
|
333
331
|
|
|
334
332
|
#### Step 4: After User Action
|
|
335
333
|
- If `implement`: Build the missing parts, verify, re-check
|
|
336
|
-
- If `
|
|
334
|
+
- If `descope`: Note as out of scope, move to next feature
|
|
337
335
|
- If `skip`: Log as skipped, move to next feature
|
|
338
336
|
|
|
339
337
|
#### Step 5: Next Feature
|
|
340
|
-
Only after current feature is resolved (fixed/skipped/
|
|
338
|
+
Only after current feature is resolved (fixed/skipped/descoped), show next:
|
|
341
339
|
|
|
342
340
|
```
|
|
343
341
|
✅ Feature 1: User Authentication - SYNCED
|
|
344
342
|
|
|
345
|
-
##
|
|
343
|
+
## Documentation Sync: Feature 2 of 5
|
|
346
344
|
|
|
347
345
|
### 📘 Dashboard...
|
|
348
346
|
```
|
package/.claude/commands/init.md
CHANGED
|
@@ -115,11 +115,12 @@ npm run setup:hooks
|
|
|
115
115
|
- commit-msg
|
|
116
116
|
|
|
117
117
|
**Next steps:**
|
|
118
|
-
1.
|
|
119
|
-
2.
|
|
120
|
-
3.
|
|
118
|
+
1. Provide your project documentation (PRD, spec, userflow, or describe your project)
|
|
119
|
+
2. Your documentation = single source of truth (used directly, no transformation)
|
|
120
|
+
3. Edit `instructions/AI_RULES.md` with your coding standards
|
|
121
|
+
4. Start using Claude Code - it will follow the workflow!
|
|
121
122
|
|
|
122
|
-
Run `/audit project` to
|
|
123
|
+
**Tip:** Run `/audit project` to scan your codebase for technical context.
|
|
123
124
|
```
|
|
124
125
|
|
|
125
126
|
## Arguments
|
|
@@ -30,13 +30,164 @@ print_header() {
|
|
|
30
30
|
echo -e "${BOLD}AUTOWORKFLOW: PROJECT AUDIT${NC}"
|
|
31
31
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
32
32
|
echo ""
|
|
33
|
-
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Mode selection based on arguments
|
|
36
|
+
select_mode() {
|
|
37
|
+
local mode="$1"
|
|
38
|
+
|
|
39
|
+
case "$mode" in
|
|
40
|
+
--from-docs)
|
|
41
|
+
echo "Mode: Generate BLUEPRINT from user-provided documentation"
|
|
42
|
+
echo ""
|
|
43
|
+
echo -e "${CYAN}I will read your provided docs and generate:${NC}"
|
|
44
|
+
echo " • instructions/BLUEPRINT.md (feature tracking)"
|
|
45
|
+
echo " • instructions/AI_RULES.md (coding standards)"
|
|
46
|
+
echo ""
|
|
47
|
+
echo -e "${YELLOW}Please provide the path to your documentation:${NC}"
|
|
48
|
+
echo " • PRD, spec, userflow, or implementation guide"
|
|
49
|
+
echo " • Or paste the content directly"
|
|
50
|
+
echo ""
|
|
51
|
+
;;
|
|
52
|
+
--scan)
|
|
53
|
+
echo "Mode: Scan existing codebase"
|
|
54
|
+
echo ""
|
|
55
|
+
echo "Scanning project structure to supplement your documentation..."
|
|
56
|
+
echo ""
|
|
57
|
+
;;
|
|
58
|
+
--interactive)
|
|
59
|
+
echo "Mode: Interactive specification builder"
|
|
60
|
+
echo ""
|
|
61
|
+
echo -e "${CYAN}I'll help you create a BLUEPRINT.md by asking questions:${NC}"
|
|
62
|
+
echo ""
|
|
63
|
+
echo " 1. What is this project? (brief description)"
|
|
64
|
+
echo " 2. What are the main features?"
|
|
65
|
+
echo " 3. What's the tech stack?"
|
|
66
|
+
echo " 4. Are there any specific requirements?"
|
|
67
|
+
echo ""
|
|
68
|
+
echo -e "${DIM}Answer these and I'll generate your specification.${NC}"
|
|
69
|
+
echo ""
|
|
70
|
+
;;
|
|
71
|
+
*)
|
|
72
|
+
echo "Scanning project to supplement your documentation..."
|
|
73
|
+
echo ""
|
|
74
|
+
;;
|
|
75
|
+
esac
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
79
|
+
# ENHANCED DISCOVERY (Serena-inspired)
|
|
80
|
+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
81
|
+
|
|
82
|
+
# Detect architecture pattern
|
|
83
|
+
detect_architecture() {
|
|
84
|
+
echo -e "${CYAN}[0/8]${NC} Detecting architecture pattern..."
|
|
85
|
+
|
|
86
|
+
local pattern="unknown"
|
|
87
|
+
|
|
88
|
+
# Monorepo detection
|
|
89
|
+
if [ -f "pnpm-workspace.yaml" ] || [ -f "lerna.json" ] || [ -d "packages" ]; then
|
|
90
|
+
pattern="monorepo"
|
|
91
|
+
echo " Pattern: Monorepo"
|
|
92
|
+
if [ -d "packages" ]; then
|
|
93
|
+
echo " Packages:"
|
|
94
|
+
ls -1 packages/ 2>/dev/null | head -5 | while read -r pkg; do
|
|
95
|
+
echo " - $pkg"
|
|
96
|
+
done
|
|
97
|
+
fi
|
|
98
|
+
# Microservices detection
|
|
99
|
+
elif [ -f "docker-compose.yml" ] && [ -d "services" ]; then
|
|
100
|
+
pattern="microservices"
|
|
101
|
+
echo " Pattern: Microservices"
|
|
102
|
+
echo " Services:"
|
|
103
|
+
ls -1 services/ 2>/dev/null | head -5 | while read -r svc; do
|
|
104
|
+
echo " - $svc"
|
|
105
|
+
done
|
|
106
|
+
# Modular monolith detection
|
|
107
|
+
elif [ -d "src/modules" ] || [ -d "src/domains" ]; then
|
|
108
|
+
pattern="modular-monolith"
|
|
109
|
+
echo " Pattern: Modular Monolith"
|
|
110
|
+
local mod_dir="src/modules"
|
|
111
|
+
[ -d "src/domains" ] && mod_dir="src/domains"
|
|
112
|
+
echo " Modules:"
|
|
113
|
+
ls -1 "$mod_dir" 2>/dev/null | head -5 | while read -r mod; do
|
|
114
|
+
echo " - $mod"
|
|
115
|
+
done
|
|
116
|
+
# Feature-based structure
|
|
117
|
+
elif [ -d "src/features" ]; then
|
|
118
|
+
pattern="feature-based"
|
|
119
|
+
echo " Pattern: Feature-based"
|
|
120
|
+
echo " Features:"
|
|
121
|
+
ls -1 src/features/ 2>/dev/null | head -5 | while read -r feat; do
|
|
122
|
+
echo " - $feat"
|
|
123
|
+
done
|
|
124
|
+
# Standard layered
|
|
125
|
+
else
|
|
126
|
+
pattern="layered"
|
|
127
|
+
echo " Pattern: Standard Layered"
|
|
128
|
+
fi
|
|
129
|
+
|
|
34
130
|
echo ""
|
|
131
|
+
|
|
132
|
+
# Save to scan output
|
|
133
|
+
echo "architecture=$pattern" >> "$SCAN_OUTPUT"
|
|
35
134
|
}
|
|
36
135
|
|
|
37
|
-
# Detect
|
|
136
|
+
# Detect essential commands from package.json
|
|
137
|
+
detect_essential_commands() {
|
|
138
|
+
echo -e "${CYAN}[1/8]${NC} Detecting essential commands..."
|
|
139
|
+
|
|
140
|
+
if [ -f "package.json" ]; then
|
|
141
|
+
echo " Available npm scripts:"
|
|
142
|
+
|
|
143
|
+
# Common important scripts
|
|
144
|
+
for script in "dev" "start" "build" "test" "lint" "format" "typecheck" "verify"; do
|
|
145
|
+
if grep -q "\"$script\":" package.json 2>/dev/null; then
|
|
146
|
+
local cmd=$(grep "\"$script\":" package.json | head -1 | sed 's/.*": "\(.*\)".*/\1/' | cut -c1-50)
|
|
147
|
+
echo -e " ${GREEN}✓${NC} npm run $script"
|
|
148
|
+
fi
|
|
149
|
+
done
|
|
150
|
+
|
|
151
|
+
# Check for custom/project-specific scripts
|
|
152
|
+
echo ""
|
|
153
|
+
echo " Other scripts:"
|
|
154
|
+
grep '"[a-z].*":' package.json 2>/dev/null | grep -v '"name"\|"version"\|"description"\|"main"\|"module"\|"types"\|"license"' | head -10 | while read -r line; do
|
|
155
|
+
local script_name=$(echo "$line" | sed 's/.*"\([^"]*\)".*/\1/')
|
|
156
|
+
case "$script_name" in
|
|
157
|
+
dev|start|build|test|lint|format|typecheck|verify) ;;
|
|
158
|
+
*) echo " - npm run $script_name" ;;
|
|
159
|
+
esac
|
|
160
|
+
done
|
|
161
|
+
echo ""
|
|
162
|
+
fi
|
|
163
|
+
|
|
164
|
+
# Check for Makefile
|
|
165
|
+
if [ -f "Makefile" ]; then
|
|
166
|
+
echo " Makefile targets:"
|
|
167
|
+
grep '^[a-zA-Z].*:' Makefile 2>/dev/null | head -5 | while read -r line; do
|
|
168
|
+
local target=$(echo "$line" | cut -d: -f1)
|
|
169
|
+
echo " - make $target"
|
|
170
|
+
done
|
|
171
|
+
echo ""
|
|
172
|
+
fi
|
|
173
|
+
|
|
174
|
+
# Check for common tools
|
|
175
|
+
echo " Tool configuration detected:"
|
|
176
|
+
[ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ] || [ -f "eslint.config.js" ] && echo " - ESLint"
|
|
177
|
+
[ -f ".prettierrc" ] || [ -f "prettier.config.js" ] && echo " - Prettier"
|
|
178
|
+
[ -f "tsconfig.json" ] && echo " - TypeScript"
|
|
179
|
+
[ -f "jest.config.js" ] || [ -f "jest.config.ts" ] && echo " - Jest"
|
|
180
|
+
[ -f "vitest.config.ts" ] && echo " - Vitest"
|
|
181
|
+
[ -f "playwright.config.ts" ] && echo " - Playwright"
|
|
182
|
+
[ -f "cypress.config.ts" ] || [ -f "cypress.config.js" ] && echo " - Cypress"
|
|
183
|
+
[ -f ".github/workflows" ] && echo " - GitHub Actions"
|
|
184
|
+
[ -f "Dockerfile" ] && echo " - Docker"
|
|
185
|
+
echo ""
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# Detect tech stack from package.json (enhanced)
|
|
38
189
|
detect_tech_stack() {
|
|
39
|
-
echo -e "${CYAN}[
|
|
190
|
+
echo -e "${CYAN}[2/8]${NC} Detecting tech stack..."
|
|
40
191
|
|
|
41
192
|
if [ -f "package.json" ]; then
|
|
42
193
|
echo " Found: package.json"
|
|
@@ -44,14 +195,26 @@ detect_tech_stack() {
|
|
|
44
195
|
# Detect framework
|
|
45
196
|
if grep -q '"next"' package.json 2>/dev/null; then
|
|
46
197
|
echo " Framework: Next.js"
|
|
198
|
+
# Detect Next.js version for App vs Pages router
|
|
199
|
+
if [ -d "app" ] || [ -d "src/app" ]; then
|
|
200
|
+
echo " → App Router (Next.js 13+)"
|
|
201
|
+
elif [ -d "pages" ] || [ -d "src/pages" ]; then
|
|
202
|
+
echo " → Pages Router"
|
|
203
|
+
fi
|
|
47
204
|
elif grep -q '"react"' package.json 2>/dev/null; then
|
|
48
205
|
echo " Framework: React"
|
|
49
206
|
elif grep -q '"vue"' package.json 2>/dev/null; then
|
|
50
207
|
echo " Framework: Vue"
|
|
208
|
+
grep -q '"nuxt"' package.json 2>/dev/null && echo " → with Nuxt"
|
|
51
209
|
elif grep -q '"svelte"' package.json 2>/dev/null; then
|
|
52
210
|
echo " Framework: Svelte"
|
|
211
|
+
grep -q '"@sveltejs/kit"' package.json 2>/dev/null && echo " → with SvelteKit"
|
|
53
212
|
elif grep -q '"express"' package.json 2>/dev/null; then
|
|
54
213
|
echo " Framework: Express"
|
|
214
|
+
elif grep -q '"fastify"' package.json 2>/dev/null; then
|
|
215
|
+
echo " Framework: Fastify"
|
|
216
|
+
elif grep -q '"hono"' package.json 2>/dev/null; then
|
|
217
|
+
echo " Framework: Hono"
|
|
55
218
|
fi
|
|
56
219
|
|
|
57
220
|
# Detect styling
|
|
@@ -63,20 +226,42 @@ detect_tech_stack() {
|
|
|
63
226
|
echo " Styling: Emotion"
|
|
64
227
|
fi
|
|
65
228
|
|
|
66
|
-
# Detect database
|
|
229
|
+
# Detect database/ORM
|
|
67
230
|
if grep -q '"prisma"' package.json 2>/dev/null; then
|
|
68
231
|
echo " Database: Prisma"
|
|
232
|
+
elif grep -q '"drizzle-orm"' package.json 2>/dev/null; then
|
|
233
|
+
echo " Database: Drizzle ORM"
|
|
234
|
+
elif grep -q '"typeorm"' package.json 2>/dev/null; then
|
|
235
|
+
echo " Database: TypeORM"
|
|
69
236
|
elif grep -q '"mongoose"' package.json 2>/dev/null; then
|
|
70
237
|
echo " Database: MongoDB (Mongoose)"
|
|
71
238
|
elif grep -q '"pg"' package.json 2>/dev/null; then
|
|
72
239
|
echo " Database: PostgreSQL"
|
|
73
240
|
fi
|
|
74
241
|
|
|
242
|
+
# Detect state management
|
|
243
|
+
if grep -q '"zustand"' package.json 2>/dev/null; then
|
|
244
|
+
echo " State: Zustand"
|
|
245
|
+
elif grep -q '"@reduxjs/toolkit"' package.json 2>/dev/null; then
|
|
246
|
+
echo " State: Redux Toolkit"
|
|
247
|
+
elif grep -q '"jotai"' package.json 2>/dev/null; then
|
|
248
|
+
echo " State: Jotai"
|
|
249
|
+
elif grep -q '"@tanstack/react-query"' package.json 2>/dev/null; then
|
|
250
|
+
echo " State: TanStack Query"
|
|
251
|
+
fi
|
|
252
|
+
|
|
75
253
|
# Detect TypeScript
|
|
76
254
|
if grep -q '"typescript"' package.json 2>/dev/null; then
|
|
77
255
|
echo " Language: TypeScript"
|
|
78
256
|
fi
|
|
79
257
|
|
|
258
|
+
# Detect testing framework
|
|
259
|
+
if grep -q '"vitest"' package.json 2>/dev/null; then
|
|
260
|
+
echo " Testing: Vitest"
|
|
261
|
+
elif grep -q '"jest"' package.json 2>/dev/null; then
|
|
262
|
+
echo " Testing: Jest"
|
|
263
|
+
fi
|
|
264
|
+
|
|
80
265
|
echo ""
|
|
81
266
|
else
|
|
82
267
|
echo " No package.json found"
|
|
@@ -86,7 +271,7 @@ detect_tech_stack() {
|
|
|
86
271
|
|
|
87
272
|
# Scan project structure
|
|
88
273
|
scan_structure() {
|
|
89
|
-
echo -e "${CYAN}[
|
|
274
|
+
echo -e "${CYAN}[3/8]${NC} Scanning project structure..."
|
|
90
275
|
|
|
91
276
|
# Find source directory
|
|
92
277
|
if [ -d "src" ]; then
|
|
@@ -106,7 +291,7 @@ scan_structure() {
|
|
|
106
291
|
|
|
107
292
|
# Scan for routes/pages
|
|
108
293
|
scan_routes() {
|
|
109
|
-
echo -e "${CYAN}[
|
|
294
|
+
echo -e "${CYAN}[4/8]${NC} Scanning routes..."
|
|
110
295
|
|
|
111
296
|
local found=false
|
|
112
297
|
|
|
@@ -147,7 +332,7 @@ scan_routes() {
|
|
|
147
332
|
|
|
148
333
|
# Scan for components
|
|
149
334
|
scan_components() {
|
|
150
|
-
echo -e "${CYAN}[
|
|
335
|
+
echo -e "${CYAN}[5/8]${NC} Scanning components..."
|
|
151
336
|
|
|
152
337
|
local comp_dir=""
|
|
153
338
|
[ -d "src/components" ] && comp_dir="src/components"
|
|
@@ -170,7 +355,7 @@ scan_components() {
|
|
|
170
355
|
|
|
171
356
|
# Scan for API endpoints
|
|
172
357
|
scan_api() {
|
|
173
|
-
echo -e "${CYAN}[
|
|
358
|
+
echo -e "${CYAN}[6/8]${NC} Scanning API endpoints..."
|
|
174
359
|
|
|
175
360
|
local api_dir=""
|
|
176
361
|
[ -d "src/app/api" ] && api_dir="src/app/api"
|
|
@@ -195,7 +380,7 @@ scan_api() {
|
|
|
195
380
|
|
|
196
381
|
# Scan for hooks
|
|
197
382
|
scan_hooks() {
|
|
198
|
-
echo -e "${CYAN}[
|
|
383
|
+
echo -e "${CYAN}[7/8]${NC} Scanning custom hooks..."
|
|
199
384
|
|
|
200
385
|
local hooks_dir=""
|
|
201
386
|
[ -d "src/hooks" ] && hooks_dir="src/hooks"
|
|
@@ -216,41 +401,118 @@ scan_hooks() {
|
|
|
216
401
|
echo ""
|
|
217
402
|
}
|
|
218
403
|
|
|
404
|
+
# Scan for environment and configuration (Serena-inspired onboarding)
|
|
405
|
+
scan_environment() {
|
|
406
|
+
echo -e "${CYAN}[8/8]${NC} Scanning environment and configuration..."
|
|
407
|
+
|
|
408
|
+
# Check for env files
|
|
409
|
+
echo " Environment files:"
|
|
410
|
+
[ -f ".env" ] && echo " - .env (⚠️ ensure not committed)"
|
|
411
|
+
[ -f ".env.local" ] && echo " - .env.local"
|
|
412
|
+
[ -f ".env.example" ] && echo " - .env.example (template)"
|
|
413
|
+
[ -f ".env.development" ] && echo " - .env.development"
|
|
414
|
+
[ -f ".env.production" ] && echo " - .env.production"
|
|
415
|
+
|
|
416
|
+
# Extract env var names from .env.example if it exists
|
|
417
|
+
if [ -f ".env.example" ]; then
|
|
418
|
+
echo ""
|
|
419
|
+
echo " Required environment variables:"
|
|
420
|
+
grep -v '^#' .env.example 2>/dev/null | grep '=' | cut -d= -f1 | head -10 | while read -r var; do
|
|
421
|
+
echo " - $var"
|
|
422
|
+
done
|
|
423
|
+
fi
|
|
424
|
+
|
|
425
|
+
# Check for common config files
|
|
426
|
+
echo ""
|
|
427
|
+
echo " Configuration files:"
|
|
428
|
+
[ -f "next.config.js" ] || [ -f "next.config.mjs" ] && echo " - Next.js config"
|
|
429
|
+
[ -f "vite.config.ts" ] && echo " - Vite config"
|
|
430
|
+
[ -f "tailwind.config.js" ] || [ -f "tailwind.config.ts" ] && echo " - Tailwind config"
|
|
431
|
+
[ -f "drizzle.config.ts" ] && echo " - Drizzle config"
|
|
432
|
+
[ -f "prisma/schema.prisma" ] && echo " - Prisma schema"
|
|
433
|
+
|
|
434
|
+
echo ""
|
|
435
|
+
}
|
|
436
|
+
|
|
219
437
|
# Generate summary
|
|
220
438
|
generate_summary() {
|
|
221
439
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
222
|
-
echo -e "${GREEN}${BOLD}🔍
|
|
440
|
+
echo -e "${GREEN}${BOLD}🔍 SCAN COMPLETE${NC}"
|
|
223
441
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
224
442
|
echo ""
|
|
225
|
-
echo "
|
|
443
|
+
echo "This scan provides technical context about your codebase."
|
|
226
444
|
echo ""
|
|
227
|
-
echo "
|
|
228
|
-
echo " - Tech Stack section (detected above)"
|
|
229
|
-
echo " - File Structure section"
|
|
445
|
+
echo -e "${YELLOW}${BOLD}To generate BLUEPRINT.md, I need your input:${NC}"
|
|
230
446
|
echo ""
|
|
231
|
-
echo "
|
|
232
|
-
echo "
|
|
233
|
-
echo " - Routes section"
|
|
234
|
-
echo " - API endpoints section"
|
|
447
|
+
echo " ${CYAN}Option 1:${NC} Provide existing documentation"
|
|
448
|
+
echo " Share your PRD, spec, userflow, or implementation guide"
|
|
235
449
|
echo ""
|
|
236
|
-
echo
|
|
450
|
+
echo " ${CYAN}Option 2:${NC} Answer a few questions"
|
|
451
|
+
echo " • What does this project do?"
|
|
452
|
+
echo " • What are the main features/user flows?"
|
|
453
|
+
echo " • Any specific requirements or constraints?"
|
|
454
|
+
echo ""
|
|
455
|
+
echo " ${CYAN}Option 3:${NC} Just describe your project"
|
|
456
|
+
echo " Tell me about it in plain language"
|
|
457
|
+
echo ""
|
|
458
|
+
echo -e "${DIM}I'll combine your input with this technical scan to generate:${NC}"
|
|
459
|
+
echo " 📄 instructions/AI_RULES.md (tech stack, coding standards)"
|
|
460
|
+
echo " 📘 instructions/BLUEPRINT.md (features, requirements, tracking)"
|
|
237
461
|
echo ""
|
|
238
462
|
}
|
|
239
463
|
|
|
240
464
|
# Main execution
|
|
241
465
|
main() {
|
|
466
|
+
local mode="${1:-}"
|
|
467
|
+
|
|
242
468
|
print_header
|
|
243
469
|
|
|
244
|
-
#
|
|
470
|
+
# Handle different modes
|
|
471
|
+
case "$mode" in
|
|
472
|
+
--from-docs)
|
|
473
|
+
select_mode "--from-docs"
|
|
474
|
+
exit 0
|
|
475
|
+
;;
|
|
476
|
+
--interactive)
|
|
477
|
+
select_mode "--interactive"
|
|
478
|
+
exit 0
|
|
479
|
+
;;
|
|
480
|
+
--help)
|
|
481
|
+
echo "Usage: blueprint-generator.sh [mode]"
|
|
482
|
+
echo ""
|
|
483
|
+
echo "Modes:"
|
|
484
|
+
echo " (no args) Scan codebase for technical context"
|
|
485
|
+
echo " --from-docs Generate from user-provided documentation"
|
|
486
|
+
echo " --interactive Build specification through Q&A"
|
|
487
|
+
echo " --help Show this help"
|
|
488
|
+
echo ""
|
|
489
|
+
exit 0
|
|
490
|
+
;;
|
|
491
|
+
esac
|
|
492
|
+
|
|
493
|
+
# Default: Scan mode
|
|
494
|
+
echo "Scanning project for technical context..."
|
|
495
|
+
echo "(This supplements your documentation, not replaces it)"
|
|
496
|
+
echo ""
|
|
497
|
+
|
|
498
|
+
# Initialize scan output
|
|
499
|
+
echo "# Project Scan Results" > "$SCAN_OUTPUT"
|
|
500
|
+
echo "Generated: $(date)" >> "$SCAN_OUTPUT"
|
|
501
|
+
echo "" >> "$SCAN_OUTPUT"
|
|
502
|
+
|
|
503
|
+
# Run all scans (Serena-inspired comprehensive discovery)
|
|
504
|
+
detect_architecture
|
|
505
|
+
detect_essential_commands
|
|
245
506
|
detect_tech_stack
|
|
246
507
|
scan_structure
|
|
247
508
|
scan_routes
|
|
248
509
|
scan_components
|
|
249
510
|
scan_api
|
|
250
511
|
scan_hooks
|
|
512
|
+
scan_environment
|
|
251
513
|
|
|
252
|
-
# Generate summary
|
|
514
|
+
# Generate summary - asks for user input
|
|
253
515
|
generate_summary
|
|
254
516
|
}
|
|
255
517
|
|
|
256
|
-
main
|
|
518
|
+
main "$@"
|