viepilot 2.23.0 → 2.45.2

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 (52) hide show
  1. package/CHANGELOG.md +288 -0
  2. package/README.md +6 -6
  3. package/bin/viepilot.cjs +140 -1
  4. package/bin/vp-tools.cjs +204 -0
  5. package/docs/brainstorm/session-2026-04-20.md +261 -0
  6. package/docs/brainstorm/session-2026-04-24.md +131 -0
  7. package/docs/brainstorm/session-2026-04-25.md +109 -0
  8. package/docs/skills-reference.md +22 -0
  9. package/docs/user/features/adapters.md +2 -2
  10. package/docs/user/features/scaffold-first.md +62 -0
  11. package/docs/user/features/skill-registry.md +125 -0
  12. package/lib/adapters/antigravity.cjs +5 -4
  13. package/lib/domain-packs/ai-product.json +33 -0
  14. package/lib/domain-packs/data-science.json +33 -0
  15. package/lib/domain-packs/devops.json +33 -0
  16. package/lib/domain-packs/mobile.json +33 -0
  17. package/lib/domain-packs/web-saas.json +33 -0
  18. package/lib/skill-installer.cjs +274 -0
  19. package/lib/skill-registry.cjs +212 -0
  20. package/lib/viepilot-calibrate.cjs +279 -0
  21. package/lib/viepilot-persona.cjs +446 -0
  22. package/lib/viepilot-update.cjs +113 -0
  23. package/package.json +1 -1
  24. package/skills/vp-audit/SKILL.md +67 -9
  25. package/skills/vp-auto/SKILL.md +54 -0
  26. package/skills/vp-brainstorm/SKILL.md +124 -2
  27. package/skills/vp-crystallize/SKILL.md +82 -0
  28. package/skills/vp-debug/SKILL.md +37 -0
  29. package/skills/vp-design/SKILL.md +219 -0
  30. package/skills/vp-docs/SKILL.md +37 -0
  31. package/skills/vp-evolve/SKILL.md +69 -6
  32. package/skills/vp-info/SKILL.md +37 -0
  33. package/skills/vp-pause/SKILL.md +37 -0
  34. package/skills/vp-persona/SKILL.md +207 -0
  35. package/skills/vp-proposal/SKILL.md +37 -0
  36. package/skills/vp-request/SKILL.md +62 -6
  37. package/skills/vp-resume/SKILL.md +37 -0
  38. package/skills/vp-rollback/SKILL.md +61 -1
  39. package/skills/vp-skills/SKILL.md +311 -0
  40. package/skills/vp-status/SKILL.md +37 -0
  41. package/skills/vp-task/SKILL.md +37 -0
  42. package/skills/vp-ui-components/SKILL.md +37 -0
  43. package/skills/vp-update/SKILL.md +37 -0
  44. package/templates/phase/TASK.md +7 -0
  45. package/templates/project/PROJECT-CONTEXT.md +76 -0
  46. package/workflows/audit.md +131 -0
  47. package/workflows/autonomous.md +199 -0
  48. package/workflows/brainstorm.md +1172 -9
  49. package/workflows/crystallize.md +639 -3
  50. package/workflows/design.md +601 -0
  51. package/workflows/evolve.md +9 -0
  52. package/workflows/rollback.md +79 -10
