autoworkflow 3.8.4 → 3.9.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,2 @@
1
+ # Keep this directory in git
2
+ # Memory files are gitignored by default but templates are kept
@@ -0,0 +1,15 @@
1
+ # Blockers
2
+
3
+ > Known issues and workarounds. Claude edits directly.
4
+
5
+ ---
6
+
7
+ ## Template
8
+ *YYYY-MM-DD*
9
+
10
+ **Issue:** What is the problem?
11
+ **Workaround:** How to work around it?
12
+ **Status:** Open / Resolved
13
+
14
+ ---
15
+
@@ -0,0 +1,15 @@
1
+ # Decisions
2
+
3
+ > Architectural and implementation choices. Claude edits directly.
4
+
5
+ ---
6
+
7
+ ## Template
8
+ *YYYY-MM-DD*
9
+
10
+ **Context:** What was the situation?
11
+ **Decision:** What was chosen and why?
12
+ **Implications:** What does this mean going forward?
13
+
14
+ ---
15
+
@@ -0,0 +1,15 @@
1
+ # Patterns
2
+
3
+ > Discovered codebase patterns. Claude edits directly.
4
+
5
+ ---
6
+
7
+ ## Template
8
+ *YYYY-MM-DD*
9
+
10
+ **Pattern:** What is this pattern?
11
+ **Where:** Which files/components use it?
12
+ **Usage:** When and how to use it?
13
+
14
+ ---
15
+
@@ -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 (generates BLUEPRINT.md)
48
- - `/audit sync` - Compare BLUEPRINT vs code, one feature at a time
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` is invoked OR when BLUEPRINT.md is missing:
198
+ When user explicitly invokes `/audit project`:
198
199
 
199
- **IMPORTANT:** When triggered by missing BLUEPRINT.md, this runs AUTOMATICALLY.
200
- - Do NOT ask "Should I run the audit?"
201
- - Do NOT wait for permission to start
202
- - Just notify and run immediately
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
- ### 📘 BLUEPRINT.md (will create/update)
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 these updates?**
251
- - AI_RULES.md → Update Tech Stack & File Structure
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 both files with discovered information.
254
+ Update AI_RULES.md with discovered technical context.
257
255
 
258
256
  ---
259
257
 
260
- ### Type 3: Blueprint Sync (`/audit sync`)
258
+ ### Type 3: Documentation Sync (`/audit sync`)
261
259
 
262
- Compare BLUEPRINT.md against actual code, **one feature at a time**.
260
+ Compare user's documentation against actual code, **one feature at a time**.
263
261
 
264
- #### Step 1: Parse BLUEPRINT.md
265
- Extract features list from the Features section.
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 BLUEPRINT requirements for this feature
270
+ Read requirements from user's documentation
273
271
 
274
272
  Scan code for this feature's implementation
275
273
 
276
- Compare: BLUEPRINT ↔ Code
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
- ## Blueprint Sync: Feature 1 of 5
290
+ ## Documentation Sync: Feature 1 of 5
293
291
 
294
292
  ### 📘 User Authentication
295
293
 
296
- **BLUEPRINT says:**
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 | 📘→💻 | In BLUEPRINT, not in code |
318
- | Password reset email | 📘→💻 | Incomplete implementation |
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
- - `remove` - Remove from BLUEPRINT (if not needed)
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 `remove`: Update BLUEPRINT.md to remove the item
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/removed), show next:
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
- ## Blueprint Sync: Feature 2 of 5
343
+ ## Documentation Sync: Feature 2 of 5
346
344
 
347
345
  ### 📘 Dashboard...
348
346
  ```
@@ -115,11 +115,12 @@ npm run setup:hooks
115
115
  - commit-msg
116
116
 
117
117
  **Next steps:**
118
- 1. Edit `instructions/AI_RULES.md` with your coding standards
119
- 2. Edit `instructions/BLUEPRINT.md` with your project spec
120
- 3. Start using Claude Code - it will follow the workflow!
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 auto-generate BLUEPRINT.md from your codebase.
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
- echo "Scanning project to generate BLUEPRINT.md..."
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 tech stack from package.json
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}[1/6]${NC} Detecting tech stack..."
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}[2/6]${NC} Scanning project structure..."
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}[3/6]${NC} Scanning routes..."
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}[4/6]${NC} Scanning components..."
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}[5/6]${NC} Scanning API endpoints..."
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}[6/6]${NC} Scanning custom hooks..."
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}🔍 AUDIT COMPLETE${NC}"
440
+ echo -e "${GREEN}${BOLD}🔍 SCAN COMPLETE${NC}"
223
441
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
224
442
  echo ""
225
- echo "Based on this scan, I will generate:"
443
+ echo "This scan provides technical context about your codebase."
226
444
  echo ""
227
- echo " 📄 instructions/AI_RULES.md"
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 " 📘 instructions/BLUEPRINT.md"
232
- echo " - Features table (routes + components + APIs)"
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 -e "${YELLOW}${BOLD}Should I save these files?${NC} (yes/no/edit first)"
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
- # Run all scans
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 "$@"