@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,94 @@
1
+ # context.md — Project Overview (Tầng 1)
2
+
3
+ > **Phase**: U.0a (Understand — Project Overview)
4
+ > **Dự án**: [Tên dự án]
5
+ > **Ngày tạo**: YYYY-MM-DD | **Cập nhật lần cuối**: YYYY-MM-DD
6
+ > **Người review**: [Tech Lead / Architect]
7
+
8
+ > ⚠️ File này là **Tầng 1** trong Multi-Layer Understanding System.
9
+ > Chỉ chứa thông tin tổng quan (~50-100 dòng). Chi tiết từng module xem tại `.v-flow/modules/`.
10
+ > Nội dung file này sẽ được auto-inject vào AGENTS.md để AI agent luôn có sẵn.
11
+
12
+ ---
13
+
14
+ ## 1. Tech Stack
15
+
16
+ | Hạng mục | Công nghệ | Phiên bản |
17
+ |----------|-----------|-----------|
18
+ | **Ngôn ngữ** | | |
19
+ | **Framework** | | |
20
+ | **Database** | | |
21
+ | **Message Queue** | | |
22
+ | **CI/CD** | | |
23
+
24
+ ---
25
+
26
+ ## 2. Kiến Trúc Tổng Quan
27
+
28
+ > Mô tả kiến trúc AS-IS (1-3 câu). Không lý tưởng hóa.
29
+
30
+ ```
31
+ project/
32
+ ├── [thư mục chính 1]/ ← [vai trò]
33
+ ├── [thư mục chính 2]/ ← [vai trò]
34
+ └── ...
35
+ ```
36
+
37
+ **Pattern chính**: [Monolith / Microservices / Modular Monolith / ...]
38
+
39
+ ---
40
+
41
+ ## 3. Entry Points
42
+
43
+ | Entry Point | File | Ghi chú |
44
+ |-------------|------|---------|
45
+ | API chính | | |
46
+ | Background jobs | | |
47
+ | CLI / Scripts | | |
48
+
49
+ ---
50
+
51
+ ## 4. 🚫 No-Go Zones
52
+
53
+ > **Đây là luật**: Agent KHÔNG được tự ý sửa các vùng này.
54
+ > **Mức độ** (cột bắt buộc — `check-nogo-zones.sh` đọc để phân loại): 🔴 Strict = BLOCK · 🟡 Warning = cần Tech Lead duyệt · 🟢 Thấp = LOG (được phép, ghi nhận). **Ô trống = mặc định 🔴 Strict** (fail-safe — không để vùng lọt qua).
55
+
56
+ | Vùng code | Mức độ | Lý do | Rủi ro |
57
+ |-----------|:------:|-------|--------|
58
+ | `[file/module]` | 🔴 | | |
59
+
60
+ ---
61
+
62
+ ## 5. Technical Debt (Top 3-5)
63
+
64
+ | # | Mô tả | Mức độ |
65
+ |---|-------|--------|
66
+ | 1 | | 🔴/🟠/🟡 |
67
+ | 2 | | |
68
+
69
+ ---
70
+
71
+ ## 6. Module Index
72
+
73
+ > Danh sách module cards có sẵn. Agent đọc module liên quan trước khi làm feature.
74
+
75
+ | Module | Mô tả 1 dòng | Đường dẫn |
76
+ |--------|--------------|-----------|
77
+ | | | `.v-flow/modules/domain-xxx/SKILL.md` |
78
+ | | | `.v-flow/modules/domain-yyy/SKILL.md` |
79
+
80
+ ---
81
+
82
+ ## 7. Quy ước quan trọng
83
+
84
+ - **Naming**: [camelCase / snake_case / PascalCase]
85
+ - **Error handling**: [pattern đang dùng]
86
+ - **Test coverage ước tính**: ~X%
87
+
88
+ ---
89
+
90
+ ## Lịch Sử Cập Nhật
91
+
92
+ | Ngày | Người | Lý do |
93
+ |------|-------|-------|
94
+ | YYYY-MM-DD | | Tạo mới (U.0a) |
@@ -0,0 +1,95 @@
1
+ # Template: Data Model
2
+
3
+ > Được tạo bởi **Plan Agent** — Phase B.0a (khi feature có data model rõ ràng)
4
+ > Lưu tại `data-model.md`
5
+ > Feature: [TÊN FEATURE]
6
+ > Spec Version: [vX.Y]
7
+
8
+ > 📌 Khi có **cả FE và BE** (contract-first): đóng băng data model TRƯỚC, cùng với `contracts/api-contract.md`. FE và BE đều `[DEPENDS]` vào task chốt model này rồi mới `[PARALLEL]`.
9
+
10
+ ---
11
+
12
+ ## 1. Entities
13
+
14
+ > Mỗi entity: field (tên / kiểu / bắt buộc / ý nghĩa nghiệp vụ). KHÔNG bịa field ngoài spec.
15
+
16
+ ```
17
+ [EntityName]
18
+ ├── id: uuid (required) — khóa chính
19
+ ├── field1: type (required) — [ý nghĩa nghiệp vụ]
20
+ ├── field2: type (optional) — [ý nghĩa]
21
+ └── field3: type — [ý nghĩa]
22
+ ```
23
+
24
+ | Entity | Nguồn (REQ/UC) | Persistence | Ghi chú |
25
+ |--------|----------------|-------------|---------|
26
+ | `[Entity]` | REQ-xxx (UC-xx) | DB table / DTO / state | |
27
+
28
+ ---
29
+
30
+ ## 2. Relationships
31
+
32
+ ```mermaid
33
+ erDiagram
34
+ ENTITY_A ||--o{ ENTITY_B : "has many"
35
+ ENTITY_B }|--|| ENTITY_C : "belongs to"
36
+ ```
37
+
38
+ | Quan hệ | Loại | Ràng buộc (FK / cascade) |
39
+ |---------|------|--------------------------|
40
+ | A → B | 1-n | FK `b.a_id`, on delete cascade |
41
+
42
+ ---
43
+
44
+ ## 3. State Machine (nếu entity có vòng đời)
45
+
46
+ ```mermaid
47
+ stateDiagram-v2
48
+ [*] --> Draft
49
+ Draft --> Active : approve
50
+ Active --> Completed : complete
51
+ Active --> Cancelled : cancel
52
+ ```
53
+
54
+ | Trạng thái | Vào từ | Ra tới | Điều kiện chuyển |
55
+ |-----------|--------|--------|------------------|
56
+ | Draft | [*] | Active | approve |
57
+
58
+ ---
59
+
60
+ ## 4. Validation Rules
61
+
62
+ > Ràng buộc dữ liệu ở tầng domain (đồng bộ với validation FE/BE). Mỗi rule trace về REQ.
63
+
64
+ | Field | Rule | Lỗi khi vi phạm | REQ |
65
+ |-------|------|-----------------|-----|
66
+ | `email` | định dạng email hợp lệ | `VALIDATION_ERROR` | REQ-xxx |
67
+ | `price` | number > 0 | `VALIDATION_ERROR` | REQ-xxx |
68
+
69
+ ---
70
+
71
+ ## 5. Persistence & Migrations (nếu lưu DB)
72
+
73
+ > Đồng bộ với plan §3.4. Phân biệt bảng **MỚI** vs **ALTER**.
74
+
75
+ | Bảng | New/ALTER | Cột | Kiểu | Null? | Index / Constraint | REQ |
76
+ |------|:---------:|-----|------|:-----:|--------------------|-----|
77
+ | `[table]` | NEW/ALTER | | | | | REQ-xxx |
78
+
79
+ - **DDL thật (up + down)** — copy-paste-được (hoặc lệnh ORM tương đương):
80
+
81
+ ```sql
82
+ -- up
83
+ ALTER TABLE [table] ADD COLUMN [col] [type] NULL;
84
+ -- down (rollback)
85
+ ALTER TABLE [table] DROP COLUMN [col];
86
+ ```
87
+
88
+ - **Truy vấn quan trọng**: xem plan §3.5 (bảng / predicate / index cho query không hiển nhiên).
89
+ - **Breaking change → Expand-Contract**: xem plan §3.4.
90
+ - **Rollback**: [cách hoàn tác]
91
+
92
+ ---
93
+
94
+ > **Trạng thái**: Draft / Frozen (đóng băng cho contract-first) / Approved
95
+ > **Đồng bộ**: `contracts/api-contract.md` (nếu có API), `plan.md` §3
@@ -0,0 +1,92 @@
1
+ # Template: Agent Decision Log
2
+
3
+ > Mỗi Agent tạo 1 decision log kèm theo output chính.
4
+ > Giúp human reviewer hiểu reasoning, audit, và cải tiến prompts.
5
+ > Lưu tại: `.v-flow/features/NNN-ten-feature/decision-logs/[agent-name]-decision-log.md`
6
+
7
+ ## Thông tin
8
+
9
+ | Mục | Giá trị |
10
+ |-----|--------|
11
+ | **Agent** | [BA / Plan / Test / Master Check / Implement] Agent |
12
+ | **Feature** | #[NNN] — [Tên feature] |
13
+ | **Thời gian** | [YYYY-MM-DD HH:MM] |
14
+ | **Model** | [Model name + version] |
15
+ | **Temperature** | [X.X] |
16
+
17
+ ---
18
+
19
+ ## 1. Input Summary — Tóm tắt đầu vào
20
+
21
+ ### Đã đọc
22
+ <!-- Liệt kê files/documents Agent đã đọc -->
23
+ - [ ] `constitution.md` — [tóm tắt ngắn điểm liên quan]
24
+ - [ ] [Input khác] — [tóm tắt]
25
+
26
+ ### Hiểu được
27
+ <!-- Agent hiểu yêu cầu chính là gì? -->
28
+
29
+ ### Câu hỏi / Unclear points
30
+ <!-- Điều gì không rõ? Giả định gì đã đặt ra? -->
31
+
32
+ ---
33
+
34
+ ## 2. Reasoning — Quá trình suy luận
35
+
36
+ ### Các phương án đã xem xét
37
+ <!-- Agent đã cân nhắc những lựa chọn nào? -->
38
+
39
+ | Phương án | Ưu điểm | Nhược điểm | Quyết định |
40
+ |-----------|---------|------------|-----------|
41
+ | [A] | | | ✅ Chọn / ❌ Bỏ |
42
+ | [B] | | | ✅ Chọn / ❌ Bỏ |
43
+
44
+ ### Lý do quyết định
45
+ <!-- Tại sao chọn phương án này? -->
46
+
47
+ ### Trade-offs chấp nhận
48
+ <!-- Có trade-off nào không? -->
49
+
50
+ ---
51
+
52
+ ## 3. Key Decisions — Quyết định quan trọng
53
+
54
+ | # | Quyết định | Lý do | Constitution reference |
55
+ |---|-----------|--------|----------------------|
56
+ | 1 | [Decision] | [Rationale] | [Section N.N nếu có] |
57
+ | 2 | | | |
58
+
59
+ ---
60
+
61
+ ## 4. Assumptions — Giả định
62
+
63
+ | # | Giả định | Rủi ro nếu sai |
64
+ |---|---------|----------------|
65
+ | 1 | [Assumption] | [Risk] |
66
+ | 2 | | |
67
+
68
+ ---
69
+
70
+ ## 5. Confidence — Độ tự tin
71
+
72
+ | Phần output | Confidence (1-5) | Ghi chú |
73
+ |-------------|:-----------------:|---------|
74
+ | [Section 1] | /5 | |
75
+ | [Section 2] | /5 | |
76
+ | **Tổng thể** | **/5** | |
77
+
78
+ > Confidence thấp (< 3) = cần human review kỹ hơn.
79
+
80
+ ---
81
+
82
+ ## 6. Output Summary — Tóm tắt đầu ra
83
+
84
+ ### Files tạo ra
85
+ - [ ] [output-file.md] — [mô tả ngắn]
86
+
87
+ ### Metrics
88
+ | Metric | Giá trị |
89
+ |--------|--------|
90
+ | Processing time | [X phút] |
91
+ | Output length | [X dòng / words] |
92
+ | Revision number | [1st / 2nd / ...] |
@@ -0,0 +1,208 @@
1
+ # V Flow State Schema
2
+ # File: .v-flow/features/NNN-feature-name/.flow-state.yaml
3
+ # Tạo tự động bởi /v.specify — cập nhật tại mỗi phase transition
4
+ # ⚠️ KHÔNG sửa tay — dùng /v.status để xem; phase tự chuyển khi chạy command tương ứng (vd /v.plan, /v.check, /v.implement)
5
+
6
+ # ────────────────────────────────────────────────────────────────────────────
7
+ # IDENTITY
8
+ # ────────────────────────────────────────────────────────────────────────────
9
+ feature_id: "NNN" # e.g. "001"
10
+ feature_name: "ten-feature" # e.g. "user-login"
11
+ created_at: "YYYY-MM-DD"
12
+ last_updated: "YYYY-MM-DD"
13
+ project_type: "greenfield" # greenfield | legacy
14
+ schema_version: "2.0" # artifact-schema generation — validator dùng để gate; bump khi template đổi schema
15
+
16
+ # ────────────────────────────────────────────────────────────────────────────
17
+ # GOVERNANCE — Risk tier + approval metadata (validator gate; --strict chặn CI)
18
+ # ────────────────────────────────────────────────────────────────────────────
19
+ risk_tier: "medium" # low | medium | high | critical — quyết định gate bắt buộc
20
+ # low: 0 approval · medium: spec · high: spec+security · critical: spec+security+tech_lead
21
+ approvals: # mỗi approval cần actor + timestamp để audit được
22
+ # - role: spec # gate được approve: spec | security | tech_lead | ...
23
+ # actor: "Nguyen Van A"
24
+ # decision: approved # approved | rejected
25
+ # timestamp: "2026-06-06T10:00:00Z"
26
+
27
+ # ────────────────────────────────────────────────────────────────────────────
28
+ # PIPELINE STATE — Phase hiện tại
29
+ # ────────────────────────────────────────────────────────────────────────────
30
+ current_phase: "S.1" # U.0 | S.0a | S.0b | S.1 | S.1.5 | B.0a | B.0b | R.0 | B.1 | R.1 | M.0 | O.0
31
+ phase_status: "in_progress" # pending | in_progress | awaiting_human | done | blocked
32
+
33
+ # Phase history (tự động append)
34
+ phase_history:
35
+ - phase: "S.1"
36
+ entered_at: "YYYY-MM-DD"
37
+ exited_at: null
38
+ reason: "initial specification"
39
+
40
+ # ────────────────────────────────────────────────────────────────────────────
41
+ # ARTIFACTS — Trạng thái từng artifact
42
+ # ────────────────────────────────────────────────────────────────────────────
43
+ artifacts:
44
+ spec:
45
+ exists: true
46
+ version: "v1.0"
47
+ status: "draft" # draft | reviewed | approved
48
+ human_approved: false
49
+ approved_by: null
50
+ approved_at: null
51
+
52
+ plan:
53
+ exists: false
54
+ synced_to_spec: null # spec version plan này được sync với
55
+ human_approved: false
56
+
57
+ tasks:
58
+ exists: false
59
+ synced_to_spec: null
60
+ total: 0
61
+ completed: 0
62
+ in_progress: 0
63
+
64
+ test_cases:
65
+ exists: false
66
+ synced_to_spec: null
67
+ total: 0
68
+ human_approved: false
69
+
70
+ validation_report:
71
+ exists: false
72
+ verdict: null # PASS | PASS_WITH_CONCERNS | FAIL | PENDING_RECHECK
73
+ spec_version_checked: null
74
+ concerns_count: 0
75
+ issues_critical: 0
76
+ issues_major: 0
77
+
78
+ code_review:
79
+ exists: false
80
+ verdict: null # APPROVED | APPROVED_WITH_NOTES | CHANGES_REQUIRED
81
+
82
+ ui_mockups: # ảnh mockup — prototype/human đặt (KHÔNG do BA ingest ở S.1)
83
+ exists: false
84
+ count: 0 # số ảnh mockup
85
+ sources: [] # [pdf, docx, md, figma] — nguồn ảnh nếu có
86
+ screens: [] # [UC-01, UC-02, ...] — UC có mockup
87
+ dir: null # path: .v-flow/features/NNN/ui/mockups/
88
+
89
+ prototype:
90
+ exists: false
91
+ branch: null # LOGIC | UI
92
+ mode: null # from-mockup (tái hiện) | explore (variant) — chỉ UI branch
93
+ verdict: null # VALIDATED | REJECTED | INCONCLUSIVE
94
+ approved_by: null # tên + vai trò người duyệt — BẮT BUỘC khi verdict=VALIDATED
95
+ approved_at: null # YYYY-MM-DD — thời điểm duyệt
96
+ question: null # câu hỏi prototype trả lời
97
+ req_refs: [] # [REQ-xxx, ...] từ spec
98
+ notes_file: null # path: .v-flow/features/NNN/prototype-notes.md
99
+ approved_ref: null # path ui/approved/UC-NN.* — render đã chốt (mode=from-mockup, KHÔNG xóa)
100
+ skipped: false
101
+ skip_reason: null # lý do skip nếu skipped = true
102
+
103
+ # ────────────────────────────────────────────────────────────────────────────
104
+ # ROUTING — Quyết định routing tại mỗi gate
105
+ # ────────────────────────────────────────────────────────────────────────────
106
+ routing:
107
+ # Sau Master Check (R.0)
108
+ after_master_check:
109
+ last_verdict: null
110
+ last_fail_reason: null # spec_gap | plan_gap | test_gap | constitution_violation | nogo_violation
111
+ route_decision: null # implement | re_specify | re_plan | re_test
112
+
113
+ # Sau Code Review (R.1)
114
+ after_review:
115
+ last_verdict: null
116
+ route_decision: null # deploy | fix_and_re_review | re_specify
117
+
118
+ # Sau Operations (O.0)
119
+ after_operations:
120
+ priority: null # P1 | P2 | P3 | P4
121
+ route_decision: null # hotfix_b1 | bugfix_full | lessons_learned
122
+
123
+ # ────────────────────────────────────────────────────────────────────────────
124
+ # HUMAN CHECKPOINTS — Các điểm cần người approve
125
+ # ────────────────────────────────────────────────────────────────────────────
126
+ human_checkpoints:
127
+ spec_approved: false
128
+ prototype_verdict_confirmed: false # human xác nhận prototype verdict (S.1.5, optional)
129
+ plan_approved: false
130
+ master_check_approved: false # human xác nhận PASS/PASS_WITH_CONCERNS
131
+ implementation_approved: false # human kick off implement sau check
132
+ review_approved: false # human approve để deploy
133
+ deploy_approved: false
134
+
135
+ # Checkpoint hiện tại đang chờ (nếu có)
136
+ awaiting_checkpoint: null # e.g. "spec_approved" | null
137
+
138
+ # ────────────────────────────────────────────────────────────────────────────
139
+ # BUSINESS VERIFICATION — Cognitive gate trước khi /v.specify viết spec
140
+ # ────────────────────────────────────────────────────────────────────────────
141
+ business_verification:
142
+ status: null # null | pending | passed | passed_with_warnings | failed | skipped
143
+ verified_at: null
144
+ verified_by: null # tên human BA/PO đã đánh giá
145
+ skip_reason: null # lý do skip nếu status = "skipped"
146
+
147
+ # Danh sách modules đã được verify (append mỗi lần chạy gate)
148
+ modules_verified:
149
+ # - module: "domain-orders"
150
+ # module_card_version: "1.2" # version lúc verify — dùng để detect staleness
151
+ # quiz_status: "ready" # "draft" | "ready" — quiz đã được human review chưa?
152
+ # must_score: "3/3" # N/Total câu MUST đúng
153
+ # should_score: "2/3" # N/Total câu SHOULD đúng
154
+ # verdict: "passed" # "passed" | "passed_with_warnings" | "failed"
155
+ # verified_at: "YYYY-MM-DD"
156
+ # warnings: [] # List SHOULD questions AI trả lời sai/thiếu
157
+
158
+ # ────────────────────────────────────────────────────────────────────────────
159
+ # CONCERNS — Từ Master Check, carry forward đến Implement
160
+ # ────────────────────────────────────────────────────────────────────────────
161
+ active_concerns:
162
+ # - id: "W-001"
163
+ # description: "Rate limiting chưa được spec rõ"
164
+ # source: "R.0 Master Check"
165
+ # resolved: false
166
+ # resolved_at: null
167
+ # resolved_how: null
168
+
169
+ # ────────────────────────────────────────────────────────────────────────────
170
+ # BLOCKED — Lý do bị block (nếu có)
171
+ # ────────────────────────────────────────────────────────────────────────────
172
+ blocked: false
173
+ blocked_reason: null # e.g. "Đang chờ API backend từ team khác"
174
+ blocked_since: null
175
+ blocked_dependencies: # Cross-feature dependency tracking (Thread Isolation)
176
+ # - feature: "001-login"
177
+ # reason: "Cần auth API endpoint"
178
+ # unblocked_when: "001-login phase >= R.1"
179
+
180
+ # ────────────────────────────────────────────────────────────────────────────
181
+ # B.0 OUTPUTS — Map-Reduce: optional agents và outputs song song
182
+ # ────────────────────────────────────────────────────────────────────────────
183
+ b0_outputs:
184
+ plan: { exists: false }
185
+ tests: { exists: false }
186
+ security: { exists: false, skipped: true, reason: null }
187
+ ux: { exists: false, skipped: true, reason: null }
188
+ api_contracts: { exists: false, skipped: true, reason: null }
189
+
190
+ # ────────────────────────────────────────────────────────────────────────────
191
+ # TIME TRAVEL — Fork & Rewind tracking
192
+ # ────────────────────────────────────────────────────────────────────────────
193
+ fork_info:
194
+ is_fork: false # true nếu đây là bản fork
195
+ forked_from: null # feature gốc (nếu is_fork = true)
196
+ forked_at_phase: null
197
+ forked_at_spec: null
198
+ fork_reason: null
199
+ active_forks: [] # danh sách bản forks đang active
200
+
201
+ rewind_count: 0 # số lần rewind (> 2 = cảnh báo)
202
+
203
+ # ────────────────────────────────────────────────────────────────────────────
204
+ # METADATA
205
+ # ────────────────────────────────────────────────────────────────────────────
206
+ spec_version_latest: "v1.0"
207
+ session_file: ".v-flow/features/NNN-feature-name/_session.md"
208
+ notes: ""
@@ -0,0 +1,30 @@
1
+ # V-Flow — validate spec/plan/tasks/test-cases on every PR.
2
+ # Scaffolded by `v-flow init`. Gates the spec-driven pipeline so plan/task
3
+ # artifacts can't drift. Legacy features (older schema_version) won't fail —
4
+ # their new-schema warnings stay advisory until migrated.
5
+ name: V-Flow Validate
6
+
7
+ on:
8
+ pull_request:
9
+ paths:
10
+ - '.v-flow/features/**'
11
+ - '.v-flow/constitution.md'
12
+ push:
13
+ branches: [main, master]
14
+ paths:
15
+ - '.v-flow/features/**'
16
+
17
+ jobs:
18
+ validate:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '20'
25
+ - name: Install v-flow CLI
26
+ run: npm install -g v-flow-cli
27
+ - name: Validate artifacts (strict — warnings block too)
28
+ run: v-flow validate --strict
29
+ # Optional — also lint source vs constitution [LINT:xxx] rules:
30
+ # - run: v-flow validate --constitution
@@ -0,0 +1,70 @@
1
+ # ADR-XXX: [Tiêu đề quyết định]
2
+
3
+ > **Status**: [Proposed | Accepted | Deprecated | Superseded by ADR-YYY]
4
+ > **Date**: YYYY-MM-DD
5
+ > **Deciders**: [Tên người quyết định]
6
+ > **Technical Story**: [REQ-xxx hoặc ticket reference]
7
+
8
+ ---
9
+
10
+ ## Context
11
+
12
+ > Mô tả bối cảnh kỹ thuật dẫn tới quyết định này.
13
+ > Gồm: vấn đề đang gặp, ràng buộc, yêu cầu phi chức năng liên quan.
14
+
15
+ *(Viết 3-5 câu mô tả tình huống thực tế)*
16
+
17
+ ---
18
+
19
+ ## Decision
20
+
21
+ > Mô tả quyết định đã chọn — ghi rõ "chọn cái gì" và "vì sao".
22
+
23
+ **Chúng tôi quyết định**: *(ghi rõ quyết định)*
24
+
25
+ ---
26
+
27
+ ## Options Considered
28
+
29
+ ### Option A: [Tên phương án]
30
+
31
+ | Tiêu chí | Đánh giá |
32
+ |----------|----------|
33
+ | Performance | *(tốt/trung bình/kém)* |
34
+ | Maintainability | |
35
+ | Team familiarity | |
36
+ | Risk level | |
37
+
38
+ **Pros**: *(liệt kê ưu điểm)*
39
+ **Cons**: *(liệt kê nhược điểm)*
40
+
41
+ ### Option B: [Tên phương án]
42
+
43
+ *(tương tự Option A)*
44
+
45
+ ---
46
+
47
+ ## Consequences
48
+
49
+ ### Positive
50
+ - *(tác động tích cực)*
51
+
52
+ ### Negative
53
+ - *(tác động tiêu cực — chấp nhận được vì...)*
54
+
55
+ ### Neutral
56
+ - *(tác động trung lập cần theo dõi)*
57
+
58
+ ---
59
+
60
+ ## Compliance
61
+
62
+ - [ ] Không vi phạm No-Go Zones (ref: `context.md` §4)
63
+ - [ ] Consistent với Constitution (ref: `constitution.md`)
64
+ - [ ] Đã review với Architect/Tech Lead
65
+
66
+ ---
67
+
68
+ ## Notes
69
+
70
+ *(Ghi chú bổ sung, link tham khảo, benchmark data, proof-of-concept results)*