@relipa/ai-flow-kit 0.1.2-beta.0 → 0.1.3

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 (41) hide show
  1. package/README.md +26 -0
  2. package/bin/aiflow.js +40 -1
  3. package/custom/harness/playwright/.env.example +10 -0
  4. package/custom/harness/playwright/playwright.config.ts +34 -0
  5. package/custom/harness/playwright/tests/e2e/auth.setup.ts +25 -0
  6. package/custom/harness/playwright/tests/e2e/fixtures/test.ts +6 -0
  7. package/custom/harness/playwright/tests/e2e/pages/BasePage.ts +9 -0
  8. package/custom/harness/playwright/tests/e2e/support/auth.ts +5 -0
  9. package/custom/mcp-presets/playwright.json +8 -0
  10. package/custom/rules/test-patterns.md +70 -0
  11. package/custom/skills/automation-testing/SKILL.md +239 -0
  12. package/custom/skills/automation-testing/templates/BasePage.ts +29 -0
  13. package/custom/skills/automation-testing/templates/PageObject.example.ts +29 -0
  14. package/custom/skills/automation-testing/templates/playwright.config.ts +39 -0
  15. package/custom/skills/automation-testing/templates/spec.example.ts +29 -0
  16. package/custom/skills/coverage-check/SKILL.md +202 -0
  17. package/custom/skills/evidence-aggregation/SKILL.md +246 -0
  18. package/custom/skills/execute-flow/SKILL.md +479 -0
  19. package/custom/skills/execute-flow/templates/playwright.config.ts +39 -0
  20. package/custom/skills/generate-test-report/SKILL.md +99 -0
  21. package/custom/skills/generate-test-report/templates/test-report.md +58 -0
  22. package/custom/skills/generate-testcase/SKILL.md +303 -0
  23. package/custom/skills/generate-testcase/templates/testcase.md +88 -0
  24. package/custom/skills/log-bug/SKILL.md +131 -0
  25. package/custom/skills/pr-impact-analysis/SKILL.md +180 -0
  26. package/custom/skills/retest-orchestration/SKILL.md +191 -0
  27. package/custom/skills/script-sync/SKILL.md +208 -0
  28. package/custom/skills/test-analysis/SKILL.md +262 -0
  29. package/custom/templates/shared/gate-workflow.md +306 -2
  30. package/docs/common/CHANGELOG.md +84 -0
  31. package/docs/common/QUICK_START.md +30 -0
  32. package/docs/common/cli-reference.md +48 -7
  33. package/package.json +1 -1
  34. package/scripts/create-score-excel.js +20 -7
  35. package/scripts/detect.js +10 -0
  36. package/scripts/guide.js +9 -0
  37. package/scripts/prompt.js +36 -0
  38. package/scripts/scaffold-playwright.js +106 -0
  39. package/scripts/task.js +21 -7
  40. package/scripts/update.js +124 -124
  41. package/scripts/use.js +30 -12
