spec-lite 1.1.3 → 1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-lite",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Spec-driven development kit for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -38,7 +38,25 @@ Chọn số integration:
38
38
  - Nếu chỉ có 1 integration có task pending → chọn luôn, không hỏi
39
39
  - Nếu tất cả đều done → thông báo: "Tất cả integration đã hoàn thành."
40
40
 
41
- ### Bước 0b: Chọn chế độ worktree (tùy chọn)
41
+ ### Bước 0b: Tạo branch và chọn chế độ worktree
42
+
43
+ **Tạo branch (bắt buộc):**
44
+
45
+ Luôn tạo branch `build/{integration-slug}` trước khi build, bất kể có dùng worktree hay không. Điều này đảm bảo `/review` luôn có base để diff chính xác.
46
+
47
+ ```bash
48
+ git checkout -b feat/{slug}
49
+ ```
50
+
51
+ Nếu branch đã tồn tại → checkout branch cũ:
52
+
53
+ ```bash
54
+ git checkout feat/{slug}
55
+ ```
56
+
57
+ ---
58
+
59
+ **Chọn worktree (tùy chọn):**
42
60
 
43
61
  Hỏi user:
44
62
 
@@ -46,18 +64,16 @@ Hỏi user:
46
64
  Bạn muốn build trong worktree riêng cho integration này không? (y/n)
47
65
  ```
48
66
 
49
- **Nếu chọn "n":** Tiếp tục build trong working directory hiện tại.
67
+ **Nếu chọn "n":** Tiếp tục build trong working directory hiện tại trên branch vừa tạo.
50
68
 
51
69
  **Nếu chọn "y":**
52
70
 
53
- 1. **Tạo worktree mới**
54
- - Tên branch: `build/{integration-slug}` (ví dụ: `build/002-implement-todo`)
71
+ 1. **Tạo worktree mới** từ branch vừa tạo
55
72
  - Đường dẫn worktree: `../{repo-name}-{integration-slug}` (ví dụ: `../myapp-002-implement-todo`)
56
73
  - Lệnh:
57
74
  ```bash
