viepilot 2.22.0 → 2.41.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +208 -0
  2. package/README.md +6 -6
  3. package/bin/viepilot.cjs +110 -2
  4. package/bin/vp-tools.cjs +109 -0
  5. package/docs/brainstorm/session-2026-04-20.md +261 -0
  6. package/docs/skills-reference.md +22 -0
  7. package/docs/user/features/adapters.md +2 -2
  8. package/docs/user/features/scaffold-first.md +62 -0
  9. package/docs/user/features/skill-registry.md +125 -0
  10. package/lib/adapters/antigravity.cjs +5 -4
  11. package/lib/skill-installer.cjs +274 -0
  12. package/lib/skill-registry.cjs +212 -0
  13. package/lib/viepilot-update.cjs +113 -0
  14. package/package.json +1 -1
  15. package/skills/vp-audit/SKILL.md +57 -9
  16. package/skills/vp-auto/SKILL.md +60 -0
  17. package/skills/vp-brainstorm/SKILL.md +112 -2
  18. package/skills/vp-crystallize/SKILL.md +76 -1
  19. package/skills/vp-debug/SKILL.md +27 -0
  20. package/skills/vp-docs/SKILL.md +27 -0
  21. package/skills/vp-evolve/SKILL.md +61 -7
  22. package/skills/vp-info/SKILL.md +27 -0
  23. package/skills/vp-pause/SKILL.md +27 -0
  24. package/skills/vp-proposal/SKILL.md +27 -0
  25. package/skills/vp-request/SKILL.md +56 -7
  26. package/skills/vp-resume/SKILL.md +27 -0
  27. package/skills/vp-rollback/SKILL.md +27 -0
  28. package/skills/vp-skills/SKILL.md +301 -0
  29. package/skills/vp-status/SKILL.md +27 -0
  30. package/skills/vp-task/SKILL.md +27 -0
  31. package/skills/vp-ui-components/SKILL.md +27 -0
  32. package/skills/vp-update/SKILL.md +27 -0
  33. package/templates/phase/TASK.md +7 -0
  34. package/templates/project/PROJECT-CONTEXT.md +76 -0
  35. package/workflows/audit.md +131 -0
  36. package/workflows/autonomous.md +142 -0
  37. package/workflows/brainstorm.md +1025 -9
  38. package/workflows/crystallize.md +528 -3
  39. package/workflows/evolve.md +2 -0
  40. package/workflows/request.md +2 -0
@@ -90,3 +90,79 @@
90
90
  |---------|---------|---------|
91
91
  {{LIBRARIES}}
92
92
  </external_dependencies>
