viepilot 2.41.0 → 2.45.3

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/bin/viepilot.cjs +32 -0
  3. package/bin/vp-tools.cjs +95 -0
  4. package/docs/brainstorm/session-2026-04-24.md +131 -0
  5. package/docs/brainstorm/session-2026-04-25.md +109 -0
  6. package/lib/domain-packs/ai-product.json +33 -0
  7. package/lib/domain-packs/data-science.json +33 -0
  8. package/lib/domain-packs/devops.json +33 -0
  9. package/lib/domain-packs/mobile.json +33 -0
  10. package/lib/domain-packs/web-saas.json +33 -0
  11. package/lib/viepilot-calibrate.cjs +279 -0
  12. package/lib/viepilot-install.cjs +5 -3
  13. package/lib/viepilot-persona.cjs +446 -0
  14. package/package.json +1 -1
  15. package/skills/vp-audit/SKILL.md +10 -0
  16. package/skills/vp-auto/SKILL.md +10 -0
  17. package/skills/vp-brainstorm/SKILL.md +16 -1
  18. package/skills/vp-crystallize/SKILL.md +10 -0
  19. package/skills/vp-debug/SKILL.md +10 -0
  20. package/skills/vp-design/SKILL.md +219 -0
  21. package/skills/vp-docs/SKILL.md +10 -0
  22. package/skills/vp-evolve/SKILL.md +10 -0
  23. package/skills/vp-info/SKILL.md +10 -0
  24. package/skills/vp-pause/SKILL.md +10 -0
  25. package/skills/vp-persona/SKILL.md +207 -0
  26. package/skills/vp-proposal/SKILL.md +10 -0
  27. package/skills/vp-request/SKILL.md +10 -0
  28. package/skills/vp-resume/SKILL.md +10 -0
  29. package/skills/vp-rollback/SKILL.md +34 -1
  30. package/skills/vp-skills/SKILL.md +10 -0
  31. package/skills/vp-status/SKILL.md +10 -0
  32. package/skills/vp-task/SKILL.md +10 -0
  33. package/skills/vp-ui-components/SKILL.md +10 -0
  34. package/skills/vp-update/SKILL.md +10 -0
  35. package/workflows/autonomous.md +59 -0
  36. package/workflows/brainstorm.md +148 -1
  37. package/workflows/crystallize.md +111 -0
  38. package/workflows/design.md +601 -0
  39. package/workflows/evolve.md +9 -0
  40. package/workflows/rollback.md +79 -10
