@magic-spells/constellation 0.2.1 → 0.3.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 (160) hide show
  1. package/README.md +13 -6
  2. package/constellation/agent/AGENT-GUIDANCE.md +22 -0
  3. package/constellation/component/COMPONENT-EDITABLE.md +9 -0
  4. package/constellation/component/COMPONENT-STATUS-PILL.md +9 -0
  5. package/constellation/component/COMPONENT-SYNC-PILL.md +9 -0
  6. package/constellation/diagram/DIAGRAM-ARCHITECTURE.md +28 -0
  7. package/constellation/doc/DOC-CARD-TYPES.md +36 -0
  8. package/constellation/doc/DOC-CHANGE-TRACKING.md +26 -0
  9. package/constellation/doc/DOC-CONNECTED-REPOS.md +25 -0
  10. package/constellation/doc/DOC-DIAGRAMS.md +22 -0
  11. package/constellation/doc/DOC-FILE-FORMAT.md +54 -0
  12. package/constellation/doc/DOC-LINT-CODES.md +35 -0
  13. package/constellation/doc/DOC-MCP-SERVER.md +59 -0
  14. package/constellation/doc/DOC-MCP-UPGRADES.md +56 -0
  15. package/constellation/external/EXTERNAL-AJV.md +7 -0
  16. package/constellation/external/EXTERNAL-GIT.md +7 -0
  17. package/constellation/external/EXTERNAL-GRAY-MATTER.md +7 -0
  18. package/constellation/external/EXTERNAL-MCP-SDK.md +7 -0
  19. package/constellation/external/EXTERNAL-ZOD.md +7 -0
  20. package/constellation/file/FILE-CLI.md +9 -0
  21. package/constellation/file/FILE-CODE.md +9 -0
  22. package/constellation/file/FILE-EXTRACT.md +9 -0
  23. package/constellation/file/FILE-GIT.md +9 -0
  24. package/constellation/file/FILE-HANDLES.md +9 -0
  25. package/constellation/file/FILE-INDEXER.md +11 -0
  26. package/constellation/file/FILE-LINT.md +9 -0
  27. package/constellation/file/FILE-MCP-SEARCH.md +12 -0
  28. package/constellation/file/FILE-MCP-SERVER.md +9 -0
  29. package/constellation/file/FILE-PARSE.md +9 -0
  30. package/constellation/file/FILE-RENAME.md +18 -0
  31. package/constellation/file/FILE-REPOS.md +9 -0
  32. package/constellation/file/FILE-RESOLVE.md +9 -0
  33. package/constellation/file/FILE-SCAFFOLD.md +12 -0
  34. package/constellation/file/FILE-SERVE.md +9 -0
  35. package/constellation/file/FILE-SYNC.md +9 -0
  36. package/constellation/file/FILE-TYPES.md +9 -0
  37. package/constellation/file/FILE-VALIDATE.md +11 -0
  38. package/constellation/file/FILE-WRITER.md +11 -0
  39. package/constellation/flow/FLOW-DRIFT-DETECT.md +11 -0
  40. package/constellation/flow/FLOW-LINT-PIPELINE.md +14 -0
  41. package/constellation/flow/FLOW-SYNC-PLAN.md +13 -0
  42. package/constellation/page/PAGE-VIEWER-CARD.md +9 -0
  43. package/constellation/page/PAGE-VIEWER-HOME.md +9 -0
  44. package/constellation/plan.md +59 -0
  45. package/constellation/test/TEST-SUITE.md +9 -0
  46. package/dist/cli/index.js +37 -0
  47. package/dist/cli/index.js.map +1 -1
  48. package/dist/core/code.d.ts +48 -0
  49. package/dist/core/code.js +184 -0
  50. package/dist/core/code.js.map +1 -0
  51. package/dist/core/git.d.ts +10 -0
  52. package/dist/core/git.js +42 -4
  53. package/dist/core/git.js.map +1 -1
  54. package/dist/core/rename.d.ts +24 -0
  55. package/dist/core/rename.js +72 -0
  56. package/dist/core/rename.js.map +1 -0
  57. package/dist/core/repos.d.ts +2 -0
  58. package/dist/core/repos.js +5 -1
  59. package/dist/core/repos.js.map +1 -1
  60. package/dist/core/sync.d.ts +3 -0
  61. package/dist/core/sync.js +21 -9
  62. package/dist/core/sync.js.map +1 -1
  63. package/dist/core/validate.js +27 -3
  64. package/dist/core/validate.js.map +1 -1
  65. package/dist/core/writer.d.ts +54 -0
  66. package/dist/core/writer.js +163 -4
  67. package/dist/core/writer.js.map +1 -1
  68. package/dist/mcp/search.d.ts +2 -2
  69. package/dist/mcp/search.js +27 -5
  70. package/dist/mcp/search.js.map +1 -1
  71. package/dist/mcp/server.js +726 -63
  72. package/dist/mcp/server.js.map +1 -1
  73. package/dist/serve/server.js +6 -7
  74. package/dist/serve/server.js.map +1 -1
  75. package/examples/constellation/datatype/DATATYPE-TICKET.md +5 -0
  76. package/package.json +5 -3
  77. package/schemas/card.json +46 -2
  78. package/skill/SKILL.md +42 -9
  79. package/skill/methodology.md +11 -4
  80. package/viewer/dist/assets/{arc-CMMRgIq9.js → arc-ByV7p1fN.js} +1 -1
  81. package/viewer/dist/assets/architecture-7EHR7CIX-FCXXAu3O.js +1 -0
  82. package/viewer/dist/assets/{architectureDiagram-3BPJPVTR-CB5p_qlN.js → architectureDiagram-3BPJPVTR-CMawC2nt.js} +1 -1
  83. package/viewer/dist/assets/{blockDiagram-GPEHLZMM-DpnMj_e6.js → blockDiagram-GPEHLZMM-Bp0MKYXV.js} +1 -1
  84. package/viewer/dist/assets/{c4Diagram-AAUBKEIU-f91ngVN8.js → c4Diagram-AAUBKEIU-BLCX9gmN.js} +1 -1
  85. package/viewer/dist/assets/channel-GJMBi5UK.js +1 -0
  86. package/viewer/dist/assets/{chunk-2J33WTMH-y7Pz5tMO.js → chunk-2J33WTMH-C6iOidst.js} +1 -1
  87. package/viewer/dist/assets/{chunk-3OPIFGDE-Ir_ghIUQ.js → chunk-3OPIFGDE-B9xItVw4.js} +1 -1
  88. package/viewer/dist/assets/{chunk-4BX2VUAB-BTPyM1ux.js → chunk-4BX2VUAB-Bl0HWb9B.js} +1 -1
  89. package/viewer/dist/assets/{chunk-55IACEB6-CtNd8e4Y.js → chunk-55IACEB6-BYilo1WJ.js} +1 -1
  90. package/viewer/dist/assets/{chunk-5ZQYHXKU-Dd3yz721.js → chunk-5ZQYHXKU-DOCnP8P8.js} +1 -1
  91. package/viewer/dist/assets/{chunk-727SXJPM-CAM8mGbv.js → chunk-727SXJPM-D9YKAzha.js} +1 -1
  92. package/viewer/dist/assets/{chunk-AQP2D5EJ-C3nW9Uve.js → chunk-AQP2D5EJ-B1KE4h_b.js} +1 -1
  93. package/viewer/dist/assets/{chunk-BSJP7CBP-r6MRPvAH.js → chunk-BSJP7CBP-DA3pfXCw.js} +1 -1
  94. package/viewer/dist/assets/{chunk-CSCIHK7Q-Cn-ZTxsS.js → chunk-CSCIHK7Q-Bv0Fa0Zn.js} +6 -6
  95. package/viewer/dist/assets/{chunk-FMBD7UC4-5axXeZJa.js → chunk-FMBD7UC4-k-EzzpU2.js} +1 -1
  96. package/viewer/dist/assets/{chunk-KSCS5N6A-BwmNx0l0.js → chunk-KSCS5N6A-CUTkv0jR.js} +1 -1
  97. package/viewer/dist/assets/{chunk-L5ZTLDWV-C2YNkUjB.js → chunk-L5ZTLDWV-C_SwE6oB.js} +1 -1
  98. package/viewer/dist/assets/{chunk-LZXEDZCA-CznuDgQD.js → chunk-LZXEDZCA-DtwqVIDt.js} +2 -2
  99. package/viewer/dist/assets/{chunk-ND2GUHAM-CokDnghi.js → chunk-ND2GUHAM-JJiAqLG2.js} +1 -1
  100. package/viewer/dist/assets/{chunk-NZK2D7GU-aaU0v4QE.js → chunk-NZK2D7GU-BQ8Dn7FA.js} +1 -1
  101. package/viewer/dist/assets/{chunk-O5CBEL6O-ByfKhkZf.js → chunk-O5CBEL6O-BRpqOJ1I.js} +1 -1
  102. package/viewer/dist/assets/chunk-QZHKN3VN-DA8qsAVF.js +1 -0
  103. package/viewer/dist/assets/chunk-WU5MYG2G-Dp8LMm21.js +1 -0
  104. package/viewer/dist/assets/{chunk-XPW4576I-Amo3awtq.js → chunk-XPW4576I-C1NcqPJd.js} +1 -1
  105. package/viewer/dist/assets/classDiagram-4FO5ZUOK-wnkp0LBB.js +1 -0
  106. package/viewer/dist/assets/classDiagram-v2-Q7XG4LA2-wnkp0LBB.js +1 -0
  107. package/viewer/dist/assets/{cose-bilkent-S5V4N54A-CO8yESCW.js → cose-bilkent-S5V4N54A-BsJFb39B.js} +1 -1
  108. package/viewer/dist/assets/{dagre-BM42HDAG-BnmNVNI2.js → dagre-BM42HDAG-CRPovG4Q.js} +1 -1
  109. package/viewer/dist/assets/{diagram-2AECGRRQ-lcGXcbei.js → diagram-2AECGRRQ-D6GCKn1u.js} +1 -1
  110. package/viewer/dist/assets/{diagram-5GNKFQAL-Cj3-lPUt.js → diagram-5GNKFQAL-CoHqKdf3.js} +1 -1
  111. package/viewer/dist/assets/{diagram-KO2AKTUF-CtXdRI4M.js → diagram-KO2AKTUF-BEkMb40X.js} +1 -1
  112. package/viewer/dist/assets/{diagram-LMA3HP47-CIyLAzX7.js → diagram-LMA3HP47-B6mfW9S2.js} +1 -1
  113. package/viewer/dist/assets/{diagram-OG6HWLK6-BwF4bQCv.js → diagram-OG6HWLK6-OBBkuJvR.js} +1 -1
  114. package/viewer/dist/assets/{dist-DzXuQd4N.js → dist-C4BxOpXa.js} +1 -1
  115. package/viewer/dist/assets/{erDiagram-TEJ5UH35-DjwFw9yq.js → erDiagram-TEJ5UH35-C2i3TB2-.js} +1 -1
  116. package/viewer/dist/assets/eventmodeling-FCH6USID-CCZDiBK0.js +1 -0
  117. package/viewer/dist/assets/{flowDiagram-I6XJVG4X-CzXbf7vQ.js → flowDiagram-I6XJVG4X-SreJFib5.js} +1 -1
  118. package/viewer/dist/assets/{ganttDiagram-6RSMTGT7-BYcIhfmm.js → ganttDiagram-6RSMTGT7-DO7GLSdw.js} +1 -1
  119. package/viewer/dist/assets/{gitGraph-WXDBUCRP-H8XeJ9QB.js → gitGraph-WXDBUCRP-Cgwn_Q5_.js} +1 -1
  120. package/viewer/dist/assets/{gitGraphDiagram-PVQCEYII-DtAPXKFK.js → gitGraphDiagram-PVQCEYII-DLwaMyDa.js} +1 -1
  121. package/viewer/dist/assets/{index-DLPCG_Or.js → index-COz6c_JS.js} +4 -4
  122. package/viewer/dist/assets/{info-J43DQDTF-BQScorZ0.js → info-J43DQDTF-Ci-BiM87.js} +1 -1
  123. package/viewer/dist/assets/{infoDiagram-5YYISTIA-Udl1omvH.js → infoDiagram-5YYISTIA-Bip5dlKM.js} +1 -1
  124. package/viewer/dist/assets/{ishikawaDiagram-YF4QCWOH-VnfzT_hk.js → ishikawaDiagram-YF4QCWOH-VXV_9uEH.js} +1 -1
  125. package/viewer/dist/assets/{journeyDiagram-JHISSGLW-Btn4EVoD.js → journeyDiagram-JHISSGLW-DQz-8gAS.js} +1 -1
  126. package/viewer/dist/assets/{kanban-definition-UN3LZRKU-flOzWhPe.js → kanban-definition-UN3LZRKU-BTWpEcf0.js} +1 -1
  127. package/viewer/dist/assets/{line-DJJ9BLuY.js → line-BnRWAabF.js} +1 -1
  128. package/viewer/dist/assets/{linear-C2SUy5ns.js → linear-BR6v_8SI.js} +1 -1
  129. package/viewer/dist/assets/{mermaid-parser.core-xhSeYiZo.js → mermaid-parser.core-CSsnrQhR.js} +2 -2
  130. package/viewer/dist/assets/{mermaid.core-DmeSIitY.js → mermaid.core-I1kLnpG2.js} +3 -3
  131. package/viewer/dist/assets/{mindmap-definition-RKZ34NQL-CCJcMKx1.js → mindmap-definition-RKZ34NQL-Cq66Ilr1.js} +1 -1
  132. package/viewer/dist/assets/{packet-YPE3B663-DS8RscAk.js → packet-YPE3B663-BjSCEGVd.js} +1 -1
  133. package/viewer/dist/assets/{pie-LRSECV5Y-I2ZQhrNJ.js → pie-LRSECV5Y-Di72yxoZ.js} +1 -1
  134. package/viewer/dist/assets/{pieDiagram-4H26LBE5-BS5HMs4j.js → pieDiagram-4H26LBE5-TmsfKHOO.js} +1 -1
  135. package/viewer/dist/assets/{quadrantDiagram-W4KKPZXB-W4H8cw2_.js → quadrantDiagram-W4KKPZXB-Dp9iSvCk.js} +1 -1
  136. package/viewer/dist/assets/{radar-GUYGQ44K-kf6QvSne.js → radar-GUYGQ44K-CZeWC3Jm.js} +1 -1
  137. package/viewer/dist/assets/{requirementDiagram-4Y6WPE33-DSbuDQGQ.js → requirementDiagram-4Y6WPE33-lbTbiw59.js} +1 -1
  138. package/viewer/dist/assets/{sankeyDiagram-5OEKKPKP-CH8Qr2vL.js → sankeyDiagram-5OEKKPKP-DqmoGDJk.js} +1 -1
  139. package/viewer/dist/assets/{sequenceDiagram-3UESZ5HK-EugVcdad.js → sequenceDiagram-3UESZ5HK-B6_EiWF6.js} +1 -1
  140. package/viewer/dist/assets/{src-CM_9kdrU.js → src-Dz3SjXJY.js} +1 -1
  141. package/viewer/dist/assets/{stateDiagram-AJRCARHV-DiFl94Qy.js → stateDiagram-AJRCARHV-Z6QRASCx.js} +1 -1
  142. package/viewer/dist/assets/stateDiagram-v2-BHNVJYJU-BePyUY0u.js +1 -0
  143. package/viewer/dist/assets/{timeline-definition-PNZ67QCA-B0KW9GUN.js → timeline-definition-PNZ67QCA-XuUZAYAP.js} +1 -1
  144. package/viewer/dist/assets/{treeView-BLDUP644-CAEY4mxq.js → treeView-BLDUP644-DuGsPB97.js} +1 -1
  145. package/viewer/dist/assets/{treemap-LRROVOQU-VVaEaTlU.js → treemap-LRROVOQU-CSJx8IZ0.js} +1 -1
  146. package/viewer/dist/assets/{vennDiagram-CIIHVFJN-BSLGNfJd.js → vennDiagram-CIIHVFJN-BnebDryc.js} +1 -1
  147. package/viewer/dist/assets/{wardley-L42UT6IY-C-5cXbAU.js → wardley-L42UT6IY-DqqoXPSq.js} +1 -1
  148. package/viewer/dist/assets/{wardleyDiagram-YWT4CUSO-COk4TVnQ.js → wardleyDiagram-YWT4CUSO-Bchy871K.js} +1 -1
  149. package/viewer/dist/assets/{xychartDiagram-2RQKCTM6-CClGJLJp.js → xychartDiagram-2RQKCTM6-Bl_zzGZm.js} +1 -1
  150. package/viewer/dist/index.html +1 -1
  151. package/docs/001-file-format.md +0 -247
  152. package/docs/002-mcp.md +0 -158
  153. package/viewer/dist/assets/architecture-7EHR7CIX-Cbb-syEI.js +0 -1
  154. package/viewer/dist/assets/channel-C2bkEQHQ.js +0 -1
  155. package/viewer/dist/assets/chunk-QZHKN3VN-DJRjGeIo.js +0 -1
  156. package/viewer/dist/assets/chunk-WU5MYG2G-C63BVvr_.js +0 -1
  157. package/viewer/dist/assets/classDiagram-4FO5ZUOK-z_bO1V-j.js +0 -1
  158. package/viewer/dist/assets/classDiagram-v2-Q7XG4LA2-z_bO1V-j.js +0 -1
  159. package/viewer/dist/assets/eventmodeling-FCH6USID-BlKFmSzA.js +0 -1
  160. package/viewer/dist/assets/stateDiagram-v2-BHNVJYJU-BlJV8F13.js +0 -1
