@v11g/agents-rock 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/README.md +65 -0
  2. package/bin/agents-rock.mjs +4 -0
  3. package/package.json +13 -0
  4. package/plugins/solution-architect/.claude-plugin/plugin.json +9 -0
  5. package/plugins/solution-architect/skills/analyze-requirements/README.md +75 -0
  6. package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +31 -0
  7. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/OFL.txt +98 -0
  8. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  9. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  10. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  11. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  12. package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
  13. package/plugins/solution-architect/skills/analyze-requirements/assets/mermaid-theme.json +52 -0
  14. package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +101 -0
  15. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +2389 -0
  16. package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +53 -0
  17. package/plugins/solution-architect/skills/analyze-requirements/references/likec4.md +157 -0
  18. package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +60 -0
  19. package/plugins/solution-architect/skills/analyze-requirements/references/research.md +78 -0
  20. package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +772 -0
  21. package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +206 -0
  22. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +74 -0
  23. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/chrome.mjs +66 -0
  24. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/companion-links.mjs +20 -0
  25. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-kinds.mjs +37 -0
  26. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +26 -0
  27. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +27 -0
  28. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-sections.mjs +78 -0
  29. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/embed.mjs +8 -0
  30. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/er-entities.mjs +16 -0
  31. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/fonts.mjs +39 -0
  32. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/frontmatter.mjs +17 -0
  33. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +41 -0
  34. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-config.mjs +41 -0
  35. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-extract.mjs +29 -0
  36. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-steps.mjs +22 -0
  37. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-defs.mjs +20 -0
  38. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-flows.mjs +46 -0
  39. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-inline.mjs +31 -0
  40. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-links.mjs +7 -0
  41. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-list.mjs +64 -0
  42. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +127 -0
  43. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-shape.mjs +19 -0
  44. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-tables.mjs +30 -0
  45. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-views.mjs +48 -0
  46. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-wide.mjs +44 -0
  47. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/nav.mjs +72 -0
  48. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/offline.mjs +19 -0
  49. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/port.mjs +13 -0
  50. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +113 -0
  51. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +49 -0
  52. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/slug-registry.mjs +11 -0
  53. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-clusters.mjs +15 -0
  54. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-deployment.mjs +8 -0
  55. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-elections.mjs +20 -0
  56. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-links.mjs +23 -0
  57. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-model-tables.mjs +24 -0
  58. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-palette.mjs +34 -0
  59. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +20 -0
  60. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-tree.mjs +16 -0
  61. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-config.mjs +19 -0
  62. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-export.mjs +35 -0
  63. package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-gen.mjs +39 -0
  64. package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +130 -0
  65. package/plugins/solution-architect/skills/analyze-requirements/scripts/serve.mjs +71 -0
  66. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +553 -0
  67. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/companion-links.test.mjs +60 -0
  68. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-kinds.test.mjs +41 -0
  69. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +104 -0
  70. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-routes.test.mjs +54 -0
  71. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-sections.test.mjs +197 -0
  72. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/embed.test.mjs +28 -0
  73. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/er-entities.test.mjs +14 -0
  74. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/ARCHITECTURE.md +47 -0
  75. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/broken/model.c4 +27 -0
  76. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/pass/model.c4 +29 -0
  77. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/adr/0001-sample.md +18 -0
  78. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimate.html +2 -0
  79. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimation.md +8 -0
  80. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model-broken.json +1 -0
  81. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model.json +1 -0
  82. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/threat-model.md +8 -0
  83. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample-model.json +1 -0
  84. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample.c4 +28 -0
  85. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fonts.test.mjs +38 -0
  86. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/frontmatter.test.mjs +27 -0
  87. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +72 -0
  88. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config-cli.test.mjs +26 -0
  89. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config.test.mjs +74 -0
  90. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-export-cli.test.mjs +61 -0
  91. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-extract.test.mjs +37 -0
  92. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-gen-cli.test.mjs +73 -0
  93. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-steps.test.mjs +32 -0
  94. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-flows.test.mjs +82 -0
  95. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-links.test.mjs +16 -0
  96. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-provenance.test.mjs +42 -0
  97. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +226 -0
  98. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-tables.test.mjs +30 -0
  99. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-views.test.mjs +76 -0
  100. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-wide.test.mjs +76 -0
  101. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/nav.test.mjs +236 -0
  102. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/offline.test.mjs +37 -0
  103. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +86 -0
  104. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gates.test.mjs +20 -0
  105. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +171 -0
  106. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/research-workflow.test.mjs +38 -0
  107. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +101 -0
  108. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/serve.test.mjs +48 -0
  109. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-clusters.test.mjs +46 -0
  110. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-deployment.test.mjs +23 -0
  111. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-elections.test.mjs +30 -0
  112. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-links.test.mjs +38 -0
  113. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-model-tables.test.mjs +51 -0
  114. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +28 -0
  115. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-tree.test.mjs +43 -0
  116. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/viewer-template.test.mjs +1206 -0
  117. package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +88 -0
  118. package/plugins/solution-architect/skills/analyze-requirements/workflows/research.js +57 -0
  119. package/plugins/solution-architect/skills/estimate/README.md +67 -0
  120. package/plugins/solution-architect/skills/estimate/SKILL.md +64 -0
  121. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +1128 -0
  122. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +95 -0
  123. package/plugins/solution-architect/skills/estimate/references/interview.md +80 -0
  124. package/plugins/solution-architect/skills/estimate/references/slicing.md +55 -0
  125. package/plugins/solution-architect/skills/estimate/references/techniques.md +111 -0
  126. package/plugins/solution-architect/skills/estimate/references/writing.md +211 -0
  127. package/plugins/solution-architect/skills/estimate/scripts/compute.mjs +23 -0
  128. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +128 -0
  129. package/plugins/solution-architect/skills/estimate/scripts/lib/components.mjs +19 -0
  130. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +85 -0
  131. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +10 -0
  132. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +30 -0
  133. package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +32 -0
  134. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +122 -0
  135. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +128 -0
  136. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +65 -0
  137. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +623 -0
  138. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +88 -0
  139. package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +34 -0
  140. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +112 -0
  141. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +58 -0
  142. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +30 -0
  143. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +60 -0
  144. package/plugins/solution-architect/skills/estimate/scripts/test/quality-gates.test.mjs +20 -0
  145. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +71 -0
  146. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +121 -0
  147. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +129 -0
  148. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +72 -0
  149. package/plugins/solution-architect/skills/estimate/scripts/validate.mjs +20 -0
  150. package/plugins/solution-architect/skills/new-lead/README.md +48 -0
  151. package/plugins/solution-architect/skills/new-lead/SKILL.md +113 -0
  152. package/plugins/solution-architect/skills/new-lead/assets/dashboard/detail.html +842 -0
  153. package/plugins/solution-architect/skills/new-lead/assets/dashboard/index.html +655 -0
  154. package/plugins/solution-architect/skills/new-lead/assets/dashboard/start.sh +3 -0
  155. package/plugins/solution-architect/skills/new-lead/assets/dashboard/stats.mjs +98 -0
  156. package/plugins/solution-architect/skills/new-lead/assets/dashboard/vendor/reactflow-bundle.js +473 -0
  157. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/entry.jsx +33 -0
  158. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package-lock.json +1055 -0
  159. package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package.json +19 -0
  160. package/plugins/solution-architect/skills/new-lead/scripts/init-root.mjs +73 -0
  161. package/plugins/solution-architect/skills/new-lead/scripts/lead-upsert.mjs +31 -0
  162. package/plugins/solution-architect/skills/new-lead/scripts/lib/enrich.mjs +20 -0
  163. package/plugins/solution-architect/skills/new-lead/scripts/lib/map-nodes.mjs +124 -0
  164. package/plugins/solution-architect/skills/new-lead/scripts/lib/map.mjs +117 -0
  165. package/plugins/solution-architect/skills/new-lead/scripts/lib/port.mjs +15 -0
  166. package/plugins/solution-architect/skills/new-lead/scripts/lib/registry.mjs +116 -0
  167. package/plugins/solution-architect/skills/new-lead/scripts/serve.mjs +163 -0
  168. package/plugins/solution-architect/skills/new-lead/scripts/test/e2e-workspace.test.mjs +59 -0
  169. package/plugins/solution-architect/skills/new-lead/scripts/test/enrich.test.mjs +16 -0
  170. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/ARCHITECTURE.md +16 -0
  171. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/brief.md +4 -0
  172. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/index.html +11 -0
  173. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/proposal-non-tech.html +2 -0
  174. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/threat-model.html +2 -0
  175. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation-inputs.json +6 -0
  176. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation.json +10 -0
  177. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/notes.md +3 -0
  178. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/proposal-non-tech.md +3 -0
  179. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/rfp.md +3 -0
  180. package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads.json +25 -0
  181. package/plugins/solution-architect/skills/new-lead/scripts/test/init-root.test.mjs +81 -0
  182. package/plugins/solution-architect/skills/new-lead/scripts/test/lead-upsert.test.mjs +67 -0
  183. package/plugins/solution-architect/skills/new-lead/scripts/test/map.test.mjs +72 -0
  184. package/plugins/solution-architect/skills/new-lead/scripts/test/port.test.mjs +31 -0
  185. package/plugins/solution-architect/skills/new-lead/scripts/test/registry-io.test.mjs +57 -0
  186. package/plugins/solution-architect/skills/new-lead/scripts/test/registry.test.mjs +49 -0
  187. package/plugins/solution-architect/skills/new-lead/scripts/test/serve.test.mjs +205 -0
  188. package/plugins/solution-architect/skills/new-lead/scripts/test/stats.test.mjs +92 -0
  189. package/plugins/solution-architect/skills/new-lead/scripts/test/validate-cli.test.mjs +24 -0
  190. package/plugins/solution-architect/skills/new-lead/scripts/test/vendor-bundle.test.mjs +9 -0
  191. package/plugins/solution-architect/skills/new-lead/scripts/validate.mjs +9 -0
  192. package/plugins/solution-architect/skills/proposal/README.md +36 -0
  193. package/plugins/solution-architect/skills/proposal/SKILL.md +58 -0
  194. package/plugins/solution-architect/skills/proposal/assets/proposal-template.html +82 -0
  195. package/plugins/solution-architect/skills/proposal/references/interview.md +63 -0
  196. package/plugins/solution-architect/skills/proposal/references/review.md +28 -0
  197. package/plugins/solution-architect/skills/proposal/references/writing.md +102 -0
  198. package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +22 -0
  199. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +75 -0
  200. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +54 -0
  201. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +17 -0
  202. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +43 -0
  203. package/plugins/solution-architect/skills/proposal/scripts/lib/jargon.mjs +9 -0
  204. package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +32 -0
  205. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +60 -0
  206. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +144 -0
  207. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +93 -0
  208. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +51 -0
  209. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +30 -0
  210. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +81 -0
  211. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +22 -0
  212. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +55 -0
  213. package/plugins/solution-architect/skills/proposal/scripts/test/quality-gates.test.mjs +20 -0
  214. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +70 -0
  215. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +40 -0
  216. package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +20 -0
  217. package/src/cli/agents.mjs +12 -0
  218. package/src/cli/args.mjs +46 -0
  219. package/src/cli/install.mjs +68 -0
  220. package/src/cli/main.mjs +124 -0
  221. package/src/cli/picker.mjs +78 -0
  222. package/src/cli/registry.mjs +26 -0
  223. package/src/cli/uninstall.mjs +38 -0
