qfai 1.0.5 → 1.0.6

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.
Files changed (27) hide show
  1. package/README.md +5 -2
  2. package/assets/init/.qfai/README.md +4 -3
  3. package/assets/init/.qfai/assistant/agents/README.md +2 -0
  4. package/assets/init/.qfai/assistant/agents/contract-designer.md +1 -1
  5. package/assets/init/.qfai/assistant/instructions/README.md +5 -1
  6. package/assets/init/.qfai/assistant/instructions/agent-selection.md +28 -0
  7. package/assets/init/.qfai/assistant/instructions/communication.md +27 -0
  8. package/assets/init/.qfai/assistant/instructions/quality.md +27 -0
  9. package/assets/init/.qfai/assistant/instructions/thinking.md +29 -0
  10. package/assets/init/.qfai/assistant/prompts/qfai-implement.md +0 -9
  11. package/assets/init/.qfai/assistant/prompts/qfai-pr.md +0 -9
  12. package/assets/init/.qfai/assistant/prompts/qfai-require.md +0 -9
  13. package/assets/init/.qfai/assistant/prompts/qfai-scenario-test.md +0 -9
  14. package/assets/init/.qfai/assistant/prompts/qfai-spec.md +14 -10
  15. package/assets/init/.qfai/assistant/prompts/qfai-unit-test.md +0 -9
  16. package/assets/init/.qfai/assistant/prompts/qfai-verify.md +0 -9
  17. package/assets/init/.qfai/assistant/prompts.local/README.md +2 -0
  18. package/assets/init/.qfai/assistant/steering/README.md +7 -0
  19. package/assets/init/.qfai/contracts/README.md +1 -1
  20. package/assets/init/.qfai/contracts/db/README.md +21 -4
  21. package/assets/init/.qfai/specs/README.md +2 -0
  22. package/dist/cli/index.cjs +2 -2
  23. package/dist/cli/index.mjs +2 -2
  24. package/dist/index.cjs +2 -2
  25. package/dist/index.mjs +2 -2
  26. package/package.json +1 -1
  27. package/assets/init/root/tests/qfai-traceability.sample.test.ts +0 -2
