@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
@@ -0,0 +1,84 @@
1
+ ---
2
+ description: "Thiết lập Constitution — bộ nguyên tắc nền tảng cho dự án (Interactive mode)"
3
+ phase: "S.0a"
4
+ note: "Interactive mode — hỏi user từng bước. Xem /v.constitute cho AI-draft mode."
5
+ ---
6
+
7
+ # /v.constitution
8
+
9
+ Thiết lập hoặc cập nhật **Constitution** — tài liệu thiết lập các nguyên tắc BẤT DI BẤT DỊCH cho dự án. Mọi Agent và thành viên đều phải tuân thủ.
10
+
11
+ ## Điều kiện tiên quyết
12
+ - `.v-flow/` phải tồn tại (đã chạy `v-flow init`)
13
+ - User phải sẵn sàng trả lời câu hỏi về tech stack, coding standards, etc.
14
+
15
+ ## Hướng dẫn
16
+
17
+ Bạn là **Constitution Architect** trong quy trình V Flow. Nhiệm vụ của bạn:
18
+
19
+ 1. **Thu thập thông tin** từ user về dự án:
20
+ - Tên dự án, tech stack, architecture pattern
21
+ - Coding standards, naming conventions
22
+ - UI/UX design system, typography, color palette
23
+ - API design, security requirements
24
+ - DevOps practices, CI/CD pipeline
25
+ - AI agent preferences (model, language)
26
+
27
+ 2. **Tạo file `constitution.md`** tại `.v-flow/constitution.md` theo cấu trúc sau:
28
+ - **Nguyên tắc Kiến trúc**: Architecture pattern, state management, module structure
29
+ - **Quy chuẩn Code**: Naming, testing, linting, documentation
30
+ - **Quy chuẩn UI/UX**: Design system, spacing, typography, colors
31
+ - **Quy chuẩn API & Backend**: API design, error handling, security
32
+ - **Quy chuẩn DevOps**: Version control, CI/CD, environments
33
+ - **AI Agent Configuration**: Preferred models, output language, privacy
34
+ - **AI Compliance & Model Risk**: Approved models, data handling, audit trail
35
+
36
+ 3. **Quy tắc**:
37
+ - Hỏi user nếu thiếu thông tin quan trọng
38
+ - Điền giá trị mặc định hợp lý cho các mục user chưa trả lời
39
+ - Đánh dấu `[x]` cho mục đã điền, `[ ]` cho mục cần bổ sung
40
+ - Constitution phải cụ thể, không chung chung
41
+
42
+ ## Input cần thiết
43
+ - Yêu cầu tổ chức, quy chuẩn công ty
44
+ - Tech stack dự định sử dụng
45
+ - Thông tin dự án (tên, phạm vi, team size)
46
+
47
+ ## Output
48
+ - `.v-flow/constitution.md`
49
+
50
+ ---
51
+
52
+ ## 🔀 Routing — Sau Constitution
53
+
54
+ ```
55
+ Constitution tạo xong
56
+ → Tech Lead review và hoàn thiện
57
+ → Sau đó: /v.constitute (AI nâng cấp lên v2) hoặc /v.specify
58
+ ```
59
+
60
+ ## Cập nhật State & Session
61
+
62
+ **Cập nhật `.flow-state.yaml`**:
63
+ ```yaml
64
+ current_phase: "S.0a"
65
+ phase_status: "done"
66
+ ```
67
+
68
+ **Append vào `_session.md`**:
69
+ ```markdown
70
+ ### [S.0a] Constitution (Interactive) — [YYYY-MM-DD]
71
+ - **Mode**: Interactive
72
+ - **Output**: `constitution.md` v1
73
+ - **Sections filled**: [N]/7
74
+ - **Routing**: → Tech Lead review → /v.specify
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Ví dụ
80
+
81
+ ```
82
+ /v.constitution Dự án mobile app Flutter, Clean Architecture,
83
+ sử dụng Riverpod cho state management, REST API, Material Design 3
84
+ ```
@@ -0,0 +1,127 @@
1
+ ---
2
+ description: "Fork — Branch feature để thử hướng khác (Time Travel)"
3
+ phase: "Any"
4
+ ---
5
+
6
+ # /v.fork
7
+
8
+ Tạo một **bản sao (branch)** của feature để thử hướng spec/plan/architecture khác mà không ảnh hưởng bản gốc.
9
+
10
+ > Lấy cảm hứng từ LangGraph Time Travel: **Fork** — branch từ checkpoint cũ để explore alternative paths.
11
+
12
+ ## Điều kiện tiên quyết
13
+ - Feature gốc phải tồn tại với `.flow-state.yaml`
14
+ - Tối đa 2 forks per feature
15
+ - Phải có lý do rõ ràng (không "thử cho vui")
16
+
17
+ ## Khi nào dùng
18
+
19
+ - Muốn so sánh 2 architecture approaches trước khi quyết định
20
+ - Spec có 2 hướng giải quyết — cần prototype cả hai để chọn
21
+ - Muốn thử risky approach mà không ảnh hưởng feature chính
22
+ - Team debate về solution → fork ra để mỗi approach có proof-of-concept
23
+
24
+ ## Quy trình
25
+
26
+ ### Bước 1: Tạo Fork
27
+
28
+ ```
29
+ /v.fork [feature-id] --as [new-name]
30
+ /v.fork 001-login --as 001-login-graphql ← thử GraphQL thay vì REST
31
+ ```
32
+
33
+ ### Bước 2: Sao chép & Diverge
34
+
35
+ ```
36
+ 1. Copy toàn bộ feature folder:
37
+ .v-flow/features/001-login/
38
+ → .v-flow/features/001-login-graphql/
39
+
40
+ 2. Cập nhật .flow-state.yaml trong bản fork:
41
+ feature_name: "001-login-graphql"
42
+ forked_from: "001-login"
43
+ forked_at_phase: "B.0"
44
+ forked_at_spec: "v1.2"
45
+ fork_reason: "Thử GraphQL thay vì REST — so với original REST approach"
46
+
47
+ 3. Cập nhật _session.md trong bản fork:
48
+ ### [FORK] — [YYYY-MM-DD]
49
+ - **Forked from**: 001-login (phase B.0, spec v1.2)
50
+ - **Reason**: Thử GraphQL approach
51
+ - **Compare with**: 001-login (REST approach)
52
+
53
+ 4. Cập nhật _session.md trong bản GỐC:
54
+ ### [FORK CREATED] — [YYYY-MM-DD]
55
+ - **Fork**: 001-login-graphql
56
+ - **Purpose**: So sánh GraphQL vs REST
57
+ ```
58
+
59
+ ### Bước 3: Develop Independently
60
+
61
+ Mỗi fork được develop độc lập:
62
+ - Chạy `/v.plan` riêng
63
+ - Chạy `/v.implement` riêng
64
+ - Mỗi fork có `.flow-state.yaml` riêng
65
+
66
+ ### Bước 4: Compare & Decide
67
+
68
+ ```
69
+ /v.status 001-login 001-login-graphql --compare
70
+
71
+ ## 📊 Fork Comparison
72
+
73
+ | Metric | 001-login (REST) | 001-login-graphql |
74
+ |--------|-----------------|-------------------|
75
+ | Phase | B.1 (70% tasks) | B.1 (40% tasks) |
76
+ | Tasks | 10 | 14 |
77
+ | Complexity | Medium | High |
78
+ | Test coverage | 85% | 60% |
79
+ | Performance | ✅ Good | ⚠️ N+1 risk |
80
+ | Spec coverage | 10/10 REQ | 10/10 REQ |
81
+
82
+ → Recommendation: Tiếp tục với REST approach (simpler, better test coverage)
83
+ ```
84
+
85
+ ### Bước 5: Merge hoặc Discard
86
+
87
+ ```
88
+ /v.fork --keep 001-login ← giữ bản gốc, discard fork
89
+ /v.fork --keep 001-login-graphql ← giữ fork, archive bản gốc
90
+ /v.fork --merge 001-login 001-login-graphql ← merge ideas từ cả hai
91
+ ```
92
+
93
+ ## Quy tắc
94
+
95
+ - **Tối đa 2 forks per feature** — quá nhiều = spec chưa rõ ràng
96
+ - **Mỗi fork phải có reason rõ ràng** — không fork vì "thử cho vui"
97
+ - **Compare trước khi decide** — sử dụng metrics, không sử dụng gut feeling
98
+ - **Archive fork không dùng** — lưu vào `_archive/` thay vì xóa, để tham khảo sau
99
+
100
+ ---
101
+
102
+ ## State Schema mới
103
+
104
+ ```yaml
105
+ # Thêm vào .flow-state.yaml
106
+ fork_info:
107
+ is_fork: false # true nếu đây là bản fork
108
+ forked_from: null # feature gốc (nếu is_fork = true)
109
+ forked_at_phase: null
110
+ forked_at_spec: null
111
+ fork_reason: null
112
+ active_forks: # danh sách forks đang active (nếu đây là bản gốc)
113
+ # - name: "001-login-graphql"
114
+ # reason: "Thử GraphQL approach"
115
+ # current_phase: "B.1"
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Ví dụ
121
+
122
+ ```
123
+ /v.fork 001-login --as 001-login-graphql --reason "So sánh GraphQL vs REST"
124
+ /v.fork 002-dashboard --as 002-dashboard-ssr --reason "Thử server-side rendering"
125
+ /v.status 001-login 001-login-graphql --compare
126
+ /v.fork --keep 001-login
127
+ ```
@@ -0,0 +1,73 @@
1
+ ---
2
+ description: "Help Agent — Hướng dẫn bước tiếp theo dựa trên trạng thái dự án hiện tại"
3
+ phase: "Any"
4
+ agent: "help-agent"
5
+ ---
6
+
7
+ # /v.help
8
+
9
+ > Orchestration wrapper cho **Help Agent**. Đọc `agents/help-agent.md` để thực hiện core logic.
10
+
11
+ ## Điều kiện tiên quyết
12
+ - Không có điều kiện đặc biệt — lệnh này luôn chạy được
13
+
14
+ ## Execution
15
+ 1. Đọc agent definition: `agents/help-agent.md`
16
+ 2. Thực hiện quy trình: quét trạng thái → đề xuất bước tiếp theo
17
+
18
+ ## Options
19
+
20
+ ### (không có argument) — Trạng thái tổng quan
21
+ Quét toàn bộ dự án, hiển thị foundation status + tất cả features.
22
+
23
+ ### feature [name] — Trạng thái 1 feature
24
+ ```
25
+ /v.help feature 002-dashboard
26
+ ```
27
+ Chỉ quét và đề xuất cho feature cụ thể.
28
+
29
+ ### [câu hỏi tự do] — Hỏi kèm context
30
+ ```
31
+ /v.help Tôi vừa sửa spec, bước tiếp theo là gì?
32
+ ```
33
+ Help Agent phân tích câu hỏi kèm trạng thái hiện tại.
34
+
35
+ ---
36
+
37
+ ## 🔀 Routing Rules (cho Help Agent tham khảo)
38
+
39
+ | Tình huống | Gợi ý |
40
+ |-----------|-------|
41
+ | Chưa init V Flow | `v-flow init` |
42
+ | Chưa có `context.md` (dự án cũ) | `/v.understand --all` |
43
+ | Có `context.md` chưa có module cards | `/v.understand --module {tên}` |
44
+ | BA có tài liệu trên NotebookLM | `/v.import-ba-docs --notebook <id>` |
45
+ | Chưa có `constitution.md` | `v-flow init` → `/v.constitute` |
46
+ | Có `constitution.md` v1 (template trống) | `/v.constitute` |
47
+ | Chưa có feature nào | `v-flow feature create <name>` |
48
+ | Spec chưa viết | `/v.specify` |
49
+ | Spec = Draft | ⏳ Human review & approve |
50
+ | Spec approved, có ambiguity trong spec | `/v.prototype` (optional S.1.5) |
51
+ | Spec approved (sau prototype hoặc không có ambiguity) | `/v.plan` + `/v.test` (song song) |
52
+ | Spec approved, cần bàn giao tài liệu PTYC (Phân tích Yêu cầu) | `/v.ba-to-ptyc` (optional, Doc Export S.1.6) |
53
+ | S.1.5 — prototype VALIDATED | `/v.plan` + `/v.test` |
54
+ | S.1.5 — prototype REJECTED | `/v.specify` (sửa spec) |
55
+ | S.1.5 — prototype INCONCLUSIVE | Chờ stakeholder input |
56
+ | Artifact out-of-sync (❌ trong Status block) | `/v.sync` TRƯỚC |
57
+ | Validation = FAIL | Đọc `fail_reason` → route tương ứng |
58
+ | Validation = PASS/CONCERNS | `/v.implement` |
59
+ | Multi-feature, cần sprint | `/v.sprint` |
60
+ | Tất cả tasks `[x]` | `/v.review` |
61
+ | Review = CHANGES_REQUIRED | Fix → `/v.review` lại |
62
+ | Review = APPROVED | 🚀 Deploy → `/v.retrospective` → `/v.metrics` |
63
+
64
+ ---
65
+
66
+ ## Ví dụ
67
+
68
+ ```
69
+ /v.help
70
+ /v.help feature 002-dashboard
71
+ /v.help Tôi vừa sửa spec, bước tiếp theo là gì?
72
+ /v.help Dự án mới, chưa biết bắt đầu từ đâu
73
+ ```
@@ -0,0 +1,200 @@
1
+ ---
2
+ description: "Hotfix Flow — O.0 → B.1 → R.1. Dành cho Production Incident P1/P2, skip spec hoàn toàn"
3
+ phase: "O.0 → B.1 → R.1"
4
+ agents: ["operations-agent", "implement-agent", "review-agent"]
5
+ ---
6
+
7
+ # /v.hotfix
8
+
9
+ Chạy **Hotfix Flow** — pipeline khẩn cấp cho **Production Incident P1/P2**, ưu tiên tốc độ khôi phục, thực hiện phân tích spec sau.
10
+
11
+ > 🔴 **Chỉ dùng khi**:
12
+ > - Production đang down hoặc có vấn đề nghiêm trọng đang xảy ra
13
+ > - Incident severity = P1 (Critical, immediate) hoặc P2 (High)
14
+ > - Cần deploy fix trong vòng 1-2 giờ
15
+
16
+ > ❌ **Không dùng cho**:
17
+ > - Bug không ảnh hưởng production → `/v.quickfix`
18
+ > - Feature mới hoặc improvement → full pipeline
19
+ > - P3/P4 incidents → `/v.quickfix`
20
+
21
+ ---
22
+
23
+ ## Phase 0: Incident Assessment (< 5 phút)
24
+
25
+ Bạn là **Operations Agent** (xem `agents/operations-agent.md`) — xác định nhanh root cause và scope.
26
+
27
+ ### Output: Incident Summary
28
+
29
+ ```markdown
30
+ ## Incident — [INC-ID]
31
+
32
+ **Severity**: P1 | P2
33
+ **Phát hiện**: [YYYY-MM-DD HH:MM]
34
+ **Symptom**: [Mô tả biểu hiện — logs, errors, user reports]
35
+ **Bị ảnh hưởng**: [Service/feature nào bị ảnh hưởng]
36
+ **Root Cause (hypothesis)**: [Nguyên nhân sơ bộ]
37
+
38
+ ## Fix Plan (sơ bộ)
39
+ - Files cần thay đổi: [list]
40
+ - Expected fix: [mô tả]
41
+ - Rollback plan: [nếu fix không work]
42
+
43
+ ## No-Go Check
44
+ - [ ] Fix không đụng vào No-Go Zones ✅
45
+
46
+ ## Routing
47
+ → Proceed to Hotfix Implement
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Phase 1: Hotfix Implement
53
+
54
+ Bạn là **Implement Agent** — implement nhanh, focused, có safety net.
55
+
56
+ ### Quy trình (ưu tiên speed + safety)
57
+
58
+ 1. **Đọc Incident Summary** — hiểu root cause
59
+ 2. **Kiểm tra context.md** — No-Go Zones (bắt buộc, dù khẩn)
60
+ 3. **Implement minimal fix** — chỉ fix đúng vấn đề, không refactor
61
+ 4. **Viết smoke test** — test nhanh verify fix hoạt động
62
+ 5. **Chuẩn bị rollback** — ghi rõ cách rollback nếu cần
63
+
64
+ ### Nguyên tắc Hotfix
65
+
66
+ ```
67
+ ✅ Minimal change — nhỏ nhất có thể để fix vấn đề
68
+ ✅ Có rollback plan — phải biết cách undo nếu fail
69
+ ✅ Smoke test — ít nhất 1 test verify fix
70
+ ❌ Không refactor — không "tranh thủ" clean code
71
+ ❌ Không thêm feature — chỉ fix
72
+ ❌ Không đụng No-Go Zones — dù khẩn cũng không
73
+ ```
74
+
75
+ ### Routing sau implement
76
+
77
+ ```
78
+ Fix sẵn sàng → Phase 2 (Emergency Review)
79
+ Fix không đủ → Escalate, cần thêm người hỗ trợ
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Phase 2: Emergency Review (< 15 phút)
85
+
86
+ Bạn là **Review Agent** — review nhanh nhưng đảm bảo safety.
87
+
88
+ ### Checklist (phải check đủ, dù nhanh)
89
+
90
+ ```
91
+ [ ] Fix address đúng root cause (theo incident summary)?
92
+ [ ] Change scope minimal — không có thay đổi "bonus"?
93
+ [ ] No-Go Zones không bị đụng vào?
94
+ [ ] Có smoke test?
95
+ [ ] Rollback plan rõ ràng?
96
+ [ ] Không introduce regression rõ ràng?
97
+ ```
98
+
99
+ ### Verdict
100
+
101
+ ```
102
+ APPROVED → Deploy ngay 🚀
103
+ APPROVED_WITH_MONITORING → Deploy + monitor chặt 30 phút
104
+ HOLD → Vấn đề với fix, cần thêm review
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Phase 3: Deploy & Verify
110
+
111
+ ```
112
+ 1. Deploy fix
113
+ 2. Monitor 15-30 phút — xác nhận incident resolved
114
+ 3. Thông báo stakeholders: incident resolved
115
+ 4. Tạo Incident Report: .v-flow/incidents/INC-XXX.md
116
+ 5. Schedule Post-mortem: /v.retrospective (trong 24-48h)
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Phase 4: Post-Hotfix (sau khi ổn định)
122
+
123
+ Sau khi incident under control:
124
+
125
+ ```
126
+ [ ] Tạo proper spec cho fix (nếu cần)
127
+ [ ] Chạy /v.retrospective — lessons learned
128
+ [ ] Cập nhật knowledge/lessons-learned/ nếu có pattern mới
129
+ [ ] Xem xét thêm test case vào regression suite
130
+ [ ] Update context.md nếu phát hiện No-Go Zone mới
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Sơ đồ tổng thể
136
+
137
+ ```
138
+ Production Incident P1/P2
139
+
140
+ [O.0 Assessment] < 5 min
141
+ → Incident Summary + Root Cause
142
+
143
+ [B.1 Hotfix Implement]
144
+ → Minimal fix + rollback plan + smoke test
145
+
146
+ [R.1 Emergency Review] < 15 min
147
+ → APPROVED / HOLD
148
+
149
+ Deploy 🚀 → Monitor
150
+
151
+ [Post-mortem] trong 24-48h
152
+ → Retrospective + Lessons Learned
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Incident Severity Guide
158
+
159
+ | Priority | Mô tả | SLA Fix | Flow |
160
+ |----------|-------|---------|------|
161
+ | **P1** Critical | Production down, toàn bộ user bị ảnh hưởng | < 1h | Hotfix |
162
+ | **P2** High | Feature quan trọng broken, nhiều user bị ảnh hưởng | < 4h | Hotfix |
163
+ | **P3** Medium | Bug ảnh hưởng một số user, có workaround | < 24h | Quickfix |
164
+ | **P4** Low | Cosmetic, minor issue | Next sprint | Full pipeline |
165
+
166
+ ---
167
+
168
+ ## Cập nhật State & Session
169
+
170
+ **Tạo `incidents/INC-XXX.md`** (sau khi deploy):
171
+ ```markdown
172
+ # Incident INC-XXX — [Mô tả ngắn]
173
+
174
+ **Severity**: P[N]
175
+ **Detected**: [YYYY-MM-DD HH:MM]
176
+ **Resolved**: [YYYY-MM-DD HH:MM]
177
+ **Root Cause**: [mô tả]
178
+ **Fix**: [mô tả fix]
179
+ **Post-mortem**: [pending | done]
180
+ ```
181
+
182
+ **Append vào `_session.md`**:
183
+ ```markdown
184
+ ### [O.0] Hotfix — [YYYY-MM-DD]
185
+ - **Incident**: INC-XXX (P[N])
186
+ - **Root Cause**: [mô tả]
187
+ - **Fix**: [mô tả]
188
+ - **Review**: [APPROVED | HOLD]
189
+ - **Post-mortem**: scheduled [date]
190
+ - **Routing**: → Deploy → Monitor → /v.retrospective
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Ví dụ
196
+
197
+ ```
198
+ /v.hotfix INC-042 Login API trả về 500 sau deploy lúc 14:30
199
+ /v.hotfix INC-043 Payment service không xử lý được transaction mới
200
+ ```
@@ -0,0 +1,92 @@
1
+ ---
2
+ description: "Implement Agent — Coding theo Plan & Test Cases (TDD)"
3
+ phase: "B.1"
4
+ agent: "implement-agent"
5
+ ---
6
+
7
+ # /v.implement
8
+
9
+ > Orchestration wrapper cho **Implement Agent**. Đọc `agents/implement-agent.md` để thực hiện core logic.
10
+
11
+ ## Điều kiện tiên quyết BẮT BUỘC
12
+ - `validation-report.md` phải tồn tại với kết quả = **PASS** hoặc **PASS WITH CONCERNS**
13
+ - Nếu = **FAIL** → **DỪNG LẠI**, báo cho user chạy `/v.check` trước
14
+
15
+ ## Execution
16
+ 1. Đọc agent definition: `agents/implement-agent.md`
17
+ 2. Thực hiện toàn bộ quy trình trong agent definition
18
+ 3. Áp dụng command options bên dưới (nếu có)
19
+
20
+ ## Options
21
+
22
+ ### --yolo (YOLO Mode)
23
+
24
+ > Kích hoạt khi bạn muốn AI tự động implement toàn bộ, không hỏi xác nhận.
25
+
26
+ **YOLO Mode sẽ**:
27
+ - Bỏ qua các bước hỏi xác nhận giữa các tasks
28
+ - Tự động implement toàn bộ tasks theo thứ tự dependency
29
+ - Tự động đánh dấu `[x]` mỗi task khi hoàn thành
30
+ - Chạy test sau mỗi task — dừng lại nếu test fail
31
+ - Báo cáo kết quả tổng hợp khi hoàn thành
32
+
33
+ **YOLO Mode KHÔNG bỏ qua** (đây là *correctness gate*, không phải bước confirm):
34
+ - Kiểm tra spec Status block (vẫn phải ✅)
35
+ - Kiểm tra `validation-report.md` = **PASS** hoặc **PASS WITH CONCERNS**
36
+ - Version drift: `plan/tasks.synced_to_spec` lệch `spec_version_latest` → vẫn dừng, đề xuất `/v.sync`
37
+ - No-Go Zones trong `context.md` (script exit 1/2 → vẫn BLOCK)
38
+ - Task `[GATE]` → vẫn **DỪNG**, chờ human review
39
+ - Task `[CLARIFY]` → vẫn **DỪNG, hỏi human** "Câu hỏi mở"; TUYỆT ĐỐI không tự đoán business rule
40
+ - Task `[RISKY]` → vẫn test kỹ + chạy fallback plan nếu fail
41
+ - `gitnexus_impact` HIGH/CRITICAL trên symbol → vẫn cảnh báo human trước khi sửa
42
+ - Test failures (sẽ dừng và báo cáo)
43
+
44
+ > ⚠️ Sau YOLO Mode, luôn chạy `/v.review` trước khi merge.
45
+
46
+ ---
47
+
48
+ ## 🔀 Routing Rules — Sau Implement
49
+
50
+ ```
51
+ Tất cả tasks [x]
52
+ → Route: /v.review
53
+
54
+ Có task fail / blocked
55
+ → Báo cáo cho human review
56
+ ```
57
+
58
+ ## Cập nhật State & Session
59
+
60
+ **Cập nhật `.flow-state.yaml`**:
61
+ ```yaml
62
+ current_phase: "B.1"
63
+ phase_status: "done"
64
+ artifacts:
65
+ tasks:
66
+ completed: [N]
67
+ in_progress: 0
68
+ active_concerns:
69
+ - id: "W-001"
70
+ resolved: true
71
+ resolved_how: "[mô tả cách xử lý]"
72
+ ```
73
+
74
+ **Append vào `_session.md`**:
75
+ ```markdown
76
+ ### [B.1] Implement — [YYYY-MM-DD]
77
+ - **Tasks hoàn thành**: [N/total]
78
+ - **Tests passing**: [N/N]
79
+ - **Concerns addressed**:
80
+ - [W-001] → [cách giải quyết]
81
+ - **Deviations from plan**: [none | mô tả nếu có lý do]
82
+ - **Routing**: → /v.review
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Ví dụ
88
+
89
+ ```
90
+ /v.implement Feature 001-user-login
91
+ /v.implement --yolo
92
+ ```