93
+
94
+ ## Skills
95
+
96
+ > Skills registered for this project (locked at /vp-crystallize, applied by /vp-auto).
97
+ > Populated by crystallize Step 1E when brainstorm session has ## skills_used.
98
+
99
+ | Skill | Source | Required | Phases | Rationale |
100
+ |-------|--------|----------|--------|-----------|
101
+ | *(none yet)* | — | — | — | — |
102
+
103
+ ## Admin & Governance
104
+
105
+ > Generated by crystallize from architect notes.md ## admin (ENH-063).
106
+ > Update manually or re-run /vp-crystallize after updating brainstorm artifacts.
107
+
108
+ | Capability | Required | Phase | Notes |
109
+ |-----------|----------|-------|-------|
110
+ | User management UI | — | — | — |
111
+ | Monitoring dashboard | — | — | — |
112
+ | Audit log | — | — | — |
113
+ | Billing management | — | — | — |
114
+
115
+ ### Admin Personas
116
+ | Persona | Key Capabilities |
117
+ |---------|-----------------|
118
+ | — | — |
119
+
120
+ ## Content Management
121
+
122
+ > Generated by crystallize from architect notes.md ## content (ENH-065).
123
+ > Update manually or re-run /vp-crystallize after updating brainstorm artifacts.
124
+
125
+ | Content Type | Created By | Lifecycle | Key Fields | Phase |
126
+ |-------------|-----------|-----------|-----------|-------|
127
+ | — | — | — | — | — |
128
+
129
+ ### Media & Storage
130
+ | Storage | CDN | Types | Max Size |
131
+ |---------|-----|-------|----------|
132
+ | — | — | — | — |
133
+
134
+ ### Localization
135
+ | Locales | Fallback |
136
+ |---------|---------|
137
+ | — | — |
138
+
139
+ ## Admin Entity Management
140
+
141
+ > Generated by crystallize from architect notes.md ## entity_mgmt (ENH-068).
142
+ > Update manually or re-run /vp-crystallize after updating brainstorm artifacts.
143
+
144
+ | Entity | CRUD Ops | Soft Delete | Bulk Actions | Audit Trail | Scope |
145
+ |--------|----------|-------------|--------------|-------------|-------|
146
+ | — | — | — | — | — | — |
147
+
148
+ ### Import / Export
149
+ | Direction | Entities |
150
+ |-----------|----------|
151
+ | CSV Import | — |
152
+ | CSV Export | — |
153
+
154
+ ## User Data Management
155
+
156
+ > Generated by crystallize from architect notes.md ## user_data (ENH-066).
157
+ > Update manually or re-run /vp-crystallize after updating brainstorm artifacts.
158
+
159
+ | Capability | Supported | Notes |
160
+ |-----------|-----------|-------|
161
+ | Profile editing | — | — |
162
+ | Notification preferences | — | — |
163
+ | Privacy settings | — | — |
164
+ | Data export (GDPR) | — | — |
165
+ | Right to erasure | — | — |
166
+ | Connected accounts | — | — |
167
+ | Session management | — | — |
168
+ | Two-factor authentication | — | — |
@@ -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
 
@@ -39,6 +39,8 @@ See `agents/` directory for full agent specifications.
39
39
 
40
40
  <process>
41
41
 
42
+ > **AUQ preload — Claude Code adapter (ENH-059):** At session start, before any interactive prompt, call `ToolSearch` with `query: "select:AskUserQuestion"` to load the deferred schema. Required on Claude Code (terminal). Skip only if `ToolSearch` returns an error → use text fallback for that session.
43
+
42
44
  <step name="initialize">
43
45
  ## 1. Initialize
44
46
 
@@ -59,6 +61,30 @@ cat .viepilot/ROADMAP.md
59
61
  Read `~/.viepilot/config.json` → `COMMUNICATION_LANG` (default: `en`).
60
62
  Use `COMMUNICATION_LANG` for all banners, control-point messages, and user-facing output in this session.
61
63
 
64
+ ### Skill Context Load (FEAT-020)
65
+
66
+ After loading context files, load the project's skill decisions:
67
+
68
+ ```bash
69
+ # Read PROJECT-CONTEXT.md ## Skills section
70
+ SKILL_CONTEXT=$(grep -A 100 "^## Skills" .viepilot/PROJECT-CONTEXT.md 2>/dev/null | \
71
+ head -n $(grep -n "^## " .viepilot/PROJECT-CONTEXT.md | awk -F: 'NR==2{print $1}'))
72
+ ```
73
+
74
+ Build `SKILL_CONTEXT_MAP` in session memory:
75
+ - Parse `## Skills` table rows
76
+ - For each row: extract `id`, `source`, `required` (yes/no), `phases` (comma list)
77
+ - Load best_practices[] for each skill from global registry:
78
+ ```bash
79
+ node ~/.claude/viepilot/bin/vp-tools.cjs get-registry --id {skill-id} 2>/dev/null \
80
+ || node ~/.cursor/viepilot/bin/vp-tools.cjs get-registry --id {skill-id} 2>/dev/null
81
+ ```
82
+ - Parse JSON output → extract `best_practices[]`
83
+ - If command absent or returns null: `best_practices = []` — silent no-op
84
+ - Structure: `{ required: [{id, phases: [1,2], best_practices: [...]}], optional: [...] }`
85
+
86
+ **If `## Skills` section absent or empty**: silent no-op — `SKILL_CONTEXT_MAP = { required: [], optional: [] }`.
87
+
62
88
  ### Tag Prefix Resolution (ENH-050)