package/README.md CHANGED
@@ -132,6 +132,7 @@ Spec では `QFAI-CONTRACT-REF:` 行で参照する契約IDを宣言します(
132
132
  Scenario では `# QFAI-CONTRACT-REF:` のコメント行で契約参照を宣言します(`none` 可)。
133
133
  契約ファイルは `QFAI-CONTRACT-ID: <ID>` を **1ファイル1ID** で宣言します。
134
134
  契約IDは UI/API/DB/THEMA(THEMA は 3 桁)です。UI 契約は `themaRef` / `themeOverrides` / `assets` を追加できます。
135
+ UI/API は YAML、DB は SQL(`.sql`)を正式フォーマットとして扱います。
135
136
  `assets.pack` は `ui/` 配下の相対パス、`assets.use` は `assets.yaml` の `items[].id` を参照します。
136
137
  `validate.json` / `report` の file path は root 相対で出力します(absolute は出力しません)。
137
138
 
@@ -240,6 +241,10 @@ qfai.config.yaml
240
241
  README.md
241
242
  constitution.md
242
243
  workflow.md
244
+ thinking.md
245
+ communication.md
246
+ quality.md
247
+ agent-selection.md
243
248
  steering/
244
249
  README.md
245
250
  product.md
@@ -271,8 +276,6 @@ qfai.config.yaml
271
276
  backend-engineer.md
272
277
  devops-ci-engineer.md
273
278
  code-reviewer.md
274
- tests/
275
- qfai-traceability.sample.test.ts
276
279
  .github/
277
280
  workflows/
278
281
  qfai.yml
@@ -1,12 +1,13 @@
1
1
  # .qfai (QFAI Workspace)
2
2
 
3
- Generated by: `qfai init`
4
- Version: v1.0.5 (proposed init structure)
5
- Updated: 2026-01-12
3
+ Generated by: `qfai init`
4
+ Template version: 1.0.6
6
5
 
7
6
  This directory is the workspace for **QFAI (Quality‑First AI)**.
8
7
  QFAI standardizes engineering work around a fixed workflow:
9
8
 
9
+ Note: You may edit files under `.qfai/` to fit your project. QFAI prompts treat this workspace as project-local SSOT for guidance and artifacts.
10
+
10
11
  **SDD → ATDD → TDD → Implementation → Verification**
11
12
 
12
13
  ## Directory Overview
@@ -32,3 +32,5 @@ Each role card includes YAML frontmatter:
32
32
  ## Response contract
33
33
 
34
34
  All subagents must use the "Findings / Recommendations / Proposed edits / Open Questions / Confidence" structure.
35
+
36
+ Note: These are **role cards** (definitions). Actual delegation/execution depends on your AI product (Copilot, Claude Code, etc.). If subagents are not supported, the orchestrator prompt must emulate role-by-role reasoning in a single run.
@@ -57,7 +57,7 @@ You are the **Contract Designer** in a QFAI-driven workflow.
57
57
 
58
58
  ## Expected Outputs
59
59
 
60
- - Contract file list + minimal YAML drafts.
60
+ - Contract file list + drafts (**UI/API: YAML**, **DB: SQL**).
61
61
  - Rationale for each field.
62
62
  - Example payloads where helpful.
63
63
 
@@ -1,6 +1,10 @@
1
1
  # instructions/
2
2
 
3
- High-level governance for AI behavior.
3
+ High-level governance for AI behavior in QFAI.
4
4
 
5
5
  - `constitution.md` : non-negotiable rules (quality, traceability, evidence)
6
6
  - `workflow.md` : the default QFAI workflow (SDD→ATDD→TDD→Implement→Verify)
7
+ - `thinking.md` : ambiguity elimination + evidence-first reasoning
8
+ - `communication.md` : reporting style + status format
9
+ - `quality.md` : quality gates + testing expectations
10
+ - `agent-selection.md` : how to delegate to roles (or emulate if unsupported)
@@ -0,0 +1,28 @@
1
+ ---
2
+ id: agent-selection
3
+ category: project
4
+ update_frequency: occasional
5
+ ---
6
+
7
+ # Agent Selection (Delegation playbook)
8
+
9
+ ## Goal
10
+
11
+ Delegate work to specialized roles to reduce blind spots and improve quality.
12
+
13
+ ## Default delegation map
14
+
15
+ - **Requirements Analyst**: clarify intent, scope, acceptance criteria, open questions
16
+ - **Planner**: plan phases, risks, gating, rollback strategy
17
+ - **Architect**: design, boundaries, compatibility considerations
18
+ - **Contract Designer**: contracts (UI/API: YAML, DB: SQL), IDs, indexing implications
19
+ - **QA Engineer**: risk-based checks, regression scope, quality gate review
20
+ - **Test Engineer**: scenario.feature and test scaffolding strategy
21
+ - **Front-end / Back-end Engineer**: implementation within repo conventions
22
+ - **DevOps/CI Engineer**: verify-pack/CI impacts
23
+ - **Code Reviewer**: style, maintainability, correctness
24
+
25
+ ## If subagents are not supported
26
+
27
+ Emulate the delegation by doing role-by-role analysis in order:
28
+ Requirements → Plan → Design → Contracts → Tests → Implementation → Review → QA.
@@ -0,0 +1,27 @@
1
+ ---
2
+ id: communication
3
+ category: universal
4
+ update_frequency: occasional
5
+ ---
6
+
7
+ # Communication (Output and reporting contract)
8
+
9
+ ## Absolute rule — Output language
10
+
11
+ All user-facing output must be in **the user's language**.
12
+ If multiple languages appear, choose the user's dominant language.
13
+
14
+ ## Reporting format (default)
15
+
16
+ Use concise, structured bullet points:
17
+
18
+ - **Summary**: what changed / decided
19
+ - **Evidence**: key file paths / commands / logs referenced
20
+ - **Impact**: user-visible changes, risks
21
+ - **Verification**: what you ran and expected result
22
+ - **Open Questions**: unresolved items (if any)
23
+
24
+ ## Error handling
25
+
26
+ - Do not hide errors. Explain impact, scope, and recovery steps.
27
+ - Avoid dumping excessive logs; show the minimum relevant excerpt.
@@ -0,0 +1,27 @@
1
+ ---
2
+ id: quality
3
+ category: universal
4
+ update_frequency: occasional
5
+ ---
6
+
7
+ # Quality (Gates, tests, and safety)
8
+
9
+ ## Quality gates (baseline)
10
+
11
+ When code changes are requested, the expected minimum gates are:
12
+
13
+ - `pnpm format:check`
14
+ - `pnpm lint`
15
+ - `pnpm check-types`
16
+ - `pnpm test`
17
+ - `pnpm verify:pack` (when publishing/distribution matters)
18
+
19
+ ## Do not weaken safety nets
20
+
21
+ - Do not suppress or disable checks via inline ignores unless explicitly approved.
22
+ - If a rule must be changed, justify with evidence and update tests/docs accordingly.
23
+
24
+ ## Testing expectations
25
+
26
+ - Prefer adding/adjusting tests over weakening validation.
27
+ - Keep outputs deterministic (avoid time/randomness).
@@ -0,0 +1,29 @@
1
+ ---
2
+ id: thinking
3
+ category: universal
4
+ update_frequency: rare
5
+ ---
6
+
7
+ # Thinking (Evidence-first, ambiguity elimination)
8
+
9
+ ## Principles
10
+
11
+ - Prefer **repo evidence** over assumptions (file paths, configs, tests, commands).
12
+ - If something cannot be verified, write `TBD` and raise an Open Question (what evidence is missing).
13
+ - Minimize ambiguity: define terms, scope, and measurable acceptance criteria.
14
+
15
+ ## Working method
16
+
17
+ 1. Restate the goal and constraints (brief).
18
+ 2. Enumerate unknowns and assumptions.
19
+ 3. Identify the evidence to check (files/commands).
20
+ 4. Decide with a rationale grounded in evidence.
21
+ 5. Record residual risk and the rollback path.
22
+
23
+ ## When to stop and ask
24
+
25
+ Stop and ask the user if:
26
+
27
+ - required inputs are missing (e.g., target behavior, API shape, UX intent),
28
+ - multiple interpretations are plausible and impact is material,
29
+ - a change could be breaking and intent is unclear.
@@ -89,15 +89,6 @@ Simulate roles by running the same sequence yourself:
89
89
 
90
90
  - Write a short “role output” section per role, then consolidate into the final deliverable(s).
91
91
 
92
- ## Behavior Rules (high leverage)
93
-
94
- - **Language**: Output MUST follow the user’s working language for this session.
95
- - **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
96
- - **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
97
- - **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
98
- - **Subagent contract**: When delegating, require the subagent response structure:
99
- 1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
100
-
101
92
  ## Step 0 — Load Context (always)
102
93
 
103
94
  1. Read relevant **project steering** (if present):
@@ -92,15 +92,6 @@ Simulate roles by running the same sequence yourself:
92
92
 
93
93
  - Write a short “role output” section per role, then consolidate into the final deliverable(s).
94
94
 
95
- ## Behavior Rules (high leverage)
96
-
97
- - **Language**: Output MUST follow the user’s working language for this session.
98
- - **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
99
- - **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
100
- - **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
101
- - **Subagent contract**: When delegating, require the subagent response structure:
102
- 1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
103
-
104
95
  ## Step 0 — Load Context (always)
105
96
 
106
97
  1. Read relevant **project steering** (if present):
@@ -88,15 +88,6 @@ Simulate roles by running the same sequence yourself:
88
88
 
89
89
  - Write a short “role output” section per role, then consolidate into the final deliverable(s).
90
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
91
  ## Step 0 — Load Context (always)
101
92
 
102
93
  1. Read relevant **project steering** (if present):
@@ -88,15 +88,6 @@ Simulate roles by running the same sequence yourself:
88
88
 
89
89
  - Write a short “role output” section per role, then consolidate into the final deliverable(s).
90
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
91
  ## Step 0 — Load Context (always)
101
92
 
102
93
  1. Read relevant **project steering** (if present):
@@ -91,15 +91,6 @@ Simulate roles by running the same sequence yourself:
91
91
 
92
92
  - Write a short “role output” section per role, then consolidate into the final deliverable(s).
93
93
 
94
- ## Behavior Rules (high leverage)
95
-
96
- - **Language**: Output MUST follow the user’s working language for this session.
97
- - **Question budget**: Ask at most **5** clarifying questions total. Prioritize blockers. If `--auto`, proceed with explicit assumptions.
98
- - **No hallucination**: Do not invent file paths, commands, or policies. Confirm via repo inspection.
99
- - **Evidence**: Do not claim completion without commands/results (format/lint/type/test/pack as applicable).
100
- - **Subagent contract**: When delegating, require the subagent response structure:
101
- 1. Findings 2) Recommendations 3) Proposed edits 4) Open Questions/Risks 5) Confidence
102
-
103
94
  ## Step 0 — Load Context (always)
