@v11g/agents-rock 1.0.10 → 1.0.11
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 +2 -1
- package/package.json +1 -1
- package/plugins/business-analyst/.claude-plugin/plugin.json +2 -2
- package/plugins/business-analyst/evals/draft-scope-rich/case.yaml +4 -0
- package/plugins/business-analyst/evals/draft-scope-rich/fixture.sh +5 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/conflict-question.md +11 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/keep-and-exclude.md +14 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/noise-and-shape.md +13 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/problem-not-solution.md +13 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/share-kept.md +11 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/skill-fired.md +7 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/vague-word.md +13 -0
- package/plugins/business-analyst/evals/draft-scope-rich/inputs/C1.txt +10 -0
- package/plugins/business-analyst/evals/draft-scope-rich/inputs/E1.txt +5 -0
- package/plugins/business-analyst/evals/draft-scope-rich/inputs/E2.txt +5 -0
- package/plugins/business-analyst/evals/draft-scope-rich/inputs/E3.txt +5 -0
- package/plugins/business-analyst/evals/draft-scope-rich/prompt.md +9 -0
- package/plugins/business-analyst/evals/draft-scope-thin/case.yaml +4 -0
- package/plugins/business-analyst/evals/draft-scope-thin/fixture.sh +4 -0
- package/plugins/business-analyst/evals/draft-scope-thin/graders/no-invention.md +18 -0
- package/plugins/business-analyst/evals/draft-scope-thin/graders/skill-fired.md +7 -0
- package/plugins/business-analyst/evals/draft-scope-thin/inputs/E1.txt +5 -0
- package/plugins/business-analyst/evals/draft-scope-thin/prompt.md +8 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/SKILL.md +46 -0
- package/plugins/business-analyst/skills/draft-scope/references/credits.md +12 -0
- package/plugins/business-analyst/skills/draft-scope/references/draft-schema.md +44 -0
- package/plugins/business-analyst/skills/draft-scope/references/rules.md +24 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_body.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_flow.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_package.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_xml.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_quotes.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_rules.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_schema.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/build_docx.py +36 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/check.py +53 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/docx_body.py +58 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/docx_flow.py +52 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/docx_package.py +62 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/docx_xml.py +44 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/draft_quotes.py +49 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/draft_rules.py +106 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/draft_schema.py +87 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/build-docx.test.mjs +76 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/check-rules.test.mjs +131 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/check-shape.test.mjs +70 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/draft-pass.json +40 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/sources/C1.txt +7 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/sources/E1.txt +5 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/gates.test.mjs +39 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/helpers.mjs +30 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/skill-files.test.mjs +59 -0
- package/plugins/business-analyst/skills/draft-scope/steps/assumptions.md +24 -0
- package/plugins/business-analyst/skills/draft-scope/steps/check.md +24 -0
- package/plugins/business-analyst/skills/draft-scope/steps/discover.md +53 -0
- package/plugins/business-analyst/skills/draft-scope/steps/draft.md +64 -0
- package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +8 -7
- package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +5 -5
- package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +15 -3
- package/plugins/solution-architect/skills/analyze-requirements/evals/evals.json +50 -6
- package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.json +31 -0
- package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.md +17 -0
- package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/transcript-citations/C1-kickoff-call.txt +16 -0
- package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/transcript-citations/E1-intro-email.md +9 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/extract.md +108 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +39 -5
- package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/references/quality-goals.md +84 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/research.md +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/references/rewriting.md +7 -2
- package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +10 -6
- package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +45 -3
- package/plugins/solution-architect/skills/analyze-requirements/scripts/ba-facts.mjs +32 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/check-quotes.mjs +39 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/ba-package.mjs +75 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +19 -7
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +42 -11
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +15 -4
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/strategy-sections.mjs +30 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +14 -2
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-quotes.mjs +55 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-strategy.mjs +65 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +18 -5
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-facts-cli.test.mjs +55 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-package-cli.test.mjs +101 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-package.test.mjs +115 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +50 -2
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/check-quotes-cli.test.mjs +49 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +49 -4
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/extract-workflow.test.mjs +69 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +14 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +19 -5
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/record-cli.test.mjs +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +69 -2
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rewriting.test.mjs +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +6 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +19 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-quotes-cli.test.mjs +58 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-quotes.test.mjs +81 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-strategy-cli.test.mjs +32 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-strategy.test.mjs +118 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +17 -6
- package/plugins/solution-architect/skills/analyze-requirements/workflows/extract.js +51 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Kickoff call - Lumen Tickets - 2026-09-10
|
|
2
|
+
Participants: Maya Chen (founder, Lumen Tickets), Sam (PO, Code Engine Studio)
|
|
3
|
+
|
|
4
|
+
Sam: Tell me what happens when a big show goes on sale.
|
|
5
|
+
Maya: We open sales at 10am sharp. For a headline act we get ten times the orders in the first five minutes, and last spring the old site just fell over.
|
|
6
|
+
Sam: What did that cost you?
|
|
7
|
+
Maya: About forty thousand dollars in refunds and a lot of angry fans.
|
|
8
|
+
Sam: How do customers pay?
|
|
9
|
+
Maya: Payments go through Stripe, we don't want to touch card data ourselves.
|
|
10
|
+
Sam: Any hosting preference?
|
|
11
|
+
Maya: We pay for Azure already, so it has to run there.
|
|
12
|
+
Maya: Sorry, the cafe downstairs is playing jazz again, ignore that.
|
|
13
|
+
Sam: Anything on speed?
|
|
14
|
+
Maya: Checkout must be fast. People abandon if it hangs.
|
|
15
|
+
Sam: Budget?
|
|
16
|
+
Maya: We are small. Running costs need to stay under two thousand dollars a month outside sale days.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
From: Maya Chen
|
|
2
|
+
Date: 2026-09-08
|
|
3
|
+
Subject: Ticketing rebuild
|
|
4
|
+
|
|
5
|
+
Hi Sam,
|
|
6
|
+
|
|
7
|
+
As discussed, our box office staff still reconcile sales in a spreadsheet every night. We want seat inventory to be the single source of truth so we never sell the same seat twice.
|
|
8
|
+
|
|
9
|
+
Maya
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Extract — client inputs to quoted facts
|
|
2
|
+
|
|
3
|
+
Read at SKILL.md step 3, before the interview, on every run: it asks for
|
|
4
|
+
client material (§2) and turns it into quoted facts (§3).
|
|
5
|
+
|
|
6
|
+
## 1. Inputs
|
|
7
|
+
|
|
8
|
+
- Client files live in `inputs/` beside ARCHITECTURE.md, unless the user
|
|
9
|
+
points elsewhere — then cite them where they are.
|
|
10
|
+
- Each file has an ID: `C` call, `E` email, `N` note, `D` other document,
|
|
11
|
+
numbered per kind in date order (`C1`, `C2`, `E1`). Named
|
|
12
|
+
`<ID>-<slug>.<txt|md>` when the skill files them; an existing name is
|
|
13
|
+
kept and the ID recorded on the `**Inputs**` line of `interview-log.md` instead.
|
|
14
|
+
- The skill reads inputs, never edits them (hard rule 5: not ours).
|
|
15
|
+
|
|
16
|
+
## 2. Ask for inputs
|
|
17
|
+
|
|
18
|
+
Evidence before questions: a fact quoted from a client file is checked word
|
|
19
|
+
for word, while a fact from an interview answer is only as good as the
|
|
20
|
+
answer. So unless client files were given or `inputs/` already holds files, the
|
|
21
|
+
run's first card asks for them. It is one card in its own `AskUserQuestion`
|
|
22
|
+
call, and it counts toward the interview's 12-question cap:
|
|
23
|
+
|
|
24
|
+
- Question: "Client material makes this document stronger: every fact taken
|
|
25
|
+
from it carries a checked quote. Do you have call transcripts, emails,
|
|
26
|
+
notes or specs?"
|
|
27
|
+
- Options, in this order:
|
|
28
|
+
1. `Added to inputs/ — continue (Recommended)` → list `inputs/`, give
|
|
29
|
+
each file its ID (§1), then run §3.
|
|
30
|
+
2. `The brief is in my message — save it` → §2.1, then §3.
|
|
31
|
+
3. `None — interview only` → log the answer. The final report says
|
|
32
|
+
`0 input files: <n> stated facts cite the interview only`.
|
|
33
|
+
- If option 1 is picked but `inputs/` is still empty, say so and continue
|
|
34
|
+
as option 3.
|
|
35
|
+
- A business-analyst package beside ARCHITECTURE.md (§2.2) is client material:
|
|
36
|
+
the card still asks for raw files, with these options instead —
|
|
37
|
+
1. `BA package only — continue (Recommended)` → §2.2 only.
|
|
38
|
+
2. `Added raw client files to inputs/ — use both` → §2.2, then §3 on `inputs/`.
|
|
39
|
+
- Whenever no card is shown (client files given, `inputs/` already holds
|
|
40
|
+
files, or the user said not to ask), a brief in the opening message is
|
|
41
|
+
still saved per §2.1. With no brief and no files, continue as option 3.
|
|
42
|
+
|
|
43
|
+
### 2.1 Saving a brief from chat
|
|
44
|
+
|
|
45
|
+
Write the part of the user's message that describes the project to
|
|
46
|
+
`inputs/N<n>-brief.md`, using the next free `N` number. Copy it exactly as
|
|
47
|
+
the user wrote it: no heading, no summary, no fixes. Date it the day it
|
|
48
|
+
arrived, on the log's `**Inputs**` line (`N1 = brief, 2026-10-14`). From then on it is an input like any other: extracted (§3), never
|
|
49
|
+
edited, never recorded or drift-gated. A later brief gets the next number
|
|
50
|
+
and never overwrites an earlier one.
|
|
51
|
+
|
|
52
|
+
### 2.2 A business-analyst package
|
|
53
|
+
|
|
54
|
+
The business-analyst skill writes `requirements.json` (for machines) and
|
|
55
|
+
`requirements.md` (for people) into the lead folder. Look for them beside
|
|
56
|
+
ARCHITECTURE.md.
|
|
57
|
+
|
|
58
|
+
- **Both present → read the json only.** Run
|
|
59
|
+
`node scripts/ba-facts.mjs --json <path> --out <tmp>/ba.json`. Never extract
|
|
60
|
+
`requirements.md` too: it is the same package, and every fact would arrive twice.
|
|
61
|
+
- **Only `requirements.md` → fallback.** Treat it as input `D<n>` at its own path
|
|
62
|
+
(§1) and run §3 with `ba: true` on its file entry.
|
|
63
|
+
- `ba.json` holds `facts` (the BA marked them `confirmed`) and `proposed`
|
|
64
|
+
(`assumed` or `recommended`). Only `facts` may be `stated` (§5). A `proposed`
|
|
65
|
+
row is written `proposed`, or asked in the interview when it would change a
|
|
66
|
+
decision. The package's assumptions and open questions are never `stated`.
|
|
67
|
+
- Pass the package file to `validate.mjs --inputs` like any input.
|
|
68
|
+
|
|
69
|
+
A package is read whether or not the card was shown. It is an input file, so
|
|
70
|
+
the run never reports `0 input files`; report `BA package: <n> confirmed facts`
|
|
71
|
+
instead.
|
|
72
|
+
|
|
73
|
+
## 3. Run
|
|
74
|
+
|
|
75
|
+
Skip this section when there are no input files.
|
|
76
|
+
|
|
77
|
+
1. Invoke `workflows/extract.js` with
|
|
78
|
+
`args = { files: [{ id, path: <absolute>, date: 'YYYY-MM-DD' }] }`.
|
|
79
|
+
**Never read an input file into the main context yourself.**
|
|
80
|
+
2. Save the returned `facts` as `{ "facts": [...] }` to a temp file and run
|
|
81
|
+
`node scripts/check-quotes.mjs --facts <tmp>/facts.json --out <tmp>/checked.json`.
|
|
82
|
+
3. Exit 1: re-invoke `extract.js` once, with only the files that missed and
|
|
83
|
+
`fix: <that file's misses>` on each. Append the returned facts to
|
|
84
|
+
`checked.json`'s `facts`, run `check-quotes` again on them, and stop.
|
|
85
|
+
Whatever still misses is dropped.
|
|
86
|
+
4. Surface `dropped` (from `extract.js`) and the dropped misses to the user
|
|
87
|
+
before the interview, as research does (`research.md` §4).
|
|
88
|
+
|
|
89
|
+
## 4. Follow-up questions
|
|
90
|
+
|
|
91
|
+
When writing needs something the facts do not cover ("what does C1 say
|
|
92
|
+
about hosting?"), invoke `extract.js` with that one file and
|
|
93
|
+
`question: '<the question>'`, then `check-quotes` its facts. One file, one
|
|
94
|
+
question — never re-extract everything.
|
|
95
|
+
|
|
96
|
+
## 5. Using the facts
|
|
97
|
+
|
|
98
|
+
- A verified fact is `stated`, cited
|
|
99
|
+
`stated [<src> · <date>](<path relative to ARCHITECTURE.md>) "<quote>"`.
|
|
100
|
+
- A `ba-facts` fact is cited by its row id, with no quote:
|
|
101
|
+
`stated [<cite>](<path relative to ARCHITECTURE.md>)`, where `cite` is
|
|
102
|
+
given (`FR-001 · kickoff call 2026-08-20`). A confirmed `quality` row can
|
|
103
|
+
back a quality-goal candidate; its `fact` becomes the `Brief says` cell.
|
|
104
|
+
- Quality-goal candidates (`quality-goals.md`) come from facts whose
|
|
105
|
+
`section` is `quality…`; the quote becomes the `Brief says` cell.
|
|
106
|
+
- Research (`research.md`) gets `statedFacts: [{ claim: fact }]` as before;
|
|
107
|
+
keep each fact's citation yourself and write it back — research never
|
|
108
|
+
changes a citation.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Interview — question bank, card batching, skip rules
|
|
2
2
|
|
|
3
|
-
Read during the interview phase (SKILL.md step
|
|
3
|
+
Read during the interview phase (SKILL.md step 4). Defines what may be asked, in
|
|
4
4
|
what shape, and when to stay silent instead.
|
|
5
5
|
|
|
6
6
|
## Hard rules
|
|
@@ -10,7 +10,8 @@ what shape, and when to stay silent instead.
|
|
|
10
10
|
3. Never ask what the scan already observed or research already answered — skip
|
|
11
11
|
on sight; don't ask a question only to discard the answer.
|
|
12
12
|
4. Every answer is recorded with provenance `stated` — including confirmations
|
|
13
|
-
of a detected default.
|
|
13
|
+
of a detected default — and written to `interview-log.md` the moment the
|
|
14
|
+
card returns (see "Interview log").
|
|
14
15
|
5. Domain questions (terms, actors, processes, rules) are asked **while the
|
|
15
16
|
mattpocock `domain-modeling` skill is invoked**, so resolved terms land in
|
|
16
17
|
`CONTEXT.md` inline — never batched for later.
|
|
@@ -19,11 +20,12 @@ what shape, and when to stay silent instead.
|
|
|
19
20
|
|
|
20
21
|
| spine section | question | mode | skip when |
|
|
21
22
|
|---|---|---|---|
|
|
23
|
+
| client inputs (`extract.md` §2) | Do you have call transcripts, emails, notes or specs? | both | files were given or `inputs/` already holds files, or the user said not to ask |
|
|
22
24
|
| §1 Goals & Scope | What is the primary goal of this system, and who are its intended users? | both | an existing README/pitch doc/ARCHITECTURE.md already states it |
|
|
23
25
|
| §2 Constraints | What constraints must the architecture respect — budget, compliance regime, timeline, mandated tech or vendor? | both | constraints are already documented (compliance docs, existing ADRs, a constraints file the scan found) |
|
|
24
|
-
| §13 Quality Requirements & SLOs |
|
|
25
|
-
| §13 Quality Requirements & SLOs |
|
|
26
|
-
| §13 Quality Requirements & SLOs |
|
|
26
|
+
| §13 Quality Requirements & SLOs | Quality goals: confirm the proposed top 3 (candidates with quotes, per `quality-goals.md`) | both | the user said not to ask — then propose the top 3 from quotes, no card (`quality-goals.md` §4); otherwise skip only goals the user already named |
|
|
27
|
+
| §13 Quality Requirements & SLOs | Trade-off: which of the three gives way first? | both | fewer than 2 goals, or the user said not to ask (the weakest quote gives way first) |
|
|
28
|
+
| §13 Quality Requirements & SLOs | Target for each picked goal (one card per goal, ≤ 3) | both | the user already gave a measurable target for that goal, or the user said not to ask |
|
|
27
29
|
| CONTEXT.md (terms) | What are the key domain terms in this system, and how do you define each precisely? | greenfield or thin CONTEXT.md | `CONTEXT.md` already has 5 or more resolved terms |
|
|
28
30
|
| DOMAIN-OVERVIEW.md (actors) | Who are the actors/personas that interact with or are affected by this system? | greenfield or thin CONTEXT.md | same as above, or the project is not domain-heavy |
|
|
29
31
|
| DOMAIN-OVERVIEW.md (processes) | What are the key business processes, described as actor-level steps? | greenfield or thin CONTEXT.md | same as above |
|
|
@@ -37,8 +39,13 @@ what shape, and when to stay silent instead.
|
|
|
37
39
|
- Group cards by spine section — one `AskUserQuestion` call per section, not
|
|
38
40
|
one call per question.
|
|
39
41
|
- **Max 3 cards per call.**
|
|
42
|
+
- The client-inputs card (`extract.md` §2) is the run's first call, on its
|
|
43
|
+
own: extraction must finish before any card proposes from evidence.
|
|
40
44
|
- Within a card, the recommended option is listed first and labeled
|
|
41
45
|
`(Recommended)`.
|
|
46
|
+
- §13 is two calls (`quality-goals.md` §3): round 1 = goals + trade-off
|
|
47
|
+
cards, round 2 = one target card per pick. Together ≤ 5 cards of the
|
|
48
|
+
12-question cap (≤ 6 on thin input, `quality-goals.md` §4).
|
|
42
49
|
|
|
43
50
|
## Honest absence
|
|
44
51
|
|
|
@@ -51,3 +58,30 @@ Not provided — <who declined/why>
|
|
|
51
58
|
```
|
|
52
59
|
|
|
53
60
|
Provenance: `stated`.
|
|
61
|
+
|
|
62
|
+
## Interview log
|
|
63
|
+
|
|
64
|
+
`interview-log.md` sits beside ARCHITECTURE.md. One entry per answer,
|
|
65
|
+
written as soon as the card returns:
|
|
66
|
+
|
|
67
|
+
# Interview log
|
|
68
|
+
**Inputs** C1 = <kept file name>
|
|
69
|
+
|
|
70
|
+
### Q3
|
|
71
|
+
**Asked** 2026-10-14 · **Answered by** Truong Vu (PO), on behalf of Trellis
|
|
72
|
+
**Card** Quality goals — "Recommended top 3: Uptime, Integration, Speed"
|
|
73
|
+
**Answer** Confirm top 3
|
|
74
|
+
|
|
75
|
+
- **Inputs** is only needed when an existing input file name is kept (it
|
|
76
|
+
has no `<ID>-<slug>` name); it maps the ID to that name. It also carries
|
|
77
|
+
a chat brief's date (`extract.md` §2.1).
|
|
78
|
+
- Append-only: never passed to the drift gate, recorded at the end of the run.
|
|
79
|
+
- Numbering continues across runs; an existing entry is never edited or
|
|
80
|
+
renumbered — other documents cite it.
|
|
81
|
+
- **Answered by** names the person and role; "on behalf of <client>" when
|
|
82
|
+
the PO answers for the client. An answer given in the user's opening
|
|
83
|
+
message is logged too, with **Card** `— (in the request)`, unless that
|
|
84
|
+
message was saved as a brief (`extract.md` §2.1): then cite the brief's
|
|
85
|
+
quote, and log only answers the brief does not contain.
|
|
86
|
+
- A declined question is logged with **Answer** `declined`, so the
|
|
87
|
+
`Not provided — …` cell that follows can cite it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Project Types — detection, elections, table variants
|
|
2
2
|
|
|
3
|
-
Read to detect project type (SKILL.md step
|
|
3
|
+
Read to detect project type (SKILL.md step 4) and to pick per-type companion
|
|
4
4
|
elections and table-column variants when writing (`writing.md`).
|
|
5
5
|
|
|
6
6
|
## Detection
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Quality goals — catalogue, filter, top 3
|
|
2
|
+
|
|
3
|
+
Read during the interview (SKILL.md step 4), before any §13 card. Defines
|
|
4
|
+
which quality goals may be proposed, how a candidate earns a place, and how
|
|
5
|
+
the top 3 are confirmed. Method from *Fundamentals of Software Architecture*
|
|
6
|
+
(Richards & Ford, ch. 4–5), in our own words.
|
|
7
|
+
|
|
8
|
+
## 1. Catalogue
|
|
9
|
+
|
|
10
|
+
Propose only these names, spelled exactly as here — §4 `Serves` and the
|
|
11
|
+
validator match on them.
|
|
12
|
+
|
|
13
|
+
| Goal | Book term | Changes the design when… |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| Speed | performance | a user waits on a step with a number attached |
|
|
16
|
+
| Spike handling | elasticity | load jumps by a stated multiple in a short window |
|
|
17
|
+
| Growth | scalability | users or data grow steadily past one machine |
|
|
18
|
+
| Uptime | availability | an outage window costs money or trust |
|
|
19
|
+
| Data recovery | recoverability (RPO/RTO) | lost or late data has a stated cost |
|
|
20
|
+
| Reliability | reliability | a failure must never leave wrong or half-written state |
|
|
21
|
+
| Security | security | data or actions need protection beyond standard login |
|
|
22
|
+
| Integration | interoperability | a named external system is the source of record |
|
|
23
|
+
| Low cost | cost | a budget or running-cost ceiling is stated |
|
|
24
|
+
| Ease of change | evolvability | rules, partners or products change often |
|
|
25
|
+
| Simplicity | simplicity | a small team or short timeline must maintain it |
|
|
26
|
+
|
|
27
|
+
## 2. Filter — what makes a candidate
|
|
28
|
+
|
|
29
|
+
A goal is a candidate only when both hold:
|
|
30
|
+
|
|
31
|
+
1. **The input shows it** — an exact quote from the user's message, a
|
|
32
|
+
document they supplied, or the code scan. No quote, no candidate.
|
|
33
|
+
2. **It changes the design** — something must be built differently for it.
|
|
34
|
+
A goal every system has but that needs nothing special (card payments
|
|
35
|
+
handled by the payment provider → Security) is not a candidate; it goes
|
|
36
|
+
to "Also considered" with that reason.
|
|
37
|
+
|
|
38
|
+
Show 4–6 candidates, never the whole catalogue. Recommend 3, unranked.
|
|
39
|
+
|
|
40
|
+
## 3. Cards
|
|
41
|
+
|
|
42
|
+
Skip both rounds when the user said not to ask (§4).
|
|
43
|
+
|
|
44
|
+
Round 1 — one `AskUserQuestion` call, two cards:
|
|
45
|
+
|
|
46
|
+
- **Quality goals.** Question text lists each candidate with its quote, ★ on
|
|
47
|
+
the recommended 3. Options: `Confirm top 3 (Recommended)` · `Swap in
|
|
48
|
+
<strongest runner-up>` · `Swap in <second runner-up>`. Further runners-up
|
|
49
|
+
stay in the question text; the user reaches them through Other.
|
|
50
|
+
- **Trade-off.** "If budget forces it, which gives way first?" Options: the
|
|
51
|
+
three picks, the one with the weakest quote first and `(Recommended)`.
|
|
52
|
+
|
|
53
|
+
Round 2 — one call, one card per pick (≤ 3): "<Goal> target?" Options: two
|
|
54
|
+
measurable targets drawn from the input (recommended first), then `No
|
|
55
|
+
target yet`.
|
|
56
|
+
|
|
57
|
+
## 4. Thin input and pre-answered goals
|
|
58
|
+
|
|
59
|
+
- Fewer than 3 candidates: round 1 carries ONE open card — "Which qualities
|
|
60
|
+
matter most for this system (up to <n>), each with a measurable target?"
|
|
61
|
+
(<n> = empty slots) — answered through Other. Its answer fills every
|
|
62
|
+
empty slot it can. When the
|
|
63
|
+
picks are not known in round 1, the trade-off card moves to round 2 with
|
|
64
|
+
the target cards (still max 3 cards per call; split into a second call if
|
|
65
|
+
needed). §13 never exceeds 6 cards of the 12-question cap.
|
|
66
|
+
- A goal the user already named in their message is answered — no card for
|
|
67
|
+
it (interview.md hard rule 3); its Target, when given, is `stated`.
|
|
68
|
+
- The user said not to ask ("don't ask me any"): no card. Fill a slot
|
|
69
|
+
only with a candidate that passes §2 on its own quote — never pad to 3.
|
|
70
|
+
The weakest quote gives way first. Target from the input, else `Not
|
|
71
|
+
provided — not asked`.
|
|
72
|
+
- A slot still empty (declined, or fewer than 3 candidates) renders its
|
|
73
|
+
Goal cell as `Not provided — <who declined/why>` (e.g. `Not provided —
|
|
74
|
+
user named only 1`). Never invent a goal to
|
|
75
|
+
fill a row.
|
|
76
|
+
- `No target yet` renders the Target cell `Not provided — no target set`.
|
|
77
|
+
|
|
78
|
+
## 5. Provenance
|
|
79
|
+
|
|
80
|
+
`src` is the source of the Target (writing.md §3a), never of the pick: a
|
|
81
|
+
Target quoted from the input or an answer is `stated`; one you suggested is
|
|
82
|
+
`proposed`. A `Not provided` Target has no source, so its `src` is
|
|
83
|
+
`proposed`, never `stated`. An unconfirmed pick does not change `src`. The trade-off pick
|
|
84
|
+
is recorded only by the "(gives way first)" label.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Research — phase order, workflow invocation, provenance rules
|
|
2
2
|
|
|
3
|
-
Read during the research phase (SKILL.md step
|
|
3
|
+
Read during the research phase (SKILL.md step 5), after the interview and
|
|
4
4
|
before any writing starts. Defines the order research runs in, exactly how to
|
|
5
5
|
invoke `workflows/research.js`, and how provenance travels from its result
|
|
6
6
|
into ARCHITECTURE.md.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Rewriting — what is already on disk
|
|
2
2
|
|
|
3
|
-
Read before step
|
|
3
|
+
Read before step 6 writes anything. The gate (§3) runs on every run, before the
|
|
4
4
|
first write; the recording (§5) closes every run. Only what they find differs —
|
|
5
5
|
a first run has no record to compare against, and the documents it finds
|
|
6
6
|
already on disk are, by that fact, not ours.
|
|
@@ -34,6 +34,11 @@ Before writing, run:
|
|
|
34
34
|
List every file this run intends to write. Paths are relative to the state
|
|
35
35
|
file. Exit codes: `0` nothing drifted, `2` something drifted, `1` usage error.
|
|
36
36
|
|
|
37
|
+
`interview-log.md` is not passed to the gate: the skill owns it and only
|
|
38
|
+
appends (step 4 writes it before this gate runs), so the gate would flag the
|
|
39
|
+
skill's own entries as `untracked` or `drifted`. `record.mjs` still records
|
|
40
|
+
it at the end of the run.
|
|
41
|
+
|
|
37
42
|
| verdict | meaning | what to do |
|
|
38
43
|
|---|---|---|
|
|
39
44
|
| `unchanged` | matches what we wrote | write it |
|
|
@@ -59,7 +64,7 @@ No merge. No three-way resolution. Detect, show, ask which wins, obey.
|
|
|
59
64
|
## 5. Recording what you wrote
|
|
60
65
|
|
|
61
66
|
The gate can only compare against a record, and nothing writes that record on
|
|
62
|
-
its own. **The last thing step
|
|
67
|
+
its own. **The last thing step 6 does**, once every document is on disk:
|
|
63
68
|
|
|
64
69
|
node scripts/record.mjs --state <package>/architecture-state.json \
|
|
65
70
|
--files ARCHITECTURE.md docs/architecture/validation-plan.md docs/adr/0001-….md
|
|
@@ -170,16 +170,17 @@ Four steps, in order — each feeds the next:
|
|
|
170
170
|
|
|
171
171
|
| Href | Becomes |
|
|
172
172
|
|---|---|
|
|
173
|
-
| relative path resolving to a document in the set | in-page anchor, fragment
|
|
173
|
+
| relative path resolving to a document in the set | in-page anchor; a fragment naming one of the target's h2/h3 headings jumps to it, any other fragment falls back to the document |
|
|
174
174
|
| any other relative path — `.c4`, a directory, `/site/root` | `.ext-ref` span, path kept in `title` |
|
|
175
|
-
| `#anchor` | untouched |
|
|
175
|
+
| `#anchor` | resolved against this document's own h2/h3 headings; anything else (a view panel, a doc head) untouched |
|
|
176
176
|
| `https:`, `mailto:`, `//host` | untouched |
|
|
177
177
|
|
|
178
178
|
The test is "is this a relative path", not a list of extensions: a `.c4` model
|
|
179
179
|
or a `docs/` directory can never be a document in the set, so it is exactly as
|
|
180
|
-
dead as an unresolved `.md` and reads better as text.
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
dead as an unresolved `.md` and reads better as text. A fragment is resolved to the heading id the page carries: outside
|
|
181
|
+
ARCHITECTURE.md every h2/h3 id is prefixed with its document's file slug
|
|
182
|
+
(`0007-cache__context`), so the same heading in two documents never collides
|
|
183
|
+
and `#context` inside an ADR stays in that ADR.
|
|
183
184
|
|
|
184
185
|
Unwrapping is also a cheap link check: anything that comes out as `.ext-ref`
|
|
185
186
|
either lives outside the set or does not exist. In the EOS set it surfaced
|
|
@@ -236,7 +237,7 @@ recorded next to `SPINE_TITLES` in `section-help.mjs`:
|
|
|
236
237
|
surrounding spaces, so `Goals & Scope` slugifies to `goals--scope` — a shape
|
|
237
238
|
nobody would guess from the JSON key `"Goals & Scope"`.
|
|
238
239
|
- `h2` and `h3` ids share one dedupe registry (`scripts/lib/slug-registry.mjs`)
|
|
239
|
-
|
|
240
|
+
within one document. An `h3` in the spine named "Security" ahead of
|
|
240
241
|
§12 would take the plain `security` slug and demote the real Security
|
|
241
242
|
heading to `security-2`, with nothing to flag it. Heading text does not
|
|
242
243
|
move when an unrelated document changes; a slug can.
|
|
@@ -647,6 +648,9 @@ Four things that are easy to get wrong:
|
|
|
647
648
|
`#doc-adr-0002-multi-tenancy` while the panel says ADR 0002, and neither is what
|
|
648
649
|
somebody would paste. The listener is on `document`, not `.doc`, because an open
|
|
649
650
|
record is no longer inside `.doc` and one record links to another.
|
|
651
|
+
- **A link to a heading inside a record** opens the drawer scrolled to that
|
|
652
|
+
heading (D20). The address bar then shows only the record's route
|
|
653
|
+
`#/<record>`, so a copied URL reopens the record at its top.
|
|
650
654
|
- **`inert` has to come off on close.** It is set on three elements and cleared in
|
|
651
655
|
`closeDrawer`, which runs on every path out — leaving it on makes the whole page
|
|
652
656
|
unfocusable with no visible cause.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Writing — spine contract, one-home-per-fact, src-column rules
|
|
2
2
|
|
|
3
|
-
Read during the writing phase (SKILL.md step
|
|
3
|
+
Read during the writing phase (SKILL.md step 6), after research completes.
|
|
4
4
|
This file is the writer's single source for ARCHITECTURE.md's structure and
|
|
5
5
|
for the conventions every companion and mattpocock-convention file follows.
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ frontmatter: name · repo · team · updated · mode · projectType · docVersio
|
|
|
24
24
|
1 Goals & Scope
|
|
25
25
|
2 Constraints
|
|
26
26
|
3 Project Structure brownfield only: fs-generated tree depth ≤2 + boundary map
|
|
27
|
-
4 Solution Strategy ≤5
|
|
27
|
+
4 Solution Strategy table, ≤5 rows: Decision · Serves · ADR · src; never restates rationale
|
|
28
28
|
5 Architecture Model LikeC4 C1/C2/C3 views, no prose
|
|
29
29
|
6 Core Components table: responsibility, tech, deploy unit, key paths, context, invariants
|
|
30
30
|
7 Runtime Behaviour 2–4 LikeC4 dynamic views, named flows only
|
|
@@ -35,7 +35,7 @@ frontmatter: name · repo · team · updated · mode · projectType · docVersio
|
|
|
35
35
|
11 Crosscutting Concepts observability, error handling, validation, config/secrets,
|
|
36
36
|
auth mechanics, testing strategy
|
|
37
37
|
12 Security mermaid DFD + trust boundaries, authz model, link to threat model
|
|
38
|
-
13 Quality Requirements & SLOs
|
|
38
|
+
13 Quality Requirements & SLOs table, 3 rows: Goal · Target · Brief says · src; + "Also considered" list
|
|
39
39
|
14 Decisions generated index of docs/adr/ (root + per-context)
|
|
40
40
|
15 Risks & Technical Debt
|
|
41
41
|
16 Glossary generated from all CONTEXT.md files; omitted if <5 terms, and says so
|
|
@@ -116,10 +116,52 @@ two homes is a defect, not redundancy:
|
|
|
116
116
|
- Values are one of the four provenance words: `observed` · `stated` ·
|
|
117
117
|
`researched` · `proposed`. `researched` is always followed by a bracketed
|
|
118
118
|
source: `researched [source]`.
|
|
119
|
+
- `stated` is always followed by its citation:
|
|
120
|
+
- from a client input: `stated [C1 · 2026-09-10](inputs/C1-kickoff-call.txt) "exact quote"` —
|
|
121
|
+
the quote copied from a fact `check-quotes.mjs` verified, in straight
|
|
122
|
+
double quotes; if the span holds double quotes itself, quote a shorter span without double quotes or `|` (a pipe splits the table cell);
|
|
123
|
+
- from the interview: `stated [Q3 · 2026-10-14](interview-log.md#q3)` — no quote.
|
|
124
|
+
- from a business-analyst package: `stated [FR-001 · kickoff call 2026-08-20](requirements.json)` —
|
|
125
|
+
row id and the BA's source, no quote. `validate.mjs` fails an id that is not
|
|
126
|
+
in the package or a row the BA did not mark confirmed.
|
|
127
|
+
The path is relative to ARCHITECTURE.md. `validate.mjs` checks the quote
|
|
128
|
+
word for word; a bare `stated` is a `WARN`.
|
|
129
|
+
- A row's `src` covers the whole row. When a `proposed` (or `researched`)
|
|
130
|
+
row carries a value the client stated — a threshold, a limit, a name —
|
|
131
|
+
cite that value in its cell, right after it, and leave the row's tag
|
|
132
|
+
alone: `applies the 0.72 floor (stated [D1 · 2026-10-01](inputs/D1-spec.md) "confidence below 0.72")`.
|
|
133
|
+
`validate.mjs` checks an inline quote exactly like one in `src`. Never
|
|
134
|
+
re-tag the row `stated` to keep the value: the design is still yours.
|
|
135
|
+
- In the viewer an interview citation jumps to its answer (`#q3`) in the log; an input citation
|
|
136
|
+
shows as text with its path on hover (inputs are not part of the page).
|
|
119
137
|
- Generated-index tables are exempt: `Decisions` (§14) and `Glossary` (§16)
|
|
120
138
|
carry no `src` column — they're derived from `docs/adr/` and `CONTEXT.md`
|
|
121
139
|
files, not asserted facts.
|
|
122
140
|
|
|
141
|
+
## 3a. §4 and §13 — the top-3 tie
|
|
142
|
+
|
|
143
|
+
- **§13** has exactly 3 rows, columns `Goal · Target · Brief says · src`.
|
|
144
|
+
Goal names come from `quality-goals.md` §1, spelled exactly. One Goal cell
|
|
145
|
+
ends ` (gives way first)` when there are 2+ goals. An empty slot is a row
|
|
146
|
+
whose Goal is `Not provided — <reason>`. `Brief says` is the quote the goal
|
|
147
|
+
was picked from; `src` is the source of the Target.
|
|
148
|
+
- Under the table, `Also considered:` — one bullet per runner-up or rejected
|
|
149
|
+
candidate, with the reason, ending in its backticked provenance word.
|
|
150
|
+
- **§4** is a table, ≤ 5 rows, `Decision · Serves · ADR · src`. `Serves`
|
|
151
|
+
lists one or more §13 goals, comma-separated, spelled as in §13. Every
|
|
152
|
+
§13 goal appears in at least one `Serves`. The reasoning lives in the ADR;
|
|
153
|
+
`Serves` is a pointer, not a rationale.
|
|
154
|
+
- `validate.mjs` (`validate-strategy.mjs`) enforces the 3-row count, the
|
|
155
|
+
gives-way-first count, every Serves name being a §13 goal, and every goal
|
|
156
|
+
being served. When §13 has no real goal (all `Not provided`), the Serves
|
|
157
|
+
checks are skipped. Catalogue spelling, ≤ 5 rows, Brief says and Also
|
|
158
|
+
considered are on the writer. A set written before it (bullets in §4, no
|
|
159
|
+
Goal column in §13) only warns.
|
|
160
|
+
|
|
161
|
+
| Decision | Serves | ADR | src |
|
|
162
|
+
| --- | --- | --- | --- |
|
|
163
|
+
| Single web app + one database | Uptime, Low cost | [ADR-001](docs/adr/0001-single-app.md) | proposed |
|
|
164
|
+
|
|
123
165
|
## 3b. Diagram embed convention
|
|
124
166
|
|
|
125
167
|
- **LikeC4 views**: a marker on its own line, `<!-- likec4:view <view-id> -->`.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { isPackage, baRows, isStated } from './lib/ba-package.mjs';
|
|
3
|
+
|
|
4
|
+
// Reads a business-analyst requirements.json into facts, split by the BA's
|
|
5
|
+
// label: `facts` may be cited `stated`, `proposed` never is
|
|
6
|
+
// (references/extract.md §2.2). No agent reads the package.
|
|
7
|
+
|
|
8
|
+
function parseArgs(argv) {
|
|
9
|
+
const args = {};
|
|
10
|
+
for (let i = 0; i < argv.length; i += 2) args[argv[i].slice(2)] = argv[i + 1];
|
|
11
|
+
return args;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function readPackage(path) {
|
|
15
|
+
try { return JSON.parse(readFileSync(path, 'utf8')); } catch { return null; }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const args = parseArgs(process.argv.slice(2));
|
|
19
|
+
if (!args.json || !args.out) {
|
|
20
|
+
console.log('FAIL usage: ba-facts.mjs --json <requirements.json> --out <file>');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
const pkg = readPackage(args.json);
|
|
24
|
+
if (!isPackage(pkg)) {
|
|
25
|
+
console.log(`FAIL ${args.json} is not a requirements package`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const rows = baRows(pkg).map((r) => ({ ...r, path: args.json }));
|
|
29
|
+
const facts = rows.filter(isStated);
|
|
30
|
+
const proposed = rows.filter((r) => !isStated(r));
|
|
31
|
+
writeFileSync(args.out, JSON.stringify({ facts, proposed }, null, 2));
|
|
32
|
+
console.log(`ok ${facts.length} confirmed facts, ${proposed.length} not confirmed (assumed or recommended)`);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { normalize, closestSentence } from './lib/validate-quotes.mjs';
|
|
3
|
+
|
|
4
|
+
// Gate between extraction and the interview (references/extract.md): a fact
|
|
5
|
+
// whose quote is not in its file never reaches the main agent as `stated`.
|
|
6
|
+
// Misses go back to their extract agent once; what still misses is dropped.
|
|
7
|
+
|
|
8
|
+
function parseArgs(argv) {
|
|
9
|
+
const args = {};
|
|
10
|
+
for (let i = 0; i < argv.length; i += 2) args[argv[i].slice(2)] = argv[i + 1];
|
|
11
|
+
return args;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function readSource(path, cache) {
|
|
15
|
+
if (!cache.has(path)) {
|
|
16
|
+
try { cache.set(path, readFileSync(path, 'utf8')); } catch { cache.set(path, null); }
|
|
17
|
+
}
|
|
18
|
+
return cache.get(path);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function missOf(fact, cache) {
|
|
22
|
+
if (!normalize(fact.quote ?? '')) return { ...fact, closest: 'empty quote' };
|
|
23
|
+
const text = readSource(fact.path, cache);
|
|
24
|
+
if (text === null) return { ...fact, closest: `file not readable: ${fact.path}` };
|
|
25
|
+
if (normalize(text).includes(normalize(fact.quote))) return null;
|
|
26
|
+
return { ...fact, closest: closestSentence(text, fact.quote) };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const args = parseArgs(process.argv.slice(2));
|
|
30
|
+
const { facts } = JSON.parse(readFileSync(args.facts, 'utf8'));
|
|
31
|
+
const cache = new Map();
|
|
32
|
+
const checked = facts.map((f) => ({ fact: f, miss: missOf(f, cache) }));
|
|
33
|
+
const kept = checked.filter((c) => !c.miss).map((c) => c.fact);
|
|
34
|
+
const misses = checked.filter((c) => c.miss).map((c) => c.miss);
|
|
35
|
+
|
|
36
|
+
for (const m of misses) console.log(`MISS [${m.src}] "${m.quote}" — closest: "${m.closest}"`);
|
|
37
|
+
console.log(`ok ${kept.length} quotes verified, ${misses.length} missed`);
|
|
38
|
+
writeFileSync(args.out, JSON.stringify({ facts: kept, misses }, null, 2));
|
|
39
|
+
process.exit(misses.length ? 1 : 0);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// A business-analyst package (requirements.json) arrives already sourced:
|
|
2
|
+
// each row has an id, a label and where it came from. A script reads it, so
|
|
3
|
+
// no extract agent and no quote matching: the id is the anchor. Only a row
|
|
4
|
+
// the BA confirmed may become `stated` (references/extract.md §2.2).
|
|
5
|
+
const SECTIONS = {
|
|
6
|
+
requirements: 'goals and scope',
|
|
7
|
+
systems: 'goals and scope',
|
|
8
|
+
features: 'goals and scope',
|
|
9
|
+
businessRules: 'goals and scope',
|
|
10
|
+
constraints: 'constraints',
|
|
11
|
+
nfrs: 'quality',
|
|
12
|
+
integrations: 'external systems and integrations',
|
|
13
|
+
data: 'data and its sensitivity',
|
|
14
|
+
};
|
|
15
|
+
const FACT = {
|
|
16
|
+
integrations: (r) => `${r.system} (${r.direction})`,
|
|
17
|
+
data: (r) => [r.entity, r.sensitivity, r.volume].filter(Boolean).join(', '),
|
|
18
|
+
};
|
|
19
|
+
const textOf = (r) => r.text ?? r.rule ?? r.purpose ?? r.name ?? '';
|
|
20
|
+
|
|
21
|
+
export function isPackage(value) {
|
|
22
|
+
return Boolean(value && value.schemaVersion && Array.isArray(value.requirements));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Constraints and business rules carry a source but no label: the BA records
|
|
26
|
+
// them only once confirmed (business-analyst references/writing.md).
|
|
27
|
+
function rowOf(row, key, updated) {
|
|
28
|
+
const label = row.label ?? (row.source ? 'confirmed' : 'unlabelled');
|
|
29
|
+
const fact = (FACT[key] ?? textOf)(row);
|
|
30
|
+
const source = row.source ?? null;
|
|
31
|
+
return { id: row.id, fact, label, source, section: SECTIONS[key], cite: `${row.id} · ${source ?? updated}` };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function baRows(pkg) {
|
|
35
|
+
return Object.keys(SECTIONS).flatMap((key) => (Array.isArray(pkg[key]) ? pkg[key] : [])
|
|
36
|
+
.filter((row) => row && typeof row === 'object')
|
|
37
|
+
.map((row) => rowOf(row, key, pkg.updated))
|
|
38
|
+
.filter((r) => r.id));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function isStated(row) {
|
|
42
|
+
return row.label === 'confirmed';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The text a quote may match: confirmed rows only, never assumed or recommended.
|
|
46
|
+
export function statedText(rows) {
|
|
47
|
+
return rows.filter(isStated).map((r) => r.fact).join('\n');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// packages maps root-relative path → baRows. A citation's label starts with
|
|
51
|
+
// the row id (`FR-001 · kickoff call`); any quote it carries is checked by
|
|
52
|
+
// validate-quotes against the package's row texts, not here.
|
|
53
|
+
// The pair rule (D22): when requirements.json sits beside requirements.md, the
|
|
54
|
+
// .md is for people and is never cited.
|
|
55
|
+
function pairRule(c, packages) {
|
|
56
|
+
const json = c.path.replace(/(^|\/)requirements\.md$/, '$1requirements.json');
|
|
57
|
+
if (json === c.path || !packages.has(json)) return null;
|
|
58
|
+
return [{ check: 'quotes', message: `${c.path} is the BA package for people; cite ${json} by row id` }];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function validateBaCitations({ citations, packages }) {
|
|
62
|
+
const paired = citations.flatMap((c) => pairRule(c, packages) ?? []);
|
|
63
|
+
return [...paired, ...citedRows({ citations, packages })];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function citedRows({ citations, packages }) {
|
|
67
|
+
return citations.filter((c) => packages.has(c.path)).flatMap((c) => {
|
|
68
|
+
const id = c.label.split('·')[0].trim();
|
|
69
|
+
const row = packages.get(c.path).find((r) => r.id === id);
|
|
70
|
+
if (!row) return [{ check: 'quotes', message: `${id} is not in ${c.path}` }];
|
|
71
|
+
if (!isStated(row)) return [{ check: 'quotes', message: `${id} is ${row.label} in ${c.path}; only confirmed rows are stated` }];
|
|
72
|
+
if (c.label.trim() === row.cite) return [];
|
|
73
|
+
return [{ check: 'quotes', message: `${c.label.trim()} does not match ${c.path}; cite it as ${row.cite}` }];
|
|
74
|
+
});
|
|
75
|
+
}
|