@relipa/ai-flow-kit 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +253 -91
  2. package/bin/aiflow.js +49 -1
  3. package/custom/skills/ba-skills/skill-ba-phan-tich-ban-dau-v1.md +44 -0
  4. package/custom/skills/ba-skills/skill-ba-prototype-v1.md +35 -0
  5. package/custom/skills/ba-skills/skill-ba-qa-template-v1.md +21 -0
  6. package/custom/skills/ba-skills/skill-ba-qa-v1.md +35 -0
  7. package/custom/skills/ba-skills/skill-ba-template-phan-tich-ban-dau-v1.md +30 -0
  8. package/custom/skills/ba-skills/skill-ba-template-uc-v1.md +83 -0
  9. package/custom/skills/ba-skills/skill-ba-ve-luong-mermaid-v1.md +35 -0
  10. package/custom/skills/ba-skills/skill-ba-viet-spec-uc-v1.md +38 -0
  11. package/custom/skills/ba-skills/skill-ba-xay-dung-business-rules-v1.md +39 -0
  12. package/custom/skills/execute-flow/SKILL.md +27 -36
  13. package/custom/skills/gate-review/SKILL.md +119 -0
  14. package/custom/skills/generate-test-report/SKILL.md +1 -1
  15. package/custom/skills/generate-testcase/SKILL.md +50 -11
  16. package/custom/skills/generate-testcase/templates/testcase.md +50 -59
  17. package/custom/skills/test-analysis/SKILL.md +37 -3
  18. package/custom/skills/test-skills/categories/00-core/00.01.requirement-analysis.md +111 -0
  19. package/custom/skills/test-skills/categories/00-core/00.02.risk-analysis.md +24 -0
  20. package/custom/skills/test-skills/categories/00-core/00.03.test-scenario-builder.md +90 -0
  21. package/custom/skills/test-skills/categories/00-core/00.04.testcase-review.md +68 -0
  22. package/custom/skills/test-skills/categories/01-test-design/01.01.boundary-value-analysis.md +30 -0
  23. package/custom/skills/test-skills/categories/01-test-design/01.02.equivalence.partitioning.md +27 -0
  24. package/custom/skills/test-skills/categories/01-test-design/01.03.decision-table.md +26 -0
  25. package/custom/skills/test-skills/categories/01-test-design/01.04.state.transition.md +26 -0
  26. package/custom/skills/test-skills/categories/01-test-design/01.05.pairwise.md +25 -0
  27. package/custom/skills/test-skills/categories/01-test-design/01.06.error-guessing.md +28 -0
  28. package/custom/skills/test-skills/categories/02-ui-testing/02.01.UI-layout.md +29 -0
  29. package/custom/skills/test-skills/categories/02-ui-testing/02.02.form-validation.md +57 -0
  30. package/custom/skills/test-skills/categories/02-ui-testing/02.03.navigation.md +27 -0
  31. package/custom/skills/test-skills/categories/02-ui-testing/02.04.localization.md +27 -0
  32. package/custom/skills/test-skills/categories/02-ui-testing/02.05.accessibility.md +27 -0
  33. package/custom/skills/test-skills/categories/03-business-testing/03.01.CRUD-testing.md +51 -0
  34. package/custom/skills/test-skills/categories/03-business-testing/03.02.workflow-testing.md +44 -0
  35. package/custom/skills/test-skills/categories/03-business-testing/03.03.permission-testing.md +41 -0
  36. package/custom/skills/test-skills/categories/03-business-testing/03.04.dependency-validation.md +40 -0
  37. package/custom/skills/test-skills/categories/03-business-testing/03.05.notification-testing.md +43 -0
  38. package/custom/skills/test-skills/categories/03-business-testing/03.06.calculation.testing.md +44 -0
  39. package/custom/skills/test-skills/categories/04-data-testing/04.01.database-testing.md +43 -0
  40. package/custom/skills/test-skills/categories/04-data-testing/04.02.import-export-testing.md +43 -0
  41. package/custom/skills/test-skills/categories/04-data-testing/04.03.data-mapping.md +39 -0
  42. package/custom/skills/test-skills/categories/04-data-testing/04.04.duplicate-handling.md +39 -0
  43. package/custom/skills/test-skills/categories/04-data-testing/04.05.migration.md +42 -0
  44. package/custom/skills/test-skills/categories/05-integration/05.01.API-testing.md +37 -0
  45. package/custom/skills/test-skills/categories/05-integration/05.02.third-party-integration.md +36 -0
  46. package/custom/skills/test-skills/categories/05-integration/05.03.batch-processing.md +38 -0
  47. package/custom/skills/test-skills/categories/05-integration/05.04.file-upload-download.md +40 -0
  48. package/custom/skills/test-skills/categories/08-domain-skills/CMS.md +34 -0
  49. package/custom/skills/test-skills/categories/08-domain-skills/Ecommerce.md +35 -0
  50. package/custom/skills/test-skills/categories/99-review/99.01.coverage-review.md +35 -0
  51. package/custom/skills/test-skills/categories/99-review/99.02.knowledge-learning.md +34 -0
  52. package/custom/skills/test-skills/categories/99-review/99.03.repository-update.md +33 -0
  53. package/custom/skills/test-skills/categories/99-review/99.04.change-history.md +38 -0
  54. package/custom/skills/test-skills/rules/Directory_and_Naming_Convention.md +257 -0
  55. package/custom/skills/test-skills/rules/QA_Writing_Standards.md +49 -0
  56. package/custom/skills/test-skills/template/template_testcase.md +83 -0
  57. package/custom/templates/shared/create-spec-workflow.md +435 -0
  58. package/custom/templates/shared/create-testcase-workflow.md +470 -0
  59. package/custom/templates/shared/gate-workflow.md +122 -16
  60. package/docs/common/CHANGELOG.md +47 -0
  61. package/package.json +2 -2
  62. package/scripts/create-score-excel.js +17 -7
  63. package/scripts/init.js +48 -1
  64. package/scripts/review.js +128 -0
  65. package/scripts/update.js +4 -1
  66. package/scripts/use.js +22 -16