@@ -0,0 +1,262 @@
1
+ ---
2
+ name: test-analysis
3
+ description: Gate 1 — AI phân tích requirements từ ticket Backlog/Jira + fetch linked docs, hỏi clarify với TESTER (từng câu một), xác định scope/risks/approach, viết test-analysis.md. TESTER review và APPROVED để sang Gate 2.
4
+ keywords: gate1, test analysis, requirement, scope, risk, approach, tester, clarify, ticket, backlog, jira
5
+ ---
6
+
7
+ # Test Analysis — Gate 1
8
+
9
+ > **GATE 1: Chạy đầu tiên, trước tất cả gates khác.**
10
+ >
11
+ > Principle: AI đọc ticket/requirements, hỏi clarify (từng câu một), xác định scope + risks + approach, viết test-analysis.md. TESTER review và APPROVED.
12
+
13
+ ---
14
+
15
+ ## Conditions to Enter Gate 1
16
+
17
+ Một trong hai:
18
+ - ✅ Ticket context tồn tại tại `.aiflow/context/current.json` (load qua `ak use TICKET-123`)
19
+ - ✅ Tester mô tả feature cần test trực tiếp trong chat
20
+
21
+ ---
22
+
23
+ ## Steps
24
+
25
+ ### Step 1: Load Input
26
+
27
+ 1. Đọc `.aiflow/context/current.json` nếu tồn tại → lấy ticket title, description, acceptance criteria
28
+ 2. Nếu có `supplementaryContext[]` → đọc từng item (linked tickets, comments, files, docs)
29
+ 3. Nếu thấy URL backlog/jira trong description chưa được fetch → chạy `ak fetch-links <url>` và tích hợp kết quả
30
+ 4. Nếu không có context file → hỏi TESTER: "Bạn muốn test feature nào? Mô tả ngắn gọn hoặc paste ticket description."
31
+
32
+ **Trigger kép:**
33
+ - Sau `ak use TICKET-123`: AI auto-start Gate 1 — TESTER không cần gõ thêm lệnh
34
+ - Sau `ak fetch-links <url>` (optional): AI tích hợp linked requirements trước khi phân tích
35
+
36
+ ---
37
+
38
+ ### Step 2: Phân tích Requirements
39
+
40
+ Dựa trên ticket/description, phân tích:
41
+
42
+ 1. **Scope** — Module/màn hình/feature cụ thể đang test. Ranh giới: bao gồm gì, không bao gồm gì
43
+ 2. **Functional Analysis**:
44
+ - Feature Overview (mô tả tính năng)
45
+ - Main Flow (happy path chính)
46
+ - Alternative Flows (các luồng phụ)
47
+ - User Roles / Permissions
48
+ - Business Rules
49
+ - Validations (input/output)
50
+ - State / Status liên quan
51
+ - API / External System (nếu có)
52
+ 3. **Non-Functional Analysis**:
53
+ - Accessibility (WCAG, screen reader)
54
+ - Compatibility (Browser/Device/OS)
55
+ 4. **Risk Areas** — High-risk flows, edge cases dễ có bug
56
+ 5. **Test Approach** — Manual / Automation / Mixed + estimate số TCs
57
+
58
+ ---
59
+
60
+ ### Step 3: Clarify Q&A
61
+
62
+ **Hỏi clarify khi:**
63
+ - Acceptance criteria không đo được hoặc mơ hồ
64
+ - Scope không rõ (in-scope vs out-of-scope)
65
+ - Business rule có edge cases chưa được document
66
+ - Môi trường test chưa xác định (browser, device, data)
67
+ - Dependency với feature/ticket khác chưa rõ
68
+ - Permission/role matrix chưa đầy đủ
69
+
70
+ **Cách hỏi:** từng câu một, chờ tester trả lời trước khi hỏi tiếp.
71
+
72
+ **Ví dụ:**
73
+ > "Tester có muốn test trên mobile (iOS/Android) hay chỉ desktop browser?"
74
+ > (chờ trả lời)
75
+ > "Role nào có thể thực hiện action này — tất cả user hay chỉ admin?"
76
+
77
+ **Khi đủ thông tin** → tiến sang Step 4 mà không cần hỏi thêm.
78
+
79
+ ---
80
+
81
+ ### Step 4: Write test-analysis.md
82
+
83
+ Tạo `test-plan/test-analysis.md`:
84
+
85
+ ```markdown
86
+ # Test Analysis: [Ticket ID / Feature Name]
87
+
88
+ **Date:** [YYYY-MM-DD]
89
+ **Status:** ⏸️ Waiting for TESTER Approval
90
+ **Risk Level:** [Low / Medium / High]
91
+ **Estimate:** [S / M / L / XL]
92
+
93
+ ---
94
+
95
+ ## 1. Scope Definition
96
+
97
+ ### In-Scope
98
+ - [Module/màn hình/feature cụ thể đang test]
99
+ - [...]
100
+
101
+ ### Out-of-Scope
102
+ - [Những gì KHÔNG test trong task này]
103
+
104
+ ---
105
+
106
+ ## 2. Functional Analysis
107
+
108
+ ### Feature Overview
109
+ [Mô tả tính năng — 2-3 câu]
110
+
111
+ ### Main Flow
112
+ 1. [Bước 1]
113
+ 2. [Bước 2]
114
+ 3. [...]
115
+
116
+ ### Alternative Flows
117
+ - **Alt 1:** [Tên flow] — [Mô tả]
118
+ - **Alt 2:** [Tên flow] — [Mô tả]
119
+
120
+ ### User Roles / Permissions
121
+ | Role | Quyền | Ghi chú |
122
+ |------|-------|---------|
123
+ | [Role] | [Được làm gì] | [Hạn chế nếu có] |
124
+
125
+ ### Business Rules
126
+ - **BR1:** [Mô tả rule]
127
+ - **BR2:** [...]
128
+
129
+ ### Validations
130
+ | Field/Action | Rule | Error Message |
131
+ |-------------|------|---------------|
132
+ | [Field] | [Rule] | [Message] |
133
+
134
+ ### State / Status
135
+ | State | Trigger | Hành vi |
136
+ |-------|---------|---------|
137
+ | [State] | [Khi nào] | [Màn hình/behavior] |
138
+
139
+ ### API / External System
140
+ | API | Endpoint | Mục đích |
141
+ |-----|----------|---------|
142
+ | [API] | [URL] | [Dùng để làm gì] |
143
+
144
+ ---
145
+
146
+ ## 3. Non-Functional Analysis
147
+
148
+ ### Accessibility (WCAG)
149
+ - [ ] [Yêu cầu accessibility cụ thể]
150
+
151
+ ### Compatibility
152
+ | Browser/Device | Version | Priority |
153
+ |----------------|---------|----------|
154
+ | Chrome Desktop | Latest | High |
155
+ | [Other] | [...] | [...] |
156
+
157
+ ---
158
+
159
+ ## 4. Test Environment
160
+
161
+ ### Test Data Dependencies
162
+ - [Data cần chuẩn bị trước khi test]
163
+
164
+ ### Third-party Integrations
165
+ - [Integration cần mock hay test thật]
166
+
167
+ ---
168
+
169
+ ## 5. Requirements Clarification (Q&A)
170
+
171
+ | Câu hỏi | Trả lời | Ngày |
172
+ |---------|---------|------|
173
+ | [Q1] | [A1] | [Date] |
174
+ | [Q2] | [A2] | [...] |
175
+
176
+ ---
177
+
178
+ ## 6. Assumptions
179
+
180
+ - [Assumption 1]
181
+ - [Assumption 2]
182
+
183
+ ---
184
+
185
+ ## 7. Risk Areas
186
+
187
+ ### High-Risk Flows
188
+ - [Flow dễ có bug — lý do]
189
+
190
+ ### Edge Cases cần chú ý
191
+ - [Edge case 1]
192
+ - [Edge case 2]
193
+
194
+ ---
195
+
196
+ ## 8. Test Approach
197
+
198
+ - **Manual test cases:** [N] cases
199
+ - **Automation (Playwright):** [N] cases
200
+ - **Test environment:** [URL, browser, device]
201
+ - **Test data:** [Cách chuẩn bị data]
202
+
203
+ ---
204
+
205
+ ## 9. Out of Scope
206
+
207
+ - [Item 1 — lý do không test]
208
+ - [Item 2]
209
+
210
+ ---
211
+
212
+ ## 10. Effort Estimate
213
+
214
+ | Loại | Size | Ghi chú |
215
+ |------|------|---------|
216
+ | Gate 2 (Test Planning) | S/M/L | Khoảng [N] scenarios |
217
+ | Gate 3 (Execution) | S/M/L | Khoảng [N] TCs |
218
+ | Gate 4 (Report) | S | Tổng hợp kết quả |
219
+ | **Total** | **S/M/L/XL** | |
220
+
221
+ > S = <2h · M = 2–4h · L = 4–8h · XL = 8h+ (split recommended)
222
+ ```
223
+
224
+ ---
225
+
226
+ ### Step 5: Present to Tester
227
+
228
+ ```
229
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
230
+ ⏸️ GATE 1: TEST ANALYSIS READY
231
+
232
+ Summary:
233
+ Scope: [N] features / [N] flows
234
+ Risk: [Low / Medium / High]
235
+ Approach: [Manual / Automation / Mixed]
236
+ Estimate: [S / M / L / XL]
237
+
238
+ → Review: test-plan/test-analysis.md
239
+ → Type APPROVED to proceed to Gate 2
240
+ → Or provide feedback to update
241
+
242
+ ⚠️ I will NOT proceed to Gate 2 until I receive "APPROVED".
243
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
244
+ ```
245
+
246
+ ---
247
+
248
+ ### Step 6: Handle Feedback
249
+
250
+ - Tester cung cấp feedback → cập nhật `test-analysis.md` → re-show Gate 1 prompt
251
+ - Tester gõ `APPROVED` → tiến sang Gate 2 (`generate-testcase` skill)
252
+
253
+ ---
254
+
255
+ ## Mandatory Rules
256
+
257
+ - ❌ **KHÔNG** tiến sang Gate 2 khi chưa nhận "APPROVED"
258
+ - ❌ **KHÔNG** hỏi nhiều câu cùng lúc — từng câu một, chờ trả lời
259
+ - ❌ **KHÔNG** viết code ở Gate 1
260
+ - ✅ **PHẢI** lưu `test-plan/test-analysis.md`
261
+ - ✅ **PHẢI** hiển thị Gate 1 prompt và chờ APPROVED
262
+ - ✅ **PHẢI** xác định scope rõ ràng trước khi liệt kê flows
@@ -5,12 +5,28 @@
5
5
 