@@ -1,4 +1,4 @@
1
- import{g as e,h as t}from"./src-CM_9kdrU.js";import{t as n}from"./mermaid-parser.core-xhSeYiZo.js";import{D as r,H as i,K as a,U as o,a as s,b as c,c as l,v as u,w as d,x as f,y as p}from"./chunk-CSCIHK7Q-Cn-ZTxsS.js";import{i as m}from"./chunk-5ZQYHXKU-Dd3yz721.js";import{t as h}from"./chunk-WU5MYG2G-C63BVvr_.js";import{t as g}from"./chunk-4BX2VUAB-BTPyM1ux.js";var _=t((e,t)=>{let n=e<=1?e*100:e;if(n<0||n>100)throw Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return n},`toPercent`),v=t((e,t,n)=>({x:_(t,`${n} evolution`),y:_(e,`${n} visibility`)}),`toCoordinates`),y=t(e=>{if(e){if(e===`+<>`)return`bidirectional`;if(e===`+<`)return`backward`;if(e===`+>`)return`forward`}},`getFlowFromPort`),b=t(e=>{if(!e?.startsWith(`+`))return{};let t=/^\+'([^']*)'/.exec(e)?.[1];return e.includes(`<>`)?{flow:`bidirectional`,label:t}:e.includes(`<`)?{flow:`backward`,label:t}:e.includes(`>`)?{flow:`forward`,label:t}:{label:t}},`extractFlowFromArrow`),x=t((e,t)=>{if(g(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let n=e.evolution.stages.map(e=>e.secondName?`${e.name.trim()} / ${e.secondName.trim()}`:e.name.trim()),r=e.evolution.stages.filter(e=>e.boundary!==void 0).map(e=>e.boundary);t.updateAxes({stages:n,stageBoundaries:r})}if(e.anchors.forEach(e=>{let n=v(e.visibility,e.evolution,`Anchor "${e.name}"`);t.addNode(e.name,e.name,n.x,n.y,`anchor`)}),e.components.forEach(e=>{let n=v(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,a=e.decorator?.strategy;t.addNode(e.name,e.name,n.x,n.y,`component`,r,i,e.inertia,a)}),e.notes.forEach(e=>{let n=v(e.visibility,e.evolution,`Note "${e.text}"`);t.addNote(e.text,n.x,n.y)}),e.pipelines.forEach(e=>{let n=t.getNode(e.parent);if(!n||typeof n.y!=`number`)throw Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);let r=n.y;t.startPipeline(e.parent),e.components.forEach(n=>{let i=`${e.parent}_${n.name}`,a=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,o=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,s=_(n.evolution,`Pipeline component "${n.name}" evolution`);t.addNode(i,n.name,s,r,`pipeline-component`,a,o),t.addPipelineComponent(e.parent,i)})}),e.links.forEach(e=>{let n=!!e.arrow&&(e.arrow.includes(`-.->`)||e.arrow.includes(`.-.`)),r=y(e.fromPort)??y(e.toPort),{flow:i,label:a}=b(e.arrow);!r&&i&&(r=i);let o=e.linkLabel,s=a??o;t.addLink(t.resolveNodeId(e.from),t.resolveNodeId(e.to),n,s,r)}),e.evolves.forEach(e=>{let n=t.getNode(e.component);if(n?.y!==void 0){let r=_(e.target,`Evolve target for "${e.component}"`);t.addTrend(e.component,r,n.y)}}),e.annotations.length>0){let n=e.annotations[0],r=v(n.x,n.y,`Annotations box`);t.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(e=>{let n=v(e.x,e.y,`Annotation ${e.number}`);t.addAnnotation(e.number,[{x:n.x,y:n.y}],e.text)}),e.accelerators.forEach(e=>{let n=v(e.x,e.y,`Accelerator "${e.name}"`);t.addAccelerator(e.name,n.x,n.y)}),e.deaccelerators.forEach(e=>{let n=v(e.x,e.y,`Deaccelerator "${e.name}"`);t.addDeaccelerator(e.name,n.x,n.y)})},`populateDb`),S={parser:{yy:void 0},parse:t(async t=>{let r=await n(`wardley`,t);e.debug(r);let i=S.parser?.yy;if(!i||typeof i.addNode!=`function`)throw Error(`parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);x(r,i)},`parse`)},C=new class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{t(this,`WardleyBuilder`)}addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label},n={...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY};this.nodes.set(e.id,n)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){let n=this.pipelines.get(e);n&&n.componentIds.push(t);let r=this.nodes.get(t);r&&(r.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[t,n]of this.nodes)if(n.label===e)return t;return e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!=`number`||typeof t.y!=`number`)throw Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}};function w(){return f()[`wardley-beta`]}t(w,`getConfig`);function T(e,t,n,r,i,a,o,s,c){C.addNode({id:e,label:t,x:n,y:r,className:i,labelOffsetX:a,labelOffsetY:o,inertia:s,sourceStrategy:c})}t(T,`addNode`);function E(e,t,n=!1,r,i){C.addLink({source:e,target:t,dashed:n,label:r,flow:i})}t(E,`addLink`);function D(e,t,n){C.addTrend({nodeId:e,targetX:t,targetY:n})}t(D,`addTrend`);function O(e,t,n){C.addAnnotation({number:e,coordinates:t,text:n})}t(O,`addAnnotation`);function k(e,t,n){C.addNote({text:e,x:t,y:n})}t(k,`addNote`);function A(e,t,n){C.addAccelerator({name:e,x:t,y:n})}t(A,`addAccelerator`);function j(e,t,n){C.addDeaccelerator({name:e,x:t,y:n})}t(j,`addDeaccelerator`);function M(e,t){C.setAnnotationsBox(e,t)}t(M,`setAnnotationsBox`);function N(e,t){C.setSize(e,t)}t(N,`setSize`);function P(e){C.startPipeline(e)}t(P,`startPipeline`);function F(e,t){C.addPipelineComponent(e,t)}t(F,`addPipelineComponent`);function I(e){C.setAxes(e)}t(I,`updateAxes`);function L(e){return C.getNode(e)}t(L,`getNode`);function R(e){return C.resolveNodeId(e)}t(R,`resolveNodeId`);function z(){return C.build()}t(z,`getWardleyData`);function B(){C.clear(),s()}t(B,`clear`);var V={getConfig:w,addNode:T,addLink:E,addTrend:D,addAnnotation:O,addNote:k,addAccelerator:A,addDeaccelerator:j,setAnnotationsBox:M,setSize:N,startPipeline:P,addPipelineComponent:F,updateAxes:I,getNode:L,resolveNodeId:R,getWardleyData:z,clear:B,setAccTitle:o,getAccTitle:p,setDiagramTitle:a,getDiagramTitle:d,getAccDescription:u,setAccDescription:i},H=[`Genesis`,`Custom Built`,`Product`,`Commodity`],U=t(()=>{let{themeVariables:e}=f();return{backgroundColor:e.wardley?.backgroundColor??e.background??`#fff`,axisColor:e.wardley?.axisColor??`#000`,axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??`#222`,gridColor:e.wardley?.gridColor??`rgba(100, 100, 100, 0.2)`,componentFill:e.wardley?.componentFill??`#fff`,componentStroke:e.wardley?.componentStroke??`#000`,componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??`#222`,linkStroke:e.wardley?.linkStroke??`#000`,evolutionStroke:e.wardley?.evolutionStroke??`#dc3545`,annotationStroke:e.wardley?.annotationStroke??`#000`,annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??`#222`,annotationFill:e.wardley?.annotationFill??e.background??`#fff`}},`getTheme`),W=t(()=>{let e=f()[`wardley-beta`];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},`getConfigValues`),G={parser:S,db:V,renderer:{draw:t((n,r,i,a)=>{e.debug(`Rendering Wardley map
1
+ import{g as e,h as t}from"./src-Dz3SjXJY.js";import{t as n}from"./mermaid-parser.core-CSsnrQhR.js";import{D as r,H as i,K as a,U as o,a as s,b as c,c as l,v as u,w as d,x as f,y as p}from"./chunk-CSCIHK7Q-Bv0Fa0Zn.js";import{i as m}from"./chunk-5ZQYHXKU-DOCnP8P8.js";import{t as h}from"./chunk-WU5MYG2G-Dp8LMm21.js";import{t as g}from"./chunk-4BX2VUAB-Bl0HWb9B.js";var _=t((e,t)=>{let n=e<=1?e*100:e;if(n<0||n>100)throw Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return n},`toPercent`),v=t((e,t,n)=>({x:_(t,`${n} evolution`),y:_(e,`${n} visibility`)}),`toCoordinates`),y=t(e=>{if(e){if(e===`+<>`)return`bidirectional`;if(e===`+<`)return`backward`;if(e===`+>`)return`forward`}},`getFlowFromPort`),b=t(e=>{if(!e?.startsWith(`+`))return{};let t=/^\+'([^']*)'/.exec(e)?.[1];return e.includes(`<>`)?{flow:`bidirectional`,label:t}:e.includes(`<`)?{flow:`backward`,label:t}:e.includes(`>`)?{flow:`forward`,label:t}:{label:t}},`extractFlowFromArrow`),x=t((e,t)=>{if(g(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let n=e.evolution.stages.map(e=>e.secondName?`${e.name.trim()} / ${e.secondName.trim()}`:e.name.trim()),r=e.evolution.stages.filter(e=>e.boundary!==void 0).map(e=>e.boundary);t.updateAxes({stages:n,stageBoundaries:r})}if(e.anchors.forEach(e=>{let n=v(e.visibility,e.evolution,`Anchor "${e.name}"`);t.addNode(e.name,e.name,n.x,n.y,`anchor`)}),e.components.forEach(e=>{let n=v(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,a=e.decorator?.strategy;t.addNode(e.name,e.name,n.x,n.y,`component`,r,i,e.inertia,a)}),e.notes.forEach(e=>{let n=v(e.visibility,e.evolution,`Note "${e.text}"`);t.addNote(e.text,n.x,n.y)}),e.pipelines.forEach(e=>{let n=t.getNode(e.parent);if(!n||typeof n.y!=`number`)throw Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);let r=n.y;t.startPipeline(e.parent),e.components.forEach(n=>{let i=`${e.parent}_${n.name}`,a=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,o=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,s=_(n.evolution,`Pipeline component "${n.name}" evolution`);t.addNode(i,n.name,s,r,`pipeline-component`,a,o),t.addPipelineComponent(e.parent,i)})}),e.links.forEach(e=>{let n=!!e.arrow&&(e.arrow.includes(`-.->`)||e.arrow.includes(`.-.`)),r=y(e.fromPort)??y(e.toPort),{flow:i,label:a}=b(e.arrow);!r&&i&&(r=i);let o=e.linkLabel,s=a??o;t.addLink(t.resolveNodeId(e.from),t.resolveNodeId(e.to),n,s,r)}),e.evolves.forEach(e=>{let n=t.getNode(e.component);if(n?.y!==void 0){let r=_(e.target,`Evolve target for "${e.component}"`);t.addTrend(e.component,r,n.y)}}),e.annotations.length>0){let n=e.annotations[0],r=v(n.x,n.y,`Annotations box`);t.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(e=>{let n=v(e.x,e.y,`Annotation ${e.number}`);t.addAnnotation(e.number,[{x:n.x,y:n.y}],e.text)}),e.accelerators.forEach(e=>{let n=v(e.x,e.y,`Accelerator "${e.name}"`);t.addAccelerator(e.name,n.x,n.y)}),e.deaccelerators.forEach(e=>{let n=v(e.x,e.y,`Deaccelerator "${e.name}"`);t.addDeaccelerator(e.name,n.x,n.y)})},`populateDb`),S={parser:{yy:void 0},parse:t(async t=>{let r=await n(`wardley`,t);e.debug(r);let i=S.parser?.yy;if(!i||typeof i.addNode!=`function`)throw Error(`parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);x(r,i)},`parse`)},C=new class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{t(this,`WardleyBuilder`)}addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label},n={...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY};this.nodes.set(e.id,n)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){let n=this.pipelines.get(e);n&&n.componentIds.push(t);let r=this.nodes.get(t);r&&(r.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[t,n]of this.nodes)if(n.label===e)return t;return e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!=`number`||typeof t.y!=`number`)throw Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}};function w(){return f()[`wardley-beta`]}t(w,`getConfig`);function T(e,t,n,r,i,a,o,s,c){C.addNode({id:e,label:t,x:n,y:r,className:i,labelOffsetX:a,labelOffsetY:o,inertia:s,sourceStrategy:c})}t(T,`addNode`);function E(e,t,n=!1,r,i){C.addLink({source:e,target:t,dashed:n,label:r,flow:i})}t(E,`addLink`);function D(e,t,n){C.addTrend({nodeId:e,targetX:t,targetY:n})}t(D,`addTrend`);function O(e,t,n){C.addAnnotation({number:e,coordinates:t,text:n})}t(O,`addAnnotation`);function k(e,t,n){C.addNote({text:e,x:t,y:n})}t(k,`addNote`);function A(e,t,n){C.addAccelerator({name:e,x:t,y:n})}t(A,`addAccelerator`);function j(e,t,n){C.addDeaccelerator({name:e,x:t,y:n})}t(j,`addDeaccelerator`);function M(e,t){C.setAnnotationsBox(e,t)}t(M,`setAnnotationsBox`);function N(e,t){C.setSize(e,t)}t(N,`setSize`);function P(e){C.startPipeline(e)}t(P,`startPipeline`);function F(e,t){C.addPipelineComponent(e,t)}t(F,`addPipelineComponent`);function I(e){C.setAxes(e)}t(I,`updateAxes`);function L(e){return C.getNode(e)}t(L,`getNode`);function R(e){return C.resolveNodeId(e)}t(R,`resolveNodeId`);function z(){return C.build()}t(z,`getWardleyData`);function B(){C.clear(),s()}t(B,`clear`);var V={getConfig:w,addNode:T,addLink:E,addTrend:D,addAnnotation:O,addNote:k,addAccelerator:A,addDeaccelerator:j,setAnnotationsBox:M,setSize:N,startPipeline:P,addPipelineComponent:F,updateAxes:I,getNode:L,resolveNodeId:R,getWardleyData:z,clear:B,setAccTitle:o,getAccTitle:p,setDiagramTitle:a,getDiagramTitle:d,getAccDescription:u,setAccDescription:i},H=[`Genesis`,`Custom Built`,`Product`,`Commodity`],U=t(()=>{let{themeVariables:e}=f();return{backgroundColor:e.wardley?.backgroundColor??e.background??`#fff`,axisColor:e.wardley?.axisColor??`#000`,axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??`#222`,gridColor:e.wardley?.gridColor??`rgba(100, 100, 100, 0.2)`,componentFill:e.wardley?.componentFill??`#fff`,componentStroke:e.wardley?.componentStroke??`#000`,componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??`#222`,linkStroke:e.wardley?.linkStroke??`#000`,evolutionStroke:e.wardley?.evolutionStroke??`#dc3545`,annotationStroke:e.wardley?.annotationStroke??`#000`,annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??`#222`,annotationFill:e.wardley?.annotationFill??e.background??`#fff`}},`getTheme`),W=t(()=>{let e=f()[`wardley-beta`];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},`getConfigValues`),G={parser:S,db:V,renderer:{draw:t((n,r,i,a)=>{e.debug(`Rendering Wardley map
2
2
  `+n);let o=W(),s=U(),c=o.nodeRadius*1.6,u=a.db,d=u.getWardleyData(),f=u.getDiagramTitle(),p=d.size?.width??o.width,m=d.size?.height??o.height,g=h(r);g.selectAll(`*`).remove(),l(g,m,p,o.useMaxWidth),g.attr(`viewBox`,`0 0 ${p} ${m}`);let _=g.append(`g`).attr(`class`,`wardley-map`),v=g.append(`defs`);v.append(`marker`).attr(`id`,`arrow-${r}`).attr(`viewBox`,`0 0 10 10`).attr(`refX`,9).attr(`refY`,5).attr(`markerWidth`,6).attr(`markerHeight`,6).attr(`orient`,`auto-start-reverse`).append(`path`).attr(`d`,`M 0 0 L 10 5 L 0 10 z`).attr(`fill`,s.evolutionStroke).attr(`stroke`,`none`),v.append(`marker`).attr(`id`,`link-arrow-end-${r}`).attr(`viewBox`,`0 0 10 10`).attr(`refX`,9).attr(`refY`,5).attr(`markerWidth`,5).attr(`markerHeight`,5).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 0 0 L 10 5 L 0 10 z`).attr(`fill`,s.linkStroke).attr(`stroke`,`none`),v.append(`marker`).attr(`id`,`link-arrow-start-${r}`).attr(`viewBox`,`0 0 10 10`).attr(`refX`,1).attr(`refY`,5).attr(`markerWidth`,5).attr(`markerHeight`,5).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 10 0 L 0 5 L 10 10 z`).attr(`fill`,s.linkStroke).attr(`stroke`,`none`),_.append(`rect`).attr(`class`,`wardley-background`).attr(`width`,p).attr(`height`,m).attr(`fill`,s.backgroundColor);let y=p-o.padding*2,b=m-o.padding*2;f&&_.append(`text`).attr(`class`,`wardley-title`).attr(`x`,p/2).attr(`y`,o.padding/2).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize*1.05).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(f);let x=t(e=>o.padding+e/100*y,`projectX`),S=t(e=>m-o.padding-e/100*b,`projectY`),C=_.append(`g`).attr(`class`,`wardley-axes`);C.append(`line`).attr(`x1`,o.padding).attr(`x2`,p-o.padding).attr(`y1`,m-o.padding).attr(`y2`,m-o.padding).attr(`stroke`,s.axisColor).attr(`stroke-width`,1),C.append(`line`).attr(`x1`,o.padding).attr(`x2`,o.padding).attr(`y1`,o.padding).attr(`y2`,m-o.padding).attr(`stroke`,s.axisColor).attr(`stroke-width`,1);let w=d.axes.xLabel??`Evolution`,T=d.axes.yLabel??`Visibility`;C.append(`text`).attr(`class`,`wardley-axis-label wardley-axis-label-x`).attr(`x`,o.padding+y/2).attr(`y`,m-o.padding/4).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).text(w),C.append(`text`).attr(`class`,`wardley-axis-label wardley-axis-label-y`).attr(`x`,o.padding/3).attr(`y`,o.padding+b/2).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).attr(`transform`,`rotate(-90 ${o.padding/3} ${o.padding+b/2})`).text(T);let E=d.axes.stages&&d.axes.stages.length>0?d.axes.stages:H;if(E.length>0){let e=_.append(`g`).attr(`class`,`wardley-stages`),t=d.axes.stageBoundaries,n=[];if(t&&t.length===E.length){let e=0;t.forEach(t=>{n.push({start:e,end:t}),e=t})}else{let e=1/E.length;E.forEach((t,r)=>{n.push({start:r*e,end:(r+1)*e})})}E.forEach((t,r)=>{let i=n[r],a=o.padding+i.start*y,c=(a+(o.padding+i.end*y))/2;r>0&&e.append(`line`).attr(`x1`,a).attr(`x2`,a).attr(`y1`,o.padding).attr(`y2`,m-o.padding).attr(`stroke`,`#000`).attr(`stroke-width`,1).attr(`stroke-dasharray`,`5 5`).attr(`opacity`,.8),e.append(`text`).attr(`class`,`wardley-stage-label`).attr(`x`,c).attr(`y`,m-o.padding/1.5).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize-2).attr(`text-anchor`,`middle`).text(t)})}if(o.showGrid){let e=_.append(`g`).attr(`class`,`wardley-grid`);for(let t=1;t<4;t++){let n=t/4,r=o.padding+y*n;e.append(`line`).attr(`x1`,r).attr(`x2`,r).attr(`y1`,o.padding).attr(`y2`,m-o.padding).attr(`stroke`,s.gridColor).attr(`stroke-dasharray`,`2 6`),e.append(`line`).attr(`x1`,o.padding).attr(`x2`,p-o.padding).attr(`y1`,m-o.padding-b*n).attr(`y2`,m-o.padding-b*n).attr(`stroke`,s.gridColor).attr(`stroke-dasharray`,`2 6`)}}let D=new Map;if(d.nodes.forEach(e=>{D.set(e.id,{x:x(e.x),y:S(e.y),node:e})}),d.pipelines.length>0){let e=_.append(`g`).attr(`class`,`wardley-pipelines`),t=_.append(`g`).attr(`class`,`wardley-pipeline-links`);d.pipelines.forEach(n=>{if(n.componentIds.length===0)return;let r=n.componentIds.map(e=>({id:e,pos:D.get(e),node:d.nodes.find(t=>t.id===e)})).filter(e=>e.pos&&e.node).sort((e,t)=>e.node.x-t.node.x);for(let e=0;e<r.length-1;e++){let n=r[e],i=r[e+1];t.append(`line`).attr(`class`,`wardley-pipeline-evolution-link`).attr(`x1`,n.pos.x).attr(`y1`,n.pos.y).attr(`x2`,i.pos.x).attr(`y2`,i.pos.y).attr(`stroke`,s.linkStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,`4 4`)}let i=1/0,a=-1/0,l=0;if(n.componentIds.forEach(e=>{let t=D.get(e);t&&(i=Math.min(i,t.x),a=Math.max(a,t.x),l=t.y)}),i!==1/0&&a!==-1/0){let t=o.nodeRadius*4,r=l-t/2,u=D.get(n.nodeId);u&&(u.x=(i+a)/2,u.y=r-c/6),e.append(`rect`).attr(`class`,`wardley-pipeline-box`).attr(`x`,i-15).attr(`y`,r).attr(`width`,a-i+30).attr(`height`,t).attr(`fill`,`none`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`rx`,4).attr(`ry`,4)}})}let O=_.append(`g`).attr(`class`,`wardley-links`),k=new Map;d.pipelines.forEach(e=>{k.set(e.nodeId,new Set(e.componentIds))});let A=d.links.filter(e=>!(!D.has(e.source)||!D.has(e.target)||k.get(e.target)?.has(e.source)));O.selectAll(`line`).data(A).enter().append(`line`).attr(`class`,e=>`wardley-link${e.dashed?` wardley-link--dashed`:``}`).attr(`x1`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.source).isPipelineParent?c/Math.sqrt(2):o.nodeRadius,i=n.x-t.x,a=n.y-t.y,s=Math.sqrt(i*i+a*a);return t.x+i/s*r}).attr(`y1`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.source).isPipelineParent?c/Math.sqrt(2):o.nodeRadius,i=n.x-t.x,a=n.y-t.y,s=Math.sqrt(i*i+a*a);return t.y+a/s*r}).attr(`x2`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.target).isPipelineParent?c/Math.sqrt(2):o.nodeRadius,i=t.x-n.x,a=t.y-n.y,s=Math.sqrt(i*i+a*a);return n.x+i/s*r}).attr(`y2`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.target).isPipelineParent?c/Math.sqrt(2):o.nodeRadius,i=t.x-n.x,a=t.y-n.y,s=Math.sqrt(i*i+a*a);return n.y+a/s*r}).attr(`stroke`,s.linkStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,e=>e.dashed?`6 6`:null).attr(`marker-end`,e=>e.flow===`forward`||e.flow===`bidirectional`?`url(#link-arrow-end-${r})`:null).attr(`marker-start`,e=>e.flow===`backward`||e.flow===`bidirectional`?`url(#link-arrow-start-${r})`:null),O.selectAll(`text`).data(A.filter(e=>e.label)).enter().append(`text`).attr(`class`,`wardley-link-label`).attr(`x`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.x+n.x)/2,i=n.y-t.y,a=n.x-t.x;return r+i/Math.sqrt(a*a+i*i)*8}).attr(`y`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.y+n.y)/2,i=n.x-t.x,a=n.y-t.y,o=Math.sqrt(i*i+a*a);return r+-i/o*8}).attr(`fill`,s.axisTextColor).attr(`font-size`,o.labelFontSize).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).attr(`transform`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.x+n.x)/2,i=(t.y+n.y)/2,a=n.x-t.x,o=n.y-t.y,s=Math.sqrt(a*a+o*o),c=o/s,l=-a/s,u=r+c*8,d=i+l*8,f=Math.atan2(o,a)*180/Math.PI;return(f>90||f<-90)&&(f+=180),`rotate(${f} ${u} ${d})`}).text(e=>e.label);let j=_.append(`g`).attr(`class`,`wardley-trends`),M=d.trends.map(e=>{let t=D.get(e.nodeId);if(!t)return null;let n=x(e.targetX),r=S(e.targetY),i=n-t.x,a=r-t.y,s=Math.sqrt(i*i+a*a),c=o.nodeRadius+2;return{origin:t,targetX:n,targetY:r,adjustedX2:s>c?n-i/s*c:n,adjustedY2:s>c?r-a/s*c:r}}).filter(e=>e!==null);j.selectAll(`line`).data(M).enter().append(`line`).attr(`class`,`wardley-trend`).attr(`x1`,e=>e.origin.x).attr(`y1`,e=>e.origin.y).attr(`x2`,e=>e.adjustedX2).attr(`y2`,e=>e.adjustedY2).attr(`stroke`,s.evolutionStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,`4 4`).attr(`marker-end`,`url(#arrow-${r})`);let N=_.append(`g`).attr(`class`,`wardley-nodes`).selectAll(`g`).data(d.nodes).enter().append(`g`).attr(`class`,e=>[`wardley-node`,e.className?`wardley-node--${e.className}`:``].filter(Boolean).join(` `));N.filter(e=>e.sourceStrategy===`outsource`).append(`circle`).attr(`class`,`wardley-outsource-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#666`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.sourceStrategy===`buy`).append(`circle`).attr(`class`,`wardley-buy-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#ccc`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.sourceStrategy===`build`).append(`circle`).attr(`class`,`wardley-build-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#eee`).attr(`stroke`,`#000`).attr(`stroke-width`,1);let P=N.filter(e=>e.sourceStrategy===`market`);P.append(`circle`).attr(`class`,`wardley-market-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>!e.isPipelineParent&&e.sourceStrategy!==`market`&&e.className!==`anchor`).append(`circle`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius).attr(`fill`,s.componentFill).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1);let F=o.nodeRadius*.7,I=o.nodeRadius*1.2;if(P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x).attr(`y1`,e=>D.get(e.id).y-I).attr(`x2`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`y2`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`y1`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`x2`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`y2`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`y1`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`x2`,e=>D.get(e.id).x).attr(`y2`,e=>D.get(e.id).y-I).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y-I).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`cy`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`cy`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),N.filter(e=>e.isPipelineParent===!0).append(`rect`).attr(`x`,e=>D.get(e.id).x-c/2).attr(`y`,e=>D.get(e.id).y-c/2).attr(`width`,c).attr(`height`,c).attr(`fill`,s.componentFill).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.inertia===!0).append(`line`).attr(`class`,`wardley-inertia`).attr(`x1`,e=>{let t=D.get(e.id),n=e.isPipelineParent?c/2+15:o.nodeRadius+15;return e.sourceStrategy&&(n+=o.nodeRadius+10),t.x+n}).attr(`y1`,e=>{let t=D.get(e.id),n=e.isPipelineParent?c:o.nodeRadius*2;return t.y-n/2}).attr(`x2`,e=>{let t=D.get(e.id),n=e.isPipelineParent?c/2+15:o.nodeRadius+15;return e.sourceStrategy&&(n+=o.nodeRadius+10),t.x+n}).attr(`y2`,e=>{let t=D.get(e.id),n=e.isPipelineParent?c:o.nodeRadius*2;return t.y+n/2}).attr(`stroke`,s.componentStroke).attr(`stroke-width`,6),N.append(`text`).attr(`x`,e=>{let t=D.get(e.id);if(e.className===`anchor`)return e.labelOffsetX===void 0?t.x:t.x+e.labelOffsetX;let n=o.nodeLabelOffset;e.sourceStrategy&&e.labelOffsetX===void 0&&(n+=10);let r=e.labelOffsetX??n;return t.x+r}).attr(`y`,e=>{let t=D.get(e.id);if(e.className===`anchor`)return e.labelOffsetY===void 0?t.y-3:t.y+e.labelOffsetY;let n=-o.nodeLabelOffset;e.sourceStrategy&&e.labelOffsetY===void 0&&(n-=10);let r=e.labelOffsetY??n;return t.y+r}).attr(`class`,`wardley-node-label`).attr(`fill`,e=>e.className===`evolved`?s.evolutionStroke:e.className===`anchor`?`#000`:s.componentLabelColor).attr(`font-size`,o.labelFontSize).attr(`font-weight`,e=>e.className===`anchor`?`bold`:`normal`).attr(`text-anchor`,e=>e.className===`anchor`?`middle`:`start`).attr(`dominant-baseline`,e=>e.className===`anchor`?`middle`:`auto`).text(e=>e.label),d.annotations.length>0){let e=_.append(`g`).attr(`class`,`wardley-annotations`);if(d.annotations.forEach(t=>{let n=t.coordinates.map(e=>({x:x(e.x),y:S(e.y)}));if(n.length>1)for(let t=0;t<n.length-1;t++)e.append(`line`).attr(`class`,`wardley-annotation-line`).attr(`x1`,n[t].x).attr(`y1`,n[t].y).attr(`x2`,n[t+1].x).attr(`y2`,n[t+1].y).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`stroke-dasharray`,`4 4`);n.forEach(n=>{let r=e.append(`g`).attr(`class`,`wardley-annotation`);r.append(`circle`).attr(`cx`,n.x).attr(`cy`,n.y).attr(`r`,10).attr(`fill`,`white`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5),r.append(`text`).attr(`x`,n.x).attr(`y`,n.y).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`central`).attr(`font-size`,10).attr(`fill`,s.axisTextColor).attr(`font-weight`,`bold`).text(t.number)})}),d.annotationsBox){let t=x(d.annotationsBox.x),n=S(d.annotationsBox.y),r=e.append(`g`).attr(`class`,`wardley-annotations-box`),i=[...d.annotations].filter(e=>e.text).sort((e,t)=>e.number-t.number),a=[];if(i.forEach((e,i)=>{let o=r.append(`text`).attr(`x`,t+10).attr(`y`,n+10+(i+1)*16).attr(`font-size`,11).attr(`fill`,s.axisTextColor).attr(`text-anchor`,`start`).attr(`dominant-baseline`,`middle`).text(`${e.number}. ${e.text}`);a.push(o)}),a.length>0){let e=0,c=0;a.forEach(t=>{let n=t.node(),r=n.getComputedTextLength();e=Math.max(e,r);let i=n.getBBox();c=Math.max(c,i.height)});let l=e+20+105,u=i.length*16+20+c/2,d=o.padding,f=p-o.padding-l,h=o.padding,g=m-o.padding-u;t=Math.max(d,Math.min(t,f)),n=Math.max(h,Math.min(n,g)),a.forEach((e,r)=>{e.attr(`x`,t+10).attr(`y`,n+10+(r+1)*16)}),r.insert(`rect`,`text`).attr(`x`,t).attr(`y`,n).attr(`width`,l).attr(`height`,u).attr(`fill`,`white`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`rx`,4).attr(`ry`,4)}}}if(d.notes.length>0){let e=_.append(`g`).attr(`class`,`wardley-notes`);d.notes.forEach(t=>{let n=x(t.x),r=S(t.y);e.append(`text`).attr(`x`,n).attr(`y`,r).attr(`text-anchor`,`start`).attr(`font-size`,11).attr(`fill`,s.axisTextColor).attr(`font-weight`,`bold`).text(t.text)})}if(d.accelerators.length>0){let e=_.append(`g`).attr(`class`,`wardley-accelerators`);d.accelerators.forEach(t=>{let n=x(t.x),r=S(t.y),i=`
