qfai 1.0.7 → 1.1.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 CHANGED
@@ -31,13 +31,15 @@ npx qfai report
31
31
  ## What you can do (CLI commands)
32
32
 
33
33
  - `npx qfai init`
34
- - Creates the QFAI workspace under `.qfai/` (requirements/specs/contracts/report) and installs the AI assistant kit (`assistant/` with prompts, instructions, agents, and steering templates), plus a default GitHub Actions workflow and `qfai.config.yaml`.
34
+ - Creates the QFAI workspace under `.qfai/` (requirements/specs/contracts/report) and installs the AI assistant kit (`assistant/` with prompts, instructions, agents, and steering templates for product/tech/structure/manifest), plus a default GitHub Actions workflow and `qfai.config.yaml`.
35
35
  - `npx qfai validate`
36
36
  - Validates specs/contracts/scenarios/traceability and writes `.qfai/report/validate.json`; use `--fail-on error` (or `--fail-on warning`) to turn it into a CI gate, and `--format github` to emit GitHub-friendly annotations.
37
37
  - `npx qfai report`
38
38
  - Produces a human-readable report (`report.md` by default) or an internal JSON export (`report.json`) from `validate.json`; use `--base-url` to link file paths in Markdown to your repository viewer.
39
39
  - `npx qfai doctor`
40
40
  - Diagnoses configuration discovery, path resolution, glob scanning, and `validate.json` inputs before running validate/report; use `--fail-on` to enforce failures in CI.
41
+ - `npx qfai guardrails`
42
+ - Lists, extracts, or checks Decision Guardrails in `delta.md` (`list` / `extract` / `check`); use `--path` to point at samples or custom locations.
41
43
 
42
44
  ## Operating model (prompt-driven workflow)
43
45
 
@@ -55,7 +57,7 @@ The agent reads QFAI assets under `.qfai/assistant/` and produces or updates SDD
55
57
 
56
58
  QFAI includes a small set of custom prompts (stored under `.qfai/assistant/prompts/`) designed to keep the workflow opinionated and repeatable.
57
59
 
58
- - **qfai-configure**: Analyze the repository (language, frameworks, test layout, directory structure) and update `qfai.config.yaml` with a minimal diff (especially `testFileGlobs`). Run this once right after `npx qfai init`, and re-run it when the repository structure changes. Output: updated YAML + validation checklist.
60
+ - **qfai-configure**: Analyze the repository (language, frameworks, test layout, directory structure) and update steering (`product.md`, `tech.md`, `structure.md`, `manifest.md`) plus `qfai.config.yaml` with a minimal diff (especially `testFileGlobs`, and optionally `validation.require.specSections` when you want strict headings). Run this once right after `npx qfai init`, and re-run it when the repository structure changes or when you want to enforce required spec headings. Output: updated steering + YAML + validation checklist.
59
61
  - **qfai-discuss**: Turn an idea into clear requirements by discussing scope, constraints, risks, and open questions.
60
62
  - **qfai-require**: Produce `.qfai/require/require.md` from your idea or discussion output.
61
63
  - **qfai-spec**: Produce `.qfai/specs/*` and `.qfai/contracts/*` from the requirements, including traceability scaffolding.
@@ -81,7 +83,7 @@ R-->>U: .qfai kit installed (prompts, instructions, agents)
81
83
 
82
84
  U->>AG: Run /qfai-configure
83
85
  AG->>Q: Read .qfai/assistant/prompts/qfai-configure.md
84
- AG->>R: Update qfai.config.yaml (testFileGlobs, etc.)
86
+ AG->>R: Update qfai.config.yaml (testFileGlobs, optional specSections)
85
87
  AG-->>U: Config tuned to this repo
86
88
 
87
89
  opt If you only have an idea
@@ -130,20 +132,23 @@ Operational notes.
130
132
 
131
133
  ## Configuration
132
134
 
133
- Configuration is stored at the repository root as `qfai.config.yaml`; you can change paths, traceability policies, and CI gate thresholds.
135
+ Configuration is stored at the repository root as `qfai.config.yaml`.
136
+ Most projects only customize `paths` and `validation.traceability`.
137
+ `.qfai/require` is currently a fixed location (not configurable).
134
138
 
135
- Example: override paths and traceability globs.
139
+ Example: a schema-valid configuration.
136
140
 
