@v11g/agents-rock 1.0.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.
Files changed (223) hide show
  1. package/README.md +65 -0
  2. package/bin/agents-rock.mjs +4 -0
  3. package/package.json +13 -0
  4. package/plugins/solution-architect/.claude-plugin/plugin.json +9 -0
  5. package/plugins/solution-architect/skills/analyze-requirements/README.md +75 -0
  6. package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +31 -0
  7. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/OFL.txt +98 -0
  8. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  9. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  10. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  11. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  12. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
  13. package/plugins/solution-architect/skills/analyze-requirements/assets/mermaid-theme.json +52 -0
  14. package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +101 -0
  15. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +2389 -0
  16. package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +53 -0
  17. package/plugins/solution-architect/skills/analyze-requirements/references/likec4.md +157 -0
  18. package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +60 -0
  19. package/plugins/solution-architect/skills/analyze-requirements/references/research.md +78 -0
  20. package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +772 -0
  21. package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +206 -0
  22. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +74 -0
  23. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/chrome.mjs +66 -0
  24. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/companion-links.mjs +20 -0
  25. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-kinds.mjs +37 -0
  26. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +26 -0
  27. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +27 -0
  28. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-sections.mjs +78 -0
  29. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/embed.mjs +8 -0
  30. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/er-entities.mjs +16 -0
  31. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/fonts.mjs +39 -0
  32. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/frontmatter.mjs +17 -0
  33. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +41 -0
  34. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-config.mjs +41 -0
  35. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-extract.mjs +29 -0
  36. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-steps.mjs +22 -0
  37. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-defs.mjs +20 -0
  38. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-flows.mjs +46 -0
  39. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-inline.mjs +31 -0
  40. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-links.mjs +7 -0
  41. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-list.mjs +64 -0
  42. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +127 -0
  43. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-shape.mjs +19 -0
  44. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-tables.mjs +30 -0
  45. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-views.mjs +48 -0
  46. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-wide.mjs +44 -0
  47. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/nav.mjs +72 -0
  48. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/offline.mjs +19 -0
  49. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/port.mjs +13 -0
  50. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +113 -0
  51. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +49 -0
  52. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/slug-registry.mjs +11 -0
  53. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-clusters.mjs +15 -0
  54. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-deployment.mjs +8 -0
  55. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-elections.mjs +20 -0
  56. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-links.mjs +23 -0
  57. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-model-tables.mjs +24 -0
  58. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-palette.mjs +34 -0
  59. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +20 -0
  60. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-tree.mjs +16 -0
  61. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-config.mjs +19 -0
  62. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-export.mjs +35 -0
  63. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-gen.mjs +39 -0
  64. package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +130 -0
  65. package/plugins/solution-architect/skills/analyze-requirements/scripts/serve.mjs +71 -0
  66. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +553 -0
  67. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/companion-links.test.mjs +60 -0
  68. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-kinds.test.mjs +41 -0
  69. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +104 -0
  70. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-routes.test.mjs +54 -0
  71. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-sections.test.mjs +197 -0
  72. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/embed.test.mjs +28 -0
  73. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/er-entities.test.mjs +14 -0
  74. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/ARCHITECTURE.md +47 -0
  75. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/broken/model.c4 +27 -0
  76. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/pass/model.c4 +29 -0
  77. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/adr/0001-sample.md +18 -0
  78. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimate.html +2 -0
  79. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimation.md +8 -0
  80. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model-broken.json +1 -0
  81. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model.json +1 -0
  82. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/threat-model.md +8 -0
  83. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample-model.json +1 -0
  84. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample.c4 +28 -0
  85. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fonts.test.mjs +38 -0
  86. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/frontmatter.test.mjs +27 -0
  87. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +72 -0
  88. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config-cli.test.mjs +26 -0
  89. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config.test.mjs +74 -0
  90. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-export-cli.test.mjs +61 -0
  91. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-extract.test.mjs +37 -0
  92. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-gen-cli.test.mjs +73 -0
  93. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-steps.test.mjs +32 -0
  94. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-flows.test.mjs +82 -0
  95. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-links.test.mjs +16 -0
  96. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-provenance.test.mjs +42 -0
  97. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +226 -0
  98. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-tables.test.mjs +30 -0
  99. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-views.test.mjs +76 -0
  100. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-wide.test.mjs +76 -0
  101. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/nav.test.mjs +236 -0
  102. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/offline.test.mjs +37 -0
  103. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +86 -0
  104. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gates.test.mjs +20 -0
  105. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +171 -0
  106. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/research-workflow.test.mjs +38 -0
  107. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +101 -0
  108. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/serve.test.mjs +48 -0
  109. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-clusters.test.mjs +46 -0
  110. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-deployment.test.mjs +23 -0
  111. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-elections.test.mjs +30 -0
  112. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-links.test.mjs +38 -0
  113. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-model-tables.test.mjs +51 -0
  114. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +28 -0
  115. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-tree.test.mjs +43 -0
  116. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/viewer-template.test.mjs +1206 -0
  117. package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +88 -0
  118. package/plugins/solution-architect/skills/analyze-requirements/workflows/research.js +57 -0
  119. package/plugins/solution-architect/skills/estimate/README.md +67 -0
  120. package/plugins/solution-architect/skills/estimate/SKILL.md +64 -0
  121. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +1128 -0
  122. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +95 -0
  123. package/plugins/solution-architect/skills/estimate/references/interview.md +80 -0
  124. package/plugins/solution-architect/skills/estimate/references/slicing.md +55 -0
  125. package/plugins/solution-architect/skills/estimate/references/techniques.md +111 -0
  126. package/plugins/solution-architect/skills/estimate/references/writing.md +211 -0
  127. package/plugins/solution-architect/skills/estimate/scripts/compute.mjs +23 -0
  128. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +128 -0
  129. package/plugins/solution-architect/skills/estimate/scripts/lib/components.mjs +19 -0
  130. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +85 -0
  131. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +10 -0
  132. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +30 -0
  133. package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +32 -0
  134. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +122 -0
  135. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +128 -0
  136. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +65 -0
  137. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +623 -0
  138. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +88 -0
  139. package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +34 -0
  140. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +112 -0
  141. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +58 -0
  142. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +30 -0
  143. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +60 -0
  144. package/plugins/solution-architect/skills/estimate/scripts/test/quality-gates.test.mjs +20 -0
  145. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +71 -0
  146. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +121 -0
  147. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +129 -0
  148. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +72 -0
  149. package/plugins/solution-architect/skills/estimate/scripts/validate.mjs +20 -0
  150. package/plugins/solution-architect/skills/new-lead/README.md +48 -0
  151. package/plugins/solution-architect/skills/new-lead/SKILL.md +113 -0
  152. package/plugins/solution-architect/skills/new-lead/assets/dashboard/detail.html +842 -0
  153. package/plugins/solution-architect/skills/new-lead/assets/dashboard/index.html +655 -0
  154. package/plugins/solution-architect/skills/new-lead/assets/dashboard/start.sh +3 -0
  155. package/plugins/solution-architect/skills/new-lead/assets/dashboard/stats.mjs +98 -0
  156. package/plugins/solution-architect/skills/new-lead/assets/dashboard/vendor/reactflow-bundle.js +473 -0
  157. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/entry.jsx +33 -0
  158. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package-lock.json +1055 -0
  159. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package.json +19 -0
  160. package/plugins/solution-architect/skills/new-lead/scripts/init-root.mjs +73 -0
  161. package/plugins/solution-architect/skills/new-lead/scripts/lead-upsert.mjs +31 -0
  162. package/plugins/solution-architect/skills/new-lead/scripts/lib/enrich.mjs +20 -0
  163. package/plugins/solution-architect/skills/new-lead/scripts/lib/map-nodes.mjs +124 -0
  164. package/plugins/solution-architect/skills/new-lead/scripts/lib/map.mjs +117 -0
  165. package/plugins/solution-architect/skills/new-lead/scripts/lib/port.mjs +15 -0
  166. package/plugins/solution-architect/skills/new-lead/scripts/lib/registry.mjs +116 -0
  167. package/plugins/solution-architect/skills/new-lead/scripts/serve.mjs +163 -0
  168. package/plugins/solution-architect/skills/new-lead/scripts/test/e2e-workspace.test.mjs +59 -0
  169. package/plugins/solution-architect/skills/new-lead/scripts/test/enrich.test.mjs +16 -0
  170. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/ARCHITECTURE.md +16 -0
  171. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/brief.md +4 -0
  172. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/index.html +11 -0
  173. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/proposal-non-tech.html +2 -0
  174. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/threat-model.html +2 -0
  175. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation-inputs.json +6 -0
  176. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation.json +10 -0
  177. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/notes.md +3 -0
  178. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/proposal-non-tech.md +3 -0
  179. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/rfp.md +3 -0
  180. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads.json +25 -0
  181. package/plugins/solution-architect/skills/new-lead/scripts/test/init-root.test.mjs +81 -0
  182. package/plugins/solution-architect/skills/new-lead/scripts/test/lead-upsert.test.mjs +67 -0
  183. package/plugins/solution-architect/skills/new-lead/scripts/test/map.test.mjs +72 -0
  184. package/plugins/solution-architect/skills/new-lead/scripts/test/port.test.mjs +31 -0
  185. package/plugins/solution-architect/skills/new-lead/scripts/test/registry-io.test.mjs +57 -0
  186. package/plugins/solution-architect/skills/new-lead/scripts/test/registry.test.mjs +49 -0
  187. package/plugins/solution-architect/skills/new-lead/scripts/test/serve.test.mjs +205 -0
  188. package/plugins/solution-architect/skills/new-lead/scripts/test/stats.test.mjs +92 -0
  189. package/plugins/solution-architect/skills/new-lead/scripts/test/validate-cli.test.mjs +24 -0
  190. package/plugins/solution-architect/skills/new-lead/scripts/test/vendor-bundle.test.mjs +9 -0
  191. package/plugins/solution-architect/skills/new-lead/scripts/validate.mjs +9 -0
  192. package/plugins/solution-architect/skills/proposal/README.md +36 -0
  193. package/plugins/solution-architect/skills/proposal/SKILL.md +58 -0
  194. package/plugins/solution-architect/skills/proposal/assets/proposal-template.html +82 -0
  195. package/plugins/solution-architect/skills/proposal/references/interview.md +63 -0
  196. package/plugins/solution-architect/skills/proposal/references/review.md +28 -0
  197. package/plugins/solution-architect/skills/proposal/references/writing.md +102 -0
  198. package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +22 -0
  199. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +75 -0
  200. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +54 -0
  201. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +17 -0
  202. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +43 -0
  203. package/plugins/solution-architect/skills/proposal/scripts/lib/jargon.mjs +9 -0
  204. package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +32 -0
  205. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +60 -0
  206. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +144 -0
  207. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +93 -0
  208. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +51 -0
  209. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +30 -0
  210. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +81 -0
  211. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +22 -0
  212. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +55 -0
  213. package/plugins/solution-architect/skills/proposal/scripts/test/quality-gates.test.mjs +20 -0
  214. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +70 -0
  215. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +40 -0
  216. package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +20 -0
  217. package/src/cli/agents.mjs +12 -0
  218. package/src/cli/args.mjs +46 -0
  219. package/src/cli/install.mjs +68 -0
  220. package/src/cli/main.mjs +124 -0
  221. package/src/cli/picker.mjs +78 -0
  222. package/src/cli/registry.mjs +26 -0
  223. package/src/cli/uninstall.mjs +38 -0