@@ -18,6 +18,8 @@ Read `.aiflow/context/current.json` → check the `taskType` field:
18
18
  | `testing` | **[TESTER] 4-Gate Testing Workflow** (below) |
19
19
  | `execute` | **[EXECUTE] Executing Flow** (below) |
20
20
  | `feature`, `bug-fix`, `refactor`, `investigation`, `documentation` | **[DEV] 5-Gate Development Workflow** (below) |
21
+ | `create-spec` | **[BA] 4-Gate Spec Creation Workflow** (below) |
22
+ | `create-testcase` | **[QA] 4-Gate TestCase Creation Workflow** (below) |
21
23
 
22
24
  If `taskType` is missing or unrecognized, default to the DEV workflow and ask ONE clarifying question.
23
25
 
@@ -40,14 +42,20 @@ AI actively reads ticket + source code to understand the requirement:
40
42
  - Requirements summary, source code analysis
41
43
  - Proposed solution and approach
42
44
  - Impact analysis, effort estimate, testing plan
43
- 6. Display "GATE 1: Requirement doc ready" wait for **APPROVED**
45
+ 6. **INVOKE** `gate-review` skill (generate mode) write `.aiflow/review/gate-1-[ticket-id].md`
46
+ 7. Display gate pause message from `gate-review` skill — wait for **APPROVED**
47
+
48
+ **When APPROVED received:**
49
+ → **INVOKE** `gate-review` skill (verify mode) — run `ak review check --gate 1 --ticket [ticket-id]`
50
+ → If passed: run `ak gate 1 approved --ticket [ticket-id]` → proceed to Gate 2
51
+ → If blocked: follow gate-review skill response protocol
44
52
 
45
53
  > **Tip:** If auto-start doesn't trigger, the developer can start this gate by typing: **"start"**, **"Gate 1"** or **"Analyze ticket"**.
46
54
 
47
55
  DO NOT just check format — **understand the content and propose solutions**.
48
56
 
49
57
  > **Telemetry:** Run `ak gate 1 start --ticket [ticket-id]` when starting this gate (auto-start or when developer types "start"/"Gate 1"). Run as-is — do NOT append shell redirects like `2>$null` or `>/dev/null`.
50
- > Run `ak gate 1 approved --ticket [ticket-id]` immediately when APPROVED is received. Run as-is — do NOT append shell redirects.
58
+ > Run `ak gate 1 approved --ticket [ticket-id]` after gate-review verify passes (see When APPROVED received block above). Run as-is — do NOT append shell redirects.
51
59
 
52
60
  ---
53
61
 
@@ -57,11 +65,16 @@ DO NOT just check format — **understand the content and propose solutions**.
57
65
 
58
66
  - Create a detailed TDD implementation plan based on the approved requirement.
59
67
  - Output `plan/[ticket-id]/plan.md` with the detailed TDD implementation plan.
60
- - Display: "GATE 2 PAUSED: type APPROVED to start coding".
61
- - CODE WILL NOT BE GENERATED until "APPROVED" is received.
68
+ - **INVOKE** `gate-review` skill (generate mode) write `.aiflow/review/gate-2-[ticket-id].md`
69
+ - Display gate pause message from `gate-review` skill — CODE WILL NOT BE GENERATED until all items checked and APPROVED received.
70
+
71
+ **When APPROVED received:**
72
+ → **INVOKE** `gate-review` skill (verify mode) — run `ak review check --gate 2 --ticket [ticket-id]`
73
+ → If passed: run `ak gate 2 approved --ticket [ticket-id]` → proceed to Gate 3
74
+ → If blocked: follow gate-review skill response protocol
62
75
 
63
76
  > **Telemetry:** Run `ak gate 2 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
64
- > Run `ak gate 2 approved --ticket [ticket-id]` immediately when APPROVED is received. Run as-is — do NOT append shell redirects.
77
+ > Run `ak gate 2 approved --ticket [ticket-id]` after gate-review verify passes (see When APPROVED received block above). Run as-is — do NOT append shell redirects.
65
78
 
66
79
  ---
67
80
 
@@ -88,12 +101,21 @@ Mandatory order:
88
101
  3. Tick `custom/rules/review-checklist.md`
89
102
  4. Create `plan/[ticket-id]/summary.md`
90
103
 
91
- Then: "GATE 4 PAUSED: type APPROVED or BUG: [description]"
92
- - Coding bug -> fix -> repeat Gate 4.
93
- - Requirement bug -> return to Gate 1.
104
+ Then:
105
+ - **INVOKE** `gate-review` skill (generate mode) write `.aiflow/review/gate-4-[ticket-id].md`
106
+ - Display gate pause message from `gate-review` skill. Also accepts `BUG: [description]` (bypasses review check — goes directly to fix cycle).
107
+
108
+ **When APPROVED received:**
109
+ → **INVOKE** `gate-review` skill (verify mode) — run `ak review check --gate 4 --ticket [ticket-id]`
110
+ → If passed: run `ak gate 4 approved --ticket [ticket-id]` → proceed to Gate 5
111
+ → If blocked: follow gate-review skill response protocol
112
+
113
+ **When BUG: [description] received (no review check needed):**
114
+ - Coding bug → fix → repeat Gate 4 (re-generate review file)
115
+ - Requirement bug → return to Gate 1
94
116
 
95
117
  > **Telemetry:** Run `ak gate 4 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