137
141
  ```yaml
138
142
  paths:
139
- qfaiDir: .qfai
140
- reportDir: .qfai/report
141
- requireDir: .qfai/require
142
143
  specsDir: .qfai/specs
143
144
  contractsDir: .qfai/contracts
145
+ outDir: .qfai/report
146
+ promptsDir: .qfai/assistant/prompts
147
+ srcDir: src
148
+ testsDir: tests
149
+
144
150
  validation:
145
151
  failOn: error # error | warning | never
146
- strict: false # if true, warnings also fail (equivalent to failOn=warning)
147
152
  traceability:
148
153
  testFileGlobs:
149
154
  - "src/**/*.test.ts"
@@ -152,11 +157,51 @@ validation:
152
157
  - "**/fixtures/**"
153
158
  scMustHaveTest: true
154
159
  scNoTestSeverity: warning # error | warning
160
+
161
+ output:
162
+ validateJsonPath: .qfai/report/validate.json
163
+ ```
164
+
165
+ ### Spec validation (BR lines and required sections)
166
+
167
+ BR lines are required and must use the format `- [BR-0001][P1] ...` (priority P0-P3). Headings can be in any language.
168
+ `validation.require.specSections` controls required H2 section titles in `spec.md`. The default is an empty list to support multi-language specs.
169
+ If you want strict required headings, run `/qfai-configure` and specify your desired spec template headings.
170
+
171
+ Example (Japanese):
172
+
173
+ ```yaml
174
+ validation:
175
+ require:
176
+ specSections:
177
+ - 背景
178
+ - スコープ
179
+ - 非ゴール
180
+ - 用語
181
+ - 前提
182
+ - 決定事項
183
+ - 業務ルール
184
+ ```
185
+
186
+ Example (English):
187
+
188
+ ```yaml
189
+ validation:
190
+ require:
191
+ specSections:
192
+ - Background
193
+ - Scope
194
+ - Non-goals
195
+ - Glossary
196
+ - Assumptions
197
+ - Decisions
198
+ - Business Rules
155
199
  ```
156
200
 
157
201
  Notes.
158
202
 
159
203
  - `validate.json`, `report.json`, and `doctor.json` are internal exports and are not a stable external contract; prefer `report.md` for integrations that must survive tool upgrades.
204
+ - `--strict` is a CLI option for `qfai validate` (treat warnings as failures); it is not a YAML setting.
160
205
  - Scenario files are expected to use the Gherkin extension `*.feature` (not `*.md`).
161
206
 
162
207
  ## Specifications and contracts (SDD)
@@ -181,9 +226,21 @@ Traceability is validated across these artifacts, so code changes remain grounde
181
226
 
182
227
  What works out-of-the-box.
183
228
 
184
- - The generated workflow is npm-oriented (`npm ci`); if your repository uses pnpm/yarn/bun, replace the install/cache steps accordingly.
229
+ - The generated workflow runs without installing repository dependencies; it only executes `npx qfai validate --fail-on error`, so it works even if your repo is not a Node project.
230
+ - The default workflow does not enable `actions/setup-node` caching, so it does not require a lockfile.
231
+ - If you want to pin the QFAI version, install your repo dependencies (e.g., to run tests), or enable dependency caching, customize the workflow accordingly.
185
232
  - The default validate gate fails only on `error`; use `--fail-on warning` or `--strict` if you want a stricter gate.
186
233
 
234
+ Optional cache example (requires a lockfile):
235
+
236
+ ```yaml
237
+ - uses: actions/setup-node@v4
238
+ with:
239
+ node-version: 20
240
+ cache: npm
241
+ # cache-dependency-path: package-lock.json
242
+ ```
243
+
187
244
  Typical customizations.
188
245
 
189
246
  - Add a second job to generate `report.md` from the uploaded `validate.json`.
@@ -277,6 +334,7 @@ Typical customizations.
277
334
  │ │ │ ├── README.md
278
335
  │ │ │ ├── product.md
279
336
  │ │ │ ├── structure.md
337
+ │ │ │ ├── manifest.md
280
338
  │ │ │ └── tech.md
281
339
  │ │ └── README.md
282
340
  │ ├── contracts
@@ -294,6 +352,9 @@ Typical customizations.
294
352
  │ │ └── require.md
295
353
  │ ├── specs
296
354
  │ │ └── README.md
355
+ │ ├── samples
356
+ │ │ ├── guardrails
357
+ │ │ │ └── delta_with_guardrails.md
297
358
  │ └── README.md
