@relipa/ai-flow-kit 0.1.5-beta.1 → 0.1.5
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/custom/rules/project-conventions.md +12 -12
- package/custom/skills/gate-review/SKILL.md +1 -1
- package/custom/skills/generate-spec/SKILL.md +3 -3
- package/custom/skills/read-study-requirement/SKILL.md +5 -5
- package/custom/skills/review-plan/SKILL.md +3 -3
- package/custom/templates/shared/coding-workflow.md +0 -0
- package/custom/templates/shared/gate-workflow.md +17 -17
- package/custom/templates/tools/claude.md +1 -1
- package/custom/templates/tools/copilot.md +1 -1
- package/custom/templates/tools/cursor.md +1 -1
- package/custom/templates/tools/gemini.md +1 -1
- package/custom/templates/tools/generic.md +1 -1
- package/docs/common/AIFLOW.md +10 -10
- package/docs/common/CHANGELOG.md +11 -0
- package/docs/common/ai-integration.md +2 -2
- package/docs/common/workflows/bug-fix.md +2 -2
- package/docs/common/workflows/feature.md +2 -2
- package/package.json +1 -1
- package/scripts/docs-repo.js +49 -0
- package/scripts/hooks/session-start.js +8 -8
- package/scripts/init.js +4 -1
- package/scripts/link-resolver.js +0 -0
- package/scripts/prompt.js +11 -11
- package/scripts/task.js +10 -9
- package/scripts/update.js +4 -0
- package/scripts/use.js +0 -0
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
## DEV Workflow Output Paths (`04.Coding/`)
|
|
8
|
+
## DEV Workflow Output Paths (`AK-Docs/04.Coding/`)
|
|
9
9
|
|
|
10
10
|
Áp dụng cho taskType: `feature` · `bug-fix` · `refactor` · `investigation` · `documentation`.
|
|
11
11
|
|
|
12
12
|
| Output | Path | Note |
|
|
13
13
|
|--------|------|------|
|
|
14
|
-
| Requirement doc | `04.Coding/01.Requirements/[functionId]/[ticketId].md` | Gate 1 output |
|
|
15
|
-
| Implementation plan | `04.Coding/02.Plans/[functionId]/[ticketId].md` | Gate 2 output — **NOT** `docs/superpowers/plans/` |
|
|
16
|
-
| TDD Notes (test list + notes) | `04.Coding/03.TDD-Notes/[functionId]/[ticketId].md` | Gate 3 output |
|
|
17
|
-
| Self-review / Summary | `04.Coding/04.Reviews/[functionId]/[ticketId].md` | Gate 4 output |
|
|
18
|
-
| PR description | `04.Coding/05.Pull-Requests/[functionId]/[ticketId].md` | Gate 5 output |
|
|
19
|
-
| Tracker | `04.Coding/00.Overview/_Index.md` | Update mỗi gate: `F-ID \| Ticket \| Dev \| Gate \| PR` |
|
|
14
|
+
| Requirement doc | `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` | Gate 1 output |
|
|
15
|
+
| Implementation plan | `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md` | Gate 2 output — **NOT** `docs/superpowers/plans/` |
|
|
16
|
+
| TDD Notes (test list + notes) | `AK-Docs/04.Coding/03.TDD-Notes/[functionId]/[ticketId].md` | Gate 3 output |
|
|
17
|
+
| Self-review / Summary | `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` | Gate 4 output |
|
|
18
|
+
| PR description | `AK-Docs/04.Coding/05.Pull-Requests/[functionId]/[ticketId].md` | Gate 5 output |
|
|
19
|
+
| Tracker | `AK-Docs/04.Coding/00.Overview/_Index.md` | Update mỗi gate: `F-ID \| Ticket \| Dev \| Gate \| PR` |
|
|
20
20
|
|
|
21
21
|
> **Override:** The `writing-plans` skill defaults to `docs/superpowers/plans/<filename>.md`.
|
|
22
|
-
> In this project, **always save plans to `04.Coding/02.Plans/[functionId]/[ticketId].md` instead.**
|
|
22
|
+
> In this project, **always save plans to `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md` instead.**
|
|
23
23
|
|
|
24
24
|
### functionId & ticketId
|
|
25
25
|
|
|
26
26
|
- `[functionId]` là mã định danh chức năng **do dự án quy định** (ví dụ `F-001_User-Login`, `AD06`, `UC-LOGIN`) — không ép format.
|
|
27
|
-
- Được xác định BẮT BUỘC ở Gate 1 Pre-flight: từ `functionId`/`screenId` trong `.aiflow/context/current.json` → suy từ file UC Spec input (nội dung hoặc đường dẫn thư mục, ví dụ `02.BA-Specs/04.UC-Specs/[functionId]/`) rồi **hỏi DEV xác nhận** → cuối cùng mới hỏi DEV cung cấp trực tiếp.
|
|
27
|
+
- Được xác định BẮT BUỘC ở Gate 1 Pre-flight: từ `functionId`/`screenId` trong `.aiflow/context/current.json` → suy từ file UC Spec input (nội dung hoặc đường dẫn thư mục, ví dụ `AK-Docs/02.BA-Specs/04.UC-Specs/[functionId]/`) rồi **hỏi DEV xác nhận** → cuối cùng mới hỏi DEV cung cấp trực tiếp.
|
|
28
28
|
- KHÔNG ĐƯỢC ghi output khi chưa có functionId.
|
|
29
29
|
- `[ticketId]` lấy từ `taskId` trong `.aiflow/context/current.json` (ví dụ `TICKET-100`). Một feature có nhiều ticket → folder theo functionId, file theo ticketId.
|
|
30
30
|
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
When `writing-plans` skill says to announce the saved path, use the **actual path**:
|
|
40
40
|
|
|
41
41
|
```
|
|
42
|
-
Plan complete and saved to `04.Coding/02.Plans/[functionId]/[ticketId].md`. Two execution options: ...
|
|
42
|
+
Plan complete and saved to `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md`. Two execution options: ...
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Do NOT copy the hardcoded path from the skill template (`docs/superpowers/plans/`).
|
|
@@ -53,8 +53,8 @@ Before saving any requirement, plan, TDD-notes, review, or PR file, verify:
|
|
|
53
53
|
- [ ] `functionId` đã được xác định/xác nhận ở Gate 1 Pre-flight
|
|
54
54
|
- [ ] `[ticketId]` is read from `.aiflow/context/current.json`
|
|
55
55
|
- [ ] Output path follows the table above — NOT the skill's default path, NOT the legacy `plan/` folder
|
|
56
|
-
- [ ] Directory `04.Coding/<section>/[functionId]/` exists or will be created
|
|
57
|
-
- [ ] Tracker `04.Coding/00.Overview/_Index.md` được cập nhật sau khi gate hoàn thành
|
|
56
|
+
- [ ] Directory `AK-Docs/04.Coding/<section>/[functionId]/` exists or will be created
|
|
57
|
+
- [ ] Tracker `AK-Docs/04.Coding/00.Overview/_Index.md` được cập nhật sau khi gate hoàn thành
|
|
58
58
|
- [ ] Announced path in the handoff message matches the actual saved path
|
|
59
59
|
|
|
60
60
|
---
|
|
@@ -55,7 +55,7 @@ When generating the output for a gate (e.g. `requirement.md` or `plan.md`), foll
|
|
|
55
55
|
3. If the JSON file does not exist, initialize it by writing an empty array `[]` (or `{ "comments": [] }`) to it. This ensures that the CLI verification commands do not fail due to a missing file when there are no comments.
|
|
56
56
|
|
|
57
57
|
### Step 2: Write the gate output file
|
|
58
|
-
Write the gate output file (e.g. `04.Coding/01.Requirements/[functionId]/[ticketId].md`, `04.Coding/02.Plans/[functionId]/[ticketId].md`, or `docs/ak-[project]/...`) as specified by the gate instructions.
|
|
58
|
+
Write the gate output file (e.g. `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md`, `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md`, or `docs/ak-[project]/...`) as specified by the gate instructions.
|
|
59
59
|
|
|
60
60
|
### Step 3: Display gate pause message
|
|
61
61
|
|
|
@@ -14,12 +14,12 @@ keywords: spec, plan, implementation, tdd, coding plan
|
|
|
14
14
|
|
|
15
15
|
## Conditions to Enter Gate 2
|
|
16
16
|
|
|
17
|
-
- ✅ Gate 1 APPROVED — `04.Coding/01.Requirements/[functionId]/[ticketId].md` reviewed and approved by DEV
|
|
17
|
+
- ✅ Gate 1 APPROVED — `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` reviewed and approved by DEV
|
|
18
18
|
- ✅ Requirement document includes: requirements, solution, impact analysis, estimate
|
|
19
19
|
|
|
20
20
|
## Fast Mode Output Rules (CRITICAL)
|
|
21
21
|
|
|
22
|
-
When updating `04.Coding/04.Reviews/[functionId]/[ticketId].md` in **fast mode**:
|
|
22
|
+
When updating `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` in **fast mode**:
|
|
23
23
|
- **Keep it extremely short.**
|
|
24
24
|
- Add a bullet point indicating Gate 2 plan is ready.
|
|
25
25
|
- **DO NOT copy the entire plan.md into summary.md.**
|
|
@@ -30,7 +30,7 @@ When updating `04.Coding/04.Reviews/[functionId]/[ticketId].md` in **fast mode**
|
|
|
30
30
|
|
|
31
31
|
### Step 1: Read Approved Requirement
|
|
32
32
|
|
|
33
|
-
Read `04.Coding/01.Requirements/[functionId]/[ticketId].md` — use the chosen approach, file list, and testing plan as input.
|
|
33
|
+
Read `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` — use the chosen approach, file list, and testing plan as input.
|
|
34
34
|
|
|
35
35
|
### Step 2: Create Implementation Plan
|
|
36
36
|
|
|
@@ -30,7 +30,7 @@ Check `mode` in `.aiflow/context/current.json` before starting:
|
|
|
30
30
|
|
|
31
31
|
## Fast Mode Output Rules (CRITICAL)
|
|
32
32
|
|
|
33
|
-
When creating `04.Coding/04.Reviews/[functionId]/[ticketId].md` during Gate 1:
|
|
33
|
+
When creating `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` during Gate 1:
|
|
34
34
|
- You must create the `summary.md` file after Gate 1 is APPROVED, to track session progress.
|
|
35
35
|
- Keep `summary.md` concise. Only include short bullet points tracking Gates.
|
|
36
36
|
- Do not write verbose implementation details in `summary.md` at Gate 1.
|
|
@@ -48,7 +48,7 @@ When creating `04.Coding/04.Reviews/[functionId]/[ticketId].md` during Gate 1:
|
|
|
48
48
|
3. Q&A: Ask at most **ONE** question if there is a blocking ambiguity.
|
|
49
49
|
If the ticket + source file names make intent clear → skip Q&A entirely.
|
|
50
50
|
Wait for answer before writing the requirement doc.
|
|
51
|
-
4. Output `04.Coding/01.Requirements/[functionId]/[ticketId].md` with **3 sections only**:
|
|
51
|
+
4. Output `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` with **3 sections only**:
|
|
52
52
|
|
|
53
53
|
```markdown
|
|
54
54
|
# Requirement: [Ticket ID] — [Title]
|
|
@@ -154,7 +154,7 @@ After the developer confirms the design direction (Step 2), extend with:
|
|
|
154
154
|
|
|
155
155
|
### Step 4: Write Requirement Document
|
|
156
156
|
|
|
157
|
-
Save to `04.Coding/01.Requirements/[functionId]/[ticketId].md`:
|
|
157
|
+
Save to `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md`:
|
|
158
158
|
|
|
159
159
|
```markdown
|
|
160
160
|
# Requirement: [Ticket ID] — [Title]
|
|
@@ -284,7 +284,7 @@ Save to `04.Coding/01.Requirements/[functionId]/[ticketId].md`:
|
|
|
284
284
|
⏸️ GATE 1: REQUIREMENT DOCUMENT READY
|
|
285
285
|
|
|
286
286
|
Ticket: [ticket-id] — [title]
|
|
287
|
-
File: 04.Coding/01.Requirements/[functionId]/[ticketId].md
|
|
287
|
+
File: AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md
|
|
288
288
|
|
|
289
289
|
Summary:
|
|
290
290
|
Type: [feature / bug-fix / refactor]
|
|
@@ -332,5 +332,5 @@ Please review the requirement document.
|
|
|
332
332
|
- ❌ **DO NOT** skip impact analysis and effort estimate
|
|
333
333
|
- ✅ **MUST** run `git status` + `git pull --ff-only` (Pre-flight) before reading source code, when working tree is clean
|
|
334
334
|
- ✅ **MUST** read source code before Q&A begins
|
|
335
|
-
- ✅ **MUST** save `04.Coding/01.Requirements/[functionId]/[ticketId].md`
|
|
335
|
+
- ✅ **MUST** save `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md`
|
|
336
336
|
- ✅ **MUST** display Gate 1 prompt and wait for `APPROVED`
|
|
@@ -43,7 +43,7 @@ Assess impact by reasoning about the changed files only:
|
|
|
43
43
|
|
|
44
44
|
## Fast Mode Output Rules (CRITICAL)
|
|
45
45
|
|
|
46
|
-
When creating `04.Coding/04.Reviews/[functionId]/[ticketId].md` in **fast mode**:
|
|
46
|
+
When creating `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` in **fast mode**:
|
|
47
47
|
- **Do not write long explanations or descriptions.**
|
|
48
48
|
- **List format only:** Bullet points with `[NEW]`, `[MODIFIED]`, `[DELETED]`.
|
|
49
49
|
- **Purpose:** Next to each file, write exactly 1 sentence explaining the *purpose* (the "why"), not the implementation details.
|
|
@@ -79,7 +79,7 @@ Run in the following mandatory order:
|
|
|
79
79
|
|
|
80
80
|
### Step 2: Create Summary Report
|
|
81
81
|
|
|
82
|
-
Create file `04.Coding/04.Reviews/[functionId]/[ticketId].md`:
|
|
82
|
+
Create file `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md`:
|
|
83
83
|
|
|
84
84
|
```markdown
|
|
85
85
|
# Summary: [Ticket ID] — [Title]
|
|
@@ -148,7 +148,7 @@ Create file `04.Coding/04.Reviews/[functionId]/[ticketId].md`:
|
|
|
148
148
|
⏸️ GATE 4: WAITING FOR DEV REVIEW
|
|
149
149
|
|
|
150
150
|
I have completed implementation and self-review.
|
|
151
|
-
Summary: 04.Coding/04.Reviews/[functionId]/[ticketId].md
|
|
151
|
+
Summary: AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md
|
|
152
152
|
|
|
153
153
|
**Self-review results:**
|
|
154
154
|
- Tests: ✅ [N] passed / ❌ [N] failed
|
|
File without changes
|
|
@@ -32,7 +32,7 @@ If `taskType` is missing or unrecognized, default to the DEV workflow and ask ON
|
|
|
32
32
|
### Cấu trúc thư mục đầu ra
|
|
33
33
|
|
|
34
34
|
```
|
|
35
|
-
04.Coding/
|
|
35
|
+
AK-Docs/04.Coding/
|
|
36
36
|
├── 00.Overview/_Index.md ← Tracker: F-ID | Ticket | Dev | Gate | PR (cập nhật mỗi gate)
|
|
37
37
|
├── 01.Requirements/[functionId]/[ticketId].md ← Gate 1 tạo
|
|
38
38
|
├── 02.Plans/[functionId]/[ticketId].md ← Gate 2 tạo
|
|
@@ -54,7 +54,7 @@ AI actively reads ticket + source code to understand the requirement:
|
|
|
54
54
|
|
|
55
55
|
Kiểm tra theo thứ tự ưu tiên:
|
|
56
56
|
1. Trường `functionId` hoặc `screenId` trong `.aiflow/context/current.json`
|
|
57
|
-
2. **Suy ra từ input**: nếu đầu vào có file UC Spec / tài liệu do BA bàn giao (trong `supplementaryContext[]`, description, hoặc file được chỉ định khi `ak use <file>`) → đọc nội dung file để tìm functionId, hoặc suy từ đường dẫn thư mục chứa file (ví dụ file nằm ở `02.BA-Specs/04.UC-Specs/[functionId]/UC-Spec_v1.md` → lấy `[functionId]`). Có thể tra thêm `04.Coding/00.Overview/_Index.md` hoặc `00.Project-Overview/Function-List.md` theo tên feature.
|
|
57
|
+
2. **Suy ra từ input**: nếu đầu vào có file UC Spec / tài liệu do BA bàn giao (trong `supplementaryContext[]`, description, hoặc file được chỉ định khi `ak use <file>`) → đọc nội dung file để tìm functionId, hoặc suy từ đường dẫn thư mục chứa file (ví dụ file nằm ở `AK-Docs/02.BA-Specs/04.UC-Specs/[functionId]/UC-Spec_v1.md` → lấy `[functionId]`). Có thể tra thêm `AK-Docs/04.Coding/00.Overview/_Index.md` hoặc `AK-Docs/00.Project-Overview/Function-List.md` theo tên feature.
|
|
58
58
|
→ Tìm được ứng viên → **hỏi xác nhận** thay vì hỏi trống:
|
|
59
59
|
```
|
|
60
60
|
functionId của task này có phải là [X] không? (Y / hoặc nhập giá trị đúng)
|
|
@@ -67,9 +67,9 @@ AI actively reads ticket + source code to understand the requirement:
|
|
|
67
67
|
|
|
68
68
|
→ Đợi DEV trả lời, dùng giá trị này cho toàn bộ 5 Gates. **KHÔNG ĐƯỢC TIẾP TỤC NẾU CHƯA CÓ functionId.**
|
|
69
69
|
|
|
70
|
-
Sau đó kiểm tra thư mục `04.Coding/` trong root dự án — chưa có thì tạo đủ cây thư mục (00.Overview → 05.Pull-Requests) và file tracker `00.Overview/_Index.md`. Thông báo:
|
|
70
|
+
Sau đó kiểm tra thư mục `AK-Docs/04.Coding/` trong root dự án — chưa có thì tạo đủ cây thư mục (00.Overview → 05.Pull-Requests) và file tracker `00.Overview/_Index.md`. Thông báo:
|
|
71
71
|
```
|
|
72
|
-
✓ Thư mục đầu ra: 04.Coding/
|
|
72
|
+
✓ Thư mục đầu ra: AK-Docs/04.Coding/
|
|
73
73
|
✓ functionId: [functionId] ✓ ticketId: [ticketId]
|
|
74
74
|
→ Bắt đầu Gate 1...
|
|
75
75
|
```
|
|
@@ -78,11 +78,11 @@ AI actively reads ticket + source code to understand the requirement:
|
|
|
78
78
|
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.
|
|
79
79
|
3. Read source code — architecture, related files, data flow
|
|
80
80
|
4. If anything is unclear — ask ONE question at a time, wait for reply
|
|
81
|
-
5. Output `04.Coding/01.Requirements/[functionId]/[ticketId].md` with:
|
|
81
|
+
5. Output `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` with:
|
|
82
82
|
- Requirements summary (ticket summary + AC), source code analysis
|
|
83
83
|
- Proposed solution and approach
|
|
84
84
|
- Impact analysis, effort estimate, testing plan
|
|
85
|
-
6. Update tracker row in `04.Coding/00.Overview/_Index.md`: `| [F-ID] | [ticketId] | [feature] | [dev] | ✅⬜⬜⬜⬜ Gate 1 | - |`
|
|
85
|
+
6. Update tracker row in `AK-Docs/04.Coding/00.Overview/_Index.md`: `| [F-ID] | [ticketId] | [feature] | [dev] | ✅⬜⬜⬜⬜ Gate 1 | - |`
|
|
86
86
|
7. **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-1-[ticket-id].md`
|
|
87
87
|
8. Display gate pause message from `gate-review` skill — wait for **APPROVED**
|
|
88
88
|
|
|
@@ -104,9 +104,9 @@ DO NOT just check format — **understand the content and propose solutions**.
|
|
|
104
104
|
|
|
105
105
|
**INVOKE:** `generate-spec` skill, then `superpowers:writing-plans`
|
|
106
106
|
|
|
107
|
-
- Create a detailed TDD implementation plan based on the approved requirement (`04.Coding/01.Requirements/[functionId]/[ticketId].md`).
|
|
108
|
-
- Output `04.Coding/02.Plans/[functionId]/[ticketId].md` with the detailed TDD implementation plan (step-by-step, file list, test-first order).
|
|
109
|
-
- Update tracker row in `04.Coding/00.Overview/_Index.md` (Gate 2 ✅).
|
|
107
|
+
- Create a detailed TDD implementation plan based on the approved requirement (`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md`).
|
|
108
|
+
- 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
|
+
- Update tracker row in `AK-Docs/04.Coding/00.Overview/_Index.md` (Gate 2 ✅).
|
|
110
110
|
- **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-2-[ticket-id].md`
|
|
111
111
|
- Display gate pause message from `gate-review` skill — CODE WILL NOT BE GENERATED until all items checked and APPROVED received.
|
|
112
112
|
|
|
@@ -128,10 +128,10 @@ Only runs after Gate 2 has been APPROVED.
|
|
|
128
128
|
- Complex feature (3+ files): `superpowers:subagent-driven-development`
|
|
129
129
|
- Write tests FIRST — run to confirm FAIL -> implement -> PASS.
|
|
130
130
|
- Bug fix EXTRA: `superpowers:systematic-debugging` + `investigate-bug` skill first.
|
|
131
|
-
- Output `04.Coding/03.TDD-Notes/[functionId]/[ticketId].md`:
|
|
131
|
+
- Output `AK-Docs/04.Coding/03.TDD-Notes/[functionId]/[ticketId].md`:
|
|
132
132
|
- **Test List** — danh sách test viết TRƯỚC khi implement (checklist `- [ ] TC-01: ...`)
|
|
133
133
|
- **Implementation Notes** — ghi chú phát sinh trong quá trình code
|
|
134
|
-
- Update tracker row in `04.Coding/00.Overview/_Index.md` (Gate 3 ✅) when tests PASS.
|
|
134
|
+
- Update tracker row in `AK-Docs/04.Coding/00.Overview/_Index.md` (Gate 3 ✅) when tests PASS.
|
|
135
135
|
|
|
136
136
|
> **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
|
|
137
137
|
|
|
@@ -145,8 +145,8 @@ Mandatory order:
|
|
|
145
145
|
1. `superpowers:verification-before-completion` — all tests must PASS
|
|
146
146
|
2. `impact-analysis` skill — check for breaking changes
|
|
147
147
|
3. Tick `custom/rules/review-checklist.md`
|
|
148
|
-
4. Create `04.Coding/04.Reviews/[functionId]/[ticketId].md` — Test Results, Impact Analysis (files changed, affected features, breaking changes), Review Checklist
|
|
149
|
-
5. Update tracker row in `04.Coding/00.Overview/_Index.md` (Gate 4 ✅)
|
|
148
|
+
4. Create `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` — Test Results, Impact Analysis (files changed, affected features, breaking changes), Review Checklist
|
|
149
|
+
5. Update tracker row in `AK-Docs/04.Coding/00.Overview/_Index.md` (Gate 4 ✅)
|
|
150
150
|
|
|
151
151
|
Then:
|
|
152
152
|
- **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-4-[ticket-id].md`
|
|
@@ -172,12 +172,12 @@ Only runs after Gate 4 has been APPROVED.
|
|
|
172
172
|
|
|
173
173
|
**INVOKE:** `superpowers:requesting-code-review`
|
|
174
174
|
|
|
175
|
-
1. Create `04.Coding/05.Pull-Requests/[functionId]/[ticketId].md` — PR description gồm:
|
|
175
|
+
1. Create `AK-Docs/04.Coding/05.Pull-Requests/[functionId]/[ticketId].md` — PR description gồm:
|
|
176
176
|
- Ticket link, danh sách thay đổi chính, How to Test, Checklist for Reviewer
|
|
177
|
-
- **Related Docs links:** UC Spec (`02.BA-Specs/04.UC-Specs/[functionId]/`), Test Case (`03.Testing/01.Testcases/[functionId]/`), Dev Plan (`04.Coding/02.Plans/[functionId]/[ticketId].md`)
|
|
178
|
-
2. **Lưu tài liệu `04.Coding/` lên remote (GitLab) TRƯỚC khi tạo Pull Request.**
|
|
177
|
+
- **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. **Lưu tài liệu `AK-Docs/04.Coding/` lên remote (GitLab) TRƯỚC khi tạo Pull Request.**
|
|
179
179
|
3. Guide on creating a Pull Request — dùng nội dung file trên làm PR description.
|
|
180
|
-
4. Update tracker row in `04.Coding/00.Overview/_Index.md` (Gate 5 ✅ Done + PR link).
|
|
180
|
+
4. Update tracker row in `AK-Docs/04.Coding/00.Overview/_Index.md` (Gate 5 ✅ Done + PR link).
|
|
181
181
|
|
|
182
182
|
> **Telemetry:** Run `ak gate 5 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
|
|
183
183
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
|
|
4
4
|
|
|
5
|
-
> **Important:** Always read `.aiflow/context/current.json` to load ticket context and check the `04.Coding/` docs directory for existing progress before starting any task.
|
|
5
|
+
> **Important:** Always read `.aiflow/context/current.json` to load ticket context and check the `AK-Docs/04.Coding/` docs directory for existing progress before starting any task.
|
|
6
6
|
|
|
7
7
|
If Gate 1 does not auto-start, wait for the developer to type **"start"**, **"Gate 1"** or **"Analyze ticket"**.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
|
|
4
4
|
|
|
5
|
-
> **Important:** Always check for context in `.aiflow/context/current.json` and progress in the `04.Coding/` docs folder before suggesting changes.
|
|
5
|
+
> **Important:** Always check for context in `.aiflow/context/current.json` and progress in the `AK-Docs/04.Coding/` docs folder before suggesting changes.
|
|
6
6
|
|
|
7
7
|
If the Gate Workflow hasn't started, wait for the developer to type **"start"** or **"Gate 1"**.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
|
|
4
4
|
|
|
5
|
-
> **Important:** Always check `.aiflow/context/current.json` and the `04.Coding/` docs directory before starting any task to understand current context and progress.
|
|
5
|
+
> **Important:** Always check `.aiflow/context/current.json` and the `AK-Docs/04.Coding/` docs directory before starting any task to understand current context and progress.
|
|
6
6
|
|
|
7
7
|
If Gate 1 doesn't auto-start, wait for the developer to type **"start"**, **"Gate 1"** or **"Analyze ticket"**.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
|
|
4
4
|
|
|
5
|
-
> **Important:** When starting a session, always read `.aiflow/context/current.json` to load ticket context and check the `04.Coding/` docs directory for existing progress.
|
|
5
|
+
> **Important:** When starting a session, always read `.aiflow/context/current.json` to load ticket context and check the `AK-Docs/04.Coding/` docs directory for existing progress.
|
|
6
6
|
|
|
7
7
|
If no instructions are automatically followed, wait for the developer to type **"start"** or **"Gate 1"** to start the analysis.
|
|
8
8
|
|
|
@@ -4,7 +4,7 @@ You are an expert AI assistant. Follow the project's Gate Workflow and Team Rule
|
|
|
4
4
|
|
|
5
5
|
## Context Awareness
|
|
6
6
|
- **Ticket context**: `.aiflow/context/current.json`
|
|
7
|
-
- **Task progress**: `04.Coding/<section>/[functionId]/[ticketId].md`
|
|
7
|
+
- **Task progress**: `AK-Docs/04.Coding/<section>/[functionId]/[ticketId].md`
|
|
8
8
|
- **Rules**: `.rules/`
|
|
9
9
|
|
|
10
10
|
Follow the gated workflow and rules defined below.
|
package/docs/common/AIFLOW.md
CHANGED
|
@@ -112,7 +112,7 @@ claude # open Claude → AI auto-starts Gate 1
|
|
|
112
112
|
| 2 | Read `CLAUDE.md` + source code | Understand architecture, tech stack, patterns |
|
|
113
113
|
| 3 | Investigate related files & data flow | Identify affected areas, dependencies |
|
|
114
114
|
| 4 | Ask clarifying questions (one at a time) | Ensure full understanding |
|
|
115
|
-
| 5 | Write `04.Coding/01.Requirements/[functionId]/[ticketId].md` | Structured requirement document |
|
|
115
|
+
| 5 | Write `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` | Structured requirement document |
|
|
116
116
|
|
|
117
117
|
**AI asks questions when:**
|
|
118
118
|
- Business requirements are vague or ambiguous
|
|
@@ -121,7 +121,7 @@ claude # open Claude → AI auto-starts Gate 1
|
|
|
121
121
|
- Multiple approaches are possible and need input
|
|
122
122
|
- Impact on existing features is unclear
|
|
123
123
|
|
|
124
|
-
**Requirement Document Output (`04.Coding/01.Requirements/[functionId]/[ticketId].md`):**
|
|
124
|
+
**Requirement Document Output (`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md`):**
|
|
125
125
|
|
|
126
126
|
```
|
|
127
127
|
├── 1. Requirements Summary
|
|
@@ -166,13 +166,13 @@ Summary:
|
|
|
166
166
|
- Approach: [brief description]
|
|
167
167
|
- Files affected: [N] files
|
|
168
168
|
|
|
169
|
-
→ Review: 04.Coding/01.Requirements/[functionId]/[ticketId].md
|
|
169
|
+
→ Review: AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md
|
|
170
170
|
→ Type APPROVED to proceed
|
|
171
171
|
→ Or provide feedback to update
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
**Gate 1 Output:**
|
|
175
|
-
- `04.Coding/01.Requirements/[functionId]/[ticketId].md` approved by DEV
|
|
175
|
+
- `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` approved by DEV
|
|
176
176
|
- DEV has typed "APPROVED"
|
|
177
177
|
|
|
178
178
|
---
|
|
@@ -265,14 +265,14 @@ In fast mode, AI uses the `tdd-lean` skill instead of per-test TDD to save massi
|
|
|
265
265
|
| 1 | `superpowers:verification-before-completion` | All tests PASS |
|
|
266
266
|
| 2 | `impact-analysis` skill | No breaking changes outside scope |
|
|
267
267
|
| 3 | `custom/rules/review-checklist.md` | All items ticked |
|
|
268
|
-
| 4 | Create `04.Coding/04.Reviews/[functionId]/[ticketId].md` | File exists and is complete |
|
|
268
|
+
| 4 | Create `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` | File exists and is complete |
|
|
269
269
|
|
|
270
270
|
**If any step fails → AI fixes it first, without showing DEV.**
|
|
271
271
|
|
|
272
272
|
**Summary report output:**
|
|
273
273
|
|
|
274
274
|
```
|
|
275
|
-
04.Coding/04.Reviews/[functionId]/[ticketId].md
|
|
275
|
+
AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md
|
|
276
276
|
├── List of changed files + reasons
|
|
277
277
|
├── Acceptance Criteria → results (Done/Not Done)
|
|
278
278
|
├── Tests: quantity, coverage
|
|
@@ -287,7 +287,7 @@ In fast mode, AI uses the `tdd-lean` skill instead of per-test TDD to save massi
|
|
|
287
287
|
Tests: ✅ [N] passed
|
|
288
288
|
Impact: [Low/Medium/High]
|
|
289
289
|
Checklist: [N/N] ✅
|
|
290
|
-
Summary: 04.Coding/04.Reviews/[functionId]/[ticketId].md
|
|
290
|
+
Summary: AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md
|
|
291
291
|
|
|
292
292
|
Type APPROVED if OK
|
|
293
293
|
Type BUG: [description] if there are issues
|
|
@@ -299,7 +299,7 @@ Type BUG: [description] if there are issues
|
|
|
299
299
|
- `BUG: requirement bug` → AI updates requirement doc → back to Gate 1
|
|
300
300
|
|
|
301
301
|
**Gate 4 Output:**
|
|
302
|
-
- `04.Coding/04.Reviews/[functionId]/[ticketId].md` completed
|
|
302
|
+
- `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md` completed
|
|
303
303
|
- DEV has typed "APPROVED"
|
|
304
304
|
|
|
305
305
|
---
|
|
@@ -458,7 +458,7 @@ aiflow telemetry disable # disable tracking
|
|
|
458
458
|
|
|
459
459
|
## Multi-AI Environment Setup
|
|
460
460
|
|
|
461
|
-
One of the core strengths of `ai-flow-kit` is that the **Gate Workflow** is tool-agnostic. Since state is saved in `.aiflow/context/current.json` and the `04.Coding/` docs directory, you can switch tools mid-task.
|
|
461
|
+
One of the core strengths of `ai-flow-kit` is that the **Gate Workflow** is tool-agnostic. Since state is saved in `.aiflow/context/current.json` and the `AK-Docs/04.Coding/` docs directory, you can switch tools mid-task.
|
|
462
462
|
|
|
463
463
|
### How to Switch Tools
|
|
464
464
|
1. **Analyze (Gate 1)** using Claude Code CLI (great for deep codebase scans).
|
|
@@ -506,7 +506,7 @@ A: Yes. Use `aiflow task pause` to save your current progress, then `aiflow use
|
|
|
506
506
|
**Q: If I resume a task, will Claude know which gate to start at?**
|
|
507
507
|
A: Yes. The SessionStart hook reads `.aiflow/tasks/<taskId>/task-state.json` and injects gate-aware instructions. If Gate 1 was already approved, Claude will skip to Gate 2, and so on.
|
|
508
508
|
**Q: Can I resume a Gate 3 (Code Generation) task in a new chatbox?**
|
|
509
|
-
A: Yes. Gate 3 progress is saved via `[x]` checkboxes in `04.Coding/02.Plans/[functionId]/[ticketId].md`. If you open a new chatbox and say "continue", the AI will automatically skip completed tasks and pick up exactly where it left off.
|
|
509
|
+
A: Yes. Gate 3 progress is saved via `[x]` checkboxes in `AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md`. If you open a new chatbox and say "continue", the AI will automatically skip completed tasks and pick up exactly where it left off.
|
|
510
510
|
|
|
511
511
|
**Q: How does AI estimate effort?**
|
|
512
512
|
A: AI analyzes the scope of changes (files affected, complexity, test requirements) and categorizes: S (< 1h), M (1-4h), L (4-8h), XL (8h+, should split).
|
package/docs/common/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **`aiflow prompt <type>` still emitted `plan/[ticket-id]/...` paths** — The 0.1.5 migration to `04.Coding/` (see below) updated `gate-workflow.md`, the skills, all 5 tool templates, and `session-start.js`, but missed `scripts/prompt.js`. Its `PROMPT_TEMPLATES` (used by `aiflow prompt feature|bug-fix|refactor|investigation|impact-analysis|testing|documentation` to build the copy-paste prompt for Cursor/Gemini/manual use) still hard-coded `Output plan/[ticket-id]/requirement.md` / `plan.md` / `summary.md`, contradicting the `custom/rules/project-conventions.md` override appended later in the same prompt — this was the root cause of `/plan` still appearing at the project root even on 0.1.5-beta.1. All 11 occurrences now point at the current `04.Coding/<section>/[functionId]/[ticketId].md` convention.
|
|
15
|
+
- **`ak init` still gitignored `plan/`** — `ensureAiflowGitignored()` in `scripts/init.js` added `plan/` to `.gitignore` on every init, reinforcing the deprecated convention. Removed; `04.Coding/` output now lives in `AK-Docs/` (see below) and isn't part of the source repo's `.gitignore` concerns.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **DEV workflow output relocated to `AK-Docs/04.Coding/`** — Per `docs/internal/Project-Structure.md` / `Coding-Structure.md`, `04.Coding/` (and its BA/QA siblings `02.BA-Specs/`, `03.Testing/`, `00.Project-Overview/`) belong under the `AK-Docs/` docs repo (a sibling of the source repo, synced via `scripts/docs-repo.js`), not directly at the source repo root. Updated all references across `CLAUDE.md`, `custom/rules/project-conventions.md`, `custom/templates/shared/gate-workflow.md`, the 5 tool templates, the DEV skills (`read-study-requirement`, `generate-spec`, `review-plan`, `gate-review`), `docs/common/AIFLOW.md` / `ai-integration.md` / `workflows/{bug-fix,feature}.md`, `scripts/hooks/session-start.js`, and `scripts/prompt.js`. `scripts/task.js` now resolves the coding dir via `resolveDocsRepoPath(PROJECT_DIR, 'AK-Docs')` (from `docs-repo.js`) instead of hard-coding the path, so `findTaskDocs()` / `detectCurrentGate()` look under `AK-Docs/04.Coding/` first, with the legacy `plan/<taskId>/` folder (at the source repo root) still checked as a fallback.
|
|
20
|
+
|
|
10
21
|
## [0.1.5] - 2026-07-01
|
|
11
22
|
|
|
12
23
|
### Added
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
When you run `aiflow init`, it generates a `.cursorrules` file.
|
|
21
21
|
- Cursor will automatically read this file to understand the **Gate Workflow**.
|
|
22
22
|
- Use `@Codebase` when you need the AI to search across your whole project.
|
|
23
|
-
- **Resumption**: If you start a task in Claude Code and switch to Cursor, Cursor will see the generated `04.Coding/` docs and resume from where you left off.
|
|
23
|
+
- **Resumption**: If you start a task in Claude Code and switch to Cursor, Cursor will see the generated `AK-Docs/04.Coding/` docs and resume from where you left off.
|
|
24
24
|
|
|
25
25
|
### 2. Gemini CLI
|
|
26
26
|
Pass `GEMINI.md` as system instructions to your Gemini session.
|
|
@@ -37,7 +37,7 @@ Copilot uses `.github/copilot-instructions.md` to guide its suggestions.
|
|
|
37
37
|
The "Secret Sauce" of `ai-flow-kit` is its file-based state management:
|
|
38
38
|
|
|
39
39
|
1. **Context**: Saved in `.aiflow/context/current.json`.
|
|
40
|
-
2. **Progress**: Saved as Markdown docs in `04.Coding/<section>/[functionId]/[ticketId].md`.
|
|
40
|
+
2. **Progress**: Saved as Markdown docs in `AK-Docs/04.Coding/<section>/[functionId]/[ticketId].md`.
|
|
41
41
|
3. **Rules**: Saved in `.rules/`.
|
|
42
42
|
|
|
43
43
|
Because these are standard files, any AI tool can read them. You can:
|
|
@@ -17,7 +17,7 @@ AI will **automatically**:
|
|
|
17
17
|
2. Read source code — trace data flow related to the bug
|
|
18
18
|
3. Use `superpowers:systematic-debugging` to form root cause hypothesis
|
|
19
19
|
4. Ask clarifying questions if reproduction steps are unclear
|
|
20
|
-
5. Output `04.Coding/01.Requirements/[functionId]/[ticketId].md` containing:
|
|
20
|
+
5. Output `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` containing:
|
|
21
21
|
- Bug analysis (current vs expected behavior)
|
|
22
22
|
- **Root cause hypothesis** with evidence from source code
|
|
23
23
|
- **Proposed fix approach** (with alternatives if applicable)
|
|
@@ -84,7 +84,7 @@ AI performs in the following order:
|
|
|
84
84
|
AI runs:
|
|
85
85
|
1. `superpowers:verification-before-completion` — all tests PASS (including old tests)
|
|
86
86
|
2. `impact-analysis` — fix doesn't cause new bugs elsewhere
|
|
87
|
-
3. Create `04.Coding/04.Reviews/[functionId]/[ticketId].md`
|
|
87
|
+
3. Create `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md`
|
|
88
88
|
|
|
89
89
|
**If OK, type:**
|
|
90
90
|
```
|
|
@@ -16,7 +16,7 @@ AI will **automatically**:
|
|
|
16
16
|
1. Load ticket info from Backlog/Jira
|
|
17
17
|
2. Read source code — understand architecture, related files, patterns
|
|
18
18
|
3. Ask clarifying questions if anything is unclear (one at a time)
|
|
19
|
-
4. Output `04.Coding/01.Requirements/[functionId]/[ticketId].md` containing:
|
|
19
|
+
4. Output `AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md` containing:
|
|
20
20
|
- Requirements summary (AI's understanding)
|
|
21
21
|
- Source code analysis (related files, data flow)
|
|
22
22
|
- **Proposed solution** with options and recommendation
|
|
@@ -83,7 +83,7 @@ AI runs:
|
|
|
83
83
|
1. `superpowers:verification-before-completion` — all tests PASS
|
|
84
84
|
2. `impact-analysis` — no breaking changes outside of scope
|
|
85
85
|
3. Review checklist — all items ticked
|
|
86
|
-
4. Create `04.Coding/04.Reviews/[functionId]/[ticketId].md`
|
|
86
|
+
4. Create `AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md`
|
|
87
87
|
|
|
88
88
|
AI displays summary and waits for developer review.
|
|
89
89
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
|
|
6
|
+
// AK-Docs (per-project docs) and Shared-Docs (cross-project templates) are
|
|
7
|
+
// fixed-name folders living directly under the workspace root — the folder
|
|
8
|
+
// opened in the editor, which contains one or more source repos plus these
|
|
9
|
+
// two docs repos as siblings. `ak` is run from that root, so projectDir
|
|
10
|
+
// (process.cwd()) already IS the root — see docs/internal/Project-Structure.md.
|
|
11
|
+
const DOC_REPOS = [
|
|
12
|
+
{ name: 'AK-Docs', purpose: 'tài liệu dự án (Requirements, Specs, Test Cases, Coding docs...)' },
|
|
13
|
+
{ name: 'Shared-Docs', purpose: 'template dùng chung cho tất cả dự án (Spec, QA, Test Case, Test Report...)' },
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
function resolveDocsRepoPath(projectDir, repoName) {
|
|
17
|
+
return path.join(projectDir, repoName);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function syncDocsRepo(projectDir, repoName, purpose) {
|
|
21
|
+
const repoPath = resolveDocsRepoPath(projectDir, repoName);
|
|
22
|
+
|
|
23
|
+
if (!(await fs.pathExists(repoPath))) {
|
|
24
|
+
console.log(chalk.yellow(`⚠ ${repoName}/ chưa tồn tại tại ${repoPath} (${purpose}). Hãy clone repo này vào thư mục root.`));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!(await fs.pathExists(path.join(repoPath, '.git')))) {
|
|
29
|
+
console.log(chalk.yellow(`⚠ ${repoName}/ tồn tại tại ${repoPath} nhưng không phải git repo — bỏ qua pull.`));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
console.log(chalk.cyan(`\n⟳ Pulling latest ${repoName}...`));
|
|
34
|
+
try {
|
|
35
|
+
execSync('git pull', { cwd: repoPath, stdio: 'inherit' });
|
|
36
|
+
console.log(chalk.green(`✓ ${repoName} đã cập nhật mới nhất.`));
|
|
37
|
+
} catch (err) {
|
|
38
|
+
console.log(chalk.red(`✗ Không thể pull ${repoName}: ${err.message}`));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function syncDocsRepos(projectDir) {
|
|
43
|
+
console.log(chalk.blue('\nĐồng bộ AK-Docs / Shared-Docs...'));
|
|
44
|
+
for (const repo of DOC_REPOS) {
|
|
45
|
+
await syncDocsRepo(projectDir, repo.name, repo.purpose);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = { syncDocsRepos, resolveDocsRepoPath, DOC_REPOS };
|
|
@@ -215,16 +215,16 @@ function buildContextPrompt(ctx, taskState) {
|
|
|
215
215
|
|
|
216
216
|
if (currentGate === 2) {
|
|
217
217
|
lines.push('Gate 1 is already APPROVED. The requirement document is at:');
|
|
218
|
-
lines.push(` 04.Coding/01.Requirements/[functionId]/${ctx.taskId}.md`);
|
|
219
|
-
lines.push(` ([functionId] — look it up in 04.Coding/00.Overview/_Index.md or the folder containing ${ctx.taskId}.md)`);
|
|
218
|
+
lines.push(` AK-Docs/04.Coding/01.Requirements/[functionId]/${ctx.taskId}.md`);
|
|
219
|
+
lines.push(` ([functionId] — look it up in AK-Docs/04.Coding/00.Overview/_Index.md or the folder containing ${ctx.taskId}.md)`);
|
|
220
220
|
lines.push('');
|
|
221
221
|
lines.push('Proceed to Gate 2: create the implementation plan.');
|
|
222
222
|
lines.push(buildModeInstruction(mode, 2));
|
|
223
223
|
} else if (currentGate === 3) {
|
|
224
224
|
lines.push('Gates 1 and 2 are already APPROVED. Plans are at:');
|
|
225
|
-
lines.push(` 04.Coding/01.Requirements/[functionId]/${ctx.taskId}.md`);
|
|
226
|
-
lines.push(` 04.Coding/02.Plans/[functionId]/${ctx.taskId}.md`);
|
|
227
|
-
lines.push(` ([functionId] — look it up in 04.Coding/00.Overview/_Index.md)`);
|
|
225
|
+
lines.push(` AK-Docs/04.Coding/01.Requirements/[functionId]/${ctx.taskId}.md`);
|
|
226
|
+
lines.push(` AK-Docs/04.Coding/02.Plans/[functionId]/${ctx.taskId}.md`);
|
|
227
|
+
lines.push(` ([functionId] — look it up in AK-Docs/04.Coding/00.Overview/_Index.md)`);
|
|
228
228
|
lines.push('');
|
|
229
229
|
lines.push('Proceed to Gate 3: implement code following the plan (TDD).');
|
|
230
230
|
lines.push(buildModeInstruction(mode, 3));
|
|
@@ -251,16 +251,16 @@ function buildContextPrompt(ctx, taskState) {
|
|
|
251
251
|
lines.push('- Pre-flight: determine functionId first (from context / input UC Spec file / ask DEV to confirm) — see the DEV workflow Pre-flight step');
|
|
252
252
|
lines.push('- Read ticket + identify changed files only (no deep source scan)');
|
|
253
253
|
lines.push('- Skip Q&A unless there is a critical blocking ambiguity');
|
|
254
|
-
lines.push('- Output a lite requirement doc (Sections 1, 3, 5 only) to 04.Coding/01.Requirements/[functionId]/' + ctx.taskId + '.md');
|
|
254
|
+
lines.push('- Output a lite requirement doc (Sections 1, 3, 5 only) to AK-Docs/04.Coding/01.Requirements/[functionId]/' + ctx.taskId + '.md');
|
|
255
255
|
lines.push('- Target: Gate 1 complete in < 5 minutes');
|
|
256
256
|
} else {
|
|
257
257
|
lines.push('Gate 1 process:');
|
|
258
|
-
lines.push('0. Pre-flight: determine functionId (from context / input UC Spec file / ask DEV to confirm) + ensure 04.Coding/ tree exists — see the DEV workflow Pre-flight step. DO NOT continue without functionId.');
|
|
258
|
+
lines.push('0. Pre-flight: determine functionId (from context / input UC Spec file / ask DEV to confirm) + ensure AK-Docs/04.Coding/ tree exists — see the DEV workflow Pre-flight step. DO NOT continue without functionId.');
|
|
259
259
|
lines.push('1. Read the ticket context above');
|
|
260
260
|
lines.push('2. Read CLAUDE.md — understand project architecture and conventions');
|
|
261
261
|
lines.push('3. Read source code — identify related files, data flow, patterns');
|
|
262
262
|
lines.push('4. If anything is unclear — ask ONE question at a time');
|
|
263
|
-
lines.push('5. Output 04.Coding/01.Requirements/[functionId]/' + ctx.taskId + '.md');
|
|
263
|
+
lines.push('5. Output AK-Docs/04.Coding/01.Requirements/[functionId]/' + ctx.taskId + '.md');
|
|
264
264
|
lines.push('6. Display GATE 1 prompt and wait for APPROVED');
|
|
265
265
|
}
|
|
266
266
|
|
package/scripts/init.js
CHANGED
|
@@ -3,6 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
const { input, checkbox, confirm } = require('@inquirer/prompts');
|
|
6
|
+
const { syncDocsRepos } = require('./docs-repo');
|
|
6
7
|
|
|
7
8
|
const PKG_DIR = path.join(__dirname, '..');
|
|
8
9
|
const GLOBAL_AIFLOW_DIR = path.join(os.homedir(), '.aiflow');
|
|
@@ -752,7 +753,6 @@ async function ensureAiflowGitignored(projectDir) {
|
|
|
752
753
|
const gitignorePath = path.join(projectDir, '.gitignore');
|
|
753
754
|
const entries = [
|
|
754
755
|
'.aiflow/',
|
|
755
|
-
'plan/',
|
|
756
756
|
'.claude/',
|
|
757
757
|
'.rules/',
|
|
758
758
|
'.mcp.json',
|
|
@@ -1048,6 +1048,9 @@ async function init(options) {
|
|
|
1048
1048
|
try {
|
|
1049
1049
|
console.log(chalk.blue(`Initializing ai-flow-kit (v${PKG_VERSION})...`));
|
|
1050
1050
|
|
|
1051
|
+
// ── Sync AK-Docs / Shared-Docs sibling repos ──────────────────
|
|
1052
|
+
await syncDocsRepos(projectDir);
|
|
1053
|
+
|
|
1051
1054
|
// ── Auto-detect or prompt for framework if not supplied ──────
|
|
1052
1055
|
if (frameworks.length === 0) {
|
|
1053
1056
|
const stateFilePath = path.join(aiflowDir, 'state.json');
|
package/scripts/link-resolver.js
CHANGED
|
File without changes
|
package/scripts/prompt.js
CHANGED
|
@@ -25,7 +25,7 @@ AI must:
|
|
|
25
25
|
1. Load ticket context + read source code related to the bug
|
|
26
26
|
2. Trace data flow to form root cause hypothesis (\`superpowers:systematic-debugging\`)
|
|
27
27
|
3. If unclear → ask ONE question at a time, wait for reply
|
|
28
|
-
4. Output \`
|
|
28
|
+
4. Output \`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md\` with:
|
|
29
29
|
- Bug analysis (current vs expected behavior)
|
|
30
30
|
- Root cause hypothesis with evidence from source code
|
|
31
31
|
- Proposed fix approach (options if multiple)
|
|
@@ -52,7 +52,7 @@ Only runs after Gate 2 APPROVED.
|
|
|
52
52
|
1. \`superpowers:verification-before-completion\` — all tests PASS (including old tests)
|
|
53
53
|
2. \`impact-analysis\` skill — fix doesn't cause new bugs elsewhere
|
|
54
54
|
3. Tick \`custom/rules/review-checklist.md\`
|
|
55
|
-
4. Create \`
|
|
55
|
+
4. Create \`AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md\`
|
|
56
56
|
- Display: "GATE 4: type APPROVED or BUG: [description]"
|
|
57
57
|
- Coding bug → fix → repeat Gate 4
|
|
58
58
|
- Requirement bug → back to Gate 1
|
|
@@ -77,7 +77,7 @@ AI must:
|
|
|
77
77
|
2. Investigate related files, data flow, existing patterns
|
|
78
78
|
3. Propose 2-3 solution approaches using Q&A if the problem is complex
|
|
79
79
|
4. If unclear → ask ONE question at a time, wait for reply
|
|
80
|
-
5. Output \`
|
|
80
|
+
5. Output \`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md\` with:
|
|
81
81
|
- Requirements summary (AI's understanding in technical language)
|
|
82
82
|
- Source code analysis (related files, data flow, patterns)
|
|
83
83
|
- Proposed solution with options (recommended + alternatives)
|
|
@@ -104,7 +104,7 @@ Only runs after Gate 2 APPROVED.
|
|
|
104
104
|
1. \`superpowers:verification-before-completion\` — all tests PASS
|
|
105
105
|
2. \`impact-analysis\` skill — no regressions
|
|
106
106
|
3. Tick \`custom/rules/review-checklist.md\`
|
|
107
|
-
4. Create \`
|
|
107
|
+
4. Create \`AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md\`
|
|
108
108
|
- Display: "GATE 4: type APPROVED or BUG: [description]"
|
|
109
109
|
- Coding bug → fix → repeat Gate 4
|
|
110
110
|
- Requirement bug → back to Gate 1
|
|
@@ -129,7 +129,7 @@ AI must:
|
|
|
129
129
|
2. **INVOKE:** \`superpowers:systematic-debugging\` — trace through all layers
|
|
130
130
|
3. **INVOKE:** \`investigate-bug\` skill — trace data flow through all layers
|
|
131
131
|
4. If unclear → ask ONE question at a time
|
|
132
|
-
5. Output \`
|
|
132
|
+
5. Output \`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md\` with:
|
|
133
133
|
- Investigation scope and approach
|
|
134
134
|
- Source code analysis (all related files traced)
|
|
135
135
|
- Findings with evidence (log output, code references)
|
|
@@ -156,7 +156,7 @@ AI must:
|
|
|
156
156
|
1. Load ticket context + read source code to understand current state
|
|
157
157
|
2. **INVOKE:** \`impact-analysis\` skill — map ALL callers and dependants
|
|
158
158
|
3. If unclear → ask ONE question at a time
|
|
159
|
-
4. Output \`
|
|
159
|
+
4. Output \`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md\` with:
|
|
160
160
|
- Current state analysis (what exists, what's wrong)
|
|
161
161
|
- Target state (what it should look like after refactor)
|
|
162
162
|
- Proposed approach (step-by-step refactor strategy)
|
|
@@ -182,7 +182,7 @@ Only runs after Gate 2 APPROVED.
|
|
|
182
182
|
1. \`superpowers:verification-before-completion\` — all tests PASS
|
|
183
183
|
2. \`impact-analysis\` skill — verify no regressions
|
|
184
184
|
3. Tick \`custom/rules/review-checklist.md\`
|
|
185
|
-
4. Create \`
|
|
185
|
+
4. Create \`AK-Docs/04.Coding/04.Reviews/[functionId]/[ticketId].md\`
|
|
186
186
|
- Display: "GATE 4: type APPROVED or BUG: [description]"
|
|
187
187
|
|
|
188
188
|
### GATE 5 — Peer Review & Done
|
|
@@ -203,7 +203,7 @@ AI must:
|
|
|
203
203
|
1. Load ticket context + read source code thoroughly
|
|
204
204
|
2. Map all dependencies, callers, services, jobs, tests
|
|
205
205
|
3. If unclear → ask ONE question at a time
|
|
206
|
-
4. Output \`
|
|
206
|
+
4. Output \`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md\` with:
|
|
207
207
|
- Change description and scope
|
|
208
208
|
- Dependency map (all callers, services, jobs, tests)
|
|
209
209
|
- Impact level: 🟢 Low / 🟡 Medium / 🔴 High / 🔥 Critical
|
|
@@ -229,7 +229,7 @@ AI must:
|
|
|
229
229
|
1. Load ticket context + read source code thoroughly
|
|
230
230
|
2. Understand what needs to be tested (unit, integration, e2e)
|
|
231
231
|
3. If unclear → ask ONE question at a time
|
|
232
|
-
4. Output \`
|
|
232
|
+
4. Output \`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md\` with:
|
|
233
233
|
- Test scope and strategy
|
|
234
234
|
- Test cases to cover (happy path + edge cases + failure cases)
|
|
235
235
|
- Source code references
|
|
@@ -239,7 +239,7 @@ AI must:
|
|
|
239
239
|
### GATE 2 — Implementation Plan
|
|
240
240
|
**INVOKE:** \`generate-spec\` skill, then \`superpowers:writing-plans\`
|
|
241
241
|
- Create detailed TDD test implementation plan.
|
|
242
|
-
- Output \`
|
|
242
|
+
- Output \`AK-Docs/04.Coding/02.Plans/[functionId]/[ticketId].md\`.
|
|
243
243
|
- Display: "GATE 2 PAUSED: type APPROVED to start coding".
|
|
244
244
|
|
|
245
245
|
### GATE 3 — Write Tests (TDD)
|
|
@@ -265,7 +265,7 @@ AI must:
|
|
|
265
265
|
1. Load ticket context + read source code
|
|
266
266
|
2. Understand what needs to be documented and for whom
|
|
267
267
|
3. If unclear → ask ONE question at a time
|
|
268
|
-
4. Output \`
|
|
268
|
+
4. Output \`AK-Docs/04.Coding/01.Requirements/[functionId]/[ticketId].md\` with:
|
|
269
269
|
- Documentation scope and target audience
|
|
270
270
|
- Content outline (sections to cover)
|
|
271
271
|
- Source code references
|
package/scripts/task.js
CHANGED
|
@@ -2,12 +2,14 @@ const fs = require('fs-extra');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const chalk = require('chalk');
|
|
4
4
|
const { confirm } = require('@inquirer/prompts');
|
|
5
|
+
const { resolveDocsRepoPath } = require('./docs-repo');
|
|
5
6
|
|
|
6
7
|
const PROJECT_DIR = process.cwd();
|
|
7
8
|
const AIFLOW_DIR = path.join(PROJECT_DIR, '.aiflow');
|
|
8
9
|
const CONTEXT_DIR = path.join(AIFLOW_DIR, 'context');
|
|
9
10
|
const CURRENT_FILE = path.join(CONTEXT_DIR, 'current.json');
|
|
10
11
|
const TASKS_DIR = path.join(AIFLOW_DIR, 'tasks');
|
|
12
|
+
const CODING_DIR = path.join(resolveDocsRepoPath(PROJECT_DIR, 'AK-Docs'), '04.Coding');
|
|
11
13
|
|
|
12
14
|
// ──────────────────────────────────────────────────────────────
|
|
13
15
|
// Entry point
|
|
@@ -216,7 +218,7 @@ async function resetTask(taskId) {
|
|
|
216
218
|
console.log(chalk.gray(` Gate: ${taskState.currentGate} → 1 | Approvals cleared | Status: active`));
|
|
217
219
|
|
|
218
220
|
const deletePlan = planFiles.length > 0 && await confirm({
|
|
219
|
-
message: `Also delete ${planFiles.length} gate doc file(s) (04.Coding/ + legacy plan/) for ${taskId}?`,
|
|
221
|
+
message: `Also delete ${planFiles.length} gate doc file(s) (AK-Docs/04.Coding/ + legacy plan/) for ${taskId}?`,
|
|
220
222
|
default: false,
|
|
221
223
|
});
|
|
222
224
|
|
|
@@ -364,7 +366,7 @@ async function nextGate(taskId) {
|
|
|
364
366
|
console.log(chalk.gray(` 1. Open a NEW chatbox or terminal session.`));
|
|
365
367
|
console.log(chalk.gray(` 2. Run: aiflow task resume ${resolvedId} (to load context).`));
|
|
366
368
|
console.log(chalk.gray(` 3. Type "start" or "continue from the current plan".`));
|
|
367
|
-
console.log(chalk.yellow(` (Note: Gate 3 progress is saved via [x] checkboxes in the Gate 2 plan doc (04.Coding/02.Plans/).`));
|
|
369
|
+
console.log(chalk.yellow(` (Note: Gate 3 progress is saved via [x] checkboxes in the Gate 2 plan doc (AK-Docs/04.Coding/02.Plans/).`));
|
|
368
370
|
console.log(chalk.yellow(` The AI will automatically resume the exact task you left off.)`));
|
|
369
371
|
console.log();
|
|
370
372
|
}
|
|
@@ -374,18 +376,17 @@ async function nextGate(taskId) {
|
|
|
374
376
|
// ──────────────────────────────────────────────────────────────
|
|
375
377
|
|
|
376
378
|
/**
|
|
377
|
-
* Find gate output docs for a task under 04.Coding/<section>/<functionId>/<taskId>.md
|
|
379
|
+
* Find gate output docs for a task under AK-Docs/04.Coding/<section>/<functionId>/<taskId>.md
|
|
378
380
|
* (new convention) plus the legacy plan/<taskId>/ folder. Returns absolute paths.
|
|
379
381
|
*/
|
|
380
382
|
async function findTaskDocs(taskId) {
|
|
381
383
|
const results = [];
|
|
382
384
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
const sections = await fs.readdir(codingDir, { withFileTypes: true }).catch(() => []);
|
|
385
|
+
if (await fs.pathExists(CODING_DIR)) {
|
|
386
|
+
const sections = await fs.readdir(CODING_DIR, { withFileTypes: true }).catch(() => []);
|
|
386
387
|
for (const section of sections) {
|
|
387
388
|
if (!section.isDirectory()) continue;
|
|
388
|
-
const sectionDir = path.join(
|
|
389
|
+
const sectionDir = path.join(CODING_DIR, section.name);
|
|
389
390
|
const featureDirs = await fs.readdir(sectionDir, { withFileTypes: true }).catch(() => []);
|
|
390
391
|
for (const feature of featureDirs) {
|
|
391
392
|
if (!feature.isDirectory()) continue;
|
|
@@ -442,9 +443,9 @@ async function detectCurrentGate(taskId) {
|
|
|
442
443
|
if (state.currentGate) return state.currentGate;
|
|
443
444
|
}
|
|
444
445
|
|
|
445
|
-
// New convention: 04.Coding/<section>/<functionId>/<taskId>.md
|
|
446
|
+
// New convention: AK-Docs/04.Coding/<section>/<functionId>/<taskId>.md
|
|
446
447
|
const hasDocInSection = async (section) => {
|
|
447
|
-
const dir = path.join(
|
|
448
|
+
const dir = path.join(CODING_DIR, section);
|
|
448
449
|
if (!(await fs.pathExists(dir))) return false;
|
|
449
450
|
const features = await fs.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
450
451
|
for (const f of features) {
|
package/scripts/update.js
CHANGED
|
@@ -2,6 +2,7 @@ const fs = require('fs-extra');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const chalk = require('chalk');
|
|
4
4
|
const { confirm, select } = require('@inquirer/prompts');
|
|
5
|
+
const { syncDocsRepos } = require('./docs-repo');
|
|
5
6
|
|
|
6
7
|
const PKG_DIR = path.join(__dirname, '..');
|
|
7
8
|
const PKG_VERSION = require('../package.json').version;
|
|
@@ -25,6 +26,9 @@ module.exports = async function update(options = {}) {
|
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
// ── Sync AK-Docs / Shared-Docs sibling repos ──────────────────
|
|
30
|
+
await syncDocsRepos(projectDir);
|
|
31
|
+
|
|
28
32
|
const state = await fs.readJson(stateFile);
|
|
29
33
|
const currentVersion = state.current_version;
|
|
30
34
|
|
package/scripts/use.js
CHANGED
|
File without changes
|