104
95
 
105
96
  1. Read relevant **project steering** (if present):
@@ -262,7 +253,20 @@ Only create contracts when the spec requires a stable interface definition.
262
253
 
263
254
  If your repo defines contract schema or naming rules, follow them. Otherwise:
264
255
 
265
- - Use a clear filename and include “Purpose / Fields / Constraints / Examples” inside the YAML as comments.
256
+ - **UI / API contracts:** write **YAML** and include “Purpose / Fields / Constraints / Examples” as YAML comments.
257
+ - **DB contracts:** write **SQL (`.sql`)** and include a small header comment block, then representative DDL/schema notes.
258
+
259
+ DB contract default conventions (unless your repo defines others):
260
+
261
+ - Filename: `db-0001-<slug>.sql`
262
+ - Header (must):
263
+ ```sql
264
+ -- QFAI-CONTRACT-ID: DB-0001
265
+ -- Purpose: <what this schema contract guarantees>
266
+ -- Constraints: <keys, nullability, ranges, invariants>
267
+ -- Examples: <optional example rows or queries>
268
+ ```
269
+ - Body: DDL or schema notes that tests/scenarios can validate (minimal, spec-driven).
266
270
 
267
271
  ## Step 4 — QA + Review
268
272
 
@@ -88,15 +88,6 @@ Simulate roles by running the same sequence yourself:
88
88
 
