@v11g/agents-rock 1.0.13 → 1.0.14

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 (572) hide show
  1. package/README.md +23 -5
  2. package/package.json +1 -1
  3. package/plugins/business-analyst/skills/business-analyst/README.md +1 -1
  4. package/plugins/business-analyst/skills/business-analyst/evals/evals.json +1 -1
  5. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-314.pyc +0 -0
  6. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-314.pyc +0 -0
  7. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-314.pyc +0 -0
  8. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-314.pyc +0 -0
  9. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-314.pyc +0 -0
  10. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-314.pyc +0 -0
  11. package/plugins/business-analyst/skills/business-analyst/scripts/test/quality-gates.test.mjs +1 -1
  12. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-browser.test.mjs +2 -2
  13. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_body.cpython-314.pyc +0 -0
  14. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_flow.cpython-314.pyc +0 -0
  15. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_package.cpython-314.pyc +0 -0
  16. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_xml.cpython-314.pyc +0 -0
  17. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_quotes.cpython-314.pyc +0 -0
  18. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_rules.cpython-314.pyc +0 -0
  19. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_schema.cpython-314.pyc +0 -0
  20. package/plugins/presales/.claude-plugin/plugin.json +9 -0
  21. package/plugins/{solution-architect → presales}/evals/workflow-happy-path/graders/workflow-or-exact-stop.md +1 -1
  22. package/plugins/{solution-architect → presales}/skills/analyze-requirements/evals/evals.json +5 -5
  23. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/ba-facts-cli.test.mjs +5 -1
  24. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/ba-package-cli.test.mjs +5 -1
  25. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/browser.test.mjs +6 -2
  26. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/check-quotes-cli.test.mjs +5 -1
  27. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/drift-cli.test.mjs +5 -1
  28. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/inputs.test.mjs +6 -2
  29. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/likec4-config-cli.test.mjs +5 -1
  30. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/likec4-export-cli.test.mjs +5 -1
  31. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/likec4-gen-cli.test.mjs +5 -1
  32. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/record-cli.test.mjs +5 -1
  33. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/render.test.mjs +22 -18
  34. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/rerun-safety.test.mjs +5 -1
  35. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-quotes-cli.test.mjs +5 -1
  36. package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-strategy-cli.test.mjs +5 -1
  37. package/plugins/{solution-architect → presales}/skills/estimate/README.md +14 -4
  38. package/plugins/{solution-architect → presales}/skills/estimate/classic/references/writing.md +1 -1
  39. package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/roadmap.mjs +9 -5
  40. package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/estimate-math.test.mjs +11 -0
  41. package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/project-price.test.mjs +10 -0
  42. package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/xlsx-export.test.mjs +12 -12
  43. package/plugins/{solution-architect → presales}/skills/estimate/evals/evals.json +1 -1
  44. package/plugins/presales/skills/estimate/shared/assets/xlsx-export.js +392 -0
  45. package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/project-price.mjs +6 -4
  46. package/plugins/presales/skills/estimate/workflow-based/FLOW.md +176 -0
  47. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/assets/estimate-template.html +127 -10
  48. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/assets/estimator-system.xlsx +0 -0
  49. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/assets/score-review.html +164 -27
  50. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/build-template.mjs +9 -2
  51. package/plugins/presales/skills/estimate/workflow-based/scripts/build-workflow-template.mjs +76 -0
  52. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/build-xlsx-template.py +3 -3
  53. package/plugins/presales/skills/estimate/workflow-based/scripts/lib/cites.mjs +60 -0
  54. package/plugins/presales/skills/estimate/workflow-based/scripts/lib/groups.mjs +65 -0
  55. package/plugins/presales/skills/estimate/workflow-based/scripts/lib/page-html.mjs +43 -0
  56. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/lib/page-view.mjs +30 -4
  57. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/lib/rollup.mjs +43 -12
  58. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/lib/schema.mjs +23 -1
  59. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/lib/score-diff.mjs +6 -1
  60. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/lib/score-html.mjs +23 -4
  61. package/plugins/presales/skills/estimate/workflow-based/scripts/lib/xlsx-group-rows.mjs +20 -0
  62. package/plugins/presales/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +81 -0
  63. package/plugins/presales/skills/estimate/workflow-based/scripts/lib/xlsx-tasks.mjs +25 -0
  64. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/render.mjs +8 -10
  65. package/plugins/presales/skills/estimate/workflow-based/scripts/score-review.mjs +81 -0
  66. package/plugins/presales/skills/estimate/workflow-based/scripts/template/cites.js +46 -0
  67. package/plugins/presales/skills/estimate/workflow-based/scripts/template/effort.css +22 -0
  68. package/plugins/presales/skills/estimate/workflow-based/scripts/template/effort.mjs +37 -0
  69. package/plugins/presales/skills/estimate/workflow-based/scripts/template/estimate-page.css +10 -0
  70. package/plugins/presales/skills/estimate/workflow-based/scripts/template/estimate-page.js +16 -0
  71. package/plugins/presales/skills/estimate/workflow-based/scripts/template/feature-tasks.js +33 -0
  72. package/plugins/presales/skills/estimate/workflow-based/scripts/template/lavish.mjs +39 -0
  73. package/plugins/presales/skills/estimate/workflow-based/scripts/template/tasks.css +25 -0
  74. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/template/view.js +21 -2
  75. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/also-builds-browser.test.mjs +1 -3
  76. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/browser.test.mjs +10 -7
  77. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/build-pages.test.mjs +10 -15
  78. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/build-template.test.mjs +6 -2
  79. package/plugins/presales/skills/estimate/workflow-based/scripts/test/cites.test.mjs +64 -0
  80. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/cli.test.mjs +1 -0
  81. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/estimator-system.test.mjs +5 -5
  82. package/plugins/presales/skills/estimate/workflow-based/scripts/test/feature-tasks-browser.test.mjs +39 -0
  83. package/plugins/presales/skills/estimate/workflow-based/scripts/test/groups-browser.test.mjs +39 -0
  84. package/plugins/presales/skills/estimate/workflow-based/scripts/test/groups.test.mjs +156 -0
  85. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/link-picker-browser.test.mjs +1 -10
  86. package/plugins/presales/skills/estimate/workflow-based/scripts/test/open-lavish.test.mjs +54 -0
  87. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/page-html.test.mjs +7 -0
  88. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/pages-browser.test.mjs +25 -21
  89. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/render.test.mjs +5 -5
  90. package/plugins/presales/skills/estimate/workflow-based/scripts/test/review-effort.test.mjs +104 -0
  91. package/plugins/presales/skills/estimate/workflow-based/scripts/test/review-lavish.test.mjs +193 -0
  92. package/plugins/presales/skills/estimate/workflow-based/scripts/test/review-tasks.test.mjs +66 -0
  93. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/schema.test.mjs +15 -0
  94. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/score-review.test.mjs +10 -1
  95. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/stage.mjs +16 -8
  96. package/plugins/presales/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +110 -0
  97. package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/validate.mjs +2 -0
  98. package/plugins/{solution-architect → presales}/skills/new-lead/README.md +1 -1
  99. package/plugins/{solution-architect → presales}/skills/new-lead/SKILL.md +1 -1
  100. package/plugins/{solution-architect → presales}/skills/new-lead/evals/evals.json +13 -13
  101. package/plugins/presales/skills/proposal/README.md +63 -0
  102. package/plugins/presales/skills/proposal/SKILL.md +91 -0
  103. package/plugins/presales/skills/proposal/assets/proposal-page.html +156 -0
  104. package/plugins/presales/skills/proposal/assets/roboto-widths.json +1 -0
  105. package/plugins/{solution-architect → presales}/skills/proposal/evals/evals.json +22 -22
  106. package/plugins/presales/skills/proposal/references/build.md +33 -0
  107. package/plugins/presales/skills/proposal/references/diagrams.md +123 -0
  108. package/plugins/presales/skills/proposal/references/interview.md +66 -0
  109. package/plugins/presales/skills/proposal/references/review.md +41 -0
  110. package/plugins/{solution-architect → presales}/skills/proposal/references/workflow.md +30 -22
  111. package/plugins/presales/skills/proposal/references/writing.md +167 -0
  112. package/plugins/presales/skills/proposal/scripts/build/arrows.mjs +70 -0
  113. package/plugins/presales/skills/proposal/scripts/build/brand.mjs +43 -0
  114. package/plugins/presales/skills/proposal/scripts/build/build.mjs +75 -0
  115. package/plugins/presales/skills/proposal/scripts/build/contents.mjs +42 -0
  116. package/plugins/presales/skills/proposal/scripts/build/docx-blocks.mjs +102 -0
  117. package/plugins/presales/skills/proposal/scripts/build/docx-doc.mjs +91 -0
  118. package/plugins/presales/skills/proposal/scripts/build/docx-inline.mjs +48 -0
  119. package/plugins/presales/skills/proposal/scripts/build/docx-table.mjs +75 -0
  120. package/plugins/presales/skills/proposal/scripts/build/figures.mjs +95 -0
  121. package/plugins/presales/skills/proposal/scripts/build/html.mjs +80 -0
  122. package/plugins/presales/skills/proposal/scripts/build/layout.mjs +48 -0
  123. package/plugins/presales/skills/proposal/scripts/build/notes.mjs +30 -0
  124. package/plugins/presales/skills/proposal/scripts/build/overlap.mjs +57 -0
  125. package/plugins/presales/skills/proposal/scripts/build/page.mjs +50 -0
  126. package/plugins/presales/skills/proposal/scripts/build/pdf.mjs +88 -0
  127. package/plugins/presales/skills/proposal/scripts/build/scope-ids.mjs +10 -0
  128. package/plugins/presales/skills/proposal/scripts/build/tool.mjs +35 -0
  129. package/plugins/{solution-architect → presales}/skills/proposal/scripts/derive.mjs +7 -1
  130. package/plugins/presales/skills/proposal/scripts/diagram/align.mjs +36 -0
  131. package/plugins/presales/skills/proposal/scripts/diagram/draw.mjs +81 -0
  132. package/plugins/presales/skills/proposal/scripts/diagram/grid.mjs +90 -0
  133. package/plugins/presales/skills/proposal/scripts/diagram/icons.mjs +30 -0
  134. package/plugins/presales/skills/proposal/scripts/diagram/index.mjs +23 -0
  135. package/plugins/presales/skills/proposal/scripts/diagram/layout.mjs +42 -0
  136. package/plugins/presales/skills/proposal/scripts/diagram/obstacles.mjs +49 -0
  137. package/plugins/presales/skills/proposal/scripts/diagram/pack.mjs +101 -0
  138. package/plugins/presales/skills/proposal/scripts/diagram/route.mjs +129 -0
  139. package/plugins/presales/skills/proposal/scripts/diagram/steps.mjs +74 -0
  140. package/plugins/presales/skills/proposal/scripts/diagram/style.mjs +61 -0
  141. package/plugins/presales/skills/proposal/scripts/diagram/text.mjs +28 -0
  142. package/plugins/presales/skills/proposal/scripts/lib/bans.mjs +82 -0
  143. package/plugins/presales/skills/proposal/scripts/lib/checks-client.mjs +74 -0
  144. package/plugins/presales/skills/proposal/scripts/lib/checks-doc.mjs +78 -0
  145. package/plugins/presales/skills/proposal/scripts/lib/checks.mjs +44 -0
  146. package/plugins/presales/skills/proposal/scripts/lib/citations.mjs +45 -0
  147. package/plugins/presales/skills/proposal/scripts/lib/diagram-spec.mjs +67 -0
  148. package/plugins/presales/skills/proposal/scripts/lib/figures.mjs +79 -0
  149. package/plugins/presales/skills/proposal/scripts/lib/load.mjs +42 -0
  150. package/plugins/presales/skills/proposal/scripts/lib/money.mjs +62 -0
  151. package/plugins/presales/skills/proposal/scripts/lib/parts.mjs +83 -0
  152. package/plugins/presales/skills/proposal/scripts/lib/price-source.mjs +74 -0
  153. package/plugins/presales/skills/proposal/scripts/lib/prose.mjs +55 -0
  154. package/plugins/presales/skills/proposal/scripts/lib/workbook.mjs +86 -0
  155. package/plugins/{solution-architect → presales}/skills/proposal/scripts/lib/workflow-checks.mjs +7 -2
  156. package/plugins/{solution-architect → presales}/skills/proposal/scripts/lib/workflow-cli.mjs +16 -18
  157. package/plugins/presales/skills/proposal/scripts/lib/workflow-md.mjs +35 -0
  158. package/plugins/{solution-architect → presales}/skills/proposal/scripts/lib/workflow-view.mjs +3 -3
  159. package/plugins/presales/skills/proposal/scripts/render.mjs +55 -0
  160. package/plugins/presales/skills/proposal/scripts/test/acme.mjs +28 -0
  161. package/plugins/presales/skills/proposal/scripts/test/bans.test.mjs +59 -0
  162. package/plugins/presales/skills/proposal/scripts/test/build.test.mjs +128 -0
  163. package/plugins/presales/skills/proposal/scripts/test/diagram.test.mjs +154 -0
  164. package/plugins/presales/skills/proposal/scripts/test/docs.test.mjs +13 -0
  165. package/plugins/presales/skills/proposal/scripts/test/e2e.test.mjs +20 -0
  166. package/plugins/{solution-architect → presales}/skills/proposal/scripts/test/evals-fixtures.test.mjs +8 -5
  167. package/plugins/{solution-architect → presales}/skills/proposal/scripts/test/figures.test.mjs +29 -1
  168. package/plugins/presales/skills/proposal/scripts/test/fixtures/acme/diagrams/aws-on-neutral.json +60 -0
  169. package/plugins/presales/skills/proposal/scripts/test/fixtures/acme/diagrams/booking.json +61 -0
  170. package/plugins/presales/skills/proposal/scripts/test/fixtures/acme/proposal-fail.md +49 -0
  171. package/plugins/presales/skills/proposal/scripts/test/fixtures/acme/proposal.md +72 -0
  172. package/plugins/presales/skills/proposal/scripts/test/fixtures/acme/references.json +5 -0
  173. package/plugins/presales/skills/proposal/scripts/test/fixtures/workbook-recalculated.xlsx +0 -0
  174. package/plugins/presales/skills/proposal/scripts/test/fixtures/workbook-unrecalculated.xlsx +0 -0
  175. package/plugins/presales/skills/proposal/scripts/test/layout.test.mjs +89 -0
  176. package/plugins/presales/skills/proposal/scripts/test/parts.test.mjs +112 -0
  177. package/plugins/presales/skills/proposal/scripts/test/prices.test.mjs +122 -0
  178. package/plugins/{solution-architect → presales}/skills/proposal/scripts/test/quality-gates.test.mjs +1 -1
  179. package/plugins/presales/skills/proposal/scripts/test/steps.test.mjs +38 -0
  180. package/plugins/presales/skills/proposal/scripts/test/validate.test.mjs +46 -0
  181. package/plugins/presales/skills/proposal/scripts/test/workbook.test.mjs +76 -0
  182. package/plugins/{solution-architect → presales}/skills/proposal/scripts/test/workflow-checks.test.mjs +7 -2
  183. package/plugins/{solution-architect → presales}/skills/proposal/scripts/test/workflow-view.test.mjs +15 -10
  184. package/plugins/{solution-architect → presales}/skills/proposal/scripts/validate.mjs +8 -3
  185. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
  186. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
  187. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
  188. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
  189. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
  190. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
  191. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_body.cpython-312.pyc +0 -0
  192. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_flow.cpython-312.pyc +0 -0
  193. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_package.cpython-312.pyc +0 -0
  194. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_xml.cpython-312.pyc +0 -0
  195. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_quotes.cpython-312.pyc +0 -0
  196. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_rules.cpython-312.pyc +0 -0
  197. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_schema.cpython-312.pyc +0 -0
  198. package/plugins/solution-architect/.claude-plugin/plugin.json +0 -9
  199. package/plugins/solution-architect/skills/estimate/shared/assets/xlsx-export.js +0 -336
  200. package/plugins/solution-architect/skills/estimate/workflow-based/FLOW.md +0 -95
  201. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-components.html +0 -1071
  202. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-components-template.mjs +0 -85
  203. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-workflow-template.mjs +0 -51
  204. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-html.mjs +0 -44
  205. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +0 -53
  206. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/score-review.mjs +0 -46
  207. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/feature-tasks.js +0 -21
  208. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/feature-tasks-browser.test.mjs +0 -30
  209. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +0 -59
  210. package/plugins/solution-architect/skills/proposal/README.md +0 -51
  211. package/plugins/solution-architect/skills/proposal/SKILL.md +0 -69
  212. package/plugins/solution-architect/skills/proposal/assets/proposal-template.html +0 -82
  213. package/plugins/solution-architect/skills/proposal/assets/proposal-workflow.html +0 -143
  214. package/plugins/solution-architect/skills/proposal/references/interview.md +0 -60
  215. package/plugins/solution-architect/skills/proposal/references/review.md +0 -40
  216. package/plugins/solution-architect/skills/proposal/references/writing.md +0 -104
  217. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +0 -58
  218. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +0 -64
  219. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +0 -21
  220. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-body.mjs +0 -42
  221. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-package.mjs +0 -56
  222. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-xml.mjs +0 -44
  223. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +0 -34
  224. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-html.mjs +0 -39
  225. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-page.mjs +0 -30
  226. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +0 -64
  227. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +0 -147
  228. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +0 -152
  229. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +0 -57
  230. package/plugins/solution-architect/skills/proposal/scripts/test/docx.test.mjs +0 -68
  231. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +0 -30
  232. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +0 -27
  233. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +0 -51
  234. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +0 -70
  235. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +0 -41
  236. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-browser.test.mjs +0 -96
  237. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-docs.test.mjs +0 -25
  238. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-render.test.mjs +0 -75
  239. /package/plugins/{solution-architect → presales}/evals/proposal-workflow/case.yaml +0 -0
  240. /package/plugins/{solution-architect → presales}/evals/proposal-workflow/fixture.sh +0 -0
  241. /package/plugins/{solution-architect → presales}/evals/proposal-workflow/graders/inputs-written.md +0 -0
  242. /package/plugins/{solution-architect → presales}/evals/proposal-workflow/graders/no-proposal-md.md +0 -0
  243. /package/plugins/{solution-architect → presales}/evals/proposal-workflow/graders/skill-fired.md +0 -0
  244. /package/plugins/{solution-architect → presales}/evals/proposal-workflow/graders/validate-then-render.md +0 -0
  245. /package/plugins/{solution-architect → presales}/evals/proposal-workflow/prompt.md +0 -0
  246. /package/plugins/{solution-architect → presales}/evals/workflow-gate-no-architecture/case.yaml +0 -0
  247. /package/plugins/{solution-architect → presales}/evals/workflow-gate-no-architecture/fixture.sh +0 -0
  248. /package/plugins/{solution-architect → presales}/evals/workflow-gate-no-architecture/graders/no-classic-fallback.md +0 -0
  249. /package/plugins/{solution-architect → presales}/evals/workflow-gate-no-architecture/graders/nothing-written.md +0 -0
  250. /package/plugins/{solution-architect → presales}/evals/workflow-gate-no-architecture/graders/skill-fired.md +0 -0
  251. /package/plugins/{solution-architect → presales}/evals/workflow-gate-no-architecture/graders/stops-at-gate.md +0 -0
  252. /package/plugins/{solution-architect → presales}/evals/workflow-gate-no-architecture/prompt.md +0 -0
  253. /package/plugins/{solution-architect → presales}/evals/workflow-happy-path/case.yaml +0 -0
  254. /package/plugins/{solution-architect → presales}/evals/workflow-happy-path/fixture.sh +0 -0
  255. /package/plugins/{solution-architect → presales}/evals/workflow-happy-path/graders/no-estimation-md.md +0 -0
  256. /package/plugins/{solution-architect → presales}/evals/workflow-happy-path/graders/pages-or-stop.md +0 -0
  257. /package/plugins/{solution-architect → presales}/evals/workflow-happy-path/graders/routed-to-workflow.md +0 -0
  258. /package/plugins/{solution-architect → presales}/evals/workflow-happy-path/graders/skill-fired.md +0 -0
  259. /package/plugins/{solution-architect → presales}/evals/workflow-happy-path/graders/three-questions-max.md +0 -0
  260. /package/plugins/{solution-architect → presales}/evals/workflow-happy-path/prompt.md +0 -0
  261. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/README.md +0 -0
  262. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/SKILL.md +0 -0
  263. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/fonts/OFL.txt +0 -0
  264. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  265. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  266. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  267. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  268. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
  269. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/mermaid-theme.json +0 -0
  270. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/section-help.json +0 -0
  271. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/assets/viewer-template.html +0 -0
  272. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.json +0 -0
  273. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.md +0 -0
  274. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/evals/fixtures/greenfield-llm-triage-spec/triage-service-spec.md +0 -0
  275. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/evals/fixtures/transcript-citations/C1-kickoff-call.txt +0 -0
  276. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/evals/fixtures/transcript-citations/E1-intro-email.md +0 -0
  277. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/extract.md +0 -0
  278. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/interview.md +0 -0
  279. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/likec4.md +0 -0
  280. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/project-types.md +0 -0
  281. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/quality-goals.md +0 -0
  282. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/research.md +0 -0
  283. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/rewriting.md +0 -0
  284. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/viewer.md +0 -0
  285. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/references/writing.md +0 -0
  286. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/ba-facts.mjs +0 -0
  287. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/check-quotes.mjs +0 -0
  288. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/drift.mjs +0 -0
  289. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/ba-package.mjs +0 -0
  290. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/cdp.mjs +0 -0
  291. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/chrome.mjs +0 -0
  292. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/companion-links.mjs +0 -0
  293. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/doc-kinds.mjs +0 -0
  294. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/doc-links.mjs +0 -0
  295. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/doc-routes.mjs +0 -0
  296. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/doc-sections.mjs +0 -0
  297. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/drift.mjs +0 -0
  298. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/embed.mjs +0 -0
  299. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/er-entities.mjs +0 -0
  300. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/fonts.mjs +0 -0
  301. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/frontmatter.mjs +0 -0
  302. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/git-diff.mjs +0 -0
  303. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/inputs.mjs +0 -0
  304. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/likec4-config.mjs +0 -0
  305. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/likec4-extract.mjs +0 -0
  306. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/likec4-steps.mjs +0 -0
  307. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-defs.mjs +0 -0
  308. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-flows.mjs +0 -0
  309. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-inline.mjs +0 -0
  310. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-links.mjs +0 -0
  311. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-list.mjs +0 -0
  312. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-render.mjs +0 -0
  313. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-shape.mjs +0 -0
  314. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-tables.mjs +0 -0
  315. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-views.mjs +0 -0
  316. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/md-wide.mjs +0 -0
  317. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/nav.mjs +0 -0
  318. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/offline.mjs +0 -0
  319. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/port.mjs +0 -0
  320. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/quality-gate.mjs +0 -0
  321. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/section-help.mjs +0 -0
  322. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/slug-registry.mjs +0 -0
  323. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/state.mjs +0 -0
  324. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/strategy-sections.mjs +0 -0
  325. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-clusters.mjs +0 -0
  326. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-deployment.mjs +0 -0
  327. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-elections.mjs +0 -0
  328. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-links.mjs +0 -0
  329. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-model-tables.mjs +0 -0
  330. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-palette.mjs +0 -0
  331. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +0 -0
  332. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-quotes.mjs +0 -0
  333. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-strategy.mjs +0 -0
  334. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/lib/validate-tree.mjs +0 -0
  335. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/likec4-config.mjs +0 -0
  336. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/likec4-export.mjs +0 -0
  337. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/likec4-gen.mjs +0 -0
  338. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/record.mjs +0 -0
  339. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/render.mjs +0 -0
  340. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/serve.mjs +0 -0
  341. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/ba-package.test.mjs +0 -0
  342. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/companion-links.test.mjs +0 -0
  343. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/doc-kinds.test.mjs +0 -0
  344. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/doc-links.test.mjs +0 -0
  345. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/doc-routes.test.mjs +0 -0
  346. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/doc-sections.test.mjs +0 -0
  347. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/drift.test.mjs +0 -0
  348. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/embed.test.mjs +0 -0
  349. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/er-entities.test.mjs +0 -0
  350. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/extract-workflow.test.mjs +0 -0
  351. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/ARCHITECTURE.md +0 -0
  352. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/broken/model.c4 +0 -0
  353. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/pass/model.c4 +0 -0
  354. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/adr/0001-sample.md +0 -0
  355. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimate.html +0 -0
  356. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimation.md +0 -0
  357. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model-broken.json +0 -0
  358. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model.json +0 -0
  359. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/docs-pass/threat-model.md +0 -0
  360. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/sample-model.json +0 -0
  361. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fixtures/sample.c4 +0 -0
  362. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/fonts.test.mjs +0 -0
  363. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/frontmatter.test.mjs +0 -0
  364. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/git-diff.test.mjs +0 -0
  365. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/likec4-config.test.mjs +0 -0
  366. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/likec4-extract.test.mjs +0 -0
  367. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/likec4-steps.test.mjs +0 -0
  368. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/md-flows.test.mjs +0 -0
  369. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/md-links.test.mjs +0 -0
  370. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/md-provenance.test.mjs +0 -0
  371. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/md-render.test.mjs +0 -0
  372. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/md-tables.test.mjs +0 -0
  373. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/md-views.test.mjs +0 -0
  374. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/md-wide.test.mjs +0 -0
  375. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/nav.test.mjs +0 -0
  376. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/offline.test.mjs +0 -0
  377. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +0 -0
  378. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/quality-gates.test.mjs +0 -0
  379. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/research-workflow.test.mjs +0 -0
  380. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/rewriting.test.mjs +0 -0
  381. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/section-help.test.mjs +0 -0
  382. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/serve.test.mjs +0 -0
  383. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/state.test.mjs +0 -0
  384. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-clusters.test.mjs +0 -0
  385. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-deployment.test.mjs +0 -0
  386. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-elections.test.mjs +0 -0
  387. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-links.test.mjs +0 -0
  388. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-model-tables.test.mjs +0 -0
  389. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +0 -0
  390. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-quotes.test.mjs +0 -0
  391. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-strategy.test.mjs +0 -0
  392. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/validate-tree.test.mjs +0 -0
  393. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/test/viewer-template.test.mjs +0 -0
  394. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/scripts/validate.mjs +0 -0
  395. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/workflows/extract.js +0 -0
  396. /package/plugins/{solution-architect → presales}/skills/analyze-requirements/workflows/research.js +0 -0
  397. /package/plugins/{solution-architect → presales}/skills/estimate/SKILL.md +0 -0
  398. /package/plugins/{solution-architect → presales}/skills/estimate/classic/FLOW.md +0 -0
  399. /package/plugins/{solution-architect → presales}/skills/estimate/classic/assets/estimate-template-agentic.html +0 -0
  400. /package/plugins/{solution-architect → presales}/skills/estimate/classic/assets/estimate-template.html +0 -0
  401. /package/plugins/{solution-architect → presales}/skills/estimate/classic/assets/scores-review-template.html +0 -0
  402. /package/plugins/{solution-architect → presales}/skills/estimate/classic/references/agentic-estimation.md +0 -0
  403. /package/plugins/{solution-architect → presales}/skills/estimate/classic/references/ai-multipliers.md +0 -0
  404. /package/plugins/{solution-architect → presales}/skills/estimate/classic/references/interview.md +0 -0
  405. /package/plugins/{solution-architect → presales}/skills/estimate/classic/references/scoring-guide.md +0 -0
  406. /package/plugins/{solution-architect → presales}/skills/estimate/classic/references/slicing.md +0 -0
  407. /package/plugins/{solution-architect → presales}/skills/estimate/classic/references/task-shapes.md +0 -0
  408. /package/plugins/{solution-architect → presales}/skills/estimate/classic/references/techniques.md +0 -0
  409. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/compute.mjs +0 -0
  410. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/agentic-checks.mjs +0 -0
  411. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/checks.mjs +0 -0
  412. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/components.mjs +0 -0
  413. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/md-tables.mjs +0 -0
  414. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/redact.mjs +0 -0
  415. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/rollup.mjs +0 -0
  416. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/schema.mjs +0 -0
  417. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/score-csv.mjs +0 -0
  418. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/score-html.mjs +0 -0
  419. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/lib/scoring-checks.mjs +0 -0
  420. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/render.mjs +0 -0
  421. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/score-review.mjs +0 -0
  422. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/baselines.test.mjs +0 -0
  423. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/browser-agentic.test.mjs +0 -0
  424. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/browser.test.mjs +0 -0
  425. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/compute.test.mjs +0 -0
  426. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/e2e.test.mjs +0 -0
  427. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/fixtures/agentic-estimation-fail.md +0 -0
  428. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/fixtures/agentic-estimation-pass.md +0 -0
  429. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/fixtures/agentic-inputs.json +0 -0
  430. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/fixtures/booking-inputs.json +0 -0
  431. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/fixtures/estimation-fail.md +0 -0
  432. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/fixtures/estimation-pass.md +0 -0
  433. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/fixtures/measurements.jsonl +0 -0
  434. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/measurements.test.mjs +0 -0
  435. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/pricing.test.mjs +0 -0
  436. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/quality-gates.test.mjs +0 -0
  437. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/references.test.mjs +0 -0
  438. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/render.test.mjs +0 -0
  439. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/schema.test.mjs +0 -0
  440. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/score-review.test.mjs +0 -0
  441. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/scoring.test.mjs +0 -0
  442. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/url-state.test.mjs +0 -0
  443. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/validate.test.mjs +0 -0
  444. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/zip-store.test.mjs +0 -0
  445. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/test/zip.mjs +0 -0
  446. /package/plugins/{solution-architect → presales}/skills/estimate/classic/scripts/validate.mjs +0 -0
  447. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/gate-check-northgate/northgate-email.md +0 -0
  448. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/pre-fed-agentic-halyard/measurements.jsonl +0 -0
  449. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/pre-fed-agentic-halyard/requirements.json +0 -0
  450. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/pre-fed-agentic-halyard/requirements.md +0 -0
  451. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/pre-fed-traditional-trellis/ARCHITECTURE.md +0 -0
  452. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/pre-fed-traditional-trellis/requirements.json +0 -0
  453. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/pre-fed-traditional-trellis/requirements.md +0 -0
  454. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +0 -0
  455. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.json +0 -0
  456. /package/plugins/{solution-architect → presales}/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.md +0 -0
  457. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/agentic-task-schema.mjs +0 -0
  458. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/baselines.mjs +0 -0
  459. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/context-schema.mjs +0 -0
  460. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/estimate-math.mjs +0 -0
  461. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/inline.mjs +0 -0
  462. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/measurements.mjs +0 -0
  463. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/pricing.mjs +0 -0
  464. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/score-diff.mjs +0 -0
  465. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/scoring-schema.mjs +0 -0
  466. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/scoring.mjs +0 -0
  467. /package/plugins/{solution-architect → presales}/skills/estimate/shared/lib/zip.mjs +0 -0
  468. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/references/hidden-work-by-type.md +0 -0
  469. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/references/linking.md +0 -0
  470. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/compute.mjs +0 -0
  471. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/lib/pair-findings.mjs +0 -0
  472. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/lib/requirements.mjs +0 -0
  473. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/lib/schema-components.mjs +0 -0
  474. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/template/also-builds.css +0 -0
  475. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/template/also-builds.js +0 -0
  476. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/template/arch-link.js +0 -0
  477. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/template/click.js +0 -0
  478. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/template/link-picker.css +0 -0
  479. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/template/link-picker.js +0 -0
  480. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/template/prelude.js +0 -0
  481. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/fixtures/ARCHITECTURE-mini.md +0 -0
  482. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/fixtures/feedback.json +0 -0
  483. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/fixtures/inputs-pass.json +0 -0
  484. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/fixtures/measurements.jsonl +0 -0
  485. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/fixtures/requirements.json +0 -0
  486. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/page-view.test.mjs +0 -0
  487. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/quality-gates.test.mjs +0 -0
  488. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/requirements.test.mjs +0 -0
  489. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/rollup.test.mjs +0 -0
  490. /package/plugins/{solution-architect → presales}/skills/estimate/workflow-based/scripts/test/workflow-script.test.mjs +0 -0
  491. /package/plugins/{solution-architect → presales}/skills/new-lead/assets/dashboard/detail.html +0 -0
  492. /package/plugins/{solution-architect → presales}/skills/new-lead/assets/dashboard/index.html +0 -0
  493. /package/plugins/{solution-architect → presales}/skills/new-lead/assets/dashboard/start.sh +0 -0
  494. /package/plugins/{solution-architect → presales}/skills/new-lead/assets/dashboard/stats.mjs +0 -0
  495. /package/plugins/{solution-architect → presales}/skills/new-lead/assets/dashboard/vendor/reactflow-bundle.js +0 -0
  496. /package/plugins/{solution-architect → presales}/skills/new-lead/assets/vendor-build/entry.jsx +0 -0
  497. /package/plugins/{solution-architect → presales}/skills/new-lead/assets/vendor-build/package-lock.json +0 -0
  498. /package/plugins/{solution-architect → presales}/skills/new-lead/assets/vendor-build/package.json +0 -0
  499. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/harborline-logistics-tms/ARCHITECTURE.md +0 -0
  500. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/harborline-logistics-tms/brief.md +0 -0
  501. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/harborline-logistics-tms/dist/index.html +0 -0
  502. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/harborline-logistics-tms/estimation.json +0 -0
  503. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/harborline-logistics-tms/proposal.md +0 -0
  504. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/harborline-logistics-tms/requirements.json +0 -0
  505. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/sable-dental-booking/rfp.md +0 -0
  506. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/vellum-books-checkout/ARCHITECTURE.md +0 -0
  507. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads/vellum-books-checkout/rfp.md +0 -0
  508. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/existing-root-pipeline/leads.json +0 -0
  509. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/fresh-lead-northwind/rfp-northwind.md +0 -0
  510. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/skips-to-proposal/leads/meridian-freight-portal/rfp.md +0 -0
  511. /package/plugins/{solution-architect → presales}/skills/new-lead/evals/fixtures/skips-to-proposal/leads.json +0 -0
  512. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/init-root.mjs +0 -0
  513. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/lead-upsert.mjs +0 -0
  514. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/lib/enrich.mjs +0 -0
  515. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/lib/map-nodes.mjs +0 -0
  516. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/lib/map.mjs +0 -0
  517. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/lib/port.mjs +0 -0
  518. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/lib/registry.mjs +0 -0
  519. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/serve.mjs +0 -0
  520. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/e2e-workspace.test.mjs +0 -0
  521. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/enrich.test.mjs +0 -0
  522. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/ARCHITECTURE.md +0 -0
  523. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/brief.md +0 -0
  524. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/index.html +0 -0
  525. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/proposal-non-tech.html +0 -0
  526. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/threat-model.html +0 -0
  527. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation-inputs.json +0 -0
  528. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation.json +0 -0
  529. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/notes.md +0 -0
  530. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/proposal-non-tech.md +0 -0
  531. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/rfp.md +0 -0
  532. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/fixtures/root/leads.json +0 -0
  533. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/init-root.test.mjs +0 -0
  534. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/lead-upsert.test.mjs +0 -0
  535. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/map.test.mjs +0 -0
  536. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/port.test.mjs +0 -0
  537. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/registry-io.test.mjs +0 -0
  538. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/registry.test.mjs +0 -0
  539. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/serve.test.mjs +0 -0
  540. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/stats.test.mjs +0 -0
  541. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/validate-cli.test.mjs +0 -0
  542. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/test/vendor-bundle.test.mjs +0 -0
  543. /package/plugins/{solution-architect → presales}/skills/new-lead/scripts/validate.mjs +0 -0
  544. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/gate-check-rivet-gym/ARCHITECTURE.md +0 -0
  545. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/gate-check-rivet-gym/brief.md +0 -0
  546. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/ARCHITECTURE.md +0 -0
  547. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/brief.md +0 -0
  548. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation-inputs.json +0 -0
  549. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation.json +0 -0
  550. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/ARCHITECTURE.md +0 -0
  551. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/brief.md +0 -0
  552. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/dist/mermaid.js +0 -0
  553. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation-inputs.json +0 -0
  554. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.json +0 -0
  555. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.md +0 -0
  556. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-meridian-dental/ARCHITECTURE.md +0 -0
  557. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-meridian-dental/brief.md +0 -0
  558. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-meridian-dental/dist/mermaid.js +0 -0
  559. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation-inputs.json +0 -0
  560. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.json +0 -0
  561. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.md +0 -0
  562. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +0 -0
  563. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation-inputs.json +0 -0
  564. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation.json +0 -0
  565. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/measurements.jsonl +0 -0
  566. /package/plugins/{solution-architect → presales}/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/requirements.json +0 -0
  567. /package/plugins/{solution-architect → presales}/skills/proposal/scripts/lib/jargon.mjs +0 -0
  568. /package/plugins/{solution-architect → presales}/skills/proposal/scripts/lib/sections.mjs +0 -0
  569. /package/plugins/{solution-architect → presales}/skills/proposal/scripts/lib/workflow-lead.mjs +0 -0
  570. /package/plugins/{solution-architect → presales}/skills/proposal/scripts/test/fixtures/proposal-inputs-pass.json +0 -0
  571. /package/plugins/{solution-architect → presales}/skills/proposal/scripts/test/workflow-stage.mjs +0 -0
  572. /package/plugins/{solution-architect → presales}/workflows/review-links.js +0 -0
