@longph2102/v-flow 1.5.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 (247) hide show
  1. package/AGENTS.md +265 -0
  2. package/CHANGELOG.md +318 -0
  3. package/LICENSE +21 -0
  4. package/README.md +326 -0
  5. package/agents/ba-agent.md +437 -0
  6. package/agents/ba-critic-agent.md +156 -0
  7. package/agents/ba-to-ptyc-agent.md +112 -0
  8. package/agents/bugfix-analyst-agent.md +221 -0
  9. package/agents/constitute-agent.md +155 -0
  10. package/agents/help-agent.md +168 -0
  11. package/agents/implement-agent.md +220 -0
  12. package/agents/import-ba-docs-agent.md +164 -0
  13. package/agents/master-check-agent.md +228 -0
  14. package/agents/metrics-agent.md +180 -0
  15. package/agents/operations-agent.md +123 -0
  16. package/agents/plan-agent.md +218 -0
  17. package/agents/prototype-agent.md +191 -0
  18. package/agents/retrospective-agent.md +196 -0
  19. package/agents/review-agent.md +210 -0
  20. package/agents/sprint-agent.md +191 -0
  21. package/agents/status-agent.md +186 -0
  22. package/agents/sync-agent.md +201 -0
  23. package/agents/test-agent.md +166 -0
  24. package/agents/understand-agent.md +339 -0
  25. package/cli/commands/check.js +96 -0
  26. package/cli/commands/dev-quiz.js +107 -0
  27. package/cli/commands/doctor.js +348 -0
  28. package/cli/commands/feature.js +259 -0
  29. package/cli/commands/hooks.js +163 -0
  30. package/cli/commands/init.js +189 -0
  31. package/cli/commands/log.js +199 -0
  32. package/cli/commands/plugin.js +230 -0
  33. package/cli/commands/score-card.js +203 -0
  34. package/cli/commands/status.js +269 -0
  35. package/cli/commands/sync.js +59 -0
  36. package/cli/commands/upgrade.js +150 -0
  37. package/cli/commands/validate.js +1259 -0
  38. package/cli/commands/watch.js +151 -0
  39. package/cli/index.js +46 -0
  40. package/cli/lib/ac-test-gate.js +89 -0
  41. package/cli/lib/activity-log.js +209 -0
  42. package/cli/lib/cli-error.js +183 -0
  43. package/cli/lib/constitution-lint.js +561 -0
  44. package/cli/lib/dev-quiz-grade.js +127 -0
  45. package/cli/lib/governance.js +78 -0
  46. package/cli/lib/hook-targets.js +167 -0
  47. package/cli/lib/i18n.js +375 -0
  48. package/cli/lib/knowledge-oracle.js +379 -0
  49. package/cli/lib/logger.js +203 -0
  50. package/cli/lib/module-card-lint.js +304 -0
  51. package/cli/lib/module-card-score.js +223 -0
  52. package/cli/lib/plugins.js +481 -0
  53. package/cli/lib/scanner.js +692 -0
  54. package/cli/lib/sync-core.js +232 -0
  55. package/cli/lib/sync-targets.js +84 -0
  56. package/cli/lib/templates.js +268 -0
  57. package/cli/lib/yaml-parser.js +203 -0
  58. package/commands/v.ba-critic.md +101 -0
  59. package/commands/v.ba-to-ptyc.md +71 -0
  60. package/commands/v.bugfix.md +86 -0
  61. package/commands/v.check.md +131 -0
  62. package/commands/v.constitute.md +87 -0
  63. package/commands/v.constitution.md +84 -0
  64. package/commands/v.fork.md +127 -0
  65. package/commands/v.help.md +73 -0
  66. package/commands/v.hotfix.md +200 -0
  67. package/commands/v.implement.md +92 -0
  68. package/commands/v.import-ba-docs.md +222 -0
  69. package/commands/v.metrics.md +74 -0
  70. package/commands/v.operations.md +70 -0
  71. package/commands/v.plan.md +78 -0
  72. package/commands/v.prototype.md +121 -0
  73. package/commands/v.quickfix.md +169 -0
  74. package/commands/v.retrospective.md +80 -0
  75. package/commands/v.review.md +78 -0
  76. package/commands/v.rewind.md +127 -0
  77. package/commands/v.specify.md +118 -0
  78. package/commands/v.sprint.md +75 -0
  79. package/commands/v.status.md +62 -0
  80. package/commands/v.sync.md +81 -0
  81. package/commands/v.test.md +67 -0
  82. package/commands/v.understand.md +112 -0
  83. package/package.json +65 -0
  84. package/skills/_shared/constitution-reader/SKILL.md +109 -0
  85. package/skills/_shared/constitution-reader/config.json +52 -0
  86. package/skills/_shared/constitution-reader/examples/good/b1-phase-output.md +48 -0
  87. package/skills/_shared/constitution-reader/gotchas.md +46 -0
  88. package/skills/_shared/context-reader/SKILL.md +111 -0
  89. package/skills/_shared/context-reader/config.json +54 -0
  90. package/skills/_shared/context-reader/examples/good/legacy-nodejs-output.md +35 -0
  91. package/skills/_shared/context-reader/gotchas.md +49 -0
  92. package/skills/_shared/ears-notation/SKILL.md +63 -0
  93. package/skills/_shared/ears-notation/config.json +55 -0
  94. package/skills/_shared/ears-notation/examples/good/plan-test-interpretation.md +29 -0
  95. package/skills/_shared/ears-notation/gotchas.md +43 -0
  96. package/skills/check/cross-validator/SKILL.md +206 -0
  97. package/skills/check/cross-validator/config.json +33 -0
  98. package/skills/check/cross-validator/examples/good/validation-report-pass-with-concerns.md +105 -0
  99. package/skills/check/cross-validator/gotchas.md +43 -0
  100. package/skills/implement/constitution-enforcer/SKILL.md +134 -0
  101. package/skills/implement/constitution-enforcer/config.json +16 -0
  102. package/skills/implement/constitution-enforcer/examples/bad/vague-report.md +42 -0
  103. package/skills/implement/constitution-enforcer/examples/good/compliance-report.md +57 -0
  104. package/skills/implement/constitution-enforcer/gotchas.md +26 -0
  105. package/skills/implement/constitution-enforcer/scripts/check-constitution.sh +88 -0
  106. package/skills/implement/no-go-zone-guard/SKILL.md +173 -0
  107. package/skills/implement/no-go-zone-guard/config.json +28 -0
  108. package/skills/implement/no-go-zone-guard/examples/good/adapter-workaround.md +46 -0
  109. package/skills/implement/no-go-zone-guard/gotchas.md +27 -0
  110. package/skills/implement/no-go-zone-guard/scripts/check-nogo-zones.sh +148 -0
  111. package/skills/implement/no-go-zone-guard/scripts/nogo-precommit.sh +96 -0
  112. package/skills/implement/tdd-driver/SKILL.md +159 -0
  113. package/skills/implement/tdd-driver/config.json +33 -0
  114. package/skills/implement/tdd-driver/examples/good/tdd-cycle-product-repo.md +81 -0
  115. package/skills/implement/tdd-driver/gotchas.md +34 -0
  116. package/skills/metrics/metrics-collector/SKILL.md +133 -0
  117. package/skills/metrics/metrics-collector/config.json +16 -0
  118. package/skills/metrics/metrics-collector/examples/bad/incomplete-report.md +48 -0
  119. package/skills/metrics/metrics-collector/examples/good/full-metrics-report.md +101 -0
  120. package/skills/metrics/metrics-collector/gotchas.md +26 -0
  121. package/skills/operations/incident-runbook/SKILL.md +167 -0
  122. package/skills/operations/incident-runbook/config.json +21 -0
  123. package/skills/operations/incident-runbook/examples/bad/vague-incident-report.md +48 -0
  124. package/skills/operations/incident-runbook/examples/good/p1-hotfix-response.md +119 -0
  125. package/skills/operations/incident-runbook/gotchas.md +26 -0
  126. package/skills/plan/architecture-designer/SKILL.md +228 -0
  127. package/skills/plan/architecture-designer/config.json +32 -0
  128. package/skills/plan/architecture-designer/examples/bad/vague-plan.md +62 -0
  129. package/skills/plan/architecture-designer/examples/good/expand-contract-migration.md +56 -0
  130. package/skills/plan/architecture-designer/examples/good/plan-structure.md +58 -0
  131. package/skills/plan/architecture-designer/gotchas.md +45 -0
  132. package/skills/plan/task-breakdown/SKILL.md +208 -0
  133. package/skills/plan/task-breakdown/config.json +26 -0
  134. package/skills/plan/task-breakdown/examples/bad/vague-tasks.md +77 -0
  135. package/skills/plan/task-breakdown/examples/good/spike-clarify-tasks.md +66 -0
  136. package/skills/plan/task-breakdown/examples/good/tasks-login-feature.md +111 -0
  137. package/skills/plan/task-breakdown/gotchas.md +39 -0
  138. package/skills/prototype/LOGIC.md +240 -0
  139. package/skills/prototype/SKILL.md +185 -0
  140. package/skills/prototype/UI.md +407 -0
  141. package/skills/prototype/config.json +104 -0
  142. package/skills/prototype/examples/bad/prototype-notes.md +68 -0
  143. package/skills/prototype/examples/good/prototype-notes-ui.md +109 -0
  144. package/skills/prototype/examples/good/prototype-notes.md +67 -0
  145. package/skills/prototype/gotchas.md +128 -0
  146. package/skills/prototype/scripts/check-flow-state.ps1 +112 -0
  147. package/skills/prototype/scripts/check-flow-state.sh +104 -0
  148. package/skills/prototype/scripts/check-prototype-cleanup.ps1 +124 -0
  149. package/skills/prototype/scripts/check-prototype-cleanup.sh +109 -0
  150. package/skills/prototype/scripts/check-prototype-notes.ps1 +107 -0
  151. package/skills/prototype/scripts/check-prototype-notes.sh +102 -0
  152. package/skills/review/adversarial-reviewer/SKILL.md +137 -0
  153. package/skills/review/adversarial-reviewer/config.json +32 -0
  154. package/skills/review/adversarial-reviewer/examples/good/review-report-template.md +56 -0
  155. package/skills/review/adversarial-reviewer/gotchas.md +46 -0
  156. package/skills/review/adversarial-reviewer/scripts/quick-security-scan.sh +52 -0
  157. package/skills/specify/ba-bpmn-doc-gen/SKILL.md +108 -0
  158. package/skills/specify/ba-bpmn-doc-gen/reference/reference-bpmn-generation.md +528 -0
  159. package/skills/specify/ba-bpmn-doc-gen/reference/reference-drawio-flowchart.md +466 -0
  160. package/skills/specify/ba-critic/SKILL.md +172 -0
  161. package/skills/specify/ba-critic/config.json +32 -0
  162. package/skills/specify/ba-critic/examples/good/critic-report-round1.md +51 -0
  163. package/skills/specify/ba-critic/gotchas.md +40 -0
  164. package/skills/specify/ba-critic/scripts/check-spec-quality.sh +72 -0
  165. package/skills/specify/ba-doc-generator/SKILL.md +102 -0
  166. package/skills/specify/ba-doc-generator/references/template-clevel.md +84 -0
  167. package/skills/specify/ba-doc-generator/references/template-compliance.md +83 -0
  168. package/skills/specify/ba-doc-generator/references/template-dev.md +138 -0
  169. package/skills/specify/ba-doc-generator/references/template-partner.md +167 -0
  170. package/skills/specify/ba-doc-generator/references/template-pm.md +92 -0
  171. package/skills/specify/ba-doc-generator/references/template-review.md +114 -0
  172. package/skills/specify/ba-doc-generator/references/template-tester.md +108 -0
  173. package/skills/specify/ba-doc-generator/references/template-user.md +98 -0
  174. package/skills/specify/bugfix-analyst/SKILL.md +296 -0
  175. package/skills/specify/bugfix-analyst/config.json +41 -0
  176. package/skills/specify/bugfix-analyst/examples/bad/common-mistakes.md +71 -0
  177. package/skills/specify/bugfix-analyst/examples/good/email-validation-bugfix.md +53 -0
  178. package/skills/specify/bugfix-analyst/gotchas.md +51 -0
  179. package/skills/specify/ears-writer/SKILL.md +129 -0
  180. package/skills/specify/ears-writer/config.json +20 -0
  181. package/skills/specify/ears-writer/examples/bad/common-mistakes.md +17 -0
  182. package/skills/specify/ears-writer/examples/good/login-requirements.md +41 -0
  183. package/skills/specify/ears-writer/gotchas.md +43 -0
  184. package/skills/specify/ears-writer/scripts/check-ears-compliance.sh +51 -0
  185. package/skills/test/test-case-generator/SKILL.md +161 -0
  186. package/skills/test/test-case-generator/config.json +33 -0
  187. package/skills/test/test-case-generator/examples/good/test-cases-login.md +104 -0
  188. package/skills/test/test-case-generator/gotchas.md +43 -0
  189. package/skills/understand/ba-docs-scanner/SKILL.md +239 -0
  190. package/skills/understand/ba-docs-scanner/config.json +47 -0
  191. package/skills/understand/ba-docs-scanner/examples/good/work-order-br-extract.md +28 -0
  192. package/skills/understand/ba-docs-scanner/gotchas.md +44 -0
  193. package/skills/understand/ba-docs-scanner/merge-rules.md +47 -0
  194. package/skills/understand/codebase-scanner/SKILL.md +260 -0
  195. package/skills/understand/codebase-scanner/config.json +56 -0
  196. package/skills/understand/codebase-scanner/examples/good/menu-module-output.md +44 -0
  197. package/skills/understand/codebase-scanner/gotchas.md +42 -0
  198. package/skills/understand/codebase-scanner/scripts/scan-project-structure.sh +64 -0
  199. package/templates/DESIGN.md +456 -0
  200. package/templates/agent-command-template.yaml +240 -0
  201. package/templates/agent-config-template.md +170 -0
  202. package/templates/agent-definition-template.md +145 -0
  203. package/templates/agent-metrics-template.md +150 -0
  204. package/templates/api-contract-template.md +72 -0
  205. package/templates/bugfix-report-template.md +195 -0
  206. package/templates/bugfix-spec-template.md +134 -0
  207. package/templates/code-review-report-template.md +119 -0
  208. package/templates/constitution-template.md +234 -0
  209. package/templates/context-template.md +94 -0
  210. package/templates/data-model-template.md +95 -0
  211. package/templates/decision-log-template.md +92 -0
  212. package/templates/flow-state-template.yaml +208 -0
  213. package/templates/github/workflows/v-flow-validate.yml +30 -0
  214. package/templates/knowledge/adr-template.md +70 -0
  215. package/templates/knowledge/api-contract-template.md +140 -0
  216. package/templates/knowledge/domain-glossary.md +29 -0
  217. package/templates/knowledge/golden-tests-readme.md +115 -0
  218. package/templates/knowledge/lessons-learned.md +41 -0
  219. package/templates/knowledge/patterns.md +103 -0
  220. package/templates/module-card/SKILL.md +85 -0
  221. package/templates/module-card/api-specs.md +96 -0
  222. package/templates/module-card/business-quiz.md +119 -0
  223. package/templates/module-card/cross-service.md +125 -0
  224. package/templates/module-card/db.md +85 -0
  225. package/templates/module-card/dev-quiz.md +62 -0
  226. package/templates/module-card/permissions.md +83 -0
  227. package/templates/module-card/state-diagram.md +64 -0
  228. package/templates/module-card/tech-context.md +90 -0
  229. package/templates/module-card/ui-flows.md +91 -0
  230. package/templates/module-card/use-cases.md +142 -0
  231. package/templates/module-template.yaml +161 -0
  232. package/templates/operations-report-template.md +108 -0
  233. package/templates/plan-template.md +308 -0
  234. package/templates/prototype-notes-template.md +116 -0
  235. package/templates/ptyc/PTYC.template.docx +0 -0
  236. package/templates/ptyc/ptyc.meta.example.yaml +44 -0
  237. package/templates/retrospective-report-template.md +136 -0
  238. package/templates/security-review-template.md +84 -0
  239. package/templates/session-template.md +167 -0
  240. package/templates/spec-review-log-template.md +75 -0
  241. package/templates/spec-template.md +229 -0
  242. package/templates/sprint-status-template.md +101 -0
  243. package/templates/tasks-template.md +275 -0
  244. package/templates/test-cases-template.md +124 -0
  245. package/templates/ux-checklist-template.md +79 -0
  246. package/templates/validation-report-template.md +125 -0
  247. package/templates/vflow-config-template.yaml +22 -0