6
6
  You have superpowers. When a ticket context exists in `.aiflow/context/current.json`:
7
7
  - **Consult the "AI Skill Registry"** below to find instructions for each skill (`SKILL.md`).
8
- - **AUTO-START Gate 1 immediately** — do NOT wait for the developer to ask.
9
- - Read instructions and follow the gate sequence below — NO EXCEPTIONS.
8
+ - **AUTO-START Gate 1 immediately** — do NOT wait to be asked.
9
+ - Read the context, **check `taskType`**, and follow the matching workflow — NO EXCEPTIONS.
10
10
  - **PROJECT CONVENTIONS:** Before writing any output file (plan, requirement, summary), read `custom/rules/project-conventions.md`. These rules override upstream skill defaults.
11
11
 
12
+ ### Workflow Selection
13
+
14
+ Read `.aiflow/context/current.json` → check the `taskType` field:
15
+
16
+ | `taskType` value | Workflow to follow |
17
+ |---|---|
18
+ | `testing` | **[TESTER] 4-Gate Testing Workflow** (below) |
19
+ | `execute` | **[EXECUTE] Executing Flow** (below) |
20
+ | `feature`, `bug-fix`, `refactor`, `investigation`, `documentation` | **[DEV] 5-Gate Development Workflow** (below) |
21
+
22
+ If `taskType` is missing or unrecognized, default to the DEV workflow and ask ONE clarifying question.
23
+
12
24
  ---
13
25
 
26
+ ## [DEV] 5-Gate Development Workflow
27
+
28
+ > **For:** `feature` · `bug-fix` · `refactor` · `investigation` · `documentation`
29
+
14
30
  ### GATE 1 — AI Analyze Requirement (auto-start)
15
31
 
16
32
  **INVOKE:** `read-study-requirement` skill
@@ -89,3 +105,291 @@ Only runs after Gate 4 has been APPROVED.
89
105
  Guide on creating a Pull Request with the ticket link.
90
106
 
