viepilot 1.14.0 → 2.4.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 (58) hide show
  1. package/CHANGELOG.md +191 -0
  2. package/README.md +27 -17
  3. package/bin/viepilot.cjs +19 -9
  4. package/bin/vp-tools.cjs +193 -0
  5. package/docs/user/features/adapters.md +74 -0
  6. package/docs/user/features/hooks.md +93 -0
  7. package/lib/adapters/antigravity.cjs +33 -0
  8. package/lib/adapters/claude-code.cjs +42 -0
  9. package/lib/adapters/codex.cjs +34 -0
  10. package/lib/adapters/cursor.cjs +32 -0
  11. package/lib/adapters/index.cjs +28 -0
  12. package/lib/hooks/brainstorm-staleness.cjs +231 -0
  13. package/lib/viepilot-config.cjs +103 -0
  14. package/lib/viepilot-install.cjs +125 -152
  15. package/package.json +1 -3
  16. package/skills/vp-audit/SKILL.md +23 -23
  17. package/skills/vp-auto/SKILL.md +23 -9
  18. package/skills/vp-brainstorm/SKILL.md +44 -38
  19. package/skills/vp-crystallize/SKILL.md +25 -19
  20. package/skills/vp-debug/SKILL.md +4 -4
  21. package/skills/vp-docs/SKILL.md +8 -8
  22. package/skills/vp-evolve/SKILL.md +26 -13
  23. package/skills/vp-info/SKILL.md +24 -24
  24. package/skills/vp-pause/SKILL.md +7 -7
  25. package/skills/vp-request/SKILL.md +14 -14
  26. package/skills/vp-resume/SKILL.md +6 -6
  27. package/skills/vp-rollback/SKILL.md +4 -4
  28. package/skills/vp-status/SKILL.md +4 -4
  29. package/skills/vp-task/SKILL.md +2 -2
  30. package/skills/vp-ui-components/SKILL.md +14 -14
  31. package/skills/vp-update/SKILL.md +18 -18
  32. package/templates/architect/apis.html +11 -10
  33. package/templates/architect/architect-actions.js +217 -0
  34. package/templates/architect/architecture.html +8 -7
  35. package/templates/architect/data-flow.html +5 -4
  36. package/templates/architect/decisions.html +4 -3
  37. package/templates/architect/deployment.html +10 -9
  38. package/templates/architect/erd.html +7 -6
  39. package/templates/architect/feature-map.html +5 -4
  40. package/templates/architect/sequence-diagram.html +6 -5
  41. package/templates/architect/style.css +146 -0
  42. package/templates/architect/tech-notes.html +3 -2
  43. package/templates/architect/tech-stack.html +8 -7
  44. package/templates/architect/user-use-cases.html +8 -7
  45. package/templates/project/AI-GUIDE.md +49 -49
  46. package/workflows/audit.md +3 -3
  47. package/workflows/autonomous.md +70 -5
  48. package/workflows/brainstorm.md +398 -222
  49. package/workflows/crystallize.md +51 -33
  50. package/workflows/debug.md +9 -9
  51. package/workflows/documentation.md +5 -5
  52. package/workflows/evolve.md +46 -12
  53. package/workflows/pause-work.md +2 -2
  54. package/workflows/request.md +8 -8
  55. package/workflows/resume-work.md +1 -1
  56. package/workflows/rollback.md +1 -1
  57. package/dev-install.sh +0 -150
  58. package/install.sh +0 -125