89
89
  - Write a short “role output” section per role, then consolidate into the final deliverable(s).
90
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
91
  ## Step 0 — Load Context (always)
101
92
 
102
93
  1. Read relevant **project steering** (if present):
@@ -88,15 +88,6 @@ Simulate roles by running the same sequence yourself:
88
88
 
89
89
  - Write a short “role output” section per role, then consolidate into the final deliverable(s).
90
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
91
  ## Step 0 — Load Context (always)
101
92
 
102
93
  1. Read relevant **project steering** (if present):
@@ -4,3 +4,5 @@ Optional per-project overrides.
4
4
 
5
5
  If a file with the same name exists here (e.g., `qfai-spec.md`), a tool wrapper may prefer it to customize behavior for this repo.
6
6
  Keep overrides minimal; prefer updating steering/instructions instead.
7
+
8
+ Note: After `qfai init`, this folder contains only this README. Place an override file here only when you intentionally diverge from the SSOT prompt bodies.
@@ -31,3 +31,10 @@ Steering MUST be grounded in repo evidence. When possible, include:
31
31
  - directory anchors (e.g., `packages/qfai/src/cli`)
32
32
 
33
33
  If a fact cannot be verified, mark it as `TBD` and record what evidence is missing.
34
+
35
+ ### Default AI-managed flow (recommended)
36
+
37
+ 1. Run a QFAI command (e.g., `/qfai-require`, `/qfai-spec`, `/qfai-implement`).
38
+ 2. The agent loads `steering/*` and fills missing placeholders from **repo evidence**.
39
+ 3. If evidence is missing, write `TBD` and add an Open Question (what evidence is required).
40
+ 4. Optionally, review changes via PR if your team requires human approval.
@@ -6,6 +6,6 @@ Subfolders:
6
6
 
7
7
  - `ui/` : UI contracts (YAML)
8
8
  - `api/`: API contracts (YAML)
9
- - `db/` : DB contracts (YAML)
9
+ - `db/` : DB contracts (SQL / .sql)
10
10
 
11
11
  Create contracts only when needed by the spec (keep minimal).