@@ -0,0 +1,60 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { mkdtempSync, writeFileSync, mkdirSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { join } from 'node:path';
6
+ import { estimateLink } from '../lib/companion-links.mjs';
7
+
8
+ function tree() {
9
+ const root = mkdtempSync(join(tmpdir(), 'companion-links-'));
10
+ const docs = join(root, 'docs');
11
+ const out = join(root, 'viewer');
12
+ mkdirSync(docs);
13
+ mkdirSync(out);
14
+ return { docs, out };
15
+ }
16
+
17
+ test('estimation page links a sibling estimate.html, relative to the out dir', () => {
18
+ const { docs, out } = tree();
19
+ writeFileSync(join(docs, 'estimate.html'), '<!doctype html>');
20
+ const page = { kind: 'estimation', path: join(docs, 'estimation.md') };
21
+ const link = estimateLink(page, out);
22
+ assert.match(link, /<a href="\.\.\/docs\/estimate\.html">/);
23
+ assert.match(link, /interactive/i);
24
+ });
25
+
26
+ // The viewer folder is the handover unit: when estimate.html is rendered into
27
+ // it, the link must stay inside the folder so shipping viewer/ alone works.
28
+ test('an estimate.html inside the viewer folder wins over the sibling', () => {
29
+ const { docs, out } = tree();
30
+ writeFileSync(join(docs, 'estimate.html'), '<!doctype html>');
31
+ writeFileSync(join(out, 'estimate.html'), '<!doctype html>');
32
+ const page = { kind: 'estimation', path: join(docs, 'estimation.md') };
33
+ assert.match(estimateLink(page, out), /<a href="estimate\.html">/);
34
+ });
35
+
36
+ // A dead link reads as a broken deliverable: an md-only run (no estimate skill
37
+ // render) must produce exactly the viewer it produces today.
38
+ test('no estimate.html beside the source means no link', () => {
39
+ const { docs, out } = tree();
40
+ const page = { kind: 'estimation', path: join(docs, 'estimation.md') };
41
+ assert.equal(estimateLink(page, out), '');
42
+ });
43
+
44
+ test('only the estimation companion gets the link', () => {
45
+ const { docs, out } = tree();
46
+ writeFileSync(join(docs, 'estimate.html'), '<!doctype html>');
47
+ for (const kind of ['spine', 'threat-model', 'domain-overview', undefined]) {
48
+ assert.equal(estimateLink({ kind, path: join(docs, 'threat-model.md') }, out), '');
49
+ }
50
+ });
51
+
52
+ test('the href is attribute-escaped', () => {
53
+ const { docs, out } = tree();
54
+ const evil = join(docs, 'a"b');
55
+ mkdirSync(evil);
56
+ writeFileSync(join(evil, 'estimate.html'), '<!doctype html>');
57
+ const link = estimateLink({ kind: 'estimation', path: join(evil, 'estimation.md') }, out);
58
+ assert.doesNotMatch(link, /href="[^"]*"b/);
59
+ assert.match(link, /&quot;/);
60
+ });
@@ -0,0 +1,41 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { kindOf } from '../lib/doc-kinds.mjs';
4
+
5
+ // Index 0 is ARCHITECTURE.md by construction — render.mjs already flags it this
6
+ // way with `spine: i === 0`. Nothing reads its filename, because a target repo
7
+ // is free to call it something else.
8
+ test('the first document is the spine whatever it is called', () => {
9
+ assert.equal(kindOf('ARCHITECTURE.md', 0), 'spine');
10
+ assert.equal(kindOf('docs/design/system.md', 0), 'spine');
11
+ });
12
+
13
+ test('the three fixed-name companions are recognised', () => {
14
+ assert.equal(kindOf('docs/threat-model.md', 1), 'threat-model');
15
+ assert.equal(kindOf('docs/estimation.md', 2), 'estimation');
16
+ assert.equal(kindOf('docs/DOMAIN-OVERVIEW.md', 3), 'domain-overview');
17
+ });
18
+
19
+ // A repo that writes THREAT-MODEL.md is writing the same document.
20
+ test('companion matching ignores case', () => {
21
+ assert.equal(kindOf('docs/THREAT-MODEL.md', 1), 'threat-model');
22
+ assert.equal(kindOf('docs/Domain-Overview.md', 2), 'domain-overview');
23
+ });
24
+
25
+ // Everything with no kind renders exactly as it does today. These are the four
26
+ // document classes the spec deliberately excludes, and each one silently
27
+ // acquiring an explainer is the regression this test exists to catch.
28
+ test('excluded document classes get no kind', () => {
29
+ assert.equal(kindOf('docs/adr/0001-use-postgres.md', 1), undefined);
30
+ assert.equal(kindOf('src/billing/CONTEXT.md', 2), undefined);
31
+ assert.equal(kindOf('CONTEXT-MAP.md', 3), undefined);
32
+ assert.equal(kindOf('docs/openapi.yaml', 4), undefined);
33
+ assert.equal(kindOf('docs/whatever.md', 5), undefined);
34
+ });
35
+
36
+ // A companion name at index 0 is still the spine: the position wins, because a
37
+ // set whose root document is called estimation.md would otherwise lose its 16
38
+ // section explainers and gain one wrong one.
39
+ test('position beats filename', () => {
40
+ assert.equal(kindOf('docs/estimation.md', 0), 'spine');
41
+ });
@@ -0,0 +1,104 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { rewriteDocLinks } from '../lib/doc-links.mjs';
4
+
5
+ const ids = new Map([
6
+ ['/repo/docs/adr/0002-rls.md', 'doc-adr-0002-multi-tenancy'],
7
+ ['/repo/ARCHITECTURE.md', 'doc-architecture'],
8
+ ]);
9
+
10
+ test('a link to a document in the set becomes an in-page anchor', () => {
11
+ const html = rewriteDocLinks(
12
+ '<p><a href="0002-rls.md">ADR-0002</a></p>', '/repo/docs/adr/index.md', ids,
13
+ );
14
+ assert.match(html, /<a href="#doc-adr-0002-multi-tenancy">ADR-0002<\/a>/);
15
+ });
16
+
17
+ test('relative hrefs resolve against the linking document, not the repo root', () => {
18
+ const html = rewriteDocLinks(
19
+ '<p><a href="../../ARCHITECTURE.md">arch</a></p>', '/repo/docs/adr/index.md', ids,
20
+ );
21
+ assert.match(html, /href="#doc-architecture"/);
22
+ });
23
+
24
+ test('a root-relative href resolves the same way', () => {
25
+ const html = rewriteDocLinks(
26
+ '<p><a href="docs/adr/0002-rls.md">x</a></p>', '/repo/ARCHITECTURE.md', ids,
27
+ );
28
+ assert.match(html, /href="#doc-adr-0002-multi-tenancy"/);
29
+ });
30
+
31
+ // Heading slugs are deduped across the whole set, so #context inside ADR-0002
32
+ // may have been minted as context-7. The document anchor is the honest target.
33
+ test('a fragment on a document link is dropped rather than guessed at', () => {
34
+ const html = rewriteDocLinks(
35
+ '<p><a href="0002-rls.md#context">why</a></p>', '/repo/docs/adr/index.md', ids,
36
+ );
37
+ assert.match(html, /href="#doc-adr-0002-multi-tenancy"/);
38
+ assert.doesNotMatch(html, /#context/);
39
+ });
40
+
41
+ // A link to a file the viewer does not contain has nothing to navigate to. Left
42
+ // alone it still looks clickable, which is worse than plain text.
43
+ test('a link to a document outside the set is unwrapped, keeping its text', () => {
44
+ const html = rewriteDocLinks(
45
+ '<p>see <a href="docs/PRD.md">docs/PRD.md</a>.</p>', '/repo/ARCHITECTURE.md', ids,
46
+ );
47
+ assert.doesNotMatch(html, /<a /);
48
+ assert.match(html, /class="ext-ref"[^>]*>docs\/PRD\.md<\/span>/);
49
+ assert.match(html, /<p>see .*\.<\/p>/);
50
+ });
51
+
52
+ test('an unwrapped reference keeps the original path in its title', () => {
53
+ const html = rewriteDocLinks(
54
+ '<p><a href="docs/PRD.md">the PRD</a></p>', '/repo/ARCHITECTURE.md', ids,
55
+ );
56
+ assert.match(html, /title="docs\/PRD\.md"/);
57
+ });
58
+
59
+ test('http and in-page hrefs are left untouched', () => {
60
+ const src = '<p><a href="https://example.com/x.md">ext</a><a href="#goals">g</a></p>';
61
+ assert.equal(rewriteDocLinks(src, '/repo/ARCHITECTURE.md', ids), src);
62
+ });
63
+
64
+ test('a document with no links is returned unchanged', () => {
65
+ const src = '<p>no links here</p>';
66
+ assert.equal(rewriteDocLinks(src, '/repo/ARCHITECTURE.md', ids), src);
67
+ });
68
+
69
+ // The rule is "any relative path", not a list of extensions. A .c4 model, a
70
+ // directory, a .py module — none of them can ever be a document in the set, so
71
+ // all of them are dead as links and all of them read better as text.
72
+ test('a link to a non-markdown source file is unwrapped', () => {
73
+ const html = rewriteDocLinks(
74
+ '<p><a href="docs/architecture/model/eos.c4">eos.c4</a></p>', '/repo/ARCHITECTURE.md', ids,
75
+ );
76
+ assert.doesNotMatch(html, /<a /);
77
+ assert.match(html, /class="ext-ref" title="docs\/architecture\/model\/eos\.c4">eos\.c4<\/span>/);
78
+ });
79
+
80
+ test('a link to a directory is unwrapped', () => {
81
+ const html = rewriteDocLinks(
82
+ '<p><a href="../mockup/">mockups</a></p>', '/repo/docs/adr/index.md', ids,
83
+ );
84
+ assert.match(html, /class="ext-ref" title="\.\.\/mockup\/">mockups<\/span>/);
85
+ });
86
+
87
+ test('an unwrapped reference keeps its fragment in the title', () => {
88
+ const html = rewriteDocLinks(
89
+ '<p><a href="docs/PRD.md#s10">PRD §10</a></p>', '/repo/ARCHITECTURE.md', ids,
90
+ );
91
+ assert.match(html, /title="docs\/PRD\.md#s10"/);
92
+ });
93
+
94
+ test('a protocol-relative url is not mistaken for a path', () => {
95
+ const src = '<p><a href="//cdn.example.com/x">cdn</a></p>';
96
+ assert.equal(rewriteDocLinks(src, '/repo/ARCHITECTURE.md', ids), src);
97
+ });
98
+
99
+ test('a root-absolute path is unwrapped: a single file has no site root', () => {
100
+ const html = rewriteDocLinks(
101
+ '<p><a href="/docs/guide">guide</a></p>', '/repo/ARCHITECTURE.md', ids,
102
+ );
103
+ assert.match(html, /class="ext-ref"/);
104
+ });
@@ -0,0 +1,54 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { routeMap } from '../lib/doc-routes.mjs';
4
+
5
+ const page = (docId, section, path) => ({ docId, section, path });
6
+ const routes = (pages) => [...routeMap(pages).values()];
7
+
8
+ // A document is what a reader opens, so a document is what gets a route. The
9
+ // slug comes from the source filename rather than the H1: a title gets
10
+ // reworded, a filename is the thing every other document already links to.
11
+ test('each document gets a route named after its source file', () => {
12
+ const pages = [
13
+ page('a', 'Architecture', '/r/ARCHITECTURE.md'),
14
+ page('b', 'Architecture', '/r/docs/architecture/DOMAIN-OVERVIEW.md'),
15
+ page('c', 'Architecture', '/r/docs/architecture/threat-model.md'),
16
+ ];
17
+ assert.deepEqual(routes(pages), ['architecture', 'domain-overview', 'threat-model']);
18
+ });
19
+
20
+ // #/decision-records has to land on the list, not on a file called index.
21
+ test("a section's index page takes the section slug instead of its filename", () => {
22
+ const pages = [
23
+ page('r1', 'Decision Records', '/r/docs/adr/0001-foundation.md'),
24
+ page('idx', 'Decision Records', '/r/docs/adr/index.md'),
25
+ ];
26
+ assert.deepEqual(routes(pages), ['0001-foundation', 'decision-records']);
27
+ });
28
+
29
+ test('the spine document keeps its own filename route, never the section slug', () => {
30
+ // Its section has no landing page, so nothing claims the section slug — and
31
+ // ARCHITECTURE.md arriving at #/architecture is the same string either way.
32
+ const pages = [{ ...page('a', 'Architecture', '/r/ARCHITECTURE.md'), spine: true }];
33
+ assert.deepEqual(routes(pages), ['architecture']);
34
+ });
35
+
36
+ test('two documents with the same filename get distinct routes', () => {
37
+ const pages = [
38
+ // Not README.md: a lone README is its section's landing and takes the
39
+ // section slug instead of its filename.
40
+ page('a', 'Architecture', '/r/docs/architecture/notes.md'),
41
+ page('b', 'Guides', '/r/docs/guides/notes.md'),
42
+ ];
43
+ assert.deepEqual(routes(pages), ['notes', 'notes-2']);
44
+ });
45
+
46
+ test('a filename is reduced to what a url fragment can carry', () => {
47
+ const pages = [page('a', 'Architecture', '/r/docs/C4 Model & Views.md')];
48
+ assert.deepEqual(routes(pages), ['c4-model-views']);
49
+ });
50
+
51
+ test('routes are keyed by document id so the nav and the body agree', () => {
52
+ const pages = [page('doc-x', 'Architecture', '/r/ARCHITECTURE.md')];
53
+ assert.equal(routeMap(pages).get('doc-x'), 'architecture');
54
+ });
@@ -0,0 +1,197 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { bucketPages, landingOf, buildDoc, slugOf } from '../lib/doc-sections.mjs';
4
+ import { routeMap } from '../lib/doc-routes.mjs';
5
+
6
+ const page = (docId, section, path, html = '<h1>x</h1>') => ({ docId, section, path, html });
7
+ const count = (html, re) => [...html.matchAll(re)].length;
8
+
9
+ test('pages bucket into consecutive runs, preserving the caller order', () => {
10
+ const buckets = bucketPages([
11
+ page('a', 'Architecture', '/r/ARCHITECTURE.md'),
12
+ page('b', 'Decision Records', '/r/docs/adr/0001.md'),
13
+ page('c', 'Decision Records', '/r/docs/adr/0002.md'),
14
+ ]);
15
+ assert.deepEqual(buckets.map((b) => b.label), ['Architecture', 'Decision Records']);
16
+ assert.deepEqual(buckets[1].pages.map((p) => p.docId), ['b', 'c']);
17
+ });
18
+
19
+ test('pages with no section land in one default bucket', () => {
20
+ const buckets = bucketPages([page('a', null, '/r/a.md'), page('b', null, '/r/b.md')]);
21
+ assert.equal(buckets.length, 1);
22
+ assert.equal(buckets[0].label, 'Documents');
23
+ });
24
+
25
+ // A section routes only if its author shipped an index page — that is the
26
+ // opt-in. No document-count threshold: 15 records behind an index is a set you
27
+ // browse, 15 records with no index is a run of documents you read.
28
+ test('a section that ships an index.md has a landing page', () => {
29
+ const bucket = bucketPages([
30
+ page('r1', 'Decision Records', '/r/docs/adr/0001.md'),
31
+ page('idx', 'Decision Records', '/r/docs/adr/index.md'),
32
+ ])[0];
33
+ assert.equal(landingOf(bucket).docId, 'idx');
34
+ });
35
+
36
+ test('README.md is a landing page when there is no index.md', () => {
37
+ const bucket = bucketPages([
38
+ page('r1', 'Decision Records', '/r/docs/adr/0001.md'),
39
+ page('rm', 'Decision Records', '/r/docs/adr/README.md'),
40
+ ])[0];
41
+ assert.equal(landingOf(bucket).docId, 'rm');
42
+ });
43
+
44
+ test('index.md wins over README.md when a section ships both', () => {
45
+ const bucket = bucketPages([
46
+ page('rm', 'Decision Records', '/r/docs/adr/README.md'),
47
+ page('idx', 'Decision Records', '/r/docs/adr/index.md'),
48
+ ])[0];
49
+ assert.equal(landingOf(bucket).docId, 'idx');
50
+ });
51
+
52
+ test('a section with no index page has no landing page', () => {
53
+ const bucket = bucketPages([page('a', 'Architecture', '/r/ARCHITECTURE.md')])[0];
54
+ assert.equal(landingOf(bucket), undefined);
55
+ });
56
+
57
+ test('every page is wrapped in its own element, keyed by its document id', () => {
58
+ const html = buildDoc([page('a', 'Architecture', '/r/A.md', '<h1>A</h1>')]);
59
+ assert.match(html, /<section class="page" id="page-a"[^>]*>\s*<h1>A<\/h1>\s*<\/section>/);
60
+ });
61
+
62
+ test('a section with an index is marked routed and names its landing page', () => {
63
+ const html = buildDoc([
64
+ page('r1', 'Decision Records', '/r/docs/adr/0001.md'),
65
+ page('idx', 'Decision Records', '/r/docs/adr/index.md'),
66
+ ]);
67
+ assert.match(html, /data-section="Decision Records"/);
68
+ assert.match(html, /data-routed/);
69
+ assert.match(html, /data-landing="page-idx"/);
70
+ });
71
+
72
+ test('a section with no index is not routed', () => {
73
+ const html = buildDoc([page('a', 'Architecture', '/r/ARCHITECTURE.md')]);
74
+ assert.doesNotMatch(html, /data-routed/);
75
+ assert.doesNotMatch(html, /data-landing/);
76
+ });
77
+
78
+ test('each page in a routed section carries its own title for the record list', () => {
79
+ const html = buildDoc([
80
+ { ...page('r1', 'Decision Records', '/r/docs/adr/0001.md'), title: 'ADR-0001: Foundation' },
81
+ page('idx', 'Decision Records', '/r/docs/adr/index.md'),
82
+ ]);
83
+ assert.match(html, /data-title="ADR-0001: Foundation"/);
84
+ });
85
+
86
+ test('section labels and titles are escaped', () => {
87
+ const html = buildDoc([{ ...page('a', 'R&D', '/r/a.md'), title: 'A & B' }]);
88
+ assert.match(html, /data-section="R&amp;D"/);
89
+ assert.match(html, /data-title="A &amp; B"/);
90
+ });
91
+
92
+ test('one wrapper per section, one page element per document', () => {
93
+ const html = buildDoc([
94
+ page('a', 'Architecture', '/r/A.md'),
95
+ page('b', 'Decision Records', '/r/docs/adr/0001.md'),
96
+ page('c', 'Decision Records', '/r/docs/adr/index.md'),
97
+ ]);
98
+ assert.equal(count(html, /class="doc-section"/g), 2);
99
+ assert.equal(count(html, /class="page"/g), 3);
100
+ });
101
+
102
+ // The section holding the root architecture document is the spine of the set:
103
+ // it is read, not browsed. Left ungated, a 226-byte docs/architecture/README.md
104
+ // would win the landing slot and hide ARCHITECTURE.md behind a stub.
105
+ test('the section holding the root document never routes', () => {
106
+ const bucket = bucketPages([
107
+ { ...page('arch', 'Architecture', '/r/ARCHITECTURE.md'), spine: true },
108
+ page('rm', 'Architecture', '/r/docs/architecture/README.md'),
109
+ ])[0];
110
+ assert.equal(landingOf(bucket), undefined);
111
+ assert.doesNotMatch(buildDoc(bucket.pages), /data-routed/);
112
+ });
113
+
114
+ // Each section is its own page now, so it needs an address. The slug is derived
115
+ // from the label rather than a counter: #/decision-records survives a reordered
116
+ // --docs list and reads as a place, #/section-2 does neither.
117
+ test('a section carries a slug and an id so it can be routed to', () => {
118
+ const html = buildDoc([page('a', 'Decision Records', '/r/docs/adr/0001.md')]);
119
+ assert.match(html, /id="sec-decision-records"/);
120
+ assert.match(html, /data-slug="decision-records"/);
121
+ });
122
+
123
+ test('a slug is reduced to what a url fragment can carry', () => {
124
+ const html = buildDoc([page('a', 'C4 / Model & Views', '/r/a.md')]);
125
+ assert.match(html, /data-slug="c4-model-views"/);
126
+ });
127
+
128
+ test('slugOf is exported so the rail names the same routes the document does', () => {
129
+ assert.equal(slugOf('Decision Records'), 'decision-records');
130
+ assert.equal(slugOf('R&D Notes'), 'r-d-notes');
131
+ });
132
+
133
+ // Routes are per document now: the section is the grouping, the page is what
134
+ // opens. The map comes from the caller so the nav and the body cannot disagree.
135
+ test('every page carries the route that opens it', () => {
136
+ const pages = [page('a', 'Architecture', '/r/ARCHITECTURE.md')];
137
+ const html = buildDoc(pages, routeMap(pages));
138
+ assert.match(html, /<section class="page" id="page-a" data-route="architecture"/);
139
+ });
140
+
141
+ test('a page with no route in the map is still rendered', () => {
142
+ const html = buildDoc([page('a', 'Architecture', '/r/A.md')], new Map());
143
+ assert.match(html, /id="page-a"/);
144
+ assert.doesNotMatch(html, /data-route=/);
145
+ });
146
+
147
+ /* ---------- drawer sections ---------- */
148
+
149
+ // §14 Decisions already tables every ADR, so a Decision Records rail section is
150
+ // the same set a second time — and the one the reader did not ask for, since they
151
+ // were looking at §14 when they clicked. The records stay in the document (a
152
+ // drawer needs something to show) but the section is marked so the router opens
153
+ // them over the page instead of replacing it.
154
+ const rec = (id, n) => ({ ...page(id, 'Decision Records', `/r/docs/adr/${n}.md`), drawer: true });
155
+
156
+ test('a section of drawer pages is marked as one', () => {
157
+ const html = buildDoc([
158
+ page('a', 'Architecture', '/r/ARCHITECTURE.md'),
159
+ rec('r1', '0001'), rec('r2', '0002'),
160
+ ]);
161
+ assert.match(html, /<div class="doc-section"[^>]*data-drawer/);
162
+ // One section is a drawer, the other is not — the flag is per section, not global.
163
+ assert.equal(count(html, /data-drawer/g), 1);
164
+ });
165
+
166
+ test('a section with no drawer pages is not marked', () => {
167
+ const html = buildDoc([page('a', 'Architecture', '/r/ARCHITECTURE.md')]);
168
+ assert.doesNotMatch(html, /data-drawer/);
169
+ });
170
+
171
+ // The records still need addresses: a drawer without a route cannot be linked to
172
+ // or reloaded into view, which is the whole reason to keep the hash in step.
173
+ test('drawer pages keep their routes', () => {
174
+ const pages = [page('a', 'Architecture', '/r/ARCHITECTURE.md'), rec('r1', '0001')];
175
+ const routes = routeMap(pages);
176
+ const html = buildDoc(pages, routes);
177
+ assert.match(html, /id="page-r1"[^>]*data-route="0001"/);
178
+ });
179
+
180
+ // The injection loop selects [data-kind="spine"] h2, so the attribute is the
181
+ // only thing telling the client which document is the spine and which of the
182
+ // three companions each other document is. Absent, every explainer is missing.
183
+ test('a page carries its document kind', () => {
184
+ const html = buildDoc([
185
+ { docId: 'a', title: 'Arch', html: '<h2>x</h2>', headings: [], kind: 'spine' },
186
+ ]);
187
+ assert.match(html, /data-kind="spine"/);
188
+ });
189
+
190
+ // A document with no kind renders exactly as it does today. An empty
191
+ // data-kind="" would match [data-kind] selectors and is worse than absence.
192
+ test('a page with no kind carries no kind attribute', () => {
193
+ const html = buildDoc([
194
+ { docId: 'b', title: 'ADR 1', html: '<h2>x</h2>', headings: [] },
195
+ ]);
196
+ assert.doesNotMatch(html, /data-kind/);
197
+ });
@@ -0,0 +1,28 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { embed } from '../lib/embed.mjs';
4
+
5
+ test('replaces every slot marker', () => {
6
+ const out = embed({
7
+ template: '<body><!-- slot:DOC --><script><!-- slot:MERMAID --></script></body>',
8
+ slots: { DOC: '<h1>hi</h1>', MERMAID: 'window.m=1' },
9
+ });
10
+ assert.match(out, /<h1>hi<\/h1>/);
11
+ assert.match(out, /window\.m=1/);
12
+ });
13
+
14
+ test('throws on marker without slot', () => {
15
+ assert.throws(() => embed({ template: '<!-- slot:MISSING -->', slots: {} }), /MISSING/);
16
+ });
17
+
18
+ test('throws on slot without marker', () => {
19
+ assert.throws(() => embed({ template: 'no markers', slots: { EXTRA: 'x' } }), /EXTRA/);
20
+ });
21
+
22
+ test('does not re-expand slot content containing marker-shaped text', () => {
23
+ const out = embed({
24
+ template: '<!-- slot:A -->AFTER<!-- slot:A -->',
25
+ slots: { A: '<!-- slot:A -->INJECTED' },
26
+ });
27
+ assert.strictEqual(out, '<!-- slot:A -->INJECTEDAFTER<!-- slot:A -->INJECTED');
28
+ });
@@ -0,0 +1,14 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { erEntities } from '../lib/er-entities.mjs';
4
+
5
+ const MD = '```mermaid\nerDiagram\n ORDER ||--o{ LINE_ITEM : contains\n CUSTOMER {\n string name\n }\n```';
6
+
7
+ test('collects entities from relations and blocks', () => {
8
+ assert.deepEqual(erEntities(MD).sort(), ['CUSTOMER', 'LINE_ITEM', 'ORDER']);
9
+ });
10
+
11
+ test('ignores non-er mermaid fences', () => {
12
+ const md = '```mermaid\nflowchart TD\n A --> B\n```';
13
+ assert.deepEqual(erEntities(md), []);
14
+ });
@@ -0,0 +1,47 @@
1
+ ---
2
+ electedDocs: [{"name":"threat-model","elected":false,"reason":"CLI-only fixture, no external attack surface"},{"name":"interface-contract","elected":false,"reason":"no public API exposed by this fixture"},{"name":"estimation","elected":false,"reason":"user declined effort estimates"},{"name":"domain-overview","elected":false,"reason":"thin domain: fixture repo"}]
3
+ ---
4
+
5
+ # Shop Architecture
6
+
7
+ ## Goals & Scope
8
+
9
+ Minimal fixture repo for validator tests. See the [components](#core-components) section for the container list.
10
+
11
+ ## Core Components
12
+
13
+ | Component | Responsibility | src |
14
+ |---|---|---|
15
+ | API | Serves REST endpoints for checkout | observed |
16
+ | Web App | Renders the storefront UI for shoppers | observed |
17
+
18
+ ### Core Components
19
+
20
+ A per-service breakdown lives in the linked runbook. This subheading exists
21
+ only to prove a heading that repeats its own parent's title picks up no
22
+ explainer of its own — subheadings are out of scope regardless of what they
23
+ are named.
24
+
25
+ ## External Integrations
26
+
27
+ | System | Method | src |
28
+ |---|---|---|
29
+ | Stripe | REST API for payment charges | researched [https://docs.stripe.com/api] |
30
+
31
+ ## Data Stores
32
+
33
+ ```mermaid
34
+ erDiagram
35
+ ORDERS {
36
+ string id
37
+ string customerId
38
+ }
39
+ ```
40
+
41
+ | Store | Purpose | src |
42
+ |---|---|---|
43
+ | Orders | Stores customer orders and line items | observed |
44
+
45
+ ## Decisions
46
+
47
+ - [sample decision](docs/adr/0001-sample.md) — records why Stripe was chosen for payments.
@@ -0,0 +1,27 @@
1
+ specification {
2
+ element person
3
+ element system
4
+ element container
5
+ deploymentNode node
6
+ tag external
7
+ }
8
+ model {
9
+ customer = person 'Customer'
10
+ shop = system 'Shop' {
11
+ web = container 'Web App'
12
+ api = container 'API'
13
+ }
14
+ stripe = system 'Stripe' {
15
+ #external
16
+ }
17
+ customer -> web 'uses'
18
+ web -> api 'calls'
19
+ api -> stripe 'charges'
20
+ }
21
+ deployment {
22
+ node prod 'Production' {
23
+ }
24
+ }
25
+ views {
26
+ view index { include * }
27
+ }
@@ -0,0 +1,29 @@
1
+ specification {
2
+ element person
3
+ element system
4
+ element container
5
+ deploymentNode node
6
+ tag external
7
+ }
8
+ model {
9
+ customer = person 'Customer'
10
+ shop = system 'Shop' {
11
+ web = container 'Web App'
12
+ api = container 'API'
13
+ }
14
+ stripe = system 'Stripe' {
15
+ #external
16
+ }
17
+ customer -> web 'uses'
18
+ web -> api 'calls'
19
+ api -> stripe 'charges'
20
+ }
21
+ deployment {
22
+ node prod 'Production' {
23
+ instanceOf shop.api
24
+ instanceOf shop.web
25
+ }
26
+ }
27
+ views {
28
+ view index { include * }
29
+ }
@@ -0,0 +1,18 @@
1
+ # ADR 0001: Use Stripe for payments
2
+
3
+ ## Status
4
+
5
+ Accepted
6
+
7
+ ## Context
8
+
9
+ The storefront needs a payment processor for checkout.
10
+
11
+ ## Decision
12
+
13
+ Use Stripe as the payment integration.
14
+
15
+ ## Consequences
16
+
17
+ Stripe's per-transaction fees apply; PCI scope is reduced since card data never
18
+ touches our servers.
@@ -0,0 +1,2 @@
1
+ <!doctype html>
2
+ <title>fixture: stands in for the estimate skill's rendered page</title>
@@ -0,0 +1,8 @@
1
+ # Estimation
2
+
3
+ Method and assumptions for the sample system. Every row carries confidence
4
+ and assumptions; unestimated rows say `not estimated`.
5
+
6
+ ## Method
7
+
8
+ Three-point PERT per task, computed by the estimate skill's pipeline.
@@ -0,0 +1 @@
1
+ {"_stage":"layouted","projectId":"default","project":{"id":"default","title":"default"},"specification":{"tags":{"external":{"color":"tomato"}},"elements":{"person":{"style":{}},"system":{"style":{}},"container":{"style":{}}},"relationships":{},"deployments":{"node":{"style":{}}},"customColors":{}},"elements":{"customer":{"style":{},"title":"Customer","kind":"person","id":"customer"},"shop":{"style":{},"title":"Shop","kind":"system","id":"shop"},"stripe":{"style":{},"tags":["external"],"title":"Stripe","kind":"system","id":"stripe"},"shop.web":{"style":{},"title":"Web App","kind":"container","id":"shop.web"},"shop.api":{"style":{},"title":"API","kind":"container","id":"shop.api"}},"relations":{"i765mi":{"title":"uses","source":{"model":"customer"},"target":{"model":"shop.web"},"id":"i765mi"},"c3iwob":{"title":"calls","source":{"model":"shop.web"},"target":{"model":"shop.api"},"id":"c3iwob"},"kxfh6h":{"title":"charges","source":{"model":"shop.api"},"target":{"model":"stripe"},"id":"kxfh6h"}},"globals":{"predicates":{},"dynamicPredicates":{},"styles":{}},"views":{"index":{"_type":"element","tags":null,"links":null,"_stage":"layouted","sourcePath":"model.c4","description":null,"title":"Landscape view","id":"index","autoLayout":{"direction":"TB"},"hash":"Zpkl5rIaSedzHdqyW9I3uzWmnr1xmGSuxWovoEyV_-w","bounds":{"x":0,"y":0,"width":320,"height":826},"nodes":[{"id":"customer","parent":null,"level":0,"children":[],"inEdges":[],"outEdges":["m645my"],"title":"Customer","modelRef":"customer","shape":"rectangle","color":"primary","style":{"opacity":15,"size":"md"},"tags":[],"kind":"person","x":0,"y":0,"width":320,"height":180,"labelBBox":{"x":115,"y":76,"width":91,"height":24}},{"id":"shop","parent":null,"level":0,"children":[],"inEdges":["m645my"],"outEdges":["175sj3b"],"title":"Shop","modelRef":"shop","shape":"rectangle","color":"primary","style":{"opacity":15,"size":"md"},"tags":[],"kind":"system","x":0,"y":323,"width":320,"height":180,"labelBBox":{"x":135,"y":76,"width":51,"height":24}},{"id":"stripe","parent":null,"level":0,"children":[],"inEdges":["175sj3b"],"outEdges":[],"title":"Stripe","modelRef":"stripe","shape":"rectangle","color":"primary","style":{"opacity":15,"size":"md"},"tags":["external"],"kind":"system","x":0,"y":646,"width":320,"height":180,"labelBBox":{"x":132,"y":76,"width":56,"height":24}}],"edges":[{"id":"m645my","source":"customer","target":"shop","label":"uses","points":[[160,180],[160,221],[160,270],[160,313]],"labelBBox":{"x":161,"y":241,"width":34,"height":18},"parent":null,"relations":["i765mi"],"color":"gray","line":"dashed","head":"normal"},{"id":"175sj3b","source":"shop","target":"stripe","label":"charges","points":[[160,503],[160,544],[160,593],[160,635]],"labelBBox":{"x":161,"y":564,"width":54,"height":18},"parent":null,"relations":["kxfh6h"],"color":"gray","line":"dashed","head":"normal"}]}},"deployments":{"elements":{"prod":{"style":{},"kind":"node","title":"Production","id":"prod"}},"relations":{}},"imports":{},"manualLayouts":{}}