qfai 1.5.7 → 1.6.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.
- package/README.md +6 -9
- package/assets/init/.qfai/README.md +1 -3
- package/assets/init/.qfai/assistant/instructions/workflow.md +5 -1
- package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +3 -5
- package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +221 -0
- package/assets/init/.qfai/specs/spec-XXXX/tdd/test-list.md +4 -0
- package/dist/cli/index.cjs +213 -74
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.mjs +202 -63
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.cjs +174 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +174 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-tdd-green/SKILL.md +0 -126
- package/assets/init/.qfai/assistant/skills/qfai-tdd-red/SKILL.md +0 -126
- package/assets/init/.qfai/assistant/skills/qfai-tdd-refactor/SKILL.md +0 -126
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ QFAI includes a small set of custom skills (stored under `.qfai/assistant/skills
|
|
|
123
123
|
- **qfai-sdd**: Unified SDD entrypoint with discussion-pack preflight guard (missing/incomplete/blocking OQ causes stop + next action guidance).
|
|
124
124
|
- **qfai-prototyping**: Build an all-spec contract-aligned skeleton and prove runtime coverage before deep coding.
|
|
125
125
|
- **qfai-atdd**: Implement acceptance tests driven by specs/scenarios.
|
|
126
|
-
- **qfai-
|
|
126
|
+
- **qfai-implement**: Unified TDD micro-cycle (Red/Green/Refactor) one test at a time using `test-list.md` as the execution ledger.
|
|
127
127
|
- **qfai-verify**: Run/interpret the local quality gates and produce a release-ready summary.
|
|
128
128
|
|
|
129
129
|
### Workflow sequence (example)
|
|
@@ -166,9 +166,10 @@ AG->>Q: Read .qfai/assistant/skills/qfai-atdd/SKILL.md
|
|
|
166
166
|
AG->>R: Implement acceptance tests
|
|
167
167
|
AG-->>U: ATDD tests ready
|
|
168
168
|
|
|
169
|
-
U->>AG:
|
|
170
|
-
AG->>Q: Read
|
|
171
|
-
AG
|
|
169
|
+
U->>AG: Run /qfai-implement
|
|
170
|
+
AG->>Q: Read .qfai/assistant/skills/qfai-implement/SKILL.md
|
|
171
|
+
AG->>R: Execute TDD micro-cycle (Red/Green/Refactor) per test-list.md
|
|
172
|
+
AG-->>U: Implementation complete
|
|
172
173
|
|
|
173
174
|
U->>AG: Run /qfai-verify
|
|
174
175
|
AG->>Q: Read .qfai/assistant/skills/qfai-verify/SKILL.md
|
|
@@ -357,11 +358,7 @@ Typical customizations.
|
|
|
357
358
|
│ │ │ │ └── SKILL.md
|
|
358
359
|
│ │ │ ├── qfai-atdd
|
|
359
360
|
│ │ │ │ └── SKILL.md
|
|
360
|
-
│ │ │ ├── qfai-
|
|
361
|
-
│ │ │ │ └── SKILL.md
|
|
362
|
-
│ │ │ ├── qfai-tdd-green
|
|
363
|
-
│ │ │ │ └── SKILL.md
|
|
364
|
-
│ │ │ ├── qfai-tdd-refactor
|
|
361
|
+
│ │ │ ├── qfai-implement
|
|
365
362
|
│ │ │ │ └── SKILL.md
|
|
366
363
|
│ │ │ └── qfai-verify
|
|
367
364
|
│ │ │ └── SKILL.md
|
|
@@ -17,9 +17,7 @@ flowchart TD
|
|
|
17
17
|
A[/qfai-discussion/] --> C[/qfai-sdd/]
|
|
18
18
|
C --> D[/qfai-prototyping/]
|
|
19
19
|
D --> E[/qfai-atdd/]
|
|
20
|
-
E --> F[/qfai-
|
|
21
|
-
F --> G[/qfai-tdd-green/]
|
|
22
|
-
G --> H[/qfai-tdd-refactor/]
|
|
20
|
+
E --> F[/qfai-implement/]
|
|
23
21
|
```
|
|
24
22
|
|
|
25
23
|
> Formatting must follow the templates and checklists documented in each directory README.
|
|
@@ -66,9 +66,13 @@ Prototyping stage policy:
|
|
|
66
66
|
- Completion requires prototyping evidence (markdown + json in `.qfai/evidence/`) and `qfai validate --fail-on error` pass.
|
|
67
67
|
- Coverage gaps (missing spec rows, unresolved declared checks, API 404) are blocking.
|
|
68
68
|
|
|
69
|
+
Implementation stage:
|
|
70
|
+
|
|
71
|
+
- `/qfai-implement` orchestrates the full TDD micro-cycle (Red/Green/Refactor) one test at a time using `test-list.md` as the execution ledger.
|
|
72
|
+
|
|
69
73
|
Legacy note:
|
|
70
74
|
|
|
71
|
-
-
|
|
75
|
+
- The three legacy TDD skills were abolished. Use `/qfai-implement` instead.
|
|
72
76
|
|
|
73
77
|
### Stage 0 — Steering refresh contract (mandatory)
|
|
74
78
|
|
|
@@ -228,7 +228,7 @@ Turn specs/contracts obligations (`US` / `TC` / `CON-API`) into runnable accepta
|
|
|
228
228
|
## Scope (ATDD only)
|
|
229
229
|
|
|
230
230
|
- In scope: E2E, API, Integration.
|
|
231
|
-
- Out of scope: Unit and Component (`/qfai-
|
|
231
|
+
- Out of scope: Unit and Component (`/qfai-implement`).
|
|
232
232
|
|
|
233
233
|
## Non-goals
|
|
234
234
|
|
|
@@ -421,9 +421,7 @@ When declaring DONE, include:
|
|
|
421
421
|
|
|
422
422
|
When this skill is complete, provide a final user-facing completion message and enumerate all actionable next steps.
|
|
423
423
|
|
|
424
|
-
- Proceed (recommended): `/qfai-
|
|
425
|
-
Action:
|
|
424
|
+
- Proceed (recommended): `/qfai-implement`.
|
|
425
|
+
Action: run unified TDD micro-cycle (Red/Green/Refactor) one test at a time from test-list.md.
|
|
426
426
|
- Acceptance tests need fixes: rerun `/qfai-atdd`.
|
|
427
427
|
Action: close uncovered `US` / `TC` / `CON-API` obligations and rerun validation.
|
|
428
|
-
- Implementation phase: `/qfai-tdd-green`.
|
|
429
|
-
Action: implement code to satisfy failing tests.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qfai-implement
|
|
3
|
+
title: QFAI Implement (Unified TDD Micro-cycle)
|
|
4
|
+
description: "Unified implementation skill that orchestrates the full TDD micro-cycle (Red/Green/Refactor) one test at a time using test-list.md as the execution ledger."
|
|
5
|
+
argument-hint: "<spec-id>"
|
|
6
|
+
allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent]
|
|
7
|
+
roles: [Implementer, Reviewer]
|
|
8
|
+
mode: approval-gated
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--
|
|
12
|
+
QFAI Skill Body (SSOT)
|
|
13
|
+
- This file is intended to be referenced by tool-specific wrappers (e.g., GitHub/Claude/Codex skills).
|
|
14
|
+
- Keep wrappers thin and route users to this skill body.
|
|
15
|
+
-->
|
|
16
|
+
|
|
17
|
+
## /qfai-implement - Unified TDD Micro-cycle
|
|
18
|
+
|
|
19
|
+
[DRIFT-PROTOCOL:MANDATORY]
|
|
20
|
+
|
|
21
|
+
## User Questions (AskUserQuestion Protocol)
|
|
22
|
+
|
|
23
|
+
- When a question to the user is needed (e.g., exception handling, scope confirmation),
|
|
24
|
+
the agent MUST use AskUserQuestion if the tool is available.
|
|
25
|
+
- When AskUserQuestion supports structured choices (radio/multi-select),
|
|
26
|
+
the agent MUST prefer structured choices over free-text input.
|
|
27
|
+
- If AskUserQuestion is technically unavailable, present the same question as a normal message
|
|
28
|
+
with explicit numbered choices.
|
|
29
|
+
The agent SHOULD preserve structured choice semantics (enumerated options, selection constraints).
|
|
30
|
+
The reason for unavailability MUST be stated.
|
|
31
|
+
|
|
32
|
+
## CRITICAL CONSTRAINTS (Read First)
|
|
33
|
+
|
|
34
|
+
- This skill processes **one test at a time** from `test-list.md`.
|
|
35
|
+
- Each item goes through the full TDD micro-cycle: write a **failing test** first, then make it pass, then refactor.
|
|
36
|
+
- The execution ledger is located at `.qfai/specs/spec-XXXX/tdd/test-list.md`.
|
|
37
|
+
- Items are processed **serially** by default. Parallel processing is allowed only when items target independent SUT slices with no shared state.
|
|
38
|
+
- Status transitions follow a strict forward-only lifecycle: `todo` -> `red` -> `green` -> `refactor` -> `done`.
|
|
39
|
+
- The `exception` status can be reached from any active status when an anomaly is detected.
|
|
40
|
+
- Backward transitions are prohibited (e.g., `green` -> `red` is not allowed).
|
|
41
|
+
- Completed items (`done`) are skipped on re-execution.
|
|
42
|
+
- When all items are `done`, report "nothing to do" and exit.
|
|
43
|
+
|
|
44
|
+
## Goal
|
|
45
|
+
|
|
46
|
+
Execute the TDD micro-cycle for each pending item in `test-list.md`, transitioning each through Red -> Green -> Refactor -> Done, producing tested production code aligned with the spec.
|
|
47
|
+
|
|
48
|
+
## Non-goals
|
|
49
|
+
|
|
50
|
+
- Writing spec artifacts (use `/qfai-sdd`).
|
|
51
|
+
- Writing acceptance tests (use `/qfai-atdd`).
|
|
52
|
+
- Running validation gates (use `/qfai-verify`).
|
|
53
|
+
- Parallel execution across multiple specs simultaneously.
|
|
54
|
+
|
|
55
|
+
## Execution Ledger: test-list.md
|
|
56
|
+
|
|
57
|
+
The execution ledger at `.qfai/specs/spec-XXXX/tdd/test-list.md` tracks progress with these required columns:
|
|
58
|
+
|
|
59
|
+
| Column | Description |
|
|
60
|
+
| --------- | -------------------------------------------------- |
|
|
61
|
+
| TDD-ID | Unique identifier for the TDD item (e.g., TDD-001) |
|
|
62
|
+
| TC-Refs | References to test cases from `06_Test-Cases.md` |
|
|
63
|
+
| Layer | Test layer (Unit, Integration, etc.) |
|
|
64
|
+
| Test file | Path to the test file |
|
|
65
|
+
| Selector | Test selector/description for targeted execution |
|
|
66
|
+
| Status | Current lifecycle status |
|
|
67
|
+
|
|
68
|
+
### Status Lifecycle
|
|
69
|
+
|
|
70
|
+
Valid status values: `todo`, `red`, `green`, `refactor`, `done`, `exception`.
|
|
71
|
+
|
|
72
|
+
Allowed transitions:
|
|
73
|
+
|
|
74
|
+
- `todo` -> `red` (write a failing test)
|
|
75
|
+
- `red` -> `green` (make the test pass with minimal code)
|
|
76
|
+
- `green` -> `refactor` (improve code quality while keeping tests green)
|
|
77
|
+
- `refactor` -> `done` (item complete)
|
|
78
|
+
- Any active status -> `exception` (anomaly detected; record DR-ID in Notes column if present)
|
|
79
|
+
|
|
80
|
+
Backward transitions are prohibited. Attempting `green` -> `red` must produce:
|
|
81
|
+
`"Backward transition prohibited: green -> red"`.
|
|
82
|
+
|
|
83
|
+
### Exception Handling
|
|
84
|
+
|
|
85
|
+
When transitioning to `exception`:
|
|
86
|
+
|
|
87
|
+
- A DR-ID (Decision Record ID) should be recorded in the Notes column if present.
|
|
88
|
+
- If a Notes column exists but is empty, emit warning: `"exception status requires DR-ID in Notes column"`.
|
|
89
|
+
|
|
90
|
+
## Required Process
|
|
91
|
+
|
|
92
|
+
### Phase: Red (Write Failing Test)
|
|
93
|
+
|
|
94
|
+
1. Read `test-list.md` and select the first item with `Status = todo`.
|
|
95
|
+
2. Transition status to `red`.
|
|
96
|
+
3. Write a **failing test** based on the TC-Refs specification.
|
|
97
|
+
4. Run the test and **watch it fail** — confirm the test actually fails for the expected reason.
|
|
98
|
+
5. If the test unexpectedly passes, transition to `exception` and record the anomaly.
|
|
99
|
+
|
|
100
|
+
### Phase: Green (Make It Pass)
|
|
101
|
+
|
|
102
|
+
1. Write the **minimum production code** to make the failing test pass.
|
|
103
|
+
2. Run the test and **watch it pass**.
|
|
104
|
+
3. Transition status to `green`.
|
|
105
|
+
4. If the test still fails after implementation, investigate and fix. Do not skip to refactor.
|
|
106
|
+
|
|
107
|
+
### Phase: Refactor
|
|
108
|
+
|
|
109
|
+
1. Improve code quality (naming, structure, duplication removal) while keeping all tests green.
|
|
110
|
+
2. Run the full relevant test suite to confirm nothing broke.
|
|
111
|
+
3. Transition status to `refactor`, then immediately to `done`.
|
|
112
|
+
|
|
113
|
+
### Completion
|
|
114
|
+
|
|
115
|
+
1. After processing all items, update `test-list.md` with final statuses.
|
|
116
|
+
2. If all items are `done`, report "All items complete".
|
|
117
|
+
3. If some items are `exception`, report them with their DR-IDs.
|
|
118
|
+
|
|
119
|
+
## Sub-agent Delegation (MANDATORY)
|
|
120
|
+
|
|
121
|
+
### Orchestrator Protocol (MUST)
|
|
122
|
+
|
|
123
|
+
- Orchestrator reads `test-list.md`, determines the next pending item, and delegates each TDD phase.
|
|
124
|
+
- Orchestrator MUST NOT write test or production code directly.
|
|
125
|
+
- Orchestrator updates `test-list.md` status after each phase completes.
|
|
126
|
+
|
|
127
|
+
### Sub-agent Roles
|
|
128
|
+
|
|
129
|
+
| Role | Responsibility |
|
|
130
|
+
| ----------- | -------------------------------------------- |
|
|
131
|
+
| TestWriter | Writes the failing test (Red phase) |
|
|
132
|
+
| Implementer | Writes minimal production code (Green phase) |
|
|
133
|
+
| Refactorer | Improves code quality (Refactor phase) |
|
|
134
|
+
| TestRunner | Executes tests and reports pass/fail results |
|
|
135
|
+
|
|
136
|
+
### Capability Probe (MUST)
|
|
137
|
+
|
|
138
|
+
1. Run one harmless Probe Task once at stage start.
|
|
139
|
+
2. If subagents are unavailable, explicitly ask for Simulation mode approval.
|
|
140
|
+
3. Without explicit approval, stop the stage.
|
|
141
|
+
|
|
142
|
+
### Simulation mode (Opt-in only)
|
|
143
|
+
|
|
144
|
+
- Allowed only when user explicitly states `Simulation mode allowed`.
|
|
145
|
+
- Record both:
|
|
146
|
+
- `Subagents: simulated (reason: <why unavailable>)`
|
|
147
|
+
- `User approval: <quote or reference>`
|
|
148
|
+
|
|
149
|
+
## Work Orders Summary
|
|
150
|
+
|
|
151
|
+
Every major artifact in this stage MUST include this table schema:
|
|
152
|
+
|
|
153
|
+
| Step | Role (sub-agent) | Task title | Input (refs) | Output (refs) | Status (PASS/REVISE) |
|
|
154
|
+
| ---- | ---------------- | ---------- | ------------ | ------------- | -------------------- |
|
|
155
|
+
| 1 | `role` | `task` | `refs` | `refs` | PASS/REVISE |
|
|
156
|
+
|
|
157
|
+
### Reviewer Gate (MUST)
|
|
158
|
+
|
|
159
|
+
- Delegate final completion gate to an independent Reviewer.
|
|
160
|
+
- Reviewer checks Drift Protocol compliance and alignment with `.qfai/assistant/steering/test-layers.md`.
|
|
161
|
+
- Test volume floors/ratios are not gates; they are signals.
|
|
162
|
+
- Do not declare DONE until Reviewer returns `PASS`; otherwise apply `REVISE`.
|
|
163
|
+
|
|
164
|
+
## Parallelization Policy
|
|
165
|
+
|
|
166
|
+
- **Default**: Serial execution. Items are processed one at a time in `test-list.md` order.
|
|
167
|
+
- **Exception**: When items target completely independent SUT modules with no shared state, parallel processing may be used with explicit user approval.
|
|
168
|
+
- Serial execution ensures that each test is written and verified in isolation before moving to the next.
|
|
169
|
+
|
|
170
|
+
## Completion Contract (Shared)
|
|
171
|
+
|
|
172
|
+
Before declaring completion, you MUST:
|
|
173
|
+
|
|
174
|
+
- All `todo` items in `test-list.md` have been processed.
|
|
175
|
+
- Each processed item reached `done` or `exception` status.
|
|
176
|
+
- All tests pass (`npm test` or equivalent).
|
|
177
|
+
- `test-list.md` reflects the final state accurately.
|
|
178
|
+
- Exception items have DR-IDs recorded (in Notes column if present).
|
|
179
|
+
|
|
180
|
+
## Evidence (MANDATORY)
|
|
181
|
+
|
|
182
|
+
Create/update: `.qfai/evidence/implement-spec-XXXX.md`
|
|
183
|
+
|
|
184
|
+
Required sections:
|
|
185
|
+
|
|
186
|
+
- Objective
|
|
187
|
+
- Items processed (TDD-ID, TC-Refs, final status)
|
|
188
|
+
- Test results summary
|
|
189
|
+
- Exception items (if any) with DR-IDs
|
|
190
|
+
- Commands executed
|
|
191
|
+
|
|
192
|
+
## FINAL CHECKLIST (Check Last)
|
|
193
|
+
|
|
194
|
+
- [ ] CRITICAL CONSTRAINTS were followed.
|
|
195
|
+
- [ ] Each item was processed one test at a time.
|
|
196
|
+
- [ ] Red phase: test was written and confirmed to fail.
|
|
197
|
+
- [ ] Green phase: minimal code was written and test confirmed to pass.
|
|
198
|
+
- [ ] Refactor phase: code improved with tests still passing.
|
|
199
|
+
- [ ] `test-list.md` statuses are accurate.
|
|
200
|
+
- [ ] No backward transitions occurred.
|
|
201
|
+
- [ ] Exception items have DR-IDs recorded.
|
|
202
|
+
- [ ] All tests pass.
|
|
203
|
+
|
|
204
|
+
## Completion Checklist (MUST)
|
|
205
|
+
|
|
206
|
+
- [ ] This skill's Definition of Done is satisfied.
|
|
207
|
+
- [ ] Required artifacts were produced or updated (if applicable).
|
|
208
|
+
- [ ] Open questions were logged to the proper OQ file (if applicable).
|
|
209
|
+
- [ ] The completion message was presented to the user.
|
|
210
|
+
- [ ] Next actions were enumerated for all available options.
|
|
211
|
+
|
|
212
|
+
## Completion Message & Next Actions (MUST)
|
|
213
|
+
|
|
214
|
+
When this skill is complete, provide a final user-facing completion message and enumerate all actionable next steps.
|
|
215
|
+
|
|
216
|
+
- Verify gates: `/qfai-verify`.
|
|
217
|
+
Action: run `qfai validate --fail-on error` and confirm all gates pass.
|
|
218
|
+
- Spec updates needed: `/qfai-sdd`.
|
|
219
|
+
Action: update spec artifacts if implementation revealed scope changes.
|
|
220
|
+
- Acceptance tests: `/qfai-atdd`.
|
|
221
|
+
Action: ensure acceptance test coverage aligns with implementation.
|