@@ -454,6 +454,137 @@ fi
454
454
  ```
455
455
  </step>
456
456
 
457
+ <step name="autolog_gate">
458
+ ## 5b. Auto-Log Gate (ENH-070)
459
+
460
+ **Skip condition**: if `--no-autolog` flag is set → skip this entire step; proceed to Step 6.
461
+
462
+ After the audit report is shown (Step 5), automatically log each detected issue as a request file — no manual `/vp-request` call needed.
463
+
464
+ ### Tier → Request Type Mapping
465
+
466
+ | Tier | Issue category | Request type | Priority |
467
+ |------|----------------|-------------|----------|
468
+ | 1 | State inconsistency / HANDOFF drift / git tag missing | BUG | medium |
469
+ | 1 | Execute-first ordering risk (BUG-001 heuristic) | BUG | medium |
470
+ | 2 | Doc drift (README/CHANGELOG version mismatch) | BUG | low |
471
+ | 2 | Missing docs / placeholder URLs | ENH | low |
472
+ | 3 | Stack violation / correctness anti-pattern | BUG | high |
473
+ | 3 | Stack improvement / best-practice gap | ENH | medium |
474
+ | 4 | Framework integrity gap (count drift, missing docs) | ENH | high |
475
+
476
+ ### Duplicate Detection (before creating any file)
477
+
478
+ For each finding, before writing a new request file:
479
+ 1. List `.viepilot/requests/*.md` (only files with `Status: new | triaged | in_progress`)
480
+ 2. For each open request, check:
481
+ - Title match: case-insensitive substring ≥ 70% overlap with the finding text
482
+ - File overlap: any file path from the finding appears in the request's `## Related → Files`
483
+ 3. If duplicate found:
484
+ - Append to the existing file under `## Discussion`:
485
+ `Re-detected by vp-audit {date}: {finding_text}`
486
+ - Mark as `auto_logged_deduped` (do NOT create a new file)
487
+ 4. If no duplicate: create new request file → mark as `auto_logged_new`
488
+
489
+ ### Create Request File
490
+
491
+ Path: `.viepilot/requests/{TYPE}-{next_available_N}.md`
492
+
493
+ ```markdown
494
+ # {TYPE}: {title from audit finding}
495
+
496
+ ## Meta
497
+ - **ID**: {TYPE}-{N}
498
+ - **Type**: Bug | Enhancement
499
+ - **Status**: new
500
+ - **Priority**: {priority from tier table above}
501
+ - **Created**: {today}
502
+ - **Reporter**: vp-audit (auto-logged)
503
+ - **Assignee**: AI
504
+ - **Source**: auto-logged by vp-audit Tier {tier}
505
+
506
+ ## Summary
507
+ {audit finding text verbatim}
508
+
509
+ ## Details
510
+ - **Tier**: {tier}
511
+ - **Audit date**: {today}
512
+ - **Affected files**: {files from finding, if any}
513
+
514
+ ## Acceptance Criteria
515
+ - [ ] Fix the detected issue
516
+ - [ ] Re-run vp-audit: this finding no longer appears
517
+
518
+ ## Related
519
+ - Files: {affected files}
520
+ - Dependencies: —
521
+
522
+ ## Resolution
523
+
524
+ ```
525
+
526
+ ### Update TRACKER.md
527
+
528
+ After creating all new request files, append each new ID to the TRACKER.md Decision Log:
529
+ ```
530
+ | {today} | {TYPE}-{N} auto-logged by vp-audit Tier {tier}: {short title} | `vp-audit` | Backlog |
531
+ ```
532
+
533
+ ### Summary counters
534
+ Track across all tiers:
535
+ - `auto_logged_new`: count of new `.viepilot/requests/` files created
536
+ - `auto_logged_deduped`: count of existing request files updated (re-detected note appended)
537
+
538
+ If `auto_logged_new == 0` AND `auto_logged_deduped == 0` (no issues found): skip banner — proceed to Step 6 silently.
539
+
540
+ ### Post-Audit Routing Banner (ENH-070)
541
+
542
+ After auto-logging completes (and `auto_logged_new > 0` OR `auto_logged_deduped > 0`), display:
543
+
544
+ ```
545
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
546
+ VP-AUDIT: {TOTAL_ISSUES} issue(s) found
547
+ Requests logged: {auto_logged_new} new, {auto_logged_deduped} updated
548
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
549
+
550
+ Logged:
551
+ {TYPE}-{N}: {short title} [Tier {T}]
552
+ {TYPE}-{N}: {short title} [Tier {T}]
553
+ ...
554
+
555
+ (Re-detected on existing requests: {list IDs, or "none"})
556
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
557
+ ```
558
+
559
+ **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`:
560
+ ```
561
+ question: "{N} gap(s) logged. What would you like to do?"
562
+ options:
563
+ - label: "Plan fix phase → /vp-evolve (Recommended)"
564
+ description: "Create ROADMAP entry + task files for logged requests now"
565
+ - label: "Auto-fix now → /vp-auto --fix"
566
+ description: "Apply auto-fixable issues immediately (Tier 1/2 only)"
567
+ - label: "Skip — review later"
568
+ description: "Requests are saved in .viepilot/requests/ — plan when ready"
569
+ ```
570
+
571
+ On selection:
572
+ - **"Plan fix phase → /vp-evolve"**: invoke `/vp-evolve {logged-request-IDs}`
573
+ - **"Auto-fix now → /vp-auto --fix"**: proceed to Step 6 (auto-fix mode)
574
+ - **"Skip — review later"**: print `"Requests saved. Run /vp-evolve {IDs} when ready."` and exit
575
+
576
+ **Text fallback (other adapters):**
577
+ ```
578
+ Next actions:
579
+ /vp-evolve {IDs} Plan fix phase (Recommended)
580
+ /vp-auto --fix Auto-fix Tier 1/2 issues
581
+ skip Review later
582
+ ```
583
+
584
+ **If `--no-autolog` was set**: skip this banner entirely; show only the plain audit report from Step 5 and proceed to Step 6.
585
+
586
+ </step>
587
+
457
588
  <step name="fix">
458
589
  ## 6. Auto-Fix (if requested)
459
590
 
@@ -61,6 +61,40 @@ 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
+
74
+ ### Skill Context Load (FEAT-020)
75
+
76
+ After loading context files, load the project's skill decisions:
77
+
78
+ ```bash
79
+ # Read PROJECT-CONTEXT.md ## Skills section
80
+ SKILL_CONTEXT=$(grep -A 100 "^## Skills" .viepilot/PROJECT-CONTEXT.md 2>/dev/null | \
81
+ head -n $(grep -n "^## " .viepilot/PROJECT-CONTEXT.md | awk -F: 'NR==2{print $1}'))
82
+ ```
83
+
84
+ Build `SKILL_CONTEXT_MAP` in session memory:
85
+ - Parse `## Skills` table rows
86
+ - For each row: extract `id`, `source`, `required` (yes/no), `phases` (comma list)
87
+ - Load best_practices[] for each skill from global registry:
88
+ ```bash
89
+ node ~/.claude/viepilot/bin/vp-tools.cjs get-registry --id {skill-id} 2>/dev/null \
90
+ || node ~/.cursor/viepilot/bin/vp-tools.cjs get-registry --id {skill-id} 2>/dev/null
91
+ ```
92
+ - Parse JSON output → extract `best_practices[]`
93
+ - If command absent or returns null: `best_practices = []` — silent no-op
94
+ - Structure: `{ required: [{id, phases: [1,2], best_practices: [...]}], optional: [...] }`
95
+
96
+ **If `## Skills` section absent or empty**: silent no-op — `SKILL_CONTEXT_MAP = { required: [], optional: [] }`.
97
+
64
98
  ### Tag Prefix Resolution (ENH-050)
65
99
  Resolve the enriched git tag prefix once at session start. All task/phase tags use `${TAG_PREFIX}`.
66
100
 
@@ -211,6 +245,28 @@ Architecture context rule (ENH-018):
211
245
  - `N/A`: respect rationale; do not force diagram regeneration.
212
246
  - If matrix is missing, continue with explicit assumption notes in task logs.
213
247
 
248
+ #### Skill Context Injection (FEAT-020)
249
+
250
+ Before executing the task, check `SKILL_CONTEXT_MAP`:
251
+
252
+ 1. Extract the current task's phase number
253
+ 2. For each skill in `required`: check if current phase is in `skill.phases[]`
254
+ 3. If match: prepend `skill.best_practices[]` to the task execution context as a silent checklist:
255
+
256
+ ```
257
+ [Skill context: {skill-id}]
258
+ Best practices to apply:
259
+ - {practice 1}
260
+ - {practice 2}
261
+ ```
262
+
263
+ 4. Record in task output: `skills_applied: [{id}@{version}]`
264
+
265
+ **Rules:**
266
+ - **Never prompt the user** — decisions were locked at crystallize
267
+ - Optional skills: included only if task file explicitly mentions matching capability keywords
268
+ - No skill context available (empty map): continue normally — no warning
269
+
214
270
  #### Validate Task Contract (required before code)
215
271
  Task must include execution-grade details:
216
272
  - Objective (specific outcome)
@@ -254,6 +310,126 @@ If stack cache is missing:
254
310
  - warn and optionally run quick research
255
311
  - then continue with explicit assumptions noted in task logs
256
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
+
362
+ #### Scaffold-First Gate (BUG-020)
363
+
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"):
365
+
366
+ **Step 1 — Check for existing scaffold**: look for a framework marker file in the project root:
367
+
368
+ | Framework | Marker file |
369
+ |-----------|-------------|
370
+ | Laravel | `artisan` |
371
+ | Next.js | `next.config.js` or `next.config.ts` |
372
+ | NestJS | `nest-cli.json` |
373
+ | Rails | `config/application.rb` |
374
+ | Django | `manage.py` |
375
+ | Spring Boot | `pom.xml` or `build.gradle` |
376
+ | Nuxt / Vue | `nuxt.config.ts` or `nuxt.config.js` |
377
+ | React (CRA) | `src/index.js` or `src/index.tsx` |
378
+ | Electron | `electron-builder.yml` |
379
+
380
+ **Step 2 — If marker NOT found (fresh project)**:
381
+
382
+ a. Read `## Scaffold` section from `~/.viepilot/stacks/{stack}/SUMMARY.md` — use `init_command:` and `marker_file:` fields if present (optional, takes priority over built-in table).
383
+
384
+ b. If SUMMARY.md has no `## Scaffold` section, use the built-in heuristic table:
385
+
386
+ | Stack | Scaffold command |
387
+ |-------|-----------------|
388
+ | laravel / laravel-php84 | `composer create-project laravel/laravel {name}` |
389
+ | nextjs / nextjs-* | `npx create-next-app@latest {name}` |
390
+ | nestjs | `npx @nestjs/cli new {name}` |
391
+ | rails | `rails new {name}` |
392
+ | django | `django-admin startproject {name} .` |
393
+ | spring-boot* | `spring init --dependencies=web,data-jpa,validation {name}` |
394
+ | nuxt / vuejs* | `npx nuxi@latest init {name}` |
395
+ | react | `npx create-react-app {name}` |
396
+ | electron | `npx create-electron-app {name}` |
397
+
398
+ c. **Run the scaffold command** — if it exits non-zero: stop, report the error, and offer user: (a) fix environment then retry, (b) confirm project already exists, (c) skip scaffold with explicit reason logged.
399
+
400
+ d. After scaffold succeeds: continue with configuration and customization tasks normally.
401
+
402
+ **Step 3 — If marker IS found** (project already scaffolded): skip scaffold entirely, proceed with the task.
403
+
404
+ **Never-handcraft block list** — NEVER create these files from scratch in a setup task without prior scaffold:
405
+ - `artisan`, `composer.json` (in a Laravel/PHP context)
406
+ - `next.config.js`, `next.config.ts`, `pages/_app.*`, `app/layout.*`
407
+ - `nest-cli.json`, combined `tsconfig.json` + `src/main.ts` in NestJS context
408
+ - `manage.py`, `wsgi.py`, `asgi.py`
409
+ - `config/application.rb`, `config/routes.rb`, `Gemfile`
410
+ - `pom.xml` or `build.gradle` with Spring Boot starters
411
+
412
+ If the task's `## Paths` block contains one of these AND no scaffold has run:
413
+ → **⛔ Scaffold-First Gate**: "Cannot create `{file}` — run scaffold command first (BUG-020). See `docs/user/features/scaffold-first.md`."
414
+ → Offer: (a) run scaffold then retry, (b) confirm project already scaffolded, (c) skip gate with explicit reason in task log.
415
+
416
+ #### UI Prototype Reference — populate for frontend tasks (ENH-069 Gap 3)
417
+
418
+ After contract validation and **before** execution, check if the task implements a frontend component:
419
+
420
+ 1. Read `.viepilot/PROJECT-CONTEXT.md → ## UI Pages → Component Map` (written by crystallize Step 7)
421
+ 2. If a row exists whose `Target component` matches the task's target file:
422
+ - Populate the task file's `## UI Prototype Reference` section:
423
+ ```markdown
424
+ ## UI Prototype Reference
425
+ - Prototype: .viepilot/ui-direction/{session-id}/pages/{slug}.html
426
+ - Key sections: {sections extracted from the prototype during crystallize Step 1A}
427
+ - Component target: {target_component_path}
428
+ ```
429
+ - Log: `"UI Prototype Reference populated from UI Pages → Component Map"`
430
+ 3. During implementation: **READ the referenced prototype file BEFORE writing any component code**. The prototype is the design source — do not implement from task description alone when a prototype is bound.
431
+ 4. If no binding found in the component map: leave `## UI Prototype Reference` blank (implement from task description).
432
+
257
433
  #### Task start checkpoint (after doc-first gate + preflight)
258
434
 
259
435
  Only after **Validate Task Contract**, **Pre-execution documentation gate**, and **Stack Preflight** (or explicit waiver logged in the task file with reason):
@@ -407,6 +583,29 @@ Rule:
407
583
 
408
584
  When all tasks in phase are done/skipped:
409
585
 
586
+ #### UI Coverage Gate (ENH-069 Gap 4)
587
+
588
+ Before phase-level verification, run a UI stub check:
589
+
590
+ 1. Read `.viepilot/PROJECT-CONTEXT.md → ## UI Pages → Component Map`
591
+ 2. Filter rows where `Phase` = current phase AND `Source` is not `design_staleness` alone (i.e., rows with a real prototype file binding)
592
+ 3. For each filtered row:
593
+ - Check if the `Target component` file exists on disk
594
+ - If the file exists, apply the stub heuristic:
595
+ - File has fewer than 20 lines **AND** contains only routing/title markup (no real layout components, no template sections, no data fetching) → **STUB detected**
596
+ - If file is **missing** OR **stub detected**:
597
+ ```
598
+ ⚠️ UI Coverage Warning: "{prototype}" → "{component}" is still a stub or missing.
599
+ Phase cannot receive ✅ PASS with unimplemented prototype-bound components.
600
+ Options:
601
+ (a) Implement now from prototype (Recommended — continue in this phase)
602
+ (b) Defer to next phase (update component map row status to "deferred-phase-{N+1}" + log reason)
603
+ (c) Mark as design-only — no implementation required (update row status to "design-only" + log reason)
604
+ ```
605
+ 4. Phase PASS is **blocked** until all warnings are resolved via options (a), (b), or (c).
606
+ - Option (a): implement the component, then re-run stub check
607
+ - Option (b) or (c): clears the warning; phase may proceed to PASS
608
+
410
609
  1. Run phase-level verification
411
610
  2. Check phase quality gate
412
611
  3. Write SUMMARY.md using `templates/phase/SUMMARY.md` as base.