package/AGENTS.md ADDED
@@ -0,0 +1,265 @@
1
+ # AGENTS.md — V Flow Instructions for AI Agents
2
+
3
+ > This file provides instructions for AI coding agents (**GitHub Copilot**, **Antigravity**, Cursor, etc.)
4
+ > working within a project that uses **V Flow** — Agentic AI Software Development Process.
5
+
6
+ ---
7
+
8
+ ## 🧠 Tầng 1: Project Overview & Rules (Auto-injected)
9
+
10
+ <!-- AUTO-INJECT: context.md START -->
11
+ > ⚠️ **Project Context**: Nội dung `context.md` (~50-100 dòng overview bao gồm tech stack, architecture, no-go zones) sẽ được V Flow CLI tự động inject vào đây.
12
+ <!-- AUTO-INJECT: context.md END -->
13
+
14
+ <!-- AUTO-INJECT: constitution.md START -->
15
+ > ⚠️ **Project Rules**: Nội dung `constitution.md` (Development rules, formatting, policies) sẽ được V Flow CLI tự động inject vào đây.
16
+ <!-- AUTO-INJECT: constitution.md END -->
17
+
18
+ ---
19
+
20
+ ## 📦 Tầng 2: Module Cards (On-Demand Context)
21
+
22
+ > Khi làm việc với một feature cụ thể, Agent PHẢI chủ động đọc các file liên quan trong thư mục `.v-flow/modules/<domain>/SKILL.md` (Bao gồm các file: `use-cases.md`, `api-specs.md`, `tech-context.md`, `db.md`, `state-diagram.md`, `permissions.md`, `ui-flows.md`) để lấy context nghiệp vụ sâu hơn.
23
+
24
+ ---
25
+
26
+ ## Project Structure
27
+
28
+ This project follows the **V Flow** Spec-Driven Development process.
29
+ All development artifacts are stored in `.v-flow/`:
30
+
31
+ ```
32
+ .v-flow/
33
+ ├── context.md ← U.0a: Project Overview (~50-100 dòng, auto-loaded)
34
+ ├── constitution.md ← Project principles & rules
35
+ ├── agent-config.md ← Agent pipeline configuration
36
+ ├── modules/ ← U.0b: Module Cards (Skills format)
37
+ │ └── domain-xxx/
38
+ │ ├── SKILL.md ← Entry point + frontmatter
39
+ │ ├── use-cases.md ← Business rules (BA đọc)
40
+ │ ├── api-specs.md ← API endpoints (Dev đọc)
41
+ │ ├── ui-flows.md ← Màn hình, UX, Field Mapping
42
+ │ ├── tech-context.md ← Patterns, dependencies (Dev đọc)
43
+ │ ├── cross-service.md ← Tích hợp liên service
44
+ │ ├── db.md ← Database, schema, DDL
45
+ │ ├── state-diagram.md ← State machine, transitions
46
+ │ ├── permissions.md ← Roles, VPS, policies
47
+ │ └── raw/ ← U.0d (Optional — NotebookLM raw data)
48
+ │ ├── sources/ ← Source fulltext files
49
+ │ ├── domain-map.json ← Mind map export
50
+ │ └── overview.md ← Briefing doc
51
+ ├── knowledge/ ← Domain knowledge base
52
+ │ ├── domain-glossary.md
53
+ │ ├── architecture-decisions/
54
+ │ ├── patterns/
55
+ │ ├── golden-tests/
56
+ │ └── lessons-learned/
57
+ ├── features/ ← Feature artifacts
58
+ │ └── NNN-feature-name/
59
+ │ ├── spec.md ← S.1: Specification — SINGLE SOURCE OF TRUTH
60
+ │ ├── .flow-state.yaml ← Machine-readable pipeline state
61
+ │ ├── _session.md ← Working memory
62
+ │ ├── plan.md ← B.0a: Technical Plan
63
+ │ ├── tasks.md ← B.0a: Task Breakdown
64
+ │ ├── test-cases.md ← B.0b: Test Cases
65
+ │ ├── validation-report.md ← R.0: Master Check
66
+ │ └── metrics-report.md ← M.0: Metrics
67
+ └── incidents/ ← O.0: Operations
68
+ ```
69
+
70
+ ## Critical Rules
71
+
72
+ 1. **Tuân thủ tuyệt đối Project Context & Constitution** được auto-inject ở trên (Tầng 1). Không hành động nếu chưa rõ no-go zones.
73
+ 2. **Chủ động đọc Module Cards (Tầng 2)** cho các module liên quan — `.v-flow/modules/domain-xxx/SKILL.md`
74
+ 3. **`spec.md` is Single Source of Truth** — if plan/tasks conflict with spec, spec wins
75
+ 4. **Check `.flow-state.yaml`** before starting any phase — know where you are in the pipeline
76
+ 5. **Read `_session.md`** for working memory — decisions made, open questions, concerns from Master Check
77
+ 6. **Check spec Status block** (Section 7) before implementing — all artifacts must be ✅
78
+ 7. **If spec changes** — run `/v.sync` before continuing implementation
79
+ 8. **Follow the pipeline order** — Spec → Plan + Tests → Master Check → Implement
80
+ 9. **Never implement without Master Check = PASS (or PASS WITH CONCERNS)** — check `validation-report.md` *(ngoại lệ: prebuilt flows `quickfix`/`bugfix`/`hotfix` cố ý bỏ R.0 — đánh đổi tốc độ, chỉ dùng cho thay đổi nhỏ/khẩn)*
81
+ 10. **Follow Routing Rules** — `validation-report.md` contains `fail_reason` + `route_decision`; don't guess
82
+ 11. **Concerns carry-forward** — resolve all [W-xxx] concerns during B.1; verify during R.1
83
+ 12. **Update `.flow-state.yaml`** at end of each phase — record verdict, routing, phase transition
84
+ 13. **Append to `_session.md`** at end of each phase — execution trace entry
85
+ 14. **Use EARS notation** for requirements: Ubiquitous, Event-driven, State-driven, Optional
86
+ 15. **Map everything to requirements** — tasks, tests, and code must trace back to REQ-xxx
87
+ 16. **TDD** — write tests before implementation code
88
+ 17. **Log mỗi ranh giới phase** — cùng lúc với việc append `_session.md` (rule 13), gọi `v-flow log` để ghi vào nhật ký tổng `.v-flow/logs/activity.jsonl` (xem "Activity Logging" bên dưới)
89
+
90
+ ## Activity Logging
91
+
92
+ Mọi hoạt động "dùng v-flow" được gom về **một nhật ký cục bộ** tại `.v-flow/logs/`:
93
+ - `activity.jsonl` — mỗi dòng 1 JSON (máy đọc / `jq` / grep)
94
+ - `activity.log` — bản dễ đọc cho người
95
+
96
+ Lệnh CLI tự ghi mỗi lần chạy. **Agent phải chủ động ghi** các mốc của mình bằng `v-flow log` (best-effort — nếu lệnh không có thì bỏ qua, đừng để chặn pipeline):
97
+
98
+ ```bash
99
+ # Bắt đầu một phase
100
+ v-flow log --feature <feature> --phase S.1 --actor ba-agent --event start "Bắt đầu viết spec"
101
+ # Quyết định / mốc quan trọng
102
+ v-flow log --feature <feature> --phase R.0 --actor master-check-agent --event decision "Verdict=PASS_WITH_CONCERNS" --data '{"verdict":"PASS_WITH_CONCERNS","concerns":2}'
103
+ # Kết thúc phase
104
+ v-flow log --feature <feature> --phase B.1 --actor implement-agent --event end "12/12 tasks done"
105
+ ```
106
+
107
+ Ghi tối thiểu ở: **start** và **end** mỗi phase, mỗi **routing decision**, và mỗi **lỗi/blocker**. Xem lại nhanh: `v-flow log --tail 30`. Tắt toàn bộ: đặt `VFLOW_NO_LOG=1`.
108
+
109
+ ### Tự động bắt log qua lifecycle hooks (đa-provider, deterministic)
110
+
111
+ Ngoài cách agent chủ động gọi `v-flow log` (best-effort), có thể cài hook để **mọi tool-use / session** được ghi tự động — chạy được trên Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Antigravity:
112
+
113
+ ```bash
114
+ v-flow hooks install # rải hook vào config từng tool (merge, không clobber)
115
+ v-flow hooks status # xem tool nào đã cài
116
+ v-flow hooks uninstall # gỡ hook của v-flow (giữ hook của bạn)
117
+ ```
118
+
119
+ Mỗi hook gọi `v-flow log --hook <provider>` — đọc payload tool đẩy qua stdin, chuẩn hoá rồi append vào cùng `.v-flow/logs/`. Hook luôn exit 0, không bao giờ chặn agent. Yêu cầu: `v-flow` có trên PATH (IDE GUI không kế thừa PATH → cài bằng `v-flow hooks install --abs`).
120
+
121
+ Safety-net tool-agnostic: `v-flow watch` giám sát `.v-flow/**` và log mọi thay đổi file — bắt được cả tool không có hook lẫn sửa tay.
122
+
123
+ ## Available Slash Commands
124
+
125
+ | Command | Phase | Purpose |
126
+ |---------|-------|---------|
127
+ | `/v.help` | Any | **Help Agent — gợi ý bước tiếp theo dựa trên trạng thái dự án** |
128
+ | `/v.understand` | U.0 | **Understand Agent — Multi-Layer Understanding (`--all`, `--module`, `--check`, `--refresh`)** |
129
+ | `/v.import-ba-docs` | U.0d | **Import BA Docs Agent — Import tài liệu BA từ NotebookLM** |
130
+ | `/v.constitution` | S.0a | Create/update project constitution (interactive) |
131
+ | `/v.constitute` | S.0a | **Constitute Agent — AI scan → tự động draft `constitution.md` v2** |
132
+ | `/v.specify` | S.1 | BA Agent — create spec + init `.flow-state.yaml` + `_session.md` (`--dual` for Dual BA loop) |
133
+ | `/v.ba-critic` | S.1 | **BA Critic Agent — Adversarial spec review 1 round (dùng sau `--dual`)** |
134
+ | `/v.prototype` | S.1.5 | **Prototype Agent — Throwaway prototype để validate ambiguity (`--logic`, `--ui`, `--question`)** |
135
+ | `/v.ba-to-ptyc` | S.1.6 | **BA to PTYC Agent — spec.md → PTYC.docx (Phân tích Yêu cầu chuẩn ISO), optional Doc Export** |
136
+ | `/v.plan` | B.0a | Plan Agent — create technical plan + tasks (`--with-security`, `--with-ux`, `--with-api`) |
137
+ | `/v.test` | B.0b | Test Agent — create test cases from spec |
138
+ | `/v.check` | R.0 | Master Check — cross-validate Spec ↔ Plan ↔ Tests + explicit routing |
139
+ | `/v.implement` | B.1 | Implement Agent — TDD coding, concerns handling (`--yolo` for auto-mode) |
140
+ | `/v.review` | R.1 | Adversarial Code Review — ≥ 3 issues + routing rules |
141
+ | `/v.sync` | Any | **Sync Agent — propagate spec changes to artifacts** |
142
+ | `/v.sprint` | B.1 | Sprint Planning Agent — tạo sprint-status.md |
143
+ | `/v.retrospective` | R.1 | Retrospective Agent — tổng kết sau epic/sprint |
144
+ | `/v.metrics` | M.0 | Collect agent performance metrics |
145
+ | `/v.operations` | O.0 | **Operations Agent — rà soát vận hành định kỳ / phân loại incident → route flow khắc phục** |
146
+ | `/v.status` | Any | **📊 Dashboard — pipeline state, routing decision, concerns** |
147
+ | `/v.quickfix` | S.1→B.1→R.1 | **Quick Fix Flow — bug fix nhỏ, skip full pipeline** |
148
+ | `/v.bugfix` | S.1→B.0→B.1→R.1 | **Bugfix Flow — root cause analysis + 3-behavior model + 3-tier TDD (Kiro-inspired)** |
149
+ | `/v.hotfix` | O.0→B.1→R.1 | **Hotfix Flow — P1/P2 production incident** |
150
+ | `/v.rewind` | Any | **Time Travel: Rewind — rollback spec/pipeline về version cũ** |
151
+ | `/v.fork` | Any | **Time Travel: Fork — branch feature để thử hướng khác** |
152
+
153
+ ## Pipeline Flow
154
+
155
+ ```
156
+ Constitution → Agent Setup → BA Agent [→ BA Critic (opt-in `--dual`)] → [Prototype Agent (opt S.1.5)] → Plan Agent ⧑ Test Agent → Master Check → Implement → Verify → Metrics
157
+ ```
158
+
159
+ **Với Legacy Project**, thêm bước đầu tiên:
160
+ ```
161
+ init → /v.understand --all (context.md) → /v.understand --module (Module Cards) → /v.constitute (constitution.md v2) → ... (giống trên)
162
+ Understand (context.md + Module Cards) → Constitution → ... (giống trên)
163
+ ```
164
+
165
+ **Prebuilt Flows** (skip full pipeline):
166
+ ```
167
+ Quick Fix: S.1 nhanh → B.1 → R.1 ← bug fix nhỏ, đơn giản (<5 files)
168
+ Bugfix: S.1 → B.0(opt) → B.1 → R.1 ← bug cần root cause analysis + regression prevention
169
+ Hotfix: O.0 → B.1 → R.1 → O.0 ← production incident P1/P2
170
+ ```
171
+
172
+ **Nhóm Phase** (U → S → B → R → M → O):
173
+ - **U** Understand: `U.0` — Multi-Layer Understanding (context.md + Module Cards + Graph)
174
+ - **S** Specify: `S.0a` Foundation, `S.0b` Agent Setup (thủ công — cấu hình `agent-config.md`, không có agent riêng), `S.1` Specification, `S.1.5` Prototype (optional)
175
+ - **B** Build: `B.0` Plan+Test (+Optional: Security/UX/API), `B.1` Implement
176
+ - **R** Review: `R.0` Master Check (explicit routing), `R.1` Verify
177
+ - **M** Metrics: `M.0`
178
+ - **O** Operations: `O.0`
179
+
180
+ ## Agent Roles
181
+
182
+ When activated via slash commands, adopt the specific agent persona:
183
+ - **Help Agent**: Navigator — đọc `.flow-state.yaml`, gợi ý bước tiếp theo dựa trên trạng thái pipeline
184
+ - **Understand Agent**: Multi-Layer Scanner — generate context.md (Tầng 1) + Module Cards (Tầng 2), đánh dấu `[⚠️ AI-inferred]`; tự kiểm card bằng CLI: `v-flow validate --module-cards <m>` (lint) + `score-card <m>` (điểm objective) + `dev-quiz <m>` (answer key từ graph)
185
+ - **Import BA Docs Agent**: BA Docs Importer — trích xuất tài liệu BA từ NotebookLM, generate raw materials + AI drafts cho Module Cards
186
+ - **Constitute Agent**: Constitution Drafter — infer từ code, để trống rõ ràng, không lý tưởng hóa
187
+ - **BA Agent**: Business Analyst — focus on WHAT, not HOW; init `.flow-state.yaml` + `_session.md`. Dual BA mode: cập nhật spec sau mỗi round review. Auto-scan ambiguity và gợi ý `/v.prototype`
188
+ - **BA Critic Agent**: Adversarial Spec Critic — fresh context mỗi round, phải tìm issues, không LGTM
189
+ - **Prototype Agent**: Throwaway Builder — tạo LOGIC TUI hoặc UI variants để resolve ambiguity, capture verdict vào `prototype-notes.md`, carry-forward qua `_session.md`
190
+ - **Plan Agent**: Technical Architect — design, don't implement; update `_session.md`
191
+ - **Test Agent**: QA Engineer — comprehensive coverage
192
+ - **Master Check Agent**: Quality Gate — strict, 3-level verdict (PASS/PASS WITH CONCERNS/FAIL), explicit `fail_reason` + `route_decision`
193
+ - **Implement Agent**: Developer — TDD, follow the plan exactly, resolve all concerns [W-xxx]
194
+ - **Bugfix Analyst Agent**: Bug Diagnostician — 3-behavior model (Current/Expected/Unchanged), root cause analysis, 3-tier test plan (Red/Green/Protect). Kiro-inspired surgical fix approach
195
+ - **Review Agent**: Adversarial Reviewer — find ≥3 issues, never "LGTM", verify concerns resolved
196
+ - **Status Agent**: Observer — cross-check `.flow-state.yaml` vs reality, render visual dashboard
197
+ - **Sync Agent**: Synchronizer — propagate spec changes to plan/tasks/tests
198
+ - **Sprint Planning Agent**: Scrum Master — create sprint-status.md and track dependencies
199
+ - **Retrospective Agent**: Evaluator — tổng kết và cập nhật knowledge base sau epic/sprint
200
+ - **Metrics Agent**: Analyst — đo lường performance và đề xuất cải tiến Agent Config
201
+ - **Operations Agent**: SRE — monitor production, detect incidents, tạo báo cáo và trigger pipeline
202
+
203
+ ## New Concepts (LangGraph-inspired)
204
+
205
+ | Concept | File | Purpose |
206
+ |---------|------|---------|
207
+ | **Auto-Inject Context** | `AGENTS.md` / `.cursorrules` | Tự động bơm Tầng 1 (`context.md` + `constitution.md`) cho GitHub Copilot, Antigravity & Cursor đọc trực tiếp |
208
+ | **Multi-Layer Understanding** | `.v-flow/modules/` | Tầng 1: Auto-injected Overview. Tầng 2: Module Cards on-demand. Tầng 3: Code Graph |
209
+ | **Typed State** | `.flow-state.yaml` | Machine-readable pipeline state — phase, artifacts, routing, concerns |
210
+ | **Routing Rules** | Embedded in each workflow | Explicit next-step decision — no guessing |
211
+ | **Working Memory** | `_session.md` | Short-term context: decisions, trace, open questions |
212
+ | **Concerns Carry-forward** | `validation-report.md` → `_session.md` | Concerns from R.0 tracked through B.1 and verified at R.1 |
213
+ | **Prebuilt Flows** | `quickfix`, `bugfix`, `hotfix` | Optimized pipelines for common scenarios (3 tiers: simple → structured → emergency) |
214
+ | **Spec Change Policy** | `constitution.md` §9 | Double-texting: Enqueue/Interrupt/Rollback/Reject based on phase |
215
+ | **Map-Reduce** | `/v.plan --with-*` | Optional agents (Security, UX, API) run in parallel at B.0 |
216
+ | **Thread Isolation** | `/v.sprint` | Multi-feature dashboard with dependency tracking |
217
+ | **Task Annotations** | `tasks.md` | `[ENTRYPOINT]`, `[PARALLEL]`, `[GATE]`, `[CRITICAL]`, `[RISKY]`, `[SPIKE]`, `[CLARIFY]`, `[DEPENDS: T-xxx]` scheduling |
218
+ | **Streaming** | `_session.md` Live Progress | Real-time progress updates during agent execution |
219
+ | **Time Travel** | `/v.rewind`, `/v.fork` | Rollback to previous versions, branch to explore alternatives |
220
+ | **Command Pattern** | `agent-command-template.yaml` | Structured agent output = state_update + routing in one block |
221
+ | **Subgraph Composition** | `module-template.yaml` | Reusable pipeline modules with encapsulated input/output |
222
+
223
+ <!-- gitnexus:start -->
224
+ # GitNexus — Code Intelligence
225
+
226
+ This project is indexed by GitNexus as **ADLC** (14006 symbols, 15182 relationships, 70 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
227
+
228
+ > If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.
229
+
230
+ ## Always Do
231
+
232
+ - **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user.
233
+ - **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows.
234
+ - **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
235
+ - When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
236
+ - When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`.
237
+
238
+ ## Never Do
239
+
240
+ - NEVER edit a function, class, or method without first running `gitnexus_impact` on it.
241
+ - NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
242
+ - NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph.
243
+ - NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope.
244
+
245
+ ## Resources
246
+
247
+ | Resource | Use for |
248
+ |----------|---------|
249
+ | `gitnexus://repo/ADLC/context` | Codebase overview, check index freshness |
250
+ | `gitnexus://repo/ADLC/clusters` | All functional areas |
251
+ | `gitnexus://repo/ADLC/processes` | All execution flows |
252
+ | `gitnexus://repo/ADLC/process/{name}` | Step-by-step execution trace |
253
+
254
+ ## CLI
255
+
256
+ | Task | Read this skill file |
257
+ |------|---------------------|
258
+ | Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` |
259
+ | Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` |
260
+ | Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` |
261
+ | Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` |
262
+ | Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
263
+ | Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
264
+
265
+ <!-- gitnexus:end -->
package/CHANGELOG.md ADDED
@@ -0,0 +1,318 @@
1
+ # Changelog
2
+
3
+ All notable changes to V-Flow will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [1.5.0] — 2026-06-30
11
+
12
+ ### Added — BA → PTYC doc export (`/v.ba-to-ptyc`)
13
+ - **`/v.ba-to-ptyc`** (agent `ba-to-ptyc-agent`, phase **S.1.6**, optional) — sinh tài liệu **Phân tích Yêu cầu (PTYC.docx)** chuẩn ISO từ `spec.md`. Cơ chế **Route B**: đổ dữ liệu vào template `.docx` có sẵn → giữ nguyên 100% format. Tương ứng bước 7a trong BA Skill Pipeline (BABOK v3).
14
+ - Template `templates/ptyc/PTYC.template.docx` (+ `ptyc.meta.example.yaml`); scripts `scripts/ptyc/` (`build_template.py`, `render_ptyc.py`, `render_mermaid.mjs` graceful, `ptyc-data.schema.json`); sample fixture `scripts/ptyc/sample/`.
15
+ - Map spec→PTYC: suy luận C/R/U/D, tách màn hình mức control, rút glossary; sơ đồ mermaid→PNG (placeholder nếu thiếu `mmdc`).
16
+ - Skills copy vào `skills/specify/ba-doc-generator`, `skills/specify/ba-bpmn-doc-gen`.
17
+
18
+ ### Added — Activity logging & multi-provider hooks
19
+ > Ghi lại toàn bộ hoạt động "dùng v-flow" về **một nhật ký cục bộ** `.v-flow/logs/` (`activity.jsonl` cho máy đọc + `activity.log` cho người), gom cả CLI lẫn các tool AI. Best-effort tuyệt đối — log không bao giờ làm vỡ CLI hay chặn agent. Tắt bằng `VFLOW_NO_LOG=1`; đổi đích bằng `VFLOW_LOG_DIR`/`VFLOW_LOG_FILE`.
20
+ - **CLI auto-log** (`cli/lib/activity-log.js`, wired ở `cli/index.js`): mỗi lần chạy `v-flow <lệnh>` ghi 1 record (cmd, args, exit code, duration, cwd, version) + toàn bộ transcript console. Append đồng bộ → sống sót qua `process.exit`/crash. Không tự tạo `.v-flow/` (tránh làm hỏng `isInitialized`).
21
+ - **`v-flow log`** (`cli/commands/log.js`): agent/người ghi event có cấu trúc (`--phase`, `--feature`, `--actor`, `--event`, `--data <json>`); `--tail [n]` xem lại. Protocol cho agent ở `AGENTS.md` (mục "Activity Logging", rule 17) — ghi tại ranh giới phase, routing decision, lỗi/blocker.
22
+ - **Lifecycle hooks đa-provider** (`cli/commands/hooks.js`, `cli/lib/hook-targets.js`): `v-flow hooks install | status | uninstall` rải/gỡ hook logging cho **Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Antigravity** — merge vào config sẵn có, **không clobber**, idempotent. Mỗi hook gọi `v-flow log --hook <provider>`: đọc payload qua stdin, chuẩn hoá đa-schema, append vào cùng log; **luôn exit 0**, không chặn agent (Antigravity nhận `{"allow_tool":true}`). Cờ `--abs` sinh đường dẫn node+CLI tuyệt đối cho IDE GUI không kế thừa PATH.
23
+ - **`v-flow watch`** (`cli/commands/watch.js`): daemon giám sát `.v-flow/**`, log mọi create/modify/delete — safety-net **tool-agnostic** (bắt được cả tool không có hook lẫn sửa tay). Watcher đệ quy thủ công (chạy mọi OS trên Node ≥18), loại trừ `logs`/`templates`/`skills`, tự thêm watcher cho thư mục mới. `--timeout <giây>` để chạy có giới hạn.
24
+
25
+ ### Notes
26
+ - `.v-flow/logs/` được thêm vào `.gitignore` (logs cục bộ); ngược lại các file config hook (`.claude/settings.json`, `.cursor/hooks.json`, …) nên commit (portable nếu `v-flow` trên PATH).
27
+ - 416/416 test xanh (toàn bộ là code mới + wiring additive, không sửa logic sẵn có).
28
+
29
+ ---
30
+
31
+ ## [1.4.0] — 2026-06-16
32
+
33
+ ### Added — Plan/Implement quality patterns (học từ obra/superpowers)
34
+ > So sánh bộ skill `superpower/` (obra/superpowers, vendored) với hệ plan/implement của V-Flow → tiếp thu các pattern *bổ sung thật sự*, giữ nguyên xương sống governance của V-Flow. Schema **không đổi** (`schema_version` vẫn `2.0`); đây là nâng cấp *nội dung skill/agent*, backward-compatible.
35
+ - **Self-Review "mắt mới"** (`skills/plan/architecture-designer/SKILL.md`, `skills/plan/task-breakdown/SKILL.md`): checklist tự chạy ngay sau khi viết plan/tasks — phủ spec/AC **hai chiều** (thiếu *và* thừa/over-engineering), quét placeholder, **nhất quán symbol/naming giữa các section/task** (`clearLayers()` vs `clearFullLayers()` = bug), DAG hợp lệ. Là self-check nội tuyến (KHÔNG subagent, KHÔNG đẩy validator sang semantics — giữ phân vai validator=structural · Master Check=semantic).
36
+ - **Iron Law TDD + bảng đập-ngụy-biện** (`skills/implement/tdd-driver/SKILL.md`): "không code production khi chưa có test FAIL trước; lỡ viết code trước → xóa, làm lại"; 7 dòng phản biện các ngụy biện skip-TDD thường gặp.
37
+ - **Test anti-patterns** (tdd-driver §4): đừng assert lên mock, không method test-only trong production (→ `test-utils/`), mock ở tầng thấp nhất sau khi hiểu deps, mirror đầy đủ cấu trúc API thật.
38
+ - **Spec-fit per-task (đúng & đủ, KHÔNG thừa)** (`agents/implement-agent.md` Bước 2/4 + rule 13; signal mới trong tdd-driver): kiểm **hai chiều** sau mỗi task — không thiếu AC *và* không over-build (thêm field/flag/endpoint/abstraction không ai yêu cầu → gỡ, theo YAGNI). Áp per-task (nhất là `[GATE]`/`[CRITICAL]`) để bắt drift sớm thay vì dồn hết về `/v.review`.
39
+
40
+ ### Fixed
41
+ - **Gold example lệch schema**: `skills/plan/task-breakdown/examples/good/tasks-login-feature.md` thiếu `Done khi (AC-NN)` + block **TDD** (có từ schema 2026-06-02) → bổ sung cho 6 task, khớp lại template + sibling `spike-clarify-tasks.md`.
42
+
43
+ ### Notes
44
+ - **Cố tình KHÔNG tiếp thu** (ghi để tránh "sửa nhầm" sau): substrate *controller-spawn-subagent-mỗi-task* của obra (xung đột SSoT + flow-state + enforcement script + GitNexus); *code-in-plan* (V-Flow giữ plan là thiết kế, không phải code); symbol-consistency giữ ở tầng *self-review*, không đẩy thành rule validator.
45
+ - 402/402 test xanh (chỉ sửa markdown, không đụng JS).
46
+
47
+ ---
48
+
49
+ ## [1.3.0] — 2026-06-02
50
+
51
+ ### Added — Plan/Task/Spec subsystem upgrade (v3)
52
+ - **Deep cross-file validator** (`cli/commands/validate.js`): kiểm tra liên file Spec ↔ Plan ↔ Tasks ↔ Tests theo ID (REQ / AC-NN / T-NNN / TC-xx):
53
+ - Traceability hai chiều REQ-xxx + phủ AC-NN (mọi AC phải có ≥1 task).
54
+ - Dependency-graph integrity: phát hiện chu trình, `[DEPENDS: T-xxx]` trỏ task không tồn tại, `[PARALLEL]`/`[ENTRYPOINT]` không hợp lệ.
55
+ - Per-task completeness: bắt buộc block **TDD (Red→Green)**, **Complexity (S/M/L)**, **Done khi (AC)**, Task Type.
56
+ - **Phân vai rõ**: validator = *structural lint*; Master Check Agent (R.0) = *semantic*; human = *judgment*.
57
+ - **TDD baked into schema**: mỗi task trong `tasks-template.md` có checklist Red→Green — viết test fail trước, code tối thiểu cho pass.
58
+ - **Acceptance-Criteria IDs (AC-NN)**: spec §4 đánh mã AC; plan/tasks/master-check truy vết theo AC.
59
+ - **Technical Decisions table** (plan-template §13): ghi WHY + phương án đã loại + đánh đổi.
60
+ - **Schema versioning** cho `.flow-state.yaml`: `schema_version: "2.0"` + `pipeline_type` (full/quickfix/hotfix → "lite" profile). `v-flow feature create` nay **stamp** cả hai field → feature mới được giữ đúng schema hiện hành (trước đây bị coi là legacy → bỏ qua mọi gate v3).
61
+ - **Templates mới**: `data-model-template.md`, `api-contract-template.md`, `ux-checklist-template.md`, `validation-report-template.md`.
62
+ - **Operations Agent** (`agents/operations-agent.md`): hiện thực hóa role O.0 (trước đây chỉ inline trong `/v.hotfix`) — wiring skill `incident-runbook` + `operations-report-template.md`.
63
+
64
+ ### Fixed
65
+ - **No-Go Zone guard fail-open** (`skills/implement/no-go-zone-guard/scripts/check-nogo-zones.sh`): `head -n -1` (GNU-only) lỗi trên macOS/BSD → guard báo PASS cho file 🔴 Strict. Đổi sang `sed '$d'` + `grep -qF` (an toàn regex).
66
+ - **Template tự-lint sạch**: `plan-template.md` / `tasks-template.md` dùng ID cụ thể (`REQ-U01`…) thay placeholder `REQ-xxx` (regex validator yêu cầu `REQ-[A-Z]\d+`). Validator coverage-matrix chấp nhận heading "Test Matrix" / "Ma trận truy vết".
67
+ - **CI/coverage**: ngưỡng `jest.config.js` đặt sát thực tế (regression floor) để `npm test` không fail giả; README/CHANGELOG bổ sung `/v.prototype`, `/v.bugfix` và cập nhật số lượng agent/command.
68
+
69
+ ---
70
+
71
+ ## [1.2.1] — 2026-05-22
72
+
73
+ ### Fixed
74
+ - **`v-flow init` / `v-flow sync` — Full template sync** (`cli/lib/sync-core.js`):
75
+ - Trước đây chỉ copy `templates/module-card/` vào `.v-flow/templates/module-card/`
76
+ - Nay copy **toàn bộ thư mục `templates/`** vào `.v-flow/templates/` (25 templates + subdirectories)
77
+ - Agents trong project đích có thể đọc tất cả template (spec, plan, tasks, constitution, v.v.) từ `.v-flow/templates/`
78
+ - Guard `isSourceRoot` vẫn được giữ để tránh self-copy khi chạy trên thư mục v-flow
79
+ - **`v-flow upgrade` — Full template upgrade** (`cli/commands/upgrade.js`):
80
+ - Trước đây loop thủ công chỉ xử lý `.md`/`.yaml` ở root, bỏ sót thư mục con (`knowledge/`, `module-card/`)
81
+ - Nay dùng `fs.copy` đệ quy — nhất quán với `sync-core.js`, cover toàn bộ subtree
82
+ - Code giảm từ ~70 dòng xuống còn ~30 dòng
83
+ - **`v-flow sync --apply` — Full template sync** (`cli/commands/sync.js`):
84
+ - `sync.js` có block riêng hardcode chỉ copy `module-card/`, không hưởng fix từ `sync-core.js`
85
+ - Nay copy toàn bộ `templates/` đệ quy vào `.v-flow/templates/`
86
+ - Section header đổi từ `── Module Card Templates ──` → `── Templates ──`
87
+ - **`v-flow init` — Log xác nhận** (`cli/commands/init.js`):
88
+ - Thêm dòng `✅ Templates: .v-flow/templates/ (all templates synced)` trong output
89
+ - **`v-flow doctor` — Templates health check** (`cli/commands/doctor.js`):
90
+ - Trước đây chỉ check `module-card/` (8 files)
91
+ - Nay check toàn bộ `.v-flow/templates/` — hiện số file, verify `module-card/` & `knowledge/` subdirs
92
+ - **`v-flow sync` — Dry-run template stats** (`cli/commands/sync.js`):
93
+ - Template changes không được tính vào `stats.added/synced` → summary thiếu số liệu
94
+ - Nay đếm chính xác new vs existing files, cộng vào stats đúng cách
95
+ - Dry-run hiện thị `(would sync)` thay vì `→ .v-flow/templates/`
96
+ - **`v-flow upgrade` — Template stats chính xác** (`cli/commands/upgrade.js`):
97
+ - `stats.updated` tính sai (= `beforeCount` thay vì số file thực sự thay đổi)
98
+ - Nay dùng `walk()` so sánh từng file để tính đúng added vs updated
99
+ - Output chi tiết hơn: `✨ N new`, `🔄 N updated`, `⏭️ up-to-date`
100
+
101
+ ---
102
+
103
+ ## [1.2.0] — 2026-04-28
104
+
105
+ ### Added
106
+ - **`cli/lib/logger.js`** — Structured logging module with verbosity levels (SILENT/NORMAL/VERBOSE/DEBUG):
107
+ - JSON output mode for machine-readable output (`--json` support)
108
+ - Elapsed time tracking and structured data buffering
109
+ - Test suite: `tests/lib/logger.test.js`
110
+ - **Integration test suite** (`tests/integration/integration.test.js`):
111
+ - End-to-end CLI workflow tests: init→check, feature lifecycle, doctor diagnostics
112
+ - Plugin system integration tests, i18n tests, CLI basics (--version, --help)
113
+ - **Plugin command tests** (`tests/commands/plugin.test.js`):
114
+ - Tests for scaffolding, discovery, validation, loading, and installation of all 4 plugin types
115
+ - **Plugin lifecycle hooks** — `executeLifecycleHook()` and `uninstallPlugin()` in plugins.js:
116
+ - `onInstall`/`onUninstall` hooks via `plugin.json` manifest
117
+ - Script-based hooks (`.js` files) or message-based hooks
118
+ - **YAML frontmatter** on all 16 agent definitions:
119
+ - `output_schema` — machine-enforceable output format for each agent
120
+ - `memory_logging` — standardized session logging configuration
121
+ - Agent metadata: name, role, phase, triggers, output
122
+ - **Learning module 08** — Plugin Development & Extension Patterns:
123
+ - Plugin creation, manifest configuration, composition patterns
124
+ - Config hooks, anti-patterns guide, 3 hands-on exercises
125
+ - **`v-flow.en.md`** — Full English translation of the V-Flow specification v4.2:
126
+ - Complete 1:1 translation of all 8 sections (~750 lines)
127
+ - Cross-reference links between Vietnamese and English versions
128
+ - Enables international adoption of V-Flow methodology
129
+ - **Constitution Lint** (`cli/lib/constitution-lint.js`):
130
+ - Parser extracts `[LINT:xxx]` tags from constitution.md
131
+ - Rule engine checks: naming, import, structure, error, test, security, doc (10 categories)
132
+ - 3 severity levels: warning, error, critical (blocks CI)
133
+ - Backward-compatible: constitutions without tags return "0 rules, skip"
134
+ - Integrated into `validate` command with `--constitution` flag
135
+ - Test suite: 32 tests (`tests/lib/constitution-lint.test.js`)
136
+ - **Learning module 09** — Constitution Lint guide:
137
+ - Tag format, categories, CI integration, best practices, 3 exercises
138
+
139
+ ### Changed
140
+ - **i18n adoption — 9/9 commands** (was 0/9):
141
+ - All commands now use `createT()` for user-facing strings
142
+ - Translation keys expanded: 63 → 200+ (vi + en)
143
+ - Commands integrated: init, check, status, doctor, sync, upgrade, validate, plugin, feature
144
+ - **ESLint enhanced** — 7 new code quality rules:
145
+ - `no-lonely-if`, `prefer-template`, `object-shorthand`, `no-else-return`
146
+ - `consistent-return`, `no-nested-ternary`, `require-await`
147
+ - Test-specific overrides for flexibility
148
+ - **Coverage thresholds raised**:
149
+ - lib/: 60/80/60/60 → 65/85/70/70 (branches/functions/lines/statements)
150
+ - commands/: 30/40/30/30 → 40/50/40/40
151
+
152
+ ### Added
153
+ - **Skills Ecosystem — 5 new `config.json` files** (12/17 → 17/17 config hooks):
154
+ - `_shared/constitution-reader/config.json` — Section mapping per phase, version checking, extraction depth
155
+ - `_shared/context-reader/config.json` — Staleness thresholds, No-Go Zone enforcement, cross-reference
156
+ - `_shared/ears-notation/config.json` — EARS strict mode, ambiguous word detection, NFR enforcement
157
+ - `understand/codebase-scanner/config.json` — Scan scope, file size limits, framework detection
158
+ - `understand/ba-docs-scanner/config.json` — Source types, auto glossary, conflict resolution
159
+ - **Skills Ecosystem — 3 new `examples/` directories** (12/17 → 17/17 examples):
160
+ - `implement/constitution-enforcer/examples/` — Good (compliance report) + Bad (vague report)
161
+ - `metrics/metrics-collector/examples/` — Good (full metrics with trends) + Bad (incomplete)
162
+ - `operations/incident-runbook/examples/` — Good (P1 hotfix response) + Bad (vague incident)
163
+ - **Workflow System — `decision-matrix.md`** — New workflow for selecting the right workflow:
164
+ - Decision tree diagram (30-second selection)
165
+ - Comprehensive comparison table (9 criteria × 6 workflows)
166
+ - Prerequisite checks (universal + legacy-specific)
167
+ - Error recovery paths (5 common scenarios with step-by-step resolution)
168
+ - Workflow composition patterns (5 patterns: sequential, escalation, parallel, incident→feature, multi-feature)
169
+ - Cross-workflow navigation map
170
+ - Anti-patterns guide
171
+
172
+ ### Changed
173
+ - **All 10 workflows** enhanced with standardized sections:
174
+ - ⚠️ Error Recovery table — 5-6 scenarios per workflow with step-by-step recovery
175
+ - 🗺️ Cross-Workflow Navigation — 5-6 navigation links per workflow
176
+ - Enhanced: `full-flow.md`, `quick-feature.md`, `ba-spec.md`, `bug-fix.md`, `hotfix.md`, `code-review.md`, `testing.md`, `sprint-planning.md`, `spec-change.md`, `legacy-onboard.md`
177
+
178
+
179
+ ## [1.1.0] — 2026-04-27
180
+
181
+ ### Added
182
+ - **`cli/lib/yaml-parser.js`** — Shared YAML parser using `js-yaml` with regex fallback
183
+ - Replaces fragile regex-based `.flow-state.yaml` parsing in status.js, doctor.js, feature.js
184
+ - `parseFlowState()`, `normalizeFlowState()`, `readFlowState()` exported for all commands
185
+ - Comprehensive test suite (`tests/lib/yaml-parser.test.js`)
186
+ - **3 new Skills** (14 → 17 total), completing the blueprint:
187
+ - `implement/constitution-enforcer/` — Validates code against constitution.md rules (B.1, R.1)
188
+ - `metrics/metrics-collector/` — Structured agent performance metrics collection (M.0)
189
+ - `operations/incident-runbook/` — Production incident response procedure (O.0)
190
+ - **`.npmignore`** — Prevents publishing test/docs/coverage/examples to npm
191
+ - **`.eslintrc.json`** — ESLint configuration (eslint:recommended + custom rules)
192
+ - **`.github/dependabot.yml`** — Automated dependency updates (weekly npm, monthly Actions)
193
+ - **Example 005** — Dual BA Review flow (spec.md, spec-review-log.md, .flow-state.yaml)
194
+ - **`--verbose` global flag** — All commands can access via `process.env.VFLOW_VERBOSE`
195
+ - **`--lang` global flag** — Integrates i18n system via preAction hook in `cli/index.js`
196
+ - **New command tests** — doctor.test.js, init.test.js, feature.test.js, status-upgrade.test.js
197
+ - **`package.json` improvements**:
198
+ - `"engines": { "node": ">=18" }` matching CI matrix
199
+ - `"files"` whitelist for npm distribution
200
+ - `"prepublishOnly": "npm run lint && npm test"` for publish validation
201
+ - `js-yaml` as direct dependency
202
+ - `eslint` as dev dependency
203
+ - `"lint"` and `"lint:fix"` scripts
204
+
205
+ ### Changed
206
+ - **All 9 CLI commands** now use `withErrorHandler` for unified error handling:
207
+ - Migrated: init.js, check.js, status.js, doctor.js, sync.js, upgrade.js, feature.js (create + list)
208
+ - Previously only validate.js and plugin.js used it
209
+ - **status.js** refactored to use shared `yaml-parser.js` (removed 60 lines of regex parsing)
210
+ - **doctor.js** refactored to use shared `yaml-parser.js` and import `formatBytes` from `cli-error.js`
211
+ - **feature.js** refactored to use shared `yaml-parser.js` for flow state reading
212
+ - **check.js** now imports `formatBytes` from `cli-error.js` instead of local `formatFileSize()`
213
+ - **v-flow.md** updated to v4.2 — added Section 8 (CLI Tool, Plugin System, i18n, Sync), updated directory structure with `plugins/` and `templates/` folders
214
+ - **CI/CD** enhanced:
215
+ - Added lint step (ESLint) before test execution
216
+ - Coverage regression check with report
217
+ - npm auto-publish on tag push (requires NPM_TOKEN secret)
218
+ - **jest.config.js** — Added coverage threshold for `commands/` (30% floor as baseline)
219
+ - **learn/README.md** — Added hands-on exercises column, linked all 5 examples
220
+ - **i18n** status clarified — marked as "available, opt-in" with integration guide in header
221
+
222
+ ### Fixed
223
+ - **Circular dependency** in `sync-core.js` — no longer requires `templates.js` at runtime
224
+ - Changed to inline `path.join(projectRoot, '.v-flow')` instead of `getVFlowDir()`
225
+ - **Duplicate `formatBytes()`** removed from `doctor.js` and `check.js` (was `formatFileSize()`)
226
+
227
+ ### Removed
228
+ - `docs/temp_docx/` — Temporary artifacts removed from repository
229
+
230
+ ### Previous Changes
231
+
232
+
233
+ - `CHANGELOG.md` — tracking all notable changes
234
+ - Test suite with Jest for CLI commands and core libraries (135 tests, 8 suites)
235
+ - Comprehensive `.gitignore` covering OS files, editors, env, build outputs, coverage
236
+ - **5 new Skills** (9 → 14 total) following standardized blueprint:
237
+ - `specify/ba-critic/` — Adversarial spec review with 5 critique dimensions (Ambiguity, Completeness, Consistency, Feasibility, Testability)
238
+ - `plan/architecture-designer/` — Architecture design from spec with constraint extraction & No-Go Zone validation
239
+ - `plan/task-breakdown/` — Task decomposition with annotation system ([ENTRYPOINT], [GATE], [PARALLEL], [RISKY], [DEPENDS])
240
+ - `test/test-case-generator/` — Test case generation with REQ-type-to-strategy mapping & 7-category edge cases
241
+ - `check/cross-validator/` — 3-phase validation engine (Traceability, Consistency, Quality) with concern carry-forward
242
+ - **2 new Examples**: 003-quickfix-bug, 004-hotfix-p1
243
+ - `roadmap/roadmap.md` — Product development roadmap v1.1 → v2.0
244
+ - **`v-flow validate`** command — Validates artifact structure (EARS, REQ-xxx, traceability, annotations)
245
+ - **CLI Architecture Refactor** (Phase 3 — Quality):
246
+ - `cli/lib/scanner.js` — Extracted 400+ lines from monolithic `templates.js`
247
+ - `cli/lib/cli-error.js` — Unified error handling: typed errors, `withErrorHandler`, guard utilities
248
+ - `templates.js` reduced from 600 → 250 lines via delegation
249
+ - **Extended Scanner** — New language/framework support:
250
+ - Dart/Flutter (pubspec.yaml reader, Riverpod/BLoC/Provider/GetX detection)
251
+ - Rust (Cargo.toml reader, Actix/Axum/Rocket/Tokio detection)
252
+ - Go (go.mod reader, Gin/Echo/Fiber detection)
253
+ - Docker, .NET (ASP.NET Core, Entity Framework), Bun, Poetry, Gradle detection
254
+ - 50+ framework patterns (was ~25), 16 package managers (was 7)
255
+ - **Plugin/Extension Architecture** (Phase 4 — Scale):
256
+ - `cli/lib/plugins.js` — Plugin discovery, validation, loading, scaffolding, installation
257
+ - `v-flow plugin` command — 4 subcommands: `list`, `create`, `install`, `validate`
258
+ - Plugin manifest format (`plugin.json`) with 4 types: agent, workflow, skill, composite
259
+ - Auto-install to all 3 targets (Antigravity, Copilot, Cursor)
260
+ - **i18n System** (`cli/lib/i18n.js`):
261
+ - Vietnamese (default) and English translations
262
+ - Language detection: `--lang` flag, `VFLOW_LANG` env, system locale
263
+ - Template variable interpolation (`{key}` syntax)
264
+ - **GitHub Actions CI/CD** (`.github/workflows/ci.yml`):
265
+ - Test matrix (Node 18/20/22)
266
+ - Artifact validation via `v-flow doctor`
267
+ - Automatic GitHub Release from git tags with changelog extraction
268
+ - **Bilingual README** — English section + Vietnamese section in single README.md
269
+ - **Knowledge Base Templates**:
270
+ - `adr-template.md` — Architecture Decision Record with V-Flow compliance checks
271
+ - `golden-tests-readme.md` — Golden test guide with file conventions and CI integration
272
+ - `api-contract-template.md` — API contract with data models, SLA, versioning policy
273
+
274
+ ### Fixed
275
+ - `v-flow upgrade` command now properly syncs agents & commands via `runSync()` instead of printing a manual hint
276
+ - `.gitignore` missing common patterns (`.DS_Store`, `.env`, `coverage/`, etc.)
277
+ - Deprecated scripts moved to `scripts/_deprecated/` with deprecation notice
278
+
279
+ ---
280
+
281
+ ## [1.0.0] — 2026-04-23
282
+
283
+ ### Added
284
+ - **Core Process**: V-Flow v4.1 specification (`v-flow.md`)
285
+ - 6 phase groups: U (Understand) → S (Specify) → B (Build) → R (Review) → M (Metrics) → O (Operations)
286
+ - 16 specialized AI agents with explicit routing and state management
287
+ - 3-level Master Check verdict: PASS / PASS WITH CONCERNS / FAIL
288
+ - Adversarial Code Review requiring ≥3 issues
289
+ - Dual BA spec critique loop (opt-in `--dual`)
290
+ - Time Travel: `/v.rewind` and `/v.fork`
291
+ - Typed State via `.flow-state.yaml`
292
+
293
+ - **CLI Tool** (`v-flow-cli` v1.0.0)
294
+ - `v-flow init` — initialize `.v-flow/` with auto-scan codebase
295
+ - `v-flow check` — quick setup verification
296
+ - `v-flow status` — pipeline progress dashboard with visual bars
297
+ - `v-flow feature create` — scaffold feature directories
298
+ - `v-flow sync` — hash-based sync to 3 AI agent targets
299
+ - `v-flow doctor` — deep health check with fix capability
300
+ - `v-flow upgrade` — template and agent upgrade
301
+
302
+ - **21 Slash Commands**: `/v.help`, `/v.understand`, `/v.specify`, `/v.plan`, `/v.test`, `/v.check`, `/v.implement`, `/v.review`, `/v.sync`, `/v.sprint`, `/v.metrics`, `/v.status`, `/v.quickfix`, `/v.hotfix`, `/v.rewind`, `/v.fork`, `/v.constitute`, `/v.constitution`, `/v.ba-critic`, `/v.retrospective`, `/v.import-ba-docs`
303
+
304
+ - **16 Agent Definitions**: BA Agent, BA Critic, Constitute, Help, Implement, Import BA Docs, Master Check, Metrics, Plan, Retrospective, Review, Sprint, Status, Sync, Test, Understand
305
+
306
+ - **10 Workflows**: Full Flow, Quick Feature, Bug Fix, Hotfix, BA Spec (Dual), Testing, Code Review, Spec Change, Sprint Planning, Legacy Onboard
307
+
308
+ - **23 Templates**: Constitution, context, spec, plan, tasks, test-cases, validation-report, flow-state, session, security-review, agent-config, agent-command, module, metrics, operations-report, decision-log, code-review-report, sprint-status, spec-review-log, retrospective-report + 9 module-card templates
309
+
310
+ - **9 Skills** (5 groups): `_shared/` (constitution-reader, context-reader, ears-notation), `implement/` (no-go-zone-guard, tdd-driver), `review/` (adversarial-reviewer), `specify/` (ears-writer), `understand/` (codebase-scanner, ba-docs-scanner)
311
+
312
+ - **3-target AI Agent Sync**: Antigravity (`.agents/`), GitHub Copilot (`.github/`), Cursor (`.cursor/`)
313
+
314
+ - **2 Examples**: 001-user-login (Greenfield Golden), 002-legacy-crud (Legacy Refactor)
315
+
316
+ - **7-lesson Learning Path**: Introduction → Core Concepts → Agent Roles → Standard Pipeline → Advanced Workflows → Critical Rules → Legacy Implementation
317
+
318
+ - **Documentation**: Best Practices, EARS Notation Guide, Agent Setup Guide, Agent Metrics Guide, Model Selection Guide, Operations Agent Guide, Skills Blueprint, Spec-to-Task Automation
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 viettelcontruction jsc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.