96
- > Run `ak gate 4 approved --ticket [ticket-id]` immediately when APPROVED is received. Run as-is — do NOT append shell redirects.
118
+ > Run `ak gate 4 approved --ticket [ticket-id]` after gate-review verify passes (see When APPROVED received block above). Run as-is — do NOT append shell redirects.
97
119
 
98
120
  ---
99
121
 
@@ -122,18 +144,24 @@ Guide on creating a Pull Request with the ticket link.
122
144
  3. Analyze scope, functional flows, non-functional requirements, risks
123
145
  4. Ask clarifying questions — **ONE at a time**, wait for reply
124
146
  5. Write `test-plan/test-analysis.md`
125
- 6. Display gate pausewait for **APPROVED**
147
+ 6. **INVOKE** `gate-review` skill (generate mode) write `.aiflow/review/gate-1-[ticket-id].md`
148
+ 7. Display gate pause message from `gate-review` skill — wait for **APPROVED**
126
149
 
127
150
  > **Tip:** TESTER can trigger with: **"start"**, **"Gate 1"** or **"Analyze ticket"**.
128
151
 
129
152
  ```
130
153
  ⏸️ GATE 1: TEST ANALYSIS READY
131
- → Review: test-plan/test-analysis.md
154
+ → Review: [test-plan/test-analysis.md](test-plan/test-analysis.md)
132
155
  → Type APPROVED to proceed to Gate 2
133
156
  ```
134
157
 
158
+ **When APPROVED received:**
159
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 1 --ticket [ticket-id]`
160
+ → If passed: `ak gate 1 approved --ticket [ticket-id]` → Gate 2
161
+ → If blocked: follow gate-review skill response protocol
162
+
135
163
  > **Telemetry:** Run `ak gate 1 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
136
- > Run `ak gate 1 approved --ticket [ticket-id]` immediately when APPROVED is received. Run as-is — do NOT append shell redirects.
164
+ > Run `ak gate 1 approved --ticket [ticket-id]` after gate-review verify passes (see When APPROVED received block above). Run as-is — do NOT append shell redirects.
137
165
 
138
166
  ---
139
167
 
@@ -152,12 +180,19 @@ Only runs after Gate 1 APPROVED.
152
180
  - If TESTER declared `PR: <url>` → **INVOKE** `pr-impact-analysis` skill (Dev Artifacts Check) first
153
181
  - Generate test scenarios/checklist TABLE covering: Happy Path, Negative, Validation, Boundary, Edge Cases, State Transitions, Role-based, Accessibility, Compatibility, Data Integrity, Integration, Exploratory
154
182
  - Save `test-plan/checklist.md`
183
+ - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-2a-[ticket-id].md`
184
+ - Display gate pause message from `gate-review` skill — wait for **APPROVED**
155
185
 
156
186
  ```
157
187
  ⏸️ GATE 2a: SCENARIOS READY
158
188
  → Type APPROVED to generate test cases
159
189
  ```
160
190
 
191
+ **When APPROVED received:**
192
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 2a --ticket [ticket-id]`
193
+ → If passed: `ak gate 2a approved --ticket [ticket-id]` → Phase 2b
194
+ → If blocked: follow gate-review skill response protocol
195
+
161
196
  #### Phase 2b — Generate Test Cases
162
197
 
163
198
  **INVOKE:** `generate-testcase` skill (Phase 2b)
@@ -166,24 +201,38 @@ Only runs after Gate 1 APPROVED.
166
201
  - TC_ID format: `TC_[Module]_[NNN]` (e.g. `TC_Login_001`)
167
202
  - Expected result ONLY from ticket/spec — never from PR/dev description
168
203
  - Save `test-plan/test-cases/`
204
+ - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-2b-[ticket-id].md`
205
+ - Display gate pause message from `gate-review` skill — wait for **APPROVED**
169
206
 
170
207
  ```
171
208
  ⏸️ GATE 2b: TEST CASES READY
172
209
  → Type APPROVED to proceed to review
173
210
  ```
174
211
 
212
+ **When APPROVED received:**
213
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 2b --ticket [ticket-id]`
214
+ → If passed: `ak gate 2b approved --ticket [ticket-id]` → Phase 2c
215
+ → If blocked: follow gate-review skill response protocol
216
+
175
217
  #### Phase 2c — Review & Optimize
176
218
 
177
219
  **INVOKE:** `generate-testcase` skill (Phase 2c)
178
220
 
179
221
  - Self-review: check duplicates, problematic TCs (vague steps, unmeasurable expected result), missing TCs, coverage gaps, accessibility/compatibility coverage
180
222
  - Output `test-plan/review-report.md` with action items
223
+ - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-2c-[ticket-id].md`
224
+ - Display gate pause message from `gate-review` skill — wait for **APPROVED**
181
225
 
182
226
  ```
183
227
  ⏸️ GATE 2c: REVIEW COMPLETE
184
228
  → Type APPROVED to finalize and generate scripts
185
229
  ```
186
230
 
231
+ **When APPROVED received:**
232
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 2c --ticket [ticket-id]`
233
+ → If passed: `ak gate 2c approved --ticket [ticket-id]` → Phase 2d
234
+ → If blocked: follow gate-review skill response protocol
235
+
187
236
  #### Phase 2d — Coverage Check & Playwright Scripts
188
237
 
189
238
  **INVOKE:** `coverage-check` skill
@@ -192,6 +241,8 @@ Only runs after Gate 1 APPROVED.
192
241
  - Generate coverage matrix (requirement → TC IDs)
193
242
  - Export final test case set to `test-plan/test-cases/final-testcases.md`
194
243
  - **INVOKE** `automation-testing` skill → generate Playwright scripts to `test-plan/test-scripts/`
244
+ - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-2d-[ticket-id].md`
245
+ - Display gate pause message from `gate-review` skill — wait for **APPROVED**
195
246
 
196
247
  ```
