qfai 1.0.3 → 1.0.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/README.md +53 -74
- package/assets/init/.qfai/README.md +17 -82
- package/assets/init/.qfai/assistant/README.md +9 -0
- package/assets/init/.qfai/assistant/agents/README.md +34 -0
- package/assets/init/.qfai/assistant/agents/architect.md +73 -0
- package/assets/init/.qfai/assistant/agents/backend-engineer.md +73 -0
- package/assets/init/.qfai/assistant/agents/code-reviewer.md +73 -0
- package/assets/init/.qfai/assistant/agents/contract-designer.md +73 -0
- package/assets/init/.qfai/assistant/agents/devops-ci-engineer.md +73 -0
- package/assets/init/.qfai/assistant/agents/facilitator.md +74 -0
- package/assets/init/.qfai/assistant/agents/frontend-engineer.md +73 -0
- package/assets/init/.qfai/assistant/agents/interviewer.md +72 -0
- package/assets/init/.qfai/assistant/agents/planner.md +73 -0
- package/assets/init/.qfai/assistant/agents/qa-engineer.md +73 -0
- package/assets/init/.qfai/assistant/agents/requirements-analyst.md +73 -0
- package/assets/init/.qfai/assistant/agents/test-engineer.md +73 -0
- package/assets/init/.qfai/assistant/instructions/README.md +6 -0
- package/assets/init/.qfai/assistant/instructions/constitution.md +131 -0
- package/assets/init/.qfai/assistant/instructions/workflow.md +75 -0
- package/assets/init/.qfai/assistant/prompts/README.md +19 -0
- package/assets/init/.qfai/assistant/prompts/qfai-discuss.md +173 -0
- package/assets/init/.qfai/assistant/prompts/qfai-implement.md +239 -0
- package/assets/init/.qfai/assistant/prompts/qfai-pr.md +218 -0
- package/assets/init/.qfai/assistant/prompts/qfai-require.md +273 -0
- package/assets/init/.qfai/assistant/prompts/qfai-scenario-test.md +229 -0
- package/assets/init/.qfai/assistant/prompts/qfai-spec.md +287 -0
- package/assets/init/.qfai/assistant/prompts/qfai-unit-test.md +202 -0
- package/assets/init/.qfai/assistant/prompts/qfai-verify.md +231 -0
- package/assets/init/.qfai/assistant/prompts.local/README.md +6 -0
- package/assets/init/.qfai/assistant/steering/README.md +33 -0
- package/assets/init/.qfai/assistant/steering/product.md +32 -0
- package/assets/init/.qfai/assistant/steering/structure.md +34 -0
- package/assets/init/.qfai/assistant/steering/tech.md +37 -0
- package/assets/init/.qfai/contracts/README.md +7 -87
- package/assets/init/.qfai/contracts/api/README.md +8 -0
- package/assets/init/.qfai/contracts/db/README.md +8 -0
- package/assets/init/.qfai/contracts/ui/README.md +8 -0
- package/assets/init/.qfai/report/README.md +13 -0
- package/assets/init/.qfai/require/README.md +4 -26
- package/assets/init/.qfai/require/require.md +74 -0
- package/assets/init/.qfai/specs/README.md +6 -57
- package/assets/init/root/.github/workflows/qfai.yml +1 -1
- package/assets/init/root/qfai.config.yaml +3 -4
- package/dist/cli/index.cjs +313 -472
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.mjs +295 -454
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.cjs +37 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +37 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/assets/init/.qfai/contracts/api/api-0001-sample.yaml +0 -15
- package/assets/init/.qfai/contracts/db/db-0001-sample.sql +0 -7
- package/assets/init/.qfai/contracts/ui/assets/thema-001-facebook-like/assets.yaml +0 -6
- package/assets/init/.qfai/contracts/ui/assets/thema-001-facebook-like/palette.png +0 -0
- package/assets/init/.qfai/contracts/ui/assets/ui-0001-sample/assets.yaml +0 -6
- package/assets/init/.qfai/contracts/ui/assets/ui-0001-sample/snapshots/login__desktop__light__default.png +0 -0
- package/assets/init/.qfai/contracts/ui/thema-001-facebook-like.yml +0 -13
- package/assets/init/.qfai/contracts/ui/ui-0001-sample.yaml +0 -17
- package/assets/init/.qfai/out/README.md +0 -17
- package/assets/init/.qfai/promptpack/commands/implement.md +0 -8
- package/assets/init/.qfai/promptpack/commands/plan.md +0 -11
- package/assets/init/.qfai/promptpack/commands/release.md +0 -6
- package/assets/init/.qfai/promptpack/commands/review.md +0 -7
- package/assets/init/.qfai/promptpack/constitution.md +0 -15
- package/assets/init/.qfai/promptpack/modes/change.md +0 -5
- package/assets/init/.qfai/promptpack/modes/compatibility.md +0 -6
- package/assets/init/.qfai/promptpack/roles/qa.md +0 -4
- package/assets/init/.qfai/promptpack/roles/spec.md +0 -4
- package/assets/init/.qfai/promptpack/roles/test.md +0 -4
- package/assets/init/.qfai/promptpack/steering/compatibility-vs-change.md +0 -42
- package/assets/init/.qfai/promptpack/steering/naming.md +0 -7
- package/assets/init/.qfai/promptpack/steering/traceability.md +0 -25
- package/assets/init/.qfai/prompts/README.md +0 -70
- package/assets/init/.qfai/prompts/analyze/README.md +0 -21
- package/assets/init/.qfai/prompts/analyze/scenario_test_consistency.md +0 -8
- package/assets/init/.qfai/prompts/analyze/scenario_to_test.md +0 -56
- package/assets/init/.qfai/prompts/analyze/spec_contract_consistency.md +0 -8
- package/assets/init/.qfai/prompts/analyze/spec_scenario_consistency.md +0 -8
- package/assets/init/.qfai/prompts/analyze/spec_to_contract.md +0 -54
- package/assets/init/.qfai/prompts/analyze/spec_to_scenario.md +0 -56
- package/assets/init/.qfai/prompts/makeBusinessFlow.md +0 -34
- package/assets/init/.qfai/prompts/makeOverview.md +0 -27
- package/assets/init/.qfai/prompts/qfai-classify-change.md +0 -33
- package/assets/init/.qfai/prompts/qfai-generate-test-globs.md +0 -29
- package/assets/init/.qfai/prompts/qfai-maintain-contracts.md +0 -35
- package/assets/init/.qfai/prompts/qfai-maintain-traceability.md +0 -36
- package/assets/init/.qfai/prompts/require-to-spec.md +0 -41
- package/assets/init/.qfai/prompts.local/README.md +0 -31
- package/assets/init/.qfai/rules/conventions.md +0 -27
- package/assets/init/.qfai/rules/pnpm.md +0 -29
- package/assets/init/.qfai/samples/analyze/analysis.md +0 -38
- package/assets/init/.qfai/samples/analyze/input_bundle.md +0 -54
- package/assets/init/.qfai/specs/spec-0001/delta.md +0 -30
- package/assets/init/.qfai/specs/spec-0001/scenario.feature +0 -11
- package/assets/init/.qfai/specs/spec-0001/spec.md +0 -40
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
QFAI Prompt Body (SSOT)
|
|
3
|
+
- This file is intended to be referenced by tool-specific custom prompt definitions (e.g., Copilot .prompt.md, Claude Code slash commands).
|
|
4
|
+
- Keep tool-specific wrappers thin: "Read this file and follow it."
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
id: qfai-unit-test
|
|
10
|
+
title: QFAI Unit Test (TDD executable)
|
|
11
|
+
description: "Implement CI-runnable unit tests derived from spec/scenario; includes review and quality checks."
|
|
12
|
+
argument-hint: "<spec-id> [--auto]"
|
|
13
|
+
allowed-tools: [Read, Glob, Write, TodoWrite, Task, Bash]
|
|
14
|
+
roles: [TestEngineer, BackendEngineer, FrontendEngineer, QAEngineer, CodeReviewer]
|
|
15
|
+
mode: test-first
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# /qfai-unit-test — Implement Unit Tests (TDD)
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
Implement **unit tests** that enforce the spec and provide fast feedback.
|
|
24
|
+
|
|
25
|
+
## Success Criteria (Definition of Done)
|
|
26
|
+
|
|
27
|
+
- Unit tests exist, are deterministic, and runnable in CI.
|
|
28
|
+
- Tests cover core logic and key edge cases derived from spec/scenario.
|
|
29
|
+
- Tests fail meaningfully (actionable errors).
|
|
30
|
+
|
|
31
|
+
## Non‑Negotiable Principles (QFAI Articles)
|
|
32
|
+
|
|
33
|
+
These principles are inspired by “constitution / articles” patterns used by other agent frameworks, but tailored to QFAI.
|
|
34
|
+
|
|
35
|
+
1. **SDD First (Specification is the source of truth)**
|
|
36
|
+
If there is a conflict between code and spec, treat the spec as authoritative and either (a) fix code or (b) raise an explicit Open Question to change the spec.
|
|
37
|
+
|
|
38
|
+
2. **Traceability is mandatory**
|
|
39
|
+
Every meaningful change must be traceable: **Require → Spec → Scenario → Tests → Code → Verification evidence**.
|
|
40
|
+
|
|
41
|
+
3. **Evidence over confidence**
|
|
42
|
+
Prefer observable proof (logs, commands, file diffs, test results). If you cannot verify, say so and record it.
|
|
43
|
+
|
|
44
|
+
4. **Minimize scope, but never hide gaps**
|
|
45
|
+
Keep changes minimal, but do not “paper over” missing decisions. If something blocks correctness, stop and ask.
|
|
46
|
+
|
|
47
|
+
5. **Quality gates are the decision mechanism**
|
|
48
|
+
Use tests/lint/typecheck/build/pack verification (whatever the repo defines) as the primary guardrail. Fix until PASS.
|
|
49
|
+
|
|
50
|
+
6. **Make it runnable**
|
|
51
|
+
Outputs must be executable in terminal/CI. Provide copy‑paste commands.
|
|
52
|
+
|
|
53
|
+
7. **User time is expensive**
|
|
54
|
+
Ask only the questions that are truly blocking. Everything else: make reasonable assumptions and label them clearly.
|
|
55
|
+
|
|
56
|
+
## Absolute Rule — Output Language
|
|
57
|
+
|
|
58
|
+
**All outputs MUST be written in the user’s working language for this session.**
|
|
59
|
+
|
|
60
|
+
- If the user writes in Japanese, output Japanese.
|
|
61
|
+
- If the user writes in English, output English.
|
|
62
|
+
- If the user mixes languages, prefer the dominant language unless explicitly instructed otherwise.
|
|
63
|
+
This rule overrides all other stylistic preferences.
|
|
64
|
+
|
|
65
|
+
## Multi‑Role Orchestration (Subagents)
|
|
66
|
+
|
|
67
|
+
This workflow assumes the environment _may_ support subagents (e.g., Claude Code “Task” tool) or may not.
|
|
68
|
+
|
|
69
|
+
### If subagents are supported
|
|
70
|
+
|
|
71
|
+
Delegate to multiple roles and then merge the results. Use a “real‑world workflow” order:
|
|
72
|
+
|
|
73
|
+
- Facilitator → Interviewer → Requirements Analyst → Planner → Architect → (Contract Designer) → Test Engineer → QA Engineer → Code Reviewer → DevOps/CI Engineer
|
|
74
|
+
|
|
75
|
+
**Pseudo‑invocation pattern** (adjust to your tool):
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Task(
|
|
79
|
+
subagent_type="planner",
|
|
80
|
+
description="Create an execution plan and DoD",
|
|
81
|
+
prompt="Context: ...\nGoal: ...\nConstraints: ...\nReturn: phases + risks + DoD"
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### If subagents are NOT supported
|
|
86
|
+
|
|
87
|
+
Simulate roles by running the same sequence yourself:
|
|
88
|
+
|
|
89
|
+
- Write a short “role output” section per role, then consolidate into the final deliverable(s).
|
|
90
|
+
|
|
91
|
+
## Behavior Rules (high leverage)
|
|
92
|
+
|
|
93
|
+
- **Language**: Output MUST follow the user’s working language for this session.
|
|
94
|
+
- **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
|
|
95
|
+
- **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
|
|
96
|
+
- **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
|
|
97
|
+
- **Subagent contract**: When delegating, require the subagent response structure:
|
|
98
|
+
1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
|
|
99
|
+
|
|
100
|
+
## Step 0 — Load Context (always)
|
|
101
|
+
|
|
102
|
+
1. Read relevant **project steering** (if present):
|
|
103
|
+
- `.qfai/assistant/steering/structure.md`
|
|
104
|
+
- `.qfai/assistant/steering/tech.md`
|
|
105
|
+
- `.qfai/assistant/steering/product.md`
|
|
106
|
+
- any additional files under `.qfai/assistant/steering/`
|
|
107
|
+
|
|
108
|
+
2. Read **project constitution / instructions** (if present):
|
|
109
|
+
- `.qfai/assistant/instructions/constitution.md`
|
|
110
|
+
- `.qfai/assistant/instructions/workflow.md` (or equivalent)
|
|
111
|
+
|
|
112
|
+
3. Read existing artifacts for the current work item (if present):
|
|
113
|
+
- `.qfai/require/`
|
|
114
|
+
- `.qfai/specs/spec-*/`
|
|
115
|
+
- `.qfai/contracts/`
|
|
116
|
+
|
|
117
|
+
4. Inspect repo conventions:
|
|
118
|
+
- package manager (pnpm/npm/yarn), test runner, lint/typecheck scripts, CI definitions
|
|
119
|
+
- existing test patterns (unit/integration/e2e)
|
|
120
|
+
|
|
121
|
+
## Step 0 — Project Analysis (mandatory)
|
|
122
|
+
|
|
123
|
+
Before producing any deliverable, **thoroughly analyze the current project** so your outputs fit the repo’s:
|
|
124
|
+
|
|
125
|
+
- background and goals
|
|
126
|
+
- directory structure and conventions
|
|
127
|
+
- chosen technologies and versions (runtime, package manager, test runner)
|
|
128
|
+
- architecture boundaries (packages, CLI, core modules)
|
|
129
|
+
- existing patterns for tests, docs, and CI
|
|
130
|
+
|
|
131
|
+
### Minimum analysis checklist
|
|
132
|
+
|
|
133
|
+
- [ ] Read key repo docs: README / CHANGELOG / RELEASE (if present)
|
|
134
|
+
- [ ] Inspect `.qfai/` layout and existing SDD/ATDD/TDD artifacts (if present)
|
|
135
|
+
- [ ] Inspect `packages/qfai` structure (CLI entrypoints, core modules, validators, assets/init)
|
|
136
|
+
- [ ] Identify standard gate commands (format/lint/type/test/verify-pack) and where they are defined
|
|
137
|
+
- [ ] Search for existing examples/patterns of similar changes in tests (if available)
|
|
138
|
+
- [ ] Note constraints: Node versions, CI matrix, packaging rules, verify-pack expectations
|
|
139
|
+
|
|
140
|
+
If analysis cannot be performed (missing access), clearly state what could not be verified and proceed with minimal-risk assumptions.
|
|
141
|
+
|
|
142
|
+
## Step 0.5 — Steering Bootstrap / Refresh (mandatory when incomplete)
|
|
143
|
+
|
|
144
|
+
QFAI expects `assistant/steering/` to contain **project‑specific facts** so all subsequent design/test/implementation fits this repository.
|
|
145
|
+
|
|
146
|
+
### What to do
|
|
147
|
+
|
|
148
|
+
1. Open these files:
|
|
149
|
+
|
|
150
|
+
- `.qfai/assistant/steering/product.md`
|
|
151
|
+
- `.qfai/assistant/steering/tech.md`
|
|
152
|
+
- `.qfai/assistant/steering/structure.md`
|
|
153
|
+
|
|
154
|
+
2. If they are missing, mostly empty, or still have placeholders (e.g., `- ` only), **populate them by analyzing the current repository**:
|
|
155
|
+
|
|
156
|
+
- derive “what/why/users/success/non-goals” from README/docs/issues (product.md)
|
|
157
|
+
- derive runtime/tooling versions + constraints from package.json, CI config, lockfiles (tech.md)
|
|
158
|
+
- derive repo layout + key directories + gate commands from the file tree and scripts (structure.md)
|
|
159
|
+
|
|
160
|
+
3. Do **not** invent facts. If something cannot be verified, write it as:
|
|
161
|
+
|
|
162
|
+
- `TBD` + what evidence is missing, or
|
|
163
|
+
- an Open Question (if it blocks correctness)
|
|
164
|
+
|
|
165
|
+
### Steering refresh checklist
|
|
166
|
+
|
|
167
|
+
- [ ] product.md: what we build / users / success / non-goals / release posture
|
|
168
|
+
- [ ] tech.md: Node / package manager / TS / test / lint / CI constraints
|
|
169
|
+
- [ ] structure.md: repo layout, key packages, entrypoints, standard gate commands, how to run locally
|
|
170
|
+
|
|
171
|
+
## Step 1 — Read relevant artifacts
|
|
172
|
+
|
|
173
|
+
- `.qfai/specs/spec-XXXX/spec.md`
|
|
174
|
+
- `.qfai/specs/spec-XXXX/scenario.feature`
|
|
175
|
+
- referenced contracts (if used by logic)
|
|
176
|
+
|
|
177
|
+
## Step 2 — Identify units and boundaries (Test Engineer + Architect mindset)
|
|
178
|
+
|
|
179
|
+
- What are the smallest meaningful units?
|
|
180
|
+
- What should be mocked vs real?
|
|
181
|
+
- Where are seams (interfaces) needed to test cleanly?
|
|
182
|
+
|
|
183
|
+
## Step 3 — Write tests first (RED)
|
|
184
|
+
|
|
185
|
+
- Add tests that should fail on current code.
|
|
186
|
+
- Keep them minimal and focused.
|
|
187
|
+
|
|
188
|
+
## Step 4 — Review test quality
|
|
189
|
+
|
|
190
|
+
- QA Engineer: edge cases, unwanted behavior, observability
|
|
191
|
+
- Code Reviewer: brittleness, over-mocking, unclear naming
|
|
192
|
+
|
|
193
|
+
## Step 5 — Provide run commands + evidence
|
|
194
|
+
|
|
195
|
+
- Document the exact command(s) to run unit tests.
|
|
196
|
+
- Provide summary of pass/fail.
|
|
197
|
+
|
|
198
|
+
## Output
|
|
199
|
+
|
|
200
|
+
- Unit test files
|
|
201
|
+
- Run command snippet
|
|
202
|
+
- Evidence summary
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
QFAI Prompt Body (SSOT)
|
|
3
|
+
- This file is intended to be referenced by tool-specific custom prompt definitions (e.g., Copilot .prompt.md, Claude Code slash commands).
|
|
4
|
+
- Keep tool-specific wrappers thin: "Read this file and follow it."
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
id: qfai-verify
|
|
10
|
+
title: QFAI Verify (Quality Gates + Evidence)
|
|
11
|
+
description: "Run and document quality gates (repo + qfai validate/report), fix until PASS."
|
|
12
|
+
argument-hint: "[--auto]"
|
|
13
|
+
allowed-tools: [Read, Glob, Bash, Write, TodoWrite, Task]
|
|
14
|
+
roles: [DevOpsCIEngineer, QAEngineer, CodeReviewer, Planner]
|
|
15
|
+
mode: evidence-focused
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# /qfai-verify — Quality Gates and Evidence
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
Run quality gates and produce **evidence** that the change is correct and safe.
|
|
24
|
+
|
|
25
|
+
## Success Criteria (Definition of Done)
|
|
26
|
+
|
|
27
|
+
- Repo quality gates PASS (format/lint/type/test/build/etc).
|
|
28
|
+
- QFAI checks PASS (at minimum: `qfai validate`, and optionally `qfai report`).
|
|
29
|
+
- A concise evidence summary exists (copy‑paste for PR).
|
|
30
|
+
|
|
31
|
+
## Non‑Negotiable Principles (QFAI Articles)
|
|
32
|
+
|
|
33
|
+
These principles are inspired by “constitution / articles” patterns used by other agent frameworks, but tailored to QFAI.
|
|
34
|
+
|
|
35
|
+
1. **SDD First (Specification is the source of truth)**
|
|
36
|
+
If there is a conflict between code and spec, treat the spec as authoritative and either (a) fix code or (b) raise an explicit Open Question to change the spec.
|
|
37
|
+
|
|
38
|
+
2. **Traceability is mandatory**
|
|
39
|
+
Every meaningful change must be traceable: **Require → Spec → Scenario → Tests → Code → Verification evidence**.
|
|
40
|
+
|
|
41
|
+
3. **Evidence over confidence**
|
|
42
|
+
Prefer observable proof (logs, commands, file diffs, test results). If you cannot verify, say so and record it.
|
|
43
|
+
|
|
44
|
+
4. **Minimize scope, but never hide gaps**
|
|
45
|
+
Keep changes minimal, but do not “paper over” missing decisions. If something blocks correctness, stop and ask.
|
|
46
|
+
|
|
47
|
+
5. **Quality gates are the decision mechanism**
|
|
48
|
+
Use tests/lint/typecheck/build/pack verification (whatever the repo defines) as the primary guardrail. Fix until PASS.
|
|
49
|
+
|
|
50
|
+
6. **Make it runnable**
|
|
51
|
+
Outputs must be executable in terminal/CI. Provide copy‑paste commands.
|
|
52
|
+
|
|
53
|
+
7. **User time is expensive**
|
|
54
|
+
Ask only the questions that are truly blocking. Everything else: make reasonable assumptions and label them clearly.
|
|
55
|
+
|
|
56
|
+
## Absolute Rule — Output Language
|
|
57
|
+
|
|
58
|
+
**All outputs MUST be written in the user’s working language for this session.**
|
|
59
|
+
|
|
60
|
+
- If the user writes in Japanese, output Japanese.
|
|
61
|
+
- If the user writes in English, output English.
|
|
62
|
+
- If the user mixes languages, prefer the dominant language unless explicitly instructed otherwise.
|
|
63
|
+
This rule overrides all other stylistic preferences.
|
|
64
|
+
|
|
65
|
+
## Multi‑Role Orchestration (Subagents)
|
|
66
|
+
|
|
67
|
+
This workflow assumes the environment _may_ support subagents (e.g., Claude Code “Task” tool) or may not.
|
|
68
|
+
|
|
69
|
+
### If subagents are supported
|
|
70
|
+
|
|
71
|
+
Delegate to multiple roles and then merge the results. Use a “real‑world workflow” order:
|
|
72
|
+
|
|
73
|
+
- Facilitator → Interviewer → Requirements Analyst → Planner → Architect → (Contract Designer) → Test Engineer → QA Engineer → Code Reviewer → DevOps/CI Engineer
|
|
74
|
+
|
|
75
|
+
**Pseudo‑invocation pattern** (adjust to your tool):
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Task(
|
|
79
|
+
subagent_type="planner",
|
|
80
|
+
description="Create an execution plan and DoD",
|
|
81
|
+
prompt="Context: ...\nGoal: ...\nConstraints: ...\nReturn: phases + risks + DoD"
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### If subagents are NOT supported
|
|
86
|
+
|
|
87
|
+
Simulate roles by running the same sequence yourself:
|
|
88
|
+
|
|
89
|
+
- Write a short “role output” section per role, then consolidate into the final deliverable(s).
|
|
90
|
+
|
|
91
|
+
## Behavior Rules (high leverage)
|
|
92
|
+
|
|
93
|
+
- **Language**: Output MUST follow the user’s working language for this session.
|
|
94
|
+
- **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
|
|
95
|
+
- **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
|
|
96
|
+
- **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
|
|
97
|
+
- **Subagent contract**: When delegating, require the subagent response structure:
|
|
98
|
+
1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
|
|
99
|
+
|
|
100
|
+
## Step 0 — Load Context (always)
|
|
101
|
+
|
|
102
|
+
1. Read relevant **project steering** (if present):
|
|
103
|
+
- `.qfai/assistant/steering/structure.md`
|
|
104
|
+
- `.qfai/assistant/steering/tech.md`
|
|
105
|
+
- `.qfai/assistant/steering/product.md`
|
|
106
|
+
- any additional files under `.qfai/assistant/steering/`
|
|
107
|
+
|
|
108
|
+
2. Read **project constitution / instructions** (if present):
|
|
109
|
+
- `.qfai/assistant/instructions/constitution.md`
|
|
110
|
+
- `.qfai/assistant/instructions/workflow.md` (or equivalent)
|
|
111
|
+
|
|
112
|
+
3. Read existing artifacts for the current work item (if present):
|
|
113
|
+
- `.qfai/require/`
|
|
114
|
+
- `.qfai/specs/spec-*/`
|
|
115
|
+
- `.qfai/contracts/`
|
|
116
|
+
|
|
117
|
+
4. Inspect repo conventions:
|
|
118
|
+
- package manager (pnpm/npm/yarn), test runner, lint/typecheck scripts, CI definitions
|
|
119
|
+
- existing test patterns (unit/integration/e2e)
|
|
120
|
+
|
|
121
|
+
## Step 0 — Project Analysis (mandatory)
|
|
122
|
+
|
|
123
|
+
Before producing any deliverable, **thoroughly analyze the current project** so your outputs fit the repo’s:
|
|
124
|
+
|
|
125
|
+
- background and goals
|
|
126
|
+
- directory structure and conventions
|
|
127
|
+
- chosen technologies and versions (runtime, package manager, test runner)
|
|
128
|
+
- architecture boundaries (packages, CLI, core modules)
|
|
129
|
+
- existing patterns for tests, docs, and CI
|
|
130
|
+
|
|
131
|
+
### Minimum analysis checklist
|
|
132
|
+
|
|
133
|
+
- [ ] Read key repo docs: README / CHANGELOG / RELEASE (if present)
|
|
134
|
+
- [ ] Inspect `.qfai/` layout and existing SDD/ATDD/TDD artifacts (if present)
|
|
135
|
+
- [ ] Inspect `packages/qfai` structure (CLI entrypoints, core modules, validators, assets/init)
|
|
136
|
+
- [ ] Identify standard gate commands (format/lint/type/test/verify-pack) and where they are defined
|
|
137
|
+
- [ ] Search for existing examples/patterns of similar changes in tests (if available)
|
|
138
|
+
- [ ] Note constraints: Node versions, CI matrix, packaging rules, verify-pack expectations
|
|
139
|
+
|
|
140
|
+
If analysis cannot be performed (missing access), clearly state what could not be verified and proceed with minimal-risk assumptions.
|
|
141
|
+
|
|
142
|
+
## Step 0.5 — Steering Bootstrap / Refresh (mandatory when incomplete)
|
|
143
|
+
|
|
144
|
+
QFAI expects `assistant/steering/` to contain **project‑specific facts** so all subsequent design/test/implementation fits this repository.
|
|
145
|
+
|
|
146
|
+
### What to do
|
|
147
|
+
|
|
148
|
+
1. Open these files:
|
|
149
|
+
|
|
150
|
+
- `.qfai/assistant/steering/product.md`
|
|
151
|
+
- `.qfai/assistant/steering/tech.md`
|
|
152
|
+
- `.qfai/assistant/steering/structure.md`
|
|
153
|
+
|
|
154
|
+
2. If they are missing, mostly empty, or still have placeholders (e.g., `- ` only), **populate them by analyzing the current repository**:
|
|
155
|
+
|
|
156
|
+
- derive “what/why/users/success/non-goals” from README/docs/issues (product.md)
|
|
157
|
+
- derive runtime/tooling versions + constraints from package.json, CI config, lockfiles (tech.md)
|
|
158
|
+
- derive repo layout + key directories + gate commands from the file tree and scripts (structure.md)
|
|
159
|
+
|
|
160
|
+
3. Do **not** invent facts. If something cannot be verified, write it as:
|
|
161
|
+
|
|
162
|
+
- `TBD` + what evidence is missing, or
|
|
163
|
+
- an Open Question (if it blocks correctness)
|
|
164
|
+
|
|
165
|
+
### Steering refresh checklist
|
|
166
|
+
|
|
167
|
+
- [ ] product.md: what we build / users / success / non-goals / release posture
|
|
168
|
+
- [ ] tech.md: Node / package manager / TS / test / lint / CI constraints
|
|
169
|
+
- [ ] structure.md: repo layout, key packages, entrypoints, standard gate commands, how to run locally
|
|
170
|
+
|
|
171
|
+
## Step 1 — Discover project gate commands (DevOps/CI Engineer)
|
|
172
|
+
|
|
173
|
+
Prefer existing scripts:
|
|
174
|
+
|
|
175
|
+
- package.json scripts
|
|
176
|
+
- Makefile / task runner
|
|
177
|
+
- CI config
|
|
178
|
+
|
|
179
|
+
If unknown, propose defaults and mark assumptions.
|
|
180
|
+
|
|
181
|
+
## Step 2 — Run QFAI gates
|
|
182
|
+
|
|
183
|
+
Run (adjust as needed):
|
|
184
|
+
|
|
185
|
+
- `qfai validate --fail-on error`
|
|
186
|
+
- `qfai report` (if used in this repo)
|
|
187
|
+
|
|
188
|
+
Capture:
|
|
189
|
+
|
|
190
|
+
- exit codes
|
|
191
|
+
- key errors/warnings
|
|
192
|
+
- file paths affected
|
|
193
|
+
|
|
194
|
+
## Step 3 — Run repo gates
|
|
195
|
+
|
|
196
|
+
Run the repo’s standard pipeline in a stable order:
|
|
197
|
+
|
|
198
|
+
1. format
|
|
199
|
+
2. lint
|
|
200
|
+
3. typecheck
|
|
201
|
+
4. unit tests
|
|
202
|
+
5. scenario/e2e tests
|
|
203
|
+
6. build/package (if relevant)
|
|
204
|
+
|
|
205
|
+
## Step 4 — Fix loop (Code Reviewer + QA)
|
|
206
|
+
|
|
207
|
+
If anything fails:
|
|
208
|
+
|
|
209
|
+
- Identify whether it’s spec mismatch, test issue, or implementation defect.
|
|
210
|
+
- Fix the root cause (do not silence tests without reason).
|
|
211
|
+
|
|
212
|
+
## Step 5 — Produce Evidence Summary (Planner)
|
|
213
|
+
|
|
214
|
+
Output this format:
|
|
215
|
+
|
|
216
|
+
### Verification Evidence
|
|
217
|
+
|
|
218
|
+
- QFAI:
|
|
219
|
+
- command:
|
|
220
|
+
- result:
|
|
221
|
+
- Repo gates:
|
|
222
|
+
- command:
|
|
223
|
+
- result:
|
|
224
|
+
- Notes:
|
|
225
|
+
- assumptions:
|
|
226
|
+
- risks:
|
|
227
|
+
|
|
228
|
+
## Output
|
|
229
|
+
|
|
230
|
+
- Evidence summary
|
|
231
|
+
- Next action suggestion: /qfai-pr (optional) or proceed to PR creation
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# steering/
|
|
2
|
+
|
|
3
|
+
Project context for the AI. Keep these files up to date.
|
|
4
|
+
|
|
5
|
+
These are intentionally short and practical:
|
|
6
|
+
|
|
7
|
+
- `product.md` : what we are building and why
|
|
8
|
+
- `tech.md` : stack, versions, constraints
|
|
9
|
+
- `structure.md` : repo structure, key directories, how to run gates
|
|
10
|
+
|
|
11
|
+
QFAI prompts are expected to read these before producing deliverables.
|
|
12
|
+
|
|
13
|
+
## AI-managed policy (recommended)
|
|
14
|
+
|
|
15
|
+
These steering files are intended to be **filled and refreshed by the AI** (via QFAI custom prompts).
|
|
16
|
+
Humans may edit them, but the default workflow is:
|
|
17
|
+
|
|
18
|
+
- run a QFAI command (e.g., /qfai-require, /qfai-spec, /qfai-implement)
|
|
19
|
+
- the agent analyzes the repository and updates steering if placeholders exist
|
|
20
|
+
|
|
21
|
+
Guideline:
|
|
22
|
+
|
|
23
|
+
- do not invent facts; if unknown, write `TBD` with missing evidence
|
|
24
|
+
|
|
25
|
+
## Evidence-first writing (recommended)
|
|
26
|
+
|
|
27
|
+
Steering MUST be grounded in repo evidence. When possible, include:
|
|
28
|
+
|
|
29
|
+
- file paths (e.g., `package.json`, `.github/workflows/ci.yml`)
|
|
30
|
+
- commands (e.g., `pnpm -C packages/qfai test`)
|
|
31
|
+
- directory anchors (e.g., `packages/qfai/src/cli`)
|
|
32
|
+
|
|
33
|
+
If a fact cannot be verified, mark it as `TBD` and record what evidence is missing.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Product Steering
|
|
2
|
+
|
|
3
|
+
## What are we building?
|
|
4
|
+
|
|
5
|
+
- Summary:
|
|
6
|
+
- Evidence: (e.g., README, docs, issue links)
|
|
7
|
+
|
|
8
|
+
## Who is the user?
|
|
9
|
+
|
|
10
|
+
- Personas / roles:
|
|
11
|
+
- Evidence:
|
|
12
|
+
|
|
13
|
+
## What is “success”?
|
|
14
|
+
|
|
15
|
+
- Success metrics / acceptance definition:
|
|
16
|
+
- Evidence:
|
|
17
|
+
|
|
18
|
+
## Non-goals
|
|
19
|
+
|
|
20
|
+
-
|
|
21
|
+
- Evidence:
|
|
22
|
+
|
|
23
|
+
## Release posture
|
|
24
|
+
|
|
25
|
+
- Compatibility policy:
|
|
26
|
+
- Breaking change policy:
|
|
27
|
+
- Evidence:
|
|
28
|
+
|
|
29
|
+
## Open questions
|
|
30
|
+
|
|
31
|
+
- Blocking:
|
|
32
|
+
- Non-blocking:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Structure Steering
|
|
2
|
+
|
|
3
|
+
## Repo layout (high level)
|
|
4
|
+
|
|
5
|
+
- Top-level directories:
|
|
6
|
+
- Evidence:
|
|
7
|
+
|
|
8
|
+
## Key packages / entrypoints
|
|
9
|
+
|
|
10
|
+
- Package(s) of interest:
|
|
11
|
+
- CLI entry:
|
|
12
|
+
- Core modules:
|
|
13
|
+
- Evidence:
|
|
14
|
+
|
|
15
|
+
## Architecture constraints
|
|
16
|
+
|
|
17
|
+
- Boundaries (what must not depend on what):
|
|
18
|
+
- Conventions (naming, file layout):
|
|
19
|
+
- Evidence:
|
|
20
|
+
|
|
21
|
+
## Quality gates (SSOT)
|
|
22
|
+
|
|
23
|
+
- format:
|
|
24
|
+
- lint:
|
|
25
|
+
- typecheck:
|
|
26
|
+
- test:
|
|
27
|
+
- verify-pack / pack:
|
|
28
|
+
- Evidence:
|
|
29
|
+
|
|
30
|
+
## How to run locally
|
|
31
|
+
|
|
32
|
+
Provide copy-paste commands and expected outputs.
|
|
33
|
+
|
|
34
|
+
- Evidence:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Tech Steering
|
|
2
|
+
|
|
3
|
+
## Runtime / platform
|
|
4
|
+
|
|
5
|
+
- Node:
|
|
6
|
+
- Evidence:
|
|
7
|
+
- OS assumptions:
|
|
8
|
+
- Evidence:
|
|
9
|
+
- CI environment:
|
|
10
|
+
- Evidence:
|
|
11
|
+
|
|
12
|
+
## Package manager
|
|
13
|
+
|
|
14
|
+
- pnpm / npm / yarn:
|
|
15
|
+
- Evidence:
|
|
16
|
+
|
|
17
|
+
## Language / framework
|
|
18
|
+
|
|
19
|
+
- TypeScript:
|
|
20
|
+
- Build tool:
|
|
21
|
+
- Test runner:
|
|
22
|
+
- Lint / format:
|
|
23
|
+
- Evidence:
|
|
24
|
+
|
|
25
|
+
## Constraints
|
|
26
|
+
|
|
27
|
+
-
|
|
28
|
+
- Evidence:
|
|
29
|
+
|
|
30
|
+
## Standard commands (copy-paste)
|
|
31
|
+
|
|
32
|
+
- Install:
|
|
33
|
+
- Test:
|
|
34
|
+
- Lint:
|
|
35
|
+
- Typecheck:
|
|
36
|
+
- Pack/verify:
|
|
37
|
+
- Evidence:
|
|
@@ -1,91 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# contracts/
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Contracts define stable interfaces and are referenced by specs/scenarios/tests.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Subfolders:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- DB: `db/db-0001-<slug>.sql`(ID は `DB-xxxx`)
|
|
11
|
-
- assets: `ui/assets/<contract-id>/assets.yaml`(参照整合のみ検証)
|
|
7
|
+
- `ui/` : UI contracts (YAML)
|
|
8
|
+
- `api/`: API contracts (YAML)
|
|
9
|
+
- `db/` : DB contracts (YAML)
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- 1ファイル = 1ID
|
|
16
|
-
- 契約IDの正は契約ファイル側(`QFAI-CONTRACT-ID` が SSOT)
|
|
17
|
-
- ファイル内に `QFAI-CONTRACT-ID: <ID>` をコメント行で宣言する
|
|
18
|
-
- 例: `# QFAI-CONTRACT-ID: API-0001` / `// QFAI-CONTRACT-ID: UI-0001` / `-- QFAI-CONTRACT-ID: DB-0001`
|
|
19
|
-
|
|
20
|
-
## 最小例(UI)
|
|
21
|
-
|
|
22
|
-
```yaml
|
|
23
|
-
# QFAI-CONTRACT-ID: UI-0001
|
|
24
|
-
id: UI-0001
|
|
25
|
-
name: 受注登録画面
|
|
26
|
-
refs:
|
|
27
|
-
- BR-0001
|
|
28
|
-
themaRef: THEMA-001
|
|
29
|
-
assets:
|
|
30
|
-
pack: assets/ui-0001-sample
|
|
31
|
-
use:
|
|
32
|
-
- UI-0001.desktop.light.default
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## 最小例(THEMA)
|
|
36
|
-
|
|
37
|
-
```yaml
|
|
38
|
-
# QFAI-CONTRACT-ID: THEMA-001
|
|
39
|
-
id: THEMA-001
|
|
40
|
-
name: facebook-like
|
|
41
|
-
tokens:
|
|
42
|
-
color:
|
|
43
|
-
background: "#FFFFFF"
|
|
44
|
-
textPrimary: "#111111"
|
|
45
|
-
accent: "#1877F2"
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## 最小例(API)
|
|
49
|
-
|
|
50
|
-
```yaml
|
|
51
|
-
# QFAI-CONTRACT-ID: API-0001
|
|
52
|
-
openapi: 3.0.0
|
|
53
|
-
info:
|
|
54
|
-
title: Sample API
|
|
55
|
-
version: 0.1.0
|
|
56
|
-
paths:
|
|
57
|
-
/health:
|
|
58
|
-
get:
|
|
59
|
-
operationId: API-0001
|
|
60
|
-
responses:
|
|
61
|
-
"200":
|
|
62
|
-
description: OK
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## 最小例(DB)
|
|
66
|
-
|
|
67
|
-
```sql
|
|
68
|
-
-- QFAI-CONTRACT-ID: DB-0001
|
|
69
|
-
CREATE TABLE sample_table (
|
|
70
|
-
id INTEGER PRIMARY KEY
|
|
71
|
-
);
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## CI でチェックされること(抜粋)
|
|
75
|
-
|
|
76
|
-
- 契約宣言: `QFAI-CONTRACT-ID` の未記載/複数宣言/重複IDは error
|
|
77
|
-
- 契約ID: 配置ディレクトリ(ui/api/db)と prefix(UI/API/DB)の不整合は error
|
|
78
|
-
- UI/API: パース失敗は error
|
|
79
|
-
- API: OpenAPI 定義があること(`openapi`)
|
|
80
|
-
- DB: 危険 SQL(DROP/TRUNCATE 等)の警告
|
|
81
|
-
- 共通: ID 形式(`PREFIX-0001`)、ID の重複検知
|
|
82
|
-
|
|
83
|
-
## 依存関係
|
|
84
|
-
|
|
85
|
-
- Spec → Contracts(spec.md に `QFAI-CONTRACT-REF` を必ず1行以上宣言、0件は `none`。この行が SSOT)
|
|
86
|
-
- Scenario → Contracts(scenario.feature に `# QFAI-CONTRACT-REF` を必ず1行以上宣言、0件は `none`)
|
|
87
|
-
|
|
88
|
-
## 良い例 / 悪い例
|
|
89
|
-
|
|
90
|
-
- 良い例: Spec で契約を参照し、必要に応じて Scenario でも参照している
|
|
91
|
-
- 悪い例: Spec が契約を参照しておらず orphan contract が発生する(allowOrphanContracts=false で error)
|
|
11
|
+
Create contracts only when needed by the spec (keep minimal).
|