package/CHANGELOG.md CHANGED
@@ -7,6 +7,197 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.4.0] - 2026-04-10
11
+
12
+ ### Added (FEAT-015 — Phase 62)
13
+ - **Codex adapter**: `lib/adapters/codex.cjs` — OpenAI Codex CLI is now a first-class install target; skills install to `~/.codex/skills/`, viepilot bundle to `~/.codex/viepilot/`
14
+ - `lib/adapters/index.cjs`: `codex` registered; `listAdapters()` now returns 4 unique adapters
15
+ - `bin/viepilot.cjs`: Codex added to interactive installer TARGETS list and help text
16
+ - `docs/user/features/adapters.md`: Codex row added; `$skill-name` invocation note; removed stale `dev-install.sh` reference
17
+
18
+ ### Notes
19
+ - Codex uses `$vp-status` syntax (not `/vp-status`) — SKILL.md format is fully compatible, invocation prefix differs
20
+
21
+ ### Tests
22
+ - Added `tests/unit/vp-adapter-codex.test.js` (11 tests)
23
+ - Updated `tests/unit/vp-adapter-antigravity.test.js`: `listAdapters()` now expects 4
24
+ - Updated `tests/unit/viepilot-adapters.test.js`: count 3 → 4
25
+ - Updated `tests/unit/guided-installer.test.js`: `normalizeTargets('all')` includes codex
26
+ - Total: 607 tests (was 596)
27
+
28
+ ## [2.3.2] - 2026-04-10
29
+
30
+ ### Changed (ENH-037 — Phase 61)
31
+ - Post-install "Next actions" block is now adapter-driven: each adapter carries a `postInstallHint` string; CLI prints one hint per unique installed target — Antigravity now appears when installed
32
+ - `lib/adapters/claude-code.cjs`, `cursor.cjs`, `antigravity.cjs`: added `postInstallHint` field
33
+
34
+ ## [2.3.1] - 2026-04-10
35
+
36
+ ### Removed (ENH-036 — Phase 60)
37
+ - `install.sh` — bash wrapper was redundant; `bin/viepilot.cjs install` covers all install functionality
38
+ - `dev-install.sh` — bash adapter routing duplicated `lib/adapters/`; `bin/viepilot.cjs install --target <adapter>` is the canonical path
39
+ - Removed 5 tests that only verified shell script content (viepilot-install.test.js, viepilot-adapters.test.js, vp-adapter-antigravity.test.js)
40
+
41
+ ## [2.3.0] - 2026-04-10
42
+
43
+ ### Added (FEAT-014 — Phase 59)
44
+ - **Antigravity adapter**: `lib/adapters/antigravity.cjs` — Google Antigravity IDE is now a first-class install target; skills install to `~/.antigravity/skills/`, viepilot bundle to `~/.antigravity/viepilot/`
45
+ - `lib/adapters/index.cjs`: `antigravity` registered; `listAdapters()` now returns 3 unique adapters
46
+ - `dev-install.sh`: `VIEPILOT_ADAPTER=antigravity` supported
47
+ - `bin/viepilot.cjs`: Antigravity added to interactive installer TARGETS list and help text
48
+ - `docs/user/features/adapters.md`: new doc — supported platforms table, install examples, guide for adding new adapters
49
+
50
+ ### Tests
51
+ - Added `tests/unit/vp-adapter-antigravity.test.js` (12 tests)
52
+ - Updated `tests/unit/viepilot-adapters.test.js`: `listAdapters()` now expects 3
53
+ - Updated `tests/unit/guided-installer.test.js`: `normalizeTargets('all')` includes antigravity
54
+ - Total: 600 tests (was 588)
55
+
56
+ ## [2.2.0] - 2026-04-10
57
+
58
+ ### Changed (ENH-035 — Phase 58)
59
+ - **{envToolDir} template variable**: all 14 `skills/*/SKILL.md` source files now use `$HOME/{envToolDir}/` instead of hardcoded `$HOME/.cursor/viepilot/` — skill sources are platform-neutral
60
+ - **`lib/viepilot-install.cjs`**: path substitution now unconditionally replaces `{envToolDir}` → `adapter.executionContextBase` for every adapter (Cursor → `.cursor/viepilot`, Claude Code → `.claude/viepilot`, future adapters just set `executionContextBase`)
61
+ - **`lib/adapters/claude-code.cjs`**: removed `pathRewrite` field — no longer needed
62
+ - **`lib/adapters/cursor.cjs`**: removed `pathRewrite: null` field — no longer needed
63
+ - Adding a new adapter now requires only `executionContextBase` — no `pathRewrite` definition
64
+
65
+ ### Tests
66
+ - Updated `tests/unit/viepilot-adapters.test.js`: removed `pathRewrite` assertion; rewrite step tests now check `from: '{envToolDir}'`; added cursor-target substitution test
67
+ - Updated `tests/unit/viepilot-install.test.js`: 2 tests updated for ENH-035 behavior
68
+ - Total: 588 tests (was 587)
69
+
70
+ ## [2.1.3] - 2026-04-10
71
+
72
+ ### Fixed (BUG-011 — Phase 55)
73
+ - **brainstorm.md dialogue path**: confirmation option 1 now shows `.viepilot/ui-direction/{session-id}/notes.md` instead of bare `ui-direction/notes.md` — eliminates ambiguity with user-managed `{root}/ui-direction/` folders
74
+ - **crystallize.md PATH GUARD**: `consume_ui_direction` step now opens with `⛔ PATH GUARD (BUG-011)` — explicitly instructs LLM to ignore any `{root}/ui-direction/` folder and read only from `.viepilot/ui-direction/`
75
+
76
+ ### Tests
77
+ - Added `tests/unit/vp-bug011-ui-direction-path-guard.test.js` (3 tests)
78
+ - Total: 587 tests (was 584)
79
+
80
+ ## [2.1.2] - 2026-04-10
81
+
82
+ ### Fixed (BUG-013 — Phase 57)
83
+ - **Untrack .viepilot/ from git**: `git rm -r --cached .viepilot/` — removes all 27 previously-tracked internal state files from the git index; `.viepilot/` now correctly treated as gitignored on disk only, never staged or pushed
84
+ - **GITIGNORE-AWARE STAGING RULE**: `workflows/autonomous.md` commit block now has `⛔ GITIGNORE-AWARE STAGING RULE (BUG-013)` — instructs vp-auto to check `git check-ignore -q` before staging, and explicitly forbids `git add .viepilot/`
85
+ - **Git persistence gate note**: porcelain check section clarified — `??` (untracked-only) lines are CLEAN, not dirty state; prevents false gate failures after BUG-013 fix
86
+
87
+ ### Tests
88
+ - Added `tests/unit/vp-bug013-gitignore-staging-rule.test.js` (3 tests)
89
+ - Total: 584 tests (was 581)
90
+ - **ui-direction path disambiguation**: `workflows/brainstorm.md` confirmation dialogue option 1 now shows full unambiguous path `.viepilot/ui-direction/{session-id}/notes.md` (was bare `ui-direction/notes.md`)
91
+ - **crystallize PATH GUARD**: `workflows/crystallize.md` `consume_ui_direction` step now opens with `⛔ PATH GUARD (BUG-011)` — explicitly instructs LLM to ignore any `{root}/ui-direction/` folder and read only from `.viepilot/ui-direction/`
92
+
93
+ ## [2.1.1] - 2026-04-10
94
+
95
+ ### Fixed (BUG-012 — Phase 56)
96
+ - **PATH RESOLUTION RULE**: `workflows/autonomous.md` now has `⛔ PATH RESOLUTION RULE (BUG-012)` block — explicitly states all file reads/edits during task execution resolve from `{cwd}` (repo root), never from `~/.claude/` or `~/.cursor/` install directories
97
+ - **evolve.md cwd note**: `workflows/evolve.md` TASK PATH RULE section now includes BUG-012 cwd-resolution clarification: repo-relative paths always anchor to `{cwd}`, not install paths
98
+
99
+ ### Tests
100
+ - Added `tests/unit/vp-bug012-path-resolution-rule.test.js` (3 tests)
101
+ - Total: 581 tests (was 578)
102
+
103
+ ## [2.1.0] - 2026-04-08
104
+
105
+ ### Added (FEAT-012 — Phase 54)
106
+ - **Brainstorm staleness hook**: `lib/hooks/brainstorm-staleness.cjs` — Claude Code `Stop` event handler; fires after each AI response in a brainstorm session; detects stale architect HTML items via keyword matching; marks `data-arch-stale="true"` (amber badge, flag-only); non-blocking (exit 0 always)
107
+ - `bin/vp-tools.cjs`: `hooks install [--adapter <id>]` subcommand — merges ViePilot hook entry into `~/.claude/settings.json`; idempotent (re-run safe)
108
+ - `docs/user/features/hooks.md` — new user doc: install instructions, adapter table, troubleshooting
109
+ - `workflows/brainstorm.md`: `architect_delta_sync` step now references automatic hook mode; `/hooks-install` command added
110
+
111
+ ### Tests
112
+ - Added `tests/unit/brainstorm-staleness-hook.test.js` (20 tests, 4 groups) — session discovery, keyword detection, HTML patching, install command
113
+ - Total: 578 tests (was 558)
114
+
115
+ ## [2.0.0] - 2026-04-08
116
+
117
+ ### Added (FEAT-013 — Phase 53)
118
+ - **Dynamic agent adapter system**: `lib/adapters/` module with `claude-code.cjs`, `cursor.cjs`, `index.cjs` registry — each platform is a self-contained adapter (skillsDir, viepilotDir, executionContextBase, hooks config, installSubdirs, isAvailable, pathRewrite)
119
+ - `lib/viepilot-install.cjs`: `buildInstallPlan()` now resolves all platform paths from adapter registry — no hardcoded `.cursor/` constants; single adapter loop replaces cursor + claude-code if-blocks
120
+ - `bin/viepilot.cjs`: TARGETS sourced from adapter registry; default non-interactive target = `claude-code`
121
+ - `dev-install.sh`: `VIEPILOT_ADAPTER` env var (default: `claude-code`); backward-compat `VIEPILOT_INSTALL_PROFILE` alias preserved
122
+ - `bin/vp-tools.cjs`: `hooks scaffold [--adapter <id>]` subcommand — prints `~/.claude/settings.json` hook registration snippet for Claude Code; Cursor: prints explanation
123
+
124
+ ### BREAKING CHANGES
125
+ - Default install target changes from `cursor-ide` → `claude-code` (`~/.claude/`)
126
+ - Cursor users: set `VIEPILOT_ADAPTER=cursor-agent` (or `VIEPILOT_INSTALL_PROFILE=cursor-agent`) or pass `--target cursor-agent`
127
+ - `normalizeInstallEnv({})` default profile is now `claude-code` (was `cursor-ide`)
128
+
129
+ ### Tests
130
+ - Added `tests/unit/viepilot-adapters.test.js` (19 tests, 4 groups) — adapter interface, registry, install plan, dev-install.sh
131
+ - Updated `tests/unit/viepilot-install.test.js` — 7 tests updated to reflect claude-code default; cursor-explicit tests use `VIEPILOT_INSTALL_PROFILE: 'cursor-ide'`
132
+ - Total: 558 tests (was 539)
133
+
134
+ ## [1.19.0] - 2026-04-08
135
+
136
+ ### Added (ENH-034 — Phase 52)
137
+ - **vp-brainstorm UI: Architect Delta Sync** — new `architect_delta_sync` step in `workflows/brainstorm.md`: bridges UI Direction Mode and Architect HTML workspace; when a UI session surfaces architect-related gaps, the step parses session for deltas, maps them to affected pages (using existing trigger keyword lists), updates `<tr>` / `<div class="card">` HTML content, marks changed items `data-updated="true"`, and records delta in `notes.md ## architect_sync`
138
+ - `/sync-arch` command: manual trigger for architect delta sync at any point in a brainstorm session
139
+ - `notes.md` YAML schema extended with `## architect_sync` section (synced_at, source_session, trigger, changes)
140
+ - `templates/architect/style.css`: `.arch-gap-badge` (amber) + `[data-arch-stale="true"]` amber left-border indicator — visually distinct from `.updated` (yellow = changed); light-mode overrides included
141
+ - `templates/architect/architect-actions.js`: `markStale(id, reason)` + `injectStaleBadges()` — auto-scans `[data-arch-stale="true"]` on DOMContentLoaded and injects amber "⚠ gap" badges; `window.vpMarkStale` exposed for browser console use
142
+
143
+ ### Tests
144
+ - Added `tests/unit/vp-enh034-architect-delta-sync.test.js` (14 tests, 3 groups) — all pass (539 total)
145
+
146
+ ## [1.18.1] - 2026-04-07
147
+
148
+ ### Fixed (BUG-010 — Phase 51)
149
+ - **Approve/Edit buttons missing on Mermaid diagram cards:** added `data-arch-id` + `data-arch-title` to all 9 diagram cards across 6 pages (architecture ARCH-DIAG1/2, data-flow DF-DIAG1/2, erd ERD-DIAG1, use-cases UC-DIAG1, sequence SEQ-DIAG1/2, deployment DEP-DIAG1)
150
+
151
+ ### Tests
152
+ - Added Test Group 5 to `tests/unit/vp-enh033-architect-item-actions.test.js` (9 new tests) — 525 total
153
+
154
+ ## [1.18.0] - 2026-04-07
155
+
156
+ ### Added (ENH-033 — Phase 50)
157
+ - **Architect HTML item actions:** stable `data-arch-id` IDs on every item across all 11 content pages (decisions D1–D2, architecture C1–C4, erd E1–E4, use-cases UC1–UC5, apis A1–A9, deployment DEP1–DEP7, data-flow DF1, sequence SEQ1–SEQ2, tech-stack TS1–TS6, tech-notes TN1, features F1–F3)
158
+ - `templates/architect/architect-actions.js` — new shared vanilla JS: `approvePrompt()`, `editPrompt()`, `copyText()` with clipboard API + execCommand fallback, button injection on DOMContentLoaded
159
+ - **✅ Approve button**: copies `[ARCH:{slug}:{id}] APPROVE — "{title}" on {slug} page. No changes needed.`
160
+ - **✏️ Edit button**: copies `[ARCH:{slug}:{id}] EDIT — "{title}" on {slug} page. Current: "{excerpt}". What should I change?`
161
+ - `templates/architect/style.css`: `.arch-id-badge`, `.arch-item-actions`, `.arch-btn`, `.arch-btn-approve`, `.arch-btn-edit`, `.arch-btn.copied`, `.arch-actions-cell` — hover-reveal pattern, light-mode overrides
162
+ - `workflows/brainstorm.md`: **Architect Item Actions (ENH-033)** section — isolation rule, APPROVE/EDIT prompt handling spec, cross-page cascade prohibition
163
+
164
+ ### Tests
165
+ - Added `tests/unit/vp-enh033-architect-item-actions.test.js` (50 tests, 4 groups) — all pass (516 total)
166
+
167
+ ## [1.17.0] - 2026-04-06
168
+
169
+ ### Added (ENH-032 — Phase 49)
170
+ - **Language configuration system:** `~/.viepilot/config.json` stores `language.communication` and `language.document` (defaults: `en`/`en`)
171
+ - `lib/viepilot-config.cjs` — new module: `readConfig`, `writeConfig`, `resetConfig`, `getConfigPath`; deep-merge with defaults; missing-file safe
172
+ - `vp-tools config get/set/reset` — CLI commands to read and write language config
173
+ - `lib/viepilot-install.cjs`: `language_config_prompt` step writes config at end of install; `--yes` uses defaults without prompting
174
+ - `workflows/crystallize.md`: Step 0-A `load_language_config` — reads `DOCUMENT_LANG` + `COMMUNICATION_LANG` for file generation and session messages
175
+ - `workflows/brainstorm.md`: Step 0 `detect_session_language` — reads `BRAINSTORM_LANG` for file storage; user session language overrides config
176
+ - `workflows/autonomous.md`: `load_language_config` in Initialize — `COMMUNICATION_LANG` for banners and control-point messages
177
+ - `skills/vp-crystallize/SKILL.md`, `skills/vp-brainstorm/SKILL.md`, `skills/vp-auto/SKILL.md`: ENH-032 language config notes
178
+
179
+ ### Tests
180
+ - Added `tests/unit/vp-enh032-language-config.test.js` (18 tests) — all pass (466 total)
181
+
182
+ ## [1.16.0] - 2026-04-06
183
+
184
+ ### Changed (ENH-031 — Phase 48)
185
+ - **Language standardization (English-primary):** all 12 workflows, all 16 skills, and `templates/project/AI-GUIDE.md` converted to English; Vietnamese retained only in `cursor_skill_adapter` invocation trigger keywords and UI scope signal detection patterns
186
+
187
+ ### Tests
188
+ - Added `tests/unit/vp-enh031-language-standardization.test.js` (63 tests) — all pass (448 total)
189
+ - Updated `vp-fe010-ui-walkthrough-contracts.test.js` + `vp-enh026-ui-extraction-contracts.test.js` to match translated English strings
190
+
191
+ ## [1.15.0] - 2026-04-06
192
+
193
+ ### Fixed (BUG-009 — Phase 47)
194
+ - **Task path guard:** `workflows/evolve.md` now enforces repo-relative paths in task `## Paths` blocks (prevents generating `~/.claude/...` paths that would edit the live install instead of source)
195
+ - **Preflight validation:** `workflows/autonomous.md` aborts task execution if `## Paths` contains `~/` or absolute path — error message names offending path and task file
196
+ - `skills/vp-evolve/SKILL.md` + `skills/vp-auto/SKILL.md`: path convention documented in `<context>`
197
+
198
+ ### Tests
199
+ - Added `tests/unit/vp-bug009-path-guard.test.js` (13 tests) — all pass (385 total)
200
+
10
201
  ## [1.14.0] - 2026-04-06