@@ -0,0 +1,102 @@
1
+ # Writing — frontmatter contract, ten sections, language rules
2
+
3
+ Read while writing proposal.md. The validator enforces everything below;
4
+ a document that satisfies this file passes `validate.mjs` by construction.
5
+
6
+ ## 1. Frontmatter (flat keys — the shared parser is flat key:value)
7
+
8
+ ```yaml
9
+ ---
10
+ client: Acme Corp
11
+ client_tech_level: non-tech # non-tech | low-tech | technical
12
+ scenario: 2eng-max5x # must exist in estimation.json
13
+ currency: USD
14
+ valid_until: 2026-09-06 # ISO date, must be in the future
15
+ jargon_allow: [] # optional, JSON array
16
+ source_architecture: ../ARCHITECTURE.md
17
+ source_estimation: ../estimation.json
18
+ ---
19
+ ```
20
+
21
+ ## 2. Numbers — the one rule that matters most
22
+
23
+ **Never write a number that `scripts/derive.mjs` did not output.** Run it
24
+ first, keep proposal-figures.json open, and use only those values: the cost
25
+ range, the duration range, and the per-milestone splits. Money is written
26
+ `$8,000` (en-US grouping); durations are written `1.6–2.4 months`. The
27
+ validator extracts every money amount and duration (ranges and single
28
+ mentions) in the document and refuses any value the derivation didn't
29
+ produce — and it recomputes the
30
+ figures from estimation.json itself, so editing proposal-figures.json by
31
+ hand changes nothing.
32
+
33
+ Rates never appear. Team members are described by role/seniority only.
34
+
35
+ ## 3. The ten sections, in order (all `##`, exact names)
36
+
37
+ 1. **Executive Summary** — problem, solution, headline cost range, headline
38
+ duration range. One page. The headline ranges are mandatory: the
39
+ validator requires cost low/high and months low/high to appear.
40
+ 2. **Background & Objectives** — the client's problem in their words, then
41
+ measurable goals.
42
+ 3. **Proposed Solution** — what we build, in the client's language, plus
43
+ exactly the depth the tech level allows (see §4). Must contain one
44
+ `mermaid` code fence — non-tech gets boxes-and-arrows with ≤ 6 nodes.
45
+ 4. **Scope** — in-scope features as a table, phrased as client outcomes.
46
+ More than ~8 rows: split into several tables grouped under `###`
47
+ subheads named after product areas the client recognizes. `###` lines
48
+ do not break section slicing; each table still validates on its own.
49
+ 5. **Out of Scope & Assumptions** — explicit exclusions (from estimation.md
50
+ plus the interview) and the assumptions the estimate rests on.
51
+ 6. **Delivery Approach** — milestones with their duration ranges, ways of
52
+ working, QA, communication cadence, and the client-relevant risks with
53
+ mitigations. The full risk register stays internal.
54
+ 7. **Investment & Timeline** — the milestone table: Duration and Investment
55
+ columns from the figures, then the bold total line and the sentence
56
+ explaining the range reflects estimation confidence.
57
+ 8. **Team** — roles from the chosen scenario's team (seniority, count),
58
+ never rates.
59
+ 9. **About <firm>** — blurb, relevant work, contact, from the profile. The
60
+ jargon scan skips this section.
61
+ 10. **Next Steps** — the valid_until date in prose, the acceptance path,
62
+ and a call to action.
63
+
64
+ ## 4. Tech-level language
65
+
66
+ - **non-tech** — plain words only; analogies over architecture; the
67
+ deny-list (scripts/lib/jargon.mjs — e.g. api, kubernetes, backend) fails
68
+ validation outside About. Diagram shows what the client sees, not
69
+ containers.
70
+ - **low-tech** — everyday product vocabulary is fine (website, app,
71
+ database); no infrastructure or tooling terms.
72
+ - **technical** — full stack detail welcome; the diagram may show
73
+ containers and technology labels.
74
+
75
+ ## 5. What must never appear
76
+
77
+ Other scenarios (ids, names, or comparisons), provenance vocabulary
78
+ (`observed`/`stated`/`researched`/`proposed` as table cells or a `src`
79
+ column), `data-internal`, placeholder text of any spelling, empty tables,
80
+ and any number the derivation didn't produce — all of these fail
81
+ `validate.mjs`. Rates, internal risk ids, and confidence internals must
82
+ never appear either, but no script can recognize them reliably: the
83
+ fresh-eyes review (`references/review.md` charter item 4) and your own
84
+ read before rendering are the gate for those. Unknowns are honest
85
+ absences — if something isn't known, say so in plain words or leave it
86
+ out.
87
+
88
+ ## 6. Placement + commands
89
+
90
+ proposal.md, proposal-figures.json beside ARCHITECTURE.md/estimation.md.
91
+ Run from `plugins/solution-architect/skills/proposal/`:
92
+
93
+ ```
94
+ node scripts/derive.mjs --estimation <dir>/estimation.json --scenario <id> --out <dir>/proposal-figures.json
95
+ node scripts/validate.mjs --md <dir>/proposal.md --estimation <dir>/estimation.json
96
+ node scripts/render.mjs --md <dir>/proposal.md --estimation <dir>/estimation.json --mermaid-bundle <path> --out <out-dir>
97
+ node ../analyze-requirements/scripts/serve.mjs <out-dir>
98
+ ```
99
+
100
+ `<out-dir>` is `<dir>/dist/` — the one rendered-pages folder, shared with the
101
+ analyze-requirements viewer (proposal.html ships beside index.html and
102
+ estimate.html).
@@ -0,0 +1,22 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+ import { deriveFigures } from './lib/figures.mjs';
3
+
4
+ function parseArgs(argv) {
5
+ const args = {};
6
+ for (let i = 0; i < argv.length; i += 1) {
7
+ if (argv[i].startsWith('--')) args[argv[i].slice(2)] = argv[++i];
8
+ }
9
+ return args;
10
+ }
11
+
12
+ const args = parseArgs(process.argv.slice(2));
13
+ const estimation = JSON.parse(readFileSync(args.estimation, 'utf8'));
14
+ let figures;
15
+ try {
16
+ figures = deriveFigures(estimation, args.scenario);
17
+ } catch (e) {
18
+ console.error(e.message);
19
+ process.exit(1);
20
+ }
21
+ writeFileSync(args.out, `${JSON.stringify(figures, null, 2)}\n`);
22
+ console.log(args.out);
@@ -0,0 +1,75 @@
1
+ // Client-safety half of the proposal gate: every number traces to the
2
+ // derived figures, nothing internal leaks, and non-tech documents carry no
3
+ // jargon outside the About section.
4
+ import { deriveFigures } from './figures.mjs';
5
+ import { sectionText, escapeRegExp } from './sections.mjs';
6
+ import { JARGON } from './jargon.mjs';
7
+
8
+ const flat = (f) => [
9
+ f.cost.low, f.cost.high, f.months.low, f.months.high,
10
+ ...f.milestones.flatMap((m) => [m.cost.low, m.cost.high, m.months.low, m.months.high]),
11
+ ];
12
+
13
+ function checkMoney(md, figures, out) {
14
+ const allowed = new Set(flat(figures));
15
+ for (const m of md.matchAll(/[$€£]\s?([\d,]+(?:\.\d+)?)/g)) {
16
+ const n = Number(m[1].replaceAll(',', ''));
17
+ if (!allowed.has(n)) out.push(`money amount ${m[0].trim()} not derived from estimation.json`);
18
+ }
19
+ for (const m of md.matchAll(/(\d+(?:\.\d+)?)\s*[–-]\s*(\d+(?:\.\d+)?)\s+months/g)) {
20
+ for (const bound of [Number(m[1]), Number(m[2])]) {
21
+ if (!allowed.has(bound)) out.push(`duration bound ${bound} months not derived from estimation.json`);
22
+ }
23
+ }
24
+ for (const m of md.matchAll(/(\d+(?:\.\d+)?)\s+months\b/g)) {
25
+ const n = Number(m[1]);
26
+ if (!allowed.has(n)) out.push(`duration bound ${n} months not derived from estimation.json`);
27
+ }
28
+ }
29
+
30
+ function checkHeadline(md, figures, out) {
31
+ const summary = sectionText(md, 'Executive Summary') ?? '';
32
+ for (const n of [figures.cost.low, figures.cost.high]) {
33
+ if (!summary.includes(n.toLocaleString('en-US'))) {
34
+ out.push(`headline cost bound ${n.toLocaleString('en-US')} missing from Executive Summary`);
35
+ }
36
+ }
37
+ for (const n of [figures.months.low, figures.months.high]) {
38
+ if (!new RegExp(`\\b${escapeRegExp(String(n))}\\b`).test(summary)) {
39
+ out.push(`headline duration bound ${n} missing from Executive Summary`);
40
+ }
41
+ }
42
+ }
43
+
44
+ function checkLeaks({ md, fm, estimation }, out) {
45
+ for (const s of estimation.inputs.scenarios ?? []) {
46
+ if (s.id !== fm.scenario && md.includes(s.id)) out.push(`leak: scenario id "${s.id}"`);
47
+ }
48
+ if (/\|\s*src\s*\|/i.test(md)) out.push('leak: provenance "src" column');
49
+ if (/data-internal/.test(md)) out.push('leak: data-internal marker');
50
+ for (const word of ['observed', 'stated', 'researched', 'proposed']) {
51
+ if (new RegExp(`\\|\\s*${word}\\s*\\|`).test(md)) out.push(`leak: provenance cell "${word}"`);
52
+ }
53
+ }
54
+
55
+ function checkJargon({ md, fm }, out) {
56
+ if (fm.client_tech_level !== 'non-tech') return;
57
+ const allow = new Set((Array.isArray(fm.jargon_allow) ? fm.jargon_allow : []).map((w) => w.toLowerCase()));
58
+ const about = sectionText(md, 'About');
59
+ const scanned = md.replace(/^---\n[\s\S]*?\n---/, '').replace(about ?? '', '');
60
+ for (const term of JARGON) {
61
+ if (allow.has(term)) continue;
62
+ if (new RegExp(`(?<![\\w/])${escapeRegExp(term)}(?:e?s)?(?![\\w/])`, 'i').test(scanned)) {
63
+ out.push(`jargon for a non-tech client: "${term}" (rewrite plainly or add to jargon_allow)`);
64
+ }
65
+ }
66
+ }
67
+
68
+ export function checkClient({ md, fm, estimation }, out = []) {
69
+ const figures = deriveFigures(estimation, fm.scenario);
70
+ checkMoney(md, figures, out);
71
+ checkHeadline(md, figures, out);
72
+ checkLeaks({ md, fm, estimation }, out);
73
+ checkJargon({ md, fm }, out);
74
+ return out;
75
+ }
@@ -0,0 +1,54 @@
1
+ // Structural half of the proposal gate: frontmatter contract, the ten
2
+ // sections, placeholder scan, future validity. Client-safety checks live
3
+ // in checks-client.mjs.
4
+ import { SECTIONS, sectionText, tables } from './sections.mjs';
5
+
6
+ const FM_KEYS = ['client', 'client_tech_level', 'scenario', 'currency',
7
+ 'valid_until', 'source_architecture', 'source_estimation'];
8
+ const TECH_LEVELS = ['non-tech', 'low-tech', 'technical'];
9
+
10
+ function checkFrontmatter({ fm, estimation, today }, out) {
11
+ for (const key of FM_KEYS) {
12
+ if (!fm[key]) out.push(`frontmatter: missing "${key}"`);
13
+ }
14
+ if (fm.client_tech_level && !TECH_LEVELS.includes(fm.client_tech_level)) {
15
+ out.push(`frontmatter: client_tech_level must be ${TECH_LEVELS.join('|')}`);
16
+ }
17
+ if (fm.scenario && !estimation.computed.scenarios[fm.scenario]) {
18
+ out.push(`frontmatter: scenario "${fm.scenario}" not in estimation.json`);
19
+ }
20
+ checkValidUntil(fm.valid_until, today, out);
21
+ }
22
+
23
+ function checkValidUntil(raw, today, out) {
24
+ if (!raw) return;
25
+ const wellFormed = /^\d{4}-\d{2}-\d{2}$/.test(raw) && !Number.isNaN(Date.parse(raw));
26
+ if (!wellFormed) { out.push('frontmatter: valid_until must be an ISO date (YYYY-MM-DD)'); return; }
27
+ if (new Date(raw) <= today) out.push(`frontmatter: valid_until ${raw} is not in the future`);
28
+ }
29
+
30
+ function checkSections(md, out) {
31
+ for (const name of SECTIONS) {
32
+ const body = sectionText(md, name);
33
+ if (body === null) { out.push(`missing ## ${name} section`); continue; }
34
+ if (!body.trim()) out.push(`## ${name} section is empty`);
35
+ }
36
+ const solution = sectionText(md, 'Proposed Solution');
37
+ if (solution !== null && !solution.includes('```mermaid')) {
38
+ out.push('Proposed Solution has no mermaid diagram');
39
+ }
40
+ }
41
+
42
+ function checkPlaceholders(md, out) {
43
+ if (/\[TODO\]|\bTBD\b|\bTODO\b|lorem ipsum/i.test(md)) out.push('placeholder text found (TODO/TBD/lorem ipsum)');
44
+ for (const t of tables(md)) {
45
+ if (t.rows.length === 0) out.push(`empty table under header "${t.header.join(' | ')}"`);
46
+ }
47
+ }
48
+
49
+ export function checkDoc({ fm, md, estimation, today }, out = []) {
50
+ checkFrontmatter({ fm, estimation, today }, out);
51
+ checkSections(md, out);
52
+ checkPlaceholders(md, out);
53
+ return out;
54
+ }
@@ -0,0 +1,17 @@
1
+ // The proposal gate. validate.mjs prints these findings; render.mjs runs
2
+ // the same function and refuses to write proposal.html on any finding.
3
+ // Figures are recomputed from estimation.json here — proposal-figures.json
4
+ // is an authoring aid, never an input, so hand-edited figures cannot pass.
5
+ import { parseFrontmatter } from '../../../analyze-requirements/scripts/lib/frontmatter.mjs';
6
+ import { checkDoc } from './checks-doc.mjs';
7
+ import { checkClient } from './checks-client.mjs';
8
+
9
+ export function checkProposal({ md, estimation, today = new Date() }) {
10
+ const { data: fm, error } = parseFrontmatter(md);
11
+ if (!fm) return [`frontmatter: ${error}`];
12
+ const out = checkDoc({ fm, md, estimation, today });
13
+ if (fm.scenario && estimation.computed.scenarios[fm.scenario]) {
14
+ checkClient({ md, fm, estimation }, out);
15
+ }
16
+ return out;
17
+ }
@@ -0,0 +1,43 @@
1
+ // Client-facing figures derived from estimation.json — the proposal never
2
+ // invents a number. Totals come from the chosen scenario; ranges scale by
3
+ // the feature low/high spread; milestone splits follow the roadmap shares.
4
+ export const round1 = (n) => Math.round(n * 10) / 10;
5
+ export const round100 = (n) => Math.round(n / 100) * 100;
6
+ export const formatMoney = (n) => `$${n.toLocaleString('en-US')}`;
7
+
8
+ function spreadRatios(computed) {
9
+ const feats = Object.values(computed.features);
10
+ const hours = feats.reduce((s, f) => s + f.hours, 0);
11
+ return {
12
+ lo: feats.reduce((s, f) => s + f.low, 0) / hours,
13
+ hi: feats.reduce((s, f) => s + f.high, 0) / hours,
14
+ };
15
+ }
16
+
17
+ const range = (value, ratios, round) => ({ low: round(value * ratios.lo), high: round(value * ratios.hi) });
18
+
19
+ function milestoneFigures(scenario, ratios) {
20
+ return (scenario.roadmap ?? []).map((band) => {
21
+ const width = band.endMonths - band.startMonths;
22
+ return {
23
+ name: band.milestone,
24
+ cost: range(scenario.totalCost * (width / scenario.months), ratios, round100),
25
+ months: range(width, ratios, round1),
26
+ };
27
+ });
28
+ }
29
+
30
+ export function deriveFigures(estimation, scenarioId) {
31
+ const scenario = estimation.computed.scenarios[scenarioId];
32
+ if (!scenario) throw new Error(`scenario "${scenarioId}" not in estimation.json`);
33
+ const ratios = spreadRatios(estimation.computed);
34
+ const team = (estimation.inputs.scenarios.find((s) => s.id === scenarioId)?.team ?? [])
35
+ .map((m) => m.seniority);
36
+ return {
37
+ scenario: scenarioId,
38
+ cost: range(scenario.totalCost, ratios, round100),
39
+ months: range(scenario.months, ratios, round1),
40
+ milestones: milestoneFigures(scenario, ratios),
41
+ team,
42
+ };
43
+ }
@@ -0,0 +1,9 @@
1
+ // Deny-list for the non-tech jargon scan. Deliberately small: it catches the
2
+ // habitual offenders; the fresh-eyes review catches the rest. Terms are
3
+ // matched whole-word, case-insensitive; frontmatter jargon_allow overrides
4
+ // per term when the client themselves uses it.
5
+ export const JARGON = [
6
+ 'api', 'backend', 'frontend', 'middleware', 'kubernetes', 'docker',
7
+ 'microservice', 'microservices', 'ci/cd', 'oauth', 'sql', 'nosql',
8
+ 'webhook', 'endpoint', 'orm', 'latency', 'schema', 'refactor', 'devops',
9
+ ];
@@ -0,0 +1,32 @@
1
+ // Section slicing + table parsing for proposal.md — same approach as the
2
+ // estimate skill's checks.mjs, section names fixed by the writing contract.
3
+ export const SECTIONS = [
4
+ 'Executive Summary', 'Background & Objectives', 'Proposed Solution', 'Scope',
5
+ 'Out of Scope & Assumptions', 'Delivery Approach', 'Investment & Timeline',
6
+ 'Team', 'About', 'Next Steps',
7
+ ];
8
+
9
+ export const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
10
+
11
+ export function sectionText(md, name) {
12
+ const m = new RegExp(`^##\\s+${escapeRegExp(name)}.*$`, 'm').exec(md);
13
+ if (!m) return null;
14
+ const rest = md.slice(m.index + m[0].length);
15
+ const next = rest.search(/^##\s/m);
16
+ return rest.slice(0, next === -1 ? undefined : next);
17
+ }
18
+
19
+ const cells = (line) => line.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map((c) => c.trim());
20
+
21
+ export function tables(text) {
22
+ const groups = [];
23
+ let cur = [];
24
+ for (const line of (text ?? '').split('\n')) {
25
+ if (/^\s*\|/.test(line)) cur.push(line);
26
+ else if (cur.length) { groups.push(cur); cur = []; }
27
+ }
28
+ if (cur.length) groups.push(cur);
29
+ return groups
30
+ .map((g) => g.filter((l) => !/^\s*\|?[\s:|-]+\|?\s*$/.test(l)))
31
+ .map((g) => ({ header: cells(g[0]), rows: g.slice(1).map(cells) }));
32
+ }
@@ -0,0 +1,60 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { embed } from '../../analyze-requirements/scripts/lib/embed.mjs';
4
+ import { buildFontFaces } from '../../analyze-requirements/scripts/lib/fonts.mjs';
5
+ import { renderMarkdown, escapeHtml } from '../../analyze-requirements/scripts/lib/md-render.mjs';
6
+ import { parseFrontmatter } from '../../analyze-requirements/scripts/lib/frontmatter.mjs';
7
+ import { checkProposal } from './lib/checks.mjs';
8
+
9
+ function parseArgs(argv) {
10
+ const args = {};
11
+ for (let i = 0; i < argv.length; i += 1) {
12
+ if (argv[i].startsWith('--')) args[argv[i].slice(2)] = argv[++i];
13
+ }
14
+ return args;
15
+ }
16
+
17
+ const archFontsDir = new URL('../../analyze-requirements/assets/fonts/', import.meta.url).pathname;
18
+ const templatePath = new URL('../assets/proposal-template.html', import.meta.url).pathname;
19
+
20
+ const args = parseArgs(process.argv.slice(2));
21
+ const md = readFileSync(args.md, 'utf8');
22
+ const estimation = JSON.parse(readFileSync(args.estimation, 'utf8'));
23
+
24
+ // Validation blocks rendering — same hard rule as the estimate skill,
25
+ // enforced in code with no skip flag.
26
+ const findings = checkProposal({ md, estimation });
27
+ if (findings.length) {
28
+ console.error(findings.join('\n'));
29
+ process.exit(1);
30
+ }
31
+
32
+ if (typeof args['mermaid-bundle'] !== 'string') {
33
+ console.error('--mermaid-bundle is required (see analyze-requirements references/viewer.md §1)');
34
+ process.exit(1);
35
+ }
36
+ const bundle = readFileSync(args['mermaid-bundle'], 'utf8');
37
+ if (bundle.includes('</script')) {
38
+ console.error('mermaid bundle carries a literal </script — rebuild it (analyze-requirements references/viewer.md §1)');
39
+ process.exit(1);
40
+ }
41
+
42
+ const { data: fm } = parseFrontmatter(md);
43
+ const { html: content, headings } = renderMarkdown(md);
44
+ const nav = headings.filter((h) => h.level === 2)
45
+ .map((h) => `<a href="#${h.slug}">${escapeHtml(h.text)}</a>`).join('\n');
46
+
47
+ const html = embed({
48
+ template: readFileSync(templatePath, 'utf8'),
49
+ slots: {
50
+ TITLE: escapeHtml(`Proposal — ${fm.client}`),
51
+ FONTS: buildFontFaces(archFontsDir),
52
+ NAV: nav,
53
+ CONTENT: content,
54
+ MERMAID_BUNDLE: bundle,
55
+ },
56
+ });
57
+
58
+ const outPath = join(args.out, 'proposal.html');
59
+ writeFileSync(outPath, html);
60
+ console.log(outPath);
@@ -0,0 +1,144 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { checkProposal } from '../lib/checks.mjs';
4
+ import { JARGON } from '../lib/jargon.mjs';
5
+
6
+ // Same synthetic estimation as figures.test.mjs: figures are
7
+ // cost 8000/12000, months 1.6/2.4, M1 6000/9000 1.2/1.8, M2 2000/3000 0.4/0.6.
8
+ const estimation = {
9
+ inputs: {
10
+ scenarios: [
11
+ { id: 's1', plan: 'max5x', team: [{ seniority: 'senior', rate: 50 }] },
12
+ { id: 's2-secret', plan: 'none', team: [{ seniority: 'mid', rate: 40 }] },
13
+ ],
14
+ },
15
+ computed: {
16
+ features: { a: { hours: 100, low: 80, high: 120 }, b: { hours: 100, low: 80, high: 120 } },
17
+ scenarios: {
18
+ s1: {
19
+ months: 2, totalCost: 10000,
20
+ roadmap: [
21
+ { name: 'M1', startMonths: 0, endMonths: 1.5 },
22
+ { name: 'M2', startMonths: 1.5, endMonths: 2 },
23
+ ],
24
+ },
25
+ 's2-secret': { months: 3, totalCost: 15000 },
26
+ },
27
+ },
28
+ };
29
+ const TODAY = new Date('2026-08-06');
30
+
31
+ const md = `---
32
+ client: Acme Corp
33
+ client_tech_level: non-tech
34
+ scenario: s1
35
+ currency: USD
36
+ valid_until: 2099-12-31
37
+ source_architecture: ../ARCHITECTURE.md
38
+ source_estimation: ../estimation.json
39
+ ---
40
+
41
+ ## Executive Summary
42
+ New booking system for $8,000 – $12,000, delivered in 1.6–2.4 months.
43
+ ## Background & Objectives
44
+ Bookings are manual today.
45
+ ## Proposed Solution
46
+ \`\`\`mermaid
47
+ graph LR; A[Your customers] --> B[New system]
48
+ \`\`\`
49
+ ## Scope
50
+ | Feature | What you get |
51
+ | --- | --- |
52
+ | Booking | Online appointments |
53
+ ## Out of Scope & Assumptions
54
+ - Text-message reminders are out.
55
+ ## Delivery Approach
56
+ M1 runs 1.2–1.8 months; M2 runs 0.4–0.6 months. Weekly demos.
57
+ ## Investment & Timeline
58
+ | Milestone | Duration | Investment |
59
+ | --- | --- | --- |
60
+ | M1 | 1.2–1.8 months | $6,000 – $9,000 |
61
+ | M2 | 0.4–0.6 months | $2,000 – $3,000 |
62
+
63
+ Total: $8,000 – $12,000 over 1.6–2.4 months.
64
+ ## Team
65
+ One senior engineer.
66
+ ## About Code Engine Studio
67
+ We build software. Contact: hello@example.com
68
+ ## Next Steps
69
+ Valid until 2099-12-31. Reply to accept.
70
+ `;
71
+
72
+ const run = (doc) => checkProposal({ md: doc, estimation, today: TODAY });
73
+
74
+ test('a document whose numbers all trace to the figures passes', () => {
75
+ assert.deepEqual(run(md), []);
76
+ });
77
+
78
+ test('an invented money amount is a finding', () => {
79
+ assert.ok(run(md.replace('$6,000', '$6,500')).some((f) => f.includes('6,500') || f.includes('6500')));
80
+ });
81
+
82
+ test('an invented duration bound is a finding', () => {
83
+ assert.ok(run(md.replace('1.6–2.4 months.\n## Team', '1.6–9.9 months.\n## Team'))
84
+ .some((f) => f.includes('9.9')));
85
+ });
86
+
87
+ test('the headline cost range must be present', () => {
88
+ const noTotals = md.replaceAll('$8,000 – $12,000', 'a fair price').replaceAll('1.6–2.4 months', 'a short time');
89
+ const findings = run(noTotals);
90
+ assert.ok(findings.some((f) => f.includes('8,000')));
91
+ assert.ok(findings.some((f) => f.includes('2.4')));
92
+ });
93
+
94
+ test('a lone invented duration is a finding', () => {
95
+ assert.ok(run(md.replace('Weekly demos.', 'Live within 9 months.')).some((f) => f.includes('9')));
96
+ });
97
+
98
+ test('headline ranges must live in the Executive Summary itself', () => {
99
+ const buried = md.replace('New booking system for $8,000 – $12,000, delivered in 1.6–2.4 months.', 'A fair price, fast.');
100
+ const findings = run(buried);
101
+ assert.ok(findings.some((f) => /Executive Summary/.test(f)));
102
+ });
103
+
104
+ test('other scenario ids and provenance markup are leaks', () => {
105
+ assert.ok(run(md.replace('Weekly demos.', 'Cheaper than s2-secret.')).some((f) => f.includes('s2-secret')));
106
+ assert.ok(run(md.replace('| Feature | What you get |', '| Feature | src |')).some((f) => f.includes('src')));
107
+ assert.ok(run(md.replace('Weekly demos.', '| observed |')).some((f) => f.includes('observed')));
108
+ });
109
+
110
+ test('stated and proposed provenance cells are leaks too', () => {
111
+ assert.ok(run(md.replace('Weekly demos.', '| proposed |')).some((f) => f.includes('proposed')));
112
+ });
113
+
114
+ test('non-tech jargon fails, jargon_allow overrides per term', () => {
115
+ const jargony = md.replace('Weekly demos.', 'We deploy the API to Kubernetes.');
116
+ const findings = run(jargony);
117
+ assert.ok(findings.some((f) => /kubernetes/i.test(f)));
118
+ assert.ok(findings.some((f) => /\bapi\b/i.test(f)));
119
+ const allowed = jargony.replace('valid_until: 2099-12-31', 'valid_until: 2099-12-31\njargon_allow: ["api", "kubernetes"]');
120
+ assert.deepEqual(run(allowed), []);
121
+ });
122
+
123
+ test('technical clients skip the jargon scan; the About section is exempt', () => {
124
+ const techDoc = md.replace('client_tech_level: non-tech', 'client_tech_level: technical')
125
+ .replace('Weekly demos.', 'We deploy the API to Kubernetes.');
126
+ assert.deepEqual(run(techDoc), []);
127
+ const aboutJargon = md.replace('We build software.', 'We build software and Kubernetes platforms.');
128
+ assert.deepEqual(run(aboutJargon), []);
129
+ });
130
+
131
+ test('plural jargon is still jargon', () => {
132
+ const plural = md.replace('Weekly demos.', 'We expose several endpoints.');
133
+ assert.ok(run(plural).some((f) => /endpoint/i.test(f)));
134
+ });
135
+
136
+ test('the deny-list is lowercase and non-trivial', () => {
137
+ assert.ok(JARGON.length >= 12);
138
+ for (const term of JARGON) assert.equal(term, term.toLowerCase());
139
+ });
140
+
141
+ test('a document with no frontmatter is a finding, not a crash', () => {
142
+ assert.deepEqual(checkProposal({ md: '## Executive Summary\nHi.', estimation, today: TODAY }),
143
+ ['frontmatter: no frontmatter block']);
144
+ });
@@ -0,0 +1,93 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { sectionText, tables } from '../lib/sections.mjs';
4
+ import { checkDoc } from '../lib/checks-doc.mjs';
5
+ import { parseFrontmatter } from '../../../analyze-requirements/scripts/lib/frontmatter.mjs';
6
+
7
+ const estimation = { computed: { scenarios: { s1: { months: 2, totalCost: 10000 } } }, inputs: { scenarios: [{ id: 's1', team: [] }] } };
8
+ const TODAY = new Date('2026-08-06');
9
+
10
+ const FM = `---
11
+ client: Acme Corp
12
+ client_tech_level: non-tech
13
+ scenario: s1
14
+ currency: USD
15
+ valid_until: 2099-12-31
16
+ source_architecture: ../ARCHITECTURE.md
17
+ source_estimation: ../estimation.json
18
+ ---`;
19
+
20
+ const SECTION_BODIES = `
21
+ ## Executive Summary
22
+ We fix scheduling.
23
+ ## Background & Objectives
24
+ Bookings are manual today.
25
+ ## Proposed Solution
26
+ \`\`\`mermaid
27
+ graph LR; A[You] --> B[New system]
28
+ \`\`\`
29
+ ## Scope
30
+ | Feature | What you get |
31
+ | --- | --- |
32
+ | Booking | Online appointments |
33
+ ## Out of Scope & Assumptions
34
+ - SMS reminders are out.
35
+ ## Delivery Approach
36
+ Two milestones, weekly demos.
37
+ ## Investment & Timeline
38
+ $8,000 – $12,000 over 1.6–2.4 months.
39
+ ## Team
40
+ One senior engineer, one mid-level engineer.
41
+ ## About Code Engine Studio
42
+ We build software. Contact: hello@example.com
43
+ ## Next Steps
44
+ Valid until 2099-12-31. Reply to accept.
45
+ `;
46
+
47
+ const goodMd = `${FM}\n${SECTION_BODIES}`;
48
+ const check = (md) => checkDoc({ fm: parseFrontmatter(md).data, md, estimation, today: TODAY });
49
+
50
+ test('a complete document produces no findings', () => {
51
+ assert.deepEqual(check(goodMd), []);
52
+ });
53
+
54
+ test('sectionText slices one section and returns null for missing ones', () => {
55
+ assert.match(sectionText(goodMd, 'Scope'), /Online appointments/);
56
+ assert.doesNotMatch(sectionText(goodMd, 'Scope'), /SMS reminders/);
57
+ assert.equal(sectionText(goodMd, 'Signature'), null);
58
+ });
59
+
60
+ test('tables groups pipe rows and drops the separator', () => {
61
+ const [t] = tables(sectionText(goodMd, 'Scope'));
62
+ assert.deepEqual(t.header, ['Feature', 'What you get']);
63
+ assert.deepEqual(t.rows, [['Booking', 'Online appointments']]);
64
+ });
65
+
66
+ test('every missing or empty section is a finding', () => {
67
+ const noTeam = goodMd.replace(/## Team[\s\S]*?(?=## About)/, '');
68
+ assert.ok(check(noTeam).some((f) => f.includes('Team')));
69
+ const emptyScope = goodMd.replace('| Booking | Online appointments |\n', '')
70
+ .replace('## Scope\n| Feature | What you get |\n| --- | --- |', '## Scope');
71
+ assert.ok(check(emptyScope).some((f) => f.includes('Scope')));
72
+ });
73
+
74
+ test('frontmatter contract: missing key, bad tech level, unknown scenario', () => {
75
+ assert.ok(check(goodMd.replace('currency: USD\n', '')).some((f) => f.includes('currency')));
76
+ assert.ok(check(goodMd.replace('non-tech', 'wizard')).some((f) => f.includes('client_tech_level')));
77
+ assert.ok(check(goodMd.replace('scenario: s1', 'scenario: ghost')).some((f) => f.includes('ghost')));
78
+ });
79
+
80
+ test('valid_until must be a future ISO date', () => {
81
+ assert.ok(check(goodMd.replace('2099-12-31', '2020-01-01')).some((f) => f.includes('valid_until')));
82
+ assert.ok(check(goodMd.replace('2099-12-31', 'someday')).some((f) => f.includes('valid_until')));
83
+ });
84
+
85
+ test('placeholders and empty tables are findings', () => {
86
+ assert.ok(check(goodMd.replace('We fix scheduling.', 'TBD')).some((f) => /placeholder/i.test(f)));
87
+ assert.ok(check(`${goodMd}\n| A | B |\n| --- | --- |\n`).some((f) => /empty table/i.test(f)));
88
+ });
89
+
90
+ test('Proposed Solution must carry a mermaid diagram', () => {
91
+ const noDiagram = goodMd.replace(/```mermaid[\s\S]*?```/, 'A drawing.');
92
+ assert.ok(check(noDiagram).some((f) => f.includes('mermaid')));
93
+ });