63
89
  Resolve the enriched git tag prefix once at session start. All task/phase tags use `${TAG_PREFIX}`.
64
90
 
@@ -209,6 +235,28 @@ Architecture context rule (ENH-018):
209
235
  - `N/A`: respect rationale; do not force diagram regeneration.
210
236
  - If matrix is missing, continue with explicit assumption notes in task logs.
211
237
 
238
+ #### Skill Context Injection (FEAT-020)
239
+
240
+ Before executing the task, check `SKILL_CONTEXT_MAP`:
241
+
242
+ 1. Extract the current task's phase number
243
+ 2. For each skill in `required`: check if current phase is in `skill.phases[]`
244
+ 3. If match: prepend `skill.best_practices[]` to the task execution context as a silent checklist:
245
+
246
+ ```
247
+ [Skill context: {skill-id}]
248
+ Best practices to apply:
249
+ - {practice 1}
250
+ - {practice 2}
251
+ ```
252
+
253
+ 4. Record in task output: `skills_applied: [{id}@{version}]`
254
+
255
+ **Rules:**
256
+ - **Never prompt the user** — decisions were locked at crystallize
257
+ - Optional skills: included only if task file explicitly mentions matching capability keywords
258
+ - No skill context available (empty map): continue normally — no warning
259
+
212
260
  #### Validate Task Contract (required before code)
213
261
  Task must include execution-grade details:
214
262
  - Objective (specific outcome)
@@ -252,6 +300,77 @@ If stack cache is missing:
252
300
  - warn and optionally run quick research
253
301
  - then continue with explicit assumptions noted in task logs
254
302
 
303
+ #### Scaffold-First Gate (BUG-020)
304
+
305
+ 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"):
306
+
307
+ **Step 1 — Check for existing scaffold**: look for a framework marker file in the project root:
308
+
309
+ | Framework | Marker file |
310
+ |-----------|-------------|
311
+ | Laravel | `artisan` |
312
+ | Next.js | `next.config.js` or `next.config.ts` |
313
+ | NestJS | `nest-cli.json` |
314
+ | Rails | `config/application.rb` |
315
+ | Django | `manage.py` |
316
+ | Spring Boot | `pom.xml` or `build.gradle` |
317
+ | Nuxt / Vue | `nuxt.config.ts` or `nuxt.config.js` |
318
+ | React (CRA) | `src/index.js` or `src/index.tsx` |
319
+ | Electron | `electron-builder.yml` |
320
+
321
+ **Step 2 — If marker NOT found (fresh project)**:
322
+
323
+ 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).
324
+
325
+ b. If SUMMARY.md has no `## Scaffold` section, use the built-in heuristic table:
326
+
327
+ | Stack | Scaffold command |
328
+ |-------|-----------------|
329
+ | laravel / laravel-php84 | `composer create-project laravel/laravel {name}` |
330
+ | nextjs / nextjs-* | `npx create-next-app@latest {name}` |
331
+ | nestjs | `npx @nestjs/cli new {name}` |
332
+ | rails | `rails new {name}` |
333
+ | django | `django-admin startproject {name} .` |
334
+ | spring-boot* | `spring init --dependencies=web,data-jpa,validation {name}` |
335
+ | nuxt / vuejs* | `npx nuxi@latest init {name}` |
336
+ | react | `npx create-react-app {name}` |
337
+ | electron | `npx create-electron-app {name}` |
338
+
339
+ 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.
340
+
341
+ d. After scaffold succeeds: continue with configuration and customization tasks normally.
342
+
343
+ **Step 3 — If marker IS found** (project already scaffolded): skip scaffold entirely, proceed with the task.
344
+
345
+ **Never-handcraft block list** — NEVER create these files from scratch in a setup task without prior scaffold:
346
+ - `artisan`, `composer.json` (in a Laravel/PHP context)
347
+ - `next.config.js`, `next.config.ts`, `pages/_app.*`, `app/layout.*`
348
+ - `nest-cli.json`, combined `tsconfig.json` + `src/main.ts` in NestJS context
349
+ - `manage.py`, `wsgi.py`, `asgi.py`
350
+ - `config/application.rb`, `config/routes.rb`, `Gemfile`
351
+ - `pom.xml` or `build.gradle` with Spring Boot starters
352
+
353
+ If the task's `## Paths` block contains one of these AND no scaffold has run:
354
+ → **⛔ Scaffold-First Gate**: "Cannot create `{file}` — run scaffold command first (BUG-020). See `docs/user/features/scaffold-first.md`."
355
+ → Offer: (a) run scaffold then retry, (b) confirm project already scaffolded, (c) skip gate with explicit reason in task log.
356
+
357
+ #### UI Prototype Reference — populate for frontend tasks (ENH-069 Gap 3)
358
+
359
+ After contract validation and **before** execution, check if the task implements a frontend component:
360
+
361
+ 1. Read `.viepilot/PROJECT-CONTEXT.md → ## UI Pages → Component Map` (written by crystallize Step 7)
362
+ 2. If a row exists whose `Target component` matches the task's target file:
363
+ - Populate the task file's `## UI Prototype Reference` section:
364
+ ```markdown
365
+ ## UI Prototype Reference
366
+ - Prototype: .viepilot/ui-direction/{session-id}/pages/{slug}.html
367
+ - Key sections: {sections extracted from the prototype during crystallize Step 1A}
368
+ - Component target: {target_component_path}
369
+ ```
370
+ - Log: `"UI Prototype Reference populated from UI Pages → Component Map"`
371
+ 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.
372
+ 4. If no binding found in the component map: leave `## UI Prototype Reference` blank (implement from task description).
373
+
255
374
  #### Task start checkpoint (after doc-first gate + preflight)