3
3
  M ${n} ${r-30/2}
4
4
  L ${n+60-20} ${r-30/2}
@@ -1,4 +1,4 @@
1
- import{g as e,h as t}from"./src-CM_9kdrU.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,f as l,v as u,w as d,y as f,z as p}from"./chunk-CSCIHK7Q-Cn-ZTxsS.js";import{t as m}from"./linear-C2SUy5ns.js";import{t as h}from"./ordinal-hYBb2elL.js";import{t as g}from"./init-D6jRqBbL.js";import{i as _}from"./chunk-5ZQYHXKU-Dd3yz721.js";import{t as v}from"./line-DJJ9BLuY.js";import{t as y}from"./chunk-WU5MYG2G-C63BVvr_.js";import{t as b}from"./chunk-O5CBEL6O-ByfKhkZf.js";function x(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function S(){var e=h().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=x(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return S(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},g.apply(d(),arguments)}var C=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,10,12,14,16,18,19,21,23],r=[2,6],i=[1,3],a=[1,5],o=[1,6],s=[1,7],c=[1,5,10,12,14,16,18,19,21,23,34,35,36],l=[1,25],u=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],h=[1,32],g=[1,33],_=[1,34],v=[1,35],y=[1,36],b=[1,37],x=[1,43],S=[1,42],C=[1,47],w=[1,50],T=[1,10,12,14,16,18,19,21,23,34,35,36],E=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],D=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],O=[1,64],k={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:`error`,5:`XYCHART`,8:`CHART_ORIENTATION`,10:`title`,12:`X_AXIS`,14:`Y_AXIS`,16:`LINE`,18:`BAR`,19:`acc_title`,20:`acc_title_value`,21:`acc_descr`,22:`acc_descr_value`,23:`acc_descr_multiline_value`,24:`SQUARE_BRACES_START`,26:`SQUARE_BRACES_END`,27:`NUMBER_WITH_DECIMAL`,28:`COMMA`,31:`ARROW_DELIMITER`,34:`NEWLINE`,35:`SEMI`,36:`EOF`,38:`STR`,39:`MD_STR`,41:`AMP`,42:`NUM`,43:`ALPHA`,44:`PLUS`,45:`EQUALS`,46:`MULT`,47:`DOT`,48:`BRKT`,49:`MINUS`,50:`UNDERSCORE`},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setOrientation(a[s]);break;case 9:r.setDiagramTitle(a[s].text.trim());break;case 12:r.setLineData({text:``,type:`text`},a[s]);break;case 13:r.setLineData(a[s-1],a[s]);break;case 14:r.setBarData({text:``,type:`text`},a[s]);break;case 15:r.setBarData(a[s-1],a[s]);break;case 16:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 17:case 18:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 19:this.$=a[s-1];break;case 20:this.$=[Number(a[s-2]),...a[s]];break;case 21:this.$=[Number(a[s])];break;case 22:r.setXAxisTitle(a[s]);break;case 23:r.setXAxisTitle(a[s-1]);break;case 24:r.setXAxisTitle({type:`text`,text:``});break;case 25:r.setXAxisBand(a[s]);break;case 26:r.setXAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 27:this.$=a[s-1];break;case 28:this.$=[a[s-2],...a[s]];break;case 29:this.$=[a[s]];break;case 30:r.setYAxisTitle(a[s]);break;case 31:r.setYAxisTitle(a[s-1]);break;case 32:r.setYAxisTitle({type:`text`,text:``});break;case 33:r.setYAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 37:this.$={text:a[s],type:`text`};break;case 38:this.$={text:a[s],type:`text`};break;case 39:this.$={text:a[s],type:`markdown`};break;case 40:this.$=a[s];break;case 41:this.$=a[s-1]+``+a[s];break}},`anonymous`),table:[e(n,r,{3:1,4:2,7:4,5:i,34:a,35:o,36:s}),{1:[3]},e(n,r,{4:2,7:4,3:8,5:i,34:a,35:o,36:s}),e(n,r,{4:2,7:4,6:9,3:10,5:i,8:[1,11],34:a,35:o,36:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(c,[2,34]),e(c,[2,35]),e(c,[2,36]),{1:[2,1]},e(n,r,{4:2,7:4,3:21,5:i,34:a,35:o,36:s}),{1:[2,3]},e(c,[2,5]),e(n,[2,7],{4:22,34:a,35:o,36:s}),{11:23,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:39,13:38,24:x,27:S,29:40,30:41,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:45,15:44,27:C,33:46,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:49,17:48,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:52,17:51,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{20:[1,53]},{22:[1,54]},e(T,[2,18]),{1:[2,2]},e(T,[2,8]),e(T,[2,9]),e(E,[2,37],{40:55,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b}),e(E,[2,38]),e(E,[2,39]),e(D,[2,40]),e(D,[2,42]),e(D,[2,43]),e(D,[2,44]),e(D,[2,45]),e(D,[2,46]),e(D,[2,47]),e(D,[2,48]),e(D,[2,49]),e(D,[2,50]),e(D,[2,51]),e(T,[2,10]),e(T,[2,22],{30:41,29:56,24:x,27:S}),e(T,[2,24]),e(T,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,11]),e(T,[2,30],{33:60,27:C}),e(T,[2,32]),{31:[1,61]},e(T,[2,12]),{17:62,24:w},{25:63,27:O},e(T,[2,14]),{17:65,24:w},e(T,[2,16]),e(T,[2,17]),e(D,[2,41]),e(T,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(T,[2,31]),{27:[1,69]},e(T,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(T,[2,15]),e(T,[2,26]),e(T,[2,27]),{11:59,32:72,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,33]),e(T,[2,19]),{25:73,27:O},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{g as e,h as t}from"./src-Dz3SjXJY.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,f as l,v as u,w as d,y as f,z as p}from"./chunk-CSCIHK7Q-Bv0Fa0Zn.js";import{t as m}from"./linear-BR6v_8SI.js";import{t as h}from"./ordinal-hYBb2elL.js";import{t as g}from"./init-D6jRqBbL.js";import{i as _}from"./chunk-5ZQYHXKU-DOCnP8P8.js";import{t as v}from"./line-BnRWAabF.js";import{t as y}from"./chunk-WU5MYG2G-Dp8LMm21.js";import{t as b}from"./chunk-O5CBEL6O-BRpqOJ1I.js";function x(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function S(){var e=h().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=x(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return S(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},g.apply(d(),arguments)}var C=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,10,12,14,16,18,19,21,23],r=[2,6],i=[1,3],a=[1,5],o=[1,6],s=[1,7],c=[1,5,10,12,14,16,18,19,21,23,34,35,36],l=[1,25],u=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],h=[1,32],g=[1,33],_=[1,34],v=[1,35],y=[1,36],b=[1,37],x=[1,43],S=[1,42],C=[1,47],w=[1,50],T=[1,10,12,14,16,18,19,21,23,34,35,36],E=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],D=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],O=[1,64],k={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:`error`,5:`XYCHART`,8:`CHART_ORIENTATION`,10:`title`,12:`X_AXIS`,14:`Y_AXIS`,16:`LINE`,18:`BAR`,19:`acc_title`,20:`acc_title_value`,21:`acc_descr`,22:`acc_descr_value`,23:`acc_descr_multiline_value`,24:`SQUARE_BRACES_START`,26:`SQUARE_BRACES_END`,27:`NUMBER_WITH_DECIMAL`,28:`COMMA`,31:`ARROW_DELIMITER`,34:`NEWLINE`,35:`SEMI`,36:`EOF`,38:`STR`,39:`MD_STR`,41:`AMP`,42:`NUM`,43:`ALPHA`,44:`PLUS`,45:`EQUALS`,46:`MULT`,47:`DOT`,48:`BRKT`,49:`MINUS`,50:`UNDERSCORE`},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setOrientation(a[s]);break;case 9:r.setDiagramTitle(a[s].text.trim());break;case 12:r.setLineData({text:``,type:`text`},a[s]);break;case 13:r.setLineData(a[s-1],a[s]);break;case 14:r.setBarData({text:``,type:`text`},a[s]);break;case 15:r.setBarData(a[s-1],a[s]);break;case 16:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 17:case 18:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 19:this.$=a[s-1];break;case 20:this.$=[Number(a[s-2]),...a[s]];break;case 21:this.$=[Number(a[s])];break;case 22:r.setXAxisTitle(a[s]);break;case 23:r.setXAxisTitle(a[s-1]);break;case 24:r.setXAxisTitle({type:`text`,text:``});break;case 25:r.setXAxisBand(a[s]);break;case 26:r.setXAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 27:this.$=a[s-1];break;case 28:this.$=[a[s-2],...a[s]];break;case 29:this.$=[a[s]];break;case 30:r.setYAxisTitle(a[s]);break;case 31:r.setYAxisTitle(a[s-1]);break;case 32:r.setYAxisTitle({type:`text`,text:``});break;case 33:r.setYAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 37:this.$={text:a[s],type:`text`};break;case 38:this.$={text:a[s],type:`text`};break;case 39:this.$={text:a[s],type:`markdown`};break;case 40:this.$=a[s];break;case 41:this.$=a[s-1]+``+a[s];break}},`anonymous`),table:[e(n,r,{3:1,4:2,7:4,5:i,34:a,35:o,36:s}),{1:[3]},e(n,r,{4:2,7:4,3:8,5:i,34:a,35:o,36:s}),e(n,r,{4:2,7:4,6:9,3:10,5:i,8:[1,11],34:a,35:o,36:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(c,[2,34]),e(c,[2,35]),e(c,[2,36]),{1:[2,1]},e(n,r,{4:2,7:4,3:21,5:i,34:a,35:o,36:s}),{1:[2,3]},e(c,[2,5]),e(n,[2,7],{4:22,34:a,35:o,36:s}),{11:23,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:39,13:38,24:x,27:S,29:40,30:41,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:45,15:44,27:C,33:46,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:49,17:48,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:52,17:51,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{20:[1,53]},{22:[1,54]},e(T,[2,18]),{1:[2,2]},e(T,[2,8]),e(T,[2,9]),e(E,[2,37],{40:55,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b}),e(E,[2,38]),e(E,[2,39]),e(D,[2,40]),e(D,[2,42]),e(D,[2,43]),e(D,[2,44]),e(D,[2,45]),e(D,[2,46]),e(D,[2,47]),e(D,[2,48]),e(D,[2,49]),e(D,[2,50]),e(D,[2,51]),e(T,[2,10]),e(T,[2,22],{30:41,29:56,24:x,27:S}),e(T,[2,24]),e(T,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,11]),e(T,[2,30],{33:60,27:C}),e(T,[2,32]),{31:[1,61]},e(T,[2,12]),{17:62,24:w},{25:63,27:O},e(T,[2,14]),{17:65,24:w},e(T,[2,16]),e(T,[2,17]),e(D,[2,41]),e(T,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(T,[2,31]),{27:[1,69]},e(T,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(T,[2,15]),e(T,[2,26]),e(T,[2,27]),{11:59,32:72,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,33]),e(T,[2,19]),{25:73,27:O},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};k.lexer=(function(){return{EOF:1,parseError:t(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:t(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:t(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:t(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:t(function(){return this._more=!0,this},`more`),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:t(function(e){this.unput(this.match.slice(e))},`less`),pastInput:t(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:t(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:t(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -11,7 +11,7 @@
11
11
  var saved = localStorage.getItem('constellation-theme');
12
12
  document.documentElement.dataset.theme = ok.indexOf(saved) >= 0 ? saved : 'observatory';
13
13
  </script>
14
- <script type="module" crossorigin src="/assets/index-DLPCG_Or.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-COz6c_JS.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-Bqs39Itl.css">
16
16
  </head>
17
17
  <body>
@@ -1,247 +0,0 @@
1
- # Constellation File Format (v2)
2
-
3
- Constellation stores a project's architecture plan as markdown files in the repo, under a
4
- `constellation/` folder. Each file is one **card** — one typed piece of the plan,
5
- linked to other cards by **connections**. ("Node" is reserved for diagram elements
6
- inside DIAGRAM cards; everything else is a card.)
7
- Git provides branching, diffing, merging, and history for the plan; the Constellation
8
- tooling (lint, MCP, viewer) provides validation, graph queries, and rendering on top.
9
-
10
- This document is the normative format spec. The JSON Schemas in `schemas/` define the
11
- per-type frontmatter fields; the skill in `skill/` teaches AI agents to author cards.
12
-
13
- ## Design principles
14
-
15
- 1. **The files are the source of truth.** Everything else — reverse indexes, catalogs,
16
- rollups, subgraph diagrams, diffs — is derived in memory and never stored.
17
- 2. **A card with no frontmatter is valid.** The file path gives identity; the body gives
18
- content. All structure is opt-in.
19
- 3. **Git is the change-tracking system.** `git diff -- constellation/` *is* the plan diff.
20
- Lifecycle state (`status`) is a property of a card; "what changed" is a property of
21
- history — the format never conflates them.
22
- 4. **Cheap to connect.** Connections are a plain list of handles. Friction on
23
- connecting cards produces sparse graphs, and a sparse graph is useless.
24
-
25
- ## Folder layout
26
-
27
- ```
28
- constellation/
29
- plan.md ← the project plan (handle PLAN-PROJECT)
30
- api/
31
- API-TICKETS.md
32
- datatype/
33
- DATATYPE-TICKET.md
34
- db/
35
- DB-TICKETS.md
36
- doc/ file/ test/ external/ event/ component/
37
- page/ job/ flow/ state/ diagram/ agent/ role/ plan/
38
- ```
39
-
40
- - The plan root is a folder named `constellation/`, normally at the repo root. Tooling
41
- finds it by walking up from the working directory (like `.git`).
42
- - Each card lives in the folder matching its type (see table below). Folder placement is
43
- a **convention**: the handle prefix is authoritative for type; a card in the wrong
44
- folder lints as a warning, not an error.
45
- - `plan.md` at the plan root is the one special file: it is the card `PLAN-PROJECT`
46
- (type PLAN). Additional PLAN cards (e.g. `PLAN-FRONTEND`) live in `plan/`.
47
-
48
- ## Files and handles
49
-
50
- **The filename is the handle.** `api/API-TICKETS.md` defines the card `API-TICKETS`.
51
- There is no `handle:` or `type:` field in frontmatter — the path already says it, and one
52
- source of truth means they can never disagree.
53
-
54
- Handle grammar:
55
-
56
- ```
57
- ^[A-Z][A-Z0-9]*-[A-Z0-9][A-Z0-9-]*$ (3–135 characters)
58
- ```
59
-
60
- Uppercase letters, digits, and dashes. The prefix (everything before the first dash)
61
- determines the type and MUST be one of the 17 canonical prefixes. v1 alias prefixes
62
- (`TYPE-`, `COMP-`, `RULE-`) are not valid in v2.
63
-
64
- | Type | Prefix | Folder | What it is |
65
- |-----------|--------------|--------------|---------------------------------------------|
66
- | API | `API-` | `api/` | HTTP/RPC endpoints |
67
- | DB | `DB-` | `db/` | Database tables / collections |
68
- | DATATYPE | `DATATYPE-` | `datatype/` | Data type schemas (interfaces, Zod, etc.) |
69
- | ROLE | `ROLE-` | `role/` | User roles / permission groups |
70
- | DOC | `DOC-` | `doc/` | Documentation cards |
71
- | FILE | `FILE-` | `file/` | Source file references |
72
- | TEST | `TEST-` | `test/` | Test specs |
73
- | EXTERNAL | `EXTERNAL-` | `external/` | External services / integrations |
74
- | EVENT | `EVENT-` | `event/` | Domain events / signals |
75
- | COMPONENT | `COMPONENT-` | `component/` | Reusable UI components |
76
- | PAGE | `PAGE-` | `page/` | Frontend routes / screens |
77
- | JOB | `JOB-` | `job/` | Background / scheduled / queued work |
78
- | FLOW | `FLOW-` | `flow/` | Multi-step sequenced processes |
79
- | STATE | `STATE-` | `state/` | State machines |
80
- | DIAGRAM | `DIAGRAM-` | `diagram/` | Architecture diagrams |
81
- | AGENT | `AGENT-` | `agent/` | AI agent instructions / policies |
82
- | PLAN | `PLAN-` | `plan/` | Plan documents (`plan.md` = `PLAN-PROJECT`) |
83
-
84
- ## Card anatomy
85
-
86
- ```markdown
87
- ---
88
- name: List & create tickets
89
- status: built
90
- path: /api/v1/tickets
91
- methods:
92
- GET:
93
- query_params:
94
- - { name: status, type: string }
95
- response_schema: DATATYPE-TICKET
96
- POST:
97
- request_schema: DATATYPE-CREATE-TICKET-INPUT
98
- response_schema: DATATYPE-TICKET
99
- connections:
100
- - DB-TICKETS
101
- ---
102
-
103
- # Tickets API
104
-
105
- Returns tickets for the active inbox. POST validates the requester exists
106
- before inserting — see [[FLOW-CREATE-TICKET]] for the full sequence.
107
- ```
108
-
109
- ### Frontmatter
110
-
111
- YAML frontmatter is optional. Four keys are **reserved** (defined in
112
- `schemas/card.json`); every other key is a type-specific field (defined in
113
- `schemas/<type>.json`):
114
-
115
- | Key | Type | Meaning |
116
- |---------------|----------|--------------------------------------------------------------|
117
- | `name` | string | Display name (the handle is the identity; this is the label) |
118
- | `kind` | string | Subtype discriminator, lowercase slug (`sql-table`, `e2e`, `decision`) |
119
- | `status` | enum | Lifecycle: `planned` \| `building` \| `built` \| `verified` |
120
- | `connections` | string[] | Plain list of handles this card is connected to |
121
-
122
- Type-specific fields sit at the top level of frontmatter (not nested under a `data` key).
123
- Schemas are permissive: almost nothing is required, known fields are typed, unknown
124
- fields are allowed (lint warns so typos get caught).
125
-
126
- ### Body
127
-
128
- The body is markdown — the card's narrative. Two constructs are graph-aware:
129
-
130
- - **Wiki-links**: `[[API-TICKETS]]` connects this card to `API-TICKETS`. Use them freely
131
- in prose; they are the cheapest way to wire the graph.
132
- - **Mermaid blocks**: inside ` ```mermaid ` fences, any node identifier shaped like a
133
- handle counts as a connection (see Diagrams below).
134
-
135
- ## Graph rules
136
-
137
- The indexer derives the connection set from four sources, in all cards:
138
-
139
- 1. The `connections:` list in frontmatter.
140
- 2. Handle-shaped string values anywhere else in frontmatter (so
141
- `response_schema: DATATYPE-TICKET` connects automatically — no need to repeat it in
142
- `connections`).
143
- 3. `[[HANDLE]]` wiki-links in the body.
144
- 4. Handle-shaped identifiers inside ` ```mermaid ` blocks in the body.
145
-
146
- Connections are **undirected** and deduped by pair: declare a connection on whichever
147
- card you are editing; both cards see it when queried. Self-references are ignored. The reverse
148
- view ("what points at X?") is the indexer's job — it is never written into files.
149
-
150
- ## Diagrams and flows
151
-
152
- Three tiers, cheapest first:
153
-
154
- 1. **Derived subgraphs** (default for "what does this area look like"): the viewer/MCP
155
- render any card's neighborhood from the real connection graph on demand. Never stored,
156
- never stale.
157
- 2. **Authored Mermaid** (default for conceptual diagrams): a DIAGRAM card whose body is a
158
- ` ```mermaid ` block. Use handles as Mermaid node IDs so the diagram joins the graph.
159
- Sequence diagrams (`sequenceDiagram`) and state diagrams (`stateDiagram-v2`) work the
160
- same way in FLOW and STATE cards.
161
- 3. **Pinned layouts** (escape hatch for curated diagrams): structured `nodes` / `edges` /
162
- `phases` in DIAGRAM frontmatter with explicit positions — see `schemas/diagram.json`. Use
163
- only when layout carries meaning; positions make noisy diffs.
164
-
165
- **FLOW cards are linear.** Steps are a numbered markdown list in the body, with nested
166
- list items for error/edge cases. If a flow needs real branching, it is either a Mermaid
167
- flowchart or actually a STATE card.
168
-
169
- ```markdown
170
- 1. [[PAGE-INBOX]] submits the new ticket form
171
- 2. [[API-CREATE-TICKET]] validates the requester
172
- - if the requester is unknown → 422, form shows inline error
173
- 3. Ticket row inserted into [[DB-TICKETS]]
174
- 4. [[EVENT-TICKET-CREATED]] fires → [[JOB-AUTO-ASSIGN]]
175
- ```
176
-
177
- ## Lint policy
178
-
179
- **Errors** (break the graph; non-zero exit, CI should block):
180
-
181
- | Code | Rule |
182
- |------|------|
183
- | E001 | Filename is not a valid handle |
184
- | E002 | Handle prefix is not one of the 17 canonical prefixes |
185
- | E003 | Duplicate handle (two files resolve to the same handle) |
186
- | E004 | `connections` entry is not a handle-shaped string |
187
- | E005 | `connections` or frontmatter-field target resolves to no card |
188
- | E006 | Frontmatter is not valid YAML |
189
-
190
- **Warnings** (style/quality; reported, exit 0):
191
-
192
- | Code | Rule |
193
- |------|------|
194
- | W001 | Card is not in the folder matching its type |
195
- | W002 | Frontmatter violates the type's JSON Schema |
196
- | W003 | Unknown frontmatter field (not reserved, not in the type schema) |
197
- | W004 | Body `[[link]]` or Mermaid reference resolves to no card |
198
-
199
- The split between E005 and W004 is deliberate: structured references (frontmatter) are
200
- contracts and must resolve; prose references may legitimately point at cards that are
201
- planned but not yet written.
202
-
203
- ## Change tracking and sync
204
-
205
- - **What changed**: `git diff <ref> -- constellation/` . Plan changes ride branches and
206
- PRs like any other change; reviewing a plan PR is the human approval gate before an
207
- AI syncs code to it.
208
- - **Sync marker**: a reconciling agent records the last plan commit it synced code
209
- against (e.g. a `constellation-synced` tag or a SHA noted in `plan.md`). "Dirty" =
210
- everything in `git diff <synced>..HEAD -- constellation/`. No per-card stamping.
211
- - **Lifecycle**: `status` tracks where a card is in its life (`planned` → `building` →
212
- `built` → `verified`), orthogonal to git history. An agent that verifies a card
213
- against the actual code sets `status: verified`.
214
-
215
- ## Connected repos (multi-repo)
216
-
217
- A project that spans several repos can declare its siblings on `PLAN-PROJECT`. This is the
218
- one cross-repo concept in the format, and it is deliberately minimal: each repo's
219
- `constellation/` is identical to a standalone one, references only its own cards, and lints
220
- clean on its own — connections never cross repos.
221
-
222
- `plan.md` frontmatter may carry a `connected_repos` list (validated by `schemas/plan.json`):
223
-
224
- ```yaml
225
- connected_repos:
226
- - name: pyramid-server # lowercase id; the `repo` selector in MCP tools
227
- path: ../pyramid-server # relative to this repo's root (or absolute)
228
- description: Back-end API for Pyramid, written in Go.
229
- ```
230
-
231
- These are **repo-level links only** — never card-to-card connections, never a merged graph.
232
- The path is local topology (it may differ per machine), so it is **never validated by lint**;
233
- tooling reports reachability only when something actually uses it. The MCP server's `repo`
234
- selector resolves a name (or path) to that sibling's plan, so one agent can read or write
235
- across repos; the per-repo plan remains the unit, and **plan resolution still never crosses a
236
- repo boundary** on its own — a sibling is reached only when explicitly named.
237
-
238
- ## What is deliberately not in the format
239
-
240
- - No IDs other than handles. No UUIDs/ULIDs.
241
- - No cross-repo card references. Cards connect only within their own plan; sibling repos are
242
- linked at the project level via `connected_repos` (above), not by handle.
243
- - No connection kinds, directions, or metadata. If a relationship needs explanation,
244
- explain it in prose in the body — structure is for navigation, prose is for meaning.
245
- - No revision/branch/diff machinery. Git does that.
246
- - No required fields beyond the filename (single exception: `FILE` cards require `path`,
247
- because a file reference without a path refers to nothing).
package/docs/002-mcp.md DELETED
@@ -1,158 +0,0 @@
1
- # Constellation MCP (v2)
2
-
3
- The MCP server gives AI agents graph queries, hydrated retrieval, validated writes,
4
- and git-powered change tracking over a plan folder. It is a thin layer over
5
- `src/core/`: every tool call reloads the index from disk (tens of milliseconds at
6
- realistic plan sizes), so it is always correct while files are being edited in
7
- parallel — no watcher, no cache invalidation.
8
-
9
- Entry point: `constellation mcp` (stdio). Bootstrap is folder discovery: the server
10
- walks up from the working directory to find `constellation/`, **bounded by the repo
11
- root** (the first ancestor with `.git`) — it never crosses into another repo's plan,
12
- so a repo with no plan returns `NO_PLAN_FOUND` rather than silently adopting a
13
- sibling's. No accounts, no tokens, no settings handshake. When no plan exists yet,
14
- `init_plan` scaffolds `constellation/` + starter `plan.md` (same shared scaffold the
15
- CLI `constellation init` uses); every other tool works immediately after — no restart.
16
-
17
- Every tool also accepts an optional **`repo`** selector to act on a *sibling* repo declared
18
- in `connected_repos` (see [Connected repos](#connected-repos-multi-repo) below). Without it,
19
- everything operates on the repo found by walk-up, exactly as before — the boundary above is
20
- never crossed implicitly, only when a sibling is named.
21
-
22
- ## Vocabulary
23
-
24
- **Card** (a file in the plan), **connection** (an undirected link between two cards).
25
- Tool responses use `connected_cards`, never `connected_nodes`.
26
-
27
- ## Hydrated retrieval (core requirement)
28
-
29
- Any read tool can return connected cards **with their full data** in one call. Three
30
- levels, chosen by the caller because the cost is context tokens, not compute:
31
-
32
- - `none` — the card(s) only
33
- - `summary` — connected cards as `{ handle, type, kind, name, status }`
34
- - `full` — connected cards with complete `frontmatter` and `body`
35
-
36
- The acceptance test: one `get_card` call returns an API card plus the complete
37
- content of every card connected to it (its datatypes, table, tests, docs).
38
-
39
- ## Tools
40
-
41
- ### Read
42
-
43
- | Tool | Input | Returns |
44
- |---|---|---|
45
- | `get_card` | `handle`, `connected?` (default `summary`) | `{ card, connected_cards }` |
46
- | `list_cards` | `types?`, `kind?`, `status?`, `connected?`, `limit?` | `{ cards: summary[], total }` (`connected:false` → orphans only) |
47
- | `search` | `q`, `types?`, `limit?` (20), `connected?` (default `none`) | `{ matches: [{ card, score, excerpt, connected_cards? }] }` |
48
- | `traverse` | `start` (handle or array), `depth?` (2, max 5), `types?`, `detail?` (`summary`/`full`) | `{ cards: [{ …, distance }], connections }` |
49
- | `describe_type` | `type?` | No arg → catalog of all 17 types (`{ type, prefix, folder, purpose }`); a type → `{ schema, reference, reserved, prefix, folder }` (frontmatter JSON Schema + golden example). Plan-independent — works with no plan loaded. |
50
-
51
- `search` scoring: handle match ≫ name match > kind/type match > body occurrences;
52
- excerpt is the first matching body line. Seeding `traverse` with multiple handles
53
- (e.g. the output of `diff_plan`) is the impact-analysis pattern.
54
-
55
- ### Write
56
-
57
- | Tool | Input | Notes |
58
- |---|---|---|
59
- | `create_card` | `handle`, `name?`, `kind?`, `status?`, `connections?`, `fields?`, `body?`, `validate?` | Writes `<folder>/<HANDLE>.md`; `fields` = type-specific frontmatter. `validate:false` skips lint (bulk import) |
60
- | `create_cards` | `cards: [...]` (1–500) | Bulk create: validates all up front, writes all, lints ONCE → intra-batch references resolve. `{ created, failed, cards, issues }` |
61
- | `update_card` | `handle`, `patch?`, `body?` | See merge semantics below |
62
- | `delete_card` | `handle` | Returns `referenced_by` so the caller can clean up |
63
- | `add_connection` | `from`, `to` | Appends to `from`'s connections (no-op if already connected from any source) |
64
- | `add_connections` | `connections: [{from,to}]` (1–1000) | Bulk connect, idempotent/undirected, one lint pass. `{ added, failed, issues }` |
65
- | `remove_connection` | `a`, `b` | Removes from either card's list; reports if the connection survives via other sources (frontmatter field, body link, mermaid) |
66
-
67
- Every write reloads the index, lints, and returns the issues touching the written
68
- file — an agent finds out immediately if it created a dangling reference. **A card
69
- is created even when issues are returned** — `issues` are the current lint state,
70
- not a failure. For migrations, prefer `create_cards` + `add_connections` (batched,
71
- one lint pass, no transient dangling-reference noise) or `create_card validate:false`
72
- followed by a single `check_integrity`.
73
-
74
- **Merge semantics for `update_card`:** `patch.name/kind/status` set (or delete with
75
- `null`); `patch.connections` replaces the list wholesale (use add/remove_connection
76
- for incremental edits); `patch.fields` deep-merges into type-specific frontmatter —
77
- objects merge recursively, arrays replace, `null` deletes a key. `body` replaces the
78
- whole body.
79
-
80
- **Formatting preservation:** a body-only update never touches frontmatter bytes.
81
- A frontmatter update re-serializes **only the top-level keys whose values
82
- changed** — unchanged keys keep their original text byte-for-byte (flow-style
83
- maps, comments, and all), so a status flip is a one-line diff. Key order is
84
- preserved; new keys append. Only a changed key's value normalizes to canonical
85
- YAML style.
86
-
87
- ### Git
88
-
89
- | Tool | Input | Returns |
90
- |---|---|---|
91
- | `diff_plan` | `base?`, `head?` | `{ base, base_source, head, changes: [{ handle, file, change, changed_keys?, body_changed? }] }` |
92
- | `plan_log` | `handle`, `limit?` (20) | commits touching that card |
93
- | `set_sync_point` | `sha?` (default `HEAD`) | writes `constellation/.sync.json`; `warning` if the plan is uncommitted |
94
- | `check_integrity` | — | lint result + `orphans` (zero-connection cards) |
95
-
96
- `diff_plan` base resolution: explicit argument → sync marker (`.sync.json`) →
97
- `HEAD` (i.e. uncommitted plan changes). `head` defaults to the working tree.
98
- `change` is `added` / `modified` / `removed` / `renamed`; for modified cards the
99
- old and new versions are parsed and compared, yielding `changed_keys` (frontmatter)
100
- and `body_changed`.
101
-
102
- The sync workflow ("sync the plan to the code"): the plan is the source of truth, so
103
- a code-sync agent brings code up to a changed plan — it calls `diff_plan` (base =
104
- marker), traverses the changed handles for blast radius, updates code, then
105
- `set_sync_point` to move the marker. For a large diff it acts as an **orchestrator**:
106
- it partitions the blast radius into non-overlapping neighborhoods and fans out a
107
- sub-agent per neighborhood (split on file boundaries so no two agents touch the same
108
- file), which keeps the orchestrator's context clean and on the macro view. It always
109
- verifies the sub-agents' work — against the cards, and via build/tests — after they
110
- finish, and only then sets the sync point (once). `.sync.json` is versioned, rides
111
- branches, and the indexer ignores dotfiles so it is never treated as a card.
112
-
113
- ### Viewer
114
-
115
- | Tool | Input | Returns |
116
- |---|---|---|
117
- | `start_viewer` | `port?` (default 4747; `0` = any free port), `readonly?`, `open?` | `{ url, port, plan_root, editable }`; idempotent — if already running, `{ already_running, url, plan_root }` |
118
- | `stop_viewer` | — | `{ stopped, was }`, or `{ running: false }` if it wasn't running |
119
-
120
- `start_viewer` renders the plan as a browsable, editable site and scans forward from the
121
- requested port for a free one, so always read the actual `port` from the response and post
122
- the `url` back to the user. The viewer runs until `stop_viewer` or until the MCP process exits.
123
-
124
- ### Connected repos (multi-repo)
125
-
126
- A project can declare sibling repos on `PLAN-PROJECT` `connected_repos` (name + path +
127
- description; see `docs/001-file-format.md`). These are repo-level links, not card
128
- connections — each repo's plan stays self-contained.
129
-
130
- Every read and write tool takes an optional **`repo`** selector: omit it for the current plan
131
- (default, unchanged), or pass a `connected_repos` name (or a path) to read or write **that**
132
- sibling's plan instead. An unknown `repo` is refused (`UNKNOWN_REPO`, listing the declared
133
- names) rather than landing in the wrong place. Three tools manage the links:
134
-
135
- | Tool | Input | Returns |
136
- |---|---|---|
137
- | `list_connected_repos` | `repo?` | `{ connected_repos: [{ name, path, description, reachable }] }` |
138
- | `add_connected_repo` | `name`, `path`, `description?`, `reciprocate?`, `reverse_description?`, `repo?` | Upserts the link on the selected repo's `PLAN-PROJECT`; `reciprocate` also writes the reverse link into the target repo |
139
- | `remove_connected_repo` | `name`, `repo?` | Removes the link from the selected repo's `PLAN-PROJECT` |
140
-
141
- Paths are local topology and are **never** linted; `reachable` is computed at call time.
142
- Cross-repo investigation has two modes: read a sibling's *plan* in-process with `repo:`, or —
143
- for the sibling's real code, or when its plan can't answer — spawn a sub-agent scoped to that
144
- repo's path. For one change spanning repos, the orchestrator writes the per-repo card updates
145
- with `repo:` set on every write, then fans out a per-repo implementer sub-agent (each in plain
146
- single-repo mode) and sets each repo's sync point.
147
-
148
- ## What v1 tools deliberately died
149
-
150
- - `expand_handles` — handles ARE the identifiers; nothing to resolve.
151
- - `init_project` / `link_project` / `check_health` — bootstrap is finding a folder.
152
- (`init_plan` exists for MCP-only environments, but it just creates the folder —
153
- no server, no settings file, no linking.)
154
- - `read_plan` / `update_plan` — `get_card("PLAN-PROJECT")` / `update_card`.
155
-
156
- (Bulk variants were *not* dropped — v1 punted on them, but `create_cards` /
157
- `add_connections` now exist: batching lints once, so intra-batch references resolve
158
- without transient dangling-reference noise. See the Write table above.)
@@ -1 +0,0 @@
1
- import"./chunk-NNHCCRGN-DlpIbxXb.js";import{x as e}from"./mermaid-parser.core-xhSeYiZo.js";export{e as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{at as e,ot as t}from"./chunk-CSCIHK7Q-Cn-ZTxsS.js";var n=(n,r)=>t.lang.round(e.parse(n)[r]);export{n as t};
@@ -1 +0,0 @@
1
- import{h as e}from"./src-CM_9kdrU.js";var t=class{constructor(e){this.init=e,this.records=this.init()}static{e(this,`ImperativeState`)}reset(){this.records=this.init()}};export{t};
@@ -1 +0,0 @@
1
- import{h as e,p as t}from"./src-CM_9kdrU.js";import{x as n}from"./chunk-CSCIHK7Q-Cn-ZTxsS.js";var r=e(e=>{let{securityLevel:r}=n(),i=t(`body`);return r===`sandbox`&&(i=t((t(`#i${e}`).node()?.contentDocument??document).body)),i.select(`#${e}`)},`selectSvgElement`);export{r as t};
@@ -1 +0,0 @@
1
- import{h as e}from"./src-CM_9kdrU.js";import"./chunk-CSCIHK7Q-Cn-ZTxsS.js";import"./chunk-5ZQYHXKU-Dd3yz721.js";import"./chunk-O5CBEL6O-ByfKhkZf.js";import"./chunk-FMBD7UC4-5axXeZJa.js";import"./chunk-BSJP7CBP-r6MRPvAH.js";import"./chunk-L5ZTLDWV-C2YNkUjB.js";import"./chunk-ND2GUHAM-CokDnghi.js";import"./chunk-55IACEB6-CtNd8e4Y.js";import"./chunk-2J33WTMH-y7Pz5tMO.js";import"./chunk-NZK2D7GU-aaU0v4QE.js";import"./chunk-3OPIFGDE-Ir_ghIUQ.js";import"./chunk-KSCS5N6A-BwmNx0l0.js";import"./chunk-LZXEDZCA-CznuDgQD.js";import{i as t,n,r,t as i}from"./chunk-727SXJPM-CAM8mGbv.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
@@ -1 +0,0 @@
1
- import{h as e}from"./src-CM_9kdrU.js";import"./chunk-CSCIHK7Q-Cn-ZTxsS.js";import"./chunk-5ZQYHXKU-Dd3yz721.js";import"./chunk-O5CBEL6O-ByfKhkZf.js";import"./chunk-FMBD7UC4-5axXeZJa.js";import"./chunk-BSJP7CBP-r6MRPvAH.js";import"./chunk-L5ZTLDWV-C2YNkUjB.js";import"./chunk-ND2GUHAM-CokDnghi.js";import"./chunk-55IACEB6-CtNd8e4Y.js";import"./chunk-2J33WTMH-y7Pz5tMO.js";import"./chunk-NZK2D7GU-aaU0v4QE.js";import"./chunk-3OPIFGDE-Ir_ghIUQ.js";import"./chunk-KSCS5N6A-BwmNx0l0.js";import"./chunk-LZXEDZCA-CznuDgQD.js";import{i as t,n,r,t as i}from"./chunk-727SXJPM-CAM8mGbv.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
@@ -1 +0,0 @@
1
- import"./chunk-NNHCCRGN-DlpIbxXb.js";import{y as e}from"./mermaid-parser.core-xhSeYiZo.js";export{e as createEventModelingServices};
@@ -1 +0,0 @@
1
- import{h as e}from"./src-CM_9kdrU.js";import"./chunk-CSCIHK7Q-Cn-ZTxsS.js";import"./chunk-5ZQYHXKU-Dd3yz721.js";import"./chunk-O5CBEL6O-ByfKhkZf.js";import"./chunk-BSJP7CBP-r6MRPvAH.js";import"./chunk-L5ZTLDWV-C2YNkUjB.js";import"./chunk-55IACEB6-CtNd8e4Y.js";import"./chunk-2J33WTMH-y7Pz5tMO.js";import"./chunk-NZK2D7GU-aaU0v4QE.js";import"./chunk-3OPIFGDE-Ir_ghIUQ.js";import"./chunk-KSCS5N6A-BwmNx0l0.js";import"./chunk-LZXEDZCA-CznuDgQD.js";import{i as t,n,r,t as i}from"./chunk-AQP2D5EJ-C3nW9Uve.js";var a={parser:n,get db(){return new i(2)},renderer:r,styles:t,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};