11
202
 
12
203
  ### Changed (ENH-030 — Phase 46)
package/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  **Autonomous Vibe Coding Framework / Bộ khung phát triển tự động có kiểm soát**
4
4
 
5
- [![Version](https://img.shields.io/badge/version-1.9.5-blue.svg)](CHANGELOG.md)
5
+ [![Version](https://img.shields.io/badge/version-2.4.0-blue.svg)](CHANGELOG.md)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
7
7
  [![Skills](https://img.shields.io/badge/skills-16-purple.svg)](#skills-reference)
8
8
  [![Workflows](https://img.shields.io/badge/workflows-12-orange.svg)](#workflows)
9
9
  [![Templates](https://img.shields.io/badge/templates-17-cyan.svg)](#templates)
10
- [![Tests](https://img.shields.io/badge/tests-308%20passing-brightgreen.svg)](tests/)
10
+ [![Tests](https://img.shields.io/badge/tests-607%20passing-brightgreen.svg)](tests/)
11
11
  [![GitHub](https://img.shields.io/github/stars/0-CODE/viepilot?style=social)](https://github.com/0-CODE/viepilot)
12
12
 
13
- **Versioning:** Shield **1.9.5** is the **ViePilot framework SemVer** tracked in `.viepilot/TRACKER.md` and `CHANGELOG.md`. The npm `package.json` field `version` (**1.9.5**) is the Node package identifier for this repo; use the framework version for milestone releases and docs.
13
+ **Versioning:** Shield **2.4.0** is the **ViePilot framework SemVer** tracked in `.viepilot/TRACKER.md` and `CHANGELOG.md`. The npm `package.json` field `version` (**2.4.0**) is the Node package identifier for this repo; use the framework version for milestone releases and docs.
14
14
 
15
15
  ViePilot là bộ skill framework cho phép AI assistant (Claude, GPT, etc.) phát triển dự án một cách **tự động**, **có kiểm soát**, và **có thể khôi phục**. Thiết kế theo các tiêu chuẩn chuyên nghiệp: Semantic Versioning, Conventional Commits, Keep a Changelog.
16
16
 
@@ -28,13 +28,13 @@ Nếu ViePilot giúp ích cho bạn, bạn có thể ủng hộ một ly cafe:
28
28
 
29
29
  | Chỉ số / Metric | Giá trị / Value |
30
30
  |-----------------|-----------------|
31
- | Total LOC | **~27,991+** (`.md`, `.js`, `.cjs`, `.yml`, `.json`, `.sh`; không gồm `node_modules`) |
31
+ | Total LOC | **~39,668+** (`.md`, `.js`, `.cjs`, `.yml`, `.json`, `.sh`; không gồm `node_modules`) |
32
32
  | Skills | **16** |
33
33
  | Workflows | **12** |
34
34
  | Templates | **17** (Project: 12, Phase: 5) |
35
35
  | CLI Commands | **18** (`vp-tools` 17 subcommands + `viepilot` installer) |
36
- | Tests | **308** (16 suites: unit + integration + AI compat + README metrics + UI direction + ENH contracts + scope policy + FEAT-009 + FEAT-010 + ENH-021 routing + FEAT-001 Claude Code + ENH-022 crystallize architecture files + viepilot-info/update/install) |
37
- | ViePilot phases (local `.viepilot`) | **34** phase cycles — **M1.29** FEAT-001 (**v1.9.3** doc); patch **v1.9.4** (Claude installer); **M1.28** FEAT-010 (**v1.9.1**); **v1.9.2** (ENH-019~021); **M1.27** (**v1.9.0** FEAT-009); xem `CHANGELOG.md` |
36
+ | Tests | **607** (34 suites: unit + integration + AI compat + README metrics + UI direction + ENH contracts + scope policy + FEAT-009/010/011/012/013/015 + ENH-021~037 routing/language/architect/adapter + BUG-009~013 guards + viepilot-info/update/install/adapters) |
37
+ | ViePilot phases (local `.viepilot`) | **62** phase cycles — **v2.4.0** FEAT-015 Codex adapter; **v2.3.x** ENH-036~037 installer cleanup; **v2.0.0** FEAT-013 dynamic adapters; **v1.x** M1.29 (FEAT-001~013); xem `CHANGELOG.md` |
38
38
  | Standards | 5 (SemVer, Commits, Changelog, Comments, Contributors) |
39
39
 
40
40
  > Metric `Total LOC` có thể được refresh tự động bằng `npm run readme:sync` (dùng `cloc`; nếu thiếu `cloc` script sẽ fallback an toàn).
@@ -48,14 +48,14 @@ Nếu ViePilot giúp ích cho bạn, bạn có thể ủng hộ một ly cafe:
48
48
  | Project Templates | 12 | AI-GUIDE, ARCHITECTURE, VIEPILOT-META, README, SYSTEM-RULES, etc. |
49
49
  | Phase Templates | 5 | SPEC, PHASE-STATE, TASK, VERIFICATION, SUMMARY |
50
50
  | CLI Tools | 2 | vp-tools.cjs (**17** subcommands) + viepilot.cjs (guided installer) |
51
- | Test Files | 15 | Jest: 14 unit + 1 integration (contracts, installer + Claude paths, info/update, FEAT-009, FEAT-010, FEAT-001, ENH-021, scope policy, …) |
51
+ | Test Files | 34 | Jest: 33 unit + 1 integration (contracts, installer + Claude paths, info/update, FEAT-009/010/011~015, ENH-021~037, BUG-009~013 guards, adapter tests, scope policy, …) |
52
52
 
53
53
  ---
54
54
 
55
55
  ## Độ hoàn thiện / Completion Status
56
56
 
57
57
  ```
58
- Tổng thể / Overall: ████████████████████ ~98% ✅ Latest **v1.9.4** (Claude Code **installer** ~/.claude/skills); **v1.9.3** FEAT-001 doc; **v1.9.2** (ENH-019~021); **v1.9.1** FEAT-010; **v1.9.0** FEAT-009
58
+ Tổng thể / Overall: ████████████████████ ~99% ✅ Latest **v2.4.0** FEAT-015 Codex adapter; **v2.3.x** ENH-036~037 installer cleanup; **v2.1.x** BUG-009~013; **v2.0.0** FEAT-013 dynamic adapters
59
59
  ```
60
60
 
61
61
  | Lĩnh vực / Area | Trạng thái | Chi tiết |
@@ -65,11 +65,11 @@ Tổng thể / Overall: ██████████████████
65
65
  | Project Templates (12) | ✅ Hoàn thiện | Placeholders cho customization (+ `VIEPILOT-META` FEAT-009) |
66
66
  | Phase Templates (5) | ✅ Hoàn thiện | Task tracking, verification, summary |
67
67
  | CLI Tools (18) | ✅ Hoàn thiện | vp-tools 17 subcommands + viepilot installer; bundle `info` / `update` |
68
- | Tests (304) | ✅ Hoàn thiện | Unit, integration, AI compat, workflow contracts, installer, scope policy, FEAT-009/010/001, ENH-021, info/update |
68
+ | Tests (607) | ✅ Hoàn thiện | Unit, integration, AI compat, workflow contracts, installer, scope policy, FEAT-009~015, ENH-021~037, BUG-009~013, adapter tests, info/update |
69
69
  | CI/CD | ✅ Hoàn thiện | GitHub Actions, Node 18/20/22 matrix, coverage >80% |
70
70
  | Documentation | ✅ Hoàn thiện | dev/, user/, api/, videos/, examples/, troubleshooting |
71
71
  | Standards | ✅ Hoàn thiện | SemVer, Conventional Commits, Keep a Changelog |
72
- | Installation | ✅ Hoàn thiện | install.sh + dev-install.sh |
72
+ | Installation | ✅ Hoàn thiện | `bin/viepilot.cjs install` (Node-based, all adapters) |
73
73
 
74
74
  ---
75
75
 
@@ -205,10 +205,13 @@ Chọn target profile trong wizard (phím mũi tên + space + enter):
205
205
  - Claude Code
206
206
  - Cursor Agent
207
207
  - Cursor IDE
208
+ - Antigravity
209
+ - Codex
208
210
 
209
211
  Non-interactive:
210
212
  ```bash
211
213
  npx viepilot install --target cursor-agent --yes
214
+ npx viepilot install --target codex --yes
212
215
  ```
213
216
 
214
217
  Gỡ cài đặt:
@@ -353,7 +356,7 @@ viepilot/
353
356
  │ ├── vp-rollback/ # Checkpoint recovery
354
357
  │ └── vp-audit/ # Documentation sync
355
358
 
356
- ├── workflows/ # 11 Workflow definitions
359
+ ├── workflows/ # 12 Workflow definitions
357
360
  │ ├── brainstorm.md # Brainstorm session flow
358
361
  │ ├── crystallize.md # Artifact generation flow
359
362
  │ ├── autonomous.md # Execution loop
@@ -388,17 +391,25 @@ viepilot/
388
391
  │ └── SUMMARY.md
389
392
 
390
393
  ├── lib/ # Shared CLI logic (coverage target for Jest)
391
- └── cli-shared.cjs # Validators, project root, Levenshtein helpers
394
+ ├── cli-shared.cjs # Validators, project root, Levenshtein helpers
395
+ │ └── adapters/ # Dynamic adapter system (FEAT-013)
396
+ │ ├── index.cjs # Registry: listAdapters(), getAdapter()
397
+ │ ├── claude-code.cjs # Claude Code adapter (~/.claude/)
398
+ │ ├── cursor.cjs # Cursor adapter (~/.cursor/)
399
+ │ ├── antigravity.cjs # Antigravity adapter (~/.antigravity/)
400
+ │ └── codex.cjs # Codex CLI adapter (~/.codex/)
392
401
 
393
402
  ├── bin/ # CLI tools
394
403
  │ └── vp-tools.cjs # 17 subcommands; uses ../lib/cli-shared.cjs, viepilot-info/update.cjs
395
404
 
396
- ├── tests/ # Test suite (308 tests)
397
- │ ├── unit/ # Unit tests
405
+ ├── tests/ # Test suite (607 tests, 34 suites)
406
+ │ ├── unit/ # 33 unit test files
398
407
  │ │ ├── validators.test.js # CLI subprocess + in-process coverage tests
399
- │ │ └── ai-provider-compat.test.js # 142 AI compat tests
408
+ │ │ ├── ai-provider-compat.test.js # AI compat tests
409
+ │ │ ├── viepilot-adapters.test.js # Adapter registry tests
410
+ │ │ └── vp-adapter-codex.test.js # Codex adapter tests
400
411
  │ └── integration/ # Integration tests
401
- │ └── workflow.test.js # 22 E2E tests
412
+ │ └── workflow.test.js # E2E tests
402
413
 
403
414
  ├── .github/workflows/ # CI/CD
404
415
  │ └── ci.yml # Node 18/20/22 matrix
@@ -419,7 +430,6 @@ viepilot/
419
430
  │ ├── api-service/ # Express + JWT example
420
431
  │ └── cli-tool/ # Node.js CLI example
421
432
 
422
- ├── install.sh # Installation script
423
433
  ├── Makefile # Developer commands
424
434
  ├── CHANGELOG.md # Version history
425
435
  ├── CONTRIBUTING.md # Contribution guide
package/bin/viepilot.cjs CHANGED
@@ -14,11 +14,15 @@ const { buildInstallPlan, applyInstallPlan, resolveViepilotPackageRoot } = requi
14
14
  'lib',
15
15
  'viepilot-install.cjs',
16
16
  ));
17
+ const { adapters: adapterMap } = require(path.join(__dirname, '..', 'lib', 'adapters', 'index.cjs'));
17
18
 
19
+ // UI target list — keep cursor-agent and cursor-ide as distinct choices for users.
18
20
  const TARGETS = [
19
- { id: 'claude-code', label: 'Claude Code' },
21
+ { id: 'claude-code', label: adapterMap['claude-code'].name + ' (default)' },
20
22
  { id: 'cursor-agent', label: 'Cursor Agent' },
21
- { id: 'cursor-ide', label: 'Cursor IDE' },
23
+ { id: 'cursor-ide', label: 'Cursor IDE' },
24
+ { id: 'antigravity', label: adapterMap['antigravity'].name },
25
+ { id: 'codex', label: adapterMap['codex'].name },
22
26
  ];
23
27
 
24
28
  function printHelp() {
@@ -32,14 +36,14 @@ Usage:
32
36
  viepilot --list-targets
33
37
 
34
38
  Install options:
35
- --target <id|id,id|all> Target profile(s): claude-code (mirrors vp-* to ~/.claude/skills), cursor-agent, cursor-ide
39
+ --target <id|id,id|all> Target profile(s): claude-code (mirrors vp-* to ~/.claude/skills), cursor-agent, cursor-ide, antigravity, codex
36
40
  --yes Non-interactive mode (skip confirmations)
37
41
  --dry-run Print actions only (Node installer; no bash)
38
42
  --list-targets Print supported targets and exit
39
43
  --help Show help
40
44
 
41
45
  Uninstall options:
42
- --target <id|id,id|all> Remove assets (claude-code: ~/.claude/skills/vp-*; cursor-*: ~/.cursor/skills/vp-*; shared: ~/.cursor/viepilot)
46
+ --target <id|id,id|all> Remove assets (claude-code: ~/.claude/skills/vp-*; cursor-*: ~/.cursor/skills/vp-*; antigravity: ~/.antigravity/skills/vp-*; codex: ~/.codex/skills/vp-*)
43
47
  --yes Non-interactive mode (skip confirmations)
44
48
  --dry-run Print actions only, do not remove files
45
49
  `);
@@ -254,7 +258,7 @@ async function interactiveTargetSelection() {
254
258
  function runInstallViaNode(selectedTargets, dryRun) {
255
259
  const fallbackRoot = path.join(__dirname, '..');
256
260
  const pkgRoot = resolveViepilotPackageRoot(fallbackRoot) || fallbackRoot;
257
- const profile = selectedTargets[0] || 'cursor-ide';
261
+ const profile = selectedTargets[0] || 'claude-code';
258
262
  const env = {
259
263
  ...process.env,
260
264
  VIEPILOT_AUTO_YES: '1',
@@ -307,8 +311,8 @@ async function installCommand(rawArgs) {
307
311
 
308
312
  if (!selectedTargets) {
309
313
  if (options.yes) {
310
- selectedTargets = TARGETS.map((t) => t.id);
311
- console.log('No --target provided with --yes; defaulting to all targets.');
314
+ selectedTargets = ['claude-code'];
315
+ console.log('No --target provided with --yes; defaulting to claude-code.');
312
316
  } else {
313
317
  selectedTargets = await interactiveTargetSelection();
314
318
  if (selectedTargets.length === 0) {
@@ -335,8 +339,14 @@ async function installCommand(rawArgs) {
335
339
  else console.log(`- ${r.target}: failed (exit ${r.code})`);
336
340
  }
337
341
  console.log('\nNext actions:');
338
- console.log('- Cursor: open project and run /vp-status');
339
- console.log('- Claude Code: restart session if needed so ~/.claude/skills/vp-* is picked up; then /vp-status');
342
+ const seenAdapters = new Set();
343
+ for (const target of selectedTargets) {
344
+ const a = adapterMap[target];
345
+ if (a && !seenAdapters.has(a.id)) {
346
+ seenAdapters.add(a.id);
347
+ console.log(`- ${a.name}: ${a.postInstallHint || 'run /vp-status'}`);
348
+ }
349
+ }
340
350
  console.log('- If needed, run /vp-brainstorm then /vp-crystallize');
341
351
 
342
352
  return failed.length === 0 ? 0 : 1;
package/bin/vp-tools.cjs CHANGED
@@ -13,6 +13,7 @@
13
13
  const fs = require('fs');
14
14
  const path = require('path');
15
15
  const readline = require('readline');
16
+ const os = require('os');
16
17
 
17
18
  const {
18
19
  validators,
@@ -25,6 +26,7 @@ const {
25
26
 
26
27
  const viepilotInfo = require(path.join(__dirname, '../lib/viepilot-info.cjs'));
27
28
  const viepilotUpdate = require(path.join(__dirname, '../lib/viepilot-update.cjs'));
29
+ const viepilotConfig = require(path.join(__dirname, '../lib/viepilot-config.cjs'));
28
30
 
29
31
  // ============================================================================
30
32
  // Output Formatting (TTY-aware)
@@ -946,6 +948,195 @@ const commands = {
946
948
  }, null, 2));
947
949
  },
948
950
 
951
+ /**
952
+ * Hooks scaffold + install — FEAT-013/FEAT-012 adapter hook management
953
+ * Usage: vp-tools hooks <scaffold|install> [--adapter <id>]
954
+ */
955
+ hooks: (args) => {
956
+ const sub = args[0];
957
+ if (!sub || sub === 'help') {
958
+ console.log(`${colors.cyan}Usage:${colors.reset}
959
+ vp-tools hooks scaffold [--adapter <id>]
960
+ vp-tools hooks install [--adapter <id>]
961
+
962
+ ${colors.cyan}Subcommands:${colors.reset}
963
+ scaffold Print hook config snippet for the target adapter (default: claude-code)
964
+ install Install ViePilot staleness hook into adapter config file (idempotent)
965
+
966
+ ${colors.cyan}Options:${colors.reset}
967
+ --adapter <id> Adapter ID: claude-code (default), cursor-agent, cursor-ide
968
+
969
+ ${colors.cyan}Examples:${colors.reset}
970
+ ${colors.gray}$${colors.reset} vp-tools hooks scaffold
971
+ ${colors.gray}$${colors.reset} vp-tools hooks scaffold --adapter cursor-agent
972
+ ${colors.gray}$${colors.reset} vp-tools hooks install
973
+ ${colors.gray}$${colors.reset} vp-tools hooks install --adapter claude-code`);
974
+ return;
975
+ }
976
+
977
+ // ── shared adapter resolution ──────────────────────────────────────────
978
+ const adapterArgIdx = args.indexOf('--adapter');
979
+ const adapterId = adapterArgIdx !== -1 ? args[adapterArgIdx + 1] : 'claude-code';
980
+ if (adapterArgIdx !== -1 && !adapterId) {
981
+ console.error(formatError('--adapter requires a value (e.g. claude-code, cursor-agent)'));
982
+ process.exit(1);
983
+ }
984
+ const { getAdapter } = require(path.join(__dirname, '../lib/adapters/index.cjs'));
985
+ let adapter;
986
+ try {
987
+ adapter = getAdapter(adapterId);
988
+ } catch (e) {
989
+ console.error(formatError(e.message));
990
+ process.exit(1);
991
+ }
992
+
993
+ if (sub === 'scaffold') {
994
+ if (!adapter.hooks || !adapter.hooks.configFile) {
995
+ console.log(`Adapter "${adapterId}" (${adapter.name}) does not use a settings.json hook config.`);
996
+ console.log(`For Cursor, hooks are configured via .cursorrules or project MDC files.`);
997
+ process.exit(0);
998
+ }
999
+ const home = os.homedir();
1000
+ const configPath = adapter.hooks.configFile(home);
1001
+ console.log(`\nViePilot hooks scaffold for: ${adapter.name}`);
1002
+ console.log(`Config file: ${configPath}\n`);
1003
+ console.log(`Add the following to your ${configPath}:\n`);
1004
+ console.log(JSON.stringify({
1005
+ hooks: {
1006
+ Stop: [{
1007
+ matcher: {},
1008
+ hooks: [{
1009
+ type: 'command',
1010
+ command: `node ${path.join(home, '.viepilot', 'hooks', 'brainstorm-staleness.cjs')}`
1011
+ }]
1012
+ }]
1013
+ }
1014
+ }, null, 2));
1015
+ console.log(`\nRun 'vp-tools hooks install' to register this hook automatically.`);
1016
+ process.exit(0);
1017
+ }
1018
+
1019
+ if (sub === 'install') {
1020
+ if (!adapter.hooks || !adapter.hooks.configFile) {
1021
+ console.log(`Adapter "${adapterId}" (${adapter.name}) does not support settings.json hooks.`);
1022
+ console.log(`For Cursor, add hooks via .cursorrules or project MDC files.`);
1023
+ process.exit(0);
1024
+ }
1025
+ const home = os.homedir();
1026
+ const configPath = adapter.hooks.configFile(home);
1027
+ const hookCommand = `node ${path.join(home, '.viepilot', 'hooks', 'brainstorm-staleness.cjs')}`;
1028
+
1029
+ // Read existing settings.json (create if missing)
1030
+ let settings = {};
1031
+ if (fs.existsSync(configPath)) {
1032
+ try { settings = JSON.parse(fs.readFileSync(configPath, 'utf8')); } catch (_e) { settings = {}; }
1033
+ }
1034
+
1035
+ // Merge hook entry — idempotent check
1036
+ if (!settings.hooks) settings.hooks = {};
1037
+ if (!settings.hooks.Stop) settings.hooks.Stop = [];
1038
+
1039
+ const alreadyInstalled = settings.hooks.Stop.some((entry) =>
1040
+ Array.isArray(entry.hooks) &&
1041
+ entry.hooks.some((h) => h.type === 'command' && h.command === hookCommand)
1042
+ );
1043
+
1044
+ if (alreadyInstalled) {
1045
+ console.log(formatSuccess('ViePilot staleness hook already installed.'));
1046
+ console.log(` Config: ${configPath}`);
1047
+ process.exit(0);
1048
+ }
1049
+
1050
+ settings.hooks.Stop.push({
1051
+ matcher: {},
1052
+ hooks: [{ type: 'command', command: hookCommand }],
1053
+ });
1054
+
1055
+ try {
1056
+ fs.mkdirSync(path.dirname(configPath), { recursive: true });
1057
+ fs.writeFileSync(configPath, JSON.stringify(settings, null, 2) + '\n', 'utf8');
1058
+ } catch (e) {
1059
+ console.error(formatError(`Failed to write ${configPath}: ${e.message}`));
1060
+ process.exit(1);
1061
+ }
1062
+
1063
+ console.log(formatSuccess('ViePilot staleness hook installed.'));
1064
+ console.log(` Config: ${configPath}`);
1065
+ console.log(` Command: ${hookCommand}`);
1066
+ process.exit(0);
1067
+ }
1068
+
1069
+ console.error(formatError(`Unknown hooks subcommand: ${sub}`, 'Use: scaffold, install'));
1070
+ process.exit(1);
1071
+ },
1072
+
1073
+ /**
1074
+ * Config get/set/reset — ENH-032 language configuration
1075
+ */
1076
+ config: (args) => {
1077
+ const sub = args[0];
1078
+ if (!sub || sub === 'help') {
1079
+ console.log(`${colors.cyan}Usage:${colors.reset}
1080
+ vp-tools config get <key>
1081
+ vp-tools config set <key> <value>
1082
+ vp-tools config reset
1083
+
1084
+ ${colors.cyan}Keys:${colors.reset}
1085
+ language.communication Language for AI communication/banners (e.g. en, vi)
1086
+ language.document Language for generated project files (e.g. en, vi)
1087
+
1088
+ ${colors.cyan}Examples:${colors.reset}
1089
+ ${colors.gray}$${colors.reset} vp-tools config get language.communication
1090
+ ${colors.gray}$${colors.reset} vp-tools config set language.communication vi
1091
+ ${colors.gray}$${colors.reset} vp-tools config reset`);
1092
+ return;
1093
+ }
1094
+ if (sub === 'get') {
1095
+ const key = args[1];
1096
+ if (!key) {
1097
+ console.error(formatError('Missing key', 'Usage: vp-tools config get <key>'));
1098
+ process.exit(1);
1099
+ }
1100
+ const cfg = viepilotConfig.readConfig();
1101
+ const parts = key.split('.');
1102
+ let val = cfg;
1103
+ for (const p of parts) {
1104
+ if (val == null || typeof val !== 'object') { val = undefined; break; }
1105
+ val = val[p];
1106
+ }
1107
+ if (val === undefined) {
1108
+ console.error(formatError(`Unknown config key: ${key}`));
1109
+ process.exit(1);
1110
+ }
1111
+ console.log(val);
1112
+ return;
1113
+ }
1114
+ if (sub === 'set') {
1115
+ const key = args[1];
1116
+ const value = args[2];
1117
+ if (!key || value === undefined) {
1118
+ console.error(formatError('Usage: vp-tools config set <key> <value>'));
1119
+ process.exit(1);
1120
+ }
1121
+ const parts = key.split('.');
1122
+ if (parts.length !== 2) {
1123
+ console.error(formatError('Key must be in format <section>.<field> (e.g. language.communication)'));
1124
+ process.exit(1);
1125
+ }
1126
+ const [section, field] = parts;
1127
+ viepilotConfig.writeConfig({ [section]: { [field]: value } });
1128
+ console.log(formatSuccess(`Set ${key} = ${value}`));
1129
+ return;
1130
+ }
1131
+ if (sub === 'reset') {
1132
+ viepilotConfig.resetConfig();
1133
+ console.log(formatSuccess('Config reset to defaults (communication=en, document=en)'));
1134
+ return;
1135
+ }
1136
+ console.error(formatError(`Unknown config subcommand: ${sub}`, 'Use get, set, or reset'));
1137
+ process.exit(1);
1138
+ },
1139
+
949
1140
  /**
950
1141
  * Help
951
1142
  */
@@ -1088,6 +1279,8 @@ ${colors.cyan}Commands:${colors.reset}
1088
1279
  ${colors.bold}info${colors.reset} [--json] Show ViePilot version, npm latest, skills/workflows
1089
1280
  ${colors.bold}update${colors.reset} [--dry-run] Update viepilot via npm (use --yes non-interactive)
1090
1281
  ${colors.bold}conflicts${colors.reset} Check for potential conflicts
1282
+ ${colors.bold}hooks${colors.reset} scaffold|install [--adapter] scaffold: print snippet; install: write to settings.json
1283
+ ${colors.bold}config${colors.reset} <get|set|reset> Read/write language config (~/.viepilot/config.json)
1091
1284
  ${colors.bold}save-state${colors.reset} Save current state for precise resume
1092
1285
  ${colors.bold}help${colors.reset} [command] Show help (optionally for specific command)
1093
1286