256
375
 
257
376
  Only after **Validate Task Contract**, **Pre-execution documentation gate**, and **Stack Preflight** (or explicit waiver logged in the task file with reason):
@@ -405,6 +524,29 @@ Rule:
405
524
 
406
525
  When all tasks in phase are done/skipped:
407
526
 
527
+ #### UI Coverage Gate (ENH-069 Gap 4)
528
+
529
+ Before phase-level verification, run a UI stub check:
530
+
531
+ 1. Read `.viepilot/PROJECT-CONTEXT.md → ## UI Pages → Component Map`
532
+ 2. Filter rows where `Phase` = current phase AND `Source` is not `design_staleness` alone (i.e., rows with a real prototype file binding)
533
+ 3. For each filtered row:
534
+ - Check if the `Target component` file exists on disk
535
+ - If the file exists, apply the stub heuristic:
536
+ - File has fewer than 20 lines **AND** contains only routing/title markup (no real layout components, no template sections, no data fetching) → **STUB detected**
537
+ - If file is **missing** OR **stub detected**:
538
+ ```
539
+ ⚠️ UI Coverage Warning: "{prototype}" → "{component}" is still a stub or missing.
540
+ Phase cannot receive ✅ PASS with unimplemented prototype-bound components.
541
+ Options:
542
+ (a) Implement now from prototype (Recommended — continue in this phase)
543
+ (b) Defer to next phase (update component map row status to "deferred-phase-{N+1}" + log reason)
544
+ (c) Mark as design-only — no implementation required (update row status to "design-only" + log reason)
545
+ ```
546
+ 4. Phase PASS is **blocked** until all warnings are resolved via options (a), (b), or (c).
547
+ - Option (a): implement the component, then re-run stub check
548
+ - Option (b) or (c): clears the warning; phase may proceed to PASS
549
+
408
550
  1. Run phase-level verification
409
551
  2. Check phase quality gate
410
552
  3. Write SUMMARY.md using `templates/phase/SUMMARY.md` as base.