@relipa/ai-flow-kit 0.1.5-beta.1 → 0.1.6
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/bin/aiflow.js +34 -0
- package/custom/rules/ml-conventions.md +11 -8
- package/custom/rules/project-conventions.md +30 -14
- package/custom/skills/design-experiment/SKILL.md +2 -2
- package/custom/skills/evaluate-model/SKILL.md +2 -2
- package/custom/skills/explore-data/SKILL.md +1 -1
- package/custom/skills/figma-to-component/SKILL.md +222 -20
- package/custom/skills/frame-ml-problem/SKILL.md +1 -1
- package/custom/skills/gate-review/SKILL.md +1 -1
- package/custom/skills/generate-spec/SKILL.md +22 -3
- package/custom/skills/read-study-requirement/SKILL.md +74 -6
- package/custom/skills/review-plan/SKILL.md +26 -3
- package/custom/templates/shared/coding-workflow.md +0 -0
- package/custom/templates/shared/create-spec-workflow.md +55 -0
- package/custom/templates/shared/create-testcase-workflow.md +55 -0
- package/custom/templates/shared/gate-workflow.md +131 -19
- package/custom/templates/shared/ml-gate-workflow.md +16 -9
- package/custom/templates/tools/claude.md +1 -1
- package/custom/templates/tools/copilot.md +1 -1
- package/custom/templates/tools/cursor.md +1 -1
- package/custom/templates/tools/gemini.md +1 -1
- package/custom/templates/tools/generic.md +1 -1
- package/docs/common/AIFLOW.md +21 -11
- package/docs/common/CHANGELOG.md +43 -0
- package/docs/common/ai-integration.md +2 -2
- package/docs/common/cli-reference.md +3 -1
- package/docs/common/workflows/bug-fix.md +2 -2
- package/docs/common/workflows/feature.md +2 -2
- package/docs/common/workflows/figma.md +176 -105
- package/package.json +2 -2
- package/scripts/create-score-excel.js +135 -14
- package/scripts/detect.js +11 -0
- package/scripts/docs-branch.js +264 -0
- package/scripts/docs-repo.js +49 -0
- package/scripts/hooks/figma-rate-limit.js +83 -0
- package/scripts/hooks/session-start.js +49 -14
- package/scripts/init.js +33 -2
- package/scripts/link-resolver.js +0 -0
- package/scripts/prompt.js +56 -11
- package/scripts/task.js +39 -23
- package/scripts/update.js +4 -0
- package/scripts/use.js +6 -5
|
@@ -30,7 +30,7 @@ Check `mode` in `.aiflow/context/current.json` before starting:
|
|
|
30
30
|
|
|
31
31
|
## Fast Mode Output Rules (CRITICAL)
|
|
32
32
|
|
|
33
|
-
When creating `04.Coding/04.Reviews/[functionId]/[ticketId].md` during Gate 1:
|
|
33
|
+
When creating `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` during Gate 1:
|
|
34
34
|
- You must create the `summary.md` file after Gate 1 is APPROVED, to track session progress.
|
|
35
35
|
- Keep `summary.md` concise. Only include short bullet points tracking Gates.
|
|
36
36
|
- Do not write verbose implementation details in `summary.md` at Gate 1.
|
|
@@ -48,7 +48,7 @@ When creating `04.Coding/04.Reviews/[functionId]/[ticketId].md` during Gate 1:
|
|
|
48
48
|
3. Q&A: Ask at most **ONE** question if there is a blocking ambiguity.
|
|
49
49
|
If the ticket + source file names make intent clear → skip Q&A entirely.
|
|
50
50
|
Wait for answer before writing the requirement doc.
|
|
51
|
-
4. Output `04.Coding/01.Requirements/[functionId]/[ticketId].md` with **3 sections only**:
|
|
51
|
+
4. Output `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` with **3 sections only**:
|
|
52
52
|
|
|
53
53
|
```markdown
|
|
54
54
|
# Requirement: [Ticket ID] — [Title]
|
|
@@ -76,7 +76,9 @@ When creating `04.Coding/04.Reviews/[functionId]/[ticketId].md` during Gate 1:
|
|
|
76
76
|
|
|
77
77
|
5. Display Gate 1 prompt and wait for `APPROVED`.
|
|
78
78
|
|
|
79
|
-
> After APPROVED, proceed to Gate 2.
|
|
79
|
+
> After APPROVED, proceed to Gate 2.
|
|
80
|
+
> - **`gen-doc` tasks:** Gate 2 generates the output document immediately (no `plan.md`, no TDD). Self-review + task-summary.md are created automatically.
|
|
81
|
+
> - **All other tasks:** Gate 2 plan fills in the implementation details.
|
|
80
82
|
|
|
81
83
|
---
|
|
82
84
|
|
|
@@ -111,6 +113,63 @@ Do this investigation **before** asking any questions. Come prepared.
|
|
|
111
113
|
|
|
112
114
|
---
|
|
113
115
|
|
|
116
|
+
### Step 1.5: Detect & Read Figma Design (UI tickets only)
|
|
117
|
+
|
|
118
|
+
Run this only when the ticket touches UI. Skip entirely for non-UI tickets.
|
|
119
|
+
|
|
120
|
+
1. **Detect a Figma URL** in this order:
|
|
121
|
+
- `current.json` → `description`
|
|
122
|
+
- `current.json` → `supplementaryContext[]` items
|
|
123
|
+
- Pattern: `https://www.figma.com/design/<fileKey>/...?node-id=<nodeId>`
|
|
124
|
+
2. **No URL but ticket looks like UI** (mentions screen, page, component, layout, "theo design"):
|
|
125
|
+
ask the DEV **once** to paste a Figma URL. If DEV skips → write "Design: TBD" in the
|
|
126
|
+
Design Analysis section and continue. Do NOT ask again.
|
|
127
|
+
3. **URL found** → invoke `figma-to-component` Steps 0–2.5 (verify MCP, read design,
|
|
128
|
+
detect & export images). Then persist the shared artifact:
|
|
129
|
+
- Create `plan/[ticket-id]/design/`
|
|
130
|
+
- Save raw response to `plan/[ticket-id]/design/nodes.json` (cache for later gates)
|
|
131
|
+
- Save exported images to `plan/[ticket-id]/design/images/`
|
|
132
|
+
- Write `plan/[ticket-id]/design/figma-manifest.json` (nodeId → image file) — per-ticket,
|
|
133
|
+
NOT a shared global manifest
|
|
134
|
+
- Write `plan/[ticket-id]/design/design-context.md` using the template below
|
|
135
|
+
4. **Figma MCP not connected** → tell DEV to run `aiflow init -a figma` (or `-a figma-desktop`),
|
|
136
|
+
mark Design Analysis as "⚠️ pending MCP", and continue with the non-UI parts of the requirement.
|
|
137
|
+
Do NOT abort the ticket.
|
|
138
|
+
|
|
139
|
+
**`design-context.md` template:**
|
|
140
|
+
|
|
141
|
+
```markdown
|
|
142
|
+
# Design Context: [ticket-id]
|
|
143
|
+
|
|
144
|
+
**Figma URL:** <url> **fileKey:** xxx **nodeId:** 123-456
|
|
145
|
+
**Fetched:** [YYYY-MM-DD] **Adapter:** figma (REST) | figma-desktop
|
|
146
|
+
|
|
147
|
+
## 1. Layout Structure
|
|
148
|
+
- Node tree: Frame > Header / Body > Card[] / Footer
|
|
149
|
+
- Flex direction, gap, padding, alignment per region
|
|
150
|
+
|
|
151
|
+
## 2. Design Tokens
|
|
152
|
+
| Type | Figma value | Project token |
|
|
153
|
+
|------|-------------|---------------|
|
|
154
|
+
| Color | #3B82F6 | blue-500 / --color-primary |
|
|
155
|
+
| Type | 16/600 | text-base font-semibold |
|
|
156
|
+
| Space | 16px | p-4 / gap-4 |
|
|
157
|
+
|
|
158
|
+
## 3. Components to build
|
|
159
|
+
- [ ] UserCard (variants: default, hover) — nodeId 78-910
|
|
160
|
+
- [ ] Header — nodeId 12-3
|
|
161
|
+
|
|
162
|
+
## 4. Image Map
|
|
163
|
+
| nodeId | layer | file |
|
|
164
|
+
|--------|-------|------|
|
|
165
|
+
| 123-456 | Banner Top | design/images/banner-top-123-456.png |
|
|
166
|
+
|
|
167
|
+
## 5. Notes
|
|
168
|
+
- Anything not mapped 1:1 (custom fonts, effects…)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
114
173
|
### Step 2: Clarify Requirements via Q&A
|
|
115
174
|
|
|
116
175
|
Ask clarifying questions directly — **one question at a time**, wait for the developer's response before asking the next.
|
|
@@ -154,7 +213,7 @@ After the developer confirms the design direction (Step 2), extend with:
|
|
|
154
213
|
|
|
155
214
|
### Step 4: Write Requirement Document
|
|
156
215
|
|
|
157
|
-
Save to `04.Coding/01.Requirements/[functionId]/[ticketId].md`:
|
|
216
|
+
Save to `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md`:
|
|
158
217
|
|
|
159
218
|
```markdown
|
|
160
219
|
# Requirement: [Ticket ID] — [Title]
|
|
@@ -227,6 +286,15 @@ Save to `04.Coding/01.Requirements/[functionId]/[ticketId].md`:
|
|
|
227
286
|
|
|
228
287
|
---
|
|
229
288
|
|
|
289
|
+
## Design Analysis (UI tickets only)
|
|
290
|
+
|
|
291
|
+
- **Source:** [Figma URL or "TBD" or "⚠️ pending MCP"]
|
|
292
|
+
- **Artifact:** `plan/[ticket-id]/design/design-context.md`
|
|
293
|
+
- **Summary:** layout, key components to build, design tokens to map, images exported
|
|
294
|
+
- **Impact on approach:** how the design shapes the proposed solution
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
230
298
|
## 4. Impact Analysis
|
|
231
299
|
|
|
232
300
|
**Impact Level:** 🟢 Low / 🟡 Medium / 🔴 High
|
|
@@ -284,7 +352,7 @@ Save to `04.Coding/01.Requirements/[functionId]/[ticketId].md`:
|
|
|
284
352
|
⏸️ GATE 1: REQUIREMENT DOCUMENT READY
|
|
285
353
|
|
|
286
354
|
Ticket: [ticket-id] — [title]
|
|
287
|
-
File: 04.Coding/01.Requirements/[functionId]/[ticketId].md
|
|
355
|
+
File: AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md
|
|
288
356
|
|
|
289
357
|
Summary:
|
|
290
358
|
Type: [feature / bug-fix / refactor]
|
|
@@ -332,5 +400,5 @@ Please review the requirement document.
|
|
|
332
400
|
- ❌ **DO NOT** skip impact analysis and effort estimate
|
|
333
401
|
- ✅ **MUST** run `git status` + `git pull --ff-only` (Pre-flight) before reading source code, when working tree is clean
|
|
334
402
|
- ✅ **MUST** read source code before Q&A begins
|
|
335
|
-
- ✅ **MUST** save `04.Coding/01.Requirements/[functionId]/[ticketId].md`
|
|
403
|
+
- ✅ **MUST** save `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md`
|
|
336
404
|
- ✅ **MUST** display Gate 1 prompt and wait for `APPROVED`
|
|
@@ -6,6 +6,8 @@ keywords: review, code review, approve, summary, checklist
|
|
|
6
6
|
|
|
7
7
|
# Review Plan — Gate 4
|
|
8
8
|
|
|
9
|
+
> ⚠️ **Skip this gate for `gen-doc` tasks.** gen-doc tasks only use Gates 1 and 2 (Gate 2 includes self-review automatically). This gate applies to `feature`, `bug-fix`, `refactor`, `documentation`, and `investigation` tasks.
|
|
10
|
+
|
|
9
11
|
> **GATE 4: Runs after AI has completed code generation.**
|
|
10
12
|
>
|
|
11
13
|
> Principle: AI self-reviews first (verification + impact-analysis), then presents a summary to the developer. The developer decides: APPROVED or report a bug.
|
|
@@ -43,7 +45,7 @@ Assess impact by reasoning about the changed files only:
|
|
|
43
45
|
|
|
44
46
|
## Fast Mode Output Rules (CRITICAL)
|
|
45
47
|
|
|
46
|
-
When creating `04.Coding/04.Reviews/[functionId]/[ticketId].md` in **fast mode**:
|
|
48
|
+
When creating `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` in **fast mode**:
|
|
47
49
|
- **Do not write long explanations or descriptions.**
|
|
48
50
|
- **List format only:** Bullet points with `[NEW]`, `[MODIFIED]`, `[DELETED]`.
|
|
49
51
|
- **Purpose:** Next to each file, write exactly 1 sentence explaining the *purpose* (the "why"), not the implementation details.
|
|
@@ -77,9 +79,29 @@ Run in the following mandatory order:
|
|
|
77
79
|
|
|
78
80
|
**If any step fails → fix first, do not proceed to Step 2.**
|
|
79
81
|
|
|
82
|
+
### Step 1.5: Design Conformance Check (UI tickets only)
|
|
83
|
+
|
|
84
|
+
If `plan/[ticket-id]/design/design-context.md` exists, compare the generated UI against the
|
|
85
|
+
design — **visually against the rendered reference image, not just the text checklist.** Open
|
|
86
|
+
`public/assets/figma/_reference-<nodeId>.png` (or the Figma frame) and the running UI, and check
|
|
87
|
+
region by region (header / panel / sections / footer):
|
|
88
|
+
|
|
89
|
+
- [ ] **Reference image compared** region by region; every visible difference listed
|
|
90
|
+
- [ ] **Background** is the correct layer (paint order) and actually visible
|
|
91
|
+
- [ ] **No-fabricate**: no element rendered that isn't in the design (no extra button/section)
|
|
92
|
+
- [ ] **No-omit**: every text label + every image node is present in its region
|
|
93
|
+
- [ ] Layout matches (arrangement/position per region, not a generic flow)
|
|
94
|
+
- [ ] Colors match the Design Tokens table (project token or arbitrary value)
|
|
95
|
+
- [ ] Typography matches (size, weight, line-height)
|
|
96
|
+
- [ ] Every component listed in "Components to build" exists
|
|
97
|
+
- [ ] Every image in the Image Map exists under `public/assets/figma/`
|
|
98
|
+
|
|
99
|
+
Any mismatch → treat as a coding bug: fix before Step 2. A text-only checklist tick is NOT enough —
|
|
100
|
+
if you have not actually looked at the reference image, say so. Skip this step for non-UI tickets.
|
|
101
|
+
|
|
80
102
|
### Step 2: Create Summary Report
|
|
81
103
|
|
|
82
|
-
Create file `04.Coding/04.Reviews/[functionId]/[ticketId].md`:
|
|
104
|
+
Create file `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md`:
|
|
83
105
|
|
|
84
106
|
```markdown
|
|
85
107
|
# Summary: [Ticket ID] — [Title]
|
|
@@ -139,6 +161,7 @@ Create file `04.Coding/04.Reviews/[functionId]/[ticketId].md`:
|
|
|
139
161
|
- [ ] Naming and Code Style follow conventions
|
|
140
162
|
- [ ] Sufficient tests (unit + integration)
|
|
141
163
|
- [ ] No dead code / leftover console.logs
|
|
164
|
+
- [ ] UI matches `design-context.md` (layout, color, typography, spacing) — UI tickets only
|
|
142
165
|
```
|
|
143
166
|
|
|
144
167
|
### Step 3: GATE 4 — Present to Developer
|
|
@@ -148,7 +171,7 @@ Create file `04.Coding/04.Reviews/[functionId]/[ticketId].md`:
|
|
|
148
171
|
⏸️ GATE 4: WAITING FOR DEV REVIEW
|
|
149
172
|
|
|
150
173
|
I have completed implementation and self-review.
|
|
151
|
-
Summary: 04.Coding/04.Reviews/[functionId]/[ticketId].md
|
|
174
|
+
Summary: AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md
|
|
152
175
|
|
|
153
176
|
**Self-review results:**
|
|
154
177
|
- Tests: ✅ [N] passed / ❌ [N] failed
|
|
File without changes
|
|
@@ -7,6 +7,26 @@
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
### Pre-flight BẮT BUỘC — Đồng bộ Source & Docs (đầu MỖI Gate)
|
|
11
|
+
|
|
12
|
+
> Áp dụng cho **cả 4 Gate** bên dưới — không chỉ Gate 1. Chạy đủ các bước sau **trước khi** thực hiện bất kỳ hành động nào khác của gate đó.
|
|
13
|
+
|
|
14
|
+
1. **Sync repo source (bên trong, không phải AK-Docs/Shared-Docs):** xác định thư mục repo source liên quan (field `repo` trong context, hoặc repo duy nhất mở trong workspace) → `cd` vào đó → chạy `git status --porcelain`; nếu working tree sạch, chạy `git pull --ff-only`. Nếu có thay đổi chưa commit, branch diverged, hoặc không có remote tracking branch → bỏ qua pull (không phải lỗi).
|
|
15
|
+
2. **Sync `AK-Docs/`:** `cd` vào `AK-Docs/` (sibling folder ở workspace root) → chạy `git pull`.
|
|
16
|
+
3. **Sync `Shared-Docs/`:** `cd` vào `Shared-Docs/` (sibling folder ở workspace root) → chạy `git pull`.
|
|
17
|
+
4. Sau khi xong, `cd` quay lại thư mục làm việc ban đầu trước khi tiếp tục các bước khác của gate.
|
|
18
|
+
|
|
19
|
+
Nếu `AK-Docs/` hoặc `Shared-Docs/` chưa tồn tại tại workspace root, hoặc không phải git repo → bỏ qua bước tương ứng, không cảnh báo.
|
|
20
|
+
|
|
21
|
+
**Nếu bất kỳ lệnh `git pull` nào ở Bước 1–3 thất bại** → **KHÔNG dừng workflow** — hiển thị cảnh báo và tiếp tục gate với dữ liệu local hiện có:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
⚠️ CẢNH BÁO: Không thể pull [tên repo] — [lý do lỗi].
|
|
25
|
+
→ Đang tiếp tục Gate [N] với dữ liệu local hiện tại, có thể chưa mới nhất.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
10
30
|
### BA Skills
|
|
11
31
|
|
|
12
32
|
Các skill sau đây được cài tự động vào `.claude/skills/ba-skills/` khi chạy `ak init` hoặc `ak up`.
|
|
@@ -76,6 +96,8 @@ Bàn giao Dev/Test
|
|
|
76
96
|
|
|
77
97
|
**Bước thực hiện:**
|
|
78
98
|
|
|
99
|
+
**Pre-flight (bắt buộc, chạy trước Bước 0):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file. Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
100
|
+
|
|
79
101
|
#### Bước 0: Pre-flight — Xác định functionId và thư mục đầu ra
|
|
80
102
|
|
|
81
103
|
**Xác định `functionId` (BẮT BUỘC):**
|
|
@@ -115,6 +137,20 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD10, UC-
|
|
|
115
137
|
→ Bắt đầu Gate 1...
|
|
116
138
|
```
|
|
117
139
|
|
|
140
|
+
#### Bước 0.5: Đảm bảo đang làm việc trên branch riêng của task (AK-Docs)
|
|
141
|
+
|
|
142
|
+
Trước khi ghi bất kỳ file nào vào `02.BA-Specs/`, đảm bảo AK-Docs đang ở branch riêng của task này, không phải `main` (mọi thay đổi `AK-Docs` phải qua branch + Merge Request, PM duyệt cuối cùng trước khi merge vào `main`):
|
|
143
|
+
|
|
144
|
+
1. Lấy `taskId` từ trường `taskId` trong `.aiflow/context/current.json`.
|
|
145
|
+
2. Kiểm tra `AK-Docs` hiện đang ở branch nào (`git -C AK-Docs branch --show-current`).
|
|
146
|
+
3. Nếu **chưa** ở branch `feature/[functionId]/[taskId]`:
|
|
147
|
+
- Hỏi BA: "Chưa có branch riêng cho task này trong AK-Docs. Tạo branch `feature/[functionId]/[taskId]` từ `main` — đồng ý không?"
|
|
148
|
+
- BA đồng ý → chạy `ak docs branch [functionId] [taskId] --yes`
|
|
149
|
+
- BA từ chối → tiếp tục Gate 1 trên nhánh hiện tại của AK-Docs (BA tự quản lý branch)
|
|
150
|
+
4. Nếu **đã** ở đúng branch (ví dụ resume từ session trước) → bỏ qua, tiếp tục.
|
|
151
|
+
|
|
152
|
+
> ❌ Không tự thêm `--yes` khi chưa thấy BA gõ xác nhận rõ ràng trong hội thoại.
|
|
153
|
+
|
|
118
154
|
#### Bước 1: Đọc và tổng hợp đầu vào
|
|
119
155
|
- Đọc `.aiflow/context/current.json` — tiêu đề, mô tả, acceptance criteria, liên kết tài liệu
|
|
120
156
|
- Nếu description có URL → chạy `ak fetch-links <url>` để tải nội dung
|
|
@@ -215,6 +251,8 @@ Vui lòng cung cấp câu trả lời theo một trong 3 cách:
|
|
|
215
251
|
|
|
216
252
|
**Bước thực hiện:**
|
|
217
253
|
|
|
254
|
+
**Pre-flight (bắt buộc, chạy trước Bước 1):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file. Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
255
|
+
|
|
218
256
|
#### Bước 1: Tiếp nhận và đánh giá câu trả lời
|
|
219
257
|
- Đối chiếu từng câu trả lời với câu hỏi trong `QnA-Log_v(m).md`
|
|
220
258
|
- Phân loại:
|
|
@@ -292,6 +330,8 @@ File phân tích: [02.BA-Specs/01.Analysis/[functionId]/Analysis_v(n+1).md](02
|
|
|
292
330
|
|
|
293
331
|
**Bước thực hiện:**
|
|
294
332
|
|
|
333
|
+
**Pre-flight (bắt buộc, chạy trước Bước 1):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file. Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
334
|
+
|
|
295
335
|
#### Bước 1: Liệt kê thành phần giao diện
|
|
296
336
|
- Đọc tài liệu phân tích đã chốt
|
|
297
337
|
- Xác định: ô nhập liệu, nút bấm, liên kết, vùng hiển thị lỗi, vùng hiển thị dữ liệu
|
|
@@ -345,6 +385,8 @@ File phân tích: [02.BA-Specs/01.Analysis/[functionId]/Analysis_v(n+1).md](02
|
|
|
345
385
|
|
|
346
386
|
**Bước thực hiện:**
|
|
347
387
|
|
|
388
|
+
**Pre-flight (bắt buộc, chạy trước Bước 1):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file. Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
389
|
+
|
|
348
390
|
#### Bước 1: Khởi tạo Spec từ Template
|
|
349
391
|
- **READ template:** `.claude/skills/ba-skills/skill-ba-uc-template-v1.md`
|
|
350
392
|
- **READ skill:** `.claude/skills/ba-skills/skill-ba-write-uc-spec-v1.md`
|
|
@@ -399,6 +441,18 @@ File phân tích: [02.BA-Specs/01.Analysis/[functionId]/Analysis_v(n+1).md](02
|
|
|
399
441
|
> **Telemetry:** Run `ak gate 4 start --ticket [functionId]` khi bắt đầu gate này.
|
|
400
442
|
> Run `ak gate 4 approved --ticket [functionId]` sau khi gate-review verify passed. Run as-is — không thêm shell redirects.
|
|
401
443
|
|
|
444
|
+
#### Bước 8: Submit AK-Docs lên remote qua Merge Request
|
|
445
|
+
|
|
446
|
+
Sau khi Gate 4 đã APPROVED (UC Spec hoàn thành):
|
|
447
|
+
|
|
448
|
+
1. Soạn title + description cho Merge Request (tóm tắt UC Spec vừa hoàn thành, link ticket gốc), hiển thị cho BA xem trước.
|
|
449
|
+
2. Hỏi BA: "Nội dung commit/MR như trên — đồng ý submit AK-Docs không?"
|
|
450
|
+
- BA đồng ý → chạy `ak docs submit --title "..." --description "..." --yes`
|
|
451
|
+
- BA từ chối → dừng, để BA tự commit/tạo MR khi sẵn sàng
|
|
452
|
+
3. Thông báo BA: MR đã mở, chờ **PM review & merge vào `main`** — đây là bước duyệt cuối cùng cho tài liệu, không phải BA tự merge.
|
|
453
|
+
|
|
454
|
+
> ❌ Không tự thêm `--yes` khi chưa thấy BA gõ xác nhận rõ ràng trong hội thoại.
|
|
455
|
+
|
|
402
456
|
---
|
|
403
457
|
|
|
404
458
|
### Bản đồ Skills theo Gate
|
|
@@ -419,6 +473,7 @@ File phân tích: [02.BA-Specs/01.Analysis/[functionId]/Analysis_v(n+1).md](02
|
|
|
419
473
|
- ❌ **KHÔNG** tiến Gate 3 khi vẫn còn câu hỏi Open
|
|
420
474
|
- ❌ **KHÔNG chấp nhận APPROVED** ở Gate 1 hoặc Gate 2 khi còn bất kỳ câu hỏi nào trạng thái **Open** — từ chối và hiển thị danh sách câu hỏi cần trả lời
|
|
421
475
|
- ✅ **BẮT BUỘC** chạy Bước 0 ở Gate 1 — xác nhận `functionId` và thư mục đầu ra trước khi làm bất cứ điều gì
|
|
476
|
+
- ✅ **BẮT BUỘC** chạy Bước 0.5 ở Gate 1 — đảm bảo AK-Docs đang ở branch `feature/[functionId]/[taskId]` trước khi ghi file đầu tiên
|
|
422
477
|
- ✅ **BẮT BUỘC** đọc skill từ `.claude/skills/ba-skills/` — không suy luận từ bộ nhớ
|
|
423
478
|
- ✅ **BẮT BUỘC** invoke `gate-review` cuối mỗi gate và chờ APPROVED
|
|
424
479
|
- ✅ **BẮT BUỘC** mọi thẻ tương tác trong HTML có `id` duy nhất
|
|
@@ -7,6 +7,26 @@
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
### Pre-flight BẮT BUỘC — Đồng bộ Source & Docs (đầu MỖI Gate)
|
|
11
|
+
|
|
12
|
+
> Áp dụng cho **cả 4 Gate** bên dưới — không chỉ Gate 1. Chạy đủ các bước sau **trước khi** thực hiện bất kỳ hành động nào khác của gate đó.
|
|
13
|
+
|
|
14
|
+
1. **Sync repo source (bên trong, không phải AK-Docs/Shared-Docs):** xác định thư mục repo source liên quan (field `repo` trong context, hoặc repo duy nhất mở trong workspace) → `cd` vào đó → chạy `git status --porcelain`; nếu working tree sạch, chạy `git pull --ff-only`. Nếu có thay đổi chưa commit, branch diverged, hoặc không có remote tracking branch → bỏ qua pull (không phải lỗi).
|
|
15
|
+
2. **Sync `AK-Docs/`:** `cd` vào `AK-Docs/` (sibling folder ở workspace root) → chạy `git pull`.
|
|
16
|
+
3. **Sync `Shared-Docs/`:** `cd` vào `Shared-Docs/` (sibling folder ở workspace root) → chạy `git pull`.
|
|
17
|
+
4. Sau khi xong, `cd` quay lại thư mục làm việc ban đầu trước khi tiếp tục các bước khác của gate.
|
|
18
|
+
|
|
19
|
+
Nếu `AK-Docs/` hoặc `Shared-Docs/` chưa tồn tại tại workspace root, hoặc không phải git repo → bỏ qua bước tương ứng, không cảnh báo.
|
|
20
|
+
|
|
21
|
+
**Nếu bất kỳ lệnh `git pull` nào ở Bước 1–3 thất bại** → **KHÔNG dừng workflow** — hiển thị cảnh báo và tiếp tục gate với dữ liệu local hiện có:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
⚠️ CẢNH BÁO: Không thể pull [tên repo] — [lý do lỗi].
|
|
25
|
+
→ Đang tiếp tục Gate [N] với dữ liệu local hiện tại, có thể chưa mới nhất.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
10
30
|
### QA Skills
|
|
11
31
|
|
|
12
32
|
Các skill sau đây được cài tự động vào `.claude/skills/test-skills/` khi chạy `ak init` hoặc `ak up`.
|
|
@@ -96,6 +116,8 @@ Sẵn sàng thực thi kiểm thử
|
|
|
96
116
|
|
|
97
117
|
**Bước thực hiện:**
|
|
98
118
|
|
|
119
|
+
**Pre-flight (bắt buộc, chạy trước Bước 0):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file. Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
120
|
+
|
|
99
121
|
#### Bước 0: Pre-flight — Xác định functionId và thư mục đầu ra
|
|
100
122
|
|
|
101
123
|
**Xác định `functionId` (BẮT BUỘC):**
|
|
@@ -133,6 +155,20 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
|
|
|
133
155
|
→ Bắt đầu Gate 1...
|
|
134
156
|
```
|
|
135
157
|
|
|
158
|
+
#### Bước 0.5: Đảm bảo đang làm việc trên branch riêng của task (AK-Docs)
|
|
159
|
+
|
|
160
|
+
Trước khi ghi bất kỳ file nào vào `03.Testing/`, đảm bảo AK-Docs đang ở branch riêng của task này, không phải `main` (mọi thay đổi `AK-Docs` phải qua branch + Merge Request, PM duyệt cuối cùng trước khi merge vào `main`):
|
|
161
|
+
|
|
162
|
+
1. Lấy `taskId` từ trường `taskId` trong `.aiflow/context/current.json`.
|
|
163
|
+
2. Kiểm tra `AK-Docs` hiện đang ở branch nào (`git -C AK-Docs branch --show-current`).
|
|
164
|
+
3. Nếu **chưa** ở branch `feature/[functionId]/[taskId]`:
|
|
165
|
+
- Hỏi QA: "Chưa có branch riêng cho task này trong AK-Docs. Tạo branch `feature/[functionId]/[taskId]` từ `main` — đồng ý không?"
|
|
166
|
+
- QA đồng ý → chạy `ak docs branch [functionId] [taskId] --yes`
|
|
167
|
+
- QA từ chối → tiếp tục Gate 1 trên nhánh hiện tại của AK-Docs (QA tự quản lý branch)
|
|
168
|
+
4. Nếu **đã** ở đúng branch (ví dụ resume từ session trước) → bỏ qua, tiếp tục.
|
|
169
|
+
|
|
170
|
+
> ❌ Không tự thêm `--yes` khi chưa thấy QA gõ xác nhận rõ ràng trong hội thoại.
|
|
171
|
+
|
|
136
172
|
#### Bước 1: Đọc và tổng hợp đầu vào
|
|
137
173
|
- Đọc `.aiflow/context/current.json` — tiêu đề, mô tả, acceptance criteria, liên kết tài liệu
|
|
138
174
|
- Nếu description có URL → chạy `ak fetch-links <url>` để tải nội dung
|
|
@@ -216,6 +252,8 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
|
|
|
216
252
|
|
|
217
253
|
**Bước thực hiện:**
|
|
218
254
|
|
|
255
|
+
**Pre-flight (bắt buộc, chạy trước Bước 1):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file. Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
256
|
+
|
|
219
257
|
#### Bước 1: Đọc artifact đầu vào
|
|
220
258
|
- Đọc `[functionId]_01_Requirement_Analysis_Result.md` — nắm toàn bộ 16 mục, Risk Matrix, Business Rules
|
|
221
259
|
|
|
@@ -287,6 +325,8 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
|
|
|
287
325
|
|
|
288
326
|
**Bước thực hiện:**
|
|
289
327
|
|
|
328
|
+
**Pre-flight (bắt buộc, chạy trước Bước 1):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file. Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
329
|
+
|
|
290
330
|
#### Bước 1: Đọc template và quy ước bắt buộc
|
|
291
331
|
- **READ template:** `.claude/skills/test-skills/template/testcase-template.md` — **BẮT BUỘC** tuân thủ 100%
|
|
292
332
|
- **READ skill:** `.claude/skills/test-skills/rules/qa-writing-standards.md`
|
|
@@ -376,6 +416,8 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
|
|
|
376
416
|
|
|
377
417
|
**Bước thực hiện:**
|
|
378
418
|
|
|
419
|
+
**Pre-flight (bắt buộc, chạy trước Bước 1):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file. Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
420
|
+
|
|
379
421
|
#### Bước 1: Review nội dung và đánh giá bao phủ
|
|
380
422
|
- **READ skill:** `.claude/skills/test-skills/categories/00-core/00.04.testcase-review.md`
|
|
381
423
|
- **READ skill:** `.claude/skills/test-skills/categories/99-review/99.01.coverage-review.md`
|
|
@@ -443,6 +485,18 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
|
|
|
443
485
|
> **Telemetry:** Run `ak gate 4 start --ticket [functionId]` khi bắt đầu gate này.
|
|
444
486
|
> Run `ak gate 4 approved --ticket [functionId]` sau khi gate-review verify passed. Run as-is — không thêm shell redirects.
|
|
445
487
|
|
|
488
|
+
#### Bước 8: Submit AK-Docs lên remote qua Merge Request
|
|
489
|
+
|
|
490
|
+
Sau khi Gate 4 đã APPROVED (bộ Test Case hoàn thành):
|
|
491
|
+
|
|
492
|
+
1. Soạn title + description cho Merge Request (tóm tắt bộ Test Case vừa hoàn thành, sign-off status, link ticket gốc), hiển thị cho QA xem trước.
|
|
493
|
+
2. Hỏi QA: "Nội dung commit/MR như trên — đồng ý submit AK-Docs không?"
|
|
494
|
+
- QA đồng ý → chạy `ak docs submit --title "..." --description "..." --yes`
|
|
495
|
+
- QA từ chối → dừng, để QA tự commit/tạo MR khi sẵn sàng
|
|
496
|
+
3. Thông báo QA: MR đã mở, chờ **PM review & merge vào `main`** — đây là bước duyệt cuối cùng cho tài liệu, không phải QA tự merge.
|
|
497
|
+
|
|
498
|
+
> ❌ Không tự thêm `--yes` khi chưa thấy QA gõ xác nhận rõ ràng trong hội thoại.
|
|
499
|
+
|
|
446
500
|
---
|
|
447
501
|
|
|
448
502
|
### Bản đồ Skills theo Gate
|
|
@@ -463,6 +517,7 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
|
|
|
463
517
|
- ❌ **KHÔNG** sinh `04_Final_Result.md` mà thiếu `[functionId]_TestCase.md` (hoặc ngược lại)
|
|
464
518
|
- ❌ **KHÔNG** tiến gate tiếp theo khi còn issue Critical hoặc Major chưa giải quyết
|
|
465
519
|
- ✅ **BẮT BUỘC** chạy Bước 0 ở Gate 1 — xác nhận `functionId` và thư mục đầu ra trước khi làm bất cứ điều gì
|
|
520
|
+
- ✅ **BẮT BUỘC** chạy Bước 0.5 ở Gate 1 — đảm bảo AK-Docs đang ở branch `feature/[functionId]/[taskId]` trước khi ghi file đầu tiên
|
|
466
521
|
- ✅ **BẮT BUỘC** đọc skill từ `.claude/skills/test-skills/` — không suy luận từ bộ nhớ
|
|
467
522
|
- ✅ **BẮT BUỘC** invoke `gate-review` cuối mỗi gate và chờ APPROVED
|
|
468
523
|
- ✅ **BẮT BUỘC** tuân thủ 100% `testcase-template.md` ở Gate 3 và Gate 4
|