@inkeep/open-knowledge 0.68.9 → 0.68.11-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/{acp-harness-probe-D4fYUyLf.mjs → acp-harness-probe-DaYXqGxg.mjs} +2 -2
  2. package/dist/assets/skills/project/SKILL.md +3 -3
  3. package/dist/{chunk-KX3P26DQ-KA7oOKfS.mjs → chunk-KX3P26DQ-Bp2m2ndV.mjs} +2 -2
  4. package/dist/cli.mjs +6 -6
  5. package/dist/constants-jyYwGmDC.mjs +2 -0
  6. package/dist/index.d.mts +1 -1
  7. package/dist/index.mjs +50 -50
  8. package/dist/init-CBEFRP85.mjs +1 -0
  9. package/dist/{init-Q6vQQIvo.mjs → init-_7R63fwz.mjs} +3 -3
  10. package/dist/{launch-json-removal-BLsICseK.mjs → launch-json-removal-B28FsoE2.mjs} +2 -2
  11. package/dist/loader-Bz5cS92c.mjs +1 -0
  12. package/dist/{loader-V75vJygF.mjs → loader-C4UW1MW5.mjs} +2 -2
  13. package/dist/{open-browser-DmtCotYQ.mjs → open-browser-H-QKQd10.mjs} +2 -2
  14. package/dist/preview-26pLGThq.mjs +1 -0
  15. package/dist/{preview-rS6YMAKu.mjs → preview-DKtYHQbM.mjs} +2 -2
  16. package/dist/public/assets/{ActivityModeContent-iAy7Htyr.js → ActivityModeContent-C9Z839EN.js} +1 -1
  17. package/dist/public/assets/{AddPropertiesButton-BKA885SM.js → AddPropertiesButton-DSQKtGW9.js} +2 -2
  18. package/dist/public/assets/{AgentDiffPane-C7KIvUPF.js → AgentDiffPane-Cu3m0Lib.js} +1 -1
  19. package/dist/public/assets/{BugReportHistoryDialog-Cdci6g1O.js → BugReportHistoryDialog-BO92hFGg.js} +1 -1
  20. package/dist/public/assets/{CodeMirrorPropInput-cqsfRNDV.js → CodeMirrorPropInput-CRa8tGX-.js} +1 -1
  21. package/dist/public/assets/{ConsentDialogBody-BHbzcNb7.js → ConsentDialogBody-Bu8u9p1a.js} +2 -2
  22. package/dist/public/assets/{DocumentContext-DOMEoUbL.js → DocumentContext-BdZiErvh.js} +1 -1
  23. package/dist/public/assets/{EditorModeToggle-cEaO7U1B.js → EditorModeToggle-DYldyVnC.js} +1 -1
  24. package/dist/public/assets/{EnableSyncConfirmDialog-CxKyhSRR.js → EnableSyncConfirmDialog-N_l5NwWg.js} +1 -1
  25. package/dist/public/assets/{ExcalidrawDocEditor-Bw1wZL5r.js → ExcalidrawDocEditor-CFg6aGVN.js} +1 -1
  26. package/dist/public/assets/FeedbackForm-CnwouVSg.js +1 -0
  27. package/dist/public/assets/{ImportSkillDialog-BHRZuf__.js → ImportSkillDialog-DOKtVFqO.js} +1 -1
  28. package/dist/public/assets/{LintConfigEditor-DaQG-dlP.js → LintConfigEditor-SzAKIf-P.js} +1 -1
  29. package/dist/public/assets/{ManagedArtifactProperties-BDuoxjvO.js → ManagedArtifactProperties-8E5SQSnI.js} +1 -1
  30. package/dist/public/assets/ManagedArtifactProperties-DyQXtUCs.js +1 -0
  31. package/dist/public/assets/{McpConsentDialogBody-CS-c374d.js → McpConsentDialogBody-D3q7WAev.js} +1 -1
  32. package/dist/public/assets/{Mermaid-mq736Zb_.js → Mermaid-Cw1EnMJu.js} +1 -1
  33. package/dist/public/assets/{MermaidDocEditor-DudmyU3i.js → MermaidDocEditor-C-qlUZje.js} +1 -1
  34. package/dist/public/assets/{PropertyDisplayRow-C9iyg7W9.js → PropertyDisplayRow-CBiQBnOL.js} +1 -1
  35. package/dist/public/assets/{ReportBugDialogBody-t1LnS7cf.js → ReportBugDialogBody-B4Ph81pw.js} +2 -2
  36. package/dist/public/assets/{ReportBugMenuTrigger-BaIKHhOn.js → ReportBugMenuTrigger-D7aC0OiR.js} +2 -2
  37. package/dist/public/assets/{SchemaConfigEditor-BLIfeCsm.js → SchemaConfigEditor-DGBRJY7Q.js} +1 -1
  38. package/dist/public/assets/{SessionsHost-DuAZF3Zj.js → SessionsHost-CrnQRViT.js} +2 -2
  39. package/dist/public/assets/{SettingsDialogBody-txHlPNWp.js → SettingsDialogBody-DnEGrTMq.js} +1 -1
  40. package/dist/public/assets/{ShareBranchSwitchDialog-CgntPdis.js → ShareBranchSwitchDialog-Cgkl3a5v.js} +1 -1
  41. package/dist/public/assets/{ShareReceiveDialog-C5Rig4O-.js → ShareReceiveDialog-6TxrHOIU.js} +1 -1
  42. package/dist/public/assets/{ShareReceiveMissDialog-D6-ck0Uu.js → ShareReceiveMissDialog-BCkm-E10.js} +1 -1
  43. package/dist/public/assets/{SkillForkDialog-D2HU42pf.js → SkillForkDialog-Bhq9zhtY.js} +1 -1
  44. package/dist/public/assets/{SkillInstallMenu-Bcy54X0U.js → SkillInstallMenu-D3KWfbhA.js} +1 -1
  45. package/dist/public/assets/{SkillOriginInline-CwgwWmps.js → SkillOriginInline-CaEMp81T.js} +2 -2
  46. package/dist/public/assets/{SkillToolbarControls-B8Ab7ngc.js → SkillToolbarControls-tpuUyOLu.js} +1 -1
  47. package/dist/public/assets/{SkillUpdateConflictDialog-AerOBYmk.js → SkillUpdateConflictDialog-Cbj5JNXp.js} +1 -1
  48. package/dist/public/assets/SlidesToolbarControls-DWqUzkgL.js +1 -0
  49. package/dist/public/assets/{SourceEditor-CrOhJB84.js → SourceEditor-D_IY9GyQ.js} +1 -1
  50. package/dist/public/assets/{TerminalWindowApp-BP8AoRew.js → TerminalWindowApp-CwExuljm.js} +1 -1
  51. package/dist/public/assets/{TextDocEditor-BOdJgOXT.js → TextDocEditor-DAcD7hS1.js} +1 -1
  52. package/dist/public/assets/{ThreadView-BsHCDmQB.js → ThreadView-Dv-MJgLn.js} +1 -1
  53. package/dist/public/assets/{TimelineDiffPane-DDVqWMSH.js → TimelineDiffPane-G1nycx_c.js} +1 -1
  54. package/dist/public/assets/{agent-diff-store-CQtqUq4i.js → agent-diff-store-Bln_lxtD.js} +1 -1
  55. package/dist/public/assets/{alert-dialog-BFfs04J5.js → alert-dialog-DLAYZZMu.js} +2 -2
  56. package/dist/public/assets/{auth-state-cache-CgquP1B2.js → auth-state-cache-BLGrQ86G.js} +4 -4
  57. package/dist/public/assets/client-version-CXZnsz8b.js +1 -0
  58. package/dist/public/assets/{comment-chips-CNyMXpWs.js → comment-chips-Bm8WWDT7.js} +1 -1
  59. package/dist/public/assets/{config-provider-qLyaitI2.js → config-provider-BvIhxk0G.js} +1 -1
  60. package/dist/public/assets/{dialog-CCHt-oLh.js → dialog-_kqu_91M.js} +1 -1
  61. package/dist/public/assets/{globals-ByagJMEb.css → globals-DeOHYo0q.css} +1 -1
  62. package/dist/public/assets/{index-r_qRX3GR.js → index-BLB78i4B.js} +9 -9
  63. package/dist/public/assets/{pending-receive-nav-store-BwS0HcBd.js → pending-receive-nav-store-BtQaH8Ow.js} +1 -1
  64. package/dist/public/assets/{progress-CzJ7mESr.js → progress-DKwbAv_d.js} +1 -1
  65. package/dist/public/assets/{selection-context-DI5wlbAC.js → selection-context-BBTm-UVn.js} +1 -1
  66. package/dist/public/assets/{src-CgbeuLkc.js → src-BBEwVksN.js} +1 -1
  67. package/dist/public/assets/{telemetry-impl-CPT6yQPK.js → telemetry-impl-B_63zFxn.js} +1 -1
  68. package/dist/public/assets/{telemetry-startup-BmgX6zXI.js → telemetry-startup-BMrCBn-y.js} +1 -1
  69. package/dist/public/assets/{typing-burst-detector-CFwuUzqv.js → typing-burst-detector-D-RxXAZt.js} +1 -1
  70. package/dist/public/assets/{uninstall-DAfbja6D.js → uninstall-C645M4Nr.js} +1 -1
  71. package/dist/public/assets/{use-activity-panel-DDXrfY-K.js → use-activity-panel-TaOc5fsr.js} +1 -1
  72. package/dist/public/assets/{use-open-skill--yVdWHLf.js → use-open-skill-BfikAHGm.js} +1 -1
  73. package/dist/public/assets/{use-terminal-enabled-DWnQ-hY2.js → use-terminal-enabled-f6uI67oZ.js} +1 -1
  74. package/dist/public/assets/{use-timeline-entry-diff-BLDu0nkY.js → use-timeline-entry-diff-DEsOnT79.js} +1 -1
  75. package/dist/public/index.html +25 -25
  76. package/dist/public/uninstall.html +3 -3
  77. package/dist/{repair-launch-json-CGyPEMBX.mjs → repair-launch-json-O0pvONvJ.mjs} +2 -2
  78. package/dist/{repair-mcp-configs-Do0L2PKW.mjs → repair-mcp-configs-BFtKKOXF.mjs} +2 -2
  79. package/dist/repair-skills-BkLHvKTk.mjs +1 -0
  80. package/dist/{repair-skills-TrS-7N9q.mjs → repair-skills-zu7vM_05.mjs} +2 -2
  81. package/dist/{resolve-project-root-CLNohNKz.mjs → resolve-project-root-dt8lYC9W.mjs} +2 -2
  82. package/dist/{skill-teardown-DvGC-0MI.mjs → skill-teardown-DUZd_juy.mjs} +2 -2
  83. package/dist/{src-C4D-_N3T.mjs → src-CT7Wk-MG.mjs} +1 -1
  84. package/dist/{src-Dim30w_Y.mjs → src-D5pqfubu.mjs} +2 -2
  85. package/dist/src-e2udu2Rw.mjs +2045 -0
  86. package/dist/src-y6vbbp7M.mjs +1 -0
  87. package/dist/start-BoiJ1XmS.mjs +1 -0
  88. package/dist/{start-CdH7_XQz.mjs → start-DET7Qj8h.mjs} +3 -3
  89. package/package.json +4 -4
  90. package/dist/constants-IMtjOwCu.mjs +0 -2
  91. package/dist/init-DCwOjemd.mjs +0 -1
  92. package/dist/loader-C2hBS-vl.mjs +0 -1
  93. package/dist/preview-gyu5corn.mjs +0 -1
  94. package/dist/public/assets/FeedbackForm-D0S2l1ev.js +0 -1
  95. package/dist/public/assets/ManagedArtifactProperties-BpjEvg_3.js +0 -1
  96. package/dist/public/assets/SlidesToolbarControls-Dz6effyN.js +0 -1
  97. package/dist/public/assets/client-version-BEh3tGFq.js +0 -1
  98. package/dist/repair-skills-zn5HSgoM.mjs +0 -1
  99. package/dist/src-BTBVMfJ4.mjs +0 -2045
  100. package/dist/src-R2F0BHsn.mjs +0 -1
  101. package/dist/start-cQx7qTAb.mjs +0 -1
  102. /package/dist/public/assets/{globals-DIT-uAXH.js → globals--7ibIAoz.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{t as e}from"./launch-json-removal-BLsICseK.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
- //# sourceMappingURL=repair-launch-json-CGyPEMBX.mjs.map
1
+ import{t as e}from"./launch-json-removal-B28FsoE2.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
+ //# sourceMappingURL=repair-launch-json-O0pvONvJ.mjs.map
@@ -1,2 +1,2 @@
1
- import{Ho as e}from"./src-B2bAQ64a.mjs";import{a as t,m as n,s as r}from"./resolve-project-root-CLNohNKz.mjs";import{d as i,v as a}from"./init-Q6vQQIvo.mjs";import{t as o}from"./mcp-migrate-event-9DFnNzHa.mjs";import{homedir as s}from"node:os";function c(e){let n=e.logger??d,i=e.home??s(),a=[];if(e.reclaimDisableEnv===`1`)return n({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=r[o],s=l(()=>t.configPath(``,i));if(s!==null&&a.push(u({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:n})),t.projectConfigPath){let r=t.projectConfigPath,i=l(()=>r(e.projectDir));i!==null&&a.push(u({scope:`project`,editorId:o,target:t,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:n}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function l(e){try{return e()}catch{return null}}function u(t){let r={scope:t.scope,editorId:t.editorId,configPath:t.configPath},s=i(t.target,t.cwd,t.home,t.configPathOverride);if(s===null)return{...r,outcome:`no-entry`};if(t.editorId===`pi`){if(n(s))return{...r,outcome:`canonical`}}else{let n=e(s);if(n.kind===`recognized`&&n.disposition===`keep`)return{...r,outcome:`canonical`};if(n.kind===`declined`&&t.scope===`project`)return t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:n.reason}),{...r,outcome:`declined`,reason:n.reason}}t.logger(o({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:s}));let c=a(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(c.action===`failed`){let e=c.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...r,outcome:`write-failed`,error:e}}return c.action===`declined`?(t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:c.declineReason}),{...r,outcome:`declined`}):{...r,outcome:`repaired`}}function d(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{c as repairMcpConfigs};
2
- //# sourceMappingURL=repair-mcp-configs-Do0L2PKW.mjs.map
1
+ import{Ho as e}from"./src-B2bAQ64a.mjs";import{a as t,m as n,s as r}from"./resolve-project-root-dt8lYC9W.mjs";import{d as i,v as a}from"./init-_7R63fwz.mjs";import{t as o}from"./mcp-migrate-event-9DFnNzHa.mjs";import{homedir as s}from"node:os";function c(e){let n=e.logger??d,i=e.home??s(),a=[];if(e.reclaimDisableEnv===`1`)return n({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=r[o],s=l(()=>t.configPath(``,i));if(s!==null&&a.push(u({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:n})),t.projectConfigPath){let r=t.projectConfigPath,i=l(()=>r(e.projectDir));i!==null&&a.push(u({scope:`project`,editorId:o,target:t,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:n}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function l(e){try{return e()}catch{return null}}function u(t){let r={scope:t.scope,editorId:t.editorId,configPath:t.configPath},s=i(t.target,t.cwd,t.home,t.configPathOverride);if(s===null)return{...r,outcome:`no-entry`};if(t.editorId===`pi`){if(n(s))return{...r,outcome:`canonical`}}else{let n=e(s);if(n.kind===`recognized`&&n.disposition===`keep`)return{...r,outcome:`canonical`};if(n.kind===`declined`&&t.scope===`project`)return t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:n.reason}),{...r,outcome:`declined`,reason:n.reason}}t.logger(o({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:s}));let c=a(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(c.action===`failed`){let e=c.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...r,outcome:`write-failed`,error:e}}return c.action===`declined`?(t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:c.declineReason}),{...r,outcome:`declined`}):{...r,outcome:`repaired`}}function d(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{c as repairMcpConfigs};
2
+ //# sourceMappingURL=repair-mcp-configs-BFtKKOXF.mjs.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./repair-skills-zu7vM_05.mjs";export{e as repairSkills};
@@ -1,4 +1,4 @@
1
- import{X as e,ls as t}from"./src-B2bAQ64a.mjs";import{En as n,Lr as r,Mr as i,Nr as a,Or as o,Pr as s,hi as c,kr as l,xi as u,yi as d}from"./src-BTBVMfJ4.mjs";import{c as f,n as p,s as m,x as h}from"./resolve-project-root-CLNohNKz.mjs";import{n as g,s as _,t as v}from"./colors-DSyAT9Cz.mjs";import{n as y,r as b,t as x}from"./skill-teardown-DvGC-0MI.mjs";import{basename as S,dirname as C,join as w,relative as T,resolve as E}from"node:path";import{existsSync as D,mkdirSync as O,readFileSync as k,readdirSync as A,rmSync as j,statSync as M,writeFileSync as N}from"node:fs";import{homedir as P}from"node:os";import{createInterface as F}from"node:readline/promises";const I={existsSync:e=>D(e),isDirectory:e=>{try{return M(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>A(e),readFileSync:e=>k(e),writeFileSync:(e,t)=>{N(e,t)},mkdirSync:(e,t)=>{O(e,t)},rmSync:(e,t)=>{j(e,t)}},L={resolveProjectBundledSkillDir:()=>c(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>c(e,{checkDesktop:!1}),readBundledVersion:()=>l(),readRecordedVersion:e=>i(e,`cli-hosts`),writeRecordedVersion:(e,t)=>s(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>r(e),readBundleDecision:(e,t)=>o(e,t),writeBundleDecision:(e,t,n)=>a(e,t,n),removeBundleFromDisk:(e,t)=>b(e,t)};function R(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function z(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(C(t),{recursive:!0}),B(e,t,n)}function B(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=w(e,r),a=w(t,r);n.isDirectory(i)?B(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function V(e,n,r){return r.existsSync(w(e,`.agents`,`skills`,n))||t.some(t=>r.existsSync(w(e,t.skillsRoot,n)))}function H(e,n,r,i,a,o){let s=[],c=w(e,`.agents`,`skills`,n);if(V(e,n,i)){i.existsSync(c)&&s.push({kind:`central`,path:c,outcome:`skipped-present`});for(let r of t){let t=w(e,r.skillsRoot,n);if(t!==c){if(!i.existsSync(w(e,r.hostDir))){s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-host-absent`});continue}i.existsSync(t)&&s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-present`})}}return{entries:s,anyWritten:!1,anyDestinationSucceeded:!0}}let l=i.existsSync(w(e,`.agents`));if(l&&i.existsSync(c))s.push({kind:`central`,path:c,outcome:`skipped-present`});else if(l)try{z(r,c,i),s.push({kind:`central`,path:c,outcome:`written`}),a({event:`user-skill-reclaim-central-written`,scope:`user`,path:c,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`central`,path:c,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-central-failed`,scope:`user`,path:c,error:t})}for(let l of t){let t=w(e,l.hostDir),u=w(e,l.skillsRoot,n);if(u===c){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!i.existsSync(t)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(i.existsSync(u)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-present`});continue}try{z(r,u,i),s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`written`}),a({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,error:t})}}return{entries:s,anyWritten:s.some(e=>e.outcome===`written`),anyDestinationSucceeded:s.some(e=>e.outcome===`written`||e.outcome===`skipped-present`)}}function U(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function W(e,t,r,i){if(!e||!t)return!1;let a;try{a=e.configPath(r,i)}catch{return!1}let o=e=>w(n(C(e)),S(e));return o(t)===o(a)}function G(e,t,n,r,i){let a;try{a=n.resolveProjectBundledSkillDir()}catch(e){return i({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let o=[];for(let n of f){let s=w(e,n.hostDir,`skills`,`open-knowledge`),c=w(s,`SKILL.md`);if(r.existsSync(c)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`present`});continue}let l=m[n.editorId],u=l?.projectConfigPath?.(e);if(W(l,u,e,t)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`skipped-global-collision`}),i({event:`project-skill-reclaim-skipped-global-collision`,scope:`project`,editorId:n.editorId,path:s});continue}if(!U(u,r)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`no-token`}),i({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:n.editorId,path:s});continue}try{p(s,e),z(a,s,r),o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`created`}),i({event:`project-skill-reclaim-created`,scope:`project`,editorId:n.editorId,path:s})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`failed`,error:t}),i({event:`project-skill-reclaim-failed`,scope:`project`,editorId:n.editorId,path:s,error:t})}}return{outcome:`done`,entries:o}}async function K(t,n,r,i){let a=e=>{n.recordEvent(e).catch(()=>{})},o=()=>new Date().toISOString(),s;try{s=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let c;try{c=await n.readRecordedVersion(t)}catch(e){i({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),c=null}let l=[],f=null;for(let e of u)try{l.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(l.length===0)return i({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),a({ts:o(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let a of l){let o=d[a.id],s=V(t,o,r),c=await n.readBundleDecision(t,o).catch(()=>null);if(!e(c,{installedOnDisk:s})){if(s)try{n.removeBundleFromDisk(t,a.id),i({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:a.id})}catch(e){i({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:a.id,error:e instanceof Error?e.message:String(e)})}continue}if(c===null&&s)try{await n.writeBundleDecision(t,o,!0)}catch(e){i({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:a.id,error:e instanceof Error?e.message:String(e)})}p.push(a)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>V(t,d[e.id],r));if(c!==null&&c===s&&m)return i({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:s}),{outcome:`skipped`,reason:`version-current`};let h=[],g=l.length===u.length,_=[];for(let{id:e,sourceDir:n}of p){let a=H(t,d[e],n,r,i,s);h.push(...a.entries),_.push({id:e,anyWritten:a.anyWritten,landed:a.anyDestinationSucceeded,centralFailed:a.entries.some(e=>e.kind===`central`&&e.outcome===`failed`),hostFailed:a.entries.some(e=>e.kind===`host`&&e.outcome===`failed`)})}let v=_.some(e=>e.centralFailed),y=_.every(e=>e.landed);if(g&&y&&!v){let e=null;try{await n.writeRecordedVersion(t,s),i({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:s})}catch(t){e=t instanceof Error?t.message:String(t),i({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:s,error:e})}for(let{id:t,anyWritten:n}of _)a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?n?`installed`:`skip-current`:`failed`,version:s,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{g||a({ts:o(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:s,reason:`bundle-unresolved`});for(let{id:e,centralFailed:t,hostFailed:n}of _)!t&&!n||a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:`failed`,version:s,reason:n?`all-writes-failed`:`central-write-failed`})}return{outcome:`done`,version:s,entries:h}}async function q(e){let t=e.logger??R,n=e.fs??I,r=e.home??P(),i={...L,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=G(e.projectDir,r,i,n,t),o=await K(r,i,n,t),s=y(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=x(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function J(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function Y(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`present`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length,o=e.project.entries.filter(e=>e.outcome===`skipped-global-collision`).length;t.push(` Project: ${n} present, ${r} created, ${i} no-token, ${a} failed.`),o>0&&t.push(` Skipped ${o} host(s) whose project config path is their user-global config (not a project directory).`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-present`).length,i=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,a=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} present, ${i} skipped, ${a} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
1
+ import{X as e,ls as t}from"./src-B2bAQ64a.mjs";import{En as n,Lr as r,Mr as i,Nr as a,Or as o,Pr as s,hi as c,kr as l,xi as u,yi as d}from"./src-e2udu2Rw.mjs";import{c as f,n as p,s as m,x as h}from"./resolve-project-root-dt8lYC9W.mjs";import{n as g,s as _,t as v}from"./colors-DSyAT9Cz.mjs";import{n as y,r as b,t as x}from"./skill-teardown-DUZd_juy.mjs";import{basename as S,dirname as C,join as w,relative as T,resolve as E}from"node:path";import{existsSync as D,mkdirSync as O,readFileSync as k,readdirSync as A,rmSync as j,statSync as M,writeFileSync as N}from"node:fs";import{homedir as P}from"node:os";import{createInterface as F}from"node:readline/promises";const I={existsSync:e=>D(e),isDirectory:e=>{try{return M(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>A(e),readFileSync:e=>k(e),writeFileSync:(e,t)=>{N(e,t)},mkdirSync:(e,t)=>{O(e,t)},rmSync:(e,t)=>{j(e,t)}},L={resolveProjectBundledSkillDir:()=>c(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>c(e,{checkDesktop:!1}),readBundledVersion:()=>l(),readRecordedVersion:e=>i(e,`cli-hosts`),writeRecordedVersion:(e,t)=>s(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>r(e),readBundleDecision:(e,t)=>o(e,t),writeBundleDecision:(e,t,n)=>a(e,t,n),removeBundleFromDisk:(e,t)=>b(e,t)};function R(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function z(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(C(t),{recursive:!0}),B(e,t,n)}function B(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=w(e,r),a=w(t,r);n.isDirectory(i)?B(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function V(e,n,r){return r.existsSync(w(e,`.agents`,`skills`,n))||t.some(t=>r.existsSync(w(e,t.skillsRoot,n)))}function H(e,n,r,i,a,o){let s=[],c=w(e,`.agents`,`skills`,n);if(V(e,n,i)){i.existsSync(c)&&s.push({kind:`central`,path:c,outcome:`skipped-present`});for(let r of t){let t=w(e,r.skillsRoot,n);if(t!==c){if(!i.existsSync(w(e,r.hostDir))){s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-host-absent`});continue}i.existsSync(t)&&s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-present`})}}return{entries:s,anyWritten:!1,anyDestinationSucceeded:!0}}let l=i.existsSync(w(e,`.agents`));if(l&&i.existsSync(c))s.push({kind:`central`,path:c,outcome:`skipped-present`});else if(l)try{z(r,c,i),s.push({kind:`central`,path:c,outcome:`written`}),a({event:`user-skill-reclaim-central-written`,scope:`user`,path:c,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`central`,path:c,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-central-failed`,scope:`user`,path:c,error:t})}for(let l of t){let t=w(e,l.hostDir),u=w(e,l.skillsRoot,n);if(u===c){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!i.existsSync(t)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(i.existsSync(u)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-present`});continue}try{z(r,u,i),s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`written`}),a({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,error:t})}}return{entries:s,anyWritten:s.some(e=>e.outcome===`written`),anyDestinationSucceeded:s.some(e=>e.outcome===`written`||e.outcome===`skipped-present`)}}function U(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function W(e,t,r,i){if(!e||!t)return!1;let a;try{a=e.configPath(r,i)}catch{return!1}let o=e=>w(n(C(e)),S(e));return o(t)===o(a)}function G(e,t,n,r,i){let a;try{a=n.resolveProjectBundledSkillDir()}catch(e){return i({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let o=[];for(let n of f){let s=w(e,n.hostDir,`skills`,`open-knowledge`),c=w(s,`SKILL.md`);if(r.existsSync(c)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`present`});continue}let l=m[n.editorId],u=l?.projectConfigPath?.(e);if(W(l,u,e,t)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`skipped-global-collision`}),i({event:`project-skill-reclaim-skipped-global-collision`,scope:`project`,editorId:n.editorId,path:s});continue}if(!U(u,r)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`no-token`}),i({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:n.editorId,path:s});continue}try{p(s,e),z(a,s,r),o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`created`}),i({event:`project-skill-reclaim-created`,scope:`project`,editorId:n.editorId,path:s})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`failed`,error:t}),i({event:`project-skill-reclaim-failed`,scope:`project`,editorId:n.editorId,path:s,error:t})}}return{outcome:`done`,entries:o}}async function K(t,n,r,i){let a=e=>{n.recordEvent(e).catch(()=>{})},o=()=>new Date().toISOString(),s;try{s=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let c;try{c=await n.readRecordedVersion(t)}catch(e){i({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),c=null}let l=[],f=null;for(let e of u)try{l.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(l.length===0)return i({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),a({ts:o(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let a of l){let o=d[a.id],s=V(t,o,r),c=await n.readBundleDecision(t,o).catch(()=>null);if(!e(c,{installedOnDisk:s})){if(s)try{n.removeBundleFromDisk(t,a.id),i({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:a.id})}catch(e){i({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:a.id,error:e instanceof Error?e.message:String(e)})}continue}if(c===null&&s)try{await n.writeBundleDecision(t,o,!0)}catch(e){i({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:a.id,error:e instanceof Error?e.message:String(e)})}p.push(a)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>V(t,d[e.id],r));if(c!==null&&c===s&&m)return i({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:s}),{outcome:`skipped`,reason:`version-current`};let h=[],g=l.length===u.length,_=[];for(let{id:e,sourceDir:n}of p){let a=H(t,d[e],n,r,i,s);h.push(...a.entries),_.push({id:e,anyWritten:a.anyWritten,landed:a.anyDestinationSucceeded,centralFailed:a.entries.some(e=>e.kind===`central`&&e.outcome===`failed`),hostFailed:a.entries.some(e=>e.kind===`host`&&e.outcome===`failed`)})}let v=_.some(e=>e.centralFailed),y=_.every(e=>e.landed);if(g&&y&&!v){let e=null;try{await n.writeRecordedVersion(t,s),i({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:s})}catch(t){e=t instanceof Error?t.message:String(t),i({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:s,error:e})}for(let{id:t,anyWritten:n}of _)a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?n?`installed`:`skip-current`:`failed`,version:s,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{g||a({ts:o(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:s,reason:`bundle-unresolved`});for(let{id:e,centralFailed:t,hostFailed:n}of _)!t&&!n||a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:`failed`,version:s,reason:n?`all-writes-failed`:`central-write-failed`})}return{outcome:`done`,version:s,entries:h}}async function q(e){let t=e.logger??R,n=e.fs??I,r=e.home??P(),i={...L,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=G(e.projectDir,r,i,n,t),o=await K(r,i,n,t),s=y(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=x(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function J(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function Y(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`present`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length,o=e.project.entries.filter(e=>e.outcome===`skipped-global-collision`).length;t.push(` Project: ${n} present, ${r} created, ${i} no-token, ${a} failed.`),o>0&&t.push(` Skipped ${o} host(s) whose project config path is their user-global config (not a project directory).`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-present`).length,i=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,a=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} present, ${i} skipped, ${a} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
2
2
  `)}function X(){return new h(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").option(`-y, --yes`,`Skip the confirmation prompt for removing directories left by a pre-0.42 install.`).action(async e=>{let t=await q({projectDir:E(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null,confirmLegacyCleanup:t=>Z(t,{yes:e.yes===!0})});process.stdout.write(`${Y(t)}\n`),process.exitCode=J(t)})}async function Z(e,t){let n=P(),r=e=>`~/${T(n,e)}`,i=t.input??process.stdin,a=[``,v(`A previous version of OpenKnowledge installed its skill into agent tools you may never have used.`),g(`(Versions before 0.42 wrote to every host a third-party installer knew about — see issue #820.)`)];if(e.skillDirs.length>0&&a.push(``,`${v(`Remove OpenKnowledge skills:`)} ${e.skillDirs.length}`,...e.skillDirs.map(e=>` ${r(e)}`)),e.emptyDirs.length>0){let t=e.skillDirs.length>0?`Then remove these, which hold nothing else once the above are gone:`:`Remove these empty directories, left behind by that install:`;a.push(``,`${v(t)} ${e.emptyDirs.length}`,...e.emptyDirs.map(e=>` ${r(e)}`))}if(a.push(``,g(`Nothing outside these paths is touched. A directory that still holds anything is kept.`)),process.stdout.write(`${a.join(`
3
3
  `)}\n`),t.yes)return!0;if(!i.isTTY)return process.stdout.write(`${_("Not a terminal — skipping cleanup. Re-run with `ok repair-skills --yes` to remove these.")}\n`),!1;let o=F({input:i,output:process.stdout});try{let e=(await o.question(`\n${v(`Remove them?`)} ${g(`[y/N] `)}`)).trim().toLowerCase();return e===`y`||e===`yes`}finally{o.close()}}export{X as n,q as t};
4
- //# sourceMappingURL=repair-skills-TrS-7N9q.mjs.map
4
+ //# sourceMappingURL=repair-skills-zu7vM_05.mjs.map
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{Qo as r,Uo as i,Zo as a,ns as o,ss as s}from"./src-B2bAQ64a.mjs";import{Bi as c,En as l,Xr as u,hi as d,ti as f}from"./src-BTBVMfJ4.mjs";import{execFileSync as p}from"node:child_process";import{basename as m,dirname as h,isAbsolute as g,join as _,posix as v,relative as y,resolve as b,sep as x,win32 as S}from"node:path";import{cpSync as ee,existsSync as C,lstatSync as te,mkdirSync as ne,readFileSync as re,readdirSync as ie,realpathSync as w,rmSync as ae,statSync as oe}from"node:fs";import{homedir as T}from"node:os";var E=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})),D=n((e=>{let{InvalidArgumentError:t}=E();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;break}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})),O=n((e=>{let{humanReadableArgName:t}=D();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"./chunk-DTipWd-i.mjs";import{Qo as r,Uo as i,Zo as a,ns as o,ss as s}from"./src-B2bAQ64a.mjs";import{Bi as c,En as l,Xr as u,hi as d,ti as f}from"./src-e2udu2Rw.mjs";import{execFileSync as p}from"node:child_process";import{basename as m,dirname as h,isAbsolute as g,join as _,posix as v,relative as y,resolve as b,sep as x,win32 as S}from"node:path";import{cpSync as ee,existsSync as C,lstatSync as te,mkdirSync as ne,readFileSync as re,readdirSync as ie,realpathSync as w,rmSync as ae,statSync as oe}from"node:fs";import{homedir as T}from"node:os";var E=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})),D=n((e=>{let{InvalidArgumentError:t}=E();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;break}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})),O=n((e=>{let{humanReadableArgName:t}=D();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})),k=n((e=>{let{InvalidArgumentError:t}=E();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?!1: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}
@@ -53,4 +53,4 @@ foreach ($d in $dirs) {
53
53
  }
54
54
  [Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
55
55
  exit 127`,I=`// ok-pi-bridge`,L=`${I}-v1`,xe=`ok-pi-managed-extension`;function Se(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 typeof e==`string`&&e.includes(`# ok-mcp-v2`)}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 typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}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 typeof e==`string`&&e.includes(`# ok-mcp-v2`)}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 typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}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(L)}return!1}function R(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=b(e);if(m(t)===`cli.mjs`&&m(h(t))===`dist`)return t;let n=t.split(x),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);return _(i.length===0?x:i.join(x),`packages`,`cli`,`dist`,`cli.mjs`)}function z(e={}){return e.mode===`dev`?{command:M,args:[R(),`mcp`],env:{...N}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{command:`/bin/sh`,args:[`-l`,`-c`,P]}}function Ce(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[M,R(),`mcp`],environment:{...N}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,P]}}function we(e){if(typeof e!=`object`||!e)return!1;let t=e;return B(t,z({mode:`published`,platformName:`darwin`}))||B(t,z({mode:`published`,platformName:`win32`}))}function B(e,t){return Object.keys(e).length===Object.keys(t).length?Te(e,t):!1}function Te(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 V(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);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]):!1}function Ee(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:V(t.args,t.command)}function De(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`&&V(r,n)}function H(e){return e===`win32`?S:v}function Oe(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env,i=H(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 ke(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.claude.json`)}function U(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env;if(t===`darwin`)return v.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??S.join(n,`AppData`,`Roaming`);return S.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function W(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.cursor`,`mcp.json`)}function Ae(e={}){let t=e.platformName??process.platform,n=e.home??T();return(e.env??process.env).CODEX_HOME??H(t).join(n,`.codex`)}function G(e={}){return H(e.platformName??process.platform).join(Ae(e),`config.toml`)}function K(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=(e.env??process.env).COPILOT_HOME??H(t).join(n,`.copilot`);return H(t).join(r,`mcp-config.json`)}function je(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env,i=H(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 q(e={}){return H(e.platformName??process.platform).join(je(e),`opencode.json`)}function Me(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.openclaw`,`openclaw.json`)}function Ne(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.hermes`,`config.yaml`)}function J(e={}){let t=e.platformName??process.platform,n=e.home??T();return(e.env??process.env).PI_CODING_AGENT_DIR??H(t).join(n,`.pi`,`agent`)}function Pe(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Fe(e,t){let n=H(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 Ie(e){try{return ie(e).length>0}catch{return!1}}function Y(e={}){let t=e.platformName??process.platform,[n,r]=Fe(e.home??T(),t),i=[n,r].find(e=>C(e.file));return i?i.file:Ie(r.dir)?r.file:n.file}const X={claude:{id:`claude`,label:j.claude,configPath:(e,t)=>ke({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.claude`),projectConfigPath:e=>_(e,`.mcp.json`),projectSkillPath:e=>_(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:j[`claude-desktop`],configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(U({home:t}))},cursor:{id:`cursor`,label:j.cursor,configPath:(e,t)=>W({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(W({home:t})),projectConfigPath:e=>_(e,`.cursor`,`mcp.json`),projectSkillPath:e=>_(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:j.codex,configPath:(e,t)=>G({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(G({home:t})),projectConfigPath:e=>_(e,`.codex`,`config.toml`),projectSkillPath:e=>_(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:j.copilot,configPath:(e,t)=>K({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(K({home:t})),projectSkillPath:e=>_(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:j.opencode,configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>i,buildEntry:(e,t)=>Ce(t),scope:`global`,detectPath:(e,t)=>h(q({home:t})),projectConfigPath:e=>_(e,`opencode.json`),projectSkillPath:e=>_(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:j.openclaw,configPath:(e,t)=>Me({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:j.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,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>J({home:t}),projectConfigPath:e=>_(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>_(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:j.antigravity,configPath:(e,t)=>Pe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:j[`lm-studio`],configPath:(e,t)=>Y({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(Y({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:j.hermes,configPath:(e,t)=>Ne({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.hermes`),offerOnlyWhenDetected:!0}};function Le(e){let t=e.filter(e=>!Object.hasOwn(X,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${A.join(`, `)}`);return e.map(e=>X[e])}function Z(e,t){let n;try{n=te(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);Q(e,t)}function Re(e,t){Q(e,t)}function Q(e,t){let n;try{n=w(t)}catch{n=b(t)}let r=h(e);for(;r.length>1&&r!==x;){let t;try{t=w(r)}catch(e){if(e.code===`ENOENT`){r=h(r);continue}throw e}let i=y(n,t);if(i===``||!i.startsWith(`..`)&&!g(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ze(e,t,n){try{if(oe(n).size>10485760)return!1}catch{return!1}let r;try{r=re(n,`utf-8`)}catch{return!1}let i=[],a=u(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!$(a))return!1;let o=a[e.topLevelKey];if(!$(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return $(s)?$(s[e.serverName(t)]):!1}function Be(e,t,n={}){if(!s.includes(e.id))return!0;try{return ze(e,t,e.configPath(t,n.home))}catch{return!1}}function Ve(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!Be(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=d(`project`,{checkDesktop:!0}),i=h(r);Z(i,t);let a=C(r)?`overwritten`:`written`;return ae(i,{recursive:!0,force:!0}),ne(h(i),{recursive:!0}),ee(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function He(e,t){let n=y(l(t),l(e));return n.length>0&&!n.startsWith(`..`)&&!g(n)}const Ue=e=>{try{let t=p(`git`,[`rev-parse`,`--show-toplevel`],c({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function We(e,t={}){let n=t.homeDir??T(),r=t.gitTopLevel??Ue,i=b(e),a;try{a=w(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(f(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=h(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&He(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}export{ve as C,me as S,H as _,A as a,J as b,be as c,xe as d,z as f,De as g,we as h,Ve as i,I as l,Se as m,Z as n,j as o,Ee as p,Re as r,X as s,We as t,L as u,Oe as v,ge as x,Le as y};
56
- //# sourceMappingURL=resolve-project-root-CLNohNKz.mjs.map
56
+ //# sourceMappingURL=resolve-project-root-dt8lYC9W.mjs.map
@@ -1,2 +1,2 @@
1
- import{ls as e}from"./src-B2bAQ64a.mjs";import{xi as t,yi as n}from"./src-BTBVMfJ4.mjs";import{dirname as r,isAbsolute as i,join as a,relative as o,resolve as s,sep as c}from"node:path";import{existsSync as l,lstatSync as u,readdirSync as d,rmSync as f,rmdirSync as p}from"node:fs";const m=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],h=[...t.map(e=>n[e]),`open-knowledge`];function g(e){if(!i(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=s(e);if(t===c||r(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function _(e,t){let n=o(e,t);if(n.startsWith(`..`)||i(n))return!1;let r=e;for(let e of n.split(c)){r=a(r,e);try{if(!u(r).isDirectory())return!1}catch{return!1}}return!0}function v(e,t){try{return d(e).every(n=>t.has(a(e,n)))}catch{return!1}}function y(e){let t=g(e),n=[],i=[],o=new Set;for(let e of m){let s=a(t,e.hostDir,`skills`);if(!_(t,s))continue;let u=h.map(e=>a(s,e)).filter(e=>l(e));n.push(...u);for(let e of u)o.add(e);let d=a(t,e.pruneRoot),f=s;for(;v(f,o)&&(i.push(f),o.add(f),f!==d);){let e=r(f);if(e===f||e===t||!e.startsWith(t+c))break;f=e}}return{skillDirs:n,emptyDirs:i}}function b(e){try{if(!u(e).isDirectory())return!1;let t=d(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function x(e){let t=new Set,n=new Set;for(let i of m){let o=a(e,i.hostDir,`skills`);for(let e of h)t.add(a(o,e));let s=a(e,i.pruneRoot),l=o;for(;n.add(l),l!==s;){let t=r(l);if(t===l||t===e||!t.startsWith(e+c))break;l=t}}return{skillDirs:t,emptyDirs:n}}function S(e,t){let n=g(e),r=x(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(_(n,e)&&b(e))try{f(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(_(n,e))try{p(e),a.push(e)}catch{}return a}function C(r){let i=g(r),o=[];for(let r of t){let t=n[r];o.push({path:a(i,`.agents`,`skills`,t),bundleId:r,scope:`central`});for(let n of e)o.push({path:a(i,n.skillsRoot,t),bundleId:r,scope:`host`,hostDir:n.hostDir})}return o}function w(e,t){let n=[];for(let r of C(e))if(r.bundleId===t)try{f(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}export{C as i,y as n,w as r,S as t};
2
- //# sourceMappingURL=skill-teardown-DvGC-0MI.mjs.map
1
+ import{ls as e}from"./src-B2bAQ64a.mjs";import{xi as t,yi as n}from"./src-e2udu2Rw.mjs";import{dirname as r,isAbsolute as i,join as a,relative as o,resolve as s,sep as c}from"node:path";import{existsSync as l,lstatSync as u,readdirSync as d,rmSync as f,rmdirSync as p}from"node:fs";const m=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],h=[...t.map(e=>n[e]),`open-knowledge`];function g(e){if(!i(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=s(e);if(t===c||r(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function _(e,t){let n=o(e,t);if(n.startsWith(`..`)||i(n))return!1;let r=e;for(let e of n.split(c)){r=a(r,e);try{if(!u(r).isDirectory())return!1}catch{return!1}}return!0}function v(e,t){try{return d(e).every(n=>t.has(a(e,n)))}catch{return!1}}function y(e){let t=g(e),n=[],i=[],o=new Set;for(let e of m){let s=a(t,e.hostDir,`skills`);if(!_(t,s))continue;let u=h.map(e=>a(s,e)).filter(e=>l(e));n.push(...u);for(let e of u)o.add(e);let d=a(t,e.pruneRoot),f=s;for(;v(f,o)&&(i.push(f),o.add(f),f!==d);){let e=r(f);if(e===f||e===t||!e.startsWith(t+c))break;f=e}}return{skillDirs:n,emptyDirs:i}}function b(e){try{if(!u(e).isDirectory())return!1;let t=d(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function x(e){let t=new Set,n=new Set;for(let i of m){let o=a(e,i.hostDir,`skills`);for(let e of h)t.add(a(o,e));let s=a(e,i.pruneRoot),l=o;for(;n.add(l),l!==s;){let t=r(l);if(t===l||t===e||!t.startsWith(e+c))break;l=t}}return{skillDirs:t,emptyDirs:n}}function S(e,t){let n=g(e),r=x(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(_(n,e)&&b(e))try{f(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(_(n,e))try{p(e),a.push(e)}catch{}return a}function C(r){let i=g(r),o=[];for(let r of t){let t=n[r];o.push({path:a(i,`.agents`,`skills`,t),bundleId:r,scope:`central`});for(let n of e)o.push({path:a(i,n.skillsRoot,t),bundleId:r,scope:`host`,hostDir:n.hostDir})}return o}function w(e,t){let n=[];for(let r of C(e))if(r.bundleId===t)try{f(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}export{C as i,y as n,w as r,S as t};
2
+ //# sourceMappingURL=skill-teardown-DUZd_juy.mjs.map
@@ -1 +1 @@
1
- import{C as e,K as t,Ko as n,Qs as r,Uo as i,X as a,fs as o,ms as s,qo as c,ws as l,x as u}from"./src-B2bAQ64a.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Aa as _,Ai as v,An as y,Ar as b,At as x,B as S,Bi as C,Bn as w,Br as T,Bt as E,C as D,Ca as O,Cn as k,Cr as A,Ct as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Dt as L,E as R,Ea as z,Ei as B,En as V,Er as H,Et as U,F as W,Fi as G,Fn as K,Fr as q,Ft as J,G as Y,Gi as X,Gn as Z,Gr as Q,Gt as $,H as ee,Hi as te,Hn as ne,Hr as re,Ht as ie,I as ae,Ii as oe,In as se,Ir as ce,It as le,J as ue,Ji as de,Jn as fe,Jt as pe,K as me,Ki as he,Kn as ge,Kr as _e,Kt as ve,L as ye,Li as be,Ln as xe,Lr as Se,Lt as Ce,M as we,Ma as Te,Mi as Ee,Mn as De,Mr as Oe,Mt as ke,N as Ae,Na as je,Ni as Me,Nn as Ne,Nr as Pe,Nt as Fe,O as Ie,Oa as Le,Oi as Re,On as ze,Or as Be,Ot as Ve,P as He,Pa as Ue,Pi as We,Pn as Ge,Pr as Ke,Pt as qe,Q as Je,Qi as Ye,Qn as Xe,Qr as Ze,Qt as Qe,R as $e,Ri as et,Rn as tt,Rr as nt,Rt as rt,S as it,Sa as at,Si as ot,Sn as st,Sr as ct,St as lt,T as ut,Ta as dt,Ti as ft,Tn as pt,Tr as mt,Tt as ht,U as gt,Ui as _t,Un as vt,Ur as yt,Ut as bt,V as xt,Vi as St,Vn as Ct,Vr as wt,Vt as Tt,W as Et,Wi as Dt,Wn as Ot,Wr as kt,Wt as At,X as jt,Xi as Mt,Xn as Nt,Xt as Pt,Y as Ft,Yi as It,Yn as Lt,Yt as Rt,Z as zt,Zi as Bt,Zn as Vt,Zt as Ht,_ as Ut,_a as Wt,_i as Gt,_n as Kt,_r as qt,a as Jt,aa as Yt,ai as Xt,an as Zt,ar as Qt,at as $t,b as en,ba as tn,bi as nn,bn as rn,br as an,bt as on,c as sn,ca as cn,ci as ln,cn as un,cr as dn,ct as fn,d as pn,da as mn,di as hn,dn as gn,dr as _n,dt as vn,ea as yn,ei as bn,en as xn,er as Sn,et as Cn,f as wn,fa as Tn,fi as En,fn as Dn,fr as On,ft as kn,g as An,ga as jn,gi as Mn,gn as Nn,gr as Pn,h as Fn,ha as In,hi as Ln,hn as Rn,hr as zn,i as Bn,ia as Vn,ii as Hn,in as Un,ir as Wn,it as Gn,j as Kn,ja as qn,ji as Jn,jn as Yn,jr as Xn,jt as Zn,k as Qn,ka as $n,ki as er,kn as tr,kr as nr,kt as rr,l as ir,la as ar,li as or,ln as sr,lr as cr,lt as lr,m as ur,ma as dr,mi as fr,mn as pr,mr,n as hr,na as gr,ni as _r,nn as vr,nr as yr,nt as br,o as xr,oa as Sr,oi as Cr,on as wr,or as Tr,ot as Er,p as Dr,pa as Or,pi as kr,pn as Ar,pr as jr,pt as Mr,q as Nr,qi as Pr,qn as Fr,qt as Ir,r as Lr,ra as Rr,ri as zr,rn as Br,rr as Vr,rt as Hr,s as Ur,sa as Wr,si as Gr,sn as Kr,sr as qr,st as Jr,t as Yr,ta as Xr,ti as Zr,tn as Qr,tr as $r,tt as ei,u as ti,ua as ni,ui as ri,un as ii,ur as ai,ut as oi,v as si,va as ci,vi as li,vn as ui,vr as di,w as fi,wa as pi,wi as mi,wn as hi,wr as gi,wt as _i,x as vi,xa as yi,xi as bi,xn as xi,xr as Si,xt as Ci,y as wi,ya as Ti,yi as Ei,yn as Di,yr as Oi,z as ki,zi as Ai,zn as ji,zr as Mi,zt as Ni}from"./src-BTBVMfJ4.mjs";import{C as Pi,E as Fi,T as Ii,_ as Li,b as Ri,c as zi,d as Bi,g as Vi,i as Hi,l as Ui,m as Wi,n as Gi,p as Ki,s as qi,t as Ji,u as Yi,v as Xi,w as Zi,x as Qi,y as $i}from"./fs-traced-DgX7lP1u.mjs";import{a as ea,d as ta,f as na,i as ra,l as ia,n as aa,r as oa,t as sa,u as ca}from"./logger-Dq-cRhcP.mjs";import{C as la,S as ua,_ as da,a as fa,b as pa,c as ma,d as ha,f as ga,g as _a,h as va,i as ya,l as ba,m as xa,n as Sa,o as Ca,p as wa,r as Ta,s as Ea,t as Da,u as Oa,x as ka}from"./server-lock-DKS1ePB3.mjs";export{dt as AGENT_ID_MAX_LEN,z as AGENT_ID_RE,St as AGENT_WRITE_ORIGIN,Te as AcpPermissionStore,$n as AcpRegistry,P as AcpThreadManager,ft as AgentFocusBroadcaster,mi as AgentPresenceBroadcaster,te as AgentSessionCapacityError,_t as AgentSessionManager,lt as AutoStartDisabledError,Gt as BUNDLE_IDS,li as BUNDLE_SCOPE,Ei as BUNDLE_SKILL_NAME,qt as BacklinkIndex,f as CC1Broadcaster,s as CC1_CONTRACT_VERSION,Nn as CONFIG_FILENAME,_n as CONFLICT_MARKER_RE,Ni as CURSOR_BUNDLE_PATHS_BY_PLATFORM,en as ConfigSchema,Yt as DEFAULT_CHECKPOINT_RETENTION,tt as DEFAULT_EMBEDDINGS_DIMENSIONS,pe as DEFAULT_PACK_ID,Y as DocumentDurabilityState,ji as EMBEDDINGS_API_KEY_ENV,Yr as EPHEMERAL_PROJECT_DIR_PREFIX,Ct as ExposureConsentError,_ as FEATURED_AGENT_IDS,Sr as FILE_SYSTEM_WRITER,zn as FILE_WATCHER_ORIGIN,De as FileEmbeddingsBackend,ii as GIT_PREFLIGHT_FAIL_SPAN_NAME,Wr as GIT_UPSTREAM_WRITER,je as GitDirAccessError,Ee as GitNotAvailableError,Me as GitTooOldError,j as HOCUSPOCUS_AUTH_REJECTION_REASONS,_i as HocuspocusAuthRejection,ht as HocuspocusAuthTokenSchema,hi as HomeProjectRootError,Hn as INSTALLED_AGENTS_SCHEMES,kn as JSON_SCHEMA_DIALECT_2020_12,o as LINEAGE_EPOCH_KEY,ee as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Rt as LOG_MD_TEMPLATE,ke as MANAGED_RENAME_ORIGIN,Re as MAX_ACP_THREADS,Dt as MAX_AGENT_SESSIONS,v as MCP_CONNECTION_ID_HEADER,i as MCP_SERVER_NAME,X as MIN_EVICTABLE_IDLE_MS,We as MIN_GIT_VERSION,me as MISSING_OK_CONFIG_MESSAGE,Ue as MalformedGitPointerError,Gn as McpLogger,Nr as MissingOkConfigError,Pr as OBSERVER_SYNC_ORIGIN,Kt as OK_OKIGNORE_TEMPLATE,nn as ONBOARDING_BUNDLE_IDS,n as ORPHAN_MODES,r as PROTOCOL_VERSION,sa as PinoLogger,ba as ProcessLockCollisionError,wn as ProjectGitInitError,Fe as ROLLBACK_ORIGIN,ui as ROOT_GITIGNORE_TEMPLATE,pa as RUNTIME_VERSION,cn as SERVICE_WRITER,ce as SKILL_INSTALL_EVENTS_FILE_REL,t as SKILL_STATE_TARGETS,Pt as STARTER_FOLDERS,Ht as STARTER_FOLDER_FRONTMATTER_FILENAME,Qe as STARTER_PACKS,h as STARTER_PACK_IDS,xn as STARTER_TEMPLATES,Qn as STATE_MANIFEST_FILENAME,ka as STATE_SCHEMA_VERSION,l as SYSTEM_DOC_NAME,wr as SeedPrerequisiteError,Kr as SeedRootDirError,Da as ServerLockCollisionError,hr as SingleFileNotAFileError,Lr as SingleFileNotFoundError,Bn as SingleFileNotMarkdownError,Jt as SingleFileProjectOverrideError,g as StateManifestError,Pn as TagIndex,bi as USER_GLOBAL_BUNDLE_IDS,qe as __getShowAllWalkStatsForTesting,J as __resetShowAllWalkStatsForTesting,Oa as acquireProcessLock,Sa as acquireServerLock,he as applyAgentMarkdownWrite,cr as applyExternalChange,Ir as applySeed,Kn as assertCompatibleStateManifest,G as assertGitAvailable,Vt as assertNeverDiskEvent,pt as assertNotHomeProjectRoot,B as attachAcpThreadSocket,on as attachCollabClientCounter,Ci as attachIdleShutdown,vi as bootServer,ct as buildAndOpenSkill,Di as buildConfigYmlContent,d as buildExecResult,ne as buildIngressPolicy,er as buildOkMcpStdioCommand,fr as buildSkillZip,Qr as buildStarterFolderFrontmatterYaml,ar as buildWipTree,ot as bundleSkillMdPath,Ne as canonicalProjectKey,V as canonicalizeForCompare,Xe as classifyEvents,Ji as classifyFsPath,Ge as clearAllEmbeddingsKeys,Gr as clearContributors,vr as coercePackId,u as colorFromSeed,ni as commitUpstreamImport,mn as commitWip,Tn as commitWipFromTree,oe as compareSemver,Mi as composeEffectiveLinterConfig,T as composeFrontmatterSchemasConfig,On as containsConflictMarkers,p as contentHash,ln as contributorCount,$e as countShadowObjects,ki as countStaleAgentWipRefs,S as countWipRefs,le as createApiExtension,Zn as createAssetServeMiddleware,Ft as createCollaborationHost,Ze as createContentFilter,m as createContentFilterAsync,K as createEmbeddingsSecretStore,xr as createEphemeralProjectDir,ai as createExternalChangeHandler,Fn as createFileLogger,gt as createLiveDerivedIndexExtension,zt as createMcpHttpHandler,Xt as createOsProbe,ye as createPersistenceExtension,R as createServer,W as createServerObserverExtension,Mt as createStreamingErrorWriter,aa as createTestLogger,se as describeStoredEmbeddingsKey,wi as detectClaudeDesktopPresence,be as detectGit,we as detectProjectShape,A as detectUserSkillHosts,Jr as discoverLockDirs,yt as discoverMarkdownlintConfig,gn as emitPreflightFailureSpan,Cn as encodeDocName,ei as encodeFolderRoute,br as encodeSkillRoute,Dr as ensureProjectGit,rn as ensureProjectSkillGitignore,Bt as errorResponse,Sn as evictStaleTrackerEntries,Ce as extractHeadings,fn as extractOkBinaryPath,di as extractWikiLinksFromMarkdown,et as fallbackPaths,ur as findEnclosingGitRoot,bn as findEnclosingProjectRoot,kt as findNativeMarkdownlintFile,An as flushFileLogger,U as formatAuthRejectionWire,or as formatContributors,ri as formatContributorsFrom,$ as formatPackRationale,Or as gcCheckpointRefs,$t as getCurrentMcpLogger,vt as getIngressContext,Oi as getLocalDir,Ut as getLogFilePath,oa as getLogger,si as getLogsDir,da as getMachineId,$i as getMeter,tn as getMetrics,Ri as getTracer,yi as handleCollabSocketError,E as handleSpawnCursor,Ot as hasForwardingHeaders,xt as hasGcLogLatch,e as iconFromClientName,at as incrementCollabSocketFilteredError,O as incrementServerObserverFire,xi as initContent,dr as initShadowRepo,Qi as initTelemetry,D as initToleranceTelemetryWriter,Mr as installJsonSchemaDialect,vn as installPrettyZodErrors,ra as installTestLoggers,gi as installUserSkill,Nt as isAllowedApiOrigin,fe as isAllowedWorkspaceHostHeader,yn as isConfigDoc,L as isHocuspocusAuthRejectionReason,F as isHomeDir,Z as isHostAdmitted,Br as isKnownPackId,Xr as isLinkIndexExcludedDoc,Lt as isLoopbackAddress,gr as isManagedArtifactDoc,ge as isOriginAdmitted,c as isOrphanMode,de as isPairedWriteOrigin,Tt as isPathWithinDir,Fr as isPeerAdmitted,ua as isProcessAlive,Zr as isProjectRoot,Rr as isReservedForUserTree,$r as isSelfWrite,Vn as isSystemDoc,fi as isToleranceTelemetryEnabled,la as isValidLockPid,yr as lastKnownHash,In as listRescueCheckpoints,Un as listStarterPacks,qn as loadCustomAgents,ae as loadPrincipal,Ta as lockAdvertisesUi,ha as lockBaseUrl,ga as lockFilePath,ea as loggerFactory,ze as loginShapedUserinfoUser,ia as logsCurrentPath,ca as logsPreviousPath,xe as makeLazyEmbeddingsKeyStore,ya as markServerLockDraining,ue as mountMcpAndApi,Gi as normalizeFsPath,tr as originGitHubHost,st as packageVersionMajorMinor,Ve as parseAuthRejectionWire,Ai as parseGitVersion,rr as parseHocuspocusAuthToken,jt as parseKeepaliveConnectionId,Vr as pathToDocName,ve as planSeed,Ur as prepareSingleFileOpen,lr as processCommand,oi as processUsage,I as readAllTargets,Be as readBundleDecision,Q as readOwnNativeRules,wa as readProcessLock,xa as readProcessLockDetailed,Et as readProjectHeadState,Yn as readProjectLocalSemanticConfig,fa as readServerLock,nr as readServerPackageVersion,b as readSkillInstallStateSnapshot,Ae as readStateManifest,Xn as readTargetRecordedAt,Oe as readTargetVersion,jr as reconcile,hn as recordContributor,Se as recordSkillInstallEvent,Dn as redactShareSubprocessStderr,Je as registerAllTools,Wn as registerWrite,va as releaseProcessLock,Ca as releaseServerLock,Qt as removeLastKnownHash,H as reportSkillInstall,pi as resetMetrics,mt as resolveBuiltinSkillHosts,a as resolveBundleEnabled,Ln as resolveBundledSkillDir,an as resolveContentDir,ie as resolveCursorBinaryDefault,bt as resolveCursorSpawnInvocation,wt as resolveEffectiveLinterConfig,w as resolveEmbeddingsCredential,Ie as resolveGitHubAccountFromUrl,Si as resolveLockDir,re as resolveNativeConfigForDoc,_e as resolveNativeMarkdownlintConfig,Zt as resolvePack,ti as resolvePackageVersion,q as resolveSkillInstallReportSettings,Hr as resolveUiInfo,En as restoreContributors,it as restoreLifecycleFromConflictsJson,_r as rewriteMarkdownLinksForDocumentRename,zr as rewriteWikiLinksForDocumentRename,Ar as runAuthReposSubprocess,pr as runAuthStatusSubprocess,un as runCloneSubprocess,Rn as runDeviceFlowSubprocess,Er as runWithMcpLogger,Cr as safeContentPath,rt as safeSubdir,jn as safetyCheckpoint,y as sameGitHubLogin,Jn as sanitizeClientName,Wt as saveInMemoryCheckpoint,ci as saveVersion,x as seedBasenameIndex,sn as seedEphemeralProjectDir,ir as serializeError,Pi as setActiveSpanAttributes,It as setupServerObservers,Ti as shadowGit,Zi as shutdownTelemetry,ta as spansCurrentPath,na as spansPreviousPath,At as spawnDetached,mr as splitMarkdownBlocks,Tr as startWatcher,Ye as streamingProblemEvent,kr as swapContributors,ut as teardownToleranceTelemetryWriter,N as toBroadcasterKey,Hi as tracedAppendFileSync,qi as tracedLinkSync,zi as tracedMkdir,Ui as tracedMkdirSync,Yi as tracedRename,Bi as tracedRenameSync,Ki as tracedRmSync,Wi as tracedRmdirSync,Vi as tracedUnlinkSync,Li as tracedWriteFile,Xi as tracedWriteFileSync,M as trustSystemCertificates,pn as untrackTrackedProjectSkillProjection,qr as updateLastKnownHash,_a as updateProcessLockPort,Ea as updateServerLockPort,Le as validateAgentId,sr as validateCloneInputs,Mn as validateSkillZip,ma as waitForServerLockDrain,C as withHiddenWindowsConsole,Ii as withSpan,Fi as withSpanSync,Pe as writeBundleDecision,nt as writeMarkdownlintRule,k as writeRootGitignoreForNewRepo,He as writeStateManifest,Ke as writeTargetVersion,dn as writeTracker};
1
+ import{C as e,K as t,Ko as n,Qs as r,Uo as i,X as a,fs as o,ms as s,qo as c,ws as l,x as u}from"./src-B2bAQ64a.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Aa as _,Ai as v,An as y,Ar as b,At as x,B as S,Bi as C,Bn as w,Br as T,Bt as E,C as D,Ca as O,Cn as k,Cr as A,Ct as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Dt as L,E as R,Ea as z,Ei as B,En as V,Er as H,Et as U,F as W,Fi as G,Fn as K,Fr as q,Ft as J,G as Y,Gi as X,Gn as Z,Gr as Q,Gt as $,H as ee,Hi as te,Hn as ne,Hr as re,Ht as ie,I as ae,Ii as oe,In as se,Ir as ce,It as le,J as ue,Ji as de,Jn as fe,Jt as pe,K as me,Ki as he,Kn as ge,Kr as _e,Kt as ve,L as ye,Li as be,Ln as xe,Lr as Se,Lt as Ce,M as we,Ma as Te,Mi as Ee,Mn as De,Mr as Oe,Mt as ke,N as Ae,Na as je,Ni as Me,Nn as Ne,Nr as Pe,Nt as Fe,O as Ie,Oa as Le,Oi as Re,On as ze,Or as Be,Ot as Ve,P as He,Pa as Ue,Pi as We,Pn as Ge,Pr as Ke,Pt as qe,Q as Je,Qi as Ye,Qn as Xe,Qr as Ze,Qt as Qe,R as $e,Ri as et,Rn as tt,Rr as nt,Rt as rt,S as it,Sa as at,Si as ot,Sn as st,Sr as ct,St as lt,T as ut,Ta as dt,Ti as ft,Tn as pt,Tr as mt,Tt as ht,U as gt,Ui as _t,Un as vt,Ur as yt,Ut as bt,V as xt,Vi as St,Vn as Ct,Vr as wt,Vt as Tt,W as Et,Wi as Dt,Wn as Ot,Wr as kt,Wt as At,X as jt,Xi as Mt,Xn as Nt,Xt as Pt,Y as Ft,Yi as It,Yn as Lt,Yt as Rt,Z as zt,Zi as Bt,Zn as Vt,Zt as Ht,_ as Ut,_a as Wt,_i as Gt,_n as Kt,_r as qt,a as Jt,aa as Yt,ai as Xt,an as Zt,ar as Qt,at as $t,b as en,ba as tn,bi as nn,bn as rn,br as an,bt as on,c as sn,ca as cn,ci as ln,cn as un,cr as dn,ct as fn,d as pn,da as mn,di as hn,dn as gn,dr as _n,dt as vn,ea as yn,ei as bn,en as xn,er as Sn,et as Cn,f as wn,fa as Tn,fi as En,fn as Dn,fr as On,ft as kn,g as An,ga as jn,gi as Mn,gn as Nn,gr as Pn,h as Fn,ha as In,hi as Ln,hn as Rn,hr as zn,i as Bn,ia as Vn,ii as Hn,in as Un,ir as Wn,it as Gn,j as Kn,ja as qn,ji as Jn,jn as Yn,jr as Xn,jt as Zn,k as Qn,ka as $n,ki as er,kn as tr,kr as nr,kt as rr,l as ir,la as ar,li as or,ln as sr,lr as cr,lt as lr,m as ur,ma as dr,mi as fr,mn as pr,mr,n as hr,na as gr,ni as _r,nn as vr,nr as yr,nt as br,o as xr,oa as Sr,oi as Cr,on as wr,or as Tr,ot as Er,p as Dr,pa as Or,pi as kr,pn as Ar,pr as jr,pt as Mr,q as Nr,qi as Pr,qn as Fr,qt as Ir,r as Lr,ra as Rr,ri as zr,rn as Br,rr as Vr,rt as Hr,s as Ur,sa as Wr,si as Gr,sn as Kr,sr as qr,st as Jr,t as Yr,ta as Xr,ti as Zr,tn as Qr,tr as $r,tt as ei,u as ti,ua as ni,ui as ri,un as ii,ur as ai,ut as oi,v as si,va as ci,vi as li,vn as ui,vr as di,w as fi,wa as pi,wi as mi,wn as hi,wr as gi,wt as _i,x as vi,xa as yi,xi as bi,xn as xi,xr as Si,xt as Ci,y as wi,ya as Ti,yi as Ei,yn as Di,yr as Oi,z as ki,zi as Ai,zn as ji,zr as Mi,zt as Ni}from"./src-e2udu2Rw.mjs";import{C as Pi,E as Fi,T as Ii,_ as Li,b as Ri,c as zi,d as Bi,g as Vi,i as Hi,l as Ui,m as Wi,n as Gi,p as Ki,s as qi,t as Ji,u as Yi,v as Xi,w as Zi,x as Qi,y as $i}from"./fs-traced-DgX7lP1u.mjs";import{a as ea,d as ta,f as na,i as ra,l as ia,n as aa,r as oa,t as sa,u as ca}from"./logger-Dq-cRhcP.mjs";import{C as la,S as ua,_ as da,a as fa,b as pa,c as ma,d as ha,f as ga,g as _a,h as va,i as ya,l as ba,m as xa,n as Sa,o as Ca,p as wa,r as Ta,s as Ea,t as Da,u as Oa,x as ka}from"./server-lock-DKS1ePB3.mjs";export{dt as AGENT_ID_MAX_LEN,z as AGENT_ID_RE,St as AGENT_WRITE_ORIGIN,Te as AcpPermissionStore,$n as AcpRegistry,P as AcpThreadManager,ft as AgentFocusBroadcaster,mi as AgentPresenceBroadcaster,te as AgentSessionCapacityError,_t as AgentSessionManager,lt as AutoStartDisabledError,Gt as BUNDLE_IDS,li as BUNDLE_SCOPE,Ei as BUNDLE_SKILL_NAME,qt as BacklinkIndex,f as CC1Broadcaster,s as CC1_CONTRACT_VERSION,Nn as CONFIG_FILENAME,_n as CONFLICT_MARKER_RE,Ni as CURSOR_BUNDLE_PATHS_BY_PLATFORM,en as ConfigSchema,Yt as DEFAULT_CHECKPOINT_RETENTION,tt as DEFAULT_EMBEDDINGS_DIMENSIONS,pe as DEFAULT_PACK_ID,Y as DocumentDurabilityState,ji as EMBEDDINGS_API_KEY_ENV,Yr as EPHEMERAL_PROJECT_DIR_PREFIX,Ct as ExposureConsentError,_ as FEATURED_AGENT_IDS,Sr as FILE_SYSTEM_WRITER,zn as FILE_WATCHER_ORIGIN,De as FileEmbeddingsBackend,ii as GIT_PREFLIGHT_FAIL_SPAN_NAME,Wr as GIT_UPSTREAM_WRITER,je as GitDirAccessError,Ee as GitNotAvailableError,Me as GitTooOldError,j as HOCUSPOCUS_AUTH_REJECTION_REASONS,_i as HocuspocusAuthRejection,ht as HocuspocusAuthTokenSchema,hi as HomeProjectRootError,Hn as INSTALLED_AGENTS_SCHEMES,kn as JSON_SCHEMA_DIALECT_2020_12,o as LINEAGE_EPOCH_KEY,ee as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Rt as LOG_MD_TEMPLATE,ke as MANAGED_RENAME_ORIGIN,Re as MAX_ACP_THREADS,Dt as MAX_AGENT_SESSIONS,v as MCP_CONNECTION_ID_HEADER,i as MCP_SERVER_NAME,X as MIN_EVICTABLE_IDLE_MS,We as MIN_GIT_VERSION,me as MISSING_OK_CONFIG_MESSAGE,Ue as MalformedGitPointerError,Gn as McpLogger,Nr as MissingOkConfigError,Pr as OBSERVER_SYNC_ORIGIN,Kt as OK_OKIGNORE_TEMPLATE,nn as ONBOARDING_BUNDLE_IDS,n as ORPHAN_MODES,r as PROTOCOL_VERSION,sa as PinoLogger,ba as ProcessLockCollisionError,wn as ProjectGitInitError,Fe as ROLLBACK_ORIGIN,ui as ROOT_GITIGNORE_TEMPLATE,pa as RUNTIME_VERSION,cn as SERVICE_WRITER,ce as SKILL_INSTALL_EVENTS_FILE_REL,t as SKILL_STATE_TARGETS,Pt as STARTER_FOLDERS,Ht as STARTER_FOLDER_FRONTMATTER_FILENAME,Qe as STARTER_PACKS,h as STARTER_PACK_IDS,xn as STARTER_TEMPLATES,Qn as STATE_MANIFEST_FILENAME,ka as STATE_SCHEMA_VERSION,l as SYSTEM_DOC_NAME,wr as SeedPrerequisiteError,Kr as SeedRootDirError,Da as ServerLockCollisionError,hr as SingleFileNotAFileError,Lr as SingleFileNotFoundError,Bn as SingleFileNotMarkdownError,Jt as SingleFileProjectOverrideError,g as StateManifestError,Pn as TagIndex,bi as USER_GLOBAL_BUNDLE_IDS,qe as __getShowAllWalkStatsForTesting,J as __resetShowAllWalkStatsForTesting,Oa as acquireProcessLock,Sa as acquireServerLock,he as applyAgentMarkdownWrite,cr as applyExternalChange,Ir as applySeed,Kn as assertCompatibleStateManifest,G as assertGitAvailable,Vt as assertNeverDiskEvent,pt as assertNotHomeProjectRoot,B as attachAcpThreadSocket,on as attachCollabClientCounter,Ci as attachIdleShutdown,vi as bootServer,ct as buildAndOpenSkill,Di as buildConfigYmlContent,d as buildExecResult,ne as buildIngressPolicy,er as buildOkMcpStdioCommand,fr as buildSkillZip,Qr as buildStarterFolderFrontmatterYaml,ar as buildWipTree,ot as bundleSkillMdPath,Ne as canonicalProjectKey,V as canonicalizeForCompare,Xe as classifyEvents,Ji as classifyFsPath,Ge as clearAllEmbeddingsKeys,Gr as clearContributors,vr as coercePackId,u as colorFromSeed,ni as commitUpstreamImport,mn as commitWip,Tn as commitWipFromTree,oe as compareSemver,Mi as composeEffectiveLinterConfig,T as composeFrontmatterSchemasConfig,On as containsConflictMarkers,p as contentHash,ln as contributorCount,$e as countShadowObjects,ki as countStaleAgentWipRefs,S as countWipRefs,le as createApiExtension,Zn as createAssetServeMiddleware,Ft as createCollaborationHost,Ze as createContentFilter,m as createContentFilterAsync,K as createEmbeddingsSecretStore,xr as createEphemeralProjectDir,ai as createExternalChangeHandler,Fn as createFileLogger,gt as createLiveDerivedIndexExtension,zt as createMcpHttpHandler,Xt as createOsProbe,ye as createPersistenceExtension,R as createServer,W as createServerObserverExtension,Mt as createStreamingErrorWriter,aa as createTestLogger,se as describeStoredEmbeddingsKey,wi as detectClaudeDesktopPresence,be as detectGit,we as detectProjectShape,A as detectUserSkillHosts,Jr as discoverLockDirs,yt as discoverMarkdownlintConfig,gn as emitPreflightFailureSpan,Cn as encodeDocName,ei as encodeFolderRoute,br as encodeSkillRoute,Dr as ensureProjectGit,rn as ensureProjectSkillGitignore,Bt as errorResponse,Sn as evictStaleTrackerEntries,Ce as extractHeadings,fn as extractOkBinaryPath,di as extractWikiLinksFromMarkdown,et as fallbackPaths,ur as findEnclosingGitRoot,bn as findEnclosingProjectRoot,kt as findNativeMarkdownlintFile,An as flushFileLogger,U as formatAuthRejectionWire,or as formatContributors,ri as formatContributorsFrom,$ as formatPackRationale,Or as gcCheckpointRefs,$t as getCurrentMcpLogger,vt as getIngressContext,Oi as getLocalDir,Ut as getLogFilePath,oa as getLogger,si as getLogsDir,da as getMachineId,$i as getMeter,tn as getMetrics,Ri as getTracer,yi as handleCollabSocketError,E as handleSpawnCursor,Ot as hasForwardingHeaders,xt as hasGcLogLatch,e as iconFromClientName,at as incrementCollabSocketFilteredError,O as incrementServerObserverFire,xi as initContent,dr as initShadowRepo,Qi as initTelemetry,D as initToleranceTelemetryWriter,Mr as installJsonSchemaDialect,vn as installPrettyZodErrors,ra as installTestLoggers,gi as installUserSkill,Nt as isAllowedApiOrigin,fe as isAllowedWorkspaceHostHeader,yn as isConfigDoc,L as isHocuspocusAuthRejectionReason,F as isHomeDir,Z as isHostAdmitted,Br as isKnownPackId,Xr as isLinkIndexExcludedDoc,Lt as isLoopbackAddress,gr as isManagedArtifactDoc,ge as isOriginAdmitted,c as isOrphanMode,de as isPairedWriteOrigin,Tt as isPathWithinDir,Fr as isPeerAdmitted,ua as isProcessAlive,Zr as isProjectRoot,Rr as isReservedForUserTree,$r as isSelfWrite,Vn as isSystemDoc,fi as isToleranceTelemetryEnabled,la as isValidLockPid,yr as lastKnownHash,In as listRescueCheckpoints,Un as listStarterPacks,qn as loadCustomAgents,ae as loadPrincipal,Ta as lockAdvertisesUi,ha as lockBaseUrl,ga as lockFilePath,ea as loggerFactory,ze as loginShapedUserinfoUser,ia as logsCurrentPath,ca as logsPreviousPath,xe as makeLazyEmbeddingsKeyStore,ya as markServerLockDraining,ue as mountMcpAndApi,Gi as normalizeFsPath,tr as originGitHubHost,st as packageVersionMajorMinor,Ve as parseAuthRejectionWire,Ai as parseGitVersion,rr as parseHocuspocusAuthToken,jt as parseKeepaliveConnectionId,Vr as pathToDocName,ve as planSeed,Ur as prepareSingleFileOpen,lr as processCommand,oi as processUsage,I as readAllTargets,Be as readBundleDecision,Q as readOwnNativeRules,wa as readProcessLock,xa as readProcessLockDetailed,Et as readProjectHeadState,Yn as readProjectLocalSemanticConfig,fa as readServerLock,nr as readServerPackageVersion,b as readSkillInstallStateSnapshot,Ae as readStateManifest,Xn as readTargetRecordedAt,Oe as readTargetVersion,jr as reconcile,hn as recordContributor,Se as recordSkillInstallEvent,Dn as redactShareSubprocessStderr,Je as registerAllTools,Wn as registerWrite,va as releaseProcessLock,Ca as releaseServerLock,Qt as removeLastKnownHash,H as reportSkillInstall,pi as resetMetrics,mt as resolveBuiltinSkillHosts,a as resolveBundleEnabled,Ln as resolveBundledSkillDir,an as resolveContentDir,ie as resolveCursorBinaryDefault,bt as resolveCursorSpawnInvocation,wt as resolveEffectiveLinterConfig,w as resolveEmbeddingsCredential,Ie as resolveGitHubAccountFromUrl,Si as resolveLockDir,re as resolveNativeConfigForDoc,_e as resolveNativeMarkdownlintConfig,Zt as resolvePack,ti as resolvePackageVersion,q as resolveSkillInstallReportSettings,Hr as resolveUiInfo,En as restoreContributors,it as restoreLifecycleFromConflictsJson,_r as rewriteMarkdownLinksForDocumentRename,zr as rewriteWikiLinksForDocumentRename,Ar as runAuthReposSubprocess,pr as runAuthStatusSubprocess,un as runCloneSubprocess,Rn as runDeviceFlowSubprocess,Er as runWithMcpLogger,Cr as safeContentPath,rt as safeSubdir,jn as safetyCheckpoint,y as sameGitHubLogin,Jn as sanitizeClientName,Wt as saveInMemoryCheckpoint,ci as saveVersion,x as seedBasenameIndex,sn as seedEphemeralProjectDir,ir as serializeError,Pi as setActiveSpanAttributes,It as setupServerObservers,Ti as shadowGit,Zi as shutdownTelemetry,ta as spansCurrentPath,na as spansPreviousPath,At as spawnDetached,mr as splitMarkdownBlocks,Tr as startWatcher,Ye as streamingProblemEvent,kr as swapContributors,ut as teardownToleranceTelemetryWriter,N as toBroadcasterKey,Hi as tracedAppendFileSync,qi as tracedLinkSync,zi as tracedMkdir,Ui as tracedMkdirSync,Yi as tracedRename,Bi as tracedRenameSync,Ki as tracedRmSync,Wi as tracedRmdirSync,Vi as tracedUnlinkSync,Li as tracedWriteFile,Xi as tracedWriteFileSync,M as trustSystemCertificates,pn as untrackTrackedProjectSkillProjection,qr as updateLastKnownHash,_a as updateProcessLockPort,Ea as updateServerLockPort,Le as validateAgentId,sr as validateCloneInputs,Mn as validateSkillZip,ma as waitForServerLockDrain,C as withHiddenWindowsConsole,Ii as withSpan,Fi as withSpanSync,Pe as writeBundleDecision,nt as writeMarkdownlintRule,k as writeRootGitignoreForNewRepo,He as writeStateManifest,Ke as writeTargetVersion,dn as writeTracker};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{Ha as t,Ia as n,La as r,ac as i,oc as a}from"./src-B2bAQ64a.mjs";import{$ as o,Ct as s,Q as c,c as l,s as u}from"./sleep-zea4v2sB.mjs";import{Bi as d,ct as ee,ei as f,h as p,lt as m,st as h,ut as g,xr as _}from"./src-BTBVMfJ4.mjs";import{A as v,I as y,L as b,O as x}from"./fs-traced-DgX7lP1u.mjs";import{C as S,S as C,_ as w,d as T,f as E,r as D}from"./server-lock-DKS1ePB3.mjs";import{t as O}from"./yazl-DejPO9b3.mjs";import{_ as k,h as te,m as A,v as j,x as M}from"./resolve-project-root-CLNohNKz.mjs";import{c as N}from"./colors-DSyAT9Cz.mjs";import{a as ne,i as re}from"./acp-harness-probe-D4fYUyLf.mjs";import{D as ie,E as P,S as ae,T as F,_ as oe,b as se,o as ce}from"./init-Q6vQQIvo.mjs";import{n as le}from"./constants-IMtjOwCu.mjs";import{t as ue}from"./is-object-Bw0-z8qH.mjs";import"./loader-V75vJygF.mjs";import"./skill-teardown-DvGC-0MI.mjs";import"./preview-rS6YMAKu.mjs";import{execSync as de,spawnSync as fe}from"node:child_process";import{basename as I,dirname as L,join as R,relative as pe,resolve as z,sep as me}from"node:path";import{cpSync as he,createWriteStream as ge,existsSync as B,lstatSync as _e,mkdirSync as V,mkdtempSync as ve,readFileSync as H,readdirSync as U,readlinkSync as ye,rmSync as be,statSync as xe,writeFileSync as W}from"node:fs";import{arch as Se,freemem as Ce,homedir as G,hostname as we,platform as Te,release as Ee,tmpdir as De,totalmem as Oe,type as ke,uptime as Ae}from"node:os";import"node:fs/promises";import{createHash as je}from"node:crypto";var Me=s();let Ne;function Pe(){return Ne}function Fe(e,t){if(t!==void 0&&t.length>0)return t;try{return f(e)?.rootPath}catch{return}}function Ie(e){let t=Fe(e.cwd,e.configuredProjectName),n=p({name:`cli`,project:t});return Ne=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}const Le=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Re(e,t,n=f){if(e!==void 0&&!Le.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let ze=null;function Be(e){ze=e}function Ve(){return ze??process.cwd()}const He=`Open Knowledge`;function Ue(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return k(t).join(j({...e,platformName:t}),n)}function We(e={}){let t=e.platformName??process.platform,n=e.home??G(),r=e.env??process.env,i=k(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function Ge(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function Ke(e){let t=R(e,`state.json`);if(!B(t))return[];let n;try{n=JSON.parse(H(t,`utf-8`))}catch{return[]}return Ge(n)??[]}function qe(e){let t=R(e,`state.json`);if(!B(t))return!1;try{return Ge(JSON.parse(H(t,`utf-8`)))!==null}catch{return!1}}function Je(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function Ye(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`\\`.repeat(t-t%2)+`/`})}const Xe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Ze(e){return e.replace(Xe,`$1"[REDACTED-DEVICE-ID]"`)}function Qe(e){return Ze(Ye(e))}const $e=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function et(e){if(typeof e!=`string`)return null;let t=$e.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function tt(e){try{let t=H(e,`utf-8`),n=t.indexOf(`
1
+ import{o as e}from"./chunk-DTipWd-i.mjs";import{Ha as t,Ia as n,La as r,ac as i,oc as a}from"./src-B2bAQ64a.mjs";import{$ as o,Ct as s,Q as c,c as l,s as u}from"./sleep-zea4v2sB.mjs";import{Bi as d,ct as ee,ei as f,h as p,lt as m,st as h,ut as g,xr as _}from"./src-e2udu2Rw.mjs";import{A as v,I as y,L as b,O as x}from"./fs-traced-DgX7lP1u.mjs";import{C as S,S as C,_ as w,d as T,f as E,r as D}from"./server-lock-DKS1ePB3.mjs";import{t as O}from"./yazl-DejPO9b3.mjs";import{_ as k,h as te,m as A,v as j,x as M}from"./resolve-project-root-dt8lYC9W.mjs";import{c as N}from"./colors-DSyAT9Cz.mjs";import{a as ne,i as re}from"./acp-harness-probe-DaYXqGxg.mjs";import{D as ie,E as P,S as ae,T as F,_ as oe,b as se,o as ce}from"./init-_7R63fwz.mjs";import{n as le}from"./constants-jyYwGmDC.mjs";import{t as ue}from"./is-object-Bw0-z8qH.mjs";import"./loader-C4UW1MW5.mjs";import"./skill-teardown-DUZd_juy.mjs";import"./preview-DKtYHQbM.mjs";import{execSync as de,spawnSync as fe}from"node:child_process";import{basename as I,dirname as L,join as R,relative as pe,resolve as z,sep as me}from"node:path";import{cpSync as he,createWriteStream as ge,existsSync as B,lstatSync as _e,mkdirSync as V,mkdtempSync as ve,readFileSync as H,readdirSync as U,readlinkSync as ye,rmSync as be,statSync as xe,writeFileSync as W}from"node:fs";import{arch as Se,freemem as Ce,homedir as G,hostname as we,platform as Te,release as Ee,tmpdir as De,totalmem as Oe,type as ke,uptime as Ae}from"node:os";import"node:fs/promises";import{createHash as je}from"node:crypto";var Me=s();let Ne;function Pe(){return Ne}function Fe(e,t){if(t!==void 0&&t.length>0)return t;try{return f(e)?.rootPath}catch{return}}function Ie(e){let t=Fe(e.cwd,e.configuredProjectName),n=p({name:`cli`,project:t});return Ne=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}const Le=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Re(e,t,n=f){if(e!==void 0&&!Le.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let ze=null;function Be(e){ze=e}function Ve(){return ze??process.cwd()}const He=`Open Knowledge`;function Ue(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return k(t).join(j({...e,platformName:t}),n)}function We(e={}){let t=e.platformName??process.platform,n=e.home??G(),r=e.env??process.env,i=k(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function Ge(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function Ke(e){let t=R(e,`state.json`);if(!B(t))return[];let n;try{n=JSON.parse(H(t,`utf-8`))}catch{return[]}return Ge(n)??[]}function qe(e){let t=R(e,`state.json`);if(!B(t))return!1;try{return Ge(JSON.parse(H(t,`utf-8`)))!==null}catch{return!1}}function Je(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function Ye(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`\\`.repeat(t-t%2)+`/`})}const Xe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Ze(e){return e.replace(Xe,`$1"[REDACTED-DEVICE-ID]"`)}function Qe(e){return Ze(Ye(e))}const $e=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function et(e){if(typeof e!=`string`)return null;let t=$e.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function tt(e){try{let t=H(e,`utf-8`),n=t.indexOf(`
2
2
  `),r=n===-1?t:t.slice(0,n),i=JSON.parse(r);if(typeof i!=`object`||!i)return{kind:`unreadable`};let{name:a,app_name:o,timestamp:s}=i,c=typeof a==`string`?a:typeof o==`string`?o:null;return c===null?{kind:`unreadable`}:{kind:`named`,name:c,timestampMs:et(s)}}catch{return{kind:`unreadable`}}}function nt(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function rt(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=U(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=R(e,t.name),r;try{r=xe(n).mtimeMs}catch{continue}if(r<i)continue;let c=tt(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!nt(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}function K(){return R(G(),`.ok`,`bug-reports`)}function it(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=K(),r=`${t}-bugreport`,i=R(n,`${r}.zip`);for(let e=2;B(i);e+=1)i=R(n,`${r}-${e}.zip`);return i}function at(e,t){let n=R(e,`.ok`,`config.yml`);if(B(n))try{let e=H(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return B(R(e,`.ok`))?je(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function ot(){let e={timestamp:new Date().toISOString(),platform:Te(),osType:ke(),osRelease:Ee(),hostname:`[redacted]`,uptime:Ae(),freeMem:Ce(),totalMem:Oe(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=de(`sw_vers -productVersion 2>/dev/null`,d({encoding:`utf8`})).trim()}catch{}try{let t=R(__dirname,`..`,`..`,`package.json`);B(t)&&(e.okVersion=JSON.parse(H(t,`utf8`)).version)}catch{}return e}const st=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function ct(e){let t=I(e);return st.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function lt(e,t){return pt(e,t).files}const ut=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function dt(e,t=ne){let n=R(e,`${t}.ShipIt`);if(!B(n))return[];let r;try{r=U(n)}catch{return[]}return ut.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>R(n,e.entry)))}function ft(e){if(!B(e))return[];try{let t=new Map;for(let n of U(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-i.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>R(e,t))}catch{return[]}}function pt(e,t){if(!B(t))return{files:[],excludedByProjectSlug:0};let n=U(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>R(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(ct),i=[],a=r.filter(t=>{try{return H(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!ct(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function mt(e){let t=R(e,`.ok`,`local`);return B(t)?{files:[`server.lock`,`last-spawn-error.log`,u].map(e=>R(t,e)).filter(e=>B(e))}:{files:[]}}function ht(e){let t=R(e,`.ok`,`local`,`logs`);return B(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>R(t,e)).filter(e=>B(e))}:{files:[]}}function gt(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${je(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function _t(e){let t=e.revealDocNames?e.content:gt(e.content).text;if(e.redact){let{redacted:n,patterns:i,lineCount:a}=r(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),i.length>0&&e.redactions.push({file:e.name,lineCount:a,patterns:i})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function q(e){for(let t of e.files)try{let n=H(t,`utf8`);_t({zipfile:e.zipfile,name:`${e.prefix}/${I(t)}`,content:t.endsWith(`.ips`)?Qe(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function vt(t){let{redact:r,outputPath:i,logger:o}=t,s=t.revealDocNames??!1,c=t.userLogsDir??R(G(),`.ok`,`logs`),l=t.projectDir?at(t.projectDir,o):null;V(L(i),{recursive:!0}),o?.info({projectSlug:l},`gathering diagnostic data`);let u=ot();u.desktop=t.desktop??null,u.language=t.language??null;let{files:d,excludedByProjectSlug:ee}=pt(l,c),{files:f}=t.projectDir?mt(t.projectDir):{files:[]},{files:p}=t.projectDir?ht(t.projectDir):{files:[]},m=t.shipItLogFiles??[],h=t.diagnosticReports?.files??[];o?.info({logFileCount:d.length,logFilesExcludedByProjectSlug:ee,lockFileCount:f.length,localSinkFileCount:p.length,shipItLogFileCount:m.length,diagnosticReportCount:h.length},`files collected`);let g=[],_=[],{ZipFile:v}=await import(`./yazl-BwMlCqRQ.mjs`).then(t=>e(t.default,1)),y=new v;q({zipfile:y,files:[...d,...m],prefix:`logs`,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o}),q({zipfile:y,files:f,prefix:`lockdir`,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o}),q({zipfile:y,files:p,prefix:`local-logs`,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o}),q({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:a,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o}),q({zipfile:y,files:h,prefix:`diagnostic-reports`,redact:r,revealDocNames:s,bundleFiles:_,redactions:g,logger:o});for(let e of t.extraFiles??[])try{let t=H(e.sourcePath),n=`extra/${e.zipName??I(e.sourcePath)}`;y.addBuffer(t,n),_.push(n)}catch(t){o?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&_t({zipfile:y,name:`note.txt`,content:t.note,redact:r,revealDocNames:s,bundleFiles:_,redactions:g});let b=new Set(h.map(e=>`diagnostic-reports/${I(e)}`)),x=_.filter(e=>b.has(e)),S=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Je(t.diagnosticReports,x.length);y.addBuffer(Buffer.from(`${S}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`);let C=JSON.stringify(u,null,2);y.addBuffer(Buffer.from(C,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let w={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:l,files:_,redactions:g,sysinfo:u};y.addBuffer(Buffer.from(JSON.stringify(w,null,2),`utf8`),`MANIFEST.json`);let T=g.reduce((e,t)=>e+t.lineCount,0),E=new Set(m.map(e=>`logs/${I(e)}`)),D=_.filter(e=>E.has(e)),O=new Set((t.bugReportLedgerFiles??[]).map(e=>`${a}/${I(e)}`)),k=_.filter(e=>O.has(e)),te=l?_.filter(e=>e.startsWith(`logs/`)&&!ct(e)&&!E.has(e)):[],A=x.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],j=A.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...A]:[`Redaction was disabled for this bundle; file contents are unmodified.`],M=[`# Bug Report Bundle`,``,`Generated: ${w.generatedAt}`,`Project: ${l??`(unscoped)`}`,`Discipline version: ${w.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...te.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...te.map(e=>`- ${e}`),``]:[],...D.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...D.map(e=>`- ${e}`),``]:[],...x.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...x.map(e=>`- ${e}`),``]:[],...k.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...k.map(e=>`- ${e}`),``]:[],...r?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${n.join(`, `)}`,T>0?`${T} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...A,``,`This bundle is safe to attach to a GitHub issue.`]:j].join(`
3
3
  `);y.addBuffer(Buffer.from(M,`utf8`),`README.md`),y.end();let N=ge(i);return y.outputStream.pipe(N),await new Promise((e,t)=>{N.on(`close`,e),N.on(`error`,t)}),o?.info({bundlePath:i,fileCount:_.length,redactionCount:T},`bundle written`),{zipPath:i,summary:{projectSlug:l,files:_,redactions:g,redactedLineCount:T,generatedAt:w.generatedAt}}}var yt=e(O(),1),J=e(N(),1);function bt(e){return b({absPath:v(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function xt({home:e=G(),env:n=process.env}={}){let r=bt(e),{override:i,preferenceList:a}=x(n),{locale:s,source:l}=t({override:i,storedPreference:r,supportedLocales:o,preferenceList:a,autoDetectableLocales:c});return{preference:r,locale:s,source:l,systemLanguages:a}}function St(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ct(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Y(e,t){if(typeof e==`string`)return St(e,t.contentDir);if(Array.isArray(e))return e.map(e=>Y(e,t));if(!Ct(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Y(i,t);return n}function wt(e,t){let n=H(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
4
4
  `),i=n.split(`
@@ -18,4 +18,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{Ha as t,Ia as n,La as r,ac as i,
18
18
  `).replace(/\n/g,`\r
19
19
  `));let u=`${i?``:``}${l}`;return u!==r&&y(e,u,{mode:F(e)}),{kind:`removed`}}function zn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function Bn(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Vn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&D(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:ee(n),command:n,isDesktop:zn(n)}}function Hn(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const Un=new Set([`running`,`desktop`,`foreign`]);function Wn(e){switch(e){case`running`:return J.default.green(e);case`desktop`:return J.default.blue(e);case`foreign`:return J.default.cyan(e);case`stale`:return J.default.yellow(e)}}function Gn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Kn(e){return`${Gn(e.server.usage)} | ${Gn(e.ui?.usage??null)}`}function qn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function Jn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory,qn(e),Kn(e),Hn(e),String(e.server.pid),Bn(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=Wn(Hn(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=J.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
20
20
  `)}async function Yn(e={}){let t=e.discover??h,n=e.inspect??(e=>$(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??m,a=e.resolveUsage??g,o=await t(),s=[];for(let e of o){let t=n(e),r=Vn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Hn(e)}));r(JSON.stringify(e,null,2));return}r(Jn(e.all?s:s.filter(e=>Un.has(Hn(e)))))}function Xn(){return new M(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Yn({all:t.all===!0||e===`all`,json:t.json===!0})})}async function Zn(e,t=Pe()){let n=$(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=T(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function Qn(e,t={}){return{targets:er(e,t.isAlive??C)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function $n(e){let t=e.inspect??(()=>$(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??Zn,o=e.logger??Pe(),s=Qn(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function er(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function tr(e,t=C){let n=await h(),r=null;for(let i of n){let n=$(i,`server`);if(er(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function nr(e,t){let n=await $n({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function rr(e,t,n={}){return t===0?`Nothing was running for ${e}, and no other open-knowledge servers are running.`:`Nothing was running for ${e}. ${t} other open-knowledge server${t===1?` is`:`s are`} running${n.listingFollows===!0?``:" — run `ok ps` to list them"}.`}async function ir(e){let t=await h(),n=0;for(let r of t)r!==e&&er($(r,`server`),C)&&n++;return n}function ar(e){return new M(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).option(`--force`,`Stop even when editor windows or agents are still connected to the server`).action(async(t,n)=>{let r=n.force===!0,i=t.length===0?void 0:t.join(` `);if(i===void 0){e();let t=_(process.cwd()),n=await $n({lockDir:t,force:r,log:()=>{}});if(n.hadTargets){if(n.stopped.length>0){let e=n.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1)}else{let e=await ir(t);console.log(rr(process.cwd(),e,{listingFollows:e>0})),e>0&&await Yn({})}return}if(i===`all`){let e=await h();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)er($(n,`server`),C)&&(await nr(n,r),t++);t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(i)){let e=Number.parseInt(i,10),t=await tr(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await nr(t,r);return}let a=z(Ve(),i),o=_(a),s=[],c=await $n({lockDir:o,force:r,log:e=>s.push(e)});if((c.failed.length>0||c.declined!==void 0)&&(process.exitCode=1),c.hadTargets)for(let e of s)console.log(e);else console.log(rr(a,await ir(o)))})}export{Ke as C,Re as D,Be as E,Pe as O,Ue as S,Ve as T,K as _,Fn as a,He as b,On as c,En as d,$ as f,it as g,xn as h,Xn as i,Ie as k,An as l,bn as m,$n as n,Dn as o,wn as p,ar as r,Mn as s,Zn as t,jn as u,rt as v,qe as w,We as x,Je as y};
21
- //# sourceMappingURL=src-Dim30w_Y.mjs.map
21
+ //# sourceMappingURL=src-D5pqfubu.mjs.map