@tianhai/pi-workflow-kit 0.15.0 → 0.16.0

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.
@@ -10,18 +10,43 @@ You may only create or edit files under `docs/plans/`. Do not modify source code
10
10
  ## Process
11
11
 
12
12
  1. **Check for a design doc** — look for `docs/plans/*-design.md`. If one exists, use it as the basis for the plan. If the design doc is incomplete, fill gaps by asking the human. If no design doc exists, ask the user to describe what they want to build and read relevant code. **Read `docs/lessons.md`** if it exists — incorporate known patterns into the task breakdown (e.g., if a lesson says "always run lint before commit," include that in relevant task instructions).
13
+
14
+ Then evaluate whether the design — whether from the design doc or from the user's description and codebase exploration — involves any of the following:
15
+
16
+ - Database schema changes or migrations
17
+ - Authentication or authorization logic
18
+ - External API or service integrations
19
+ - Concurrency or batch processing
20
+ - File uploads or large data flows
21
+ - Redis, caching, or message queues
22
+
23
+ If any apply AND the design doc does not already have an `## Architectural Review` section, prompt the user: "This design involves [list what you found] but hasn't been reviewed for production risks. Run `/skill:design-review` first, or type 'proceed' to skip."
24
+
25
+ If the design doc explicitly notes "Simple change — no design review needed", skip this check.
13
26
  2. **Write the implementation plan** — break the design into tasks. Save to `docs/plans/YYYY-MM-DD-<topic>-implementation.md`. If the design is too large for ~15 tasks, flag this to the human and ask whether to reduce scope or proceed with the full plan.
14
27
  3. **Present the plan** — show the complete plan to the human. Wait for approval before suggesting execution.
15
28
 
29
+ Before presenting, run the **Plan Acceptance Audit**:
30
+ - **Vertical Slices**: Is every task a complete vertical slice (not horizontal)?
31
+ - **Task Sizing**: Is any single task too large or covering multiple complex behaviors? If so, split it.
32
+ - **QA Coverage**: Does every task have both a Happy Path and at least one Edge Case in its Acceptance Criteria?
33
+ - **Checkpoint Alignment**: Are `checkpoint: test` and `checkpoint: done` gates placed on the most critical or risky tasks?
34
+ - **Risk Enforcement**: If the design doc's Architectural Review section flagged any hazards as `[TRIGGERED]`, verify the corresponding tasks have `checkpoint: done` and a `Hazard Mitigation Verification` section.
35
+
36
+ If any check fails, fix the plan before presenting.
37
+
16
38
  ## Task format
17
39
 
18
40
  Each task should produce one testable change. The executing-tasks skill handles committing — do not include `git commit` in the task body.
19
41
 
20
42
  Each task must include:
21
43
  - Exact file paths to create/modify
44
+ - **Acceptance Criteria (QA Engineer Hat)** — Put on your **QA Engineer Hat** to design exhaustive test coverage. Explicitly define:
45
+ - **Happy Path**: Expected behavior under normal operations.
46
+ - **Edge Cases & Error Paths**: What happens with empty inputs, limits exceeded, authentication failures, or error states.
47
+ Ensure every criteria block specifies the expected state and returned results using `Given/When/Then` behavioral blocks.
22
48
  - **Concrete code** — include the actual implementation, not a summary. Write out SQL schemas, type definitions, function signatures with bodies, route handler code, and test assertions. A developer should be able to copy-paste from the plan and have working code. For tasks that depend on types or utilities from earlier tasks, reference them explicitly (e.g., `import { User } from Task 2`) and include only the new code
23
49
  - Exact commands with expected output (e.g., `npx vitest run src/user/model.test.ts` → shows 1 test passing)
24
- - Each task's tests should cover the happy path and at least one edge case or error path, with concrete assertions
25
50
 
26
51
  Each task must use a numbered heading with optional metadata comments:
27
52
 
@@ -95,6 +120,16 @@ The examples below show the structure — headings, metadata comments, checkpoin
95
120
 
96
121
  <!-- tdd: new-feature -->
97
122
 
123
+ Acceptance Criteria (QA Engineer Hat):
124
+ - **Happy Path**:
125
+ - Given: Valid user data with name and email
126
+ - When: The User model is created
127
+ - Then: The model contains the correct fields and a generated ID
128
+ - **Edge Case (duplicate email)**:
129
+ - Given: A user with email "test@example.com" already exists
130
+ - When: Another user is created with the same email
131
+ - Then: Creation fails with a unique constraint error
132
+
98
133
  Files:
99
134
  - `src/user/model.ts`
100
135
  - `src/user/model.test.ts`
@@ -113,6 +148,16 @@ Steps:
113
148
  <!-- tdd: new-feature -->
114
149
  <!-- checkpoint: test -->
115
150
 
151
+ Acceptance Criteria (QA Engineer Hat):
152
+ - **Happy Path**:
153
+ - Given: A user with valid credentials exists
154
+ - When: Login is attempted
155
+ - Then: A valid session token is returned
156
+ - **Edge Case (wrong password)**:
157
+ - Given: A user exists but password is incorrect
158
+ - When: Login is attempted
159
+ - Then: An authentication error is returned
160
+
116
161
  Files:
117
162
  - `src/auth/login.test.ts`
118
163
 
@@ -135,6 +180,20 @@ Steps:
135
180
  <!-- tdd: new-feature -->
136
181
  <!-- checkpoint: done -->
137
182
 
183
+ Acceptance Criteria (QA Engineer Hat):
184
+ - **Happy Path**:
185
+ - Given: A user with email "user@example.com" and password "secure123" exists
186
+ - When: A POST request with those credentials is sent to `/api/login`
187
+ - Then: Response returns `200 OK` with a signed JWT token
188
+ - **Edge Case (invalid password)**:
189
+ - Given: A user exists but the password sent is "wrong-pass"
190
+ - When: A POST request is sent to `/api/login`
191
+ - Then: Response returns `401 Unauthorized`
192
+ - **Edge Case (rate limiting)**:
193
+ - Given: 5 failed login attempts from the same IP
194
+ - When: A 6th attempt is sent
195
+ - Then: Response returns `429 Too Many Requests`
196
+
138
197
  Files:
139
198
  - `src/auth/login.ts`
140
199
  - `src/auth/login.test.ts`
@@ -159,6 +218,16 @@ Steps:
159
218
  <!-- checkpoint: test -->
160
219
  <!-- checkpoint: done -->
161
220
 
221
+ Acceptance Criteria (QA Engineer Hat):
222
+ - **Happy Path**:
223
+ - Given: A valid OAuth2 authorization code
224
+ - When: The auth callback is invoked
225
+ - Then: A user session is created and the user is redirected to the dashboard
226
+ - **Edge Case (expired code)**:
227
+ - Given: An expired or invalid authorization code
228
+ - When: The auth callback is invoked
229
+ - Then: The user is redirected to login with an error message
230
+
162
231
  Steps:
163
232
  1. Write failing test for auth flow
164
233
  2. Run test — confirm it fails