197
248
  ⏸️ GATE 2: TEST PLAN READY
@@ -201,7 +252,12 @@ Scripts: [N] Playwright specs generated
201
252
  → Type APPROVED to proceed to Gate 3 (execution)
202
253
  ```
203
254
 
204
- > **Telemetry:** Run `ak gate 2 approved --ticket [ticket-id]` immediately when final APPROVED received. Run as-is — do NOT append shell redirects.
255
+ **When APPROVED received:**
256
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 2d --ticket [ticket-id]`
257
+ → If passed: `ak gate 2 approved --ticket [ticket-id]` → Gate 3
258
+ → If blocked: follow gate-review skill response protocol
259
+
260
+ > **Telemetry:** Run `ak gate 2 approved --ticket [ticket-id]` after gate-review verify passes (see When APPROVED received block above). Run as-is — do NOT append shell redirects.
205
261
 
206
262
  ---
207
263
 
@@ -236,6 +292,9 @@ BASE_URL=<url> npx playwright test --headed
236
292
  - Update evidence (create `run-N/` subfolder — never delete prior evidence)
237
293
  - Update bug status (RESOLVED / Still OPEN)
238
294
 
295
+ **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-3-[ticket-id].md` — summarize execution results + bug list
296
+ Display gate pause message from `gate-review` skill — wait for **APPROVED**
297
+
239
298
  ```
240
299
  ⏸️ GATE 3: EXECUTION COMPLETE
241
300
  Passed: [N] | Failed: [N] | Blocked: [N]
@@ -245,6 +304,11 @@ Bugs: [N Critical] [N High] [N Medium] [N Low]
245
304
  → Type PR: [url] to declare new dev PRs
246
305
  ```
247
306
 
307
+ **When APPROVED received:**
308
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 3 --ticket [ticket-id]`
309
+ → If passed: `ak gate 3 approved --ticket [ticket-id]` → Gate 4
310
+ → If blocked: follow gate-review skill response protocol
311
+
248
312
  > **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
249
313
 
250
314
  ---
@@ -261,6 +325,9 @@ Only runs after Gate 3 APPROVED.
261
325
  4. Determine Go / No-Go: 0 unresolved Critical = Go
262
326
  5. Write `test-plan/test-report.md`
263
327
 
328
+ - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-4-[ticket-id].md` — summarize test report + go/no-go decision
329
+ - Display gate pause message from `gate-review` skill. Also accepts `NO-GO: [reason]` (bypasses review check).
330
+
264
331
  ```
265
332
  ⏸️ GATE 4: TEST REPORT READY
266
333
  Decision: [GO / NO-GO]
@@ -270,8 +337,15 @@ Coverage: [N]% acceptance criteria
270
337
  → Type NO-GO: [reason] to reject release
271
338
  ```
272
339
 
340
+ **When APPROVED received:**
341
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 4 --ticket [ticket-id]`
342
+ → If passed: `ak gate 4 approved --ticket [ticket-id]` → sign off complete
343
+ → If blocked: follow gate-review skill response protocol
344
+
345
+ **When NO-GO: [reason] received (no review check needed):** reject release per reason.
346
+
273
347
  > **Telemetry:** Run `ak gate 4 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
274
- > Run `ak gate 4 approved --ticket [ticket-id]` immediately when APPROVED received. Run as-is — do NOT append shell redirects.
348
+ > Run `ak gate 4 approved --ticket [ticket-id]` after gate-review verify passes (see When APPROVED received block above). Run as-is — do NOT append shell redirects.
275
349
 
276
350
  ---
277
351
 
@@ -297,15 +371,23 @@ Pre-flight checks (stop and report if any fail):
297
371
 
298
372
  Then display work plan:
299
373
 
374
+ - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-1-[ticket-id].md`
375
+ - Display gate pause message from `gate-review` skill — wait for **APPROVED**
376
+
300
377
  ```
301
378
  ⏸️ GATE 1: EXECUTE FLOW READY
302
- TC file: [path]
379
+ TC file: [path](path)
303
380
  Repo: [repo]
304
381
  Screen: [ScreenID] — [Screen Name]
305
382
  BASE_URL: [url]
306
383
  → Type APPROVED to sync scripts (Gate 2)
307
384
  ```
308
385
 
386
+ **When APPROVED received:**
387
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 1 --ticket [ticket-id]`
388
+ → If passed: `ak gate 1 approved --ticket [ticket-id]` → Gate 2
389
+ → If blocked: follow gate-review skill response protocol
390
+
309
391
  > **Telemetry:** Run `ak gate 1 start --ticket [ticket-id]` when starting. Run `ak gate 1 approved --ticket [ticket-id]` when APPROVED.
310
392
 
311
393
  ---
@@ -324,12 +406,20 @@ Hash-based TC↔script sync — for each TC in the file:
324
406
 
325
407
  Output: `ak-test/{repo}/scripts/{screenId}/{ScreenID}.spec.ts` (1 file per screen, all TCs inside)
326
408
 
409
+ - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-2-[ticket-id].md`
410
+ - Display gate pause message from `gate-review` skill — wait for **APPROVED**
411
+
327
412
  ```
328
413
  ⏸️ GATE 2: SCRIPT SYNC COMPLETE
329
414
  ✅ New: [N] | 🔄 Updated: [N] | ⏭️ Skipped: [N] | ⚠️ Manual: [N]
330
415
  → Type APPROVED to execute (Gate 3)
331
416
  ```
332
417
 
418
+ **When APPROVED received:**
419
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 2 --ticket [ticket-id]`
420
+ → If passed: `ak gate 2 approved --ticket [ticket-id]` → Gate 3
421
+ → If blocked: follow gate-review skill response protocol
422
+
333
423
  ---
334
424
 
335
425
  ### GATE 3 — Execute & Evidence
@@ -359,6 +449,9 @@ BASE_URL=<url> npx playwright test scripts/{screenId}/{ScreenID}.spec.ts
359
449
  - Create new `run-{N}/` — never delete prior runs
360
450
  - Update R1/R2 columns
361
451
 
452
+ **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-3-[ticket-id].md`
453
+ Display gate pause message from `gate-review` skill — wait for **APPROVED**
454
+
362
455
  ```
363
456
  ⏸️ GATE 3: EXECUTION COMPLETE
364
457
  Run: run-{N} | Passed: [N] | Failed: [N] | Untest: [N] | Pending: [N]
@@ -367,6 +460,11 @@ Run: run-{N} | Passed: [N] | Failed: [N] | Untest: [N] | Pending: [N]
367
460
  → Type PR: [url] to declare a dev fix PR
368
461
  ```
369
462
 
463
+ **When APPROVED received:**
464
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 3 --ticket [ticket-id]`
465
+ → If passed: `ak gate 3 approved --ticket [ticket-id]` → Gate 4
466
+ → If blocked: follow gate-review skill response protocol
467
+
370
468
  > **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting. Run as-is — do NOT append shell redirects.
371
469
 
372
470
  ---
@@ -384,12 +482,20 @@ Only runs after Gate 3 APPROVED.
384
482
 
385
483
  Wait for reply before moving to next bug.
386
484
 
485
+ - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-4-[ticket-id].md`
486
+ - Display gate pause message from `gate-review` skill — wait for **APPROVED**
487
+
387
488
  ```
388
489
  ⏸️ GATE 4: REPORT READY
389
490
  Decision: [GO / NO-GO]
390
491
  Bugs logged: [N] | Skipped: [N]
391
- → Review: ak-test/{repo}/results/{screenId}/run-{N}/testreport.md
492
+ → Review: [ak-test/{repo}/results/{screenId}/run-{N}/testreport.md](ak-test/{repo}/results/{screenId}/run-{N}/testreport.md)
392
493
  → Type APPROVED to sign off
393
494
  ```
394
495
 
496
+ **When APPROVED received:**
497
+ → **INVOKE** `gate-review` skill (verify mode) — `ak review check --gate 4 --ticket [ticket-id]`
498
+ → If passed: `ak gate 4 approved --ticket [ticket-id]` → sign off complete
499
+ → If blocked: follow gate-review skill response protocol
500
+
395
501
  > **Telemetry:** Run `ak gate 4 start --ticket [ticket-id]` when starting. Run `ak gate 4 approved --ticket [ticket-id]` when APPROVED.
@@ -7,6 +7,53 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.1.4] - 2026-06-29
11
+
12
+ ### Added
13
+
14
+ - **`spec` task type — 4-Gate BA Workflow (Create Spec)** — New end-to-end spec creation workflow for Business Analysts. Activated when `taskType: "spec"` in context. Orchestrated by the `create-spec` skill across 4 gates:
15
+ - **Gate 1 — Phân tích Yêu cầu Ban đầu**: AI reads ticket, classifies Facts vs Assumptions, identifies Gaps, generates a Q&A list for clarification. BA reviews → `APPROVED`.
16
+ - **Gate 2 — Q&A Loop & Confirm**: AI iterates through each Q&A answer, updates analysis until all items are Confirmed. BA approves full Q&A → `APPROVED`.
17
+ - **Gate 3 — Prototype Design**: AI generates HTML/CSS prototype for the main screens. BA reviews UI flow → `APPROVED`.
18
+ - **Gate 4 — UC Spec hoàn chỉnh**: AI produces a complete UC Spec document (flows, business rules, validations, edge cases). BA reviews → `APPROVED`.
19
+
20
+ - **`testcase` task type — 4-Gate QA Workflow (Create Testcase)** — New structured test case creation workflow for QA engineers. Activated when `taskType: "testcase"` in context. Orchestrated by the `create-testcase` skill across 4 gates:
21
+ - **Gate 1 — Phân tích Yêu cầu & Rủi ro**: AI reads ticket/spec, analyzes scope and risk, reads source code to discover hidden validation rules and business logic. QA reviews → `APPROVED`.
22
+ - **Gate 2 — Xây dựng Scenarios & Checklist**: AI generates checklist grouped by Functional, Non-functional, Data & Integration, Regression. Checks Dev Artifacts (PR diff) via `pr-impact-analysis` skill to add regression TCs. Output: `test-plan/checklist.md`. QA reviews → `APPROVED`.
23
+ - **Gate 3 — Thiết kế Test Case chi tiết**: AI generates full TC table (TC_ID, Steps, Expected Result) using BVA, Equivalence Partitioning, Decision Table, State Transition techniques. Output: `test-plan/test-cases/`. QA reviews → `APPROVED`.
24
+ - **Gate 4 — Review & Tối ưu**: AI reviews coverage, removes duplicates, adds missing edge cases, exports final set to `test-plan/test-cases/final-testcases.md`. QA reviews → `APPROVED`.
25
+
26
+ - **BA Skills Library** (`custom/skills/ba-skills/`) — New collection of BA-specific sub-skills:
27
+ - `skill-ba-phan-tich-ban-dau-v1` — Initial requirement analysis (Facts vs Assumptions, Gap Analysis)
28
+ - `skill-ba-qa-v1` — Q&A generation and confirmation loop
29
+ - `skill-ba-viet-spec-uc-v1` — UC Spec writing with flows, business rules, validations
30
+ - `skill-ba-prototype-v1` — HTML/CSS prototype generation for UI screens
31
+ - `skill-ba-ve-luong-mermaid-v1` — Mermaid flow diagram generation
32
+ - `skill-ba-xay-dung-business-rules-v1` — Business rules extraction and structuring
33
+
34
+ - **Test Skills Library** (`custom/skills/test-skills/`) — New collection of 20+ QA sub-skills organized by category:
35
+ - **Core**: `requirement-analysis`, `risk-analysis`, `test-scenario-builder`, `testcase-review`
36
+ - **Test Design**: `boundary-value-analysis`, `equivalence-partitioning`, `decision-table`, `state-transition`, `pairwise`, `error-guessing`
37
+ - **UI Testing**: `UI-layout`, `form-validation`, `navigation`, `localization`, `accessibility`
38
+ - **Business Testing**: `CRUD-testing`, `workflow-testing`, `permission-testing`, `dependency-validation`, `notification-testing`, `calculation-testing`
39
+ - **Data Testing**: `database-testing`, `import-export-testing`, `data-mapping`, `duplicate-handling`, `migration`
40
+ - **Integration**: `API-testing`, `third-party-integration`, `batch-processing`, `file-upload-download`
41
+ - **Domain Skills**: `CMS`, `Ecommerce`
42
+ - **Review**: `coverage-review`, `knowledge-learning`, `repository-update`, `change-history`
43
+
44
+ - **`gate-review` skill** (`custom/skills/gate-review/SKILL.md`) — New gate review orchestration skill that enforces explicit `APPROVED` at each gate boundary across all workflow types (coding, execute, spec, testcase). Prevents silent gate advancement without QA/BA/DEV sign-off.
45
+
46
+ - **Gate review protocol in Execute Test Flow** — Gates 1, 3, and 4 of the execute-flow now explicitly require QA `APPROVED` before advancing. Gate 2 (Script Sync) is AI-only and advances automatically after sync completes.
47
+
48
+ - **`spec` and `testcase` options in `ak use` type selector** — Both the `promptForTaskType()` shared function and the `manualContext()` flow now include `spec` and `testcase` as selectable types, routing AI to the correct 4-gate workflow.
49
+
50
+ ### Changed
51
+
52
+ - **`aiflow` CLI alias fully deprecated → use `ak`** — All documentation, README, QUICK_START, cli-reference, and guide output updated to use `ak` as the primary command. The `aiflow` command still works but shows a deprecation warning on every invocation.
53
+ - **README restructured** — "Overview Flow" section renamed to "Coding Flow"; Execute Test Flow merged into a single diagram (removed duplicate Vietnamese section); Create Spec Flow and Create Testcase Flow diagrams added.
54
+
55
+ ---
56
+
10
57
  ## [0.1.3] - 2026-06-18
11
58
 
12
59
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relipa/ai-flow-kit",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "All-in-one AI Flow Kit for team development with Claude AI - skills, templates, and MCP adapters",
5
5
  "author": "Example Team",
6
6
  "publishConfig": {
@@ -65,4 +65,4 @@
65
65
  "<rootDir>/tests/**/*.test.js"
66
66
  ]
67
67
  }
68
- }
68
+ }
@@ -164,16 +164,25 @@ function buildRow(email, u) {
164
164
  const ticketsStr = ticketsCompleted.length ? ticketsCompleted.join(', ') : '';
165
165
 
166
166
  // Notes
167
+ const onlyExploreCmds = [...rawCmds].every(c => EXPLORE_CMDS.has(c));
167
168
  let notes = '';
168
- if (score === 0) notes = 'Không có event nào trong tuần';
169
- else if (score === 1) notes = 'Chỉ lệnh khám phá cơ bản (init/update/version/help)';
169
+ if (score === 0) notes = 'Không có hoạt động';
170
+ else if (score === 1) notes = 'Chỉ dùng lệnh khám phá';
170
171
  else if (score === 2) {
171
- if (ticketsStarted.length > 0) notes = `Có gate.start nhưng chưa gate4.approved, ${activeDays} ngày active`;
172
- else notes = `${displayCmds.slice(0, 3).join('/')}, ${activeDays} ngày active, chưa dùng gate workflow`;
172
+ if (ticketsStarted.length > 0)
173
+ notes = `${ticketsStarted.length} ticket(s) trong tuần; gate.start nhưng chưa hoàn thành ticket`;
174
+ else if (onlyExploreCmds)
175
+ notes = 'Chỉ dùng lệnh khám phá';
173
176
  }
174
- else if (score === 3) notes = `Gate workflow bắt đầu, ${ticketsStarted.length} ticket(s), chưa hoàn thành`;
175
- else if (score === 4) notes = `${ticketsCompleted.length} ticket hoàn thành (gate4+)`;
176
- else if (score === 5) notes = `Gate 3-5 approved, ${ticketsCompleted.length} tickets hoàn thành`;
177
+ else if (score === 3)
178
+ notes = `${ticketsStarted.length} ticket(s) trong tuần; Có gate.start nhưng chưa hoàn thành ticket`;
179
+ else if (score === 4) {
180
+ notes = `Gate 3-5 approved; ${ticketsCompleted.length} ticket(s) hoàn thành`;
181
+ if (ticketsStarted.length > ticketsCompleted.length)
182
+ notes += `; ${ticketsStarted.length} ticket(s) trong tuần`;
183
+ }
184
+ else if (score === 5)
185
+ notes = `Gate 3-5 approved; ${ticketsCompleted.length} ticket(s) hoàn thành; ${ticketsStarted.length} ticket(s) trong tuần`;
177
186
 
178
187
  return {
179
188
  email,
@@ -315,6 +324,7 @@ const CANONICAL_USERS = [
315
324
  const LOG_EMAIL_ALIAS = {
316
325
  'tructh@relipasoft.com': 'tructth@relipasoft.com',
317
326
  'duongnt1@relipasoft.com': 'duongnt@relipasoft.com',
327
+ 'anhtt2@relipasoft.com': 'anhtt@relipasoft.com',
318
328
  };
319
329
 
320
330
  const EMPTY_USER = (email) => ({
package/scripts/init.js CHANGED
@@ -285,6 +285,37 @@ async function verifySuperpowersSkills(versionDir) {
285
285
  }
286
286
  }
287
287
 
288
+ /**
289
+ * Install Claude Code custom commands from shared workflow templates.
290
+ * Creates .claude/commands/<name>.md for each shared workflow template.
291
+ * Users can invoke these with /<name> in Claude Code.
292
+ */
293
+ async function setupClaudeCommands(projectDir) {
294
+ const commandsDir = path.join(projectDir, '.claude', 'commands');
295
+ await fs.ensureDir(commandsDir);
296
+
297
+ const commands = [
298
+ {
299
+ src: path.join(PKG_DIR, 'custom', 'templates', 'shared', 'create-spec-workflow.md'),
300
+ dest: 'create-spec.md',
301
+ description: 'BA 4-Gate Spec Creation Workflow — converts raw requirements (Jira/Backlog/file) into complete UC Spec documents following the UCflow process: Gate 1 (analysis & Q&A), Gate 2 (Q&A loop until all Confirmed), Gate 3 (HTML/CSS prototype design), Gate 4 (full UC Spec). Reads BA sub-skills from .claude/skills/ba-skills/.',
302
+ },
303
+ {
304
+ src: path.join(PKG_DIR, 'custom', 'templates', 'shared', 'create-testcase-workflow.md'),
305
+ dest: 'create-testcase.md',
306
+ description: 'QA 4-Gate TestCase Creation Workflow — converts raw requirements (SRS/Backlog/Jira/Spec file) into a complete, execution-ready Test Case set following the QA Workflow standard: Gate 1 (requirement & risk analysis), Gate 2 (scenario building), Gate 3 (detailed test case design), Gate 4 (review & optimization). Reads QA sub-skills from .claude/skills/test-skills/.',
307
+ },
308
+ ];
309
+
310
+ for (const cmd of commands) {
311
+ if (!(await fs.pathExists(cmd.src))) continue;
312
+ const body = await fs.readFile(cmd.src, 'utf-8');
313
+ const content = `---\ndescription: ${cmd.description}\n---\n\n${body}`;
314
+ await fs.writeFile(path.join(commandsDir, cmd.dest), content);
315
+ console.log(chalk.green(`✓ Installed /${path.basename(cmd.dest, '.md')} command → .claude/commands/${cmd.dest}`));
316
+ }
317
+ }
318
+
288
319
 
289
320
  async function generateSkillRegistry(projectDir) {
290
321
  const skillsDir = path.join(projectDir, '.claude', 'skills');
@@ -332,10 +363,24 @@ async function setupFramework(projectDir, framework, multi = false, selectedTool
332
363
  const frameworkContent = await fs.readFile(frameworkTemplatePath, 'utf-8');
333
364
  const workflowFile = resolveWorkflowFile(framework);
334
365
  const workflowPath = path.join(PKG_DIR, 'custom', 'templates', 'shared', workflowFile);
335
- const workflowContent = (await fs.pathExists(workflowPath))
366
+ const gateWorkflowContent = (await fs.pathExists(workflowPath))
336
367
  ? await fs.readFile(workflowPath, 'utf-8')
337
368
  : '';
338
369
 
370
+ // Load BA spec creation workflow (appended to all instruction files)
371
+ const createSpecPath = path.join(PKG_DIR, 'custom', 'templates', 'shared', 'create-spec-workflow.md');
372
+ const createSpecContent = (await fs.pathExists(createSpecPath))
373
+ ? await fs.readFile(createSpecPath, 'utf-8')
374
+ : '';
375
+
376
+ // Load QA testcase creation workflow (appended to all instruction files)
377
+ const createTestcasePath = path.join(PKG_DIR, 'custom', 'templates', 'shared', 'create-testcase-workflow.md');
378
+ const createTestcaseContent = (await fs.pathExists(createTestcasePath))
379
+ ? await fs.readFile(createTestcasePath, 'utf-8')
380
+ : '';
381
+
382
+ const workflowContent = [gateWorkflowContent, createSpecContent, createTestcaseContent].filter(Boolean).join('\n\n---\n\n');
383
+
339
384
  const separator = `\n\n---\n\n`;
340
385
  const skillRegistry = await generateSkillRegistry(projectDir);
341
386
 
@@ -1047,6 +1092,7 @@ async function init(options) {
1047
1092
  await verifySuperpowersSkills(versionDir);
1048
1093
  await updateSymlinks(projectDir, versionDir);
1049
1094
  await copyDocsToProject(projectDir);
1095
+ await setupClaudeCommands(projectDir);
1050
1096
 
1051
1097
  const selectedTools = options.aiTools || Object.keys(AI_TOOL_FILES);
1052
1098
  for (const fw of frameworks) {
@@ -1103,6 +1149,7 @@ module.exports.AI_TOOL_FILES = AI_TOOL_FILES;
1103
1149
  module.exports.detectRtk = detectRtk;
1104
1150
  module.exports.isRtkHookConfigured = isRtkHookConfigured;
1105
1151
  module.exports.isGitNexusConfigured = isGitNexusConfigured;
1152
+ module.exports.setupClaudeCommands = setupClaudeCommands;
1106
1153
  module.exports.setupFramework = setupFramework;
1107
1154
  module.exports.ensureAiflowGitignored = ensureAiflowGitignored;
1108
1155
  module.exports.resolveWorkflowFile = resolveWorkflowFile;
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs-extra');
4
+ const path = require('path');
5
+
6
+ const REVIEW_DIR = '.aiflow/review';
7
+
8
+ function reviewFilePath(gate, ticketId) {
9
+ return path.join(process.cwd(), REVIEW_DIR, `gate-${gate}-${ticketId}.md`);
10
+ }
11
+
12
+ function commentsFilePath(ticketId) {
13
+ return path.join(process.cwd(), REVIEW_DIR, `comments-${ticketId}.json`);
14
+ }
15
+
16
+ /**
17
+ * Parse a gate review file and return checkbox state.
18
+ *
19
+ * @param {number} gate
20
+ * @param {string} ticketId
21
+ * @returns {Promise<{exists: boolean, passed?: boolean, total?: number, unchecked?: string[], commented?: Array<{item: string, comment: string}>}>}
22
+ */
23
+ async function checkReviewFile(gate, ticketId) {
24
+ const mdPath = reviewFilePath(gate, ticketId);
25
+ const jsonPath = commentsFilePath(ticketId);
26
+
27
+ const mdExists = await fs.pathExists(mdPath);
28
+ const jsonExists = await fs.pathExists(jsonPath);
29
+
30
+ if (!mdExists && !jsonExists) {
31
+ return { exists: false };
32
+ }
33
+
34
+ const unchecked = [];
35
+ const commented = [];
36
+ let total = 0;
37
+
38
+ // 1. Process JSON comments if file exists
39
+ if (jsonExists) {
40
+ try {
41
+ const data = await fs.readJson(jsonPath);
42
+ const comments = Array.isArray(data) ? data : (data.comments || []);
43
+
44
+ // Filter comments by gate
45
+ const gateComments = comments.filter(c => String(c.gate) === String(gate));
46
+ total += gateComments.length;
47
+
48
+ for (const comment of gateComments) {
49
+ const isUnresolved = comment.status === 'active' || comment.status === 'unresolved';
50
+ if (isUnresolved) {
51
+ const fileLabel = comment.filePath ? path.basename(comment.filePath) : 'File';
52
+ const itemLabel = `**[${fileLabel}:${comment.line || 1}]**`;
53
+ commented.push({
54
+ item: itemLabel,
55
+ comment: comment.text
56
+ });
57
+ }
58
+ }
59
+ } catch (err) {
60
+ console.error(`Error reading comments JSON: ${err.message}`);
61
+ }
62
+ }
63
+
64
+ // 2. Process MD checklist if file exists
65
+ if (mdExists) {
66
+ const content = await fs.readFile(mdPath, 'utf-8');
67
+ const lines = content.split('\n');
68
+
69
+ for (let i = 0; i < lines.length; i++) {
70
+ const line = lines[i];
71
+ const checkboxMatch = line.match(/^- \[([ xX])\] (.+)/);
72
+ if (!checkboxMatch) continue;
73
+
74
+ total++;
75
+ const isChecked = checkboxMatch[1].toLowerCase() === 'x';
76
+ const itemText = checkboxMatch[2].trim();
77
+
78
+ if (!isChecked) {
79
+ let comment = null;
80
+ let commentBuffer = '';
81
+ let inComment = false;
82
+ for (let j = i + 1; j < lines.length; j++) {
83
+ const nextLine = lines[j].trim();
84
+ if (!inComment && nextLine.match(/^- \[/)) break;
85
+ if (!inComment && nextLine === '---') break;
86
+ if (!inComment) {
87
+ const singleLineMatch = nextLine.match(/<!--([\s\S]+?)-->/);
88
+ if (singleLineMatch) {
89
+ comment = singleLineMatch[1].trim();
90
+ break;
91
+ }
92
+ if (nextLine.includes('<!--')) {
93
+ inComment = true;
94
+ commentBuffer = nextLine.replace(/^.*<!--/, '');
95
+ if (commentBuffer.includes('-->')) {
96
+ comment = commentBuffer.replace(/-->.*$/, '').trim();
97
+ break;
98
+ }
99
+ continue;
100
+ }
101
+ } else {
102
+ if (nextLine.includes('-->')) {
103
+ commentBuffer += ' ' + nextLine.replace(/-->.*$/, '');
104
+ comment = commentBuffer.trim();
105
+ break;
106
+ }
107
+ commentBuffer += ' ' + nextLine;
108
+ }
109
+ }
110
+ if (comment) {
111
+ commented.push({ item: itemText, comment });
112
+ } else {
113
+ unchecked.push(itemText);
114
+ }
115
+ }
116
+ }
117
+ }
118
+
119
+ return {
120
+ exists: true,
121
+ passed: unchecked.length === 0 && commented.length === 0,
122
+ total,
123
+ unchecked,
124
+ commented,
125
+ };
126
+ }
127
+
128
+ module.exports = { checkReviewFile, reviewFilePath, commentsFilePath };
package/scripts/update.js CHANGED
@@ -110,13 +110,16 @@ module.exports = async function update(options = {}) {
110
110
 
111
111
  // Sync instruction files with the updated skills.
112
112
  // Support both old 'framework' (singular string) and new 'frameworks' (array).
113
- const { setupFramework, AI_TOOL_FILES, ensureAiflowGitignored } = require('./init');
113
+ const { setupFramework, AI_TOOL_FILES, ensureAiflowGitignored, setupClaudeCommands } = require('./init');
114
114
  const frameworks = state.frameworks || (state.framework ? [state.framework] : []);
115
115
  const selectedTools = state.aiTools || Object.keys(AI_TOOL_FILES);
116
116
  for (const fw of frameworks) {
117
117
  await setupFramework(projectDir, fw, frameworks.length > 1, selectedTools, { force: true });
118
118
  }
119
119
 
120
+ // Install / refresh Claude Code custom commands (.claude/commands/)
121
+ await setupClaudeCommands(projectDir);
122
+
120
123
  // Ensure all aiflow files are gitignored (especially for projects upgrading from older versions)
121
124
  await ensureAiflowGitignored(projectDir);
122
125