@inkeep/open-knowledge 0.78.0-beta.4 → 0.78.0-beta.6

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 (146) hide show
  1. package/dist/assets/skills/project/SKILL.md +1 -1
  2. package/dist/assets/skills/project/references/linking.md +1 -0
  3. package/dist/cli.mjs +25 -25
  4. package/dist/constants-B5vbbQ59.mjs +1 -0
  5. package/dist/dist-DeGSxFUJ.mjs +2109 -0
  6. package/dist/{dist-H727Mac0.mjs → dist-DhGQyLku.mjs} +1 -1
  7. package/dist/index.d.mts +2 -0
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-UUEtW3_5.mjs +1 -0
  10. package/dist/{init-t5VRZLwD.mjs → init-__dFxXcd.mjs} +6 -6
  11. package/dist/{launch-json-removal-Dj_gH_Rq.mjs → launch-json-removal-D-bsUXkT.mjs} +1 -1
  12. package/dist/loader-BI5MbK2x.mjs +1 -0
  13. package/dist/{loader-BJBEDxPY.mjs → loader-Dbk8NaZV.mjs} +1 -1
  14. package/dist/{md-manager-BGnqyqi1-XuN_2HH6.mjs → md-manager-BGnqyqi1-CTvRTh-G.mjs} +155 -155
  15. package/dist/{open-browser-BnVmN9HA.mjs → open-browser-DB4_oZoA.mjs} +1 -1
  16. package/dist/parse-worker.mjs +1 -1
  17. package/dist/preview-DAraVn8e.mjs +1 -0
  18. package/dist/{preview-IjtgcT3j.mjs → preview-YKuXh9c-.mjs} +1 -1
  19. package/dist/public/assets/{ActivityModeContent-C0ggUUwf.js → ActivityModeContent-2otPjTz0.js} +1 -1
  20. package/dist/public/assets/AddPropertiesButton-z6PEwIQs.js +2 -0
  21. package/dist/public/assets/{AgentDiffPane-CwIvZ2u0.js → AgentDiffPane-BtmZfqMO.js} +1 -1
  22. package/dist/public/assets/{AgentIconCluster-D4c5FBAw.js → AgentIconCluster-DcoteycJ.js} +1 -1
  23. package/dist/public/assets/{AgentThreadClientBinder-B_EgL186.js → AgentThreadClientBinder-spIm7YG2.js} +1 -1
  24. package/dist/public/assets/{BugReportHistory-fO3bN8lg.js → BugReportHistory-IV-7NiFn.js} +1 -1
  25. package/dist/public/assets/{BugReportHistoryDialog-JJhcauNP.js → BugReportHistoryDialog-CCtxqoW-.js} +1 -1
  26. package/dist/public/assets/CodeMirrorPropInput-CUaf0ERc.js +3 -0
  27. package/dist/public/assets/{ConsentDialogBody-BqIjS2gR.js → ConsentDialogBody-D5LrKSjM.js} +1 -1
  28. package/dist/public/assets/{DeleteConfirmationDialog-MTriAXRX.js → DeleteConfirmationDialog-B2-SwXRR.js} +1 -1
  29. package/dist/public/assets/{DiffViewBoundary-CvmixHlE.js → DiffViewBoundary-BKTRwr-q.js} +1 -1
  30. package/dist/public/assets/DocumentContext-qmBJKxx1.js +39 -0
  31. package/dist/public/assets/{EditorModeToggle-KkeyqUiS.js → EditorModeToggle-DIsED8Ee.js} +1 -1
  32. package/dist/public/assets/{EnableSyncConfirmDialog-B1jUtYf0.js → EnableSyncConfirmDialog-ClgOSs_Y.js} +1 -1
  33. package/dist/public/assets/{ExcalidrawDocEditor-CWEkU2Is.js → ExcalidrawDocEditor-uHpy0AAc.js} +1 -1
  34. package/dist/public/assets/FeedbackForm-DBF-rKSz.js +1 -0
  35. package/dist/public/assets/{GraphPanel-D5xZaXcb.js → GraphPanel-CZnzR4jC.js} +2 -2
  36. package/dist/public/assets/{ImageAttachments-_-DakRUS.js → ImageAttachments-CWuAmsog.js} +1 -1
  37. package/dist/public/assets/{ImportSkillDialog-1JqeHG2e.js → ImportSkillDialog-CU7iB5L6.js} +1 -1
  38. package/dist/public/assets/{LintConfigEditor-BrzBuNZO.js → LintConfigEditor-B0dzhCuG.js} +1 -1
  39. package/dist/public/assets/{ManagedArtifactProperties-BC8n8Uux.js → ManagedArtifactProperties-CtEUYI6Q.js} +1 -1
  40. package/dist/public/assets/ManagedArtifactProperties-sotU_Ocn.js +1 -0
  41. package/dist/public/assets/{MermaidDocEditor-Bcrx_8El.js → MermaidDocEditor-C7JqZR9B.js} +1 -1
  42. package/dist/public/assets/{OpenInAgentMenuItem-AxhfRLpc.js → OpenInAgentMenuItem-d6cTev6Q.js} +1 -1
  43. package/dist/public/assets/{PropertyDisplayRow-C--8-E2f.js → PropertyDisplayRow-CC5SBOVN.js} +1 -1
  44. package/dist/public/assets/{RegisteredAgentIcon-KQW6AEu6.js → RegisteredAgentIcon-CT5gi4vr.js} +1 -1
  45. package/dist/public/assets/{ReportBugDialogBody-DX1dP7wO.js → ReportBugDialogBody-By2RAlz4.js} +2 -2
  46. package/dist/public/assets/{ReportBugMenuTrigger-CfFeITtu.js → ReportBugMenuTrigger-B6aEgC78.js} +2 -2
  47. package/dist/public/assets/{SchemaConfigEditor-D4GFyhNn.js → SchemaConfigEditor-7rsW6AqO.js} +1 -1
  48. package/dist/public/assets/SessionsHost-bNj6G9Pv.js +2 -0
  49. package/dist/public/assets/{SettingsDialogBody-CuLgDT7N.js → SettingsDialogBody-5-7DYVq5.js} +4 -4
  50. package/dist/public/assets/{ShareBranchSwitchDialog-Di1yYilr.js → ShareBranchSwitchDialog-B1KimRuC.js} +1 -1
  51. package/dist/public/assets/{ShareReceiveDialog-BKjgWKBF.js → ShareReceiveDialog-D5Bd6_Uw.js} +1 -1
  52. package/dist/public/assets/{ShareReceiveMissDialog-wjtra43z.js → ShareReceiveMissDialog-D3LovDQH.js} +1 -1
  53. package/dist/public/assets/{SkillCostValue-BjMa_RzW.js → SkillCostValue-DwP8X4M4.js} +1 -1
  54. package/dist/public/assets/{SkillEditBanner-BuxFwQVA.js → SkillEditBanner-_K6R6aVz.js} +1 -1
  55. package/dist/public/assets/{SkillForkDialog-DZeI1dUW.js → SkillForkDialog-BgexAeVj.js} +1 -1
  56. package/dist/public/assets/{SkillInstallMenu-cLslx-4M.js → SkillInstallMenu-DzL4PC8i.js} +1 -1
  57. package/dist/public/assets/{SkillOriginInline-ghHkXApt.js → SkillOriginInline-I_DytAON.js} +1 -1
  58. package/dist/public/assets/{SkillToolbarControls-Ci1FfVXC.js → SkillToolbarControls-Bb2vtxIa.js} +1 -1
  59. package/dist/public/assets/{SlidesToolbarControls-DgebeZ1o.js → SlidesToolbarControls-sqb30S3w.js} +1 -1
  60. package/dist/public/assets/{SourceEditor-BFdkSsY2.js → SourceEditor-DymwlqP8.js} +1 -1
  61. package/dist/public/assets/{TerminalPanel-Czcgr2ni.js → TerminalPanel-a9K3c36S.js} +3 -3
  62. package/dist/public/assets/{TerminalWindowApp-pNv7NtSU.js → TerminalWindowApp-Dvdpuwl2.js} +1 -1
  63. package/dist/public/assets/{TextDocEditor-mnFdtiZH.js → TextDocEditor-CWdJg5Pu.js} +1 -1
  64. package/dist/public/assets/ThreadView-CILl3ntk.js +21 -0
  65. package/dist/public/assets/{TimelineDiffPane-BAWK-Q5D.js → TimelineDiffPane-B8jS8gx3.js} +1 -1
  66. package/dist/public/assets/{agent-connection-status-BpmHdteI.js → agent-connection-status-LIP44ufg.js} +1 -1
  67. package/dist/public/assets/{auth-state-cache-CdB3wQ9D.js → auth-state-cache-QfPSJt_I.js} +4 -4
  68. package/dist/public/assets/{bug-report-send-manager-Bdl0o5Py.js → bug-report-send-manager-Bs5Fu1jl.js} +1 -1
  69. package/dist/public/assets/{client-version-Ca-8OF05.js → client-version-Sdq1bFlD.js} +1 -1
  70. package/dist/public/assets/{comment-chips-v9i2WFp7.js → comment-chips-DagTxmux.js} +1 -1
  71. package/dist/public/assets/{config-provider-BUgrvKtX.js → config-provider-Dr27QzBn.js} +2 -2
  72. package/dist/public/assets/{css-color-to-hex-CdrQ_PIL.js → css-color-to-hex-C4FHR9dx.js} +1 -1
  73. package/dist/public/assets/{diagnostic-breadcrumb-ZzsGTt1a.js → diagnostic-breadcrumb-CojycWig.js} +1 -1
  74. package/dist/public/assets/{dist-BBWka618.js → dist-DT6HE5IA.js} +195 -195
  75. package/dist/public/assets/{doc-paths-Cchodm9a.js → doc-paths-C7pk7I8D.js} +1 -1
  76. package/dist/public/assets/{doc-undo-manager-Bk_m4g6i.js → doc-undo-manager-BkyufL8p.js} +1 -1
  77. package/dist/public/assets/{documents-events-4ANG-YM5.js → documents-events-CnaHShEW.js} +1 -1
  78. package/dist/public/assets/{file-tree-adapter-DLjG7Vd1.js → file-tree-adapter-BGuWYLzM.js} +1 -1
  79. package/dist/public/assets/{file-tree-utils-xLkLWRXE.js → file-tree-utils-BgvBKCLs.js} +1 -1
  80. package/dist/public/assets/{folder-config-api-DicSUP85.js → folder-config-api-vyjLcdCA.js} +1 -1
  81. package/dist/public/assets/{index-BIWFUzVP.js → index-B3KSeJbY.js} +75 -75
  82. package/dist/public/assets/{lint-config-client-CnphqIMJ.js → lint-config-client-C3yOZHnO.js} +1 -1
  83. package/dist/public/assets/{markdownlint-rule-browser-Deli4eWi.js → markdownlint-rule-browser-CkE1p9lW.js} +1 -1
  84. package/dist/public/assets/navigation-targets-DiuADw5X.js +1 -0
  85. package/dist/public/assets/{page-list-cache-DzovwSp2.js → page-list-cache-DsEiE2Un.js} +1 -1
  86. package/dist/public/assets/{pending-receive-nav-store-CjPbRp3A.js → pending-receive-nav-store-Dcm8McA1.js} +1 -1
  87. package/dist/public/assets/{preferred-session-events-BRTAOH0T.js → preferred-session-events-DWc8Xjyi.js} +1 -1
  88. package/dist/public/assets/{progress-C8UCGQRe.js → progress-CJ4FRC5C.js} +3 -3
  89. package/dist/public/assets/{project-paths-C72_JOWy.js → project-paths-CBxhzjAo.js} +1 -1
  90. package/dist/public/assets/{prop-types-Dr9qeaU4.js → prop-types-CeNV_Lm8.js} +1 -1
  91. package/dist/public/assets/{receive-store-Dsik8VH_.js → receive-store-C7JHFqt7.js} +1 -1
  92. package/dist/public/assets/{selection-context-Cp2kc_W1.js → selection-context-C4yFDd-G.js} +1 -1
  93. package/dist/public/assets/{launch-agent-thread--2IQ94Jw.js → sign-in-terminal-events-DLcKlGJW.js} +1 -1
  94. package/dist/public/assets/{skill-scope-CDgG3_a5.js → skill-scope-53qgIrBi.js} +1 -1
  95. package/dist/public/assets/{skills-api-CpXGHi5r.js → skills-api-CG4bu_dq.js} +1 -1
  96. package/dist/public/assets/{src-CTXqiIaz.js → src-D7ecQKqz.js} +1 -1
  97. package/dist/public/assets/{startup-marks-CP0XYWYE.js → startup-marks-Du9Crw9t.js} +1 -1
  98. package/dist/public/assets/{tag-pill-input-Bs1Otf32.js → tag-pill-input-0bmnekZe.js} +1 -1
  99. package/dist/public/assets/{target-navigation-intent-BVmWK8dj.js → target-navigation-intent-DYQRxPvr.js} +1 -1
  100. package/dist/public/assets/{telemetry-startup-B5w9-Gaz.js → telemetry-startup-0nqSXEm2.js} +1 -1
  101. package/dist/public/assets/{terminal-command-events-B_odljGI.js → terminal-command-events-Bcf_LtH6.js} +1 -1
  102. package/dist/public/assets/{terminal-launch-events-CXy7fHCR.js → terminal-launch-events-hw0w9wbw.js} +1 -1
  103. package/dist/public/assets/{terminal-telemetry-GDbpPMTk.js → terminal-telemetry-DEVcyHvO.js} +1 -1
  104. package/dist/public/assets/thread-client-CvXILcIs.js +3 -0
  105. package/dist/public/assets/{typing-burst-detector-BFDczoXG.js → typing-burst-detector-bSQ8b587.js} +3 -3
  106. package/dist/public/assets/{uninstall-BcKDZGep.js → uninstall-BYIz77L2.js} +1 -1
  107. package/dist/public/assets/{use-activity-panel-BYLbiHM1.js → use-activity-panel-CCxIwVvo.js} +1 -1
  108. package/dist/public/assets/{use-apply-config-language-CcGDxTum.js → use-apply-config-language-DUnEKDIN.js} +1 -1
  109. package/dist/public/assets/{use-collab-url-BEoSkrry.js → use-collab-url-BBYolnNH.js} +1 -1
  110. package/dist/public/assets/{use-conflicts-N7mhpHgE.js → use-conflicts-CTT0fVBq.js} +1 -1
  111. package/dist/public/assets/{use-live-xterm-theme-BFttHtXj.js → use-live-xterm-theme-lf7zogfi.js} +1 -1
  112. package/dist/public/assets/{use-open-skill-xND65ZuD.js → use-open-skill-BD8zATG5.js} +1 -1
  113. package/dist/public/assets/{use-settings-route-Dq8G3ePM.js → use-settings-route-BdukeOHl.js} +1 -1
  114. package/dist/public/assets/{use-skill-origin-DuzlJQSS.js → use-skill-origin-D5GNh_Yy.js} +1 -1
  115. package/dist/public/assets/{use-skills-ComzVz7s.js → use-skills-6SOBj70E.js} +1 -1
  116. package/dist/public/assets/{use-terminal-enabled-DTm-rbQh.js → use-terminal-enabled-Bi7qjHzG.js} +1 -1
  117. package/dist/public/assets/use-timeline-entry-diff-D1u6nQ9x.js +5 -0
  118. package/dist/public/assets/{use-workspace-JzehlodO.js → use-workspace-BeJwTF-m.js} +1 -1
  119. package/dist/public/index.html +57 -57
  120. package/dist/public/uninstall.html +3 -3
  121. package/dist/{registry-probes-B_XMbPBP.mjs → registry-probes-BCPhKQte.mjs} +2 -2
  122. package/dist/{removal-file-path-VW4DROhD.mjs → removal-file-path-D8sfQtGu.mjs} +1 -1
  123. package/dist/{repair-launch-json-BX2PHTJQ.mjs → repair-launch-json-BMlAnEeM.mjs} +1 -1
  124. package/dist/{repair-mcp-configs-ChXyo2XV.mjs → repair-mcp-configs-DXFs_6us.mjs} +1 -1
  125. package/dist/{src-DmS8js9y.mjs → src-B8i0Z_NO.mjs} +4 -4
  126. package/dist/src-BSG5D3Tb.mjs +1 -0
  127. package/dist/start-CuAZYwLo.mjs +1 -0
  128. package/dist/{start-Djch7d7i.mjs → start-MMCeO0I3.mjs} +3 -3
  129. package/package.json +5 -5
  130. package/dist/constants-DJMEHHjq.mjs +0 -1
  131. package/dist/dist-D0NB38wf.mjs +0 -2109
  132. package/dist/init-NzXoC351.mjs +0 -1
  133. package/dist/loader-DwXDuEVO.mjs +0 -1
  134. package/dist/preview-BhHYpVzt.mjs +0 -1
  135. package/dist/public/assets/AddPropertiesButton-onYfQ085.js +0 -2
  136. package/dist/public/assets/CodeMirrorPropInput-BxpqNYRy.js +0 -3
  137. package/dist/public/assets/DocumentContext-D5M6KGbp.js +0 -39
  138. package/dist/public/assets/FeedbackForm-BD_Tnq8q.js +0 -1
  139. package/dist/public/assets/ManagedArtifactProperties-BjR__N-F.js +0 -1
  140. package/dist/public/assets/SessionsHost-Cekk7eEg.js +0 -2
  141. package/dist/public/assets/ThreadView-CeGUJ4X2.js +0 -21
  142. package/dist/public/assets/navigation-targets-CQRRzWZU.js +0 -1
  143. package/dist/public/assets/thread-client-Cpl5iQ-N.js +0 -3
  144. package/dist/public/assets/use-timeline-entry-diff-BSYk_tLD.js +0 -5
  145. package/dist/src-CGf4N1La.mjs +0 -1
  146. package/dist/start-C84VD82e.mjs +0 -1
@@ -1 +1 @@
1
- import{Fs as e,Go as t,Hl as n,Jn as r,No as i,Pa as a,Pd as o,gn as s,ru as c,xn as l,zt as u}from"./md-manager-BGnqyqi1-XuN_2HH6.mjs";import{$ as d,$a as f,$i as p,$n as m,$o as h,$r as g,$t as _,A as v,Aa as y,Ai as b,An as x,Ar as S,At as C,B as w,Ba as T,Bi as E,Bn as D,Br as O,Bt as k,C as A,Ca as j,Ci as M,Cn as N,Cr as P,Ct as F,D as I,Da as L,Di as R,Dn as z,Dr as B,Dt as V,E as H,Ea as U,Ei as W,En as G,Er as K,Et as q,F as J,Fa as Y,Fi as X,Fn as Z,Fr as Q,Ft as $,G as ee,Ga as te,Gi as ne,Gn as re,Gr as ie,Gt as ae,H as oe,Ha as se,Hi as ce,Hn as le,Ho as ue,Hr as de,Ht as fe,I as pe,Ia as me,Ii as he,In as ge,Ir as _e,It as ve,J as ye,Ja as be,Ji as xe,Jn as Se,Jo as Ce,Jr as we,Jt as Te,K as Ee,Ka as De,Ki as Oe,Kn as ke,Ko as Ae,Kr as je,Kt as Me,L as Ne,La as Pe,Li as Fe,Ln as Ie,Lr as Le,Lt as Re,M as ze,Ma as Be,Mi as Ve,Mn as He,Mr as Ue,Mt as We,N as Ge,Na as Ke,Ni as qe,Nn as Je,Nr as Ye,Nt as Xe,O as Ze,Oa as Qe,Oi as $e,On as et,Or as tt,Ot as nt,P as rt,Pa as it,Pi as at,Pn as ot,Pr as st,Pt as ct,Q as lt,Qa as ut,Qi as dt,Qn as ft,Qo as pt,Qr as mt,Qt as ht,R as gt,Ra as _t,Ri as vt,Rn as yt,Rr as bt,Rt as xt,S as St,Sa as Ct,Si as wt,Sn as Tt,Sr as Et,St as Dt,T as Ot,Ta as kt,Ti as At,Tn as jt,Tr as Mt,Tt as Nt,U as Pt,Ua as Ft,Ui as It,Un as Lt,Ur as Rt,Ut as zt,V as Bt,Va as Vt,Vi as Ht,Vn as Ut,Vo as Wt,Vr as Gt,Vt as Kt,W as qt,Wa as Jt,Wi as Yt,Wn as Xt,Wr as Zt,Wt as Qt,X as $t,Xa as en,Xi as tn,Xn as nn,Xo as rn,Xr as an,Xt as on,Y as sn,Ya as cn,Yi as ln,Yn as un,Yo as dn,Yr as fn,Yt as pn,Z as mn,Za as hn,Zi as gn,Zn as _n,Zo as vn,Zr as yn,Zt as bn,_ as xn,_a as Sn,_i as Cn,_n as wn,_o as Tn,_r as En,_t as Dn,a as On,aa as kn,ai as An,an as jn,ao as Mn,ar as Nn,at as Pn,b as Fn,ba as In,bi as Ln,bn as Rn,br as zn,bt as Bn,c as Vn,ca as Hn,ci as Un,cn as Wn,co as Gn,cr as Kn,ct as qn,d as Jn,da as Yn,di as Xn,dn as Zn,do as Qn,dr as $n,dt as er,ea as tr,ei as nr,en as rr,eo as ir,er as ar,es as or,et as sr,f as cr,fa as lr,fi as ur,fn as dr,fo as fr,fr as pr,ft as mr,g as hr,ga as gr,gi as _r,gn as vr,go as yr,gr as br,gt as xr,h as Sr,ha as Cr,hi as wr,hn as Tr,ho as Er,hr as Dr,ht as Or,i as kr,ia as Ar,ii as jr,in as Mr,io as Nr,ir as Pr,it as Fr,j as Ir,ja as Lr,ji as Rr,jn as zr,jr as Br,jt as Vr,k as Hr,ka as Ur,ki as Wr,kn as Gr,kr as Kr,kt as qr,l as Jr,la as Yr,li as Xr,ln as Zr,lo as Qr,lr as $r,lt as ei,m as ti,ma as ni,mi as ri,mn as ii,mo as ai,mr as oi,mt as si,n as ci,na as li,ni as ui,nn as di,no as fi,nr as pi,nt as mi,o as hi,oa as gi,oi as _i,on as vi,oo as yi,or as bi,ot as xi,p as Si,pa as Ci,pi as wi,pn as Ti,po as Ei,pr as Di,pt as Oi,q as ki,qa as Ai,qi as ji,qn as Mi,qo as Ni,qr as Pi,qt as Fi,r as Ii,ra as Li,ri as Ri,rn as zi,ro as Bi,rr as Vi,rt as Hi,s as Ui,sa as Wi,si as Gi,sn as Ki,so as qi,sr as Ji,st as Yi,t as Xi,ta as Zi,ti as Qi,tn as $i,to as ea,tr as ta,tt as na,u as ra,ua as ia,ui as aa,un as oa,uo as sa,ur as ca,ut as la,v as ua,va as da,vi as fa,vn as pa,vr as ma,vt as ha,w as ga,wa as _a,wi as va,wn as ya,wr as ba,wt as xa,x as Sa,xa as Ca,xi as wa,xn as Ta,xr as Ea,xt as Da,y as Oa,ya as ka,yi as Aa,yn as ja,yr as Ma,yt as Na,z as Pa,za as Fa,zi as Ia,zn as La,zr as Ra,zt as za}from"./dist-D0NB38wf.mjs";export{Xi as AGENT_ID_MAX_LEN,ci as AGENT_ID_RE,Ii as AGENT_WRITE_ORIGIN,kr as AcpPermissionStore,On as AcpRegistry,hi as AcpThreadManager,Ui as AgentFocusBroadcaster,Vn as AgentPresenceBroadcaster,Jr as AgentSessionCapacityError,ra as AgentSessionManager,Jn as AutoStartDisabledError,cr as BUNDLE_IDS,Si as BUNDLE_SCOPE,ti as BUNDLE_SKILL_NAME,Sr as BacklinkIndex,hr as CC1Broadcaster,n as CC1_CONTRACT_VERSION,xn as CONCURRENT_REPLACE_WINDOW_MS,ua as CONFIG_FILENAME,Oa as CONFLICT_MARKER_RE,Fn as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Sa as ConfigSchema,St as ConflictAuthority,A as DEFAULT_CHECKPOINT_RETENTION,ga as DEFAULT_EMBEDDINGS_DIMENSIONS,Ot as DEFAULT_PACK_ID,H as DocumentDurabilityState,I as DocumentDurabilityStateError,Ze as EMBEDDINGS_API_KEY_ENV,Hr as EPHEMERAL_PROJECT_DIR_PREFIX,v as ExposureConsentError,Ir as FEATURED_AGENT_IDS,ze as FILE_SYSTEM_WRITER,Ge as FILE_WATCHER_ORIGIN,rt as FileEmbeddingsBackend,J as GIT_PREFLIGHT_FAIL_SPAN_NAME,pe as GIT_UPSTREAM_WRITER,Wt as GitDirAccessError,Ne as GitNotAvailableError,gt as GitTooOldError,Pa as HOCUSPOCUS_AUTH_REJECTION_REASONS,w as HocuspocusAuthRejection,Bt as HocuspocusAuthTokenSchema,oe as HomeProjectRootError,Pt as INSTALLED_AGENTS_SCHEMES,qt as JSON_SCHEMA_DIALECT_2020_12,u as LINEAGE_EPOCH_KEY,ee as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Ee as MANAGED_RENAME_ORIGIN,ki as MAX_ACP_THREADS,ye as MAX_AGENT_SESSIONS,sn as MCP_CONNECTION_ID_HEADER,o as MCP_SERVER_NAME,$t as MIN_EVICTABLE_IDLE_MS,mn as MIN_GIT_VERSION,lt as MISSING_OK_CONFIG_MESSAGE,ue as MalformedGitPointerError,d as McpLogger,sr as MissingOkConfigError,na as OBSERVER_SYNC_ORIGIN,mi as OK_OKIGNORE_TEMPLATE,Hi as ONBOARDING_BUNDLE_IDS,s as ORPHAN_MODES,l as PROTOCOL_VERSION,Ae as PinoLogger,Fr as ProcessLockCollisionError,Pn as ProjectGitInitError,xi as ROLLBACK_ORIGIN,Yi as ROOT_GITIGNORE_TEMPLATE,qn as RUNTIME_VERSION,ei as SERVICE_WRITER,la as SKILL_INSTALL_EVENTS_FILE_REL,r as SKILL_STATE_TARGETS,er as STARTER_FOLDER_FRONTMATTER_FILENAME,mr as STARTER_PACKS,Oi as STARTER_PACK_IDS,si as STATE_MANIFEST_FILENAME,Or as STATE_SCHEMA_VERSION,c as SYSTEM_DOC_NAME,xr as SeedPrerequisiteError,Dn as SeedRootDirError,ha as ServerLockCollisionError,Na as SingleFileNotAFileError,Bn as SingleFileNotFoundError,Da as SingleFileNotMarkdownError,Dt as SingleFileProjectOverrideError,F as StateManifestError,xa as TagIndex,Nt as USER_GLOBAL_BUNDLE_IDS,q as __getShowAllWalkStatsForTesting,V as __resetShowAllWalkStatsForTesting,nt as acquireProcessLock,qr as acquireServerLock,C as applyAgentMarkdownWrite,Vr as applyExternalChange,We as applySeed,Xe as assertCompatibleStateManifest,ct as assertGitAvailable,$ as assertNeverDiskEvent,ve as assertNotHomeProjectRoot,Re as attachAcpThreadSocket,xt as attachCollabClientCounter,za as attachIdleShutdown,k as bindConflictAuthority,Kt as bootServer,fe as buildAndOpenSkill,zt as buildConfigYmlContent,Qt as buildExecResult,ae as buildIngressPolicy,Me as buildOkMcpStdioCommand,Fi as buildSkillZip,Te as buildStarterFolderFrontmatterYaml,pn as buildWipTree,on as bundleSkillMdPath,bn as canonicalProjectKey,ht as canonicalizeForCompare,_ as classifyEvents,rr as classifyFsPath,$i as clearAllEmbeddingsKeys,di as coercePackId,zi as collectServerHostSnapshot,a as colorFromSeed,Mr as commitUpstreamImport,jn as commitWip,vi as commitWipFromTree,Ki as compareSemver,Wn as composeEffectiveLinterConfig,Zr as composeFrontmatterSchemasConfig,oa as containsConflictMarkers,Zn as contentHash,dr as contributorCount,Ti as countShadowObjects,ii as countStaleAgentWipRefs,Tr as countWipRefs,vr as createApiExtension,wn as createAssetServeMiddleware,pa as createCollaborationHost,ja as createContentFilter,Rn as createContentFilterAsync,Ta as createEmbeddingsSecretStore,Tt as createEphemeralProjectDir,N as createExternalChangeHandler,ya as createFileLogger,jt as createLiveDerivedIndexExtension,G as createMcpHttpHandler,z as createOsProbe,et as createPersistenceExtension,Gr as createProbeFailureReporter,x as createServer,zr as createServerObserverExtension,He as createServerProbeResolver,Je as createStreamingErrorWriter,Ni as createTestLogger,ot as describeStoredEmbeddingsKey,Z as detectClaudeDesktopPresence,ge as detectGit,Ie as detectProjectShape,yt as detectUserSkillHosts,La as discoverLockDirs,D as discoverMarkdownlintConfig,Ut as emitPreflightFailureSpan,le as encodeDocName,Lt as encodeFolderRoute,Xt as encodeSkillRoute,re as ensureProjectGit,ke as errorResponse,Mi as evictStaleTrackerEntries,Se as extractHeadings,un as extractOkBinaryPath,nn as extractWikiLinksFromMarkdown,_n as fallbackPaths,ft as findEnclosingGitRoot,m as findEnclosingProjectRoot,ar as findNativeMarkdownlintFile,ta as flushFileLogger,pi as formatAuditBrokenLinkSuppressionLine,Vi as formatAuthRejectionWire,Pr as formatContributorsFrom,Nn as formatPackRationale,bi as gcCheckpointRefs,Ji as getCurrentMcpLogger,Kn as getIngressContext,$r as getLocalDir,ca as getLogFilePath,Ce as getLogger,$n as getLogsDir,pr as getMachineId,Di as getMeter,oi as getMetrics,Dr as getTracer,br as handleCollabSocketError,En as handleSpawnCursor,ma as hasForwardingHeaders,Ma as hasGcLogLatch,i as iconFromClientName,zn as incrementCollabSocketFilteredError,Ea as incrementServerObserverFire,Et as initContent,P as initShadowRepo,ba as initTelemetry,Mt as initToleranceTelemetryWriter,K as installJsonSchemaDialect,B as installPrettyZodErrors,dn as installTestLoggers,tt as installUserSkill,Kr as isAllowedApiOrigin,S as isAllowedWorkspaceHostHeader,Br as isConfigDoc,Ue as isDefunctProcess,Ye as isDocInConflict,st as isHocuspocusAuthRejectionReason,Q as isHomeDir,_e as isHostAdmitted,Le as isKnownPackId,bt as isLinkIndexExcludedDoc,Ra as isLockProcessRunning,O as isLoopbackAddress,Gt as isManagedArtifactDoc,de as isOriginAdmitted,t as isOrphanMode,Rt as isPairedWriteOrigin,Zt as isPathWithinDir,ie as isPeerAdmitted,je as isProcessAlive,Pi as isProjectRoot,we as isReservedForUserTree,fn as isSelfWrite,an as isSystemDoc,yn as isToleranceTelemetryEnabled,mt as isValidLockPid,g as lastKnownHash,nr as listRescueCheckpoints,Qi as listStarterPacks,ui as loadCustomAgents,Ri as loadPrincipal,jr as lockAdvertisesUi,An as lockBaseUrl,_i as lockFilePath,rn as loggerFactory,Gi as loginShapedUserinfoUser,vn as logsCurrentPath,pt as logsPreviousPath,Un as makeLazyEmbeddingsKeyStore,Xr as markServerLockDraining,aa as mountMcpAndApi,Xn as normalizeFsPath,ur as observeReadiness,wi as packageVersionMajorMinor,ri as parseAuthRejectionWire,wr as parseGitVersion,_r as parseHocuspocusAuthToken,Cn as parseKeepaliveConnectionId,fa as pathToDocName,Aa as planSeed,Ln as prepareSingleFileOpen,wa as processCommand,wt as processUsage,M as readAllTargets,va as readBundleDecision,At as readDeclaredGitHubHosts,W as readOriginGitHubRepo,R as readOwnNativeRules,$e as readProcessLock,Wr as readProcessLockDetailed,b as readProcessState,Rr as readProjectHeadState,Ve as readProjectLocalSemanticConfig,qe as readServerLock,at as readServerPackageVersion,X as readSkillInstallStateSnapshot,he as readStateManifest,Fe as readTargetRecordedAt,vt as readTargetVersion,Ia as reconcile,E as recordContributor,Ht as recordSkillInstallEvent,ce as redactShareSubprocessStderr,It as registerAllTools,Yt as registerWrite,ne as releaseProcessLock,Oe as releaseServerLock,ji as removeLastKnownHash,xe as removeProjectSkillGitignoreBlock,ln as reportSkillInstall,tn as resetMetrics,gn as resolveBuiltinSkillHosts,e as resolveBundleEnabled,dt as resolveBundledSkillDir,p as resolveContentDir,tr as resolveCursorBinaryDefault,Zi as resolveCursorSpawnInvocation,li as resolveEffectiveLinterConfig,Li as resolveEmbeddingsCredential,Ar as resolveGitHubAccountFromUrl,kn as resolveGitHubAuthHost,gi as resolveLockDir,Wi as resolveNativeConfigForDoc,Hn as resolveNativeMarkdownlintConfig,Yr as resolvePack,ia as resolvePackageVersion,Yn as resolveSkillInstallReportSettings,lr as resolveUiInfo,Ci as restoreContributors,ni as rewriteMarkdownLinksForDocumentRename,Cr as rewriteWikiLinksForDocumentRename,gr as runAuthReposSubprocess,Sn as runAuthStatusSubprocess,da as runCloneSubprocess,ka as runDeviceFlowSubprocess,In as runWithMcpLogger,Ca as safeContentPath,Ct as safeSubdir,j as safetyCheckpoint,_a as sameGitHubLogin,kt as sanitizeClientName,U as saveInMemoryCheckpoint,L as saveVersion,Qe as scanLockProcesses,Ur as seedBasenameIndex,y as seedEphemeralProjectDir,Lr as serializeError,Be as setActiveSpanAttributes,Ke as setupServerObservers,it as shadowGit,Y as shutdownTelemetry,h as spansCurrentPath,or as spansPreviousPath,me as spawnDetached,Pe as splitMarkdownBlocks,_t as startWatcher,Fa as strategiesFor,T as streamingProblemEvent,Vt as swapContributors,se as teardownToleranceTelemetryWriter,Ft as toBroadcasterKey,Jt as tracedAppendFileSync,te as tracedLinkSync,De as tracedMkdir,Ai as tracedMkdirSync,be as tracedRename,cn as tracedRenameSync,en as tracedRmSync,hn as tracedRmdirSync,ut as tracedUnlinkSync,f as tracedWriteFile,ir as tracedWriteFileSync,ea as trustSystemCertificates,fi as updateLastKnownHash,Bi as updateProcessLockPort,Nr as updateServerLockPort,Mn as validateAgentId,yi as validateCloneInputs,qi as validateSkillZip,Gn as waitForServerLockDrain,Qr as withHiddenWindowsConsole,sa as withSpan,Qn as withSpanSync,fr as writeBundleDecision,Ei as writeMarkdownlintRule,ai as writeRootGitignoreForNewRepo,Er as writeStateManifest,yr as writeTargetVersion,Tn as writeTracker};
1
+ import{Fd as e,Fs as t,Go as n,Hl as r,Jn as i,No as a,Pa as o,gn as s,ru as c,xn as l,zt as u}from"./md-manager-BGnqyqi1-CTvRTh-G.mjs";import{$ as d,$a as f,$i as p,$n as m,$o as h,$r as g,$t as _,A as v,Aa as y,Ai as b,An as x,Ar as S,At as C,B as w,Ba as T,Bi as E,Bn as D,Br as O,Bt as k,C as A,Ca as j,Ci as M,Cn as N,Cr as P,Ct as F,D as I,Da as L,Di as R,Dn as z,Dr as B,Dt as V,E as H,Ea as U,Ei as W,En as G,Er as K,Et as q,F as J,Fa as Y,Fi as X,Fn as Z,Fr as Q,Ft as $,G as ee,Ga as te,Gi as ne,Gn as re,Gr as ie,Gt as ae,H as oe,Ha as se,Hi as ce,Hn as le,Ho as ue,Hr as de,Ht as fe,I as pe,Ia as me,Ii as he,In as ge,Ir as _e,It as ve,J as ye,Ja as be,Ji as xe,Jn as Se,Jo as Ce,Jr as we,Jt as Te,K as Ee,Ka as De,Ki as Oe,Kn as ke,Ko as Ae,Kr as je,Kt as Me,L as Ne,La as Pe,Li as Fe,Ln as Ie,Lr as Le,Lt as Re,M as ze,Ma as Be,Mi as Ve,Mn as He,Mr as Ue,Mt as We,N as Ge,Na as Ke,Ni as qe,Nn as Je,Nr as Ye,Nt as Xe,O as Ze,Oa as Qe,Oi as $e,On as et,Or as tt,Ot as nt,P as rt,Pa as it,Pi as at,Pn as ot,Pr as st,Pt as ct,Q as lt,Qa as ut,Qi as dt,Qn as ft,Qo as pt,Qr as mt,Qt as ht,R as gt,Ra as _t,Ri as vt,Rn as yt,Rr as bt,Rt as xt,S as St,Sa as Ct,Si as wt,Sn as Tt,Sr as Et,St as Dt,T as Ot,Ta as kt,Ti as At,Tn as jt,Tr as Mt,Tt as Nt,U as Pt,Ua as Ft,Ui as It,Un as Lt,Ur as Rt,Ut as zt,V as Bt,Va as Vt,Vi as Ht,Vn as Ut,Vo as Wt,Vr as Gt,Vt as Kt,W as qt,Wa as Jt,Wi as Yt,Wn as Xt,Wr as Zt,Wt as Qt,X as $t,Xa as en,Xi as tn,Xn as nn,Xo as rn,Xr as an,Xt as on,Y as sn,Ya as cn,Yi as ln,Yn as un,Yo as dn,Yr as fn,Yt as pn,Z as mn,Za as hn,Zi as gn,Zn as _n,Zo as vn,Zr as yn,Zt as bn,_ as xn,_a as Sn,_i as Cn,_n as wn,_o as Tn,_r as En,_t as Dn,a as On,aa as kn,ai as An,an as jn,ao as Mn,ar as Nn,at as Pn,b as Fn,ba as In,bi as Ln,bn as Rn,br as zn,bt as Bn,c as Vn,ca as Hn,ci as Un,cn as Wn,co as Gn,cr as Kn,ct as qn,d as Jn,da as Yn,di as Xn,dn as Zn,do as Qn,dr as $n,dt as er,ea as tr,ei as nr,en as rr,eo as ir,er as ar,es as or,et as sr,f as cr,fa as lr,fi as ur,fn as dr,fo as fr,fr as pr,ft as mr,g as hr,ga as gr,gi as _r,gn as vr,go as yr,gr as br,gt as xr,h as Sr,ha as Cr,hi as wr,hn as Tr,ho as Er,hr as Dr,ht as Or,i as kr,ia as Ar,ii as jr,in as Mr,io as Nr,ir as Pr,it as Fr,j as Ir,ja as Lr,ji as Rr,jn as zr,jr as Br,jt as Vr,k as Hr,ka as Ur,ki as Wr,kn as Gr,kr as Kr,kt as qr,l as Jr,la as Yr,li as Xr,ln as Zr,lo as Qr,lr as $r,lt as ei,m as ti,ma as ni,mi as ri,mn as ii,mo as ai,mr as oi,mt as si,n as ci,na as li,ni as ui,nn as di,no as fi,nr as pi,nt as mi,o as hi,oa as gi,oi as _i,on as vi,oo as yi,or as bi,ot as xi,p as Si,pa as Ci,pi as wi,pn as Ti,po as Ei,pr as Di,pt as Oi,q as ki,qa as Ai,qi as ji,qn as Mi,qo as Ni,qr as Pi,qt as Fi,r as Ii,ra as Li,ri as Ri,rn as zi,ro as Bi,rr as Vi,rt as Hi,s as Ui,sa as Wi,si as Gi,sn as Ki,so as qi,sr as Ji,st as Yi,t as Xi,ta as Zi,ti as Qi,tn as $i,to as ea,tr as ta,tt as na,u as ra,ua as ia,ui as aa,un as oa,uo as sa,ur as ca,ut as la,v as ua,va as da,vi as fa,vn as pa,vr as ma,vt as ha,w as ga,wa as _a,wi as va,wn as ya,wr as ba,wt as xa,x as Sa,xa as Ca,xi as wa,xn as Ta,xr as Ea,xt as Da,y as Oa,ya as ka,yi as Aa,yn as ja,yr as Ma,yt as Na,z as Pa,za as Fa,zi as Ia,zn as La,zr as Ra,zt as za}from"./dist-DeGSxFUJ.mjs";export{Xi as AGENT_ID_MAX_LEN,ci as AGENT_ID_RE,Ii as AGENT_WRITE_ORIGIN,kr as AcpPermissionStore,On as AcpRegistry,hi as AcpThreadManager,Ui as AgentFocusBroadcaster,Vn as AgentPresenceBroadcaster,Jr as AgentSessionCapacityError,ra as AgentSessionManager,Jn as AutoStartDisabledError,cr as BUNDLE_IDS,Si as BUNDLE_SCOPE,ti as BUNDLE_SKILL_NAME,Sr as BacklinkIndex,hr as CC1Broadcaster,r as CC1_CONTRACT_VERSION,xn as CONCURRENT_REPLACE_WINDOW_MS,ua as CONFIG_FILENAME,Oa as CONFLICT_MARKER_RE,Fn as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Sa as ConfigSchema,St as ConflictAuthority,A as DEFAULT_CHECKPOINT_RETENTION,ga as DEFAULT_EMBEDDINGS_DIMENSIONS,Ot as DEFAULT_PACK_ID,H as DocumentDurabilityState,I as DocumentDurabilityStateError,Ze as EMBEDDINGS_API_KEY_ENV,Hr as EPHEMERAL_PROJECT_DIR_PREFIX,v as ExposureConsentError,Ir as FEATURED_AGENT_IDS,ze as FILE_SYSTEM_WRITER,Ge as FILE_WATCHER_ORIGIN,rt as FileEmbeddingsBackend,J as GIT_PREFLIGHT_FAIL_SPAN_NAME,pe as GIT_UPSTREAM_WRITER,Wt as GitDirAccessError,Ne as GitNotAvailableError,gt as GitTooOldError,Pa as HOCUSPOCUS_AUTH_REJECTION_REASONS,w as HocuspocusAuthRejection,Bt as HocuspocusAuthTokenSchema,oe as HomeProjectRootError,Pt as INSTALLED_AGENTS_SCHEMES,qt as JSON_SCHEMA_DIALECT_2020_12,u as LINEAGE_EPOCH_KEY,ee as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Ee as MANAGED_RENAME_ORIGIN,ki as MAX_ACP_THREADS,ye as MAX_AGENT_SESSIONS,sn as MCP_CONNECTION_ID_HEADER,e as MCP_SERVER_NAME,$t as MIN_EVICTABLE_IDLE_MS,mn as MIN_GIT_VERSION,lt as MISSING_OK_CONFIG_MESSAGE,ue as MalformedGitPointerError,d as McpLogger,sr as MissingOkConfigError,na as OBSERVER_SYNC_ORIGIN,mi as OK_OKIGNORE_TEMPLATE,Hi as ONBOARDING_BUNDLE_IDS,s as ORPHAN_MODES,l as PROTOCOL_VERSION,Ae as PinoLogger,Fr as ProcessLockCollisionError,Pn as ProjectGitInitError,xi as ROLLBACK_ORIGIN,Yi as ROOT_GITIGNORE_TEMPLATE,qn as RUNTIME_VERSION,ei as SERVICE_WRITER,la as SKILL_INSTALL_EVENTS_FILE_REL,i as SKILL_STATE_TARGETS,er as STARTER_FOLDER_FRONTMATTER_FILENAME,mr as STARTER_PACKS,Oi as STARTER_PACK_IDS,si as STATE_MANIFEST_FILENAME,Or as STATE_SCHEMA_VERSION,c as SYSTEM_DOC_NAME,xr as SeedPrerequisiteError,Dn as SeedRootDirError,ha as ServerLockCollisionError,Na as SingleFileNotAFileError,Bn as SingleFileNotFoundError,Da as SingleFileNotMarkdownError,Dt as SingleFileProjectOverrideError,F as StateManifestError,xa as TagIndex,Nt as USER_GLOBAL_BUNDLE_IDS,q as __getShowAllWalkStatsForTesting,V as __resetShowAllWalkStatsForTesting,nt as acquireProcessLock,qr as acquireServerLock,C as applyAgentMarkdownWrite,Vr as applyExternalChange,We as applySeed,Xe as assertCompatibleStateManifest,ct as assertGitAvailable,$ as assertNeverDiskEvent,ve as assertNotHomeProjectRoot,Re as attachAcpThreadSocket,xt as attachCollabClientCounter,za as attachIdleShutdown,k as bindConflictAuthority,Kt as bootServer,fe as buildAndOpenSkill,zt as buildConfigYmlContent,Qt as buildExecResult,ae as buildIngressPolicy,Me as buildOkMcpStdioCommand,Fi as buildSkillZip,Te as buildStarterFolderFrontmatterYaml,pn as buildWipTree,on as bundleSkillMdPath,bn as canonicalProjectKey,ht as canonicalizeForCompare,_ as classifyEvents,rr as classifyFsPath,$i as clearAllEmbeddingsKeys,di as coercePackId,zi as collectServerHostSnapshot,o as colorFromSeed,Mr as commitUpstreamImport,jn as commitWip,vi as commitWipFromTree,Ki as compareSemver,Wn as composeEffectiveLinterConfig,Zr as composeFrontmatterSchemasConfig,oa as containsConflictMarkers,Zn as contentHash,dr as contributorCount,Ti as countShadowObjects,ii as countStaleAgentWipRefs,Tr as countWipRefs,vr as createApiExtension,wn as createAssetServeMiddleware,pa as createCollaborationHost,ja as createContentFilter,Rn as createContentFilterAsync,Ta as createEmbeddingsSecretStore,Tt as createEphemeralProjectDir,N as createExternalChangeHandler,ya as createFileLogger,jt as createLiveDerivedIndexExtension,G as createMcpHttpHandler,z as createOsProbe,et as createPersistenceExtension,Gr as createProbeFailureReporter,x as createServer,zr as createServerObserverExtension,He as createServerProbeResolver,Je as createStreamingErrorWriter,Ni as createTestLogger,ot as describeStoredEmbeddingsKey,Z as detectClaudeDesktopPresence,ge as detectGit,Ie as detectProjectShape,yt as detectUserSkillHosts,La as discoverLockDirs,D as discoverMarkdownlintConfig,Ut as emitPreflightFailureSpan,le as encodeDocName,Lt as encodeFolderRoute,Xt as encodeSkillRoute,re as ensureProjectGit,ke as errorResponse,Mi as evictStaleTrackerEntries,Se as extractHeadings,un as extractOkBinaryPath,nn as extractWikiLinksFromMarkdown,_n as fallbackPaths,ft as findEnclosingGitRoot,m as findEnclosingProjectRoot,ar as findNativeMarkdownlintFile,ta as flushFileLogger,pi as formatAuditBrokenLinkSuppressionLine,Vi as formatAuthRejectionWire,Pr as formatContributorsFrom,Nn as formatPackRationale,bi as gcCheckpointRefs,Ji as getCurrentMcpLogger,Kn as getIngressContext,$r as getLocalDir,ca as getLogFilePath,Ce as getLogger,$n as getLogsDir,pr as getMachineId,Di as getMeter,oi as getMetrics,Dr as getTracer,br as handleCollabSocketError,En as handleSpawnCursor,ma as hasForwardingHeaders,Ma as hasGcLogLatch,a as iconFromClientName,zn as incrementCollabSocketFilteredError,Ea as incrementServerObserverFire,Et as initContent,P as initShadowRepo,ba as initTelemetry,Mt as initToleranceTelemetryWriter,K as installJsonSchemaDialect,B as installPrettyZodErrors,dn as installTestLoggers,tt as installUserSkill,Kr as isAllowedApiOrigin,S as isAllowedWorkspaceHostHeader,Br as isConfigDoc,Ue as isDefunctProcess,Ye as isDocInConflict,st as isHocuspocusAuthRejectionReason,Q as isHomeDir,_e as isHostAdmitted,Le as isKnownPackId,bt as isLinkIndexExcludedDoc,Ra as isLockProcessRunning,O as isLoopbackAddress,Gt as isManagedArtifactDoc,de as isOriginAdmitted,n as isOrphanMode,Rt as isPairedWriteOrigin,Zt as isPathWithinDir,ie as isPeerAdmitted,je as isProcessAlive,Pi as isProjectRoot,we as isReservedForUserTree,fn as isSelfWrite,an as isSystemDoc,yn as isToleranceTelemetryEnabled,mt as isValidLockPid,g as lastKnownHash,nr as listRescueCheckpoints,Qi as listStarterPacks,ui as loadCustomAgents,Ri as loadPrincipal,jr as lockAdvertisesUi,An as lockBaseUrl,_i as lockFilePath,rn as loggerFactory,Gi as loginShapedUserinfoUser,vn as logsCurrentPath,pt as logsPreviousPath,Un as makeLazyEmbeddingsKeyStore,Xr as markServerLockDraining,aa as mountMcpAndApi,Xn as normalizeFsPath,ur as observeReadiness,wi as packageVersionMajorMinor,ri as parseAuthRejectionWire,wr as parseGitVersion,_r as parseHocuspocusAuthToken,Cn as parseKeepaliveConnectionId,fa as pathToDocName,Aa as planSeed,Ln as prepareSingleFileOpen,wa as processCommand,wt as processUsage,M as readAllTargets,va as readBundleDecision,At as readDeclaredGitHubHosts,W as readOriginGitHubRepo,R as readOwnNativeRules,$e as readProcessLock,Wr as readProcessLockDetailed,b as readProcessState,Rr as readProjectHeadState,Ve as readProjectLocalSemanticConfig,qe as readServerLock,at as readServerPackageVersion,X as readSkillInstallStateSnapshot,he as readStateManifest,Fe as readTargetRecordedAt,vt as readTargetVersion,Ia as reconcile,E as recordContributor,Ht as recordSkillInstallEvent,ce as redactShareSubprocessStderr,It as registerAllTools,Yt as registerWrite,ne as releaseProcessLock,Oe as releaseServerLock,ji as removeLastKnownHash,xe as removeProjectSkillGitignoreBlock,ln as reportSkillInstall,tn as resetMetrics,gn as resolveBuiltinSkillHosts,t as resolveBundleEnabled,dt as resolveBundledSkillDir,p as resolveContentDir,tr as resolveCursorBinaryDefault,Zi as resolveCursorSpawnInvocation,li as resolveEffectiveLinterConfig,Li as resolveEmbeddingsCredential,Ar as resolveGitHubAccountFromUrl,kn as resolveGitHubAuthHost,gi as resolveLockDir,Wi as resolveNativeConfigForDoc,Hn as resolveNativeMarkdownlintConfig,Yr as resolvePack,ia as resolvePackageVersion,Yn as resolveSkillInstallReportSettings,lr as resolveUiInfo,Ci as restoreContributors,ni as rewriteMarkdownLinksForDocumentRename,Cr as rewriteWikiLinksForDocumentRename,gr as runAuthReposSubprocess,Sn as runAuthStatusSubprocess,da as runCloneSubprocess,ka as runDeviceFlowSubprocess,In as runWithMcpLogger,Ca as safeContentPath,Ct as safeSubdir,j as safetyCheckpoint,_a as sameGitHubLogin,kt as sanitizeClientName,U as saveInMemoryCheckpoint,L as saveVersion,Qe as scanLockProcesses,Ur as seedBasenameIndex,y as seedEphemeralProjectDir,Lr as serializeError,Be as setActiveSpanAttributes,Ke as setupServerObservers,it as shadowGit,Y as shutdownTelemetry,h as spansCurrentPath,or as spansPreviousPath,me as spawnDetached,Pe as splitMarkdownBlocks,_t as startWatcher,Fa as strategiesFor,T as streamingProblemEvent,Vt as swapContributors,se as teardownToleranceTelemetryWriter,Ft as toBroadcasterKey,Jt as tracedAppendFileSync,te as tracedLinkSync,De as tracedMkdir,Ai as tracedMkdirSync,be as tracedRename,cn as tracedRenameSync,en as tracedRmSync,hn as tracedRmdirSync,ut as tracedUnlinkSync,f as tracedWriteFile,ir as tracedWriteFileSync,ea as trustSystemCertificates,fi as updateLastKnownHash,Bi as updateProcessLockPort,Nr as updateServerLockPort,Mn as validateAgentId,yi as validateCloneInputs,qi as validateSkillZip,Gn as waitForServerLockDrain,Qr as withHiddenWindowsConsole,sa as withSpan,Qn as withSpanSync,fr as writeBundleDecision,Ei as writeMarkdownlintRule,ai as writeRootGitignoreForNewRepo,Er as writeStateManifest,yr as writeTargetVersion,Tn as writeTracker};
package/dist/index.d.mts CHANGED
@@ -2457,6 +2457,8 @@ type HandoffScope = 'selection';
2457
2457
  interface TerminalLaunchCommand {
2458
2458
  readonly executable: string;
2459
2459
  readonly args: readonly string[];
2460
+ readonly env?: Readonly<Record<string, string>>;
2461
+ readonly pathPrepend?: readonly string[];
2460
2462
  readonly supportFile?: {
2461
2463
  readonly kind: 'claude-settings';
2462
2464
  readonly relativePath: string;
package/dist/index.mjs CHANGED
@@ -1535,6 +1535,6 @@ GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){funct
1535
1535
  `);re(e,o)}function M9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=A9(JSON.parse(n),t),i=n.endsWith(`
1536
1536
  `)?`
1537
1537
  `:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=k9(n,t.contentDir);r!==n&&re(e,r)}}function N9(e,t){let n=S(e,`utf-8`),r=k9(n,t.contentDir);r!==n&&re(e,r)}function P9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const gje=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function F9(e){return/\.log\.\d+$/.test(e)}function _je(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||F9(e)}const vje=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function yje(e){let t={contentDir:e.contentDir};for(let n of vje)for(let r of P9(N(e.stagingDir,n)))_je(r)?j9(r,t):r.endsWith(`.json`)?M9(r,t):N9(r,t);for(let n of P9(N(e.stagingDir,`state`))){let e=me(n);n.endsWith(`.jsonl`)?j9(n,t):gje.has(e)?M9(n,t):N9(n,t)}}const I9=[`.ok`,`local`,`telemetry`],L9=[`.ok`,`local`,`logs`],R9=[`.ok`,`local`,`loss-capture`],z9=`spans-current.jsonl`,B9=`spans-prev.jsonl`,V9=`server-current.jsonl`,H9=`server-prev.jsonl`,U9=`loss-current.jsonl`,W9=`loss-prev.jsonl`;function bje(e){return N(e,...I9,z9)}function xje(e){return N(e,...I9,B9)}function Sje(e){return N(e,...L9,V9)}function Cje(e){return N(e,...L9,H9)}function wje(e){return N(e,...R9,U9)}function Tje(e){return N(e,...R9,W9)}const G9=1e3;async function Eje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function Dje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function Oje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}function kje(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
1538
- `)}\n`:null}catch{return null}}function Aje(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],H6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function jje(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],H6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function Mje(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function Nje(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,tn.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function Pje(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return Pje(e.maxBytes)}function Fje(e){let t=J9(RX(`project`,e)),n=J9(RX(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function Ije(e){return Ne(`sha256`).update(e).digest(`hex`)}function Lje(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const Rje=[`"doc.name"`,`"docName"`];function zje(e){let t=S(e,`utf-8`),n=0;for(let e of Rje){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(M(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,w7(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Bje=new Set([`.jsonl`]);function Vje(e){let t=e.lastIndexOf(`.`);return t!==-1&&Bje.has(e.slice(t))}const Hje=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function Uje(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&Hje.has(e.slice(t))}function Wje(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!Uje(r))continue;let{redacted:i,patterns:a,lineCount:o}=kB(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ye(e,t).split(xe).join(`/`)}async function Gje(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Eje,a=r.fetchAgentEffects??Dje,o=r.fetchWatcherRecent??Oje,s=r.readShadowHead??Aje,c=r.readCheckpointRefs??jje,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.78.0-beta.4`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??Mje,h=r.isOtlpPushEnabled??Nje,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(bje(n),N(_,`telemetry`,z9)),Z9(xje(n),N(_,`telemetry`,B9)),Z9(Sje(n),N(_,`logs`,V9)),Z9(Cje(n),N(_,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,me(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,eR,me(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,N(_,`diagnostic-reports`,me(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=kje(n);e!==null&&re(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(N(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(N(_,`state`,`checkpoint-refs.txt`),D),Z9(wje(n),N(_,`state`,U9)),Z9(Tje(n),N(_,`state`,W9)),Z9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(b,Ru),N(_,`state`,Ru)),Z9(N(b,zu),N(_,`state`,zu)),Z9(N(b,Lu),N(_,`state`,Lu));let ee=p(),ne=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
1538
+ `)}\n`:null}catch{return null}}function Aje(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],H6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function jje(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],H6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function Mje(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function Nje(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,tn.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function Pje(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return Pje(e.maxBytes)}function Fje(e){let t=J9(RX(`project`,e)),n=J9(RX(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function Ije(e){return Ne(`sha256`).update(e).digest(`hex`)}function Lje(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const Rje=[`"doc.name"`,`"docName"`];function zje(e){let t=S(e,`utf-8`),n=0;for(let e of Rje){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(M(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,w7(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Bje=new Set([`.jsonl`]);function Vje(e){let t=e.lastIndexOf(`.`);return t!==-1&&Bje.has(e.slice(t))}const Hje=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function Uje(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&Hje.has(e.slice(t))}function Wje(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!Uje(r))continue;let{redacted:i,patterns:a,lineCount:o}=kB(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ye(e,t).split(xe).join(`/`)}async function Gje(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Eje,a=r.fetchAgentEffects??Dje,o=r.fetchWatcherRecent??Oje,s=r.readShadowHead??Aje,c=r.readCheckpointRefs??jje,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.78.0-beta.6`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??Mje,h=r.isOtlpPushEnabled??Nje,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(bje(n),N(_,`telemetry`,z9)),Z9(xje(n),N(_,`telemetry`,B9)),Z9(Sje(n),N(_,`logs`,V9)),Z9(Cje(n),N(_,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,me(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,eR,me(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,N(_,`diagnostic-reports`,me(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=kje(n);e!==null&&re(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(N(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(N(_,`state`,`checkpoint-refs.txt`),D),Z9(wje(n),N(_,`state`,U9)),Z9(Tje(n),N(_,`state`,W9)),Z9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(b,Ru),N(_,`state`,Ru)),Z9(N(b,zu),N(_,`state`,zu)),Z9(N(b,Lu),N(_,`state`,Lu));let ee=p(),ne=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
1539
1539
  `:`not-running (${w})\n`;re(N(_,`state`,`server-status.txt`),oe);let se=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:C7(e.diagnosticReports,y);if(re(N(_,`state`,`diagnostic-reports-status.txt`),`${se}\n`),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let k=e.redact===!0;k&&yje({stagingDir:_,contentDir:t}),e.note&&re(N(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=Wje(_));for(let t of e.extraFiles??[])Z9(t.sourcePath,N(_,`extra`,t.zipName??me(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let le=Fje(n),ue=Q9(_),A=[],j=0,de=0;for(let e of ue){let t=$9(_,e),n=te(e).size,r=Vje(t)?Lje(e):0;A.push({path:t,bytes:n,lines:r}),j+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=zje(e))}let fe={applied:k};ce!==null&&(fe.secretScrub=ce);let pe={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie},contentDir:{pathSha256:Ije(t),absolutePath:k?`<CONTENT_DIR>`:t},telemetry:{localSink:le,otlpPushEnabled:h()},redaction:fe,serverStatus:C,files:A};re(N(_,`manifest.json`),`${JSON.stringify(pe,null,2)}\n`);let M=ue.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),he={stagedDiagnosticReports:y,totalBytes:j,fileCount:A.length,docNameCount:de,contentDirVisible:M,redacted:k},ge=!1;return{stagingDir:_,manifest:pe,summary:he,cleanup:()=>{ge||(ge=!0,O(_,{recursive:!0,force:!0}))}}}catch(e){throw O(_,{recursive:!0,force:!0}),e}}async function Kje(e){let{collected:t,outputPath:n}=e,r=M(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new JCe.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function qje(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,tn.parse)(S(n,`utf-8`)),r=G8(t)?t.content:void 0,i=G8(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return be(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return be(e)}async function Jje(e,t,n,r,i){let a=E7(t,e.logger),o=await Gje({contentDir:qje(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...iAe(a,e.userLogsDir??N(k(),`.ok`,`logs`)),...O7(e.cachesDir??N(k(),`Library`,`Caches`))],userStateFiles:k7(e.bugReportsDir??T7()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(M(e.outputPath),{recursive:!0}),await Kje({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function Yje(e){let{projectDir:t}=e,n=e.readDesktopEnv??K9,r=e.readLanguage??O9,i=()=>$ke(e.diagnosticReportsDir??N(k(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return Jje(e,t,n,r,i());let{zipPath:a,summary:o}=await lAe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:O7(e.cachesDir??N(k(),`Library`,`Caches`)),bugReportLedgerFiles:k7(e.bugReportsDir??T7()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}export{Q8 as ALL_EDITOR_IDS,$8 as EDITOR_LABELS,k5 as EDITOR_TARGETS,bOe as HOSTS_WITH_USER_SKILL_DIR,zke as LAUNCH_CONFIG_NAME,QAe as PATH_SHIM_BEGIN,eje as PATH_SHIM_BLOCK_RE,$Ae as PATH_SHIM_END,I5 as ProjectPathSafetyError,_ke as addOkPathsToGitExclude,L5 as assertProjectPathSafe,d5 as buildManagedServerEntry,HAe as buildMcpConfigDeclineEvent,UAe as buildMcpConfigMigrateEvent,b7 as classifyExistingMcpEntry,Yje as collectReportBundle,aje as createCliProbeResolver,on as createTokenStore,tAe as defaultBugReportZipPath,We as detectGh,qe as detectGhAccounts,Uke as detectInstalledEditors,b5 as droppedManagedKeys,VOe as editorConfigPathDisplay,BOe as editorEntryLocator,jAe as ensurePiBridge,Q5 as formatTrackedRemediation,bke as getExcludedOkPaths,X5 as getInstalledSkillProjectionPaths,yOe as getNativeTomlMcpEditor,Y5 as getOkArtifactPaths,l5 as isEntryUpToDate,f5 as isOwnManagedEntry,YAe as loadConfig,bee as makeLazyProbeTokenStore,T7 as okBugReportsDir,b9 as parseGitHubBlobUrl,XAe as parseGitHubShareUrl,x9 as parseGitHubTreeUrl,y9 as parseGitUrl,tje as pathInstallMarkerPath,nke as previewContent,Wke as probeOwnManagedEditorMcpEntry,kAe as probePiBridgeState,Z5 as probeTrackedOkPaths,v7 as readExistingMcpEntry,yke as readSharingMode,kB as redactContent,vke as removeOkPathsFromGitExclude,RAe as removeOwnMcpEntry,mke as removeProjectSkill,sje as removeUserGlobalSkillBundle,pje as removeUserSkill,cke as resolveProjectRoot,KAe as runStop,h9 as truncatePriorEntry,E9 as userGlobalSkillBundleTargets,fje as userSkillPresentAnywhere,ZAe as validateLocalFolderForShare,_7 as writeEditorMcpConfig,uje as writeProjectAiIntegrations,U5 as writeProjectSkill,Hke as writeUserMcpConfigs,dje as writeUserSkill};
1540
1540
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ import"./dist-DeGSxFUJ.mjs";import{_ as e}from"./init-__dFxXcd.mjs";export{e as runInit};
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{$l as r,Bd as i,Gd as a,Kd as o,Mt as s,Pd as c,Ud as l,Uu as u,Vd as d,Vl as f,Xd as p,Yd as m,Yl as h,gs as g,ic as _,qu as v,vs as y,zu as b}from"./md-manager-BGnqyqi1-XuN_2HH6.mjs";import{Do as x,Eo as S,Fr as ee,Gn as te,Go as ne,H as re,Ji as ie,L as ae,No as C,Oo as oe,Or as se,Qi as ce,Qt as le,R as ue,Rn as de,Sr as fe,To as pe,Tt as me,Yi as he,at as ge,da as _e,fo as ve,ko as ye,lo as be,m as xe,mo as Se,qr as Ce,rt as we,zo as Te}from"./dist-D0NB38wf.mjs";import{i as w,n as T,o as E,r as Ee,s as D,t as O}from"./colors-r_owlCuY.mjs";import{t as k}from"./is-object-BGze3w87.mjs";import{t as De}from"./constants-DJMEHHjq.mjs";import{t as Oe}from"./preview-IjtgcT3j.mjs";import{createRequire as ke}from"node:module";import{execFileSync as Ae}from"node:child_process";import je,{basename as Me,dirname as A,isAbsolute as Ne,join as j,posix as Pe,relative as M,resolve as N,sep as P,win32 as Fe}from"node:path";import F from"node:process";import{fileURLToPath as Ie}from"node:url";import{cpSync as Le,existsSync as I,lstatSync as Re,mkdirSync as ze,readFileSync as L,readdirSync as Be,readlinkSync as Ve,realpathSync as He,rmSync as Ue,statSync as We,writeFileSync as Ge}from"node:fs";import{homedir as R}from"node:os";import{inspect as Ke,stripVTControlCharacters as qe,styleText as z}from"node:util";import*as Je from"node:readline";import{AsyncLocalStorage as Ye,AsyncResource as Xe}from"node:async_hooks";var Ze=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),Qe=n((e=>{let{InvalidArgumentError:t}=Ze();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),$e=n((e=>{let{humanReadableArgName:t}=Qe();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1
+ import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{$l as r,Fd as i,Hd as a,Ju as o,Kd as s,Mt as c,Uu as l,Vd as u,Vl as d,Wd as f,Xd as p,Yl as m,Zd as h,gs as g,ic as _,qd as v,vs as y,zu as b}from"./md-manager-BGnqyqi1-CTvRTh-G.mjs";import{Do as x,Eo as S,Fr as ee,Gn as te,Go as ne,H as re,Ji as ie,L as ae,No as C,Oo as oe,Or as se,Qi as ce,Qt as le,R as ue,Rn as de,Sr as fe,To as pe,Tt as me,Yi as he,at as ge,da as _e,fo as ve,ko as ye,lo as be,m as xe,mo as Se,qr as Ce,rt as we,zo as Te}from"./dist-DeGSxFUJ.mjs";import{i as w,n as T,o as E,r as Ee,s as D,t as O}from"./colors-r_owlCuY.mjs";import{t as k}from"./is-object-BGze3w87.mjs";import{t as De}from"./constants-B5vbbQ59.mjs";import{t as Oe}from"./preview-YKuXh9c-.mjs";import{createRequire as ke}from"node:module";import{execFileSync as Ae}from"node:child_process";import je,{basename as Me,dirname as A,isAbsolute as Ne,join as j,posix as Pe,relative as M,resolve as N,sep as P,win32 as Fe}from"node:path";import F from"node:process";import{fileURLToPath as Ie}from"node:url";import{cpSync as Le,existsSync as I,lstatSync as Re,mkdirSync as ze,readFileSync as L,readdirSync as Be,readlinkSync as Ve,realpathSync as He,rmSync as Ue,statSync as We,writeFileSync as Ge}from"node:fs";import{homedir as R}from"node:os";import{inspect as Ke,stripVTControlCharacters as qe,styleText as z}from"node:util";import*as Je from"node:readline";import{AsyncLocalStorage as Ye,AsyncResource as Xe}from"node:async_hooks";var Ze=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),Qe=n((e=>{let{InvalidArgumentError:t}=Ze();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),$e=n((e=>{let{humanReadableArgName:t}=Qe();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
2
2
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
3
3
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
4
4
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),et=n((e=>{let{InvalidArgumentError:t}=Ze();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -278,7 +278,7 @@ let br=/^[a-z0-9-_]+$/i;function xr(e){let t=typeof e;if(t===`object`){if(Array.
278
278
  `)+Or(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=wr(t[c],e,r,i),a+=`
279
279
  `}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function kr(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(xr(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=Or(0,e,``,t,n);return r[r.length-1]===`
280
280
  `?r:r+`
281
- `}var J=b();function Ar(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function jr(e){return!e||typeof e!=`object`?String(e):`${typeof e} keys=[${Object.keys(e).join(`,`)}]`}function Mr(e,t){let n=[],r=new WeakSet,i=t;for(;i instanceof Error&&!r.has(i);)r.add(i),n.push(i.message),i=i.cause;return n.length===0?`${e}: ${jr(t)}`:`${e}: ${n.reverse().slice(0,5).join(` -> `)}`}function Y(e,t){process.env.OK_DEBUG_NATIVE&&process.stderr.write(`[ok] native-config ${Mr(e,t)}\n`)}const Nr=[`native`,`index.js`];function Pr(e={},t=Y){let n=e.moduleUrl??import.meta.url,r=e.requireModule??ke(n);try{let e=A(Ie(n));return r(j(e,...Nr))}catch(e){Ar(e)||t(`bundled loader failed to load`,e)}try{return r(`@inkeep/open-knowledge-native-config`)}catch(e){return Ar(e)||t(`workspace addon failed to load`,e),null}}function Fr(){let e=Pr();return e&&typeof e.parseTomlToJson==`function`?e:null}function Ir(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return Y(`addon loaded but probe failed`,e),!1}}function Lr(e){if(!k(e))throw Error(`TOML root is not a table`);return e}function Rr(e){return{backend:`native`,parseToObject(t){return Lr(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}},removeEntryKey(t,n,r){let i=e.removeMcpServerKey(t,n,r);return{text:i.text,existed:i.existed}}}}function zr(){return{backend:`fallback`,parseToObject(e){return Lr(yr(e))}}}function Br(e=Fr){let t=e();return t&&Ir(t)?Rr(t):zr()}let Vr=null;function Hr(){return Vr===null&&(Vr=Br()),Vr}function Ur(){let e=Hr();return e.backend===`native`?e:void 0}const Wr=i,X=d,Gr=a,Kr=`node`,qr={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},Jr=`# ok-mcp-v2`,Yr=`# ok-mcp-v2
281
+ `}var J=b();function Ar(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function jr(e){return!e||typeof e!=`object`?String(e):`${typeof e} keys=[${Object.keys(e).join(`,`)}]`}function Mr(e,t){let n=[],r=new WeakSet,i=t;for(;i instanceof Error&&!r.has(i);)r.add(i),n.push(i.message),i=i.cause;return n.length===0?`${e}: ${jr(t)}`:`${e}: ${n.reverse().slice(0,5).join(` -> `)}`}function Y(e,t){process.env.OK_DEBUG_NATIVE&&process.stderr.write(`[ok] native-config ${Mr(e,t)}\n`)}const Nr=[`native`,`index.js`];function Pr(e={},t=Y){let n=e.moduleUrl??import.meta.url,r=e.requireModule??ke(n);try{let e=A(Ie(n));return r(j(e,...Nr))}catch(e){Ar(e)||t(`bundled loader failed to load`,e)}try{return r(`@inkeep/open-knowledge-native-config`)}catch(e){return Ar(e)||t(`workspace addon failed to load`,e),null}}function Fr(){let e=Pr();return e&&typeof e.parseTomlToJson==`function`?e:null}function Ir(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return Y(`addon loaded but probe failed`,e),!1}}function Lr(e){if(!k(e))throw Error(`TOML root is not a table`);return e}function Rr(e){return{backend:`native`,parseToObject(t){return Lr(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}},removeEntryKey(t,n,r){let i=e.removeMcpServerKey(t,n,r);return{text:i.text,existed:i.existed}}}}function zr(){return{backend:`fallback`,parseToObject(e){return Lr(yr(e))}}}function Br(e=Fr){let t=e();return t&&Ir(t)?Rr(t):zr()}let Vr=null;function Hr(){return Vr===null&&(Vr=Br()),Vr}function Ur(){let e=Hr();return e.backend===`native`?e:void 0}const Wr=u,X=a,Gr=s,Kr=`node`,qr={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},Jr=`# ok-mcp-v2`,Yr=`# ok-mcp-v2
282
282
  USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
283
283
  [ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
284
284
  BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
@@ -314,16 +314,16 @@ foreach ($d in $dirs) {
314
314
  if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
315
315
  }
316
316
  [Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
317
- exit 127`,$r=`// ok-pi-bridge`,ei=`${$r}-v1`;function ti(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return ui(e,Jr)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return ui(e,Xr)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return ui(e,Jr)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return ui(e,Xr)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(ei)}return!1}function ni(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=N(e);if(Me(t)===`cli.mjs`&&Me(A(t))===`dist`)return t;let n=t.split(P),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r),a=i.length===0?P:i.join(P);return j(a,`packages`,`cli`,`dist`,`cli.mjs`)}function Z(e={}){return e.mode===`dev`?{command:Kr,args:[ni(),`mcp`],env:{...qr}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,Qr]}:{command:`/bin/sh`,args:[`-l`,`-c`,Yr]}}function ri(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[Kr,ni(),`mcp`],environment:{...qr}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,Qr]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,Yr]}}function ii(e){if(typeof e!=`object`||!e)return!1;let t=e;return ai(t,Z({mode:`published`,platformName:`darwin`}))||ai(t,Z({mode:`published`,platformName:`win32`}))}function ai(e,t){return Object.keys(e).length===Object.keys(t).length&&oi(e,t)}function oi(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function si(e,t){let n=e=>di(e);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`&&e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3])}function ci(e){return e.format===`toml`?Hr().backend===`native`:e.format===`json`||e.format===`yaml`}function li(e){return Array.isArray(e.command)?e.command:[e.command,...Array.isArray(e.args)?e.args:[]]}function ui(e,t){return typeof e==`string`&&e.trimStart().startsWith(t)}function di(e){return ui(e,`# ok-mcp`)}function fi(e){return typeof e==`string`&&(e===Zr||e.startsWith(`${Zr}@`))}function pi(e){if(typeof e!=`object`||!e)return!1;let t=li(e),n=t.findIndex(e=>e===`-c`||e===`-Command`);return n>=0&&di(t[n+1])?!0:t.some(fi)}function mi(e){if(typeof e!=`object`||!e)return!1;let t=li(e);if(t[0]!==Kr||t[2]!==`mcp`)return!1;try{return t[1]===ni()}catch{return!1}}const hi=[`command`,`args`,`env`],gi=[`type`,`command`,`environment`];function _i(e){return e.type===`local`&&Array.isArray(e.command)?gi:hi}function vi(e,t){if(typeof e!=`object`||!e)return[];let n=e;return _i(t).filter(e=>t[e]===void 0&&n[e]!==void 0)}function yi(e,t){return e.format===`file`?null:e.buildEntry(t,{})}function bi(e,t){return vi(e,t).length>0}function xi(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:si(t.args,t.command)}function Si(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&si(r,n)}function Q(e){return e===`win32`?Fe:Pe}function Ci(e={}){let t=e.platformName??process.platform,n=e.home??R(),r=e.env??process.env,i=Q(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA||i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME||i.join(n,`.config`)}function wi(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.claude.json`)}function Ti(e={}){let t=e.platformName??process.platform,n=e.home??R(),r=e.env??process.env;if(t===`darwin`)return Pe.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??Fe.join(n,`AppData`,`Roaming`);return Fe.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function Ei(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.cursor`,`mcp.json`)}function Di(e={}){let t=e.platformName??process.platform,n=e.home??R();return(e.env??process.env).CODEX_HOME??Q(t).join(n,`.codex`)}function Oi(e={}){return Q(e.platformName??process.platform).join(Di(e),`config.toml`)}function ki(e={}){let t=e.platformName??process.platform,n=e.home??R(),r=(e.env??process.env).COPILOT_HOME??Q(t).join(n,`.copilot`);return Q(t).join(r,`mcp-config.json`)}function Ai(e={}){let t=e.platformName??process.platform,n=e.home??R(),r=e.env??process.env,i=Q(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function ji(e={}){return Q(e.platformName??process.platform).join(Ai(e),`opencode.json`)}function Mi(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.openclaw`,`openclaw.json`)}function Ni(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.hermes`,`config.yaml`)}function Pi(e={}){let t=e.platformName??process.platform,n=e.home??R();return(e.env??process.env).PI_CODING_AGENT_DIR??Q(t).join(n,`.pi`,`agent`)}function Fi(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Ii(e,t){let n=Q(t);return[{file:n.join(e,`.lmstudio`,`mcp.json`),dir:n.join(e,`.lmstudio`)},{file:n.join(e,`.cache`,`lm-studio`,`mcp.json`),dir:n.join(e,`.cache`,`lm-studio`)}]}function Li(e){try{return Be(e).length>0}catch{return!1}}function Ri(e={}){let t=e.platformName??process.platform,[n,r]=Ii(e.home??R(),t),i=[n,r].find(e=>I(e.file));return i?i.file:Li(r.dir)?r.file:n.file}const $={claude:{id:`claude`,label:X.claude,configPath:(e,t)=>wi({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>j(t??R(),`.claude`),projectConfigPath:e=>j(e,`.mcp.json`),projectSkillPath:e=>j(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:X[`claude-desktop`],configPath:(e,t)=>Ti({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(Ti({home:t}))},cursor:{id:`cursor`,label:X.cursor,configPath:(e,t)=>Ei({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(Ei({home:t})),projectConfigPath:e=>j(e,`.cursor`,`mcp.json`),projectSkillPath:e=>j(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:X.codex,configPath:(e,t)=>Oi({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(Oi({home:t})),projectConfigPath:e=>j(e,`.codex`,`config.toml`),projectSkillPath:e=>j(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:X.copilot,configPath:(e,t)=>ki({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(ki({home:t})),projectSkillPath:e=>j(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:X.opencode,configPath:(e,t)=>ji({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>c,buildEntry:(e,t)=>ri(t),scope:`global`,detectPath:(e,t)=>A(ji({home:t})),projectConfigPath:e=>j(e,`opencode.json`),projectSkillPath:e=>j(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:X.openclaw,configPath:(e,t)=>Mi({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>j(t??R(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:X.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>c,scope:`project`,detectPath:(e,t)=>Pi({home:t}),projectConfigPath:e=>j(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>j(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:X.antigravity,configPath:(e,t)=>Fi({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>j(t??R(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:X[`lm-studio`],configPath:(e,t)=>Ri({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(Ri({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:X.hermes,configPath:(e,t)=>Ni({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>c,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>j(t??R(),`.hermes`),offerOnlyWhenDetected:!0}};function zi(e){let t=e.filter(e=>!Object.hasOwn($,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${Wr.join(`, `)}`);return e.map(e=>$[e])}const Bi=`**/.ok/*`,Vi=`!**/${h}/`;function Hi(e){let t=[`.ok/`,`.okignore`];for(let n of Wr){let r=$[n];r.projectConfigPath&&t.push(ra(r.projectConfigPath(e),e))}return t.push(`.claude/launch.json`),Array.from(new Set(t))}function Ui(e){let t=j(e,...s);if(!I(t))return[];try{let e=g(L(t,`utf-8`));if(!e)return[];let n=[];for(let[t,r]of Object.entries(e.skills))if(t!==`open-knowledge`)for(let e of r.hosts){let r=l[e];r&&n.push(`${r}/${t}/`)}return Array.from(new Set(n))}catch{return[]}}function Wi(e,t){let n=Ji(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:Qi(n)};let r=$i(e);if(r.kind!==`ok`)return r.result;let i=I(r.path)?L(r.path,`utf-8`):``,a=new Set(Ui(e)),o=[],s=a.size===0?i:i.split(`
317
+ exit 127`,$r=`// ok-pi-bridge`,ei=`${$r}-v1`;function ti(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return ui(e,Jr)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return ui(e,Xr)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return ui(e,Jr)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return ui(e,Xr)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(ei)}return!1}function ni(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=N(e);if(Me(t)===`cli.mjs`&&Me(A(t))===`dist`)return t;let n=t.split(P),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r),a=i.length===0?P:i.join(P);return j(a,`packages`,`cli`,`dist`,`cli.mjs`)}function Z(e={}){return e.mode===`dev`?{command:Kr,args:[ni(),`mcp`],env:{...qr}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,Qr]}:{command:`/bin/sh`,args:[`-l`,`-c`,Yr]}}function ri(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[Kr,ni(),`mcp`],environment:{...qr}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,Qr]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,Yr]}}function ii(e){if(typeof e!=`object`||!e)return!1;let t=e;return ai(t,Z({mode:`published`,platformName:`darwin`}))||ai(t,Z({mode:`published`,platformName:`win32`}))}function ai(e,t){return Object.keys(e).length===Object.keys(t).length&&oi(e,t)}function oi(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function si(e,t){let n=e=>di(e);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`&&e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3])}function ci(e){return e.format===`toml`?Hr().backend===`native`:e.format===`json`||e.format===`yaml`}function li(e){return Array.isArray(e.command)?e.command:[e.command,...Array.isArray(e.args)?e.args:[]]}function ui(e,t){return typeof e==`string`&&e.trimStart().startsWith(t)}function di(e){return ui(e,`# ok-mcp`)}function fi(e){return typeof e==`string`&&(e===Zr||e.startsWith(`${Zr}@`))}function pi(e){if(typeof e!=`object`||!e)return!1;let t=li(e),n=t.findIndex(e=>e===`-c`||e===`-Command`);return n>=0&&di(t[n+1])?!0:t.some(fi)}function mi(e){if(typeof e!=`object`||!e)return!1;let t=li(e);if(t[0]!==Kr||t[2]!==`mcp`)return!1;try{return t[1]===ni()}catch{return!1}}const hi=[`command`,`args`,`env`],gi=[`type`,`command`,`environment`];function _i(e){return e.type===`local`&&Array.isArray(e.command)?gi:hi}function vi(e,t){if(typeof e!=`object`||!e)return[];let n=e;return _i(t).filter(e=>t[e]===void 0&&n[e]!==void 0)}function yi(e,t){return e.format===`file`?null:e.buildEntry(t,{})}function bi(e,t){return vi(e,t).length>0}function xi(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:si(t.args,t.command)}function Si(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&si(r,n)}function Q(e){return e===`win32`?Fe:Pe}function Ci(e={}){let t=e.platformName??process.platform,n=e.home??R(),r=e.env??process.env,i=Q(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA||i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME||i.join(n,`.config`)}function wi(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.claude.json`)}function Ti(e={}){let t=e.platformName??process.platform,n=e.home??R(),r=e.env??process.env;if(t===`darwin`)return Pe.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??Fe.join(n,`AppData`,`Roaming`);return Fe.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function Ei(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.cursor`,`mcp.json`)}function Di(e={}){let t=e.platformName??process.platform,n=e.home??R();return(e.env??process.env).CODEX_HOME??Q(t).join(n,`.codex`)}function Oi(e={}){return Q(e.platformName??process.platform).join(Di(e),`config.toml`)}function ki(e={}){let t=e.platformName??process.platform,n=e.home??R(),r=(e.env??process.env).COPILOT_HOME??Q(t).join(n,`.copilot`);return Q(t).join(r,`mcp-config.json`)}function Ai(e={}){let t=e.platformName??process.platform,n=e.home??R(),r=e.env??process.env,i=Q(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function ji(e={}){return Q(e.platformName??process.platform).join(Ai(e),`opencode.json`)}function Mi(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.openclaw`,`openclaw.json`)}function Ni(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.hermes`,`config.yaml`)}function Pi(e={}){let t=e.platformName??process.platform,n=e.home??R();return(e.env??process.env).PI_CODING_AGENT_DIR??Q(t).join(n,`.pi`,`agent`)}function Fi(e={}){let t=e.platformName??process.platform,n=e.home??R();return Q(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Ii(e,t){let n=Q(t);return[{file:n.join(e,`.lmstudio`,`mcp.json`),dir:n.join(e,`.lmstudio`)},{file:n.join(e,`.cache`,`lm-studio`,`mcp.json`),dir:n.join(e,`.cache`,`lm-studio`)}]}function Li(e){try{return Be(e).length>0}catch{return!1}}function Ri(e={}){let t=e.platformName??process.platform,[n,r]=Ii(e.home??R(),t),i=[n,r].find(e=>I(e.file));return i?i.file:Li(r.dir)?r.file:n.file}const $={claude:{id:`claude`,label:X.claude,configPath:(e,t)=>wi({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>j(t??R(),`.claude`),projectConfigPath:e=>j(e,`.mcp.json`),projectSkillPath:e=>j(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:X[`claude-desktop`],configPath:(e,t)=>Ti({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(Ti({home:t}))},cursor:{id:`cursor`,label:X.cursor,configPath:(e,t)=>Ei({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(Ei({home:t})),projectConfigPath:e=>j(e,`.cursor`,`mcp.json`),projectSkillPath:e=>j(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:X.codex,configPath:(e,t)=>Oi({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(Oi({home:t})),projectConfigPath:e=>j(e,`.codex`,`config.toml`),projectSkillPath:e=>j(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:X.copilot,configPath:(e,t)=>ki({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(ki({home:t})),projectSkillPath:e=>j(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:X.opencode,configPath:(e,t)=>ji({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>i,buildEntry:(e,t)=>ri(t),scope:`global`,detectPath:(e,t)=>A(ji({home:t})),projectConfigPath:e=>j(e,`opencode.json`),projectSkillPath:e=>j(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:X.openclaw,configPath:(e,t)=>Mi({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>j(t??R(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:X.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>i,scope:`project`,detectPath:(e,t)=>Pi({home:t}),projectConfigPath:e=>j(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>j(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:X.antigravity,configPath:(e,t)=>Fi({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>j(t??R(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:X[`lm-studio`],configPath:(e,t)=>Ri({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>A(Ri({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:X.hermes,configPath:(e,t)=>Ni({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>i,buildEntry:(e,t)=>Z(t),scope:`global`,detectPath:(e,t)=>j(t??R(),`.hermes`),offerOnlyWhenDetected:!0}};function zi(e){let t=e.filter(e=>!Object.hasOwn($,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${Wr.join(`, `)}`);return e.map(e=>$[e])}const Bi=`**/.ok/*`,Vi=`!**/${m}/`;function Hi(e){let t=[`.ok/`,`.okignore`];for(let n of Wr){let r=$[n];r.projectConfigPath&&t.push(ra(r.projectConfigPath(e),e))}return t.push(`.claude/launch.json`),Array.from(new Set(t))}function Ui(e){let t=j(e,...c);if(!I(t))return[];try{let e=g(L(t,`utf-8`));if(!e)return[];let n=[];for(let[t,r]of Object.entries(e.skills))if(t!==`open-knowledge`)for(let e of r.hosts){let r=f[e];r&&n.push(`${r}/${t}/`)}return Array.from(new Set(n))}catch{return[]}}function Wi(e,t){let n=Ji(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:Qi(n)};let r=$i(e);if(r.kind!==`ok`)return r.result;let i=I(r.path)?L(r.path,`utf-8`):``,a=new Set(Ui(e)),o=[],s=a.size===0?i:i.split(`
318
318
  `).filter(e=>{let t=e.trim();return!a.has(t)||(o.push(t),!1)}).join(`
319
319
  `),c=na(s),l=[],u=[];for(let e of t)ta(c,e)?u.push(e):l.push(e);if(l.length===0&&o.length===0)return{kind:`updated`,appended:l,alreadyPresent:u,removed:[]};let d=l.length===0||s.length===0||s.endsWith(`
320
320
  `)?``:`
321
321
  `,f=l.length===0?``:`${l.join(`
322
322
  `)}\n`;try{Ge(r.path,`${s}${d}${f}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:l,alreadyPresent:u,removed:o}}function Gi(e,t){let n=$i(e);if(n.kind!==`ok`)return n.result;if(!I(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>ea(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(Bi),i.add(Vi);for(let t of Ui(e))i.add(t);let a;try{a=L(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
323
323
  `),s=new Set,c=[];for(let e of o){let t=e.trim();if(i.has(t)){s.add(t);continue}c.push(e)}let l=[...s];if(s.size===0)return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let u=c.join(`
324
- `);if(u!==a)try{Ge(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function Ki(e){let t=$i(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!I(t.path))return`shared`;let n;try{n=L(t.path,`utf-8`)}catch{return`shared`}let r=na(n),i=Hi(e);for(let e of i)if(ta(r,e))return`local-only`;return r.has(Bi)?`local-only`:`shared`}function qi(e){let t=$i(e);if(t.kind!==`ok`||!I(t.path))return[];let n;try{n=L(t.path,`utf-8`)}catch{return[]}let r=na(n),i=[...Hi(e),...Ui(e)].filter(e=>ta(r,e)),a=new Set(i),o=[];for(let e of Object.values(l))e!==null&&o.push(e);let s=[];for(let e of r){if(a.has(e))continue;if(e===Bi||e===Vi){s.push(e);continue}let t=e.replace(/^\//,``).replace(/\/$/,``);o.some(e=>t.startsWith(`${e}/`)&&t.length>e.length+1)&&s.push(e)}return[...i,...s]}function Ji(e,t){let n=[];for(let r of t){let t=N(e,r);if(I(t))try{Ae(`git`,[`ls-files`,`--error-unmatch`,...y([r])],be({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}const Yi=/^[\w.\-/]+$/;function Xi(e){return process.platform===`win32`?`"${e.replaceAll(`"`,``)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`}function Zi(e){return Yi.test(e)?e:Xi(_(e))}function Qi(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}-- ${Zi(e)}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
324
+ `);if(u!==a)try{Ge(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function Ki(e){let t=$i(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!I(t.path))return`shared`;let n;try{n=L(t.path,`utf-8`)}catch{return`shared`}let r=na(n),i=Hi(e);for(let e of i)if(ta(r,e))return`local-only`;return r.has(Bi)?`local-only`:`shared`}function qi(e){let t=$i(e);if(t.kind!==`ok`||!I(t.path))return[];let n;try{n=L(t.path,`utf-8`)}catch{return[]}let r=na(n),i=[...Hi(e),...Ui(e)].filter(e=>ta(r,e)),a=new Set(i),o=[];for(let e of Object.values(f))e!==null&&o.push(e);let s=[];for(let e of r){if(a.has(e))continue;if(e===Bi||e===Vi){s.push(e);continue}let t=e.replace(/^\//,``).replace(/\/$/,``);o.some(e=>t.startsWith(`${e}/`)&&t.length>e.length+1)&&s.push(e)}return[...i,...s]}function Ji(e,t){let n=[];for(let r of t){let t=N(e,r);if(I(t))try{Ae(`git`,[`ls-files`,`--error-unmatch`,...y([r])],be({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}const Yi=/^[\w.\-/]+$/;function Xi(e){return process.platform===`win32`?`"${e.replaceAll(`"`,``)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`}function Zi(e){return Yi.test(e)?e:Xi(_(e))}function Qi(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}-- ${Zi(e)}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
325
325
  `)}function $i(e){let t=ne(e);switch(t.kind){case`repository`:{let e=t.repository.readCommonDir();if(e.kind===`unreadable`)return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}};let n=j(e.path,`info`);return I(n)?{kind:`ok`,path:j(n,`exclude`)}:{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-info-dir`}}}case`absent`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-git`}};case`malformed-pointer`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`malformed-pointer`}};case`inaccessible`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}}}}function ea(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function ta(e,t){for(let n of ea(t))if(e.has(n))return!0;return!1}function na(e){let t=new Set;for(let n of e.split(`
326
- `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function ra(e,t){return ia(M(t,e))}function ia(e){return P===`/`?e:e.split(P).join(`/`)}var aa=class extends Error{name=`ProjectPathSafetyError`;code=`PROJECT_PATH_SAFETY`};function oa(e,t){let n;try{n=Re(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw new aa(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);ca(e,t)}function sa(e,t){ca(e,t)}function ca(e,t){la(e,t)}function la(e,t){let n=t,r;try{r=He(n)}catch{r=N(n)}let i=A(e);for(;i.length>1&&i!==P;){let t;try{t=He(i)}catch(e){if(e.code===`ENOENT`){i=A(i);continue}throw e}let n=M(r,t);if(n===``||!n.startsWith(`..`)&&!Ne(n))return;throw new aa(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${r}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function ua(e,t){let n=A(t),r=I(t)?`overwritten`:`written`;if(r===`written`&&I(n))throw Error(`Refusing to replace ${n}: it exists but holds no SKILL.md, so it is not a bundle OpenKnowledge wrote. Move it aside and try again.`);return Ue(n,{recursive:!0,force:!0}),ze(A(n),{recursive:!0}),Le(e,n,{recursive:!0}),r}function da(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fa(e,t,n){try{if(We(n).size>10485760)return!1}catch{return!1}let r;try{r=L(n,`utf-8`)}catch{return!1}let i=[],a=oe(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!da(a))return!1;let o=a[e.topLevelKey];if(!da(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;if(!da(s))return!1;let c=s[e.serverName(t)];return da(c)&&c.enabled===!1?!1:pi(c)||mi(c)}function pa(e){let t=u[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:v(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:$[n.editor]??null}function ma(e,t,n={}){if(!p.includes(e.id))return!0;let r=pa(e.id),i=r?.projectConfigPath?.(t);if(r!==null&&i!==void 0&&fa(r,t,i))return!0;try{return fa(e,t,e.configPath(t,n.home))}catch{return!1}}function ha(e){let t=new Set(o.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function ga(e,t){if(ha(t).length===0)return null;let n=j(e,f,m,`SKILL.md`);try{let t=ce(`project`,{checkDesktop:!0});return oa(A(n),e),{editorId:`agents`,label:`.agents hub`,action:ua(t,n),path:n}}catch(e){return{editorId:`agents`,label:`.agents hub`,action:`failed`,path:n,error:e instanceof Error?e.message:String(e)}}}function _a(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!ma(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=ce(`project`,{checkDesktop:!0});oa(A(r),t);let i=ua(n,r);return{editorId:e.id,label:e.label,action:i,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function va(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=A(n);return I(n)?(sa(r,t),Ue(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function ya(e){switch(e?.code){case`EACCES`:case`EPERM`:return`permission-denied`;case`ELOOP`:return`unresolved-symlink`;case`EISDIR`:case`ENOTDIR`:return`not-a-file`;case`ENOENT`:return`disappeared`;default:return`unreadable`}}function ba(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions, then retry`;case`missing-symlink-target`:return`the symlink target is missing; restore the target or correct the symlink, then retry`;case`unresolved-symlink`:return`the path or symlink could not be resolved; check path permissions and repair any symlink cycle, then retry`;case`not-a-file`:return`the path is not a regular file; restore the intended configuration file, then retry`;case`disappeared`:return`the file disappeared; retry to check its current state`;case`unreadable`:return`the file could not be read; check that the path is accessible, then retry`;default:throw Error(`unhandled configuration file decline reason: ${e}`)}}function xa(e){for(let t of e.split(`
326
+ `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function ra(e,t){return ia(M(t,e))}function ia(e){return P===`/`?e:e.split(P).join(`/`)}var aa=class extends Error{name=`ProjectPathSafetyError`;code=`PROJECT_PATH_SAFETY`};function oa(e,t){let n;try{n=Re(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw new aa(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);ca(e,t)}function sa(e,t){ca(e,t)}function ca(e,t){la(e,t)}function la(e,t){let n=t,r;try{r=He(n)}catch{r=N(n)}let i=A(e);for(;i.length>1&&i!==P;){let t;try{t=He(i)}catch(e){if(e.code===`ENOENT`){i=A(i);continue}throw e}let n=M(r,t);if(n===``||!n.startsWith(`..`)&&!Ne(n))return;throw new aa(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${r}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function ua(e,t){let n=A(t),r=I(t)?`overwritten`:`written`;if(r===`written`&&I(n))throw Error(`Refusing to replace ${n}: it exists but holds no SKILL.md, so it is not a bundle OpenKnowledge wrote. Move it aside and try again.`);return Ue(n,{recursive:!0,force:!0}),ze(A(n),{recursive:!0}),Le(e,n,{recursive:!0}),r}function da(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fa(e,t,n){try{if(We(n).size>10485760)return!1}catch{return!1}let r;try{r=L(n,`utf-8`)}catch{return!1}let i=[],a=oe(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!da(a))return!1;let o=a[e.topLevelKey];if(!da(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;if(!da(s))return!1;let c=s[e.serverName(t)];return da(c)&&c.enabled===!1?!1:pi(c)||mi(c)}function pa(e){let t=l[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:o(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:$[n.editor]??null}function ma(e,t,n={}){if(!h.includes(e.id))return!0;let r=pa(e.id),i=r?.projectConfigPath?.(t);if(r!==null&&i!==void 0&&fa(r,t,i))return!0;try{return fa(e,t,e.configPath(t,n.home))}catch{return!1}}function ha(e){let t=new Set(v.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function ga(e,t){if(ha(t).length===0)return null;let n=j(e,d,p,`SKILL.md`);try{let t=ce(`project`,{checkDesktop:!0});return oa(A(n),e),{editorId:`agents`,label:`.agents hub`,action:ua(t,n),path:n}}catch(e){return{editorId:`agents`,label:`.agents hub`,action:`failed`,path:n,error:e instanceof Error?e.message:String(e)}}}function _a(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!ma(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=ce(`project`,{checkDesktop:!0});oa(A(r),t);let i=ua(n,r);return{editorId:e.id,label:e.label,action:i,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function va(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=A(n);return I(n)?(sa(r,t),Ue(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function ya(e){switch(e?.code){case`EACCES`:case`EPERM`:return`permission-denied`;case`ELOOP`:return`unresolved-symlink`;case`EISDIR`:case`ENOTDIR`:return`not-a-file`;case`ENOENT`:return`disappeared`;default:return`unreadable`}}function ba(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions, then retry`;case`missing-symlink-target`:return`the symlink target is missing; restore the target or correct the symlink, then retry`;case`unresolved-symlink`:return`the path or symlink could not be resolved; check path permissions and repair any symlink cycle, then retry`;case`not-a-file`:return`the path is not a regular file; restore the intended configuration file, then retry`;case`disappeared`:return`the file disappeared; retry to check its current state`;case`unreadable`:return`the file could not be read; check that the path is accessible, then retry`;default:throw Error(`unhandled configuration file decline reason: ${e}`)}}function xa(e){for(let t of e.split(`
327
327
  `)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function Sa(e){let t=(e.match(/\r\n/g)??[]).length;return t!==0&&t>=(e.match(/\n/g)??[]).length-t}function Ca(e){try{return We(e).mode&511}catch{return}}function wa(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
328
328
  `)?`\r
329
329
  `:`
@@ -689,5 +689,5 @@ export default function okBridge(pi: {
689
689
  `));let g=`${s?``:``}${m}`;return g!==o&&C(e,g,{mode:Ca(e)}),a&&g===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const _o=e=>e!==`project`,vo=e=>e!==`user`;async function yo(){let e=await Ma({message:`Where should the MCP server be configured?
690
690
  `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function bo(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??yo)():`both`}async function xo(e){return La({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function So(e){if(e.sharing!==void 0)return e.sharing;let t=Ki(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??xo)(t):t}var Co=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function wo(e){if(e===void 0||e===!0)return new Set(we);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(me.filter(e=>t.includes(e)))}function To(e,t,n){let r=N(n,e),i;try{i=We(r)}catch(e){let t=e.code;throw t===`ENOENT`?new Co(`--content-dir path does not exist: ${r}`):new Co(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new Co(`--content-dir must be a directory: ${r}`);let a=Eo(t),o=Eo(r),s=M(a,o);if(s.startsWith(`..`)||Ne(s))throw new Co(`--content-dir must be inside the project root (${t}); got ${r}`);return s===``?`.`:s}function Eo(e){try{return He(e)}catch{return e}}const Do=`open-knowledge-ui`;function Oo(e,t,n){try{let r=e.detectPath?.(t,n)??A(e.configPath(t,n));return I(r)}catch{return!1}}function ko(e,t,n){try{let r=N(A(e.configPath(t,n))),i=N(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+P)}catch{return!1}}function Ao(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!I(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||ko(e,t,r);if(!i&&c&&!Oo(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{oa(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Mo(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||ze(A(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{Te(`${o}.lock`,()=>{let t=Xa(o).writePath;if(s||ze(A(t),{recursive:!0}),e.format===`toml`){let r=po(Hr(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=go(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=fo(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const jo={pi:Ha};function Mo(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=jo[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{ze(A(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{Te(`${t}.lock`,()=>{let e=null;try{e=L(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}C(t,c,e===null?void 0:{mode:Ca(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function No(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!I(n)))return{editorId:e.id,label:e.label,path:n}}async function Po(e){let t=zi(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>Ao(t,``,n,e.home))}function Fo(e,t,n,r){let i=Lo(e,t,n,r);return i.kind===`present`?i.entry:null}function Io(e,t,n,r){let i=uo(e,t,r);if(!k(i))return{kind:`no-entry`};let a=i[n];return k(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Lo(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!I(i))return{kind:`absent`};try{if(We(i).size>io)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:ya(e)}}let a;try{a=L(i,`utf-8`)}catch(e){return{kind:`decline`,reason:ya(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Va(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=Hr().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Io(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,J.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Io(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=$a(a);return s?eo(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Io(S(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ro(e={}){let t=N(e.cwd??process.cwd()),n=Ga(t,{homeDir:e.home}),i=n.projectRoot;if(ee(i,e.home??R()))throw new re(i);let a=!I(j(i,`.ok`)),o=n.gitRootPromoted?M(i,t):void 0,s=e.contentDir===void 0?n.defaultContentDir:To(e.contentDir,i,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${i}`):n.gitRootPromoted&&a&&s===`.`&&process.stderr.write(`${D(`[ok] Content scope promoted to the git repo root: ${i}`)}\n Ran in ${o}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${o} in .ok/config.yml.\n`);let c={mode:e.devMcp?`dev`:`published`},l=await te(i),u;try{u=fe(i,{contentDir:s})}catch(t){let r=$.claude.configPath(i,e.home);return{projectRoot:i,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:l.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:r,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let d=u.created.includes(De),f=!1;if(l.didInit)try{f=Se(i)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${i}: ${e instanceof Error?e.message:String(e)}`)}try{ie(i)===`removed`&&console.warn(`[ok] Removed the OpenKnowledge project-skill lines from .gitignore. The skill is ordinary project content now — commit it if your team wants it on clone.`)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore cleanup at ${i}: ${e instanceof Error?e.message:String(e)}`)}let p=await bo({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),m=e.editors??Wo(i,e.home),h=e.editors??m,g=zi(m),_=zi(h),v=e.mcp===!1||p===null,y=Array.from(new Map([...g,...v?[]:_].map(e=>[e.id,e])).values()),b=g.filter(t=>Oo(t,i,e.home)),x=[],S=[],ne=new Set;for(let t of y){if(v){let n=``;try{n=t.configPath(i,e.home)}catch{}x.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(i)});continue}if(_o(p)&&g.includes(t)&&t.scope===`global`&&x.push(Ao(t,i,c,e.home)),vo(p)&&_.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(i),r=Ao(t,i,c,e.home,n);x.push(r),(r.action===`written`||r.action===`overwritten`)&&ne.add(n)}}let ae=new Set;for(let t of _){let n=t.projectSkillPath?.(i);!n||ae.has(n)||(ae.add(n),S.push(_a(t,i,{home:e.home})))}let C=ga(i,_.map(e=>e.id));C&&S.push(C);let oe=S.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(oe.length>0){let t=e.home??R();he({source:r,skills:[xe.project],agents:oe,scope:i},{home:t,enabled:_e(t).enabled})}let ce=!v&&p!==null&&vo(p)?_.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,le=v?[]:b.map(e=>No(e,i)).filter(e=>e!==void 0).filter(e=>!ne.has(e.path)),ue=e.installUserSkill??se,pe=e.home??R(),ge=wo(e.skills),ye=!1,be=!1,Ce=!1,we=!1,Te=!1;for(let t of me){if(!ge.has(t))continue;await ve(pe,xe[t],!0).catch(()=>{}),ye=!0;let n=await ue({home:e.home,bundleId:t,force:!0});n===`installed`?be=!0:n===`failed`?Ce=!0:n===`no-hosts`?Te=!0:we=!0}let w=Ce?`failed`:be?`installed`:ye&&we?`skip-current`:ye&&Te?`no-hosts`:`declined`,T=be?de(pe).map(e=>e.editorId):[],E=v?`skipped-flag`:`skipped-missing`,Ee=x.find(e=>e.editorId===`claude`)??x[0]??{action:E,configPath:$.claude.configPath(i,e.home)},O=await zo({projectRoot:i,desiredMode:await So({sharing:e.sharing,projectRoot:i,isTTY:e.isTTY,freshProject:a,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:i,contentCreated:u.created,contentUpdated:u.updated,contentSkipped:u.skipped,editors:x,projectSkills:S,legacyProjectConfigs:le,skillInstall:w,skillHosts:T,didGitInit:l.didInit,rootGitignoreCreated:f,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDir:d?s:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:Ee.action,mcpPath:Ee.configPath,mcpError:`error`in Ee?Ee.error:void 0,projectScopeUnsupportedLabels:ce,sharing:O}}async function zo(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Ki(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=Hi(t);if(n===`local-only`){let e=Wi(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Bo(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Gi(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Bo(t,o,`remove`)}function Bo(e,t,n){let r=Ki(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.removed}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Vo(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions`;case`unresolved-symlink`:return`could not resolve the path or symlink; check permissions and symlink cycles`;case`not-a-file`:return`config path is not a regular file`;case`disappeared`:return`config disappeared while being read; retry to check its current state`;case`unreadable`:return`could not read the config file; check that the path is accessible`;case`unparseable`:return`config could not be parsed`;case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;case void 0:return`config not readable`;default:throw Error(`unhandled MCP decline reason: ${e}`)}}function Ho(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=j(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(O(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(O(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0){if(n.push(O(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`)}else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(O(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(O(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?M(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${E(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${E(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${Ee(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Vo(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(O(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?M(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${Ee(`FAILED`)}: ${r.error}`)}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${M(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(O(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>X[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${E(`installed for ${r}`)}`),n.push(` ${T(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${T(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${T(`skipped for this run (--no-skills)`)}`),n.push(` ${T(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${T(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${T(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${T(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${D(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${D(` ok repair-skills`)}`)}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(D(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(D(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(Oe(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...qo(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${E(`✓`)} ${O(`Next steps:`)}`),n.push(` 1. Open your editor (${w(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${w(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${w(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
691
691
  `)}function Uo(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Wo(e,t){let n=[];for(let r of Wr)r!==`claude-desktop`&&Oo($[r],e,t)&&n.push(r);return n}function Go(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Ke(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Ko(){return new ut(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new ft(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new ft(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new ft(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Go():null;try{let r;try{r=await Ro({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof Co||e instanceof re){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof ae||e instanceof ue){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof ge){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
692
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-DwXDuEVO.mjs`),{resolveContentDir:s}=await import(`./dist-H727Mac0.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-BhHYpVzt.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Uo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Ho(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function qo(e,t){let n=[];switch(e.kind){case`applied`:return n.push(O(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${E(`local-only`)} — appended ${e.appended.length} path(s) to ${O(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${E(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${E(`local-only`)} — already excluded; nothing to do.`):n.push(` ${E(`local-only`)}`):e.action===`removed`?n.push(` ${E(`shared`)} — removed OK paths from ${O(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${E(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(D(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
692
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-BI5MbK2x.mjs`),{resolveContentDir:s}=await import(`./dist-DhGQyLku.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-DAraVn8e.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Uo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Ho(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function qo(e,t){let n=[];switch(e.kind){case`applied`:return n.push(O(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${E(`local-only`)} — appended ${e.appended.length} path(s) to ${O(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${E(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${E(`local-only`)} — already excluded; nothing to do.`):n.push(` ${E(`local-only`)}`):e.action===`removed`?n.push(` ${E(`shared`)} — removed OK paths from ${O(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${E(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(D(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
693
693
  `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${w(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(D(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${w(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${w(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(D(`Sharing mode unavailable: ${e.reason}.`));return n}}export{yi as $,wa as A,Wi as B,Ga as C,ut as Ct,Ma as D,La as E,oa as F,Ji as G,qi as H,sa as I,Wr as J,Ki as K,va as L,ya as M,aa as N,Ca as O,la as P,Z as Q,ua as R,Xa as S,St,Ba as T,ft as Tt,Ui as U,Qi as V,Hi as W,$ as X,X as Y,Gr as Z,Ro as _,Hn as _t,Uo as a,Si as at,Po as b,Jt as bt,Ho as c,Pi as ct,Oo as d,Hr as dt,vi as et,Fo as f,Y as ft,So as g,$n as gt,To as h,Pr as ht,zo as i,ii as it,ba as j,Sa as k,qo as l,ci as lt,bo as m,jr as mt,Do as n,xi as nt,Lo as o,Q as ot,wo as p,Mr as pt,Gi as q,jo as r,ti as rt,Wo as s,Ci as st,Co as t,bi as tt,Ko as u,Ur as ut,co as v,Qt as vt,Ha as w,ct as wt,ko as x,V as xt,Ao as y,Yt as yt,_a as z};
@@ -1 +1 @@
1
- import{Eo as e,No as t,ko as n}from"./dist-D0NB38wf.mjs";import{A as r,M as i,O as a}from"./init-t5VRZLwD.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-VW4DROhD.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:i(e)}}let g=[],_=n(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=e(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=r(h,[`configurations`,y]);return x?(t(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
1
+ import{Eo as e,No as t,ko as n}from"./dist-DeGSxFUJ.mjs";import{A as r,M as i,O as a}from"./init-__dFxXcd.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-D8sfQtGu.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:i(e)}}let g=[],_=n(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=e(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=r(h,[`configurations`,y]);return x?(t(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-Dbk8NaZV.mjs";export{e as loadConfig};
@@ -1 +1 @@
1
- import{Ol as e,cl as t,gl as n,no as r,ol as i,os as a,zu as o}from"./md-manager-BGnqyqi1-XuN_2HH6.mjs";import{Fo as s,Lo as c,x as l}from"./dist-D0NB38wf.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-DJMEHHjq.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=o();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(n){let o=n??process.cwd(),u=[],p=[],m=[],h=[],g=c(`user`,o),_=s({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(t,n=!1)=>{let a=v(t);if(a.diagnostic!==void 0&&p.push(a.diagnostic),a.value===null)return{};let o=i({value:a.value,file:a.path,source:a.source,doc:a.doc});p.push(...o),u.push(t);let s=o.length>0?e(a.value):a.value;return n&&h.push(...r({value:s,file:a.path,source:a.source,doc:a.doc})),s},x=f(o,`.ok`,d),S=b(x,!0),C=b(c(`project-local`,o)),w=a(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),n={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(t(n))}return{config:T.data,sources:u,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
1
+ import{Ol as e,cl as t,gl as n,no as r,ol as i,os as a,zu as o}from"./md-manager-BGnqyqi1-CTvRTh-G.mjs";import{Fo as s,Lo as c,x as l}from"./dist-DeGSxFUJ.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-B5vbbQ59.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=o();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(n){let o=n??process.cwd(),u=[],p=[],m=[],h=[],g=c(`user`,o),_=s({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(t,n=!1)=>{let a=v(t);if(a.diagnostic!==void 0&&p.push(a.diagnostic),a.value===null)return{};let o=i({value:a.value,file:a.path,source:a.source,doc:a.doc});p.push(...o),u.push(t);let s=o.length>0?e(a.value):a.value;return n&&h.push(...r({value:s,file:a.path,source:a.source,doc:a.doc})),s},x=f(o,`.ok`,d),S=b(x,!0),C=b(c(`project-local`,o)),w=a(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),n={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(t(n))}return{config:T.data,sources:u,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};