@a-company/paradigm 7.2.0 → 7.5.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 (167) hide show
  1. package/dist/{accept-orchestration-XW44LF5Y.js → accept-orchestration-NFNY5A4Q.js} +1 -1
  2. package/dist/{aggregate-H7SB2UYT.js → aggregate-647KIGV6.js} +1 -1
  3. package/dist/ambient-5TA5CD7Z.js +2 -0
  4. package/dist/{ambient-TFLZFV5Y.js → ambient-N24SR3BC.js} +1 -1
  5. package/dist/ambient-W3SPKLKC.js +2 -0
  6. package/dist/{arch-loader-YVOS3QRY.js → arch-loader-6TDQOSUE.js} +1 -1
  7. package/dist/arch-loader-NAGXLWUQ.js +2 -0
  8. package/dist/{beacon-WVN264OT.js → beacon-4XQSMTNN.js} +1 -1
  9. package/dist/calibrate-SH6PRZFD.js +2 -0
  10. package/dist/calibration-aggregate-5IVXSBDP.js +2 -0
  11. package/dist/calibration-aggregate-DUEE3LL2.js +4 -0
  12. package/dist/captain-2MEKZKJS.js +2 -0
  13. package/dist/captain-V5XPN4UP.js +2 -0
  14. package/dist/chunk-43H6PB2A.js +142 -0
  15. package/dist/chunk-54C2PETP.js +12 -0
  16. package/dist/{chunk-RGSFU2YW.js → chunk-5LIE2QMS.js} +1 -1
  17. package/dist/{chunk-ACJWUOMA.js → chunk-74NGU6YN.js} +1 -1
  18. package/dist/chunk-ABHILQLA.js +42 -0
  19. package/dist/{chunk-2KK4JQ55.js → chunk-AMZ3ESAK.js} +2 -2
  20. package/dist/chunk-BTMT4K73.js +93 -0
  21. package/dist/chunk-BXKFSYIN.js +2 -0
  22. package/dist/{chunk-RZRFYGND.js → chunk-CHFY3JSF.js} +15 -15
  23. package/dist/chunk-D2T5AV5N.js +504 -0
  24. package/dist/{chunk-ASBK55FU.js → chunk-DLMDHS2X.js} +1 -1
  25. package/dist/{chunk-6VZSOQ7Y.js → chunk-DQ4MMMTP.js} +1 -1
  26. package/dist/chunk-F3OBFUOE.js +2 -0
  27. package/dist/chunk-GADXREYG.js +18 -0
  28. package/dist/{chunk-A5EEY6NO.js → chunk-HGT7RNOL.js} +1 -1
  29. package/dist/chunk-HLPYCWE5.js +6 -0
  30. package/dist/chunk-IGB2CIMK.js +93 -0
  31. package/dist/{chunk-27EK3OQZ.js → chunk-JJ3AUHQU.js} +1 -1
  32. package/dist/chunk-JOHPASZG.js +4 -0
  33. package/dist/chunk-JOWT6J4C.js +25 -0
  34. package/dist/chunk-L4MKNG56.js +42 -0
  35. package/dist/chunk-PRZZL57E.js +7 -0
  36. package/dist/chunk-QBIME67A.js +2 -0
  37. package/dist/{chunk-USYV5QYU.js → chunk-QTMJVEEW.js} +1 -1
  38. package/dist/chunk-RPGSQQTS.js +2 -0
  39. package/dist/chunk-RQHZUPLO.js +4 -0
  40. package/dist/chunk-SGLIPRIC.js +3 -0
  41. package/dist/chunk-SOVBBLFK.js +6 -0
  42. package/dist/chunk-SPU3R5GW.js +25 -0
  43. package/dist/{chunk-NRP2KJ6I.js → chunk-T577TTVG.js} +3 -3
  44. package/dist/{chunk-W3VWORQZ.js → chunk-VHVUJGZ2.js} +2 -2
  45. package/dist/chunk-WUSTIEYA.js +4 -0
  46. package/dist/{commands-4ENQMHFO.js → commands-RSHKXKXN.js} +1 -1
  47. package/dist/{compliance-3M6COUCO.js → compliance-EFNXWHDL.js} +1 -1
  48. package/dist/{constellation-TIKNCZWR.js → constellation-26225R5K.js} +1 -1
  49. package/dist/{diff-Z2YSIRC4.js → diff-G52RYZNF.js} +1 -1
  50. package/dist/dist-6TDAY6TQ-HMSTBL57.js +39 -0
  51. package/dist/dist-N4NYCS3D.js +2 -0
  52. package/dist/dist-O7KGTIYK.js +4 -0
  53. package/dist/{docs-OWJ7EPD7.js → docs-2O7HUSBX.js} +1 -1
  54. package/dist/doctor-KGQXLGOQ.js +2 -0
  55. package/dist/github-GI3HX3N5.js +4 -0
  56. package/dist/graph-slice-2WECDOEN.js +2 -0
  57. package/dist/index.js +6 -6
  58. package/dist/{init-QPMLEQWQ.js → init-JGYCABZZ.js} +1 -1
  59. package/dist/{integrity-FRGF5BFS.js → integrity-YUCXTQX3.js} +1 -1
  60. package/dist/mcp.js +2 -2
  61. package/dist/nomination-engine-3EYXJOZZ.js +2 -0
  62. package/dist/nomination-engine-BUPERVPR.js +2 -0
  63. package/dist/notebook-loader-QM4KUT4R.js +2 -0
  64. package/dist/{orchestrate-C5NM5MFN.js → orchestrate-RIKQB2DV.js} +1 -1
  65. package/dist/orchestration-GFNPCEUU.js +2 -0
  66. package/dist/orchestration-I62QXOWV.js +2 -0
  67. package/dist/platform-server-AAEDDBS3.js +25 -0
  68. package/dist/{probe-G3TKOJYW.js → probe-GD3VDWGT.js} +1 -1
  69. package/dist/reindex-FNL4QRUZ.js +2 -0
  70. package/dist/reindex-N4NTDLJY.js +2 -0
  71. package/dist/{review-WHRNLW2W.js → review-YG4LWV22.js} +1 -1
  72. package/dist/{ripple-B6U7263T.js → ripple-S6VBP5C6.js} +1 -1
  73. package/dist/{sentinel-EFPEX246.js → sentinel-RIEQWALQ.js} +1 -1
  74. package/dist/{sentinel-bridge-UR2MKARY.js → sentinel-bridge-D4LFDFCH.js} +1 -1
  75. package/dist/sentinel.js +1 -1
  76. package/dist/serve-NPRYOGQX.js +9 -0
  77. package/dist/{server-4D77LCST.js → server-K7G3IHR3.js} +1 -1
  78. package/dist/session-tracker-HYN6ZYPH.js +2 -0
  79. package/dist/{session-work-log-T2IE4Y4T.js → session-work-log-KZX4PGUL.js} +1 -1
  80. package/dist/{setup-L5OP24US.js → setup-GPOTHS3N.js} +1 -1
  81. package/dist/{shift-UDKXCIW7.js → shift-ZIJTQ5SW.js} +2 -2
  82. package/dist/{snapshot-MT5L6XE4.js → snapshot-2ARNF3U2.js} +1 -1
  83. package/dist/{spawn-I6XG57S2.js → spawn-PHA2SVQ3.js} +1 -1
  84. package/dist/{status-4QGKLOP6.js → status-NTWWESOR.js} +1 -1
  85. package/dist/{summary-6QNVQZJV.js → summary-4QXYLXAB.js} +1 -1
  86. package/dist/sync-layer-Z266WBWF.js +2 -0
  87. package/dist/task-6F527BNU.js +3 -0
  88. package/dist/task-loader-75NBBLRQ.js +2 -0
  89. package/dist/task-loader-INPLZRG5.js +2 -0
  90. package/dist/task-settlement-3ROAHAND.js +3 -0
  91. package/dist/task-settlement-F7CIKUG3.js +3 -0
  92. package/dist/team-PFJTOCPM.js +2 -0
  93. package/dist/tools-MAH6K5UL.js +142 -0
  94. package/dist/tools-Z354SXGS.js +2 -0
  95. package/dist/{workspace-4D4TQ637.js → workspace-HADUT5XT.js} +1 -1
  96. package/package.json +3 -6
  97. package/platform-ui/dist/assets/{AmbientSection-CwatqcBD.js → AmbientSection-xoxr3DQg.js} +1 -1
  98. package/platform-ui/dist/assets/{DocsSection-BZ2SFJBZ.js → DocsSection-Us2qksna.js} +1 -1
  99. package/platform-ui/dist/assets/{GitSection-MNNYU1tO.js → GitSection-DIHZyadf.js} +1 -1
  100. package/platform-ui/dist/assets/{GraphSection-COYjb4Pt.js → GraphSection-9TO0L1IO.js} +1 -1
  101. package/platform-ui/dist/assets/{LoreSection-B0hUbfsJ.js → LoreSection-DVDit8Aw.js} +1 -1
  102. package/platform-ui/dist/assets/{SentinelSection-BCxW1DCp.js → SentinelSection-a5_VNYcx.js} +1 -1
  103. package/platform-ui/dist/assets/{SymphonySection-BsucZRqy.js → SymphonySection-cRHEoJ9t.js} +1 -1
  104. package/platform-ui/dist/assets/TasksSection-44_gDO3L.css +1 -0
  105. package/platform-ui/dist/assets/TasksSection-h8x3qRIj.js +1 -0
  106. package/platform-ui/dist/assets/{TeamSection-C0QNTudW.js → TeamSection-mFoDyNic.js} +1 -1
  107. package/platform-ui/dist/assets/{UniversitySection-DN1-g9pw.js → UniversitySection-D99YRjmC.js} +1 -1
  108. package/platform-ui/dist/assets/{index-DwUT8pju.js → index-D_wB2S_2.js} +11 -11
  109. package/platform-ui/dist/index.html +1 -1
  110. package/dist/ambient-OW5M5LVN.js +0 -2
  111. package/dist/ambient-VCTUHHIG.js +0 -2
  112. package/dist/arch-loader-G3AAM4E2.js +0 -2
  113. package/dist/calibrate-PHVP7RPH.js +0 -4
  114. package/dist/captain-CAXGHC2V.js +0 -2
  115. package/dist/captain-CWCLFOXV.js +0 -2
  116. package/dist/chunk-33ERV2MW.js +0 -18
  117. package/dist/chunk-3I3TITBA.js +0 -25
  118. package/dist/chunk-3YM5ABNX.js +0 -2
  119. package/dist/chunk-6HYRS3PH.js +0 -142
  120. package/dist/chunk-727PXENG.js +0 -2
  121. package/dist/chunk-D6BSCELB.js +0 -2
  122. package/dist/chunk-FG3M6VVO.js +0 -30
  123. package/dist/chunk-HSY75GRR.js +0 -6
  124. package/dist/chunk-K7KT6FL3.js +0 -25
  125. package/dist/chunk-KAUGQMXU.js +0 -4
  126. package/dist/chunk-QPQBXRXX.js +0 -93
  127. package/dist/chunk-RVXQNS6K.js +0 -30
  128. package/dist/chunk-TMDPDIWA.js +0 -3
  129. package/dist/chunk-UNSI6DVD.js +0 -93
  130. package/dist/chunk-XBK244QR.js +0 -6
  131. package/dist/chunk-XMAV5AG6.js +0 -2
  132. package/dist/chunk-XSKIXXFW.js +0 -504
  133. package/dist/chunk-Y76OIMDO.js +0 -7
  134. package/dist/chunk-ZSWXLFN7.js +0 -12
  135. package/dist/dist-GQ42YS5N-4HIJZVBB.js +0 -39
  136. package/dist/dist-PW5YPGFF.js +0 -2
  137. package/dist/dist-RXYJK7AZ.js +0 -2
  138. package/dist/doctor-CBZYYQQH.js +0 -2
  139. package/dist/github-4X4MYINS.js +0 -4
  140. package/dist/lore-server-FC2GMDLT.js +0 -14
  141. package/dist/nomination-engine-EFXDEPZN.js +0 -2
  142. package/dist/nomination-engine-YRHZZZUN.js +0 -2
  143. package/dist/notebook-loader-TZVIMNDJ.js +0 -2
  144. package/dist/orchestration-EVWQWTOV.js +0 -2
  145. package/dist/orchestration-UP3KFUJT.js +0 -2
  146. package/dist/platform-server-FXF3XFHM.js +0 -25
  147. package/dist/reindex-QZYOD5K4.js +0 -2
  148. package/dist/reindex-W67B2LQP.js +0 -2
  149. package/dist/serve-L52ZUTU6.js +0 -10
  150. package/dist/serve-ZT2Z54NK.js +0 -8
  151. package/dist/session-tracker-BZ7FU4AT.js +0 -2
  152. package/dist/task-KFND4HLF.js +0 -3
  153. package/dist/task-loader-HBZ3KRH2.js +0 -2
  154. package/dist/task-loader-IO4UVFUD.js +0 -2
  155. package/dist/task-settlement-NF7PFSNE.js +0 -3
  156. package/dist/task-settlement-TATNPY6L.js +0 -3
  157. package/dist/team-6WNNLBAO.js +0 -2
  158. package/dist/tools-GDWT74O6.js +0 -2
  159. package/dist/tools-SDWAFQMQ.js +0 -142
  160. package/graph-ui/dist/assets/index-BlgXTl53.css +0 -1
  161. package/graph-ui/dist/assets/index-Bq5nXK8p.js +0 -63
  162. package/graph-ui/dist/index.html +0 -13
  163. package/lore-ui/dist/assets/index-C3EixkjW.css +0 -1
  164. package/lore-ui/dist/assets/index-DKhNxgtW.js +0 -56
  165. package/lore-ui/dist/index.html +0 -13
  166. package/platform-ui/dist/assets/CanvasSection-dFAthehN.js +0 -9
  167. package/platform-ui/dist/assets/CanvasSection-flMXU19z.css +0 -1
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import*as j from'fs';import*as z from'js-yaml';import {z as z$1}from'zod';import*as P from'path';import {glob}from'glob';var B=z$1.object({description:z$1.string(),type:z$1.string().optional(),parent:z$1.string().optional(),anchors:z$1.array(z$1.string()).optional(),tags:z$1.array(z$1.string()).optional(),endpoints:z$1.array(z$1.string()).optional(),tests:z$1.array(z$1.string()).optional(),rules:z$1.record(z$1.unknown()).optional(),aspects:z$1.array(z$1.string()).optional(),flows:z$1.array(z$1.string()).optional(),gates:z$1.array(z$1.string()).optional(),signals:z$1.array(z$1.string()).optional(),states:z$1.array(z$1.string()).optional(),components:z$1.array(z$1.string()).optional(),location:z$1.string().optional(),locations:z$1.array(z$1.string()).optional(),uses:z$1.array(z$1.string()).optional(),"used-by":z$1.array(z$1.string()).optional(),"used-for":z$1.array(z$1.string()).optional(),exports:z$1.array(z$1.string()).optional(),status:z$1.string().optional(),properties:z$1.record(z$1.unknown()).optional(),handles:z$1.array(z$1.string()).optional()}).passthrough(),Z=B.extend({id:z$1.string()}),Ce=z$1.object({description:z$1.string().optional(),category:z$1.string().optional(),severity:z$1.enum(["info","warn","error"]).optional(),emitters:z$1.array(z$1.string()).optional(),related:z$1.array(z$1.string()).optional(),data:z$1.record(z$1.unknown()).optional()}),Ae=z$1.union([Ce,z$1.string().transform(e=>({description:e}))]),je=z$1.object({from:z$1.string(),to:z$1.string(),type:z$1.string(),description:z$1.string().optional()}),Ie=z$1.union([je,z$1.string()]),De=z$1.object({component:z$1.string(),action:z$1.string(),description:z$1.string().optional()}),Q=z$1.union([De,z$1.string()]),Re=z$1.object({name:z$1.string(),description:z$1.string().optional(),steps:z$1.array(Q)}),Ee=z$1.object({description:z$1.string().optional(),gates:z$1.array(z$1.string()).optional(),signals:z$1.array(z$1.string()).optional(),components:z$1.array(z$1.string()).optional(),steps:z$1.array(Q).optional()}),Fe=z$1.object({description:z$1.string().optional(),requires:z$1.array(z$1.string()).optional(),keys:z$1.array(z$1.string()).optional(),signals:z$1.array(z$1.string()).optional()}),Oe=z$1.object({description:z$1.string().optional(),default:z$1.unknown().optional(),type:z$1.string().optional()}),Te=z$1.object({description:z$1.string().optional(),tags:z$1.array(z$1.string()).optional(),anchors:z$1.array(z$1.string()).optional(),"applies-to":z$1.array(z$1.string()).optional(),enforcement:z$1.string().optional()}),ze=z$1.object({target:z$1.string(),type:z$1.string(),path:z$1.string()}),Me=z$1.object({version:z$1.string().optional(),description:z$1.string().optional(),apiSpec:z$1.string().optional(),context:z$1.array(z$1.string()).optional(),rules:z$1.record(z$1.unknown()).optional(),features:z$1.union([z$1.array(Z),z$1.record(B)]).optional(),components:z$1.union([z$1.array(Z),z$1.record(B)]).optional(),gates:z$1.record(Fe).optional(),states:z$1.record(Oe).optional(),signals:z$1.record(Ae).optional(),aspects:z$1.record(Te).optional(),relationships:z$1.array(Ie).optional(),flows:z$1.union([z$1.array(Re),z$1.record(Ee)]).optional(),references:z$1.array(ze).optional()});function Le(e){let t=_e(e);return {data:t.data,errors:t.errors}}function _e(e){let t=[],o=[],s;try{s=j.readFileSync(e,"utf8");}catch(c){let f=`Cannot read file: ${c.message}`;return t.push(f),o.push({message:f,type:"file"}),{data:null,errors:t,detailedErrors:o,rawContent:void 0,isYamlValid:false}}let n=s.replace(/^([#~!$^][\w-]+):/gm,'"$1":').replace(/^(\s*-\s+)([!#][\w-]+)$/gm,'$1"$2"'),a=null;try{a=z.load(n);}catch(c){let f=c,p=f.mark?.line?f.mark.line+1:void 0,d=`YAML syntax error: ${f.reason||c.message}`;return t.push(`${d}${p?` (line ${p})`:""}`),o.push({message:d,line:p,type:"yaml"}),{data:null,errors:t,detailedErrors:o,rawContent:s,isYamlValid:false}}if(a==null)return {data:{},errors:[],detailedErrors:[],rawContent:s,isYamlValid:true};if(typeof a=="object"&&a!==null){let c=a,f={"#":"components",$:"flows","^":"gates","!":"signals","~":"aspects"};for(let p of Object.keys(c)){let d=p[0],g=f[d];if(!g||p.length<2)continue;let y=p.slice(1),$=c[p];if(typeof $!="object"||$===null)continue;let h=c[g]||{};g in c||(c[g]=h),y in h||(h[y]=$),delete c[p];}}let r=Me.safeParse(a);if(!r.success){for(let c of r.error.issues){let f=c.path.join("."),p=c.message;t.push(`Schema error at ${f||"/"}: ${p}`),o.push({message:p,path:f||"/",type:"schema"});}return {data:a,errors:t,detailedErrors:o,rawContent:s,isYamlValid:true}}return {data:r.data,errors:[],detailedErrors:[],rawContent:s,isYamlValid:true}}function T(e){return e?Array.isArray(e)?e.map(t=>[t.id,t]):Object.entries(e):[]}async function Ye(e){let t=P.resolve(e);return (await glob("**/.purpose",{cwd:t,absolute:true,ignore:["**/node_modules/**","**/dist/**","**/.git/**"]})).sort((s,n)=>{let a=s.split(P.sep).length,r=n.split(P.sep).length;return a-r})}async function ee(e){let t=await Ye(e),o=[];for(let s of t){let{data:n,errors:a}=Le(s);n&&(o.push({filePath:s,data:n}),a.length>0&&console.warn(`Warnings parsing ${s}:`,a));}return o}function te(e){let t=new Map;for(let{filePath:o,data:s}of e){let n=T(s.features);for(let[a,r]of n)t.set(a,{item:r,filePath:o});}return t}function oe(e){let t=new Map;for(let{filePath:o,data:s}of e){let n=T(s.components);for(let[a,r]of n)t.set(a,{item:r,filePath:o});}return t}function se(e){let t=new Map;for(let{filePath:o,data:s}of e)if(s.gates)for(let[n,a]of Object.entries(s.gates))t.set(n,{item:a,filePath:o});return t}function ne(e){let t=new Map;for(let{filePath:o,data:s}of e)if(s.states)for(let[n,a]of Object.entries(s.states))t.set(n,{item:a,filePath:o});return t}function re(e){let t=new Map;for(let{filePath:o,data:s}of e)if(s.flows)if(Array.isArray(s.flows))for(let n of s.flows)t.set(n.name,{item:{id:n.name,description:n.description,steps:n.steps},filePath:o});else for(let[n,a]of Object.entries(s.flows))t.set(n,{item:{id:n,description:a.description,gates:a.gates,signals:a.signals,components:a.components,steps:a.steps},filePath:o});return t}function ae(e){let t=new Map;for(let{filePath:o,data:s}of e)if(s.signals)for(let[n,a]of Object.entries(s.signals))t.set(n,{item:a,filePath:o});return t}function ie(e){let t=new Map;for(let{filePath:o,data:s}of e)if(s.aspects)for(let[n,a]of Object.entries(s.aspects))t.set(n,{item:a,filePath:o});return t}function ce(e){let t=[],o=new Set;for(let{filePath:s,data:n}of e){let a=T(n.features);for(let[c,f]of a)J(`#${c}`,f,s,t,o);let r=T(n.components);for(let[c,f]of r)J(`#${c}`,f,s,t,o);}return t}function J(e,t,o,s,n){if(t.flows)for(let a of t.flows){let r=a.startsWith("$")?a:`$${a}`;n.has(r)||(n.add(r),s.push({symbol:r,type:"flow",sourceSymbol:e,filePath:o}));}if(t.gates)for(let a of t.gates){let r=a.startsWith("^")?a:`^${a}`;n.has(r)||(n.add(r),s.push({symbol:r,type:"gate",sourceSymbol:e,filePath:o}));}if(t.signals)for(let a of t.signals){let r=a.startsWith("!")?a:`!${a}`;n.has(r)||(n.add(r),s.push({symbol:r,type:"signal",sourceSymbol:e,filePath:o}));}if(t.states)for(let a of t.states){let r=a.startsWith("#")?a:a.startsWith("%")?`#${a.slice(1)}`:`#${a}`;n.has(r)||(n.add(r),s.push({symbol:r,type:"component",sourceSymbol:e,filePath:o}));}if(t.components)for(let a of t.components){let r=a.startsWith("#")?a:`#${a}`;n.has(r)||(n.add(r),s.push({symbol:r,type:"component",sourceSymbol:e,filePath:o}));}if(t.aspects)for(let a of t.aspects){let r=a.startsWith("~")?a:`~${a}`;n.has(r)||(n.add(r),s.push({symbol:r,type:"aspect",sourceSymbol:e,filePath:o}));}if(t.description){let a=We(t.description);for(let{symbol:r,type:c}of a)n.has(r)||(n.add(r),s.push({symbol:r,type:c,sourceSymbol:e,filePath:o}));}}var Ne=new Set(["$lib","$env","$app","$service-worker","$virtual","$schema","$ref","$id","$type"]);function We(e){let t=[],o=/([$^!#~%])([a-zA-Z][a-zA-Z0-9._-]*)/g,s;for(;(s=o.exec(e))!==null;){let n=s[1],a=s[2],r,c;switch(n){case "#":c="component",r=`#${a}`;break;case "$":c="flow",r=`$${a}`;break;case "^":c="gate",r=`^${a}`;break;case "!":c="signal",r=`!${a}`;break;case "~":c="aspect",r=`~${a}`;break;case "%":c="component",r=`#${a}`;break;default:continue}Ne.has(r)||t.push({symbol:r,type:c});}return t}var Be={visualizerPort:42195,watcherPort:42196,autoConnect:true};async function M(e){let t=P.resolve(e),o=P.dirname(t);if(!j.existsSync(t))throw new Error(`Gate config not found: ${t}`);let s=j.readFileSync(t,"utf8"),n=z.load(s);if(!n.version)throw new Error('Gate config missing required "version" field');let a=[],r=n,c=n.gates||r.portals;if(c)for(let[p,d]of Object.entries(c)){let g=p.startsWith("^")?p.slice(1):p;a.push(K(g,d));}if(n.include)for(let p of n.include){let d=P.join(o,p),g=await glob(d.replace(/\\/g,"/"));for(let y of g){let $=await Ve(y);a.push(...$);}}let f=[];if(n.flows)for(let[p,d]of Object.entries(n.flows))f.push(qe(p,d));return {version:n.version,gates:a,flows:f,settings:{dev:{...Be,...n.settings?.dev}}}}async function Ve(e){let t=j.readFileSync(e,"utf8"),o=z.load(t);if(o.id){let s=o.id,n=s.startsWith("^")?s.slice(1):s;return [K(n,o)]}if(o.gates){let s=[];for(let[n,a]of Object.entries(o.gates)){let r=n.startsWith("^")?n.slice(1):n;s.push(K(r,a));}return s}return []}function K(e,t){let o=[];if(t.locks)for(let n of t.locks)o.push(Ke(n));let s=[];if(t.prizes)for(let n of t.prizes)s.push(Ue(n));return {id:e,description:t.description,locks:o,prizes:s,position:t.position}}function Ke(e){let t=e,o=[];if(t.keys){for(let s of t.keys)if(typeof s=="string")o.push({expression:s});else if(s.expression){let n=s;o.push({expression:n.expression,description:n.description});}}return {id:t.id,description:t.description,keys:o,mode:t.mode||"all"}}function Ue(e){let t=e;return {id:t.id,oneTime:t.oneTime??false,metadata:t.metadata}}function qe(e,t){return {id:e,description:t.description,gates:t.gates||[],forkable:t.forkable}}async function pe(e){let t=P.resolve(e);return await glob("**/portal.yaml",{cwd:t,absolute:true,ignore:["**/node_modules/**","**/dist/**","**/.git/**"]})}var Ze={component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"},Je={"#":"component",$:"flow","^":"gate","!":"signal","~":"aspect"},He=["#","$","^","!","~"];function Qe(e){return He.includes(e)}var et=z$1.object({x:z$1.number(),y:z$1.number()}),tt=z$1.object({x:z$1.number(),y:z$1.number(),zoom:z$1.number()}),le=z$1.object({path:z$1.string(),include:z$1.array(z$1.string()).optional(),exclude:z$1.array(z$1.string()).optional()}),he=z$1.object({id:z$1.string(),symbol:z$1.string(),type:z$1.enum(["feature","component","flow","state","aspect","gate","signal","idea"]),content:z$1.string().optional(),position:et,tags:z$1.array(z$1.string()).optional(),created:z$1.string(),modified:z$1.string().optional()}),ye=z$1.object({from:z$1.string(),to:z$1.string(),label:z$1.string().optional(),type:z$1.string().optional()}),ot=z$1.object({id:z$1.string(),name:z$1.string(),nodes:z$1.array(z$1.string()),color:z$1.string().optional()}),we=z$1.object({viewport:tt,groups:z$1.array(ot).optional()}),st=z$1.object({nodes:z$1.array(he),connections:z$1.array(ye),layout:we}),nt=z$1.object({id:z$1.string(),name:z$1.string(),timestamp:z$1.string(),description:z$1.string().optional(),state:st}),rt=z$1.object({version:z$1.string(),metadata:z$1.object({name:z$1.string(),created:z$1.string(),modified:z$1.string()}),sources:z$1.object({purpose:z$1.array(le).optional(),portal:z$1.array(le).optional()}),nodes:z$1.array(he),connections:z$1.array(ye),layout:we,snapshots:z$1.array(nt).optional()});function Wt(e){let t=[],o;try{o=j.readFileSync(e,"utf8");}catch(s){return t.push(`Cannot read file: ${s.message}`),{data:null,errors:t,rawContent:void 0}}return at(o)}function at(e){let t=[],o=null;try{o=z.load(e);}catch(n){let a=n,r=a.mark?.line?a.mark.line+1:void 0;return t.push(`YAML syntax error: ${a.reason||n.message}${r?` (line ${r})`:""}`),{data:null,errors:t,rawContent:e}}if(o==null)return {data:$e(),errors:[],rawContent:e};let s=rt.safeParse(o);if(!s.success){for(let n of s.error.issues){let a=n.path.join(".");t.push(`Schema error at ${a||"/"}: ${n.message}`);}return {data:o,errors:t,rawContent:e}}return {data:s.data,errors:[],rawContent:e}}function $e(e="Untitled"){let t=new Date().toISOString();return {version:"1.0.0",metadata:{name:e,created:t,modified:t},sources:{purpose:[{path:"./"}],portal:[{path:"./portal.yaml"}]},nodes:[],connections:[],layout:{viewport:{x:0,y:0,zoom:1}}}}function it(e){return e.metadata.modified=new Date().toISOString(),z.dump(e,{indent:2,lineWidth:-1,noRefs:true,sortKeys:false})}function Bt(e="My Project"){return it($e(e))}function Vt(e,t){return {...e,nodes:[...e.nodes,t],metadata:{...e.metadata,modified:new Date().toISOString()}}}function Kt(e,t,o){return {...e,nodes:e.nodes.map(s=>s.id===t?{...s,position:o,modified:new Date().toISOString()}:s),metadata:{...e.metadata,modified:new Date().toISOString()}}}function Ut(e,t){return e.connections.some(s=>s.from===t.from&&s.to===t.to)?e:{...e,connections:[...e.connections,t],metadata:{...e.metadata,modified:new Date().toISOString()}}}function qt(e,t,o){let s={id:`snap-${Date.now()}`,name:t,timestamp:new Date().toISOString(),description:o,state:{nodes:[...e.nodes],connections:[...e.connections],layout:{...e.layout}}};return {...e,snapshots:[...e.snapshots||[],s],metadata:{...e.metadata,modified:new Date().toISOString()}}}async function ct(e,t){let o=[],s=[],n=[],a=[];if(e.sources.purpose)for(let f of e.sources.purpose){let p=P.resolve(t,f.path);try{let d=await ee(p);n.push(...d.map(u=>u.filePath));let g=te(d);for(let[u,{item:m,filePath:b}]of g){let E=["feature",...m.tags||[]];o.push(S({id:`purpose-feature-${u}`,symbol:`#${u}`,type:"component",source:"purpose",filePath:b,data:m,description:m.description,tags:E,componentType:m.type,parentSymbol:m.parent,anchors:m.anchors?.map(ke=>U(ke))}));}let y=oe(d);for(let[u,{item:m,filePath:b}]of y)o.push(S({id:`purpose-component-${u}`,symbol:`#${u}`,type:"component",source:"purpose",filePath:b,data:m,description:m.description,tags:m.tags,componentType:m.type,parentSymbol:m.parent,anchors:m.anchors?.map(E=>U(E))}));let $=se(d);for(let[u,{item:m,filePath:b}]of $)o.push(S({id:`purpose-gate-${u}`,symbol:`^${u}`,type:"gate",source:"purpose",filePath:b,data:m,description:m.description}));let h=ne(d);for(let[u,{item:m,filePath:b}]of h)o.push(S({id:`purpose-state-${u}`,symbol:`#${u}`,type:"component",source:"purpose",filePath:b,data:m,description:m.description,tags:["state"]}));let w=re(d);for(let[u,{item:m,filePath:b}]of w)o.push(S({id:`purpose-flow-${u}`,symbol:`$${u}`,type:"flow",source:"purpose",filePath:b,data:m,description:m.description}));let x=ae(d);for(let[u,{item:m,filePath:b}]of x)o.push(S({id:`purpose-signal-${u}`,symbol:`!${u}`,type:"signal",source:"purpose",filePath:b,data:m,description:m.description}));let R=ie(d);for(let[u,{item:m,filePath:b}]of R)o.push(S({id:`purpose-aspect-${u}`,symbol:`~${u}`,type:"aspect",source:"purpose",filePath:b,data:m,description:m.description,anchors:m.anchors?.map(E=>U(E)),appliesTo:m["applies-to"],tags:m.tags,enforcement:m.enforcement}));let W=ce(d),v=new Set(o.map(u=>u.symbol));for(let u of W)v.has(u.symbol)||(v.add(u.symbol),o.push(S({id:`purpose-ref-${u.type}-${u.symbol.slice(1)}`,symbol:u.symbol,type:u.type,source:"purpose",filePath:u.filePath,data:{referencedFrom:u.sourceSymbol},description:`Referenced from ${u.sourceSymbol}`})));}catch(d){s.push({source:"purpose",filePath:p,message:d.message});}}if(e.sources.portal)for(let f of e.sources.portal){let p=P.resolve(t,f.path);try{let d;if(p.endsWith(".yaml")||p.endsWith(".yml"))d=await M(p),a.push(p);else {let g=await pe(p);if(a.push(...g),g.length>0){d=await M(g[0]);for(let y=1;y<g.length;y++){let $=await M(g[y]);d.gates.push(...$.gates),d.flows.push(...$.flows);}}else continue}for(let g of d.gates){o.push(ft(g,p));for(let y of g.prizes)o.push(S({id:`gate-signal-${g.id}-${y.id}`,symbol:`!${y.id}`,type:"signal",source:"portal",filePath:p,data:y,description:`Signal from gate ${g.id}`}));}for(let g of d.flows)o.push(pt(g,p));}catch(d){s.push({source:"portal",filePath:p,message:d.message});}}for(let f of e.nodes){let p=f.tags?.includes("idea");if(!f.content&&!p){let d=o.find(g=>g.symbol===f.symbol);if(d){d.position=f.position,d.tags=f.tags;continue}}o.push(S({id:f.id,symbol:f.symbol,type:f.type,source:"premise",filePath:".premise",data:f,description:f.content,position:f.position,tags:f.tags,created:f.created,modified:f.modified}));}ut(o);let r=new Map;for(let f of o){let p=r.get(f.symbol)||[];p.includes(f.filePath)||p.push(f.filePath),r.set(f.symbol,p);}let c=[];for(let[f,p]of r)p.length>1&&c.push({symbol:f,files:p});return {symbols:o,purposeFiles:n,portalFiles:a,errors:s,timestamp:Date.now(),...c.length>0?{duplicateSymbols:c}:{}}}function S(e){return {...e,data:e.data??null,references:e.references??[],referencedBy:e.referencedBy??[]}}function ft(e,t){let o=e.id.startsWith("^")?e.id.slice(1):e.id;return S({id:`gate-${o}`,symbol:`^${o}`,type:"gate",source:"portal",filePath:t,data:e,description:e.description,position:e.position})}function pt(e,t){return S({id:`gate-flow-${e.id}`,symbol:`$${e.id}`,type:"flow",source:"portal",filePath:t,data:e,description:e.description})}function U(e){let t=e.lastIndexOf(":");if(t===-1||t===e.length-1)return {path:e,lines:0,raw:e};let o=e.slice(t+1),s=e.slice(0,t);if(!/^[\d,\- ]+$/.test(o))return {path:e,lines:0,raw:e};if(o.includes("-")){let[n,a]=o.split("-").map(Number);return {path:s,lines:[n,a],raw:e}}else if(o.includes(",")){let n=o.split(",").map(Number);return {path:s,lines:n,raw:e}}else return {path:s,lines:Number(o),raw:e}}var lt=new Set(["$lib","$env","$app","$service-worker","$virtual","$schema","$ref","$id","$type"]);function ut(e){let t=new Map(e.map(o=>[o.symbol,o]));for(let o of e){let s=JSON.stringify(o.data),n=/(?:\?[@#$%~^!]|[@#$%~^!?])[a-zA-Z][\w-]*/g,a=(s.match(n)||[]).filter(r=>!lt.has(r));for(let r of a)if(r!==o.symbol&&t.has(r)){o.references.includes(r)||o.references.push(r);let c=t.get(r);c&&!c.referencedBy.includes(o.symbol)&&c.referencedBy.push(o.symbol);}}}async function dt(e){let t={metadata:{name:P.basename(e),created:new Date().toISOString(),modified:new Date().toISOString()},sources:{purpose:[{path:"./"}],portal:[{path:"./"}]},nodes:[]};return ct(t,e)}function mt(){return {entries:new Map,byType:new Map,bySource:new Map,timestamp:0}}function gt(e){let t=mt();t.timestamp=e.timestamp;for(let o of e.symbols)t.entries.set(o.id,o),t.byType.has(o.type)||t.byType.set(o.type,[]),t.byType.get(o.type).push(o),t.bySource.has(o.source)||t.bySource.set(o.source,[]),t.bySource.get(o.source).push(o);return t}function C(e,t){for(let o of e.entries.values())if(o.symbol===t)return o}function Jt(e,t){return e.entries.get(t)}function I(e,t){return e.byType.get(t)||[]}function Ht(e,t){return e.bySource.get(t)||[]}function ht(e,t){let o=t.toLowerCase(),s=[];for(let n of e.entries.values()){if(n.symbol.toLowerCase().includes(o)){s.push(n);continue}if(n.description?.toLowerCase().includes(o)){s.push(n);continue}if(n.tags?.some(a=>a.toLowerCase().includes(o))){s.push(n);continue}if(n.componentType?.toLowerCase().includes(o)){s.push(n);continue}}return s}function Qt(e,t){return I(e,"component").filter(s=>s.componentType===t)}function eo(e){let t=new Set,o=I(e,"component");for(let s of o)s.componentType&&t.add(s.componentType);return Array.from(t).sort()}function to(e,t){return I(e,"component").filter(s=>s.parentSymbol===t)}function yt(e,t){let o=C(e,t);return o?o.referencedBy.map(s=>C(e,s)).filter(s=>s!==void 0):[]}function ue(e,t){let o=C(e,t);return o?o.references.map(s=>C(e,s)).filter(s=>s!==void 0):[]}function oo(e,t){let o=[];for(let s of e.entries.values())s.tags?.includes(t)&&o.push(s);return o}function so(e){let t=new Set;for(let o of e.entries.values())for(let s of o.tags||[])t.add(s);return Array.from(t).sort()}function no(e){let t={component:0,flow:0,gate:0,signal:0,aspect:0};for(let[o,s]of e.byType)o in t&&(t[o]=s.length);return t}function wt(e){return Array.from(e.entries.values())}function be(e){if(e.length<2)return null;let t=e[0],o=e.slice(1);return Qe(t)?{type:Je[t],name:o}:null}function ro(e,t){return `${Ze[e]}${t}`}function ao(e){return be(e)!==null}function io(e,t,o=10){let s=t.toLowerCase(),n=be(t);return n?I(e,n.type).filter(r=>r.symbol.toLowerCase().includes(s)).slice(0,o):ht(e,t).slice(0,o)}function $t(e,t,o){if(P.isAbsolute(e))return {resolvedPath:e,baseUsed:"absolute",exists:j.existsSync(e)};let s=P.join(o,e);if(j.existsSync(s))return {resolvedPath:s,baseUsed:"project-root",exists:true};let n=P.resolve(t,e);return j.existsSync(n)?{resolvedPath:n,baseUsed:"purpose-dir",exists:true}:{resolvedPath:s,baseUsed:"project-root",exists:false}}function co(e,t,o){if(P.isAbsolute(e)){let a=j.existsSync(e);return {rootResolves:a,purposeResolves:a,mismatch:false}}let s=j.existsSync(P.join(o,e)),n=j.existsSync(P.resolve(t,e));return {rootResolves:s,purposeResolves:n,mismatch:s!==n}}function bt(e,t){return e.includes("*")?new RegExp("^"+e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*")+"$").test(t):e===t}function fo(e,t,o){let s=[],n=I(e,"aspect"),a=new Set;for(let r of n){let c=r.appliesTo||[];if(c.length!==0)for(let f of c)for(let p of t){if(!bt(f,p))continue;let d=r.anchors||[];if(d.length===0){let g=`${r.symbol}::__no-anchors__`;a.has(g)||(a.add(g),s.push({aspectSymbol:r.symbol,anchorRaw:null,kind:"no-anchors"}));}else {let g=r.filePath?P.isAbsolute(r.filePath)?r.filePath:P.resolve(o,r.filePath):o,y=r.filePath?P.dirname(g):o;for(let $ of d){let h=`${r.symbol}::${$.raw}`;if(a.has(h))continue;$t($.path,y,o).exists||(a.add(h),s.push({aspectSymbol:r.symbol,anchorRaw:$.raw,kind:"missing-file"}));}}}}return s}var St=1,vt=3,q=8,xt=5,de={"#":"component",$:"flow","^":"gate","!":"signal","~":"aspect"},L={component:"component",flow:"flow",gate:"gate",signal:"signal",aspect:"aspect"};async function Pt(e){let t=await dt(e),o=gt(t),s=wt(o).map(r=>r.symbol),n=new Map,a=new Map;for(let r of I(o,"flow")){let c=r.data,f=c?.sequence||c?.gates||r.references;if(Array.isArray(f))for(let p of f)typeof p!="string"||!p||(n.has(p)||n.set(p,new Set),n.get(p).add(r.symbol),a.has(r.symbol)||a.set(r.symbol,new Set),a.get(r.symbol).add(p));}return {index:o,allSymbols:s,symbolFlows:n,flowMembers:a,generatedAt:new Date().toISOString()}}function kt(e,t){let o=Ct(t.radius),s=t.mode??"ego",n=jt(t.symbol,e),a={generatedAt:e.generatedAt,stale:false};if(!n||!C(e.index,n)){let h=Rt(t.symbol,e.allSymbols);return {root:t.symbol,freshness:a,nodes:[],edges:[],truncated:false,didYouMean:h}}let r=new Set([n]),c=new Set([n]),f=new Map,p=new Map,d=false,g=[n];for(let h=0;h<o;h++){let w=[];for(let x of g){let R=It(x,e,s),W=R.slice(0,q);if(R.length>q){d=true;let v=R.length-q,u=`${x}::+more`;c.add(u),f.set(`${x}|${u}|uses`,{source:x,target:u,kind:"uses"}),p.set(u,v);}for(let{target:v,kind:u}of W){let m=`${x}|${v}|${u}`;f.has(m)||f.set(m,{source:x,target:v,kind:u}),c.add(v),r.has(v)||(r.add(v),w.push(v));}}if(g=w,g.length===0)break}let y=[];for(let h of c){if(p.has(h)){y.push({id:h,kind:"component",label:`+${p.get(h)} more`});continue}let w=C(e.index,h),x=ve(h,w);y.push({id:h,kind:x,label:At(h,w),...w?.filePath?{path:w.filePath}:{}});}y.sort((h,w)=>h.id.localeCompare(w.id));let $=Array.from(f.values()).sort((h,w)=>h.source!==w.source?h.source.localeCompare(w.source):h.target!==w.target?h.target.localeCompare(w.target):h.kind.localeCompare(w.kind));return {root:n,freshness:a,nodes:y,edges:$,truncated:d}}async function po(e,t){let o=await Pt(e);return kt(o,t)}function lo(e){let t=["graph LR"],o=new Map,s=0;for(let n of e.nodes){let a=`n${s++}`;o.set(n.id,a);let r=Ft(n.kind,n.id,n.label);t.push(` ${a}${r}`);}for(let n of e.edges){let a=o.get(n.source),r=o.get(n.target);!a||!r||t.push(` ${a} -->|${n.kind}| ${r}`);}return t.join(`
3
+ `)}function Ct(e){let t=typeof e=="number"&&!Number.isNaN(e)?Math.floor(e):St;return Math.min(Math.max(t,1),vt)}function _(e){return e.replace(/^[#$^!~@%?&]{1,2}/,"")}function Se(e){let t=/^[#$^!~]/.exec(e);return t?t[0]:""}function ve(e,t){if(t?.type&&L[t.type])return L[t.type];let o=Se(e);return o&&de[o]?de[o]:"component"}function At(e,t){return t?.data?.name||_(e)}function jt(e,t){if(!e)return null;if(C(t.index,e))return e;let o=_(e);for(let s of ["#","$","$$","^","!","~"]){let n=`${s}${o}`;if(C(t.index,n))return n}return null}function It(e,t,o){let s=new Map,n=(r,c)=>{!r||r===e||s.set(`${r}|${c}`,{target:r,kind:c});};if(o==="ego"||o==="ripple"){for(let r of ue(t.index,e))n(r.symbol,Dt(r));for(let r of yt(t.index,e))X(r)==="flow"&&(t.symbolFlows.get(e)?.has(r.symbol)??false)?n(r.symbol,"in-flow"):n(r.symbol,"used-by");}else for(let r of ue(t.index,e))X(r)==="flow"&&n(r.symbol,"in-flow");for(let r of t.symbolFlows.get(e)||[])n(r,"in-flow");if(o==="flow")for(let r of t.symbolFlows.get(e)||[])for(let c of t.flowMembers.get(r)||[])n(c,"uses");return Array.from(s.values()).sort((r,c)=>r.target!==c.target?r.target.localeCompare(c.target):r.kind.localeCompare(c.kind))}function X(e){return e.type&&L[e.type]?L[e.type]:ve(e.symbol)}function Dt(e){let t=X(e);return t==="gate"?"gated-by":t==="flow"?"in-flow":"uses"}function Rt(e,t){let o=_(e).toLowerCase(),s=[];for(let n of t){let a=_(n).toLowerCase();if(a===o){s.push({sym:n,dist:0});continue}if(a.includes(o)||o.includes(a)){s.push({sym:n,dist:1});continue}let r=Et(o,a);r<=4&&s.push({sym:n,dist:r});}return s.sort((n,a)=>n.dist!==a.dist?n.dist-a.dist:n.sym.localeCompare(a.sym)),s.slice(0,xt).map(n=>n.sym)}function Et(e,t){let o=e.length,s=t.length;if(o===0)return s;if(s===0)return o;let n=new Array(s+1),a=new Array(s+1);for(let r=0;r<=s;r++)n[r]=r;for(let r=1;r<=o;r++){a[0]=r;for(let c=1;c<=s;c++){let f=e[r-1]===t[c-1]?0:1;a[c]=Math.min(n[c]+1,a[c-1]+1,n[c-1]+f);}[n,a]=[a,n];}return n[s]}function Ft(e,t,o){let s=Ot(`${Se(t)||""}${o}`);switch(e){case "flow":return `([${s}])`;case "gate":return `{{${s}}}`;case "signal":return `[/${s}/]`;case "aspect":return `[[${s}]]`;default:return `(${s})`}}function Ot(e){return `"${e.replace(/"/g,"'")}"`}var xe=P.join(".paradigm","events"),Tt="classroom-certifications.jsonl",zt="field-failures.jsonl";function Pe(e){try{return j.existsSync(e)?j.readFileSync(e,"utf8").trim().split(`
4
+ `).filter(t=>t.trim()).map(t=>{try{return JSON.parse(t)}catch{return null}}).filter(t=>t!==null):[]}catch{return []}}function uo(e){return Pe(P.join(e,xe,Tt))}function mo(e){return Pe(P.join(e,xe,zt))}function me(e,t){return e>0?Number((t/e).toFixed(3)):null}function go(e){let t=0,o=0,s={};for(let n of e){let a=n.agent;if(!a)continue;let r=n.outcome==="overturned";if(!(r||n.outcome==="survived"))continue;let f=s[a]??{resolved:0,overturned:0,rate:null};f.resolved+=1,r&&(f.overturned+=1),s[a]=f,t+=1,r&&(o+=1);}for(let n of Object.keys(s)){let a=s[n];a.rate=me(a.resolved,a.overturned);}return {overall:me(t,o),perAgent:s}}export{Je as PREFIX_TO_TYPE,Ze as SYMBOL_PREFIXES,Ut as addConnection,Vt as addPremiseNode,dt as aggregateFromDirectory,ct as aggregateFromPremise,gt as buildSymbolIndex,fo as checkAspectAnchors,go as computeRepeatFailureRate,$e as createEmptyPremiseFile,qt as createSnapshot,mt as createSymbolIndex,ro as createSymbolString,co as detectAnchorBaseMismatch,eo as getAllComponentTypes,wt as getAllSymbols,so as getAllTags,io as getAutocompleteSuggestions,to as getChildComponents,Qt as getComponentsByType,Bt as getDefaultPremiseContent,ue as getReferencesFrom,yt as getReferencesTo,C as getSymbol,Jt as getSymbolById,no as getSymbolCounts,Ht as getSymbolsBySource,oo as getSymbolsByTag,I as getSymbolsByType,po as graphSliceFromRoot,ao as isValidSymbol,Pt as loadLiveGraph,at as parsePremiseContent,Wt as parsePremiseFile,be as parseSymbol,kt as projectGraphSlice,uo as readClassroomCertifications,mo as readFieldFailures,$t as resolveAnchorPath,ht as searchSymbols,it as serializePremiseFile,lo as sliceToMermaid,Kt as updateNodePosition};
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {a,d,e,f,g,b}from'./chunk-BFD3GFRK.js';import'./chunk-5TAVYPOV.js';import n from'chalk';import*as t from'fs';import*as o from'path';import {fileURLToPath}from'url';async function C(c){let s=process.cwd(),e=parseInt(c.port||"3850",10),p=c.open!==false;console.log(n.cyan(`
3
3
  Starting Paradigm Docs...
4
- `));try{let{startPlatformServer:i}=await import('./platform-server-FXF3XFHM.js');await i({projectDir:s,port:e,open:p,sections:["overview","docs"]}),console.log(n.green(` Docs running at ${n.bold(`http://localhost:${e}`)}`)),console.log(n.gray(` Press Ctrl+C to stop
4
+ `));try{let{startPlatformServer:i}=await import('./platform-server-AAEDDBS3.js');await i({projectDir:s,port:e,open:p,sections:["overview","docs"]}),console.log(n.green(` Docs running at ${n.bold(`http://localhost:${e}`)}`)),console.log(n.gray(` Press Ctrl+C to stop
5
5
  `)),await new Promise(()=>{});}catch(i){i.code==="EADDRINUSE"?(console.error(n.red(`
6
6
  Error: Port ${e} is already in use.`)),console.log(n.gray(` Try: paradigm docs serve --port ${e+1}
7
7
  `))):console.error(n.red(`
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export{a as doctorCommand}from'./chunk-54C2PETP.js';import'./chunk-WR6D3SC6.js';import'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import'./chunk-YNDPSWOE.js';import'./chunk-VIG5LSGZ.js';import'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import {a as a$1}from'./chunk-RPGSQQTS.js';import {a}from'./chunk-NFN5UUJB.js';import {b,a as a$2}from'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';import {execFileSync}from'child_process';b();var y="gh";function p(o){let e=o.match(/^([^/\s]+\/[^/#\s]+)#\d+$/);if(e)return e[1];let s=o.match(/github\.com\/([^/]+\/[^/]+)\/issues\/\d+/);if(s)return s[1]}function v(o){let e=o.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);return e?`${e[1]}#${e[2]}`:void 0}function d(o){let e=o.match(/#(\d+)$/)||o.match(/\/issues\/(\d+)/);return e?e[1]:o}var m=class{id="github";repo;run;constructor(e={}){this.repo=e.repo,this.run=e.run??(s=>execFileSync(y,s,{encoding:"utf8",timeout:2e4}));}capabilities(){return {push:true,comment:true,pull:true,close:true}}async isAvailable(){try{return this.run(["auth","status"]),!0}catch{return false}}async push(e){let s=this.resolveRepo(e),t=this.renderBody(e),r=a$1(e.claimant),n=["issue","create","--title",e.blurb,"--body",t];s&&n.push("--repo",s),r.assignee&&n.push("--assignee","@me");let a=this.run(n).trim(),l=a.split(`
3
+ `).map(i=>i.trim()).find(i=>/github\.com\//.test(i)),c=l?v(l):void 0;if(!c)throw a$2.component("#github-provider").warn("Could not parse issue ref from gh output",{stdout:a}),new Error(`gh issue create did not return a parseable issue URL: ${a||"(empty)"}`);return a$2.component("#github-provider").info("Pushed task to GitHub",{taskId:e.id,ref:c}),{ref:c,url:l}}async comment(e,s){let t=p(e.ref)??this.repo,r=["issue","comment",d(e.ref),"--body",s];t&&r.push("--repo",t),this.run(r),a$2.component("#github-provider").info("Commented on GitHub issue",{ref:e.ref});}async close(e,s="completed"){let t=p(e.ref)??this.repo,r=["issue","close",d(e.ref),"--reason",s];t&&r.push("--repo",t),this.run(r),a$2.component("#github-provider").info("Closed GitHub issue",{ref:e.ref,reason:s});}async reopen(e){let s=p(e.ref)??this.repo,t=["issue","reopen",d(e.ref)];s&&t.push("--repo",s),this.run(t),a$2.component("#github-provider").info("Reopened GitHub issue",{ref:e.ref});}async edit(e,s){let t=p(e.ref)??this.repo,r=["issue","edit",d(e.ref)];for(let n of s.addLabels??[])r.push("--add-label",n);for(let n of s.removeLabels??[])r.push("--remove-label",n);s.addAssignee&&r.push("--add-assignee",s.addAssignee),r.length!==3&&(t&&r.push("--repo",t),this.run(r));}async pull(e){let s=p(e.ref)??this.repo,t=["issue","view",d(e.ref),"--json","state,stateReason,assignees,labels,title,url"];s&&t.push("--repo",s);let r=this.run(t),n=JSON.parse(r),a=(n.state||"").toUpperCase()==="CLOSED"?"closed":"open",l=(n.stateReason||"").toUpperCase();return {status:a,closedReason:a==="closed"?l==="NOT_PLANNED"?"not-planned":"completed":void 0,assignees:(n.assignees??[]).map(i=>i.login).filter(i=>!!i),labels:(n.labels??[]).map(i=>i.name).filter(i=>!!i),title:n.title,url:n.url}}resolveRepo(e){if(e.external_ref?.ref){let s=p(e.external_ref.ref);if(s)return s}return this.repo}renderBody(e){let s=[];return s.push(`Synced from Paradigm task \`${e.id}\`.`),s.push(""),e.claimant&&s.push(`Claimant: \`${e.claimant.kind}:${e.claimant.ref}\``),s.push(`Priority: ${e.priority}`),e.tags.length>0&&s.push(`Tags: ${e.tags.join(", ")}`),s.push(""),s.push("\u2014 Synced by Paradigm (two-way). Closing/reopening this issue flows back to the task on the next `paradigm task sync`."),s.join(`
4
+ `)}};a("github",()=>new m);export{m as GithubProvider};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {d,a as a$1,e,h,f,g,c,b as b$1}from'./chunk-WR6D3SC6.js';import {M as M$1,N}from'./chunk-JOHPASZG.js';import'./chunk-K6TLYNRQ.js';import'./chunk-ZJQY5PPP.js';import {a}from'./chunk-LKAT7IAK.js';import'./chunk-5TAVYPOV.js';var v=new Set(["mermaid","envelope","json"]),G=new Set(["ego","ripple","flow"]);async function L(e$1,i,r){let t=i||process.cwd(),c=r.radius?parseInt(r.radius,10):1,m=r.mode||"ego";r.mode&&!G.has(r.mode)&&(d(`Invalid mode: "${r.mode}". Expected: ego | ripple | flow`),process.exit(1)),r.format&&!v.has(r.format)&&(d(`Invalid format: "${r.format}". Expected: mermaid | envelope | json`),process.exit(1));let n;try{n=await M$1(t,{symbol:e$1,radius:c,mode:m});}catch(l){d(`Failed to project graph slice: ${l.message}`),process.exit(1);return}if(!(r.asLightbox||r.format)&&process.env.DEBUG&&a.component("graph-slice-command").info("Projected graph slice",{symbol:e$1,radius:c,mode:m,nodes:n.nodes.length,edges:n.edges.length,truncated:n.truncated}),n.didYouMean){if(d(`Symbol not found: ${e$1}`),n.didYouMean.length>0){a$1(""),e(" Did you mean:");for(let l of n.didYouMean)a$1(" "+l);a$1("");}else e(" No similar symbols found. Run `paradigm scan` to (re)build the index.");process.exit(1);return}let g=r.format;if(r.asLightbox||g==="envelope"){a$1(b(n));return}if(g==="mermaid"){a$1(M(n));return}if(g==="json"){h(n);return}w(n,m,c);}function M(e){return "```mermaid\n"+N(e)+"\n```"}function b(e){let i={id:`graph-${e.root.replace(/^[#$^!~]/,"")}`,kind:"graph",title:`Graph slice: ${e.root}`,payload:e};return "```conductor-visual\n"+JSON.stringify(i,null,2)+"\n```"}function w(e$1,i,r){f(`Graph slice \u2014 ${e$1.root}`),g("mode",i),g("radius",String(r)),g("nodes",String(e$1.nodes.length)),g("edges",String(e$1.edges.length)),g("generated",e$1.freshness.generatedAt||"unknown"),e$1.freshness.stale&&c(" scan-index is STALE \u2014 a .purpose is newer than the index. Run `paradigm scan`."),e$1.truncated&&c(" slice truncated \u2014 some nodes have >8 neighbors (collapsed to +N more)."),a$1(""),e(" Nodes:");for(let t of e$1.nodes)a$1(` ${t.id} ${E(t.kind)}`);a$1(""),e(" Edges:");for(let t of e$1.edges)a$1(` ${t.source} --(${t.kind})--> ${t.target}`);a$1(""),b$1(`Projected ${e$1.nodes.length} node(s), ${e$1.edges.length} edge(s).`),e(" Render: --format mermaid (cockpit/GitHub) | --as-lightbox (conductor-visual)");}function E(e){return `[${e}]`}export{L as graphSliceCommand};