91
107
  > **Telemetry:** Run `ak gate 5 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
108
+
109
+ ---
110
+
111
+ ## [TESTER] 4-Gate Testing Workflow
112
+
113
+ > **For:** `testing`
114
+ > **Interaction Rules:** Ask ONE clarifying question at a time — wait for TESTER reply before proceeding. NEVER batch questions.
115
+
116
+ ### GATE 1 — Phân tích & Confirm (auto-start)
117
+
118
+ **INVOKE:** `test-analysis` skill
119
+
120
+ 1. Read `.aiflow/context/current.json` — ticket title, description, acceptance criteria
121
+ 2. Fetch linked docs if URLs present in description (`ak fetch-links <url>`)
122
+ 3. Analyze scope, functional flows, non-functional requirements, risks
123
+ 4. Ask clarifying questions — **ONE at a time**, wait for reply
124
+ 5. Write `test-plan/test-analysis.md`
125
+ 6. Display gate pause — wait for **APPROVED**
126
+
127
+ > **Tip:** TESTER can trigger with: **"start"**, **"Gate 1"** or **"Analyze ticket"**.
128
+
129
+ ```
130
+ ⏸️ GATE 1: TEST ANALYSIS READY
131
+ → Review: test-plan/test-analysis.md
132
+ → Type APPROVED to proceed to Gate 2
133
+ ```
134
+
135
+ > **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.
137
+
138
+ ---
139
+
140
+ ### GATE 2 — Lập Kế Hoạch Test (4 phases, each needs APPROVED)
141
+
142
+ Only runs after Gate 1 APPROVED.
143
+
144
+ > **Rule:** TESTER must approve each phase before AI moves to the next. Never merge phases.
145
+
146
+ > **Telemetry:** Run `ak gate 2 start --ticket [ticket-id]` when starting Phase 2a. Run as-is — do NOT append shell redirects.
147
+
148
+ #### Phase 2a — Scenarios & Checklist
149
+
150
+ **INVOKE:** `generate-testcase` skill (Phase 2a)
151
+
152
+ - If TESTER declared `PR: <url>` → **INVOKE** `pr-impact-analysis` skill (Dev Artifacts Check) first
153
+ - Generate test scenarios/checklist TABLE covering: Happy Path, Negative, Validation, Boundary, Edge Cases, State Transitions, Role-based, Accessibility, Compatibility, Data Integrity, Integration, Exploratory
154
+ - Save `test-plan/checklist.md`
155
+
156
+ ```
157
+ ⏸️ GATE 2a: SCENARIOS READY
158
+ → Type APPROVED to generate test cases
159
+ ```
160
+
161
+ #### Phase 2b — Generate Test Cases
162
+
163
+ **INVOKE:** `generate-testcase` skill (Phase 2b)
164
+
165
+ - Generate detailed test cases TABLE from Phase 2a checklist: `TC_ID | Scenario | Preconditions | Test Steps | Test Data | Expected Result`
166
+ - TC_ID format: `TC_[Module]_[NNN]` (e.g. `TC_Login_001`)
167
+ - Expected result ONLY from ticket/spec — never from PR/dev description
168
+ - Save `test-plan/test-cases/`
169
+
170
+ ```
171
+ ⏸️ GATE 2b: TEST CASES READY
172
+ → Type APPROVED to proceed to review
173
+ ```
174
+
175
+ #### Phase 2c — Review & Optimize
176
+
177
+ **INVOKE:** `generate-testcase` skill (Phase 2c)
178
+
179
+ - Self-review: check duplicates, problematic TCs (vague steps, unmeasurable expected result), missing TCs, coverage gaps, accessibility/compatibility coverage
180
+ - Output `test-plan/review-report.md` with action items
181
+
182
+ ```
183
+ ⏸️ GATE 2c: REVIEW COMPLETE
184
+ → Type APPROVED to finalize and generate scripts
185
+ ```
186
+
187
+ #### Phase 2d — Coverage Check & Playwright Scripts
188
+
189
+ **INVOKE:** `coverage-check` skill
190
+
191
+ - Apply all action items from Phase 2c
192
+ - Generate coverage matrix (requirement → TC IDs)
193
+ - Export final test case set to `test-plan/test-cases/final-testcases.md`
194
+ - **INVOKE** `automation-testing` skill → generate Playwright scripts to `test-plan/test-scripts/`
195
+
196
+ ```
197
+ ⏸️ GATE 2: TEST PLAN READY
198
+ Test cases: [N] total ([N] manual / [N] automation)
199
+ Coverage: [N]% requirements covered
200
+ Scripts: [N] Playwright specs generated
201
+ → Type APPROVED to proceed to Gate 3 (execution)
202
+ ```
203
+
204
+ > **Telemetry:** Run `ak gate 2 approved --ticket [ticket-id]` immediately when final APPROVED received. Run as-is — do NOT append shell redirects.
205
+
206
+ ---
207
+
208
+ ### GATE 3 — Thực Thi & Evidence
209
+
210
+ Only runs after Gate 2 APPROVED.
211
+
212
+ **Step 3.1 — Dev Artifacts Check (Gate 3 entry)**
213
+
214
+ **INVOKE:** `pr-impact-analysis` skill — check for new commits since Gate 2. If delta found → propose TC additions → TESTER approves delta only before proceeding.
215
+
216
+ **Step 3.2 — Execute Playwright**
217
+
218
+ ```bash
219
+ BASE_URL=<url> npx playwright test --headed
220
+ ```
221
+
222
+ **Step 3.3 — Organize Evidence**
223
+
224
+ **INVOKE:** `evidence-aggregation` skill
225
+
226
+ - Parse `test-results/results.json`
227
+ - Create `evidence/TC_[ID]-[scenario]/` with screenshots + traces
228
+ - Generate `result.md` per TC
229
+ - Auto-draft `bugs/BUG-NNN-*.md` for failed TCs
230
+
231
+ **Re-test loop** — when TESTER types `RETEST: [TC_ID]`:
232
+
233
+ **INVOKE:** `retest-orchestration` skill
234
+ - Re-run Dev Artifacts Check (detect new commits in dev fix)
235
+ - Re-execute: `npx playwright test --grep "TC_ID_pattern" --headed`
236
+ - Update evidence (create `run-N/` subfolder — never delete prior evidence)
237
+ - Update bug status (RESOLVED / Still OPEN)
238
+
239
+ ```
240
+ ⏸️ GATE 3: EXECUTION COMPLETE
241
+ Passed: [N] | Failed: [N] | Blocked: [N]
242
+ Bugs: [N Critical] [N High] [N Medium] [N Low]
243
+ → Type APPROVED when all critical/high bugs resolved
244
+ → Type RETEST: [TC_ID] to re-execute
245
+ → Type PR: [url] to declare new dev PRs
246
+ ```
247
+
248
+ > **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
249
+
250
+ ---
251
+
252
+ ### GATE 4 — Báo Cáo & Sign-off
253
+
254
+ Only runs after Gate 3 APPROVED.
255
+
256
+ **INVOKE:** `generate-test-report` skill
257
+
258
+ 1. Aggregate results from `evidence/*/result.md`
259
+ 2. Summarize bugs from `bugs/BUG-*.md` by severity
260
+ 3. Verify acceptance criteria coverage from Gate 1
261
+ 4. Determine Go / No-Go: 0 unresolved Critical = Go
262
+ 5. Write `test-plan/test-report.md`
263
+
264
+ ```
265
+ ⏸️ GATE 4: TEST REPORT READY
266
+ Decision: [GO / NO-GO]
267
+ Passed: [N/total] | Bugs unresolved: [N]
268
+ Coverage: [N]% acceptance criteria
269
+ → Type APPROVED to sign off
270
+ → Type NO-GO: [reason] to reject release
271
+ ```
272
+
273
+ > **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.
275
+
276
+ ---
277
+
278
+ ## [EXECUTE] Executing Flow
279
+
280
+ > **For:** `execute`
281
+ > **Entry points:** `ak execute TICKET-ID` · `ak execute ./path/to/testcases.md` · `ak execute` (manual)
282
+ > **Interaction Rules:** Ask ONE clarifying question at a time — wait for TESTER reply before proceeding.
283
+
284
+ ### GATE 1 — Pre-flight & Work Plan (auto-start)
285
+
286
+ **INVOKE:** `execute-flow` skill (from `custom/skills/execute-flow/SKILL.md`)
287
+
288
+ Pre-flight checks (stop and report if any fail):
289
+ 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.
290
+ - 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]"
291
+ - If Y: read and update `~/.claude/settings.json` by merging the playwright entry into `mcpServers`, then instruct TESTER to **restart Claude Code** before retrying. Stop here.
292
+ - If n: show manual install instructions (add `playwright` to `mcpServers` in `~/.claude/settings.json`). Stop here.
293
+ 1. TC file is parseable — Section 3 has at least one TC row
294
+ 2. `ak-test/{repo}/` directory exists (or offer to scaffold it)
295
+ 3. `BASE_URL` env var is set
296
+ 4. `ak-test/{repo}/playwright.config.ts` exists (or offer to create from template)
297
+
298
+ Then display work plan:
299
+
300
+ ```
301
+ ⏸️ GATE 1: EXECUTE FLOW READY
302
+ TC file: [path]
303
+ Repo: [repo]
304
+ Screen: [ScreenID] — [Screen Name]
305
+ BASE_URL: [url]
306
+ → Type APPROVED to sync scripts (Gate 2)
307
+ ```
308
+
309
+ > **Telemetry:** Run `ak gate 1 start --ticket [ticket-id]` when starting. Run `ak gate 1 approved --ticket [ticket-id]` when APPROVED.
310
+
311
+ ---
312
+
313
+ ### GATE 2 — Script Sync
314
+
315
+ Only runs after Gate 1 APPROVED.
316
+
317
+ **INVOKE:** `script-sync` skill (from `custom/skills/script-sync/SKILL.md`)
318
+
319
+ Hash-based TC↔script sync — for each TC in the file:
320
+ - **New TC** (no matching `@tc-hash` in spec): generate Playwright test using MCP (`browser_navigate` → `browser_snapshot` → `browser_generate_locator`). Never fabricate selectors.
321
+ - **Changed TC** (hash mismatch): update the existing test block only.
322
+ - **Unchanged TC** (hash matches): skip — do not touch.
323
+ - **Manual/Blocked TC**: mark `⏭️ Untest` / `⏳ Pending` — no script generated.
324
+
325
+ Output: `ak-test/{repo}/scripts/{screenId}/{ScreenID}.spec.ts` (1 file per screen, all TCs inside)
326
+
327
+ ```
328
+ ⏸️ GATE 2: SCRIPT SYNC COMPLETE
329
+ ✅ New: [N] | 🔄 Updated: [N] | ⏭️ Skipped: [N] | ⚠️ Manual: [N]
330
+ → Type APPROVED to execute (Gate 3)
331
+ ```
332
+
333
+ ---
334
+
335
+ ### GATE 3 — Execute & Evidence
336
+
337
+ Only runs after Gate 2 APPROVED.
338
+
339
+ **Step 3.1 — Determine run number**
340
+
341
+ Check `ak-test/{repo}/results/{screenId}/` — next run is `run-{N+1}`.
342
+
343
+ **Step 3.2 — Execute Playwright**
344
+
345
+ ```bash
346
+ BASE_URL=<url> npx playwright test scripts/{screenId}/{ScreenID}.spec.ts
347
+ ```
348
+
349
+ **Step 3.3 — Organize evidence** into `ak-test/{repo}/results/{screenId}/run-{N}/`:
350
+ - Per-TC folder `{TC_ID}-{scenario}/` with `step-NN-{desc}.png`, `trace.zip`, `result.md`
351
+ - Auto-draft `bugs/BUG-NNN-{slug}.md` for failed TCs
352
+
353
+ **Step 3.4 — Update TC file** R1/R2 columns:
354
+ - `✅ Pass` · `❌ Fail` · `⏭️ Untest` · `⏳ Pending`
355
+
356
+ **Re-test loop** — when TESTER types `RETEST: [TC_ID]`:
357
+ - Re-run Dev Artifacts Check if PR was declared
358
+ - Re-execute only the specified TCs
359
+ - Create new `run-{N}/` — never delete prior runs
360
+ - Update R1/R2 columns
361
+
362
+ ```
363
+ ⏸️ GATE 3: EXECUTION COMPLETE
364
+ Run: run-{N} | Passed: [N] | Failed: [N] | Untest: [N] | Pending: [N]
365
+ → Type APPROVED when all Critical/High bugs resolved
366
+ → Type RETEST: [TC_ID] to re-execute specific TCs
367
+ → Type PR: [url] to declare a dev fix PR
368
+ ```
369
+
370
+ > **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting. Run as-is — do NOT append shell redirects.
371
+
372
+ ---
373
+
374
+ ### GATE 4 — Report & Bug Logging
375
+
376
+ Only runs after Gate 3 APPROVED.
377
+
378
+ **Step 4.1** — Generate `ak-test/{repo}/results/{screenId}/run-{N}/testreport.md`:
379
+ - Per-module rows with Pass/Fail/Untest/Pending counts, R1/R2 columns, % completion
380
+ - Go/No-Go: 0 unresolved Critical = Go
381
+
382
+ **Step 4.2** — Bug logging: for each `❌ Fail` TC, ask TESTER ONE at a time:
383
+ > "BUG-NNN — [TC_ID]: [title]. Log to Jira? (Y/N/edit)"
384
+
385
+ Wait for reply before moving to next bug.
386
+
387
+ ```
388
+ ⏸️ GATE 4: REPORT READY
389
+ Decision: [GO / NO-GO]
390
+ Bugs logged: [N] | Skipped: [N]
391
+ → Review: ak-test/{repo}/results/{screenId}/run-{N}/testreport.md
392
+ → Type APPROVED to sign off
393
+ ```
394
+
395
+ > **Telemetry:** Run `ak gate 4 start --ticket [ticket-id]` when starting. Run `ak gate 4 approved --ticket [ticket-id]` when APPROVED.
@@ -7,6 +7,90 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.1.3] - 2026-06-18
11
+
12
+ ### Added
13
+
14
+ - **`execute` task type — 4-Gate Executing Flow** — New end-to-end test execution workflow for QA testers. Activated when `taskType: "execute"` in context. Orchestrated by the new `execute-flow` skill across 4 gates:
15
+ - **Gate 1 — Pre-flight & Work Plan**: Validates TC file, `ak-test/{repo}/` directory, `BASE_URL` env var, and `playwright.config.ts` before any scripts are touched.
16
+ - **Gate 2 — Script Sync**: Hash-based TC↔script sync via the new `script-sync` skill. Each TC is hashed as `SHA1(TC_ID + "|" + Steps + "|" + Expected Result)[:8]` and compared against the `@tc-hash` comment in the spec file. New TCs get scripts generated via MCP browser tools; changed TCs update their existing block; unchanged TCs are skipped entirely.
17
+ - **Gate 3 — Execute & Evidence**: Runs `npx playwright test` and organizes evidence into `ak-test/{repo}/results/{screenId}/run-{N}/` with per-TC folders (screenshots, trace.zip, result.md). Auto-drafts bug files for failed TCs. Supports `RETEST: [TC_ID]` loop.
18
+ - **Gate 4 — Report & Bug Logging**: Generates `testreport.md` with Go/No-Go decision; logs each failed TC to Jira/Backlog one-by-one with interactive confirm per bug.
19
+
20
+ - **`execute-flow` skill** (`custom/skills/execute-flow/SKILL.md`) — 4-gate execute flow orchestrator. Handles 3 entry points: `ak execute TICKET-ID` (ticket with `taskType: "execute"`), `ak execute ./path/to/testcases.md` (direct TC file), and `ak execute` (manual — AI asks for TC file). Output structure: `ak-test/{repo}/scripts/{screenId}/{ScreenID}.spec.ts` for scripts; `ak-test/{repo}/results/{screenId}/run-{N}/` for evidence.
21
+
22
+ - **`script-sync` skill** (`custom/skills/script-sync/SKILL.md`) — Hash-based TC↔Playwright script sync engine. Called from execute-flow Gate 2. Never fabricates selectors — uses MCP browser tools (`browser_navigate` → `browser_snapshot` → `browser_generate_locator`) for any new/changed TC. Produces one `.spec.ts` per screen with all TCs inside, using `screenId` (lowercase) for directory paths and `{ScreenID}.spec.ts` (uppercase) for the filename.
23
+
24
+ - **`playwright.config.ts` template** for execute-flow (`custom/skills/execute-flow/templates/playwright.config.ts`) — Default config for each `ak-test/{repo}` repo with HTML + JSON reporters, screenshot-on-failure, and trace-on-failure. AI offers to scaffold this file during Gate 1 pre-flight if it doesn't exist.
25
+
26
+ - **`execute` entry in `gate-workflow.md` Workflow Selection table** — `gate-workflow.md` (single source of truth for all AI agent instruction files) now routes `taskType: "execute"` to the `[EXECUTE] Executing Flow` section. Distributed to all agents (Claude, Gemini, Cursor, Copilot) via `ak init` / `ak up`.
27
+
28
+ - **`▶️ Execute Test` option in `ak use` type selector** — Both the `promptForTaskType()` shared function (Backlog/Jira loaders) and the `manualContext()` manual entry flow now include `execute` as a selectable type. Users can run `ak use --manual` or `ak use TICKET-ID` and choose "Execute Test" to route the AI to the execute-flow.
29
+
30
+ - **`ak execute` command** (`ak ex` alias) — New top-level CLI entry point that bypasses `ak use`. Accepts a ticket ID, a TC file path, or no argument (AI asks interactively). Documented in README, QUICK_START, cli-reference, and `ak guide --commands`.
31
+
32
+ - **`test-analysis` skill** (`custom/skills/test-analysis/SKILL.md`) — Gate 1 analysis skill for the [TESTER] workflow. Reads ticket context, fetches linked docs, analyzes scope and risk, asks clarifying questions one at a time, and writes `test-plan/test-analysis.md`.
33
+
34
+ - **`coverage-check` skill** (`custom/skills/coverage-check/SKILL.md`) — Gate 2d skill that applies review action items, generates a requirement→TC coverage matrix, exports the final test case set to `test-plan/test-cases/final-testcases.md`, and invokes `automation-testing` to generate Playwright scripts.
35
+
36
+ - **`evidence-aggregation` skill** (`custom/skills/evidence-aggregation/SKILL.md`) — Parses `test-results/results.json`, organizes screenshots and traces into `evidence/TC_[ID]-[scenario]/` folders, generates per-TC `result.md`, and auto-drafts `bugs/BUG-NNN-*.md` for failed TCs.
37
+
38
+ - **`retest-orchestration` skill** (`custom/skills/retest-orchestration/SKILL.md`) — Handles the `RETEST: [TC_ID]` loop in Gate 3. Re-runs dev artifacts check (detect new commits), re-executes only specified TCs, creates `run-N/` subfolders (never deletes prior evidence), and updates bug status.
39
+
40
+ - **`pr-impact-analysis` skill** (`custom/skills/pr-impact-analysis/SKILL.md`) — Checks for new commits/PRs between gates to ensure TC coverage stays current with dev changes.
41
+
42
+ - **`log-bug` skill** (`custom/skills/log-bug/SKILL.md`) — Logs a failed TC as a bug ticket in Jira/Backlog with structured fields (severity, steps, expected/actual, evidence link).
43
+
44
+ - **Playwright harness scaffold** — `ak scaffold playwright` (via `scripts/scaffold-playwright.js`) creates the `ak-test/{repo}/` directory structure with `playwright.config.ts`, `tests/e2e/fixtures/test.ts`, `tests/e2e/pages/BasePage.ts`, `tests/e2e/support/auth.ts`, and `.env.example`. Covered by 90-line Jest test suite in `tests/scaffold-playwright.test.js`.
45
+
46
+ - **Playwright MCP preset** (`custom/mcp-presets/playwright.json`) — MCP configuration preset for browser automation tools used by `script-sync` during TC→script generation.
47
+
48
+ - **`test-patterns.md` rules file** (`custom/rules/test-patterns.md`) — Team-level Playwright patterns and conventions referenced by `automation-testing` and `script-sync` skills.
49
+
50
+ - **`generate-testcase` skill — Phase 2a/2b/2c structure** — Skill rewritten with explicit phased execution: Phase 2a (scenarios & checklist), Phase 2b (generate detailed TC table), Phase 2c (review & optimize). TC_ID format: `TC_[Module]_[NNN]`. Gate pauses after each phase.
51
+
52
+ - **`automation-testing` skill — MCP browser integration** — Updated to document MCP tool sequence (`browser_navigate` → `browser_snapshot` → `browser_generate_locator`) for generating reliable Playwright locators without fabricating selectors.
53
+
54
+ ### Fixed
55
+
56
+ - **`execute-flow` Gate 1 pre-flight missing `playwright.config.ts` check** — Original Gate 1 had 3 checks; spec required 4. Added explicit check for `ak-test/{repo}/playwright.config.ts` with offer to scaffold from template.
57
+ - **`screenId` casing ambiguity in execute-flow/script-sync** — Directory paths use lowercase `screenId` (e.g. `ad10`); spec file names remain uppercase `{ScreenID}.spec.ts` (e.g. `AD10.spec.ts`). Both skills now explicitly document this distinction with examples to prevent AI from using wrong case.
58
+ - **`--reporter` CLI flag overriding config reporters** — Gate 3 run command previously included `--reporter=json,html` which overrides (not appends) reporters defined in `playwright.config.ts`, causing the HTML report to be replaced entirely. Removed the flag; reporters are now defined solely in `playwright.config.ts`.
59
+
60
+ ---
61
+
62
+ ## [0.1.2] - 2026-06-13
63
+
64
+ ### Added
65
+
66
+ - **`python-ml` framework type** — New framework option for Python ML projects (scikit-learn / PyTorch / TensorFlow / Keras / MLflow / Wandb). Auto-detected from `requirements.txt` or `pyproject.toml` when any of the following dependencies are found: `torch`, `scikit-learn`, `sklearn`, `tensorflow`, `keras`, `mlflow`, `wandb`. Uses a dedicated gate workflow (`ml-gate-workflow.md`) tailored for ML iteration cycles (experiment → evaluate → iterate) instead of the standard software-development gate workflow. Select via `ak init` checkbox or `ak init -f python-ml`.
67
+ - **Task type selector in `ak use`** — After loading a ticket from Backlog, Jira, a local file, or manual entry, `ak use` now prompts the developer to confirm or change the task type via an interactive list (Bug Fix, Feature, Investigation, Refactor, Impact Analysis, Documentation). The type is auto-detected from the ticket title/issue type first and pre-selected as the default. The chosen value is saved to `.aiflow/context/current.json` as `taskType` and is available to the gate workflow throughout the session.
68
+ - **Telemetry warning on `ak use`** — If telemetry logging is not yet enabled, `ak use` now prints a yellow warning at startup so developers know their activity is not being tracked:
69
+ ```
70
+ ⚠ Telemetry logging is not enabled. Developer activity will not be tracked.
71
+ Run: ak telemetry enable to set up team productivity tracking.
72
+ ```
73
+ The check is wrapped in try/catch and never blocks the command. Silently skipped when telemetry is already enabled.
74
+ - **Backup before overwrite (`aiflow update` / `aiflow init`)** — Before overwriting any AI instruction file (CLAUDE.md, GEMINI.md, `.cursorrules`, `.github/copilot-instructions.md`), the current file is now backed up to `.aiflow/bk/YYYY-MM-DD_HH-MM_<filename>`. Multiple backups accumulate across runs, providing a full history to roll back to.
75
+ - **Single upfront confirm on update** — Instead of asking per-file, `aiflow update` and `aiflow init` now show a single summary of all files that will be overwritten, then ask for one confirmation before proceeding. This replaces the per-file prompt sequence that was easy to accidentally skip.
76
+
77
+ ### Changed
78
+
79
+ - **Framework conventions included in single-framework CLAUDE.md** — Previously, the framework template (e.g. Spring Boot coding standards, architecture rules) was only appended to CLAUDE.md in multi-framework projects. Single-framework projects got only the tool header + skill registry + gate workflow, losing all stack-specific conventions. The framework template is now always embedded for single-framework setups.
80
+ - **`aiflow update` no longer wipes `.claude/` directory** — Previously `update` called `fs.emptyDir('.claude/')` which deleted `.claude/settings.json`, destroying the SessionStart/SessionEnd/PreToolUse hooks configuration. Update now empties only `.claude/skills/` and re-copies skills there, leaving `settings.json` and other files untouched.
81
+
82
+ ### Fixed
83
+
84
+ - **Critical: `aiflow update` / `aiflow init` did not update CLAUDE.md or GEMINI.md** — Three compounding root causes:
85
+ 1. Old `state.json` wrote `framework: "spring-boot"` (singular string). New code read `state.frameworks` (plural array), got `undefined`, fell back to `[]`, and never called `setupFramework` — so no AI instruction file was ever written or updated.
86
+ 2. `aiflow init` called `setupFramework` without `force: true`, triggering per-file interactive prompts. Users who pressed No (or were surprised by the overwrite prompt) silently skipped the update.
87
+ 3. `aiflow update`'s old per-file confirm dialogs caused the same silent skip.
88
+ All three are fixed: singular→plural fallback added everywhere `state.frameworks` is read; both `init` and `update` now use `force: true`; the update path is backup-then-overwrite.
89
+ - **Stale skill registry paths in CLAUDE.md** — After upgrading the package, CLAUDE.md still referenced `.aiflow/versions/0.1.1/skills/...` instead of the current `.claude/skills/...` paths. This caused Claude to fail when trying to load skills. Fixed as part of the forced-overwrite update flow above.
90
+ - **`state.framework` (singular) not recognized after upgrade** — `aiflow update`, `aiflow init` re-run, and `ak sync-skills` all read `state.frameworks` (plural). Projects initialized before the plural key was introduced had only `framework: "spring-boot"` in state.json, causing the framework to be silently dropped and `setupFramework` to never run. Fixed with a fallback: `state.frameworks || (state.framework ? [state.framework] : [])` in `update.js`, `init.js`, and `aiflow.js`.
91
+
92
+ ---
93
+
10
94
  ## [0.1.1] - 2026-06-08
11
95
 
12
96
  ### Added