@@ -41,6 +41,16 @@ version, `{adapter_id}` with the active adapter (claude-code / cursor / antigrav
41
41
  - `config.json` → `update.check: false` → skip this step entirely
42
42
  - Show at most once per session (`update_check_done` session guard)
43
43
  </version_check>
44
+ <persona_context>
45
+ ## Persona Context Injection (ENH-073)
46
+ At skill start, run:
47
+ ```bash
48
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona auto-switch
49
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona context
50
+ ```
51
+ Inject the output as `## User Persona` context before any task execution.
52
+ Silent if command unavailable or errors.
53
+ </persona_context>
44
54
 
45
55
 
46
56
  <cursor_skill_adapter>
@@ -41,6 +41,16 @@ version, `{adapter_id}` with the active adapter (claude-code / cursor / antigrav
41
41
  - `config.json` → `update.check: false` → skip this step entirely
42
42
  - Show at most once per session (`update_check_done` session guard)
43
43
  </version_check>
44
+ <persona_context>
45
+ ## Persona Context Injection (ENH-073)
46
+ At skill start, run:
47
+ ```bash
48
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona auto-switch
49
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona context
50
+ ```
51
+ Inject the output as `## User Persona` context before any task execution.
52
+ Silent if command unavailable or errors.
53
+ </persona_context>
44
54
 
45
55
 
46
56
  <cursor_skill_adapter>
@@ -61,6 +61,16 @@ cat .viepilot/ROADMAP.md
61
61
  Read `~/.viepilot/config.json` → `COMMUNICATION_LANG` (default: `en`).
62
62
  Use `COMMUNICATION_LANG` for all banners, control-point messages, and user-facing output in this session.
63
63
 
64
+ ### Persona Context (ENH-073)
65
+ After loading AI-GUIDE.md and TRACKER.md, run:
66
+ ```bash
67
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona auto-switch
68
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona context
69
+ ```
70
+ Inject output as `## User Persona` block into each task's execution context.
71
+ Use `persona.stacks` for stack preflight matching (prefer persona stacks over generic detection).
72
+ Silent if command unavailable or errors — do not fail the phase.
73
+
64
74
  ### Skill Context Load (FEAT-020)
65
75
 
66
76
  After loading context files, load the project's skill decisions:
@@ -300,6 +310,55 @@ If stack cache is missing:
300
310
  - warn and optionally run quick research
301
311
  - then continue with explicit assumptions noted in task logs
302
312
 
313
+ #### Preflight 5.5 — Design.MD Token Injection (ENH-076)
314
+
315
+ After Stack Preflight, if `design.md` exists at project root (or nearest parent directory):
316
+
317
+ **Step A — Build TOKEN_MAP** (parse YAML front matter):
318
+ - `TOKEN_MAP.colors.*` — primary, surface, accent, error, success, warning
319
+ - `TOKEN_MAP.typography.*` — fontFamily, fontSize, fontWeight, lineHeight
320
+ - `TOKEN_MAP.spacing.*` — base, scale
321
+ - `TOKEN_MAP.rounded.*` — sm, md, lg, full
322
+
323
+ **Step B — UI task detection** (check task title + file paths + objective text):
324
+ ```
325
+ UI_KEYWORDS = [
326
+ html, css, style, component, tailwind, layout, button, card,
327
+ form, page, ui, frontend, color, font, typography, responsive, design
328
+ ]
329
+ ```
330
+ If NO UI_KEYWORDS matched → skip Design.MD injection entirely for this task.
331
+
332
+ **Step C — Injection levels (when UI task detected):**
333
+
334
+ - **Level 1 — Silent context injection (always):**
335
+ Token map injected as implicit constraint in execution context.
336
+ AI naturally applies brand tokens when generating HTML/CSS.
337
+ No output shown to user.
338
+
339
+ - **Level 2 — Checklist items (when task has explicit UI acceptance criteria):**
340
+ Auto-append to task checklist:
341
+ ```
342
+ - [ ] Primary color uses TOKEN_MAP.colors.primary (or var(--color-primary))
343
+ - [ ] Font family matches TOKEN_MAP.typography.fontFamily
344
+ - [ ] Spacing follows TOKEN_MAP.spacing.base unit
345
+ ```
346
+
347
+ - **Level 3 — Post-task design audit (when task output includes .html or .css files):**
348
+ After generating output: scan for token deviations.
349
+ Auto-fix: obvious wrong fonts or exact hex mismatches.
350
+ AUQ on Claude Code terminal when judgment call required.
351
+ Report:
352
+ ```
353
+ 🎨 Design.MD check: ✅ Colors ✅ Typography ⚠️ 1 spacing deviation (auto-fixed)
354
+ ```
355
+
356
+ **Edge cases:**
357
+ - Backend-only task (no UI_KEYWORDS) → skip entirely
358
+ - design.md missing a token → inject only present tokens, no fail
359
+ - Monorepo → nearest `design.md` wins (task dir → parent → project root)
360
+ - Token conflict with Tailwind config → AUQ: Use design.md / Use Tailwind config / Update both
361
+
303
362
  #### Scaffold-First Gate (BUG-020)
304
363
 
305
364
  When the stack preflight identifies a **framework stack** AND the current task is a **project setup / init task** (keywords in title or objective: "set up", "initialize", "create project", "scaffold", "bootstrap", "new project", "install Laravel/Next/Nest/Rails/Django"):
@@ -32,8 +32,33 @@ If the user writes in a different language during the session, that takes preced
32
32
  If `~/.viepilot/config.json` is absent, default to `en` — do not fail.
33
33
  </step>
34
34
 
35
+ <step name="persona_domain_pack">
36
+ ## 0B. Persona Domain Pack Integration (ENH-073)
37
+
38
+ At session start, before presenting topics, run:
39
+ ```bash
40
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona auto-switch
41
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona context
42
+ ```
43
+
44
+ Store the result as `PERSONA_CONTEXT`. If command unavailable or errors → `PERSONA_CONTEXT = null`, continue silently.
45
+
46
+ **If `PERSONA_CONTEXT` is available:**
47
+ 1. Read `persona.domain` — load corresponding `lib/domain-packs/{domain}.json`
48
+ - If domain is array (merged persona): load all packs and union their fields
49
+ 2. Apply to topic list:
50
+ - Prepend `extra_topics` not already in template (injected before session topics)
51
+ - Reorder template topics by `topic_priority` (matching topics float to top)
52
+ - Remove topics whose id is in `persona.brainstorm.topic_skip`
53
+ 3. When phase discussion begins: suggest `phase_template.phases` from domain pack as default ordering
54
+ 4. When Architect Design Mode activates: add domain pack `architect_pages` to workspace
55
+ 5. If `persona.confidence < 0.6`: add inline note "(persona auto-detected, may be inaccurate — run /vp-persona to refine)" — not a blocking prompt
56
+
57
+ **Persona context is silently injected into the session — no banner, no AUQ.**
58
+ </step>
59
+
35
60
  <step name="detect_embedded_domain">
36
- ## 0B. Detect Embedded Domain (ENH-071)
61
+ ## 0C. Detect Embedded Domain (ENH-071)
37
62
 
38
63
  Scan the user's **initial message** (and, on `--continue`, the prior session content) for embedded trigger keywords.
39
64
 
@@ -403,6 +428,46 @@ For each topic:
403
428
  4. Suggest alternatives if needed
404
429
  5. Record decisions
405
430
 
431
+ ### Mid-session Structured Choice Rule (BUG-022)
432
+
433
+ When presenting a decision with **≥2 discrete named options** during Q&A (e.g. "Hero first
434
+ or Features section?", "lean into multi-adapter or persona angle?", any numbered choice set),
435
+ use adapter-aware prompts:
436
+
437
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`. AUQ spec:
438
+ > - question: "{The direction/decision question}"
439
+ > - header: "{short label, ≤12 chars}"
440
+ > - options: one entry per discrete choice (2–4 options per AUQ call)
441
+ > - multiSelect: false (unless user explicitly wants multi-select)
442
+ > **Cursor / Codex / Antigravity / Copilot:** present as plain numbered list.
443
+
444
+ **Exempt from AUQ** (remain plain conversational text):
445
+ - Open-ended questions with no discrete choices ("Anything else you'd like to add?")
446
+ - Follow-up clarification questions ("Tell me more about X")
447
+ - Questions where the expected answer is a free-form description
448
+
449
+ **AUQ per decision, not per topic:** One AUQ call per structured decision point.
450
+ Do not bundle multiple unrelated decisions into a single AUQ call.
451
+
452
+ ### Mid-session Transition Prompt Rule (BUG-023)
453
+
454
+ When the AI offers **session-flow choices** at a section or topic boundary — after presenting
455
+ a table, completing an analysis, or finishing a discussion topic — use adapter-aware prompts:
456
+
457
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`. Canonical AUQ spec:
458
+ > - question: "What would you like to do next?"
459
+ > - header: "Next step"
460
+ > - options (vary by context; always ≥2):
461
+ > - label: "Save session → /vp-crystallize", description: "Generate implementation specs"
462
+ > - label: "Update UI Direction artifacts", description: "Update index.html/notes.md now"
463
+ > - label: "Continue discussing", description: "Explore another section or topic"
464
+ > - multiSelect: false
465
+ > **Cursor / Codex / Antigravity / Copilot:** present as plain numbered list.
466
+
467
+ **Scope:** session-FLOW control choices only — distinct from BUG-022 (Q&A content/direction
468
+ decisions during Q&A). Triggered when offering: save/crystallize, update artifacts, or
469
+ continue/discuss more. NOT triggered for content questions about what to build or design.
470
+
406
471
  ### Landing Page Deep-Dive (activated contextually)
407
472
  If the user is brainstorming a landing page / homepage / marketing page:
408
473
 
@@ -458,6 +523,71 @@ If the user is brainstorming a project with UI/UX or requests a visual design:
458
523
  - Update HTML/CSS direction directly
459
524
  - Record decision + rationale in `notes.md` (single source of truth for design intent)
460
525
 
526
+ ### Design Token Extraction (ENH-076)
527
+
528
+ **Trigger:** UI Direction Mode active (`--ui` flag) OR ≥2 design keywords detected in session:
529
+ `color` / `font` / `brand` / `spacing` / `typography` / `palette` / `theme` / `style`
530
+
531
+ **Extraction process:**
532
+ During Q&A, AI tracks design decisions and maps them to a TOKEN_MAP:
533
+ - Color mentions → `tokens.colors.*` (primary, surface, accent, error, success, warning)
534
+ - Font/typeface mentions → `tokens.typography.fontFamily`, `fontSize`
535
+ - Size/scale/rhythm mentions → `tokens.spacing.base`, `tokens.spacing.scale`
536
+ - Roundness/corner mentions → `tokens.rounded.*` (sm/md/lg/full)
537
+
538
+ **Output — `.viepilot/ui-direction/{session-id}/design.md`** (Design.MD v1 spec):
539
+ ```yaml
540
+ ---
541
+ name: "{project-name}"
542
+ description: "{one-line brand description from session}"
543
+ colors:
544
+ primary: "{hex}"
545
+ surface: "{hex}"
546
+ accent: "{hex}"
547
+ typography:
548
+ fontFamily: "{font}, sans-serif"
549
+ fontSize:
550
+ base: 16
551
+ spacing:
552
+ base: 8
553
+ scale: [4, 8, 16, 24, 32, 48]
554
+ rounded:
555
+ sm: 4px
556
+ md: 8px
557
+ ---
558
+
559
+ ## Overview
560
+ {Brand personality extracted from session}
561
+
562
+ ## Colors
563
+ {Color rationale from session decisions}
564
+
565
+ ## Typography
566
+ {Font rationale from session decisions}
567
+ ```
568
+
569
+ **notes.md section added** (append to session notes.md):
570
+ ```yaml
571
+ ## design_tokens
572
+ colors:
573
+ primary: "{hex}"
574
+ typography:
575
+ fontFamily: "{font}"
576
+ spacing_base: 8
577
+ design_md_path: .viepilot/ui-direction/{session-id}/design.md
578
+ design_md_generated: true
579
+ ```
580
+
581
+ **After generation:** Show inline summary:
582
+ ```
583
+ 🎨 Design.MD generated: primary={hex} | font={font} | spacing={n}px
584
+ Path: .viepilot/ui-direction/{session-id}/design.md
585
+ ```
586
+
587
+ **Incremental updates:** If user refines a color or font later in the session, update
588
+ `design.md` and `notes.md ## design_tokens` in place (same as how `index.html` is updated
589
+ incrementally as design decisions evolve).
590
+
461
591
  ### Skill Registry Integration (FEAT-020)
462
592
 
463
593
  **Trigger**: UI Direction Mode is active (at least one HTML file being generated or updated).
@@ -671,6 +801,23 @@ Activate Architect Design Mode so I can create an HTML visualization?
671
801
  | `entity-mgmt.html` | Admin entity CRUD matrix: entity name, admin ops (C/R/U/D), soft delete flag, bulk actions, audit trail, multi-tenant scope; import/export summary table (ENH-068) |
672
802
  | `content.html` | Content types, lifecycle states, creator permission matrix, taxonomy tree, media storage config, SEO field schema |
673
803
  | `user-data.html` | User-owned data: profile field list, privacy rights matrix (export/erasure), connected OAuth providers, session/device management, 2FA config, consent log schema |
804
+ | `design.html` | Design system visual reference: color swatches grid, typography scale table, spacing grid, border-radius samples, component token table (ENH-076) |
805
+
806
+ **design.html trigger:** Architect Mode active AND (`design.md` present in session dir OR `## design_tokens` in `notes.md`).
807
+
808
+ **design.html content sections:**
809
+
810
+ 1. **Color Palette** — swatch grid: colored square + hex value + semantic label, grouped as Brand (primary/accent) | Neutral (surface/muted) | Semantic (error/success/warning)
811
+ 2. **Typography Scale** — table: Level | Font Family | Size | Weight | Line Height | Example text (H1 → H2 → H3 → Body → Caption → Code)
812
+ 3. **Spacing Grid** — visual row of boxes with increasing widths (4px, 8px, 16px, 24px, 32px, 48px), labeled spacing-1 through spacing-12
813
+ 4. **Shape / Border Radius** — 4 visual boxes showing sharp/subtle/rounded/pill radii with CSS var labels (`--rounded-sm` → `--rounded-full`)
814
+ 5. **Component Tokens** — table: Component | Token | Value (rendered only if `components:` section exists in design.md)
815
+
816
+ **Sync rule:** When `notes.md ## design_tokens` is updated (e.g. via new UI direction keywords), regenerate `design.html` sections — same incremental update pattern as other Architect pages.
817
+
818
+ **Hub nav:** Add `<a href="design.html">🎨 Design System</a>` to `index.html` nav when `design.html` is created. Update `## Pages inventory` in `notes.md`.
819
+
820
+ **Format:** Pure HTML + inline `<style>`, no external CSS/JS dependencies — consistent with all other Architect workspace pages.
674
821
 
675
822
  #### Admin & Governance Detection (ENH-063)
676
823
 
@@ -907,6 +907,20 @@ When `IS_BROWNFIELD=true`, the following table governs which steps execute:
907
907
  </step>
908
908
 
909
909
  <step name="analyze_brainstorm">
910
+ ## Step 0C: Persona output_style adaptation (ENH-073)
911
+
912
+ Read active persona via:
913
+ ```bash
914
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona get
915
+ ```
916
+
917
+ Apply `output_style` to document generation in Steps 1D and 1E:
918
+ - `lean` → concise docs: summary sections, skip boilerplate headers, short descriptions
919
+ - `balanced` → standard docs (default if persona unavailable)
920
+ - `enterprise` → full docs: compliance sections, decision rationale appendix, detailed risk notes
921
+
922
+ Silent if persona unavailable → use `balanced` default.
923
+
910
924
  ## Step 1: Analyze Brainstorm
911
925
 
912
926
  ```bash
@@ -1397,6 +1411,103 @@ If notes.md contains any of: `## hw_topology`, `## pin_map`, `## memory_layout`,
1397
1411
 
1398
1412
  ---
1399
1413
 
1414
+ ### Step 1D.14 — Design.MD Export (ENH-076)
1415
+
1416
+ **Trigger (gate fires when ANY of):**
1417
+ - `design.md` exists in `.viepilot/ui-direction/{session-id}/`
1418
+ - `notes.md` contains `## design_tokens` section
1419
+ - Brainstorm session text contains ≥3 design keywords: `color` / `font` / `brand` / `spacing` / `typography` / `palette` / `theme` / `rounded` / `style`
1420
+
1421
+ **Skip conditions (gate does NOT fire when ANY of):**
1422
+ - `notes.md` has `design_md_status: skipped` (idempotent — user already skipped this session)
1423
+ - `notes.md` has `design_md_status: exported` (already exported this session)
1424
+ - Session has no UI components and no design keywords
1425
+
1426
+ **Gate — AUQ (mandatory-acknowledge — user must select one option):**
1427
+
1428
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`:
1429
+ > - question: "Design tokens found in this session. What would you like to do with design.md?"
1430
+ > - header: "design.md"
1431
+ > - options:
1432
+ > - label: "Export to project root" (Recommended)
1433
+ > description: "Copy design.md, update ARCHITECTURE.md + PROJECT-CONTEXT.md"
1434
+ > - label: "Finalize & export"
1435
+ > description: "Complete any missing tokens via Q&A, then export"
1436
+ > - label: "Skip this time"
1437
+ > description: "Note: vp-auto will not apply brand tokens to UI tasks"
1438
+ > **Cursor / Codex / Antigravity / Copilot:** present as plain numbered list.
1439
+
1440
+ **Export pipeline (options 1 + 2):**
1441
+
1442
+ 1. **Source:** `.viepilot/ui-direction/{session-id}/design.md`
1443
+ 2. **Destination:** `{project-root}/design.md`
1444
+ - If `design.md` already exists at project root → AUQ (or plain numbered list on non-terminal):
1445
+ Override with new tokens / Merge (new fills gaps, existing takes precedence) / Keep existing / View diff
1446
+ 3. **Update `ARCHITECTURE.md`** — append `## Design System` section:
1447
+ ```markdown
1448
+ ## Design System
1449
+
1450
+ > Generated from Design.MD spec (v1)
1451
+ > Source: `.viepilot/ui-direction/{session-id}/design.md`
1452
+ > Last updated: {crystallize-date}
1453
+
1454
+ | Category | Token | Value |
1455
+ |----------|-------|-------|
1456
+ | Colors | primary | {hex} |
1457
+ | Colors | surface | {hex} |
1458
+ | Typography | fontFamily | {font} |
1459
+ | Spacing | base | {n}px |
1460
+
1461
+ **Full spec:** See `design.md` at project root.
1462
+ ```
1463
+ 4. **Update `PROJECT-CONTEXT.md`** — add field:
1464
+ ```
1465
+ design_md: true
1466
+ ```
1467
+ 5. **Update `notes.md`** — set:
1468
+ ```yaml
1469
+ design_md_status: exported
1470
+ design_md_exported_at: {timestamp}
1471
+ ```
1472
+
1473
+ **Skip pipeline (option 3):**
1474
+ - Write to `notes.md`:
1475
+ ```yaml
1476
+ design_md_status: skipped
1477
+ design_md_skipped_at: {timestamp}
1478
+ ```
1479
+ - Show warning: `⚠️ design.md skipped — vp-auto will not apply brand tokens to UI tasks`
1480
+
1481
+ **Post-Export Handoff: vp-design --sync (ENH-077)**
1482
+
1483
+ After **successful export** (export pipeline steps 1–5 complete), offer sync handoff:
1484
+
1485
+ **Skip condition:** If no stylesheet target detected (no `tailwind.config.js`, no `.css`, no `.scss` files in project) → skip AUQ silently. Print:
1486
+ > `Note: no stylesheet target detected. Run /vp-design --sync after adding your stylesheets.`
1487
+
1488
+ Otherwise:
1489
+
1490
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`:
1491
+ > - question: "design.md exported to project root. Sync design tokens to your stylesheets now?"
1492
+ > - header: "Sync tokens?"
1493
+ > - options:
1494
+ > - label: "Run /vp-design --sync now (Recommended)"
1495
+ > description: "Auto-applies tokens to Tailwind / CSS vars / SCSS — stack auto-detected"
1496
+ > - label: "Skip — run manually later"
1497
+ > description: "Run /vp-design --sync yourself when ready"
1498
+ >
1499
+ > **Cursor / Codex / Antigravity / Copilot:** Text fallback:
1500
+ > ```
1501
+ > design.md exported. Next step:
1502
+ > /vp-design --sync Apply tokens to Tailwind / CSS / SCSS
1503
+ > ```
1504
+
1505
+ **On selection:**
1506
+ - "Run /vp-design --sync now" → invoke `/vp-design --sync` skill
1507
+ - "Skip" → print: `Tip: run /vp-design --sync to apply design tokens to your stylesheets.`
1508
+
1509
+ ---
1510
+
1400
1511
  ### Step 1D-a: arch_to_ui_sync noted items → UI Pages → Component Map (ENH-069 Gap 5)
1401
1512
 
1402
1513
  After reading `notes.md → ## arch_to_ui_sync[]`, for each entry with `status: noted`: