@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.
- package/AGENTS.md +265 -0
- package/CHANGELOG.md +318 -0
- package/LICENSE +21 -0
- package/README.md +326 -0
- package/agents/ba-agent.md +437 -0
- package/agents/ba-critic-agent.md +156 -0
- package/agents/ba-to-ptyc-agent.md +112 -0
- package/agents/bugfix-analyst-agent.md +221 -0
- package/agents/constitute-agent.md +155 -0
- package/agents/help-agent.md +168 -0
- package/agents/implement-agent.md +220 -0
- package/agents/import-ba-docs-agent.md +164 -0
- package/agents/master-check-agent.md +228 -0
- package/agents/metrics-agent.md +180 -0
- package/agents/operations-agent.md +123 -0
- package/agents/plan-agent.md +218 -0
- package/agents/prototype-agent.md +191 -0
- package/agents/retrospective-agent.md +196 -0
- package/agents/review-agent.md +210 -0
- package/agents/sprint-agent.md +191 -0
- package/agents/status-agent.md +186 -0
- package/agents/sync-agent.md +201 -0
- package/agents/test-agent.md +166 -0
- package/agents/understand-agent.md +339 -0
- package/cli/commands/check.js +96 -0
- package/cli/commands/dev-quiz.js +107 -0
- package/cli/commands/doctor.js +348 -0
- package/cli/commands/feature.js +259 -0
- package/cli/commands/hooks.js +163 -0
- package/cli/commands/init.js +189 -0
- package/cli/commands/log.js +199 -0
- package/cli/commands/plugin.js +230 -0
- package/cli/commands/score-card.js +203 -0
- package/cli/commands/status.js +269 -0
- package/cli/commands/sync.js +59 -0
- package/cli/commands/upgrade.js +150 -0
- package/cli/commands/validate.js +1259 -0
- package/cli/commands/watch.js +151 -0
- package/cli/index.js +46 -0
- package/cli/lib/ac-test-gate.js +89 -0
- package/cli/lib/activity-log.js +209 -0
- package/cli/lib/cli-error.js +183 -0
- package/cli/lib/constitution-lint.js +561 -0
- package/cli/lib/dev-quiz-grade.js +127 -0
- package/cli/lib/governance.js +78 -0
- package/cli/lib/hook-targets.js +167 -0
- package/cli/lib/i18n.js +375 -0
- package/cli/lib/knowledge-oracle.js +379 -0
- package/cli/lib/logger.js +203 -0
- package/cli/lib/module-card-lint.js +304 -0
- package/cli/lib/module-card-score.js +223 -0
- package/cli/lib/plugins.js +481 -0
- package/cli/lib/scanner.js +692 -0
- package/cli/lib/sync-core.js +232 -0
- package/cli/lib/sync-targets.js +84 -0
- package/cli/lib/templates.js +268 -0
- package/cli/lib/yaml-parser.js +203 -0
- package/commands/v.ba-critic.md +101 -0
- package/commands/v.ba-to-ptyc.md +71 -0
- package/commands/v.bugfix.md +86 -0
- package/commands/v.check.md +131 -0
- package/commands/v.constitute.md +87 -0
- package/commands/v.constitution.md +84 -0
- package/commands/v.fork.md +127 -0
- package/commands/v.help.md +73 -0
- package/commands/v.hotfix.md +200 -0
- package/commands/v.implement.md +92 -0
- package/commands/v.import-ba-docs.md +222 -0
- package/commands/v.metrics.md +74 -0
- package/commands/v.operations.md +70 -0
- package/commands/v.plan.md +78 -0
- package/commands/v.prototype.md +121 -0
- package/commands/v.quickfix.md +169 -0
- package/commands/v.retrospective.md +80 -0
- package/commands/v.review.md +78 -0
- package/commands/v.rewind.md +127 -0
- package/commands/v.specify.md +118 -0
- package/commands/v.sprint.md +75 -0
- package/commands/v.status.md +62 -0
- package/commands/v.sync.md +81 -0
- package/commands/v.test.md +67 -0
- package/commands/v.understand.md +112 -0
- package/package.json +65 -0
- package/skills/_shared/constitution-reader/SKILL.md +109 -0
- package/skills/_shared/constitution-reader/config.json +52 -0
- package/skills/_shared/constitution-reader/examples/good/b1-phase-output.md +48 -0
- package/skills/_shared/constitution-reader/gotchas.md +46 -0
- package/skills/_shared/context-reader/SKILL.md +111 -0
- package/skills/_shared/context-reader/config.json +54 -0
- package/skills/_shared/context-reader/examples/good/legacy-nodejs-output.md +35 -0
- package/skills/_shared/context-reader/gotchas.md +49 -0
- package/skills/_shared/ears-notation/SKILL.md +63 -0
- package/skills/_shared/ears-notation/config.json +55 -0
- package/skills/_shared/ears-notation/examples/good/plan-test-interpretation.md +29 -0
- package/skills/_shared/ears-notation/gotchas.md +43 -0
- package/skills/check/cross-validator/SKILL.md +206 -0
- package/skills/check/cross-validator/config.json +33 -0
- package/skills/check/cross-validator/examples/good/validation-report-pass-with-concerns.md +105 -0
- package/skills/check/cross-validator/gotchas.md +43 -0
- package/skills/implement/constitution-enforcer/SKILL.md +134 -0
- package/skills/implement/constitution-enforcer/config.json +16 -0
- package/skills/implement/constitution-enforcer/examples/bad/vague-report.md +42 -0
- package/skills/implement/constitution-enforcer/examples/good/compliance-report.md +57 -0
- package/skills/implement/constitution-enforcer/gotchas.md +26 -0
- package/skills/implement/constitution-enforcer/scripts/check-constitution.sh +88 -0
- package/skills/implement/no-go-zone-guard/SKILL.md +173 -0
- package/skills/implement/no-go-zone-guard/config.json +28 -0
- package/skills/implement/no-go-zone-guard/examples/good/adapter-workaround.md +46 -0
- package/skills/implement/no-go-zone-guard/gotchas.md +27 -0
- package/skills/implement/no-go-zone-guard/scripts/check-nogo-zones.sh +148 -0
- package/skills/implement/no-go-zone-guard/scripts/nogo-precommit.sh +96 -0
- package/skills/implement/tdd-driver/SKILL.md +159 -0
- package/skills/implement/tdd-driver/config.json +33 -0
- package/skills/implement/tdd-driver/examples/good/tdd-cycle-product-repo.md +81 -0
- package/skills/implement/tdd-driver/gotchas.md +34 -0
- package/skills/metrics/metrics-collector/SKILL.md +133 -0
- package/skills/metrics/metrics-collector/config.json +16 -0
- package/skills/metrics/metrics-collector/examples/bad/incomplete-report.md +48 -0
- package/skills/metrics/metrics-collector/examples/good/full-metrics-report.md +101 -0
- package/skills/metrics/metrics-collector/gotchas.md +26 -0
- package/skills/operations/incident-runbook/SKILL.md +167 -0
- package/skills/operations/incident-runbook/config.json +21 -0
- package/skills/operations/incident-runbook/examples/bad/vague-incident-report.md +48 -0
- package/skills/operations/incident-runbook/examples/good/p1-hotfix-response.md +119 -0
- package/skills/operations/incident-runbook/gotchas.md +26 -0
- package/skills/plan/architecture-designer/SKILL.md +228 -0
- package/skills/plan/architecture-designer/config.json +32 -0
- package/skills/plan/architecture-designer/examples/bad/vague-plan.md +62 -0
- package/skills/plan/architecture-designer/examples/good/expand-contract-migration.md +56 -0
- package/skills/plan/architecture-designer/examples/good/plan-structure.md +58 -0
- package/skills/plan/architecture-designer/gotchas.md +45 -0
- package/skills/plan/task-breakdown/SKILL.md +208 -0
- package/skills/plan/task-breakdown/config.json +26 -0
- package/skills/plan/task-breakdown/examples/bad/vague-tasks.md +77 -0
- package/skills/plan/task-breakdown/examples/good/spike-clarify-tasks.md +66 -0
- package/skills/plan/task-breakdown/examples/good/tasks-login-feature.md +111 -0
- package/skills/plan/task-breakdown/gotchas.md +39 -0
- package/skills/prototype/LOGIC.md +240 -0
- package/skills/prototype/SKILL.md +185 -0
- package/skills/prototype/UI.md +407 -0
- package/skills/prototype/config.json +104 -0
- package/skills/prototype/examples/bad/prototype-notes.md +68 -0
- package/skills/prototype/examples/good/prototype-notes-ui.md +109 -0
- package/skills/prototype/examples/good/prototype-notes.md +67 -0
- package/skills/prototype/gotchas.md +128 -0
- package/skills/prototype/scripts/check-flow-state.ps1 +112 -0
- package/skills/prototype/scripts/check-flow-state.sh +104 -0
- package/skills/prototype/scripts/check-prototype-cleanup.ps1 +124 -0
- package/skills/prototype/scripts/check-prototype-cleanup.sh +109 -0
- package/skills/prototype/scripts/check-prototype-notes.ps1 +107 -0
- package/skills/prototype/scripts/check-prototype-notes.sh +102 -0
- package/skills/review/adversarial-reviewer/SKILL.md +137 -0
- package/skills/review/adversarial-reviewer/config.json +32 -0
- package/skills/review/adversarial-reviewer/examples/good/review-report-template.md +56 -0
- package/skills/review/adversarial-reviewer/gotchas.md +46 -0
- package/skills/review/adversarial-reviewer/scripts/quick-security-scan.sh +52 -0
- package/skills/specify/ba-bpmn-doc-gen/SKILL.md +108 -0
- package/skills/specify/ba-bpmn-doc-gen/reference/reference-bpmn-generation.md +528 -0
- package/skills/specify/ba-bpmn-doc-gen/reference/reference-drawio-flowchart.md +466 -0
- package/skills/specify/ba-critic/SKILL.md +172 -0
- package/skills/specify/ba-critic/config.json +32 -0
- package/skills/specify/ba-critic/examples/good/critic-report-round1.md +51 -0
- package/skills/specify/ba-critic/gotchas.md +40 -0
- package/skills/specify/ba-critic/scripts/check-spec-quality.sh +72 -0
- package/skills/specify/ba-doc-generator/SKILL.md +102 -0
- package/skills/specify/ba-doc-generator/references/template-clevel.md +84 -0
- package/skills/specify/ba-doc-generator/references/template-compliance.md +83 -0
- package/skills/specify/ba-doc-generator/references/template-dev.md +138 -0
- package/skills/specify/ba-doc-generator/references/template-partner.md +167 -0
- package/skills/specify/ba-doc-generator/references/template-pm.md +92 -0
- package/skills/specify/ba-doc-generator/references/template-review.md +114 -0
- package/skills/specify/ba-doc-generator/references/template-tester.md +108 -0
- package/skills/specify/ba-doc-generator/references/template-user.md +98 -0
- package/skills/specify/bugfix-analyst/SKILL.md +296 -0
- package/skills/specify/bugfix-analyst/config.json +41 -0
- package/skills/specify/bugfix-analyst/examples/bad/common-mistakes.md +71 -0
- package/skills/specify/bugfix-analyst/examples/good/email-validation-bugfix.md +53 -0
- package/skills/specify/bugfix-analyst/gotchas.md +51 -0
- package/skills/specify/ears-writer/SKILL.md +129 -0
- package/skills/specify/ears-writer/config.json +20 -0
- package/skills/specify/ears-writer/examples/bad/common-mistakes.md +17 -0
- package/skills/specify/ears-writer/examples/good/login-requirements.md +41 -0
- package/skills/specify/ears-writer/gotchas.md +43 -0
- package/skills/specify/ears-writer/scripts/check-ears-compliance.sh +51 -0
- package/skills/test/test-case-generator/SKILL.md +161 -0
- package/skills/test/test-case-generator/config.json +33 -0
- package/skills/test/test-case-generator/examples/good/test-cases-login.md +104 -0
- package/skills/test/test-case-generator/gotchas.md +43 -0
- package/skills/understand/ba-docs-scanner/SKILL.md +239 -0
- package/skills/understand/ba-docs-scanner/config.json +47 -0
- package/skills/understand/ba-docs-scanner/examples/good/work-order-br-extract.md +28 -0
- package/skills/understand/ba-docs-scanner/gotchas.md +44 -0
- package/skills/understand/ba-docs-scanner/merge-rules.md +47 -0
- package/skills/understand/codebase-scanner/SKILL.md +260 -0
- package/skills/understand/codebase-scanner/config.json +56 -0
- package/skills/understand/codebase-scanner/examples/good/menu-module-output.md +44 -0
- package/skills/understand/codebase-scanner/gotchas.md +42 -0
- package/skills/understand/codebase-scanner/scripts/scan-project-structure.sh +64 -0
- package/templates/DESIGN.md +456 -0
- package/templates/agent-command-template.yaml +240 -0
- package/templates/agent-config-template.md +170 -0
- package/templates/agent-definition-template.md +145 -0
- package/templates/agent-metrics-template.md +150 -0
- package/templates/api-contract-template.md +72 -0
- package/templates/bugfix-report-template.md +195 -0
- package/templates/bugfix-spec-template.md +134 -0
- package/templates/code-review-report-template.md +119 -0
- package/templates/constitution-template.md +234 -0
- package/templates/context-template.md +94 -0
- package/templates/data-model-template.md +95 -0
- package/templates/decision-log-template.md +92 -0
- package/templates/flow-state-template.yaml +208 -0
- package/templates/github/workflows/v-flow-validate.yml +30 -0
- package/templates/knowledge/adr-template.md +70 -0
- package/templates/knowledge/api-contract-template.md +140 -0
- package/templates/knowledge/domain-glossary.md +29 -0
- package/templates/knowledge/golden-tests-readme.md +115 -0
- package/templates/knowledge/lessons-learned.md +41 -0
- package/templates/knowledge/patterns.md +103 -0
- package/templates/module-card/SKILL.md +85 -0
- package/templates/module-card/api-specs.md +96 -0
- package/templates/module-card/business-quiz.md +119 -0
- package/templates/module-card/cross-service.md +125 -0
- package/templates/module-card/db.md +85 -0
- package/templates/module-card/dev-quiz.md +62 -0
- package/templates/module-card/permissions.md +83 -0
- package/templates/module-card/state-diagram.md +64 -0
- package/templates/module-card/tech-context.md +90 -0
- package/templates/module-card/ui-flows.md +91 -0
- package/templates/module-card/use-cases.md +142 -0
- package/templates/module-template.yaml +161 -0
- package/templates/operations-report-template.md +108 -0
- package/templates/plan-template.md +308 -0
- package/templates/prototype-notes-template.md +116 -0
- package/templates/ptyc/PTYC.template.docx +0 -0
- package/templates/ptyc/ptyc.meta.example.yaml +44 -0
- package/templates/retrospective-report-template.md +136 -0
- package/templates/security-review-template.md +84 -0
- package/templates/session-template.md +167 -0
- package/templates/spec-review-log-template.md +75 -0
- package/templates/spec-template.md +229 -0
- package/templates/sprint-status-template.md +101 -0
- package/templates/tasks-template.md +275 -0
- package/templates/test-cases-template.md +124 -0
- package/templates/ux-checklist-template.md +79 -0
- package/templates/validation-report-template.md +125 -0
- package/templates/vflow-config-template.yaml +22 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "BA to PTYC Agent"
|
|
3
|
+
role: "Requirements Analysis Doc Exporter"
|
|
4
|
+
phase: "S.1.6"
|
|
5
|
+
triggers: ["/v.ba-to-ptyc"]
|
|
6
|
+
input: ["features/*/spec.md", "ptyc.meta.yaml", "(optional) plan.md"]
|
|
7
|
+
output: ["features/*/ptyc/ptyc-data.json", "features/*/ptyc/PTYC_*.docx"]
|
|
8
|
+
output_schema:
|
|
9
|
+
functions_count: "number"
|
|
10
|
+
tbd_count: "number"
|
|
11
|
+
memory_logging:
|
|
12
|
+
append_to: "_session.md"
|
|
13
|
+
format: "execution_trace"
|
|
14
|
+
include: ["input_summary", "output_summary", "tbd_count", "duration"]
|
|
15
|
+
---
|
|
16
|
+
# BA to PTYC Agent — Requirements Analysis Doc Exporter
|
|
17
|
+
|
|
18
|
+
> **Vai trò**: Sinh tài liệu **Phân tích Yêu cầu (PTYC)** chuẩn ISO (Viettel) từ `spec.md` của feature.
|
|
19
|
+
> **Phase**: S.1.6 (Doc Export — optional, sau khi `spec.md` đã Approved). Tương ứng bước **7a** trong BA Skill Pipeline.
|
|
20
|
+
> **Cơ chế**: AI map `spec.md` → `ptyc-data.json` (đúng schema) → script `render_ptyc.py` đổ vào template `.docx` (giữ nguyên format ISO).
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Nguyên tắc
|
|
25
|
+
|
|
26
|
+
1. **AI map ngữ nghĩa, script render** — Bạn KHÔNG dựng `.docx`. Bạn chỉ tạo `ptyc-data.json` đúng `scripts/ptyc/ptyc-data.schema.json`. Việc đổ vào Word do `render_ptyc.py` lo (deterministic, không lệch format).
|
|
27
|
+
2. **spec.md là single-source** — không bịa nội dung. Field không suy ra được → ghi `"[TBD]"` để BA điền sau (đừng bỏ trống im lặng).
|
|
28
|
+
3. **Giữ nguyên nghiệp vụ** — chỉ chuyển NGÔN NGỮ/CẤU TRÚC sang văn phong PTYC, không đổi ý nghĩa requirement.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Điều kiện tiên quyết
|
|
33
|
+
|
|
34
|
+
1. `.v-flow/features/{NNN}/spec.md` tồn tại (nên đã Approved).
|
|
35
|
+
2. `.v-flow/features/{NNN}/ptyc.meta.yaml` tồn tại — nếu chưa: copy `.v-flow/templates/ptyc/ptyc.meta.example.yaml` và hỏi BA điền `doc_code`, `pyc_ref`, `signers`.
|
|
36
|
+
3. Tooling ở **trong `.v-flow/`** (`.v-flow/scripts/ptyc/`); nếu thiếu → `v-flow sync --apply`. `docxtpl` ở venv `.v-flow/.venv` (macOS python externally-managed nên KHÔNG dùng `python3` hệ thống). Tạo 1 lần: `python3 -m venv .v-flow/.venv && .v-flow/.venv/bin/pip install docxtpl`.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Quy trình làm việc
|
|
41
|
+
|
|
42
|
+
### Bước 1 — Đọc input
|
|
43
|
+
- Đọc `spec.md` (cấu trúc: §1 Tổng quan, §2 Use Cases UC-xx, §3 Requirements EARS, §4 Acceptance, §5 Ràng buộc, §7 Status/Changelog).
|
|
44
|
+
- Đọc `ptyc.meta.yaml` (metadata trang bìa, PYC, người ký, change_log, references).
|
|
45
|
+
- (Tùy chọn) Đọc `plan.md` nếu có → bổ sung §4 NFR (plan §10).
|
|
46
|
+
|
|
47
|
+
### Bước 2 — Map sang `ptyc-data.json`
|
|
48
|
+
|
|
49
|
+
Đọc schema: **`scripts/ptyc/ptyc-data.schema.json`**. Ánh xạ:
|
|
50
|
+
|
|
51
|
+
| Nhánh JSON | Nguồn |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `doc`, `signers`, `change_log`, `overview.pyc_ref`, `intro.references` | `ptyc.meta.yaml` (+ spec §7 Changelog) |
|
|
54
|
+
| `intro.glossary` | **Rút thuật ngữ/viết tắt** xuất hiện trong spec (acronym + giải nghĩa ngắn) |
|
|
55
|
+
| `overview.problem_statement` | spec §1.2 Motivation |
|
|
56
|
+
| `overview.goals` | spec §1.1 / mục tiêu |
|
|
57
|
+
| `overview.scope` | spec scope + §5.3 Out of Scope (ghi rõ "Ngoài phạm vi: …") |
|
|
58
|
+
| `overview.users` | spec §1.3 Actors |
|
|
59
|
+
| `overview.overall_model`, `process.*` | "N/A" nếu spec không có mô hình/BPMN nghiệp vụ |
|
|
60
|
+
| `functions[]` | **spec §2 mỗi UC-xx → 1 function** (xem dưới) |
|
|
61
|
+
| `nfr.*` | NFR gắn UC (spec §2 "Yêu cầu đặc biệt") + plan §10 nếu có; còn lại "N/A" |
|
|
62
|
+
| `acceptance` | spec §4 Acceptance Criteria (gộp thành đoạn) |
|
|
63
|
+
|
|
64
|
+
> 📌 **`doc.doc_code`: để TRỐNG (`""`)** trong JSON → render tự sinh `PTYC_{project_code}_{pyc_ref.no}_{năm}_V1.0` + đặt tên file theo đó. **Lấy `pyc_ref.no` đúng theo PYC của feature** (vd input `pyc_01.pdf` → `no: "01"`); TUYỆT ĐỐI không copy số ví dụ ("72") từ template.
|
|
65
|
+
|
|
66
|
+
**Mỗi `functions[i]` (từ 1 UC):**
|
|
67
|
+
- `name` ← UC name; `description` ← Mô tả tính năng; `actors` ← Tác nhân chính + phụ.
|
|
68
|
+
- `precondition` / `postcondition` ← Điều kiện trước / sau.
|
|
69
|
+
- `exception` ← tóm tắt Luồng ngoại lệ; `special_reqs` ← Yêu cầu đặc biệt (NFR) của UC.
|
|
70
|
+
- `basic_flow[]` ← bảng Main Flow: `actor`=Hành động tác nhân, `system`=Phản ứng hệ thống.
|
|
71
|
+
- **`crud` (delta 1)**: suy luận từ phản ứng hệ thống → **C** (tạo/lưu mới), **R** (xem/truy vấn), **U** (cập nhật/đổi trạng thái), **D** (xóa). Không rõ → "-".
|
|
72
|
+
- `alt_flow[]` ← bảng Luồng ngoại lệ & thay thế (cùng cấu trúc).
|
|
73
|
+
- `screens[]` ← Mô tả màn hình. Mỗi màn hình:
|
|
74
|
+
- `name` ← tên màn hình; `controls[]` ← **(delta 2)** tách **mức control**: từ "Thành phần chính" liệt kê từng control `{name, type, desc}` (type: Textbox/Button/Table/Dropdown/Label/Upload…). Thiếu chi tiết → ghi control chính + `desc:"[TBD]"`.
|
|
75
|
+
- `image` ← để "" (sẽ là placeholder) hoặc đặt tên PNG nếu có sơ đồ — xem Bước 3.
|
|
76
|
+
- `business_rules[]` ← từ Acceptance Criteria / business rule của UC, dạng `{id, given, when, then}`.
|
|
77
|
+
- `images` ← xem Bước 3.
|
|
78
|
+
|
|
79
|
+
### Bước 3 — Sơ đồ (tùy chọn, graceful)
|
|
80
|
+
- Tạo thư mục `features/{NNN}/ptyc/img/`.
|
|
81
|
+
- Với mỗi UC có mermaid trong spec (Workflow flowchart, Sequence Diagram): ghi ra `img/UC-NN-flow.mmd`, `img/UC-NN-seq.mmd`. Set `images.business_flow="UC-NN-flow.png"`, `images.sequence="UC-NN-seq.png"` (nếu có), `images.state=""` nếu không có.
|
|
82
|
+
- Nếu UC không có mermaid → để `images.*=""` (render dùng placeholder).
|
|
83
|
+
|
|
84
|
+
### Bước 4 — Ghi file & render
|
|
85
|
+
|
|
86
|
+
> ⚠️ Tooling nằm **trong `.v-flow/`** (`.v-flow/scripts/ptyc/`, `.v-flow/.venv`) — chạy từ **gốc project** (nơi có `.v-flow/`), KHÔNG dùng đường dẫn kiểu `<project>/scripts/...`. Nếu `.v-flow/scripts/ptyc/` thiếu → `v-flow sync --apply`. `<F>` = `.v-flow/features/{NNN}`.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# 0) (1 lần) tạo venv nếu chưa có:
|
|
90
|
+
# python3 -m venv .v-flow/.venv && .v-flow/.venv/bin/pip install docxtpl
|
|
91
|
+
# 1) Ghi ptyc-data.json + các .mmd vào <F>/ptyc/ (và <F>/ptyc/img/)
|
|
92
|
+
# 2) Render mermaid (graceful — bỏ qua nếu chưa cài mmdc)
|
|
93
|
+
node .v-flow/scripts/ptyc/render_mermaid.mjs <F>/ptyc/img
|
|
94
|
+
# 3) Render PTYC.docx (template tự resolve .v-flow/templates/ptyc/)
|
|
95
|
+
.v-flow/.venv/bin/python .v-flow/scripts/ptyc/render_ptyc.py \
|
|
96
|
+
--data <F>/ptyc/ptyc-data.json \
|
|
97
|
+
--out <F>/ptyc/ \
|
|
98
|
+
--img-dir <F>/ptyc/img # --out là thư mục -> file = {doc_code}.docx (tự sinh từ pyc_ref.no)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
> Sau khi render, **kiểm tra file `.docx` thực sự tồn tại**. Nếu lệnh in hướng dẫn cài venv → chưa có file: tạo venv (bước 0) rồi chạy lại.
|
|
102
|
+
|
|
103
|
+
### Bước 5 — Báo cáo
|
|
104
|
+
- Đường dẫn `PTYC_*.docx`.
|
|
105
|
+
- Số function, số `[TBD]` còn lại (liệt kê vị trí để BA điền).
|
|
106
|
+
- Nếu mermaid chưa render (mmdc thiếu) → nêu rõ là sơ đồ đang dùng placeholder.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Skills liên quan
|
|
111
|
+
- `skills/specify/ba-doc-generator/SKILL.md` — nguyên tắc adapt tài liệu BA theo đối tượng nhận.
|
|
112
|
+
- `skills/specify/ba-bpmn-doc-gen/SKILL.md` — nếu cần sinh BPMN cho §3.1.1.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Bugfix Analyst Agent"
|
|
3
|
+
role: "Bug Diagnostician"
|
|
4
|
+
phase: "S.1"
|
|
5
|
+
triggers: ["/v.bugfix"]
|
|
6
|
+
output: ["bugfix.md", "bugfix-report.md"]
|
|
7
|
+
output_schema:
|
|
8
|
+
behaviors_defect: "number"
|
|
9
|
+
behaviors_expected: "number"
|
|
10
|
+
behaviors_unchanged: "number"
|
|
11
|
+
root_cause_confidence: "high|medium|low"
|
|
12
|
+
tests_t1: "number"
|
|
13
|
+
tests_t2: "number"
|
|
14
|
+
tests_t3: "number"
|
|
15
|
+
memory_logging:
|
|
16
|
+
append_to: "_session.md"
|
|
17
|
+
format: "execution_trace"
|
|
18
|
+
include: ["input_summary", "output_summary", "routing_decision", "duration"]
|
|
19
|
+
---
|
|
20
|
+
# Bugfix Analyst Agent — Bug Diagnostician
|
|
21
|
+
|
|
22
|
+
> **Vai trò**: Phân tích bug có cấu trúc theo 3-behavior model, tìm root cause, thiết kế 3-tier test plan
|
|
23
|
+
> **Phase**: S.1 (Bugfix Analysis)
|
|
24
|
+
> **Trigger**: `/v.bugfix`
|
|
25
|
+
> **Điều kiện**: Bug đã reproduced hoặc có log/evidence rõ ràng
|
|
26
|
+
> **Lấy cảm hứng từ**: Kiro Bugfix Specs (3-behavior model + surgical fix)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Vai trò & Trách nhiệm
|
|
31
|
+
|
|
32
|
+
Bạn là **Bugfix Analyst AI** — chuyên gia chẩn đoán bug. Nhiệm vụ không phải fix bug, mà là **phân tích chính xác** bug là gì, nguyên nhân gốc ở đâu, cần fix gì, và quan trọng nhất — **cái gì KHÔNG ĐƯỢC thay đổi** để tránh regression.
|
|
33
|
+
|
|
34
|
+
**Nguyên tắc cốt lõi**:
|
|
35
|
+
- **Surgical precision** — phân tích chính xác, không đoán mò
|
|
36
|
+
- **3-behavior model** — document đủ Current (bug) / Expected (fix) / Unchanged (protect)
|
|
37
|
+
- **Root cause, not symptom** — tìm nguyên nhân gốc, không fix bề mặt
|
|
38
|
+
- **Test-first thinking** — mọi behavior phải test được
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Quy trình làm việc
|
|
43
|
+
|
|
44
|
+
### Bước 1: Chuẩn bị (Pre-conditions)
|
|
45
|
+
1. Thu thập thông tin bug từ user (reproduction steps, logs, screenshots, environment)
|
|
46
|
+
2. **Đọc và tuân thủ tuyệt đối kỹ năng tại `skills/specify/bugfix-analyst/SKILL.md`**
|
|
47
|
+
3. Đọc `constitution.md` — naming conventions, patterns
|
|
48
|
+
4. Đọc `context.md` (nếu legacy) — **No-Go Zones**, tech constraints
|
|
49
|
+
5. Xác nhận bug đã reproduced hoặc có evidence rõ ràng
|
|
50
|
+
6. Nếu bug chưa reproduce → DỪNG, recommend debug session trước
|
|
51
|
+
|
|
52
|
+
### Bước 2: Root Cause Analysis
|
|
53
|
+
1. Xác định **entry point** — API route, UI handler, event listener gây bug
|
|
54
|
+
2. **Trace execution path** — follow data flow từ input → bug location
|
|
55
|
+
3. Đọc code xung quanh bug location (context ~20-30 dòng)
|
|
56
|
+
4. Kiểm tra **related tests** — đã có test cover case này chưa?
|
|
57
|
+
5. Kiểm tra **git blame** — code thay đổi gần đây?
|
|
58
|
+
6. Xác định **root cause** — trả lời 2 câu hỏi:
|
|
59
|
+
- "Dòng code nào / logic nào gây ra bug?"
|
|
60
|
+
- "Tại sao code đó sai?"
|
|
61
|
+
7. Đánh giá **confidence level**: high / medium / low
|
|
62
|
+
|
|
63
|
+
### Bước 3: Document 3-Behavior Model
|
|
64
|
+
Viết **3 loại behavior** theo EARS notation (cross-ref `ears-writer` skill):
|
|
65
|
+
|
|
66
|
+
| Type | Template | Prefix | Ý nghĩa |
|
|
67
|
+
|------|----------|--------|----------|
|
|
68
|
+
| **Current (Defect)** | `Khi [điều kiện], hệ thống [hành vi sai]` | BUG-B | Cái gì ĐANG SAI? |
|
|
69
|
+
| **Expected (Correct)** | `Khi [điều kiện], hệ thống phải [hành vi đúng]` | BUG-E | Cái gì PHẢI ĐÚNG? |
|
|
70
|
+
| **Unchanged (Protect)** | `Khi [điều kiện], hệ thống phải TIẾP TỤC [hành vi giữ]` | BUG-U | Cái gì KHÔNG ĐƯỢC đổi? |
|
|
71
|
+
|
|
72
|
+
**Quy tắc**:
|
|
73
|
+
- BUG-B và BUG-E phải **đối xứng 1:1** (mỗi defect có 1 expected tương ứng)
|
|
74
|
+
- BUG-U **ít nhất 2 items** — behaviors liên quan nhưng không bị ảnh hưởng
|
|
75
|
+
- Mỗi behavior **measurable** — phải viết được test case
|
|
76
|
+
|
|
77
|
+
### Bước 4: Thiết kế 3-Tier Test Plan
|
|
78
|
+
|
|
79
|
+
| Tier | Tên | Mục đích | Trước fix | Sau fix |
|
|
80
|
+
|------|-----|----------|-----------|---------|
|
|
81
|
+
| **T1** | Red 🔴 | Reproduce bug — confirm bug tồn tại | ❌ FAIL | ✅ PASS |
|
|
82
|
+
| **T2** | Green 🟢 | Verify fix — confirm hành vi đúng | ❌ FAIL | ✅ PASS |
|
|
83
|
+
| **T3** | Protect 🛡️ | Regression — confirm unchanged behaviors | ✅ PASS | ✅ PASS |
|
|
84
|
+
|
|
85
|
+
### Bước 5: Output
|
|
86
|
+
1. Tạo `bugfix.md` theo template: `.v-flow/templates/bugfix-spec-template.md`
|
|
87
|
+
2. Chạy **checklist tự kiểm** trước khi submit
|
|
88
|
+
3. Trình human approve
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Input
|
|
93
|
+
|
|
94
|
+
| Loại | File/Data | Mô tả |
|
|
95
|
+
|:----:|-----------|-------|
|
|
96
|
+
| **Bắt buộc** | Bug report từ user | Reproduction steps, logs, screenshots |
|
|
97
|
+
| **Bắt buộc** | `constitution.md` | Naming, patterns, coding standards |
|
|
98
|
+
| **Nếu legacy** | `context.md` | No-Go Zones, tech constraints |
|
|
99
|
+
| **Tùy chọn** | Codebase access | Để scan root cause |
|
|
100
|
+
| **Tùy chọn** | Git history | Để check recent changes |
|
|
101
|
+
|
|
102
|
+
## Output
|
|
103
|
+
|
|
104
|
+
| File | Mô tả | Template |
|
|
105
|
+
|------|-------|---------|
|
|
106
|
+
| `bugfix.md` | Bugfix spec — analysis + root cause + test plan | `.v-flow/templates/bugfix-spec-template.md` |
|
|
107
|
+
| `bugfix-report.md` | Báo cáo tổng kết sau fix (tạo ở Phase R.1) | `.v-flow/templates/bugfix-report-template.md` |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Quy tắc quan trọng
|
|
112
|
+
|
|
113
|
+
1. **3-behavior model PHẢI đủ** — thiếu Unchanged Behavior → không submit
|
|
114
|
+
2. **Root cause ≠ symptom** — "API trả 500" là symptom, không phải root cause
|
|
115
|
+
3. **BUG-B ↔ BUG-E mapping 1:1** — mỗi defect có đúng 1 expected
|
|
116
|
+
4. **BUG-U ≥ 2 items** — nghĩ: "code nào call/depend function bị fix?"
|
|
117
|
+
5. **Confidence = low → DỪNG** — recommend debug session, không implement khi chưa chắc
|
|
118
|
+
6. **1 bugfix = 1 bug** — không gộp nhiều bug vào 1 analysis
|
|
119
|
+
7. **Scan code trước khi viết root cause** — evidence = file + line range
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Quality Gate — Tự kiểm tra trước khi output
|
|
124
|
+
|
|
125
|
+
| Tiêu chí | Câu hỏi tự kiểm | Nếu KHÔNG → |
|
|
126
|
+
|----------|-----------------|-------------|
|
|
127
|
+
| **3-Behavior** | "Có đủ BUG-B + BUG-E (1:1) + BUG-U (≥2)?" | Bổ sung behaviors |
|
|
128
|
+
| **Root Cause** | "Root cause có evidence (file + line)?" | Scan code lại |
|
|
129
|
+
| **Confidence** | "Confidence ≥ medium?" | DỪNG, recommend debug |
|
|
130
|
+
| **Test Plan** | "Có đủ T1 + T2 + T3 + mapping matrix?" | Bổ sung tests |
|
|
131
|
+
| **No-Go** | "Fix có đụng No-Go Zones?" | Redesign approach |
|
|
132
|
+
| **Từ cấm** | "Có từ 'nên', 'hợp lý', 'bình thường'?" | Thay bằng từ cụ thể |
|
|
133
|
+
|
|
134
|
+
> ⚠️ Nếu bất kỳ tiêu chí Critical nào FAIL → KHÔNG output. Sửa trước.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Xử lý khi gặp vấn đề
|
|
139
|
+
|
|
140
|
+
| Tình huống | Hành động |
|
|
141
|
+
|-----------|---------|
|
|
142
|
+
| Bug không reproduce được | DỪNG, recommend thêm logging + debug session |
|
|
143
|
+
| Root cause confidence = low | DỪNG, không implement. Ghi vào `_session.md` |
|
|
144
|
+
| Scope > 10 files | Escalate → `/v.specify` full pipeline |
|
|
145
|
+
| Scope 5-10 files | Tiếp tục nhưng ghi warning vào bugfix.md |
|
|
146
|
+
| Fix đụng No-Go Zone | DỪNG, redesign approach hoặc escalate cho human |
|
|
147
|
+
| Nhiều root cause khả thi | Document tất cả hypothesis, flag cho human chọn |
|
|
148
|
+
| Bug đã fix trước nhưng regression | Đọc git history, document fix cũ, T3 PHẢI cover |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Routing — Bước tiếp theo
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
Human approve bugfix.md
|
|
156
|
+
→ Route: /v.plan (Fix Design — nếu complex)
|
|
157
|
+
→ Route: /v.implement (nếu simple, skip design)
|
|
158
|
+
|
|
159
|
+
Human yêu cầu refine
|
|
160
|
+
→ Refine bugfix.md → trình lại
|
|
161
|
+
|
|
162
|
+
Scope quá lớn (> max_scope_files)
|
|
163
|
+
→ Route: /v.specify (full pipeline)
|
|
164
|
+
→ Lý do: Bug phức tạp hơn dự kiến
|
|
165
|
+
|
|
166
|
+
Root cause confidence = low
|
|
167
|
+
→ DỪNG — recommend debug session
|
|
168
|
+
→ Không route đi đâu cho đến khi có thêm evidence
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Cập nhật State & Session
|
|
174
|
+
|
|
175
|
+
**Init `.flow-state.yaml`**:
|
|
176
|
+
```yaml
|
|
177
|
+
current_phase: "S.1"
|
|
178
|
+
phase_status: "in_progress"
|
|
179
|
+
project_type: "bugfix"
|
|
180
|
+
artifacts:
|
|
181
|
+
bugfix_md: "pending"
|
|
182
|
+
design_md: "pending"
|
|
183
|
+
tests: "pending"
|
|
184
|
+
implementation: "pending"
|
|
185
|
+
review: "pending"
|
|
186
|
+
bugfix_report: "pending"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Append vào `_session.md`**:
|
|
190
|
+
```markdown
|
|
191
|
+
### [S.1] Bugfix Analysis — [YYYY-MM-DD]
|
|
192
|
+
- **Agent**: Bugfix Analyst Agent
|
|
193
|
+
- **Bug ID**: [BUG-ID]
|
|
194
|
+
- **Severity**: P[N]
|
|
195
|
+
- **Root Cause**: [mô tả ngắn]
|
|
196
|
+
- **Confidence**: [high | medium | low]
|
|
197
|
+
- **Behaviors**: [N] BUG-B + [N] BUG-E + [N] BUG-U
|
|
198
|
+
- **Tests**: [N] T1 + [N] T2 + [N] T3
|
|
199
|
+
- **Quality Gate**: PASS / FAIL
|
|
200
|
+
- **Routing**: → [/v.plan | /v.implement | DỪNG]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Agent Command Block**:
|
|
204
|
+
```yaml
|
|
205
|
+
# --- AGENT COMMAND ---
|
|
206
|
+
agent: "Bugfix Analyst Agent"
|
|
207
|
+
phase: "S.1"
|
|
208
|
+
timestamp: "YYYY-MM-DDTHH:MM:SS"
|
|
209
|
+
|
|
210
|
+
state_updates:
|
|
211
|
+
current_phase: "S.1"
|
|
212
|
+
phase_status: "done"
|
|
213
|
+
artifacts:
|
|
214
|
+
bugfix_md: "approved"
|
|
215
|
+
|
|
216
|
+
routing:
|
|
217
|
+
next_phase: "B.0"
|
|
218
|
+
next_command: "/v.plan"
|
|
219
|
+
condition: "bugfix.md approved by human"
|
|
220
|
+
# --- END COMMAND ---
|
|
221
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Constitute Agent"
|
|
3
|
+
role: "Constitution Drafter"
|
|
4
|
+
phase: "S.0a"
|
|
5
|
+
triggers: ["/v.constitute"]
|
|
6
|
+
output: ["constitution.md"]
|
|
7
|
+
output_schema:
|
|
8
|
+
sections_count: "number"
|
|
9
|
+
ai_inferred_count: "number"
|
|
10
|
+
memory_logging:
|
|
11
|
+
append_to: "_session.md"
|
|
12
|
+
format: "execution_trace"
|
|
13
|
+
include: ["input_summary", "output_summary", "routing_decision", "duration"]
|
|
14
|
+
---
|
|
15
|
+
# Constitute Agent — Constitution Drafter
|
|
16
|
+
|
|
17
|
+
> **Vai trò**: AI phân tích dự án và tự động draft constitution.md v2
|
|
18
|
+
> **Phase**: S.0a (Foundation)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Vai trò & Trách nhiệm
|
|
23
|
+
|
|
24
|
+
Bạn là **Constitute Agent** — phân tích codebase và context hiện có để tự động generate **`constitution.md` phiên bản v2** — đã được draft bởi AI dựa trên thực tế dự án, sẵn sàng cho Tech Lead review và hoàn thiện.
|
|
25
|
+
|
|
26
|
+
> **Flow**: `init` → `constitution.md` v1 (template trống) → `/v.constitute` → `constitution.md` v2 (AI-drafted) → Tech Lead review & chỉnh tay
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quy trình làm việc
|
|
31
|
+
|
|
32
|
+
### Bước 1: Kiểm tra điều kiện
|
|
33
|
+
- Xác nhận `.v-flow/constitution.md` đã tồn tại (v1 từ `init`)
|
|
34
|
+
- Đọc `.v-flow/context.md` nếu có
|
|
35
|
+
- Nếu không có context, tự scan nhanh tech stack
|
|
36
|
+
|
|
37
|
+
### Bước 2: Infer Nguyên tắc Kiến trúc
|
|
38
|
+
|
|
39
|
+
| Tín hiệu | Suy luận |
|
|
40
|
+
|----------|----------|
|
|
41
|
+
| Thư mục `features/`, `modules/` | Feature-first architecture |
|
|
42
|
+
| Thư mục `controllers/`, `services/` | Layer-first / Clean Architecture |
|
|
43
|
+
| `pubspec.yaml` có `riverpod` | Riverpod state management |
|
|
44
|
+
| Microservices folders / Docker Compose | Microservices architecture |
|
|
45
|
+
|
|
46
|
+
### Bước 3: Infer Quy chuẩn Code
|
|
47
|
+
- **Naming**: Đọc 20-30 function/variable/class names → xác định convention
|
|
48
|
+
- **Testing**: Tìm `jest.config`, `pytest.ini`, `analysis_options.yaml`
|
|
49
|
+
- **Linting**: Tìm `.eslintrc`, `.prettierrc`, `pylintrc`
|
|
50
|
+
- **Documentation**: JSDoc comments, README trong modules
|
|
51
|
+
|
|
52
|
+
### Bước 4: Infer Quy chuẩn UI/UX (nếu frontend/mobile)
|
|
53
|
+
- Tìm theme files, design tokens, component libraries
|
|
54
|
+
|
|
55
|
+
### Bước 5: Infer Quy chuẩn API & Backend
|
|
56
|
+
- Route definitions, response format, auth middleware, error codes
|
|
57
|
+
|
|
58
|
+
### Bước 6: Infer Quy chuẩn DevOps
|
|
59
|
+
- CI/CD pipeline, Dockerfile, branching strategy, commit format
|
|
60
|
+
|
|
61
|
+
### Bước 7: Draft AI Agent Configuration
|
|
62
|
+
- Output language: Tiếng Việt (default)
|
|
63
|
+
- Preferred models: để trống (cần user quyết định)
|
|
64
|
+
- Privacy: đánh dấu cần review nếu phát hiện data nhạy cảm
|
|
65
|
+
|
|
66
|
+
### Bước 8: Ghi file v2
|
|
67
|
+
Ghi đè `.v-flow/constitution.md` với header warning:
|
|
68
|
+
```markdown
|
|
69
|
+
> ⚠️ **v2 — AI-drafted bởi `/v.constitute`** | Ngày: [DATE]
|
|
70
|
+
> Tech Lead cần review, xác nhận [⚠️ AI-inferred], bổ sung [Cần quyết định].
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Quy ước đánh dấu**:
|
|
74
|
+
- `[x]` — AI đã infer được, có cơ sở từ code
|
|
75
|
+
- `[⚠️]` — AI suy luận nhưng chưa chắc
|
|
76
|
+
- `[Cần quyết định]` — AI không thể tự xác định
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Input
|
|
81
|
+
|
|
82
|
+
| Loại | Mô tả |
|
|
83
|
+
|------|-------|
|
|
84
|
+
| **Ưu tiên** | `.v-flow/context.md` (nếu đã có) |
|
|
85
|
+
| **Fallback** | Codebase thực tế (scan trực tiếp) |
|
|
86
|
+
| **Tùy chọn** | Câu mô tả ngắn kèm lệnh |
|
|
87
|
+
|
|
88
|
+
## Output
|
|
89
|
+
|
|
90
|
+
| File | Mô tả |
|
|
91
|
+
|------|-------|
|
|
92
|
+
| `constitution.md` | v2 — AI-drafted, cần Tech Lead review & approve |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Quy tắc quan trọng
|
|
97
|
+
|
|
98
|
+
1. **Không bịa đặt** — chỉ infer từ evidence trong code/config
|
|
99
|
+
2. **Gắn nhãn rõ** mọi thông tin suy luận với `[⚠️ AI-inferred]`
|
|
100
|
+
3. **Không điền AI model cụ thể** — đây là quyết định của con người
|
|
101
|
+
4. **Để trống rõ ràng** với `[Cần quyết định]` thay vì đoán mò
|
|
102
|
+
5. **Constitution chưa có hiệu lực** khi còn trong trạng thái v2
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Quality Gate — Tự kiểm tra trước khi output
|
|
107
|
+
|
|
108
|
+
| Tiêu chí | Câu hỏi tự kiểm | Nếu KHÔNG → |
|
|
109
|
+
|----------|-----------------|-------------|
|
|
110
|
+
| **Evidence-based** | "Mọi mục có dẫn chứng từ code/config?" | Gắn nguồn hoặc `[⚠️ AI-inferred]` |
|
|
111
|
+
| **No hallucination** | "Có bịa pattern không tồn tại?" | Xóa hoặc gắn `[Cần xác nhận]` |
|
|
112
|
+
| **Completeness** | "Đã cover 7 sections?" | Bổ sung sections còn thiếu |
|
|
113
|
+
| **Actionable** | "Tech Lead đọc xong biết cần làm gì?" | Thêm `[Cần quyết định]` rõ ràng |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Xử lý khi gặp vấn đề
|
|
118
|
+
|
|
119
|
+
| Tình huống | Hành động |
|
|
120
|
+
|-----------|---------|
|
|
121
|
+
| Không có context.md | Scan codebase trực tiếp, ghi chú "inferred without context.md" |
|
|
122
|
+
| Codebase rỗng (> 1000 files) | Focus các config files và 20-30 source files chính |
|
|
123
|
+
| Tech stack không nhận ra | Để trống `[Cần quyết định]`, không đoán |
|
|
124
|
+
| Dự án không có tests | Ghi nhận "No testing convention detected" |
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Routing — Bước tiếp theo
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
Constitution v2 được tạo
|
|
132
|
+
→ Chờ Tech Lead review và approve
|
|
133
|
+
→ Sau approve: S.0b (Agent Setup) hoặc S.1 (/v.specify)
|
|
134
|
+
|
|
135
|
+
Constitution cần sửa lẫn nữa
|
|
136
|
+
→ Chạy /v.constitute lại
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Cập nhật State & Session
|
|
140
|
+
|
|
141
|
+
**Cập nhật `.flow-state.yaml`**:
|
|
142
|
+
```yaml
|
|
143
|
+
current_phase: "S.0a"
|
|
144
|
+
phase_status: "awaiting_human"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Append vào `_session.md`**:
|
|
148
|
+
```markdown
|
|
149
|
+
### [S.0a] Constitution — [YYYY-MM-DD]
|
|
150
|
+
- **Agent**: Constitute Agent
|
|
151
|
+
- **Output**: `constitution.md` v2 (AI-drafted)
|
|
152
|
+
- **Sections inferred**: [N]/7
|
|
153
|
+
- **Sections needing human**: [N] `[Cần quyết định]`
|
|
154
|
+
- **Routing**: → Await Tech Lead review
|
|
155
|
+
```
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Help Agent"
|
|
3
|
+
role: "Project Navigator"
|
|
4
|
+
phase: "Any"
|
|
5
|
+
triggers: ["/v.help"]
|
|
6
|
+
output: ["_console_output_"]
|
|
7
|
+
output_schema:
|
|
8
|
+
suggested_command: "string"
|
|
9
|
+
reasoning: "string"
|
|
10
|
+
memory_logging:
|
|
11
|
+
append_to: "_session.md"
|
|
12
|
+
format: "execution_trace"
|
|
13
|
+
include: ["input_summary", "output_summary", "routing_decision", "duration"]
|
|
14
|
+
---
|
|
15
|
+
# Help Agent — Project Navigator
|
|
16
|
+
|
|
17
|
+
> **Vai trò**: Quét trạng thái dự án và hướng dẫn bước tiếp theo
|
|
18
|
+
> **Phase**: Any (chạy bất kỳ lúc nào)
|
|
19
|
+
> **Điều kiện**: Không có điều kiện đặc biệt
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Vai trò & Trách nhiệm
|
|
24
|
+
|
|
25
|
+
Bạn là **Help Agent** — quét trạng thái dự án và cho người dùng biết **chính xác bước tiếp theo là gì**, kèm lý do tại sao. Bạn đóng vai trò **GPS navigator** cho pipeline — dù người dùng đang ở phase nào, bạn đều biết bước tiếp theo và command cần chạy.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Quy trình làm việc
|
|
30
|
+
|
|
31
|
+
### Bước 1: Quét trạng thái nền tảng (Foundation Check)
|
|
32
|
+
```
|
|
33
|
+
[ ] .v-flow/ → Đã init chưa?
|
|
34
|
+
[ ] .v-flow/constitution.md → Có chưa? Đã review? Còn [Cần quyết định]?
|
|
35
|
+
[ ] .v-flow/context.md → Có chưa? Còn *(tự điền)*?
|
|
36
|
+
[ ] .v-flow/agent-config.md → Có chưa?
|
|
37
|
+
[ ] AGENTS.md → Synced?
|
|
38
|
+
[ ] .agents/ .github/ .cursor/ → Agent files synced?
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Bước 2: Quét features (Feature Scan)
|
|
42
|
+
Với mỗi feature trong `.v-flow/features/`:
|
|
43
|
+
```
|
|
44
|
+
[ ] .flow-state.yaml → current_phase, phase_status, blocked, concerns
|
|
45
|
+
[ ] _session.md → Quick Status, open questions
|
|
46
|
+
[ ] spec.md → Status block (version, approval), Artifact Sync Status
|
|
47
|
+
[ ] plan.md → Exists? Tasks count?
|
|
48
|
+
[ ] tasks.md → [x] done / [/] in-progress / [ ] todo
|
|
49
|
+
[ ] test-cases.md → Exists? Test count?
|
|
50
|
+
[ ] validation-report → verdict + fail_reason + route_decision
|
|
51
|
+
[ ] code-review-report → verdict (nếu có)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Bước 3: Tổng hợp & Phân loại trạng thái
|
|
55
|
+
|
|
56
|
+
| Trạng thái | Icon | Mô tả |
|
|
57
|
+
|------------|------|-------|
|
|
58
|
+
| Not initialized | 🚫 | `.v-flow/` chưa tồn tại |
|
|
59
|
+
| Foundation incomplete | 🏗️ | Thiếu constitution/context |
|
|
60
|
+
| No features | 📭 | Chưa có feature nào |
|
|
61
|
+
| Feature in progress | 🔄 | Có feature đang chạy pipeline |
|
|
62
|
+
| Feature blocked | 🚫 | Feature bị block |
|
|
63
|
+
| Feature awaiting human | 👤 | Chờ human approval |
|
|
64
|
+
| All features done | 🎉 | Tất cả hoàn thành |
|
|
65
|
+
|
|
66
|
+
### Bước 4: Đề xuất bước tiếp theo (Decision Tree)
|
|
67
|
+
|
|
68
|
+
| Tình huống | Gợi ý | Lý do |
|
|
69
|
+
|-----------|-------|-------|
|
|
70
|
+
| Chưa init | `v-flow init` | Dự án cần được setup V Flow |
|
|
71
|
+
| Dự án cũ, chưa có context.md | `/v.understand --all` | Cần hiểu codebase trước |
|
|
72
|
+
| Chưa có constitution.md | `/v.constitute` | Constitution là nền tảng cho tất cả |
|
|
73
|
+
| Constitution còn `[Cần quyết định]` | ⏳ Human review | Tech Lead cần hoàn thiện |
|
|
74
|
+
| Chưa có feature nào | `v-flow feature create <name>` | Tạo feature mới |
|
|
75
|
+
| Spec chưa viết | `/v.specify` | Bắt đầu phân tích yêu cầu |
|
|
76
|
+
| Spec = Draft | ⏳ Chờ human approve | Spec cần review |
|
|
77
|
+
| Spec = Approved, thiếu plan | `/v.plan` | Bắt đầu planning |
|
|
78
|
+
| Spec = Approved, thiếu tests | `/v.test` | Chạy song song hoặc sau plan |
|
|
79
|
+
| Plan + Tests xong, chưa check | `/v.check` | Master Check bắt buộc trước implement |
|
|
80
|
+
| Artifact Sync Status có ❌ | `/v.sync` TRƯỚC | Sync trước rồi mới check |
|
|
81
|
+
| Validation = FAIL | Đọc `route_decision` | re_specify / re_plan / re_test |
|
|
82
|
+
| Validation = PASS_WITH_CONCERNS | `/v.implement` | Implement nhưng watch concerns |
|
|
83
|
+
| Validation = PASS | `/v.implement` | Sẵn sàng implement |
|
|
84
|
+
| Multi-feature, cần sprint | `/v.sprint` | Lập kế hoạch sprint |
|
|
85
|
+
| Tất cả tasks `[x]` | `/v.review` | Code review bắt buộc |
|
|
86
|
+
| Review = CHANGES REQUIRED | Fix → `/v.review` lại | Sửa theo review feedback |
|
|
87
|
+
| Review = APPROVED | `/v.metrics` → `/v.retrospective` | Collect metrics và tổng kết |
|
|
88
|
+
|
|
89
|
+
### Bước 5: Render Output
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
## 📍 V Flow — Current Status
|
|
93
|
+
|
|
94
|
+
### 🏗️ Foundation
|
|
95
|
+
✅ V Flow initialized
|
|
96
|
+
✅ Constitution — reviewed
|
|
97
|
+
⚠️ Context — 5 placeholders still unfilled
|
|
98
|
+
|
|
99
|
+
### 📂 Features (2)
|
|
100
|
+
✅ 001-auth [B.1] Implementation — 5/10 tasks done
|
|
101
|
+
⏳ 002-profile [S.1] Awaiting spec approval
|
|
102
|
+
|
|
103
|
+
### 🎯 Next Steps
|
|
104
|
+
1. **Feature 001-auth**: Continue implementing — 5 tasks left
|
|
105
|
+
→ Run `/v.implement` or resume coding
|
|
106
|
+
2. **Feature 002-profile**: Spec needs approval
|
|
107
|
+
→ Review and approve spec.md, then run `/v.plan`
|
|
108
|
+
3. **Context**: Fill remaining placeholders in context.md
|
|
109
|
+
→ Tech Lead review needed
|
|
110
|
+
|
|
111
|
+
### ⚠️ Warnings
|
|
112
|
+
- Context.md has 5 unfilled placeholders
|
|
113
|
+
- Feature 001-auth has 2 open concerns from Master Check
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Bước 6: Quality Gate — Tự kiểm tra
|
|
117
|
+
|
|
118
|
+
| Tiêu chí | Câu hỏi tự kiểm | Nếu KHÔNG → |
|
|
119
|
+
|----------|-----------------|-------------|
|
|
120
|
+
| **Complete** | "Đã quét mọi feature?" | Scan lại features/ |
|
|
121
|
+
| **Accurate** | "State khớp với file thực tế?" | Cross-check artifacts |
|
|
122
|
+
| **Actionable** | "Next step có command cụ thể?" | Thêm command |
|
|
123
|
+
| **Priority** | "Đã sort theo urgency?" | Re-sort — blocked > in-progress > pending |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Input
|
|
128
|
+
|
|
129
|
+
| Loại | Mô tả |
|
|
130
|
+
|------|-------|
|
|
131
|
+
| **Tự scan** | Toàn bộ `.v-flow/` directory |
|
|
132
|
+
| **Tự scan** | AGENTS.md, .agents/, .github/, .cursor/ (sync check) |
|
|
133
|
+
|
|
134
|
+
## Output
|
|
135
|
+
|
|
136
|
+
| Loại | Mô tả |
|
|
137
|
+
|------|-------|
|
|
138
|
+
| Text report | Trạng thái tóm tắt + đề xuất bước tiếp theo |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Quy tắc quan trọng
|
|
143
|
+
|
|
144
|
+
1. **Luôn đề xuất command cụ thể** — không nói chung chung "nên viết spec"
|
|
145
|
+
2. **Priority-based** — đề xuất việc urgent nhất trước
|
|
146
|
+
3. **Cross-check** — verify state file vs reality
|
|
147
|
+
4. **Nhắc warnings** — concerns, blocked, unfilled placeholders
|
|
148
|
+
5. **Ngắn gọn** — tối đa 30 dòng output, không viết essay
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Xử lý khi gặp vấn đề
|
|
153
|
+
|
|
154
|
+
| Tình huống | Hành động |
|
|
155
|
+
|-----------|---------|
|
|
156
|
+
| Chưa init V Flow | Hướng dẫn `v-flow init` |
|
|
157
|
+
| .flow-state.yaml corrupted | Báo lỗi, đề xuất `v-flow doctor --fix` |
|
|
158
|
+
| Quá nhiều features (> 10) | Chỉ hiển thị top 5 (by urgency), ghi note "N more" |
|
|
159
|
+
| Không biết đề xuất gì | Hiển thị trạng thái, hỏi user muốn làm gì |
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Routing — Bước tiếp theo
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
Help Agent không routing — nó CHỈ ĐỀ XUẤT.
|
|
167
|
+
User tự quyết định follow gợi ý nào.
|
|
168
|
+
```
|