58
- git worktree add -b build/{slug} ../{repo}-{slug}
75
+ git worktree add ../{repo}-{slug} feat/{slug}
59
76
  ```
60
- - Nếu branch đã tồn tại, dùng `--force` hoặc checkout branch cũ.
61
77
 
62
78
  2. **Detect package manager**
63
79
  - Kiểm tra theo thứ tự: `pnpm-lock.yaml` → `yarn.lock` → `package-lock.json` → `package.json`
@@ -152,3 +168,13 @@ Invoke `debugging-and-error-recovery`:
152
168
  - [ ] Mỗi task có atomic commit riêng
153
169
  - [ ] Tất cả task đánh dấu `[x]` trong `todo.md`
154
170
  - [ ] Không còn uncommitted changes
171
+
172
+ ## Sau khi hoàn thành
173
+
174
+ Khi tất cả task trong session này đã done, thông báo:
175
+
176
+ ```
177
+ Tất cả task đã hoàn thành. Bước tiếp theo: chạy /review để kiểm tra toàn bộ implementation trước khi merge.
178
+ ```
179
+
180
+ Không tự động invoke `/review` — để user chủ động gọi.
@@ -16,7 +16,12 @@ Trước khi bắt đầu review, load context từ working integration:
16
16
  3. `specs/integrations/{slug}/plan.md` — task breakdown và acceptance criteria chi tiết
17
17
  4. `specs/integrations/{slug}/todo.md` — task nào đã được implement (`[x]`)
18
18
 
19
- Chạy `git diff main...HEAD` để lấy thay đổi cần review.
19
+ Chạy lệnh sau để lấy thay đổi cần review — diff từ điểm branch tách ra, không phải từ tip của base branch:
20
+
21
+ ```bash
22
+ BASE=$(git rev-parse --abbrev-ref @{upstream} 2>/dev/null | sed 's|origin/||' || echo main)
23
+ git diff $(git merge-base HEAD $BASE)...HEAD
24
+ ```
20
25
 
21
26
  ## Xác định integration
22
27
 
@@ -95,7 +95,16 @@ Sau khi confirm, assign F-XXX IDs theo thứ tự tăng dần.
95
95
 
96
96
  ### Bước 4: Scan sâu từng feature
97
97
 
98
- **4a. User stories — infer từ:**
98
+ **4a. User flows — infer từ:**
99
+ - Test file chains nhiều request liên tiếp → detect luồng thao tác có thứ tự
100
+ - Navigation / router config trong UI code (`steps`, `wizard`, `onNext`) → detect bước chuyển màn
101
+ - State machine hoặc status enum (`pending → processing → done`) → detect nhánh edge case
102
+ - Error handling branches trong use case → detect luồng thất bại
103
+
104
+ Đánh dấu source: `(inferred from tests)` hoặc `(inferred from UI navigation)`.
105
+ Nếu không detect được → User Flows section sẽ là NEEDS_CLARIFY.
106
+
107
+ **4b. User stories — infer từ:**
99
108
  - Use case class names và public methods → action descriptions
100
109
  - Route names + HTTP methods → "As a user, I want to POST /auth/register..."
101
110
  - Test `describe` / `it` blocks → `it('should register a new user', ...)` → user story
@@ -149,11 +158,13 @@ Với mỗi feature, generate 2 files dùng templates tương ứng:
149
158
 
150
159
  **`frd.md`** — WHAT (dùng `.claude/templates/main/feature/frd-template.md`):
151
160
  - Description và business goal (infer từ feature name + use case, NEEDS_CLARIFY nếu không rõ)
161
+ - User flows: Mermaid flowchart cho happy case và edge cases (infer từ test chains / UI navigation, NEEDS_CLARIFY nếu không detect được)
152
162
  - User stories (đánh dấu source)
153
163
  - Acceptance criteria (extract từ tests nếu có, NEEDS_CLARIFY nếu không)
154
164
  - Scope: In scope từ detected routes/actions; Out of scope → NEEDS_CLARIFY
155
- - Components consumed: list C-XXX từ Component Index
156
- - Dependencies: feature-to-feature dependencies nếu detect được
165
+ - Dependencies:
166
+ - Feature Dependencies: feature-to-feature dependencies nếu detect được
167
+ - Components Used: list C-XXX từ Component Index (infer từ import statements)
157
168
 
158
169
  **`fdd.md`** — HOW / inter-component (dùng `.claude/templates/main/feature/fdd-template.md`):
159
170
  - Inter-component data flow: sequence diagram từ detected call chain (Mermaid hoặc ASCII)
@@ -65,10 +65,11 @@ frd.md — F-001 Authentication đã tồn tại.
65
65
  Sections hiện có:
66
66
 
67
67
  [1] Overview
68
- [2] Feature-level Acceptance Criteria
69
- [3] User Stories
70
- [4] Scope (In Scope / Out of Scope)
71
- [5] Dependencies
68
+ [2] User Flows
69
+ [3] Feature-level Acceptance Criteria
70
+ [4] User Stories
71
+ [5] Scope (In Scope / Out of Scope)
72
+ [6] Dependencies (Feature Dependencies + Components Used)
72
73
  [A] All — viết lại toàn bộ từ đầu
73
74
  [S] Lên spec từ frd.md hiện tại — frd.md đã đầy đủ, không cần chỉnh
74
75
 
@@ -223,11 +224,11 @@ frd.md — F-001 Authentication đã tồn tại.
223
224
  Sections hiện có:
224
225
 
225
226
  [1] Overview
226
- [2] Components Consumed
227
+ [2] User Flows
227
228
  [3] Feature-level Acceptance Criteria
228
229
  [4] User Stories
229
230
  [5] Scope (In Scope / Out of Scope)
230
- [6] Dependencies
231
+ [6] Dependencies (Feature Dependencies + Components Used)
231
232
  [A] All — viết lại toàn bộ từ đầu
232
233
 
233
234
  Chọn section cần cập nhật (có thể chọn nhiều, ví dụ: 2 3):
@@ -15,13 +15,29 @@ referenced_by:
15
15
 
16
16
  {Mô tả feature này giải quyết vấn đề gì cho user nào, trong 2-3 câu.}
17
17
 
18
- ## Components Consumed
18
+ ## User Flows
19
19
 
20
- Các component feature này dùng tham chiếu đến `specs/main/component/{C-XXX}-...`.
20
+ {Mô tả các luồng thao tác của user để hoàn thành mục tiêu của feature này.}
21
+ {Mỗi flow là một Mermaid flowchart riêng, bao gồm happy case và tất cả edge cases quan trọng.}
21
22
 
22
- | Component | Vai trò trong feature |
23
- | --- | --- |
24
- | `{C-XXX}-{component-name}` | {component này phục vụ cái gì cho feature này} |
23
+ ### Flow 1: {Tên luồng chính}
24
+
25
+ ```mermaid
26
+ flowchart TD
27
+ A([{Điểm bắt đầu}]) --> B[{Bước 1}]
28
+ B --> C{Điều kiện?}
29
+ C -- Happy case --> D[{Bước 2 — thành công}]
30
+ C -- Edge case --> E[{Xử lý lỗi / nhánh phụ}]
31
+ D --> F([{Kết thúc thành công}])
32
+ E --> G([{Kết thúc thất bại / fallback}])
33
+ ```
34
+
35
+ ### Flow 2: {Tên luồng phụ / edge case lớn} *(nếu có)*
36
+
37
+ ```mermaid
38
+ flowchart TD
39
+ A([{Điểm bắt đầu}]) --> B[{...}]
40
+ ```
25
41
 
26
42
  ## Feature-level Acceptance Criteria
27
43
 
@@ -83,6 +99,16 @@ US ID format: `US-F{NNN}-{seq}` — đánh số tăng dần toàn feature.
83
99
 
84
100
  ## Dependencies
85
101
 
102
+ ### Feature Dependencies
103
+
86
104
  | Feature | Loại | Ghi chú |
87
105
  | --- | --- | --- |
88
106
  | {feature-name} | required before / parallel | {lý do} |
107
+
108
+ ### Components Used
109
+
110
+ Tham chiếu đến `specs/main/component/{C-XXX}-...`.
111
+
112
+ | Component | Vai trò trong feature |
113
+ | --- | --- |
114
+ | `{C-XXX}-{component-name}` | {component này phục vụ cái gì cho feature này} |