@@ -1,8 +1,25 @@
1
1
  # contracts/db/
2
2
 
3
- Place DB contracts here (YAML).
3
+ Place **DB contracts** here as **SQL DDL files** (`.sql`).
4
4
 
5
- Guidelines:
5
+ ## File naming
6
6
 
7
- - Keep contracts minimal: define only what scenarios/tests need to validate.
8
- - Include examples where helpful.
7
+ - `db-0001-<slug>.sql`
8
+ - Contract ID: `DB-0001` (4-digit fixed)
9
+
10
+ ## Required header
11
+
12
+ Include the contract ID in the SQL header comments so QFAI can discover/index it:
13
+
14
+ ```sql
15
+ -- QFAI-CONTRACT-ID: DB-0001
16
+ -- DB-0001 (short description)
17
+ ```
18
+
19
+ ## Guidelines
20
+
21
+ - Keep DB contracts minimal and spec-driven (only what scenarios/tests need).
22
+ - This directory is for the **contract/schema snapshot**, not migrations history.
23
+ - If your project uses an ORM schema (Prisma, etc.), decide one:
24
+ - (Recommended for v1.0.6) Keep a minimal `.sql` contract snapshot here, and link to the real schema in the spec.
25
+ - (Future) Add support for other schema formats via config (out of scope for v1.0.6).
@@ -7,3 +7,5 @@ A **spec pack** lives under `specs/spec-XXXX/` and contains:
7
7
  - `scenario.feature` : Gherkin scenarios (ATDD skeleton)
8
8
 
9
9
  Create/update spec packs with `/qfai-spec`.
10
+
11
+ Note: After `qfai init`, this folder contains only this README. Spec packs (`spec-XXXX/`) are created by running `/qfai-spec`.
@@ -1075,8 +1075,8 @@ var import_promises7 = require("fs/promises");
1075
1075
  var import_node_path9 = __toESM(require("path"), 1);
1076
1076
  var import_node_url2 = require("url");
1077
1077
  async function resolveToolVersion() {
1078
- if ("1.0.5".length > 0) {
1079
- return "1.0.5";
1078
+ if ("1.0.6".length > 0) {
1079
+ return "1.0.6";
1080
1080
  }
1081
1081
  try {
1082
1082
  const packagePath = resolvePackageJsonPath();
@@ -1056,8 +1056,8 @@ import { readFile as readFile4 } from "fs/promises";
1056
1056
  import path9 from "path";
1057
1057
  import { fileURLToPath as fileURLToPath2 } from "url";
1058
1058
  async function resolveToolVersion() {
1059
- if ("1.0.5".length > 0) {
1060
- return "1.0.5";
1059
+ if ("1.0.6".length > 0) {
1060
+ return "1.0.6";
1061
1061
  }
1062
1062
  try {
1063
1063
  const packagePath = resolvePackageJsonPath();
package/dist/index.cjs CHANGED
@@ -1290,8 +1290,8 @@ var import_promises7 = require("fs/promises");
1290
1290
  var import_node_path8 = __toESM(require("path"), 1);
1291
1291
  var import_node_url = require("url");
1292
1292
  async function resolveToolVersion() {
1293
- if ("1.0.5".length > 0) {
1294
- return "1.0.5";
1293
+ if ("1.0.6".length > 0) {
1294
+ return "1.0.6";
1295
1295
  }
1296
1296
  try {
1297
1297
  const packagePath = resolvePackageJsonPath();
package/dist/index.mjs CHANGED
@@ -1237,8 +1237,8 @@ import { readFile as readFile4 } from "fs/promises";
1237
1237
  import path8 from "path";
1238
1238
  import { fileURLToPath } from "url";
1239
1239
  async function resolveToolVersion() {
1240
- if ("1.0.5".length > 0) {
1241
- return "1.0.5";
1240
+ if ("1.0.6".length > 0) {
1241
+ return "1.0.6";
1242
1242
  }
1243
1243
  try {
1244
1244
  const packagePath = resolvePackageJsonPath();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qfai",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Quality-first AI-driven development toolkit (SDD × ATDD × TDD).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- // Traceability sample: reference SC IDs via annotations (comments are enough).
2
- // QFAI:SC-0001