@@ -0,0 +1,91 @@
1
+ // The Word file: cover, a one-page contents with page numbers, body (each
2
+ // part on a new page), References, with real footnotes, CES fonts embedded,
3
+ // CES heading styles and a footer reading
4
+ // "Code Engine Studio · Proposal: <title> · page N".
5
+ import { readFileSync, writeFileSync } from 'node:fs';
6
+ import { bodyBlocks, SPACE } from './docx-blocks.mjs';
7
+ import { TOC_STYLE } from './contents.mjs';
8
+ import { referenceList, sourceNumbers } from './notes.mjs';
9
+ import { longDate } from './page.mjs';
10
+ import { COLORS, FIRM, LOGO, TTF } from './brand.mjs';
11
+
12
+ const TEXT_WIDTH = 11906 - 2 * 864; // twips: A4 less the side margins
13
+
14
+ function styles(d) {
15
+ const { BorderStyle } = d;
16
+ const h = (id, run, paragraph) => ({ id, name: id.replace(/(\d)/, ' $1'), basedOn: 'Normal', next: 'Normal', quickFormat: true, run, paragraph });
17
+ return {
18
+ default: { document: { run: { font: 'Roboto', size: 19, color: COLORS.ink }, paragraph: { spacing: { line: 264 }, widowControl: true } } },
19
+ paragraphStyles: [
20
+ h('Heading1', { font: 'Libre Baskerville', size: 34, color: COLORS.ink }, { spacing: { before: 0, after: 200 }, border: { top: { style: BorderStyle.SINGLE, size: 18, color: COLORS.accent, space: 6 } } }),
21
+ h('Heading2', { font: 'Libre Baskerville', size: 26, color: COLORS.ink }, { spacing: { before: 2 * SPACE.gap, after: SPACE.gap - 20 } }),
22
+ h('Heading3', { bold: true, size: 21, color: COLORS.ink }, { spacing: { before: SPACE.gap + 60, after: SPACE.item * 2 } }),
23
+ ],
24
+ };
25
+ }
26
+
27
+ function numbering(d) {
28
+ const { LevelFormat, AlignmentType } = d;
29
+ const lvl = (level, format, [text, left, hanging = 240]) => ({ level, format, text, alignment: AlignmentType.LEFT, style: { paragraph: { indent: { left, hanging } } } });
30
+ return { config: [
31
+ { reference: 'bul', levels: [lvl(0, LevelFormat.BULLET, ['•', 360]), lvl(1, LevelFormat.BULLET, ['–', 760])] },
32
+ { reference: 'num', levels: [lvl(0, LevelFormat.DECIMAL, ['%1.', 480, 400])] },
33
+ ] };
34
+ }
35
+
36
+ function coverBlocks(meta, { d }) {
37
+ const { Paragraph, TextRun, ImageRun } = d;
38
+ const line = (label, value) => new Paragraph({ children: [new TextRun({ text: `${label} `, bold: true }), new TextRun(value)] });
39
+ return [
40
+ new Paragraph({ children: [new ImageRun({ type: 'png', data: readFileSync(LOGO), transformation: { width: 220, height: 47 } })], spacing: { after: 2400 } }),
41
+ new Paragraph({ children: [new TextRun({ text: (meta.kicker ?? 'Proposal').toUpperCase(), color: COLORS.accent, bold: true, size: 20 })], spacing: { after: 200 } }),
42
+ new Paragraph({ children: [new TextRun({ text: meta.title, font: 'Libre Baskerville', size: 60, color: COLORS.ink })], spacing: { after: 240 } }),
43
+ new Paragraph({ children: [new TextRun({ text: meta.subtitle, size: 30, color: COLORS.muted })], spacing: { after: 900 } }),
44
+ line('Prepared for', meta.preparedFor), line('Prepared by', FIRM), line('Date', longDate(meta.date)),
45
+ new Paragraph({ children: [new TextRun({ text: `Confidential. Prepared for ${meta.preparedFor}.`, color: COLORS.muted })] }),
46
+ ];
47
+ }
48
+
49
+ // The contents page: parts, and their sections when they fit (contents.mjs),
50
+ // each with a dotted leader to its page number; pages[i] is entry i's page,
51
+ // left out until a print has been read.
52
+ function contentsBlocks(toc, pages, { d }) {
53
+ const { Paragraph, TextRun, Tab, HeadingLevel, TabStopType, LeaderType } = d;
54
+ const stop = [{ type: TabStopType.RIGHT, position: TEXT_WIDTH, leader: LeaderType.DOT }];
55
+ return [
56
+ new Paragraph({ heading: HeadingLevel.HEADING_1, pageBreakBefore: true, children: [new TextRun('Contents')] }),
57
+ ...toc.map((t, i) => {
58
+ const s = t.level === 2 ? TOC_STYLE.part : TOC_STYLE.section;
59
+ const run = { size: s.size, color: t.level === 2 ? COLORS.ink : COLORS.muted };
60
+ return new Paragraph({ tabStops: stop, indent: s.indent ? { left: s.indent } : undefined, spacing: { before: s.before, after: s.after },
61
+ // No empty run before the numbers are known: LibreOffice prints a damaged PDF on one.
62
+ children: [new TextRun({ ...run, text: t.text }), ...(pages?.[i] ? [new TextRun({ ...run, children: [new Tab(), String(pages[i])] })] : [])] });
63
+ }),
64
+ ];
65
+ }
66
+
67
+ function referencesBlocks(md, ctx) {
68
+ const list = referenceList(md, ctx.refs);
69
+ if (!list.length) return [];
70
+ const { Paragraph, TextRun, HeadingLevel } = ctx.d;
71
+ const flows = ctx.flow.has(ctx.partN + 1);
72
+ return [new Paragraph({ heading: HeadingLevel.HEADING_1, pageBreakBefore: !flows, spacing: flows ? { before: SPACE.part, after: 200 } : undefined, keepNext: true, children: [new TextRun('References')] }),
73
+ ...list.map((t) => new Paragraph({ children: [new TextRun({ text: t, size: 17 })], numbering: { reference: 'num', level: 0, instance: 999 }, spacing: { after: SPACE.gap - 40 }, keepLines: true }))];
74
+ }
75
+
76
+ // tool: loadTool(); doc: { md (body), meta, refs, figures, toc ([{ text, level }]) };
77
+ // pages: the page of each contents entry, once a print is read;
78
+ // flow: indexes of the parts that follow the part before on its page.
79
+ export async function writeDocx(file, { tool, doc, pages, flow = new Set() }) {
80
+ const d = tool.require('docx');
81
+ const ctx = { d, refs: doc.refs, figures: doc.figures, notes: { list: {}, next: 1, numbers: sourceNumbers(doc.md) }, figN: 0, listN: 0, partN: -1, flow };
82
+ const children = [...coverBlocks(doc.meta, { d }), ...contentsBlocks(doc.toc, pages, { d }), ...bodyBlocks(tool.marked.lexer(doc.md), ctx), ...referencesBlocks(doc.md, ctx)];
83
+ const footer = new d.Footer({ children: [new d.Paragraph({ alignment: d.AlignmentType.RIGHT, children: [
84
+ new d.TextRun({ text: `${FIRM} · Proposal: ${doc.meta.title} · page `, size: 16, color: '6B7280' }), new d.TextRun({ children: [d.PageNumber.CURRENT], size: 16, color: '6B7280' })] })] });
85
+ const document = new d.Document({
86
+ creator: FIRM, title: `Proposal: ${doc.meta.title}`, footnotes: ctx.notes.list, styles: styles(d), numbering: numbering(d),
87
+ fonts: [{ name: 'Roboto', data: readFileSync(TTF.roboto) }, { name: 'Libre Baskerville', data: readFileSync(TTF.libre) }],
88
+ sections: [{ properties: { page: { size: { width: 11906, height: 16838 }, margin: { top: 900, bottom: 900, left: 864, right: 864 } } }, footers: { default: footer }, children }],
89
+ });
90
+ writeFileSync(file, await d.Packer.toBuffer(document));
91
+ }
@@ -0,0 +1,48 @@
1
+ // Inline markdown (marked tokens) to docx runs. A source's first citation
2
+ // becomes a real footnote at the page foot, so the PDF printed from this file
3
+ // carries its note where a reader expects it; a later citation of the same
4
+ // source repeats that number as a plain superscript instead of a second note.
5
+ // Citations side by side are separated by a superscript comma.
6
+ import { CITE } from '../lib/prose.mjs';
7
+ import { footnoteText } from './notes.mjs';
8
+
9
+ const unescape = (s) => s.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'");
10
+
11
+ // ctx: { d (the docx module), refs, notes: { list: {}, next: 1, numbers: Map key -> n } }.
12
+ function citation(key, loc, ctx) {
13
+ const { TextRun, Paragraph, FootnoteReferenceRun } = ctx.d;
14
+ const n = ctx.notes.numbers.get(key);
15
+ if (n < ctx.notes.next) return new TextRun({ text: String(n), superScript: true });
16
+ // Word numbers footnotes in order, so the next note must be this source's number.
17
+ if (n !== ctx.notes.next) throw new Error(`footnote order: [^${key}] is source ${n} but would print as note ${ctx.notes.next}`);
18
+ ctx.notes.next += 1;
19
+ ctx.notes.list[n] = { children: [new Paragraph({ spacing: { after: 0, line: 240 }, children: [new TextRun({ text: ` ${footnoteText(ctx.refs, key, loc)}`, size: 15 })] })] };
20
+ return new FootnoteReferenceRun(n);
21
+ }
22
+
23
+ function textRuns(text, ctx, base) {
24
+ const { TextRun } = ctx.d;
25
+ const runs = [];
26
+ let last = 0;
27
+ for (const m of text.matchAll(CITE)) {
28
+ if (m.index > last) runs.push(new TextRun({ ...base, text: text.slice(last, m.index) }));
29
+ else if (m.index && runs.length) runs.push(new TextRun({ text: ',', superScript: true }));
30
+ runs.push(citation(m[1], m[2], ctx));
31
+ last = m.index + m[0].length;
32
+ }
33
+ if (last < text.length) runs.push(new TextRun({ ...base, text: text.slice(last) }));
34
+ return runs;
35
+ }
36
+
37
+ export function inlineRuns(tokens, ctx, base = {}) {
38
+ return (tokens ?? []).flatMap((t) => {
39
+ if (t.type === 'strong') return inlineRuns(t.tokens, ctx, { ...base, bold: true });
40
+ if (t.type === 'em') return inlineRuns(t.tokens, ctx, { ...base, italics: true });
41
+ if (t.type === 'link') return inlineRuns(t.tokens, ctx, { ...base, color: 'C4441A', underline: {} });
42
+ if (t.type === 'codespan') return [new ctx.d.TextRun({ ...base, text: unescape(t.text), font: 'Consolas' })];
43
+ if (t.type === 'br') return [new ctx.d.TextRun({ break: 1 })];
44
+ if (t.type === 'html') return [];
45
+ if (t.tokens) return inlineRuns(t.tokens, ctx, base);
46
+ return textRuns(unescape(t.text ?? t.raw ?? ''), ctx, base);
47
+ });
48
+ }
@@ -0,0 +1,75 @@
1
+ // Markdown tables to Word tables in the page's style: ink header row, light
2
+ // rules, a soft full-width row for a group (only its first cell filled), a
3
+ // rule above a bold total row. Column widths follow the length of the text.
4
+ // No row splits across pages and the header repeats; a short table stays on
5
+ // one page, and a long one never leaves its header with one row at a page
6
+ // foot or its last row alone at the top of the next.
7
+ import { inlineRuns } from './docx-inline.mjs';
8
+ import { COLORS } from './brand.mjs';
9
+
10
+ const TEXT_WIDTH = 10178; // twips: A4 less the 15 mm side margins
11
+ const WHOLE_ROWS = 14; // a table up to this many rows is kept on one page
12
+ const KEEP_HEAD = 2; // a longer table keeps its header with this many rows
13
+
14
+ function widths(t) {
15
+ // A column is at least as wide as its longest word and its longest short
16
+ // cell, so numbers and durations never break mid-figure.
17
+ const words = (s) => Math.max(0, ...String(s).split(/\s+/).map((w) => w.length));
18
+ const len = t.header.map((h, i) => Math.max(h.text.length, ...t.rows.map((r) => (r[i]?.text ?? '').length)));
19
+ const floor = t.header.map((h, i) => Math.max(words(h.text), ...t.rows.map((r) => ((r[i]?.text ?? '').length <= 14 ? (r[i]?.text ?? '').length : words(r[i]?.text ?? '')))));
20
+ const weight = len.map((n, i) => Math.min(Math.max(n, 10, floor[i] + 2), 70));
21
+ const sum = weight.reduce((a, b) => a + b, 0);
22
+ // Then every column gets room for its floor at 8.5 pt (about 105 twips a
23
+ // character plus the cell margins), taken from the widest columns.
24
+ const need = floor.map((f) => f * 105 + 200);
25
+ const w = weight.map((x) => Math.round((TEXT_WIDTH * x) / sum));
26
+ for (let i = 0; i < w.length; i += 1) {
27
+ const short = need[i] - w[i];
28
+ if (short <= 0) continue;
29
+ w[i] += short;
30
+ w[w.indexOf(Math.max(...w.filter((_, j) => j !== i)))] -= short;
31
+ }
32
+ return w;
33
+ }
34
+
35
+ function cell(c, { t, i, ctx, kind, keep }) {
36
+ const { TableCell, Paragraph, AlignmentType, ShadingType } = ctx.d;
37
+ const head = kind === 'head';
38
+ const base = head ? { bold: true, color: 'FFFFFF', size: 17 } : { size: 17, bold: i === 0 };
39
+ const fill = head ? COLORS.ink : kind === 'sum' ? 'EEF0F3' : undefined;
40
+ return new TableCell({
41
+ children: [new Paragraph({ alignment: t.align[i] === 'right' ? AlignmentType.RIGHT : undefined, children: inlineRuns(c.tokens, ctx, base), spacing: { after: 0, line: 252 }, keepNext: keep })],
42
+ shading: fill ? { type: ShadingType.CLEAR, fill, color: 'auto' } : undefined, margins: { top: 50, bottom: 50, left: 80, right: 80 },
43
+ });
44
+ }
45
+
46
+ function groupRow(r, { cols, ctx }) {
47
+ // A group row always stays with the row under it.
48
+ const { TableRow, TableCell, Paragraph, TextRun, ShadingType } = ctx.d;
49
+ return new TableRow({ cantSplit: true, children: [new TableCell({ columnSpan: cols, shading: { type: ShadingType.CLEAR, fill: COLORS.soft, color: 'auto' }, margins: { top: 60, bottom: 50, left: 80, right: 80 },
50
+ children: [new Paragraph({ keepNext: true, spacing: { after: 0 }, children: [new TextRun({ text: r[0].text.replace(/\*\*/g, ''), font: 'Libre Baskerville', size: 18, color: COLORS.ink })] })] })] });
51
+ }
52
+
53
+ // Whether row i (0 = header) stays with the next row.
54
+ export function keepRow(i, rows) {
55
+ if (i >= rows) return false;
56
+ if (rows <= WHOLE_ROWS) return true;
57
+ return i <= KEEP_HEAD || i === rows - 1;
58
+ }
59
+
60
+ export function tableBlock(t, ctx) {
61
+ const { Table, TableRow, WidthType, TableLayoutType, BorderStyle } = ctx.d;
62
+ const cols = t.header.length;
63
+ const n = t.rows.length;
64
+ const row = (r, i) => {
65
+ if (cols > 2 && r.slice(1).every((c) => !c.text.trim())) return groupRow(r, { cols, ctx });
66
+ const kind = r[0].text.startsWith('**') ? 'sum' : 'body';
67
+ return new TableRow({ cantSplit: true, children: r.slice(0, cols).map((c, j) => cell(c, { t, i: j, ctx, kind, keep: keepRow(i + 1, n) })) });
68
+ };
69
+ const line = { style: BorderStyle.SINGLE, size: 4, color: COLORS.rule };
70
+ return new Table({
71
+ width: { size: 100, type: WidthType.PERCENTAGE }, layout: TableLayoutType.FIXED, columnWidths: widths(t),
72
+ rows: [new TableRow({ tableHeader: true, cantSplit: true, children: t.header.map((c, i) => cell(c, { t, i, ctx, kind: 'head', keep: keepRow(0, n) })) }), ...t.rows.map(row)],
73
+ borders: { top: line, bottom: line, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE }, insideHorizontal: line, insideVertical: { style: BorderStyle.NONE } },
74
+ });
75
+ }
@@ -0,0 +1,95 @@
1
+ // Every figure of a proposal, drawn once in headless Chrome: architecture
2
+ // specs through the style-B generator, mermaid fences in the CES light theme,
3
+ // figure files as they are. Each gives an inline SVG for the page and a PNG
4
+ // for the Word file; architecture and figure files must pass the overlap
5
+ // check, or the build stops.
6
+ import { readFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { renderArchitecture } from '../diagram/index.mjs';
9
+ import { stepsSvg } from '../diagram/steps.mjs';
10
+ import { fontCss, MERMAID_THEME } from './brand.mjs';
11
+ import { overlapScript } from './overlap.mjs';
12
+ import { ARROW_LIMITS, arrowScript, mermaidLinks, sizeFindings } from './arrows.mjs';
13
+
14
+ export { PAGE } from '../diagram/style.mjs';
15
+ import { PAGE } from '../diagram/style.mjs';
16
+
17
+ export const figureKey = (lang, inner) => `${lang}\n${inner.trimEnd()}`;
18
+
19
+ const SEQUENCE = { useMaxWidth: false, actorFontSize: 16, messageFontSize: 16, noteFontSize: 15, mirrorActors: false, actorMargin: 70, boxMargin: 10, messageMargin: 40, width: 170, height: 56, wrap: true };
20
+
21
+ async function openPage(browser, tool) {
22
+ const page = await browser.newPage();
23
+ await page.setViewport({ width: 1600, height: 1200, deviceScaleFactor: 2 });
24
+ await page.setContent(`<!doctype html><html><head><style>${fontCss()} body{margin:0;background:#fff;font-family:Roboto}</style></head><body><div id="host" style="display:inline-block"></div></body></html>`);
25
+ await page.addScriptTag({ path: join(tool.dir, 'node_modules/mermaid/dist/mermaid.min.js') });
26
+ await page.addScriptTag({ content: `${overlapScript()}\n${arrowScript()}` });
27
+ await page.evaluate(async ({ theme, sequence }) => {
28
+ await document.fonts.load('16px Roboto');
29
+ await document.fonts.load('700 16px Roboto');
30
+ window.mermaid.initialize({ startOnLoad: false, theme: 'base', themeVariables: theme.vars, themeCSS: theme.css, securityLevel: 'strict', sequence });
31
+ }, { theme: MERMAID_THEME, sequence: SEQUENCE });
32
+ return page;
33
+ }
34
+
35
+ // Mermaid writes width="100%"; pin the drawing to its own size so it is
36
+ // measured, scaled and enlarged like every other figure. Its arrowheads are
37
+ // drawn half again as large, so they still read once the figure is scaled
38
+ // down to the page.
39
+ function naturalSize(svg) {
40
+ const vb = /viewBox="[-\d.]+ [-\d.]+ ([\d.]+) ([\d.]+)"/.exec(svg);
41
+ if (!vb) return svg;
42
+ const [w, h] = [Math.ceil(Number(vb[1])), Math.ceil(Number(vb[2]))];
43
+ return svg.replace(/^<svg([^>]*?) width="100%"/, `<svg$1 width="${w}" height="${h}"`).replace(/^(<svg[^>]*?) style="max-width:[^"]*"/, '$1')
44
+ .replace(/(<marker\b[^>]*?)markerWidth="([\d.]+)"([^>]*?)markerHeight="([\d.]+)"/g, (_, a, mw, b, mh) => `${a}markerWidth="${mw * 1.5}"${b}markerHeight="${mh * 1.5}"`);
45
+ }
46
+
47
+ // A left-to-right flow too wide to print at 60% or more is turned to run
48
+ // top to bottom, so its boxes and arrows stay readable on the page.
49
+ async function mermaidSvg(code, { page, n }) {
50
+ const draw = async (c) => naturalSize(await page.evaluate(async (id, src) => (await window.mermaid.render(id, src)).svg, `fig${n}`, c));
51
+ const svg = await draw(code);
52
+ const w = Number(/ width="([\d.]+)"/.exec(svg)?.[1] ?? 0);
53
+ return /^\s*flowchart LR/.test(code) && w > PAGE.w / 0.6 ? draw(code.replace(/flowchart LR/, 'flowchart TB')) : svg;
54
+ }
55
+
56
+ // The figure's SVG and how many links its source declares (null: not counted).
57
+ async function sourceSvg(fence, { lead, tool, page, n }) {
58
+ if (fence.lang === 'mermaid') return { svg: await mermaidSvg(fence.body, { page, n }), expected: mermaidLinks(fence.body) };
59
+ if (fence.lang === 'steps') { const r = stepsSvg(fence.body, fence.meta.caption); return { svg: r.svg, expected: r.edges }; }
60
+ const file = lead.diagrams.get(fence.meta.file);
61
+ if (fence.lang === 'figure') return { svg: readFileSync(file.path, 'utf8'), expected: null };
62
+ const r = await renderArchitecture(file.spec, tool.dir);
63
+ return { svg: r.svg, expected: r.edges, warnings: r.warnings };
64
+ }
65
+
66
+ async function drawOne(fence, ctx) {
67
+ const { svg, expected, warnings = [] } = await sourceSvg(fence, ctx);
68
+ await ctx.page.evaluate((s) => { document.getElementById('host').innerHTML = s; }, svg);
69
+ const el = await ctx.page.$('#host svg');
70
+ const box = await el.boundingBox();
71
+ const png = await el.screenshot({ type: 'png', omitBackground: false });
72
+ const scale = Math.min(1, PAGE.w / box.width, PAGE.h / box.height);
73
+ const found = await ctx.page.evaluate((lang, limits) => ({ hits: [...(lang === 'mermaid' ? [] : window.ovCheck(document.querySelector('#host svg'))),
74
+ ...window.arCheck(document.querySelector('#host svg'), limits)], smallest: window.arSmallestText(document.querySelector('#host svg')) }), fence.lang, { ...ARROW_LIMITS, scale, expected });
75
+ const hits = [...warnings, ...found.hits, ...sizeFindings({ lang: fence.lang, box, smallest: found.smallest }, PAGE)];
76
+ return { svg, png, width: Math.round(box.width), height: Math.round(box.height), caption: fence.meta.caption ?? '', lang: fence.lang, hits };
77
+ }
78
+
79
+ // fences: figureFences(md) or the workflow page's flows; lead: loadProposal's result.
80
+ export async function renderFigures({ fences, lead, tool }) {
81
+ const browser = await tool.puppeteer.launch({ executablePath: tool.chrome, headless: true, args: ['--no-sandbox', '--font-render-hinting=none'] });
82
+ const figures = new Map();
83
+ const findings = [];
84
+ try {
85
+ const page = await openPage(browser, tool);
86
+ for (const [n, fence] of fences.entries()) {
87
+ const fig = await drawOne(fence, { lead, tool, page, n }).catch((e) => { throw new Error(`figure "${fence.meta.caption ?? fence.meta.file}" failed: ${e.message}`); });
88
+ for (const h of fig.hits) findings.push(`figure "${fig.caption}": ${h}`);
89
+ figures.set(figureKey(fence.lang, fence.inner), fig);
90
+ }
91
+ } finally {
92
+ await browser.close();
93
+ }
94
+ return { figures, findings };
95
+ }
@@ -0,0 +1,80 @@
1
+ // Proposal body as HTML through marked: parts with the CES heading rule,
2
+ // figures inline as SVG (click to enlarge), tables with group and total rows,
3
+ // citations as footnotes numbered by source (the References number) and
4
+ // listed once at the end of each part that cites them, and the References
5
+ // list at the end.
6
+ import { figureKey } from './figures.mjs';
7
+ import { footnoteText, referenceList, sourceNumbers } from './notes.mjs';
8
+ import { CITE } from '../lib/prose.mjs';
9
+ import { headingText } from '../lib/parts.mjs';
10
+ import { scopeIds } from './scope-ids.mjs';
11
+
12
+ export { scopeIds };
13
+
14
+ export const slug = (s) => s.toLowerCase().replace(/<[^>]+>/g, '').replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
15
+ const attr = (s) => String(s).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;');
16
+
17
+ function figureHtml(fig, n) {
18
+ let svg = scopeIds(fig.svg, n).replace(/^<svg /, `<svg role="img" aria-label="${attr(fig.caption)}" data-w="${fig.width}" data-h="${fig.height}" `);
19
+ const size = `width:${fig.width}px;max-width:100%;height:auto`;
20
+ svg = /style="max-width:[^"]*"/.test(svg) ? svg.replace(/style="max-width:[^"]*"/, `style="${size}"`) : svg.replace(/^(<svg[^>]*?) style="/, `$1 style="${size};`);
21
+ return `<figure class="diagram" data-n="${n}"><div class="fig-inner" tabindex="0" role="button" title="Click to enlarge">${svg}</div>`
22
+ + `<figcaption><span>Figure ${n}.</span> ${attr(fig.caption)} <em class="hint">Click to enlarge.</em></figcaption></figure>`;
23
+ }
24
+
25
+ function tableHtml(token) {
26
+ const cell = (tag, c) => `<${tag}${c.align ? ` style="text-align:${c.align}"` : ''}>${this.parser.parseInline(c.tokens)}</${tag}>`;
27
+ const rows = token.rows.map((r) => {
28
+ if (r.length > 2 && r.slice(1).every((c) => !c.text.trim())) return `<tr class="grp"><td colspan="${r.length}">${this.parser.parseInline(r[0].tokens)}</td></tr>`;
29
+ return `<tr${r[0].text.startsWith('**') ? ' class="sum"' : ''}>${r.map((c) => cell('td', c)).join('')}</tr>`;
30
+ }).join('');
31
+ return `<div class="tbl"><table><thead><tr>${token.header.map((c) => cell('th', c)).join('')}</tr></thead><tbody>${rows}</tbody></table></div>`;
32
+ }
33
+
34
+ function renderer(tool, { figures, toc }) {
35
+ const r = new tool.marked.Renderer();
36
+ let n = 0;
37
+ r.code = ({ text, lang }) => {
38
+ const fig = figures.get(figureKey(lang, text));
39
+ if (!fig) return `<pre><code>${attr(text)}</code></pre>`;
40
+ n += 1;
41
+ return figureHtml(fig, n);
42
+ };
43
+ r.heading = function heading({ tokens, depth, text }) {
44
+ const inner = this.parser.parseInline(tokens).replace(/\s*\{#[a-z-]+\}\s*$/, '');
45
+ const id = slug(headingText(text));
46
+ if (depth === 2 || depth === 3) toc.push({ id, text: inner, level: depth });
47
+ return `<h${depth} id="${id}"${depth === 2 ? ' class="part"' : ''}>${inner}</h${depth}>\n`;
48
+ };
49
+ r.table = tableHtml;
50
+ return r;
51
+ }
52
+
53
+ // One number per source; each part ends with the notes for the sources it cites.
54
+ function footnotes(html, refs, numbers) {
55
+ return html.split(/(?=<h2 )/).map((part) => {
56
+ const notes = new Map();
57
+ const out = part.replace(CITE, (_, key, loc) => {
58
+ const n = numbers.get(key);
59
+ if (!notes.has(n)) notes.set(n, footnoteText(refs, key, loc));
60
+ return `<sup class="fn"><a href="#ref-${n}" title="${attr(footnoteText(refs, key, loc))}">${n}</a></sup>`;
61
+ }).replace(/<\/sup><sup class="fn">/g, ',</sup><sup class="fn">');
62
+ if (!notes.size) return out;
63
+ return `${out}<aside class="notes" aria-label="Notes"><ol>${[...notes].sort(([a], [b]) => a - b).map(([n, text]) => `<li value="${n}">${attr(text)}</li>`).join('')}</ol></aside>`;
64
+ }).join('');
65
+ }
66
+
67
+ function referencesHtml(md, refs, toc) {
68
+ const list = referenceList(md, refs);
69
+ if (!list.length) return '';
70
+ toc.push({ id: 'references', text: 'References', level: 2 });
71
+ const link = (t) => attr(t).replace(/(https?:\/\/[^\s)]+)/, '<a href="$1">$1</a>');
72
+ return `<h2 id="references" class="part">References</h2><ol class="refs">${list.map((t, i) => `<li id="ref-${i + 1}">${link(t)}</li>`).join('')}</ol>`;
73
+ }
74
+
75
+ // md is the body without frontmatter; returns the HTML and the contents list.
76
+ export function bodyHtml({ md, refs, figures, tool }) {
77
+ const toc = [];
78
+ const html = tool.marked.parse(md, { renderer: renderer(tool, { figures, toc }), gfm: true });
79
+ return { html: footnotes(html, refs, sourceNumbers(md)) + referencesHtml(md, refs, toc), toc };
80
+ }
@@ -0,0 +1,48 @@
1
+ // A read of the printed PDF for the page faults the Word file's keep rules
2
+ // are meant to prevent: a page left nearly empty, and a heading stranded at
3
+ // a page foot with nothing of its section under it. The build reports them;
4
+ // the fix is in the text (shorten or move what spills) or in the keep rules.
5
+ const NEAR_EMPTY = 0.15; // share of the page body
6
+
7
+ const norm = (s) => s.normalize('NFKC').replace(/\s+/g, ' ').trim();
8
+ const FOOTER = /Code Engine Studio · Proposal: .* · page \d+$/;
9
+
10
+ // pages: page texts; fill: { body, notes } per page (pdf.mjs pageFill);
11
+ // headings: every heading text that may print. Returns one line per fault.
12
+ export function layoutNotes({ pages, fill, headings }) {
13
+ const out = [];
14
+ fill.forEach(({ body, notes }, i) => {
15
+ if (i > 0 && body + notes < NEAR_EMPTY) out.push(`page ${i + 1} is nearly empty (${Math.round((body + notes) * 100)}% of the page used)`);
16
+ });
17
+ const wanted = new Set(headings.map(norm));
18
+ pages.forEach((text, i) => {
19
+ const lines = text.split('\n').map(norm).filter((l) => l && !FOOTER.test(l));
20
+ const last = lines[lines.length - 1];
21
+ if (last && wanted.has(last)) out.push(`page ${i + 1} ends with the heading "${last}": it should start the next page`);
22
+ });
23
+ return out;
24
+ }
25
+
26
+ // Which parts may follow the part before them on its last page instead of
27
+ // starting a new one: those whose whole first page fits in the room left
28
+ // there. Every part starts a new page in the first print; this reads that
29
+ // print, and a part that flows on leaves the pages after its first as they
30
+ // were. starts: the page (1-based) each part's heading printed on, References
31
+ // last; fill: { body, notes } per page, one per printed page. Returns the
32
+ // indexes of the parts (References included) that flow on. The first part
33
+ // always opens its own page.
34
+ export const FLOW = { fit: 0.9, gap: 0.05 };
35
+
36
+ export function flowingParts({ starts, fill }) {
37
+ const flow = new Set();
38
+ const used = (page) => fill[page - 1].body + fill[page - 1].notes;
39
+ let carry = null; // share used of the page the previous part ends on, after any flow
40
+ const next = [...starts.slice(1), fill.length + 1];
41
+ for (let k = 0; k < starts.length; k += 1) {
42
+ const single = next[k] === starts[k] + 1;
43
+ const fits = k > 0 && carry != null && carry + FLOW.gap + used(starts[k]) <= FLOW.fit;
44
+ if (fits) flow.add(k);
45
+ carry = fits && single ? carry + FLOW.gap + used(starts[k]) : used(next[k] - 1);
46
+ }
47
+ return flow;
48
+ }
@@ -0,0 +1,30 @@
1
+ // Footnote and References text from references.json. A client document is
2
+ // named by title and date; a public source by title, publisher and date in
3
+ // its footnote, and with its URL and the day it was checked in References.
4
+ // Each source has one number, in the order it is first cited: the References
5
+ // list uses it, the source's one footnote carries it, and every later
6
+ // citation of the same source repeats it, so a page never holds the same
7
+ // note twice.
8
+ import { CITE, unfenced } from '../lib/prose.mjs';
9
+
10
+ export function footnoteText(refs, key, loc) {
11
+ const r = refs[key];
12
+ const where = loc ? `, ${loc}` : '';
13
+ if (r.client) return `${r.title}, ${r.date}${where}.`;
14
+ return `${r.title}${where}. ${[r.publisher, r.date].filter(Boolean).join(', ')}.`.replace(/\. \.$/, '.');
15
+ }
16
+
17
+ export function referenceText(r) {
18
+ if (r.client) return `${r.title}. ${r.publisher ?? 'Client document'}, ${r.date}.`;
19
+ return `${r.title}. ${r.publisher ?? ''}${r.date ? `, ${r.date}` : ''}. ${r.url}${r.checked ? ` (checked ${r.checked})` : ''}`.replace(/^(.*?)\. , /, '$1. ');
20
+ }
21
+
22
+ // Cited keys in the order they are first cited; fenced code holds no citations.
23
+ export const citedOrder = (md) => [...new Set([...unfenced(md).matchAll(CITE)].map((m) => m[1]))];
24
+
25
+ // key -> its number (1-based), shared by the footnotes and References.
26
+ export const sourceNumbers = (md) => new Map(citedOrder(md).map((k, i) => [k, i + 1]));
27
+
28
+ export function referenceList(md, refs) {
29
+ return citedOrder(md).map((k) => referenceText(refs[k]));
30
+ }
@@ -0,0 +1,57 @@
1
+ // The label-overlap check every architecture figure passes before a build
2
+ // (after the Clinic build's check-figures.mjs): text over text, text over a
3
+ // service tile, a label pad over text, an arrow through a caption. Lines of
4
+ // one label stacked under each other are not overlaps, nor is text set inside
5
+ // a tile (a button) or a round step badge on an arrow. These functions run
6
+ // inside the page, on the real text boxes Chrome measured.
7
+ function ovHit(a, c, pad = -4) {
8
+ return a.x + pad < c.x + c.width && c.x + pad < a.x + a.width && a.y + pad < c.y + c.height && c.y + pad < a.y + a.height;
9
+ }
10
+
11
+ function ovInside(t, pd) {
12
+ const cx = t.x + t.width / 2; const cy = t.y + t.height / 2;
13
+ return cx > pd.x && cx < pd.x + pd.width && cy > pd.y && cy < pd.y + pd.height;
14
+ }
15
+
16
+ function ovShapes(svg) {
17
+ const rects = [...svg.querySelectorAll('rect')];
18
+ const texts = [...svg.querySelectorAll('text')].map((t) => ({ s: t.textContent, r: t.getBBox() }));
19
+ const tiles = rects.filter((r) => r.getAttribute('rx') === '8' && +r.getAttribute('width') >= 30 && +r.getAttribute('width') <= 72).map((r) => r.getBBox());
20
+ // Pads under arrow labels; a frame title's pad is not one, so an arrow
21
+ // through a frame title is still caught.
22
+ const pads = rects.filter((r) => ['3', '4'].includes(r.getAttribute('rx')) && !r.classList.contains('title-pad')).map((r) => r.getBBox());
23
+ const badges = [...svg.querySelectorAll('circle')].map((c) => c.getBBox());
24
+ const segs = [];
25
+ for (const p of svg.querySelectorAll(':scope > path[d^="M"]')) {
26
+ const pts = p.getAttribute('d').slice(1).split(' L').map((q) => q.split(',').map(Number));
27
+ for (let k = 1; k < pts.length; k += 1) segs.push([pts[k - 1], pts[k]]);
28
+ }
29
+ return { texts, tiles, pads, badges, segs };
30
+ }
31
+
32
+ function ovStacked(a, b) {
33
+ const sameX = Math.abs((a.x + a.width / 2) - (b.x + b.width / 2)) < 1.5 || Math.abs(a.x - b.x) < 1.5 || Math.abs((a.x + a.width) - (b.x + b.width)) < 1.5;
34
+ return sameX && Math.abs(a.y - b.y) <= 23;
35
+ }
36
+
37
+ function ovCrosses(r, [[x1, y1], [x2, y2]]) {
38
+ if (x1 === x2) return x1 > r.x && x1 < r.x + r.width && Math.max(y1, y2) > r.y && Math.min(y1, y2) < r.y + r.height;
39
+ if (y1 === y2) return y1 > r.y && y1 < r.y + r.height && Math.max(x1, x2) > r.x && Math.min(x1, x2) < r.x + r.width;
40
+ return false;
41
+ }
42
+
43
+ function ovCheck(svg) {
44
+ const { texts: T, tiles, pads, badges, segs } = ovShapes(svg);
45
+ const within = (t, boxes) => boxes.some((b) => ovInside(t, b));
46
+ const out = [];
47
+ for (const pd of pads) for (const t of T) if (!ovInside(t.r, pd) && ovHit(t.r, pd)) out.push(`label pad covers text "${t.s}"`);
48
+ T.forEach((a, i) => {
49
+ for (const b of T.slice(i + 1)) if (ovHit(a.r, b.r) && !ovStacked(a.r, b.r)) out.push(`text "${a.s}" overlaps text "${b.s}"`);
50
+ for (const tl of tiles) if (ovHit(a.r, tl) && !ovInside(a.r, tl)) out.push(`text "${a.s}" overlaps an icon tile`);
51
+ if (!within(a.r, pads) && !within(a.r, badges) && segs.some((s) => ovCrosses(a.r, s))) out.push(`an arrow crosses text "${a.s}"`);
52
+ });
53
+ return [...new Set(out)];
54
+ }
55
+
56
+ // Source for page.addScriptTag: the functions above, callable as window.ovCheck.
57
+ export const overlapScript = () => [ovHit, ovInside, ovShapes, ovStacked, ovCrosses, ovCheck].map(String).join('\n');
@@ -0,0 +1,50 @@
1
+ // The proposal page: the plain cover (logo, PROPOSAL, title, one line, who it
2
+ // is for, who prepared it, the date), the contents, the body, a footer, and a
3
+ // download bar for the PDF, the Word file and, when the lead has one, the
4
+ // estimate workbook. A draft carries a draft marker and no downloads.
5
+ import { readFileSync } from 'node:fs';
6
+ import { embed } from '../../../analyze-requirements/scripts/lib/embed.mjs';
7
+ import { FIRM, fontCss, logoDataUri } from './brand.mjs';
8
+
9
+ const TEMPLATE = new URL('../../assets/proposal-page.html', import.meta.url);
10
+ const esc = (s) => String(s ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
11
+
12
+ export const longDate = (iso) => new Date(`${iso}T00:00:00Z`).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric', timeZone: 'UTC' });
13
+
14
+ // meta: title, subtitle, preparedFor, date (ISO), kicker.
15
+ function coverHtml(meta) {
16
+ return `<section class="cover"><img class="logo" alt="${FIRM}" src="${logoDataUri()}"><div>`
17
+ + `<div class="kicker">${esc(meta.kicker ?? 'Proposal')}</div><h1>${esc(meta.title)}</h1><p class="sub">${esc(meta.subtitle)}</p><div class="rule"></div>`
18
+ + `<div class="meta"><b>Prepared for</b> ${esc(meta.preparedFor)}<br><b>Prepared by</b> ${FIRM}<br><b>Date</b> ${longDate(meta.date)}<br>Confidential. Prepared for ${esc(meta.preparedFor)}.</div>`
19
+ + '</div></section>';
20
+ }
21
+
22
+ function downloadsHtml({ draft, downloads }) {
23
+ if (draft) return '<nav class="dl-bar" aria-label="Draft"><div><span class="draft">Draft for review</span><span>Not for the client yet: the Word, PDF and Excel files are made by the final build.</span></div></nav>';
24
+ const links = downloads.map((d) => `<a href="${esc(d.href)}" download>${esc(d.label)}</a>`).join('');
25
+ return `<nav class="dl-bar" aria-label="Downloads"><div><span>Download this proposal:</span>${links}</div></nav>`;
26
+ }
27
+
28
+ // The contents: the parts, each with its sections nested under it.
29
+ function tocHtml(toc) {
30
+ const parts = [];
31
+ for (const t of toc) {
32
+ if (t.level === 3 && parts.length) parts[parts.length - 1].subs.push(t);
33
+ else parts.push({ ...t, subs: [] });
34
+ }
35
+ const link = (t) => `<a href="#${t.id}">${t.text}</a>`;
36
+ const item = (p) => `<li>${link(p)}${p.subs.length ? `<ol>${p.subs.map((s) => `<li>${link(s)}</li>`).join('')}</ol>` : ''}</li>`;
37
+ return `<nav class="toc"><h2>Contents</h2><ol>${parts.map(item).join('')}</ol></nav>`;
38
+ }
39
+
40
+ // body/toc from html.mjs; downloads: [{ href, label }].
41
+ export function pageHtml({ meta, body, toc, draft, downloads }) {
42
+ return embed({
43
+ template: readFileSync(TEMPLATE, 'utf8'),
44
+ slots: {
45
+ TITLE: esc(`Proposal: ${meta.title}`), FONTS: fontCss(), DOWNLOADS: downloadsHtml({ draft, downloads }),
46
+ COVER: coverHtml(meta), TOC: tocHtml(toc), BODY: body,
47
+ FOOT: `<div class="foot"><span>${FIRM} · codeenginestudio.com</span><span>${esc(meta.title)} · ${longDate(meta.date)}</span></div>`,
48
+ },
49
+ });
50
+ }