@relipa/ai-flow-kit 0.1.5 → 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 +18 -2
- 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/generate-spec/SKILL.md +19 -0
- package/custom/skills/read-study-requirement/SKILL.md +69 -1
- package/custom/skills/review-plan/SKILL.md +23 -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 +115 -3
- package/custom/templates/shared/ml-gate-workflow.md +16 -9
- package/docs/common/AIFLOW.md +11 -1
- package/docs/common/CHANGELOG.md +32 -0
- package/docs/common/cli-reference.md +3 -1
- 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/hooks/figma-rate-limit.js +83 -0
- package/scripts/hooks/session-start.js +41 -6
- package/scripts/init.js +29 -1
- package/scripts/prompt.js +45 -0
- package/scripts/task.js +30 -15
- package/scripts/use.js +6 -5
|
@@ -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.
|
|
@@ -77,6 +79,26 @@ 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
104
|
Create file `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md`:
|
|
@@ -139,6 +161,7 @@ Create file `AK-Docs/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
|
|
@@ -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
|
|
@@ -3,12 +3,32 @@
|
|
|
3
3
|
> **Absolute Rule: Complete Gate N before entering Gate N+1.**
|
|
4
4
|
> **Do not skip, shorten, or merge Gates.**
|
|
5
5
|
|
|
6
|
+
> **Task type `gen-doc`** uses a **2-gate flow** (Gate 1 + Gate 2 only). See the gen-doc section below — do NOT run Gates 3/4/5 for gen-doc tasks.
|
|
7
|
+
|
|
6
8
|
You have superpowers. When a ticket context exists in `.aiflow/context/current.json`:
|
|
7
9
|
- **Consult the "AI Skill Registry"** below to find instructions for each skill (`SKILL.md`).
|
|
8
10
|
- **AUTO-START Gate 1 immediately** — do NOT wait to be asked.
|
|
9
11
|
- Read the context, **check `taskType`**, and follow the matching workflow — NO EXCEPTIONS.
|
|
10
12
|
- **PROJECT CONVENTIONS:** Before writing any output file (plan, requirement, summary), read `custom/rules/project-conventions.md`. These rules override upstream skill defaults.
|
|
11
13
|
|
|
14
|
+
### Pre-flight BẮT BUỘC — Đồng bộ Source & Docs (đầu MỖI Gate)
|
|
15
|
+
|
|
16
|
+
> Áp dụng cho **mọi Gate** của cả 3 workflow bên dưới ([DEV], [TESTER], [EXECUTE]) — 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 đó.
|
|
17
|
+
|
|
18
|
+
1. **Sync repo source (bên trong, không phải AK-Docs/Shared-Docs):** xác định thư mục repo source hiện tại → `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, không cần cảnh báo).
|
|
19
|
+
2. **Sync `AK-Docs/`:** `cd` vào `AK-Docs/` (sibling folder ở workspace root) → chạy `git pull`.
|
|
20
|
+
3. **Sync `Shared-Docs/`:** `cd` vào `Shared-Docs/` (sibling folder ở workspace root) → chạy `git pull`.
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
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 (dự án có thể chưa dùng docs repo riêng).
|
|
24
|
+
|
|
25
|
+
**Nếu bất kỳ lệnh `git pull` nào ở Bước 1–3 thất bại** (conflict, mất mạng, không có remote, v.v.) → **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ó:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
⚠️ CẢNH BÁO: Không thể pull [tên repo] — [lý do lỗi].
|
|
29
|
+
→ Đ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.
|
|
30
|
+
```
|
|
31
|
+
|
|
12
32
|
### Workflow Selection
|
|
13
33
|
|
|
14
34
|
Read `.aiflow/context/current.json` → check the `taskType` field:
|
|
@@ -74,8 +94,21 @@ AI actively reads ticket + source code to understand the requirement:
|
|
|
74
94
|
→ Bắt đầu Gate 1...
|
|
75
95
|
```
|
|
76
96
|
|
|
97
|
+
0.5. **Đảm bảo đang làm việc trên branch riêng của ticket (AK-Docs):**
|
|
98
|
+
|
|
99
|
+
Trước khi ghi bất kỳ file nào vào `AK-Docs/04.Coding/`, đảm bảo AK-Docs đang ở branch riêng của ticket 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`):
|
|
100
|
+
|
|
101
|
+
1. Kiểm tra `AK-Docs` hiện đang ở branch nào (`git -C AK-Docs branch --show-current`).
|
|
102
|
+
2. Nếu **chưa** ở branch `feature/[functionId]/[ticketId]`:
|
|
103
|
+
- Hỏi DEV: "Chưa có branch riêng cho ticket này trong AK-Docs. Tạo branch `feature/[functionId]/[ticketId]` từ `main` — đồng ý không?"
|
|
104
|
+
- DEV đồng ý → chạy `ak docs branch [functionId] [ticketId] --yes`
|
|
105
|
+
- DEV từ chối → tiếp tục Gate 1 trên nhánh hiện tại của AK-Docs (DEV tự quản lý branch)
|
|
106
|
+
3. Nếu **đã** ở đúng branch (ví dụ resume từ session trước, hoặc Gate 2/3/4 tiếp nối Gate 1) → bỏ qua, tiếp tục.
|
|
107
|
+
|
|
108
|
+
> ❌ Không tự thêm `--yes` khi chưa thấy DEV gõ xác nhận rõ ràng trong hội thoại.
|
|
109
|
+
|
|
77
110
|
1. Read `.aiflow/context/current.json` — ticket info
|
|
78
|
-
2. **Pre-flight
|
|
111
|
+
2. **Pre-flight (bắt buộc):** chạy [Pre-flight — Đồng bộ Source & Docs](#pre-flight-bắt-buộc--đồng-bộ-source--docs-đầu-mỗi-gate) ở đầu file (sync repo source + `AK-Docs/` + `Shared-Docs/`). Lỗi → hiển thị ⚠️ cảnh báo, không dừng gate.
|
|
79
112
|
3. Read source code — architecture, related files, data flow
|
|
80
113
|
4. If anything is unclear — ask ONE question at a time, wait for reply
|
|
81
114
|
5. Output `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` with:
|
|
@@ -104,6 +137,7 @@ DO NOT just check format — **understand the content and propose solutions**.
|
|
|
104
137
|
|
|
105
138
|
**INVOKE:** `generate-spec` skill, then `superpowers:writing-plans`
|
|
106
139
|
|
|
140
|
+
- **Pre-flight (bắt buộc):** 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.
|
|
107
141
|
- Create a detailed TDD implementation plan based on the approved requirement (`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md`).
|
|
108
142
|
- Output `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md` with the detailed TDD implementation plan (step-by-step, file list, test-first order).
|
|
109
143
|
- Update tracker row in `AK-Docs/04.Coding/00.Overview/_Index.md` (Gate 2 ✅).
|
|
@@ -125,6 +159,7 @@ DO NOT just check format — **understand the content and propose solutions**.
|
|
|
125
159
|
Only runs after Gate 2 has been APPROVED.
|
|
126
160
|
|
|
127
161
|
**INVOKE:** `superpowers:test-driven-development`
|
|
162
|
+
- **Pre-flight (bắt buộc):** 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.
|
|
128
163
|
- Complex feature (3+ files): `superpowers:subagent-driven-development`
|
|
129
164
|
- Write tests FIRST — run to confirm FAIL -> implement -> PASS.
|
|
130
165
|
- Bug fix EXTRA: `superpowers:systematic-debugging` + `investigate-bug` skill first.
|
|
@@ -142,6 +177,7 @@ Only runs after Gate 2 has been APPROVED.
|
|
|
142
177
|
**INVOKE:** `review-plan` skill
|
|
143
178
|
|
|
144
179
|
Mandatory order:
|
|
180
|
+
0. **Pre-flight (bắt buộc):** 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.
|
|
145
181
|
1. `superpowers:verification-before-completion` — all tests must PASS
|
|
146
182
|
2. `impact-analysis` skill — check for breaking changes
|
|
147
183
|
3. Tick `custom/rules/review-checklist.md`
|
|
@@ -172,11 +208,18 @@ Only runs after Gate 4 has been APPROVED.
|
|
|
172
208
|
|
|
173
209
|
**INVOKE:** `superpowers:requesting-code-review`
|
|
174
210
|
|
|
211
|
+
0. **Pre-flight (bắt buộc):** 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.
|
|
175
212
|
1. Create `AK-Docs/04.Coding/05.Pull-Requests/[functionId]/[ticketId].md` — PR description gồm:
|
|
176
213
|
- Ticket link, danh sách thay đổi chính, How to Test, Checklist for Reviewer
|
|
177
214
|
- **Related Docs links:** UC Spec (`AK-Docs/02.BA-Specs/04.UC-Specs/[functionId]/`), Test Case (`AK-Docs/03.Testing/01.Testcases/[functionId]/`), Dev Plan (`AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md`)
|
|
178
|
-
2. **
|
|
179
|
-
|
|
215
|
+
2. **Submit `AK-Docs/04.Coding/` lên remote qua Merge Request TRƯỚC khi tạo Pull Request cho source code:**
|
|
216
|
+
- Soạn title + description cho MR (tóm tắt toàn bộ tài liệu vừa hoàn thành: Requirements, Plan, Review, PR-doc), hiển thị cho DEV xem trước.
|
|
217
|
+
- Hỏi DEV: "Nội dung commit/MR như trên — đồng ý submit AK-Docs không?"
|
|
218
|
+
- DEV đồng ý → chạy `ak docs submit --title "..." --description "..." --yes`
|
|
219
|
+
- DEV từ chối → dừng, để DEV tự commit/tạo MR khi sẵn sàng
|
|
220
|
+
- Thông báo DEV: 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 DEV tự merge.
|
|
221
|
+
- ❌ Không tự thêm `--yes` khi chưa thấy DEV gõ xác nhận rõ ràng trong hội thoại.
|
|
222
|
+
3. Guide on creating a Pull Request (source code) — dùng nội dung file trên làm PR description.
|
|
180
223
|
4. Update tracker row in `AK-Docs/04.Coding/00.Overview/_Index.md` (Gate 5 ✅ Done + PR link).
|
|
181
224
|
|
|
182
225
|
> **Telemetry:** Run `ak gate 5 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
|
|
@@ -192,6 +235,7 @@ Only runs after Gate 4 has been APPROVED.
|
|
|
192
235
|
|
|
193
236
|
**INVOKE:** `test-analysis` skill
|
|
194
237
|
|
|
238
|
+
0. **Pre-flight (bắt buộc):** 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.
|
|
195
239
|
1. Read `.aiflow/context/current.json` — ticket title, description, acceptance criteria
|
|
196
240
|
2. Fetch linked docs if URLs present in description (`ak fetch-links <url>`)
|
|
197
241
|
3. Analyze scope, functional flows, non-functional requirements, risks
|
|
@@ -230,6 +274,7 @@ Only runs after Gate 1 APPROVED.
|
|
|
230
274
|
|
|
231
275
|
**INVOKE:** `generate-testcase` skill (Phase 2a)
|
|
232
276
|
|
|
277
|
+
- **Pre-flight (bắt buộc):** 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.
|
|
233
278
|
- If TESTER declared `PR: <url>` → **INVOKE** `pr-impact-analysis` skill (Dev Artifacts Check) first
|
|
234
279
|
- Generate test scenarios/checklist TABLE covering: Happy Path, Negative, Validation, Boundary, Edge Cases, State Transitions, Role-based, Accessibility, Compatibility, Data Integrity, Integration, Exploratory
|
|
235
280
|
- Save `test-plan/checklist.md`
|
|
@@ -250,6 +295,7 @@ Only runs after Gate 1 APPROVED.
|
|
|
250
295
|
|
|
251
296
|
**INVOKE:** `generate-testcase` skill (Phase 2b)
|
|
252
297
|
|
|
298
|
+
- **Pre-flight (bắt buộc):** 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.
|
|
253
299
|
- Generate detailed test cases TABLE from Phase 2a checklist: `TC_ID | Scenario | Preconditions | Test Steps | Test Data | Expected Result`
|
|
254
300
|
- TC_ID format: `TC_[Module]_[NNN]` (e.g. `TC_Login_001`)
|
|
255
301
|
- Expected result ONLY from ticket/spec — never from PR/dev description
|
|
@@ -271,6 +317,7 @@ Only runs after Gate 1 APPROVED.
|
|
|
271
317
|
|
|
272
318
|
**INVOKE:** `generate-testcase` skill (Phase 2c)
|
|
273
319
|
|
|
320
|
+
- **Pre-flight (bắt buộc):** 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.
|
|
274
321
|
- Self-review: check duplicates, problematic TCs (vague steps, unmeasurable expected result), missing TCs, coverage gaps, accessibility/compatibility coverage
|
|
275
322
|
- Output `test-plan/review-report.md` with action items
|
|
276
323
|
- **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-2c-[ticket-id].md`
|
|
@@ -290,6 +337,7 @@ Only runs after Gate 1 APPROVED.
|
|
|
290
337
|
|
|
291
338
|
**INVOKE:** `coverage-check` skill
|
|
292
339
|
|
|
340
|
+
- **Pre-flight (bắt buộc):** 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.
|
|
293
341
|
- Apply all action items from Phase 2c
|
|
294
342
|
- Generate coverage matrix (requirement → TC IDs)
|
|
295
343
|
- Export final test case set to `test-plan/test-cases/final-testcases.md`
|
|
@@ -318,6 +366,10 @@ Scripts: [N] Playwright specs generated
|
|
|
318
366
|
|
|
319
367
|
Only runs after Gate 2 APPROVED.
|
|
320
368
|
|
|
369
|
+
**Step 3.0 — Pre-flight (bắt buộc)**
|
|
370
|
+
|
|
371
|
+
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.
|
|
372
|
+
|
|
321
373
|
**Step 3.1 — Dev Artifacts Check (Gate 3 entry)**
|
|
322
374
|
|
|
323
375
|
**INVOKE:** `pr-impact-analysis` skill — check for new commits since Gate 2. If delta found → propose TC additions → TESTER approves delta only before proceeding.
|
|
@@ -372,6 +424,7 @@ Only runs after Gate 3 APPROVED.
|
|
|
372
424
|
|
|
373
425
|
**INVOKE:** `generate-test-report` skill
|
|
374
426
|
|
|
427
|
+
0. **Pre-flight (bắt buộc):** 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.
|
|
375
428
|
1. Aggregate results from `evidence/*/result.md`
|
|
376
429
|
2. Summarize bugs from `bugs/BUG-*.md` by severity
|
|
377
430
|
3. Verify acceptance criteria coverage from Gate 1
|
|
@@ -412,6 +465,8 @@ Coverage: [N]% acceptance criteria
|
|
|
412
465
|
|
|
413
466
|
**INVOKE:** `execute-flow` skill (from `custom/skills/test-skills/execute-flow/SKILL.md`)
|
|
414
467
|
|
|
468
|
+
**Đồng bộ Source & Docs (bắt buộc, chạy trước mọi pre-flight check khác):** 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.
|
|
469
|
+
|
|
415
470
|
Pre-flight checks (stop and report if any fail):
|
|
416
471
|
0. **MCP Playwright is configured** — check `~/.claude/settings.json` (global user-level) for a `playwright` key in `mcpServers`. This is global — set once, works across all repos.
|
|
417
472
|
- If missing: ask TESTER "MCP Playwright chưa cấu hình. Tự động cài vào global settings (~/.claude/settings.json)? [Y/n]"
|
|
@@ -451,6 +506,8 @@ Only runs after Gate 1 APPROVED.
|
|
|
451
506
|
|
|
452
507
|
**INVOKE:** `script-sync` skill (from `custom/skills/test-skills/script-sync/SKILL.md`)
|
|
453
508
|
|
|
509
|
+
**Pre-flight (bắt buộc):** 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.
|
|
510
|
+
|
|
454
511
|
Hash-based TC↔script sync — for each TC in the file:
|
|
455
512
|
- **New TC** (no matching `@tc-hash` in spec): generate Playwright test using MCP (`browser_navigate` → `browser_snapshot` → `browser_generate_locator`). Never fabricate selectors.
|
|
456
513
|
- **Changed TC** (hash mismatch): update the existing test block only.
|
|
@@ -479,6 +536,10 @@ Output: `ak-test/{repo}/scripts/{screenId}/{ScreenID}.spec.ts` (1 file per scree
|
|
|
479
536
|
|
|
480
537
|
Only runs after Gate 2 APPROVED.
|
|
481
538
|
|
|
539
|
+
**Step 3.0 — Pre-flight (bắt buộc)**
|
|
540
|
+
|
|
541
|
+
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.
|
|
542
|
+
|
|
482
543
|
**Step 3.1 — Determine run number**
|
|
483
544
|
|
|
484
545
|
Check `ak-test/{repo}/results/{screenId}/` — next run is `run-{N+1}`.
|
|
@@ -526,6 +587,10 @@ Run: run-{N} | Passed: [N] | Failed: [N] | Untest: [N] | Pending: [N]
|
|
|
526
587
|
|
|
527
588
|
Only runs after Gate 3 APPROVED.
|
|
528
589
|
|
|
590
|
+
**Step 4.0 — Pre-flight (bắt buộc)**
|
|
591
|
+
|
|
592
|
+
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.
|
|
593
|
+
|
|
529
594
|
**Step 4.1** — Generate `ak-test/{repo}/results/{screenId}/run-{N}/testreport.md`:
|
|
530
595
|
- Per-module rows with Pass/Fail/Untest/Pending counts, R1/R2 columns, % completion
|
|
531
596
|
- Go/No-Go: 0 unresolved Critical = Go
|
|
@@ -552,3 +617,50 @@ Bugs logged: [N] | Skipped: [N]
|
|
|
552
617
|
→ If blocked: follow gate-review skill response protocol
|
|
553
618
|
|
|
554
619
|
> **Telemetry:** Run `ak gate 4 start --ticket [ticket-id]` when starting. Run `ak gate 4 approved --ticket [ticket-id]` when APPROVED.
|
|
620
|
+
## gen-doc Task Type — 2-Gate Flow
|
|
621
|
+
|
|
622
|
+
> This section applies **only** when `taskType === "gen-doc"`. All other task types use the 5-gate flow above.
|
|
623
|
+
|
|
624
|
+
> `gen-doc` reuses the **same** `AK-Docs/04.Coding/` folders as the standard Dev workflow above (see `custom/rules/project-conventions.md`) — it just only uses Gate 1–2 of them, not a separate section.
|
|
625
|
+
|
|
626
|
+
### GATE 1 — AI Analyze & Plan Document (auto-start)
|
|
627
|
+
|
|
628
|
+
**INVOKE:** `read-study-requirement` skill
|
|
629
|
+
|
|
630
|
+
1. Load ticket context + read source code / files to understand scope
|
|
631
|
+
2. **Xác định `functionId` và thư mục đầu ra (BẮT BUỘC)** — theo đúng quy tắc "functionId & ticketId" trong `custom/rules/project-conventions.md`: kiểm tra `functionId`/`screenId` trong `.aiflow/context/current.json` → suy từ ticketId/input → nếu không suy ra được (task ad-hoc, không gắn với chức năng cụ thể), hỏi trực tiếp người yêu cầu (có thể dùng một mã chủ đề ngắn, ví dụ `AD-HOC` hoặc tên báo cáo). KHÔNG ĐƯỢC GHI FILE khi chưa có `functionId`.
|
|
632
|
+
3. **Đảm bảo đang làm việc trên branch riêng của task (AK-Docs):** kiểm tra `AK-Docs` hiện đang ở branch nào (`git -C AK-Docs branch --show-current`). Nếu chưa ở `feature/[functionId]/[ticketId]` → hỏi: "Chưa có branch riêng cho task này trong AK-Docs. Tạo branch `feature/[functionId]/[ticketId]` từ `main` — đồng ý không?" → đồng ý thì chạy `ak docs branch [functionId] [ticketId] --yes`; từ chối thì tiếp tục trên nhánh hiện tại (người dùng tự quản lý branch). Đã đúng branch rồi thì bỏ qua. ❌ Không tự thêm `--yes` khi chưa thấy người dùng xác nhận rõ ràng.
|
|
633
|
+
4. Understand the document goal, target audience, and output format
|
|
634
|
+
5. If unclear → ask ONE question at a time, wait for reply
|
|
635
|
+
6. Output `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` with:
|
|
636
|
+
- Document scope and target audience
|
|
637
|
+
- Content outline (sections to cover)
|
|
638
|
+
- Source references (files, features, flows to analyze)
|
|
639
|
+
- Output format: Markdown or Excel (note template path if applicable)
|
|
640
|
+
- Effort estimate
|
|
641
|
+
7. Display "GATE 1: Document plan ready" → wait for **APPROVED**
|
|
642
|
+
|
|
643
|
+
> **Telemetry:** Run `ak gate 1 start --ticket [ticket-id]` when starting.
|
|
644
|
+
> Run `ak gate 1 approved --ticket [ticket-id]` immediately when APPROVED is received.
|
|
645
|
+
|
|
646
|
+
---
|
|
647
|
+
|
|
648
|
+
### GATE 2 — Generate Document + Auto Review (runs immediately after APPROVED)
|
|
649
|
+
|
|
650
|
+
**DO NOT create `plan.md`. DO NOT run TDD. Proceed directly to document generation.**
|
|
651
|
+
|
|
652
|
+
1. Re-read `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` (the approved outline)
|
|
653
|
+
2. Read source code, trace data flows, analyze features as needed
|
|
654
|
+
3. Generate the output document:
|
|
655
|
+
- **Markdown:** Save to `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md` (or the custom path/format noted in the requirement doc — e.g. Excel; still write a short pointer + summary into this file so the AK-Docs history stays complete)
|
|
656
|
+
4. Self-review: verify content completeness against the approved requirement outline
|
|
657
|
+
5. Create `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId]-summary.md` with a brief summary of what was generated
|
|
658
|
+
6. **Submit AK-Docs lên remote qua Merge Request:**
|
|
659
|
+
- Soạn title + description cho MR (tóm tắt tài liệu vừa tạo, link ticket gốc), hiển thị cho người dùng xem trước.
|
|
660
|
+
- Hỏi: "Nội dung commit/MR như trên — đồng ý submit AK-Docs không?" → đồng ý thì chạy `ak docs submit --title "..." --description "..." --yes`; từ chối thì dừng, để người dùng tự commit/tạo MR khi sẵn sàng.
|
|
661
|
+
- Thông báo: MR đã mở, chờ **PM review & merge vào `main`** — đây là bước duyệt cuối cùng, không phải tự merge.
|
|
662
|
+
- ❌ Không tự thêm `--yes` khi chưa thấy người dùng gõ xác nhận rõ ràng trong hội thoại.
|
|
663
|
+
7. Run: `ak gate 2 approved --ticket [ticket-id]` to close the task
|
|
664
|
+
8. Display: `GATE 2 DONE: Document generated at [path]`
|
|
665
|
+
|
|
666
|
+
**Do NOT wait for extra approval before generating the document or opening the MR — only the explicit branch/MR confirmations above gate this; run the gate 2 approved command immediately after.**
|
|
@@ -18,16 +18,18 @@ You have superpowers. When a ticket context exists in `.aiflow/context/current.j
|
|
|
18
18
|
AI actively reads the ticket and dataset to frame the problem and assess the data:
|
|
19
19
|
1. Read `.aiflow/context/current.json` — ticket info
|
|
20
20
|
2. **Pre-flight: sync with remote** — run `git status --porcelain`; if working tree is clean, run `git pull --ff-only` to pull the latest source from remote. Skip the pull (with a `⚠️` notice to DEV) if there are uncommitted changes, the branch has diverged, or no remote tracking branch exists.
|
|
21
|
-
3.
|
|
22
|
-
4.
|
|
23
|
-
5.
|
|
24
|
-
6.
|
|
21
|
+
3. **Xác định `functionId` và thư mục đầu ra (BẮT BUỘC)** — theo đúng quy tắc "functionId & ticketId" trong `custom/rules/project-conventions.md`: kiểm tra `functionId`/`screenId` trong context → suy từ ticketId/input → nếu không có, hỏi DEV xác nhận trực tiếp. KHÔNG ĐƯỢC GHI FILE khi chưa có `functionId`.
|
|
22
|
+
4. **Đảm bảo đang làm việc trên branch riêng của ticket (AK-Docs):** kiểm tra `AK-Docs` hiện đang ở branch nào (`git -C AK-Docs branch --show-current`). Nếu chưa ở `feature/[functionId]/[ticketId]` → hỏi DEV: "Chưa có branch riêng cho ticket này trong AK-Docs. Tạo branch `feature/[functionId]/[ticketId]` từ `main` — đồng ý không?" → đồng ý thì chạy `ak docs branch [functionId] [ticketId] --yes`; từ chối thì tiếp tục trên nhánh hiện tại (DEV tự quản lý branch). Đã đúng branch rồi thì bỏ qua. ❌ Không tự thêm `--yes` khi chưa thấy DEV xác nhận rõ ràng.
|
|
23
|
+
5. Define the prediction target, evaluation metric, baseline, success threshold, and constraints.
|
|
24
|
+
6. Run EDA; assess data quality and **leakage** (target leakage, train/test contamination, temporal leakage).
|
|
25
|
+
7. If anything is unclear — ask ONE question at a time, wait for reply.
|
|
26
|
+
8. Output `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` with:
|
|
25
27
|
- Problem statement, prediction target, and evaluation metric (with justification)
|
|
26
28
|
- Baseline definition and success threshold
|
|
27
29
|
- Data report (shape, quality, missing values, distributions)
|
|
28
30
|
- Leakage assessment (all three types checked)
|
|
29
31
|
- Constraints and effort estimate
|
|
30
|
-
|
|
32
|
+
9. Display "GATE 1: ML problem doc ready" → wait for **APPROVED**
|
|
31
33
|
|
|
32
34
|
> **Tip:** If auto-start doesn't trigger, the developer can start this gate by typing: **"start"**, **"Gate 1"** or **"Analyze ticket"**.
|
|
33
35
|
|
|
@@ -43,7 +45,7 @@ DO NOT just check format — **understand the data and propose solutions**.
|
|
|
43
45
|
**INVOKE:** `design-experiment` skill, then `superpowers:writing-plans`
|
|
44
46
|
|
|
45
47
|
- Define the validation strategy (CV scheme/splits, leakage prevention), candidate approaches and feature sets, ablation plan, and experiment-tracking setup.
|
|
46
|
-
- Output `
|
|
48
|
+
- Output `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md` with the detailed experiment plan.
|
|
47
49
|
- Display: "GATE 2 PAUSED: type APPROVED to start experiments".
|
|
48
50
|
- NO EXPERIMENTS OR TRAINING until "APPROVED" is received.
|
|
49
51
|
|
|
@@ -77,7 +79,7 @@ Mandatory order:
|
|
|
77
79
|
2. `evaluate-model` skill — held-out metrics vs baseline and threshold, error analysis, overfitting/leakage/drift checks
|
|
78
80
|
3. `impact-analysis` skill — assess data pipeline and downstream blast radius
|
|
79
81
|
4. Tick `custom/rules/ml-review-checklist.md`
|
|
80
|
-
5. Create `
|
|
82
|
+
5. Create `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` with the eval report and a model card draft (own section in the same file)
|
|
81
83
|
|
|
82
84
|
Then: "GATE 4 PAUSED: type APPROVED or BUG: [description]"
|
|
83
85
|
- Coding or pipeline bug → fix → repeat Gate 4.
|
|
@@ -97,7 +99,12 @@ Only runs after Gate 4 has been APPROVED.
|
|
|
97
99
|
- Version the artifact (model, training data version, code commit, config) in the registry.
|
|
98
100
|
- Package the full inference pipeline so serving matches training exactly.
|
|
99
101
|
- Define the monitoring plan (input drift, prediction distribution, latency, retraining trigger).
|
|
100
|
-
- Finalize the model card (intended use, data, metrics, limitations, owner).
|
|
101
|
-
-
|
|
102
|
+
- Finalize the model card (intended use, data, metrics, limitations, owner) in `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md`.
|
|
103
|
+
- **Submit `AK-Docs/04.Coding/` lên remote qua Merge Request TRƯỚC khi tạo Pull Request cho source code:**
|
|
104
|
+
- Soạn title + description cho MR (tóm tắt ML problem, experiment plan, eval report/model card), hiển thị cho DEV xem trước.
|
|
105
|
+
- Hỏi DEV: "Nội dung commit/MR như trên — đồng ý submit AK-Docs không?" → đồng ý thì chạy `ak docs submit --title "..." --description "..." --yes`; từ chối thì dừng, để DEV tự commit/tạo MR khi sẵn sàng.
|
|
106
|
+
- Thông báo DEV: 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 DEV tự merge.
|
|
107
|
+
- ❌ Không tự thêm `--yes` khi chưa thấy DEV gõ xác nhận rõ ràng trong hội thoại.
|
|
108
|
+
- Guide on creating a Pull Request (source code) with the ticket link.
|
|
102
109
|
|
|
103
110
|
> **Telemetry:** Run `ak gate 5 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
|
package/docs/common/AIFLOW.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
**Version:** 2.0.0 | **Package:** ai-flow-kit
|
|
4
4
|
|
|
5
|
-
> This workflow applies to
|
|
5
|
+
> This workflow applies to coding tasks: feature, bug-fix, refactor, investigation.
|
|
6
|
+
> For document generation tasks, use task type **`gen-doc`** — a 2-gate flow (Gate 1 + Gate 2 only).
|
|
6
7
|
> **Absolute Rule: Complete Gate N → Only then can you enter Gate N+1. No exceptions.**
|
|
7
8
|
|
|
8
9
|
---
|
|
@@ -399,6 +400,15 @@ Gate 1 (AI analyzes: dependency map, risk level, breaking changes, recommendatio
|
|
|
399
400
|
→ DONE (no Gates 2-5, implementation needs a separate ticket)
|
|
400
401
|
```
|
|
401
402
|
|
|
403
|
+
### Generate Document (gen-doc) — 2-Gate Flow
|
|
404
|
+
```
|
|
405
|
+
Gate 1 (AI reads requirement, plans document: outline, scope, output format, sources)
|
|
406
|
+
→ DEV reviews requirement.md → APPROVED
|
|
407
|
+
→ Gate 2 (AI generates document immediately: Markdown output.md or Excel)
|
|
408
|
+
(AI self-reviews + creates task-summary.md → task DONE)
|
|
409
|
+
→ NO Gate 3/4/5
|
|
410
|
+
```
|
|
411
|
+
|
|
402
412
|
---
|
|
403
413
|
|
|
404
414
|
## Skills Used in Workflow
|