298
359
  └── qfai.config.yaml
299
360
  ```
@@ -1,7 +1,8 @@
1
1
  # .qfai (QFAI Workspace)
2
2
 
3
3
  Generated by: `qfai init`
4
- Template version: 1.0.6
4
+ Template version: 1.1.0
5
+ This kit is generated by the installed QFAI version. See the QFAI changelog for release details.
5
6
 
6
7
  This directory is the workspace for **QFAI (Quality‑First AI)**.
7
8
  QFAI standardizes engineering work around a fixed workflow:
@@ -6,4 +6,4 @@ This folder contains AI assistance assets.
6
6
  - `prompts.local/` : optional per-project overrides (not required)
7
7
  - `agents/` : subagent definitions (general job roles)
8
8
  - `instructions/` : constitutions/workflow policies for the AI
9
- - `steering/` : project context (product/tech/structure) used before work begins
9
+ - `steering/` : project context (product/tech/structure/manifest) used before work begins
@@ -10,7 +10,7 @@ Rule:
10
10
  Files:
11
11
 
12
12
  - qfai-discuss.md (optional)
13
- - qfai-configure.md (run after init; updates qfai.config.yaml testFileGlobs; outputs updated YAML + validation checklist)
13
+ - qfai-configure.md (run after init; updates steering + qfai.config.yaml testFileGlobs; outputs updated YAML + validation checklist)
14
14
  - qfai-require.md
15
15
  - qfai-spec.md
16
16
  - qfai-scenario-test.md
@@ -8,7 +8,7 @@ QFAI Prompt Body (SSOT)
8
8
 
9
9
  id: qfai-configure
10
10
  title: QFAI Configure (Tune qfai.config.yaml)
11
- description: "Analyze the repository and tune qfai.config.yaml (testFileGlobs, exclude globs)."
11
+ description: "Analyze the repository and tune qfai.config.yaml (testFileGlobs, exclude globs, optional specSections)."
12
12
  argument-hint: "[--auto]"
13
13
  allowed-tools: [Read, Glob, Write, TodoWrite, Task]
14
14
  roles: [DevOpsCIEngineer, QAEngineer, CodeReviewer, Planner]
@@ -20,14 +20,16 @@ mode: evidence-focused
20
20
 
21
21
  ## Purpose
22
22
 
23
- Analyze the repository and update `qfai.config.yaml` so QFAI traceability checks (especially SC->Test) are actionable without manual tuning.
23
+ Analyze the repository and update `qfai.config.yaml` so QFAI traceability checks (especially SC->Test) are actionable without manual tuning, and optionally tune required spec sections if requested.
24
24
 
25
25
  ## Success Criteria (Definition of Done)
26
26
 
27
27
  - `qfai.config.yaml` is updated with a **minimal diff** focused on traceability globs.
28
28
  - `validation.traceability.testFileGlobs` reflects the real test layout.
29
29
  - `validation.traceability.testFileExcludeGlobs` is added only when needed.
30
+ - If strict spec sections are explicitly requested, `validation.require.specSections` is updated with a minimal, evidence-based list.
30
31
  - A validation checklist with evidence (sample matched files) is produced.
32
+ - Steering files (`product.md`, `tech.md`, `structure.md`, `manifest.md`) are filled or refreshed with evidence, or marked `TBD` when evidence is missing.
31
33
 
32
34
  ## Non-Negotiable Principles (QFAI Articles)
33
35
 
@@ -91,10 +93,11 @@ Simulate roles by running the same sequence yourself:
91
93
 
92
94
  ## Constraints
93
95
 
94
- - Only update `qfai.config.yaml` unless explicitly asked.
96
+ - Only update `qfai.config.yaml` and `.qfai/assistant/steering/*` unless explicitly asked.
95
97
  - Do **not** modify tests or source code.
96
98
  - Avoid overly broad globs (e.g., `**/*`).
97
99
  - Exclude generated/output directories (`node_modules`, `.git`, `.qfai`, `dist`, `build`, `coverage`, `.next`, `out`, etc.).
100
+ - Keep `validation.require.specSections` unchanged unless the user explicitly requests strict required headings.
98
101
 
99
102
  ## Step 0 - Load Context (always)
100
103
 
@@ -112,6 +115,12 @@ Simulate roles by running the same sequence yourself:
112
115
  - package manager (pnpm/npm/yarn), test runner, lint/typecheck scripts, CI definitions
113
116
  - existing test patterns (unit/integration/e2e)
114
117
 
118
+ 4. Inspect steering templates and placeholders:
119
+ - `.qfai/assistant/steering/product.md`
120
+ - `.qfai/assistant/steering/tech.md`
121
+ - `.qfai/assistant/steering/structure.md`
122
+ - `.qfai/assistant/steering/manifest.md`
123
+
115
124
  ## Step 0 - Project Analysis (mandatory)
116
125
 
117
126
  Before editing config, **thoroughly analyze the current project**:
@@ -129,6 +138,7 @@ If analysis cannot be performed (missing access), clearly state what could not b
129
138
  1. Inspect `package.json` and config files (e.g., `vitest.config.*`, `jest.config.*`, `playwright.config.*`, `pytest.ini`, `go.mod`).
130
139
  2. Enumerate directories that contain tests (e.g., `tests/`, `src/`, `e2e/`, `integration/`).
131
140
  3. Note naming rules and extensions that indicate test files.
141
+ 4. If strict spec sections are requested, sample existing `spec.md` files and list H2 headings used.
132
142
 
133
143
  ## Step 2 - Propose glob patterns
134
144
 
@@ -139,16 +149,25 @@ Provide 3-10 **include globs** that cover all known test locations:
139
149
 
140
150
  Provide **exclude globs** only when necessary (beyond the default exclusions).
141
151
 
142
- ## Step 3 - Update `qfai.config.yaml` (minimal diff)
152
+ ## Step 3 - Update steering (evidence-first)
153
+
154
+ Fill steering templates with repo evidence.
155
+
156
+ - Keep existing content when already accurate.
157
+ - When evidence is missing, write `TBD` and record what is missing.
158
+ - Do not invent facts.
159
+
160
+ ## Step 4 - Update `qfai.config.yaml` (minimal diff)
143
161
 
144
162
  Edit:
145
163
 
146
164
  - `validation.traceability.testFileGlobs`
147
165
  - `validation.traceability.testFileExcludeGlobs` (only if needed)
166
+ - `validation.require.specSections` (only if explicitly requested)
148
167
 
149
168
  Keep all other config keys unchanged.
150
169
 
151
- ## Step 4 - Evidence sampling
170
+ ## Step 5 - Evidence sampling
152
171
 
153
172
  Sample 5-15 actual test files that match the proposed globs.
154
173
 
@@ -158,8 +177,10 @@ Sample 5-15 actual test files that match the proposed globs.
158
177
  ## Checkpoints
159
178
 
160
179
  - [ ] Repository analysis completed (frameworks, test layout, naming rules).
180
+ - [ ] Steering files updated with evidence or `TBD`.
161
181
  - [ ] Proposed include/exclude globs with rationale.
162
182
  - [ ] `qfai.config.yaml` updated (minimal diff).
183
+ - [ ] Optional: specSections tuned when requested (or kept empty).
163
184
  - [ ] Evidence: sample matched files listed.
164
185
 
165
186
  ## Output
@@ -167,8 +188,10 @@ Sample 5-15 actual test files that match the proposed globs.
167
188
  Provide:
168
189
 
169
190
  1. Updated `qfai.config.yaml` (diff or full file, as appropriate).
170
- 2. A short summary of changes and rationale.
171
- 3. Validation checklist with sampled files.
172
- 4. Open questions (blocking vs non-blocking).
191
+ 2. Updated steering files (diff or summary).
192
+ 3. A short summary of changes and rationale.
193
+ 4. Validation checklist with sampled files.
194
+ 5. If specSections updated, list the chosen headings and evidence source.
195
+ 6. Open questions (blocking vs non-blocking).
173
196
 
174
197
  Suggest next step: `/qfai-require` (or `/qfai-discuss` if requirements are not ready).
@@ -219,4 +219,4 @@ Output this format:
219
219
  ## Output
220
220
 
221
221
  - Evidence summary
222
- - Next action suggestion: /qfai-pr (optional) or proceed to PR creation
222
+ - Next action suggestion: proceed to PR creation (use your platform workflow)
@@ -7,9 +7,15 @@ These are intentionally short and practical:
7
7
  - `product.md` : what we are building and why
8
8
  - `tech.md` : stack, versions, constraints
9
9
  - `structure.md` : repo structure, key directories, how to run gates
10
+ - `manifest.md` : product-level decision spine and governance rubric
10
11
 
11
12
  QFAI prompts are expected to read these before producing deliverables.
12
13
 
14
+ Rule:
15
+
16
+ - Keep steering flat (no subdirectories).
17
+ - Markdown only.
18
+
13
19
  ## AI-managed policy (recommended)
14
20
 
15
21
  These steering files are intended to be **filled and refreshed by the AI** (via QFAI custom prompts).
@@ -0,0 +1,43 @@
1
+ # Manifest (Decision Spine)
2
+
3
+ ## Product / Mission
4
+
5
+ - Summary:
6
+ - Value:
7
+ - Evidence:
8
+
9
+ ## Drive / Lens / Axioms
10
+
11
+ - Axioms / principles:
12
+ - Decision lens (what we optimize for):
13
+ - Evidence:
14
+
15
+ ## Compatibility vs Change (Rubric)
16
+
17
+ - Compatibility:
18
+ - Change:
19
+ - Examples:
20
+ - Evidence:
21
+
22
+ ## Ownership / Governance
23
+
24
+ - Owner:
25
+ - Review / approval:
26
+ - Update cadence:
27
+ - Evidence:
28
+
29
+ ## Evidence
30
+
31
+ - Rule (e.g., link to repo evidence for every claim):
32
+ - Evidence:
33
+
34
+ ## Non-goals / Not-now (Optional)
35
+
36
+ -
37
+ - Evidence:
38
+
39
+ ## References (Optional)
40
+
41
+ - product.md
42
+ - tech.md
43
+ - structure.md
@@ -20,6 +20,13 @@ Include the contract ID in the SQL header comments so QFAI can discover/index it
20
20
 
21
21
  - Keep DB contracts minimal and spec-driven (only what scenarios/tests need).
22
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).
23
+
24
+ If your project uses an ORM schema (Prisma, etc.), decide one:
25
+
26
+ ### Recommended
27
+
28
+ - Keep a minimal `.sql` contract snapshot here, and link to the real schema in the spec.
29
+
30
+ ### Out of scope
31
+
32
+ - Add support for other schema formats via config.
@@ -0,0 +1,19 @@
1
+ # SPEC-0001: Delta (Decision Guardrails Sample)
2
+
3
+ ## Decision Guardrails
4
+
5
+ - ID: DG-0001
6
+ Type: non-goal
7
+ Guardrail: Do not introduce per-language parsing rules into validators.
8
+ Rationale: Multi-language output is a core contract.
9
+ Reconsider: never
10
+ Related: SPEC-0001
11
+ Keywords: parsing, validators, multi-language
12
+
13
+ - ID: DG-0002
14
+ Type: not-now
15
+ Guardrail: Do not add automatic template upgrades for existing repositories.
16
+ Rationale: Update safety needs a dedicated upgrade design.
17
+ Reconsider: after upgrade design is approved
18
+ Related: V11-OQ-007
19
+ Keywords: upgrade, templates
@@ -8,4 +8,8 @@ A **spec pack** lives under `specs/spec-XXXX/` and contains:
8
8
 
9
9
  Create/update spec packs with `/qfai-spec`.
10
10
 
11
+ Decision Guardrails can be stored under `delta.md` as `## Decision Guardrails`. See `.qfai/samples/guardrails/delta_with_guardrails.md` for an opt-in example.
12
+
13
+ Manifest is maintained under `.qfai/assistant/steering/manifest.md` (product-level decision spine). Do not duplicate a manifest under specs.
14
+
11
15
  Note: After `qfai init`, this folder contains only this README. Spec packs (`spec-XXXX/`) are created by running `/qfai-spec`.
@@ -13,8 +13,6 @@ jobs:
13
13
  - uses: actions/setup-node@v4
14
14
  with:
15
15
  node-version: 20
16
- cache: npm
17
- - run: npm ci
18
16
  - run: npx qfai validate --fail-on error --format github
19
17
  - uses: actions/upload-artifact@v4
20
18
  with:
@@ -8,14 +8,7 @@ paths:
8
8
  validation:
9
9
  failOn: error
10
10
  require:
11
- specSections:
12
- - 背景
13
- - スコープ
14
- - 非ゴール
15
- - 用語
16
- - 前提
17
- - 決定事項
18
- - 業務ルール
11
+ specSections: []
19
12
  traceability:
20
13
  brMustHaveSc: true
21
14
  scMustHaveTest: true