@inkeep/open-knowledge 0.48.0-beta.0 → 0.48.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +5 -0
  2. package/dist/{acp-harness-probe-CLjNYBeh.mjs → acp-harness-probe-DgjLEALo.mjs} +2 -2
  3. package/dist/assets/skills/discovery/SKILL.md +1 -1
  4. package/dist/assets/skills/packs/codebase-wiki/SKILL.md +2 -2
  5. package/dist/assets/skills/packs/entity-vault/SKILL.md +2 -2
  6. package/dist/assets/skills/packs/knowledge-base/SKILL.md +6 -6
  7. package/dist/assets/skills/packs/knowledge-base/consolidate/SKILL.md +4 -4
  8. package/dist/assets/skills/packs/knowledge-base/research/SKILL.md +6 -6
  9. package/dist/assets/skills/packs/okf/SKILL.md +2 -2
  10. package/dist/assets/skills/packs/plain-notes/SKILL.md +2 -2
  11. package/dist/assets/skills/packs/software-lifecycle/SKILL.md +7 -7
  12. package/dist/assets/skills/packs/software-lifecycle/frame-a-proposal/SKILL.md +2 -2
  13. package/dist/assets/skills/packs/software-lifecycle/record-a-decision/SKILL.md +2 -2
  14. package/dist/assets/skills/packs/software-lifecycle/review-a-design/SKILL.md +2 -2
  15. package/dist/assets/skills/packs/software-lifecycle/write-a-postmortem/SKILL.md +2 -2
  16. package/dist/assets/skills/packs/software-lifecycle/write-a-spec/SKILL.md +2 -2
  17. package/dist/assets/skills/packs/worldbuilding/SKILL.md +2 -2
  18. package/dist/assets/skills/packs/writing-pipeline/SKILL.md +2 -2
  19. package/dist/assets/skills/project/SKILL.md +3 -3
  20. package/dist/assets/skills/project/references/starter-packs.md +2 -2
  21. package/dist/assets/skills/write-skill/SKILL.md +1 -1
  22. package/dist/cli.mjs +30 -30
  23. package/dist/constants-uLxFyV1-.mjs +2 -0
  24. package/dist/{git-handle-DDjBzdsL.mjs → git-handle-D6plgfL-.mjs} +2 -2
  25. package/dist/git-handle-qS6DQPrF.mjs +1 -0
  26. package/dist/index.mjs +1 -1
  27. package/dist/init-DKGnIaVq.mjs +643 -0
  28. package/dist/init-mzZ0flqJ.mjs +1 -0
  29. package/dist/{launch-json-removal-CW5dt-YP.mjs → launch-json-removal-DaoUddem.mjs} +2 -2
  30. package/dist/{loader-BcI3tO-1.mjs → loader-B5E-OO52.mjs} +2 -2
  31. package/dist/loader-BHzsvYfj.mjs +1 -0
  32. package/dist/md-manager-CpKO8i9i.mjs +2 -0
  33. package/dist/{open-browser-B3-Ef7NQ.mjs → open-browser-ifD987S6.mjs} +2 -2
  34. package/dist/parse-worker.mjs +1 -1
  35. package/dist/{preview-CVcIMjjs.mjs → preview-CKl5PSpe.mjs} +2 -2
  36. package/dist/preview-jJpFrlNd.mjs +1 -0
  37. package/dist/public/assets/{ActivityModeContent-DjiQUaxK.js → ActivityModeContent-8B7wGd5y.js} +1 -1
  38. package/dist/public/assets/{AgentDiffPane-DVqNjX-B.js → AgentDiffPane-BeWRgbnA.js} +1 -1
  39. package/dist/public/assets/{AgentThreadClientBinder-DWbG4rs8.js → AgentThreadClientBinder-FT8wNbjk.js} +1 -1
  40. package/dist/public/assets/{ChangedOutsideBadge-BXDsfsDT.js → ChangedOutsideBadge-Bb-re-nG.js} +1 -1
  41. package/dist/public/assets/{CodeMirrorPropInput-CBS5Kedm.js → CodeMirrorPropInput-BQoCzCdy.js} +1 -1
  42. package/dist/public/assets/{DocumentContext-DsVUZHbY.js → DocumentContext-CcK-mNAi.js} +2 -2
  43. package/dist/public/assets/{EditorModeToggle-DTHXAfTy.js → EditorModeToggle-NV902SqC.js} +1 -1
  44. package/dist/public/assets/{EnableSyncConfirmDialog-Rkcv8fFX.js → EnableSyncConfirmDialog-B3txwN8d.js} +1 -1
  45. package/dist/public/assets/FeedbackForm-1y4YvRvd.js +1 -0
  46. package/dist/public/assets/{GraphPanel-CCCwgc9t.js → GraphPanel-z_BpNtFU.js} +1 -1
  47. package/dist/public/assets/{ImportSkillDialog-DTNfVQlS.js → ImportSkillDialog-CyLMLgQN.js} +1 -1
  48. package/dist/public/assets/{LintConfigEditor-BGSFYjxS.js → LintConfigEditor-SRropTDk.js} +1 -1
  49. package/dist/public/assets/ManagedArtifactProperties-CbgN40D5.js +1 -0
  50. package/dist/public/assets/{ManagedArtifactProperties-ybtGabat.js → ManagedArtifactProperties-DwV7emUI.js} +1 -1
  51. package/dist/public/assets/{McpConsentDialogBody-0WUuivuI.js → McpConsentDialogBody-BiF_k0VW.js} +1 -1
  52. package/dist/public/assets/{MermaidDocEditor-DiODDcNN.js → MermaidDocEditor-DkkZ1470.js} +1 -1
  53. package/dist/public/assets/{ReportBugDialogBody-Bz6zj2ya.js → ReportBugDialogBody-CtlgCQX3.js} +1 -1
  54. package/dist/public/assets/{SchemaConfigEditor-HM0KvRBJ.js → SchemaConfigEditor-DOmoubBM.js} +1 -1
  55. package/dist/public/assets/{SessionsHost-2riVqKto.js → SessionsHost-DCZv6SXD.js} +2 -2
  56. package/dist/public/assets/{SettingsDialogBody-C-RLLaSQ.js → SettingsDialogBody-BegCUhJP.js} +1 -1
  57. package/dist/public/assets/{ShareBranchSwitchDialog-LWhsqKpx.js → ShareBranchSwitchDialog-DYf_N6bq.js} +1 -1
  58. package/dist/public/assets/{ShareReceiveDialog-DkiMKpYB.js → ShareReceiveDialog-ayJ6qYFK.js} +1 -1
  59. package/dist/public/assets/{ShareReceiveMissDialog-BlfRjTjz.js → ShareReceiveMissDialog-OcYPcuBz.js} +1 -1
  60. package/dist/public/assets/{SkillEditBanner-BKknMb0n.js → SkillEditBanner-DBJEqMg4.js} +1 -1
  61. package/dist/public/assets/{SkillOriginInline-BTfGYiOL.js → SkillOriginInline-FJ-Hk1Uz.js} +1 -1
  62. package/dist/public/assets/{SkillToolbarControls-6kAZOtPa.js → SkillToolbarControls-CKBT36Fc.js} +1 -1
  63. package/dist/public/assets/{SourceEditor-D6opP3B_.js → SourceEditor-OE-lSW6p.js} +1 -1
  64. package/dist/public/assets/{TerminalPanel-DpTpMxPr.js → TerminalPanel-DN4Eag17.js} +1 -1
  65. package/dist/public/assets/{TerminalWindowApp-Hmiqsizv.js → TerminalWindowApp-BAn1bShz.js} +1 -1
  66. package/dist/public/assets/{TextDocEditor-B9cpkQ1h.js → TextDocEditor-gUC9Hdas.js} +1 -1
  67. package/dist/public/assets/{ThreadView-ClOb6d2G.js → ThreadView-CklwWwdl.js} +1 -1
  68. package/dist/public/assets/{TimelineDiffPane-Co8A5WJX.js → TimelineDiffPane-R2I1Oytb.js} +1 -1
  69. package/dist/public/assets/{agent-diff-store-DefFCgDx.js → agent-diff-store-BABq_wfE.js} +1 -1
  70. package/dist/public/assets/{agent-visibility-pSgQW56D.js → agent-visibility-p6xMSDdk.js} +1 -1
  71. package/dist/public/assets/{auth-state-cache-DtDuE8TC.js → auth-state-cache-B-pK5XlG.js} +1 -1
  72. package/dist/public/assets/{client-version-kugr1poH.js → client-version-1hLDBtWZ.js} +1 -1
  73. package/dist/public/assets/{comment-chips-eKJtA_0z.js → comment-chips-DhFlg6Lg.js} +1 -1
  74. package/dist/public/assets/{config-context-BwIW8FCz.js → config-context-JFJadbOg.js} +1 -1
  75. package/dist/public/assets/{config-provider-CQHfxw_T.js → config-provider-GgI7K6tF.js} +1 -1
  76. package/dist/public/assets/{dist-DYnLkWYw2.js → dist-D0lKV18u2.js} +2 -2
  77. package/dist/public/assets/{doc-paths-zGDWSnP4.js → doc-paths-BuYvs-Sl.js} +1 -1
  78. package/dist/public/assets/{documents-events-DrpYhlm4.js → documents-events-CZXYlWJs.js} +1 -1
  79. package/dist/public/assets/{file-tree-adapter-VrQojY1R.js → file-tree-adapter-VPm5Cnie.js} +1 -1
  80. package/dist/public/assets/{file-tree-utils-DwQGrZOA.js → file-tree-utils-DEJGOhLm.js} +1 -1
  81. package/dist/public/assets/{folder-config-api-hHnKg-gr.js → folder-config-api-CkzVN79U.js} +1 -1
  82. package/dist/public/assets/{follow-file-LHobDt_S.js → follow-file-Ad0qyANw.js} +1 -1
  83. package/dist/public/assets/{globals-isQ8TLSF.js → globals-CGSd7dgM.js} +1 -1
  84. package/dist/public/assets/{index-CqKKVkkU.js → index-D7Hnjtop.js} +108 -108
  85. package/dist/public/assets/{lint-config-client-iegX1n8T.js → lint-config-client-CKLyoxWn.js} +1 -1
  86. package/dist/public/assets/{markdownlint-rule-browser-DLGYhzDM.js → markdownlint-rule-browser-BJyF5XvC.js} +1 -1
  87. package/dist/public/assets/{navigation-targets-BCEN_wqJ.js → navigation-targets-kcw1-114.js} +1 -1
  88. package/dist/public/assets/{open-managed-artifact-tab-CkjRYJU3.js → open-managed-artifact-tab-CRB-rvl-.js} +1 -1
  89. package/dist/public/assets/{pending-receive-nav-store-BQi_7hNu.js → pending-receive-nav-store-yAE2j52e.js} +1 -1
  90. package/dist/public/assets/{prop-types-CO1vfdpW.js → prop-types-C-VFVfev.js} +1 -1
  91. package/dist/public/assets/{receive-store-Zkulsnri.js → receive-store-C3RyDFMU.js} +1 -1
  92. package/dist/public/assets/{selection-context--eUfBqxv.js → selection-context-CojvRwo6.js} +1 -1
  93. package/dist/public/assets/skill-actions-BVQGnmjM.js +2 -0
  94. package/dist/public/assets/{skill-scope-CE5P-qa2.js → skill-scope-DwDLnOOD.js} +1 -1
  95. package/dist/public/assets/{skills-api-DiFi6C13.js → skills-api-BBaU5yMj.js} +1 -1
  96. package/dist/public/assets/{src-DJkafp4E.js → src-BFaead-K.js} +1 -1
  97. package/dist/public/assets/{tag-pill-input-3_tUFZqt.js → tag-pill-input-T8jCzKA4.js} +1 -1
  98. package/dist/public/assets/{target-navigation-intent-BgP4rk-A.js → target-navigation-intent-ur7EfH9N.js} +1 -1
  99. package/dist/public/assets/{terminal-launch-events-AQ_xnG-R.js → terminal-launch-events-CIEJD8Ca.js} +1 -1
  100. package/dist/public/assets/{terminal-telemetry-BMEqHABV.js → terminal-telemetry-D3CzWhx2.js} +1 -1
  101. package/dist/public/assets/{typing-burst-detector-NUP-QLEw.js → typing-burst-detector-DCq4EEJa.js} +1 -1
  102. package/dist/public/assets/{uninstall-38Y5JJ_e.js → uninstall-oyd1jRGx.js} +1 -1
  103. package/dist/public/assets/{use-activity-panel-W5wD2DFm.js → use-activity-panel-BPsAzeX7.js} +1 -1
  104. package/dist/public/assets/{use-collab-url-BwWR4HI-.js → use-collab-url-oYOwLAYB.js} +1 -1
  105. package/dist/public/assets/{use-live-xterm-theme-KbfqWxbp.js → use-live-xterm-theme-DEdN-vX3.js} +1 -1
  106. package/dist/public/assets/{use-open-skill-BJSoBcc-.js → use-open-skill-Ljj3_grf.js} +1 -1
  107. package/dist/public/assets/{use-settings-route-BOYDhit3.js → use-settings-route-B1Atzr9C.js} +1 -1
  108. package/dist/public/assets/{use-skill-directory-CEid-P_G.js → use-skill-directory-Ie653N2P.js} +1 -1
  109. package/dist/public/assets/{use-skill-origin-DR4xcMJo.js → use-skill-origin-LsbeWa_R.js} +1 -1
  110. package/dist/public/assets/{use-skills-1DslFHtO.js → use-skills-CtCsB6PZ.js} +1 -1
  111. package/dist/public/assets/{use-terminal-enabled-Cf5f3wmZ.js → use-terminal-enabled-BArDTeSK.js} +1 -1
  112. package/dist/public/assets/{use-timeline-entry-diff-DOTzJbQP.js → use-timeline-entry-diff-s1PlK0BB.js} +1 -1
  113. package/dist/public/assets/{use-workspace-BlkDxHAu.js → use-workspace-3mjuTrTC.js} +1 -1
  114. package/dist/public/index.html +44 -44
  115. package/dist/public/uninstall.html +3 -3
  116. package/dist/{repair-launch-json-DSzK0I0T.mjs → repair-launch-json-D2WeY50Y.mjs} +2 -2
  117. package/dist/{repair-mcp-configs-Drmmkvoh.mjs → repair-mcp-configs-BJ9v8T7k.mjs} +2 -2
  118. package/dist/{repair-skills-BzVqzuuo.mjs → repair-skills-Cm70zKLA.mjs} +2 -2
  119. package/dist/repair-skills-DT7FGT3w.mjs +1 -0
  120. package/dist/server-lock-CQ1oOrnO.mjs +1 -0
  121. package/dist/{server-lock--0V-ESY4.mjs → server-lock-DQJq-D9V.mjs} +2 -2
  122. package/dist/{skill-teardown-Crg4l1lZ.mjs → skill-teardown-BQ0YQ9rO.mjs} +2 -2
  123. package/dist/src-BTCvmkZK.mjs +2030 -0
  124. package/dist/src-BuZeH4bR.mjs +1 -0
  125. package/dist/src-CmzmL097.mjs +20 -0
  126. package/dist/{src-Bnk118Ag.mjs → src-y-VpYk60.mjs} +121 -121
  127. package/dist/start-BYT6GfDm.mjs +1 -0
  128. package/dist/{start-CjGC35eg.mjs → start-DT_8Fr-l.mjs} +3 -3
  129. package/dist/{write-project-skill-D_wY5RR9.mjs → write-project-skill-DQTCLDNM.mjs} +4 -4
  130. package/package.json +5 -5
  131. package/dist/constants-T8XJZcO-.mjs +0 -2
  132. package/dist/git-handle-DtHx3JAy.mjs +0 -1
  133. package/dist/init-CFsgSbpu.mjs +0 -643
  134. package/dist/init-DqUHC_mm.mjs +0 -1
  135. package/dist/loader-OdYvbJHt.mjs +0 -1
  136. package/dist/md-manager-BURSRub5.mjs +0 -2
  137. package/dist/preview-CRaIYBd0.mjs +0 -1
  138. package/dist/public/assets/FeedbackForm-wBTRDqbC.js +0 -1
  139. package/dist/public/assets/ManagedArtifactProperties-Ck3NkHUQ.js +0 -1
  140. package/dist/public/assets/skill-actions-Bm9dmT9V.js +0 -2
  141. package/dist/repair-skills-BdXdNQUC.mjs +0 -1
  142. package/dist/server-lock-owrYVjgw.mjs +0 -1
  143. package/dist/src-CX7TfFa6.mjs +0 -2030
  144. package/dist/src-DAPOkcDv.mjs +0 -1
  145. package/dist/src-p8pvGFyq.mjs +0 -20
  146. package/dist/start-C4e_XF0z.mjs +0 -1
@@ -70,12 +70,12 @@
70
70
  -->
71
71
  <script>(() => { const isMode = (v) => v === 'light' || v === 'dark' || v === 'system'; const isThemeId = (v) => typeof v === 'string' && /^[a-z0-9-]{1,32}$/.test(v); let pref = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (isMode(r)) pref = r; } catch {} let slots = null; try { const raw = localStorage.getItem('ok-color-theme-pair-v1'); if (raw) { const o = JSON.parse(raw); if (o?.light && o?.dark) { slots = o; if (isMode(o.pref)) pref = o.pref; } } } catch {} let dark = pref === 'dark'; if (pref === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } let ct = null; if (slots) { const slot = dark ? slots.dark : slots.light; if (isThemeId(slot?.id)) { dark = !!slot.dark; if (slot.id !== 'default') ct = slot.id; } } else { try { const c = localStorage.getItem('ok-color-theme-v1'); if (isThemeId(c) && c !== 'default') ct = c; } catch {} } let customCss = null; if (ct === 'custom') { try { const raw = localStorage.getItem('ok-custom-theme-v1'); if (raw) { const o = JSON.parse(raw); if (o?.css) { customCss = o.css; dark = !!o.dark; } } } catch {} if (!customCss) ct = null; } if (dark) document.documentElement.classList.add('dark'); if (ct) document.documentElement.setAttribute('data-color-theme', ct); if (customCss) { const s = document.createElement('style'); s.id = 'ok-custom-theme'; s.textContent = customCss; document.head.appendChild(s); } if (window.okDesktop) { document.documentElement.classList.add('electron-mode'); document.documentElement.classList.add(`electron-platform-${window.okDesktop.platform}`); } })();</script>
72
72
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
73
- <script type="module" crossorigin src="./assets/index-CqKKVkkU.js"></script>
73
+ <script type="module" crossorigin src="./assets/index-D7Hnjtop.js"></script>
74
74
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
75
75
  <link rel="modulepreload" crossorigin href="./assets/dist-CpRBr-Ct.js">
76
76
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
77
77
  <link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
78
- <link rel="modulepreload" crossorigin href="./assets/globals-isQ8TLSF.js">
78
+ <link rel="modulepreload" crossorigin href="./assets/globals-CGSd7dgM.js">
79
79
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-Chd9yIcd.js">
80
80
  <link rel="modulepreload" crossorigin href="./assets/w3c-keyname-hgmz1BF7.js">
81
81
  <link rel="modulepreload" crossorigin href="./assets/dist-zYQJXuRH.js">
@@ -102,10 +102,10 @@
102
102
  <link rel="modulepreload" crossorigin href="./assets/trace-api-DH580DYm.js">
103
103
  <link rel="modulepreload" crossorigin href="./assets/lib-CtlgmvnR.js">
104
104
  <link rel="modulepreload" crossorigin href="./assets/markdownit-DoX6x6DK.js">
105
- <link rel="modulepreload" crossorigin href="./assets/dist-DYnLkWYw2.js">
106
- <link rel="modulepreload" crossorigin href="./assets/client-version-kugr1poH.js">
107
- <link rel="modulepreload" crossorigin href="./assets/config-context-BwIW8FCz.js">
108
- <link rel="modulepreload" crossorigin href="./assets/config-provider-CQHfxw_T.js">
105
+ <link rel="modulepreload" crossorigin href="./assets/dist-D0lKV18u2.js">
106
+ <link rel="modulepreload" crossorigin href="./assets/client-version-1hLDBtWZ.js">
107
+ <link rel="modulepreload" crossorigin href="./assets/config-context-JFJadbOg.js">
108
+ <link rel="modulepreload" crossorigin href="./assets/config-provider-GgI7K6tF.js">
109
109
  <link rel="modulepreload" crossorigin href="./assets/dist-Bi80hc1t.js">
110
110
  <link rel="modulepreload" crossorigin href="./assets/dist-CR6aO28t.js">
111
111
  <link rel="modulepreload" crossorigin href="./assets/dist-DpaqLIPT.js">
@@ -137,22 +137,22 @@
137
137
  <link rel="modulepreload" crossorigin href="./assets/switch-0kSGDL9E.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/folder-open-ee990ToL.js">
139
139
  <link rel="modulepreload" crossorigin href="./assets/trash-2-Ccq_llrY.js">
140
- <link rel="modulepreload" crossorigin href="./assets/file-tree-utils-DwQGrZOA.js">
141
- <link rel="modulepreload" crossorigin href="./assets/doc-paths-zGDWSnP4.js">
142
- <link rel="modulepreload" crossorigin href="./assets/skill-scope-CE5P-qa2.js">
143
- <link rel="modulepreload" crossorigin href="./assets/navigation-targets-BCEN_wqJ.js">
140
+ <link rel="modulepreload" crossorigin href="./assets/file-tree-utils-DEJGOhLm.js">
141
+ <link rel="modulepreload" crossorigin href="./assets/doc-paths-BuYvs-Sl.js">
142
+ <link rel="modulepreload" crossorigin href="./assets/skill-scope-DwDLnOOD.js">
143
+ <link rel="modulepreload" crossorigin href="./assets/navigation-targets-kcw1-114.js">
144
144
  <link rel="modulepreload" crossorigin href="./assets/asset-dispatch-O9x3rXhj.js">
145
145
  <link rel="modulepreload" crossorigin href="./assets/external-link-COF7NUCm.js">
146
146
  <link rel="modulepreload" crossorigin href="./assets/documents-fetch-DK-kdvYE.js">
147
- <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-CBS5Kedm.js">
147
+ <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-BQoCzCdy.js">
148
148
  <link rel="modulepreload" crossorigin href="./assets/git-branch-B0WeYwW-.js">
149
149
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-V8YoC6ss.js">
150
150
  <link rel="modulepreload" crossorigin href="./assets/Mermaid-DT9lZOmy.js">
151
151
  <link rel="modulepreload" crossorigin href="./assets/CopyButton-DfXJBl0I.js">
152
- <link rel="modulepreload" crossorigin href="./assets/documents-events-DrpYhlm4.js">
152
+ <link rel="modulepreload" crossorigin href="./assets/documents-events-CZXYlWJs.js">
153
153
  <link rel="modulepreload" crossorigin href="./assets/parse-api-error-BFe1cdS7.js">
154
154
  <link rel="modulepreload" crossorigin href="./assets/startup-marks-BJYEMeGu.js">
155
- <link rel="modulepreload" crossorigin href="./assets/prop-types-CO1vfdpW.js">
155
+ <link rel="modulepreload" crossorigin href="./assets/prop-types-C-VFVfev.js">
156
156
  <link rel="modulepreload" crossorigin href="./assets/eye-CArKS_Md.js">
157
157
  <link rel="modulepreload" crossorigin href="./assets/hash-CDGtqqEo.js">
158
158
  <link rel="modulepreload" crossorigin href="./assets/info-BnJuC0vW.js">
@@ -162,34 +162,34 @@
162
162
  <link rel="modulepreload" crossorigin href="./assets/file-tree-rename-validation-DEz_ryBu.js">
163
163
  <link rel="modulepreload" crossorigin href="./assets/badge-CnYDYmI5.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/input-CtKG6a5B.js">
165
- <link rel="modulepreload" crossorigin href="./assets/use-collab-url-BwWR4HI-.js">
166
- <link rel="modulepreload" crossorigin href="./assets/skills-api-DiFi6C13.js">
167
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-DsVUZHbY.js">
165
+ <link rel="modulepreload" crossorigin href="./assets/use-collab-url-oYOwLAYB.js">
166
+ <link rel="modulepreload" crossorigin href="./assets/skills-api-BBaU5yMj.js">
167
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-CcK-mNAi.js">
168
168
  <link rel="modulepreload" crossorigin href="./assets/format-CFFWVvag.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/braces-PuTG97X6.js">
170
- <link rel="modulepreload" crossorigin href="./assets/folder-config-api-hHnKg-gr.js">
171
- <link rel="modulepreload" crossorigin href="./assets/comment-chips-eKJtA_0z.js">
170
+ <link rel="modulepreload" crossorigin href="./assets/folder-config-api-CkzVN79U.js">
171
+ <link rel="modulepreload" crossorigin href="./assets/comment-chips-DhFlg6Lg.js">
172
172
  <link rel="modulepreload" crossorigin href="./assets/textarea-CUVLEZhx.js">
173
- <link rel="modulepreload" crossorigin href="./assets/selection-context--eUfBqxv.js">
174
- <link rel="modulepreload" crossorigin href="./assets/lint-config-client-iegX1n8T.js">
175
- <link rel="modulepreload" crossorigin href="./assets/use-skills-1DslFHtO.js">
176
- <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-ybtGabat.js">
173
+ <link rel="modulepreload" crossorigin href="./assets/selection-context-CojvRwo6.js">
174
+ <link rel="modulepreload" crossorigin href="./assets/lint-config-client-CKLyoxWn.js">
175
+ <link rel="modulepreload" crossorigin href="./assets/use-skills-CtCsB6PZ.js">
176
+ <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-DwV7emUI.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/cursor-W0skD8YU.js">
178
178
  <link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon-CSZXCqwG.js">
179
179
  <link rel="modulepreload" crossorigin href="./assets/folder-DxrU2PLH.js">
180
180
  <link rel="modulepreload" crossorigin href="./assets/copilot-CuzHDCzI.js">
181
- <link rel="modulepreload" crossorigin href="./assets/agent-visibility-pSgQW56D.js">
182
- <link rel="modulepreload" crossorigin href="./assets/use-workspace-BlkDxHAu.js">
183
- <link rel="modulepreload" crossorigin href="./assets/ChangedOutsideBadge-BXDsfsDT.js">
184
- <link rel="modulepreload" crossorigin href="./assets/use-open-skill-BJSoBcc-.js">
185
- <link rel="modulepreload" crossorigin href="./assets/use-settings-route-BOYDhit3.js">
181
+ <link rel="modulepreload" crossorigin href="./assets/agent-visibility-p6xMSDdk.js">
182
+ <link rel="modulepreload" crossorigin href="./assets/use-workspace-3mjuTrTC.js">
183
+ <link rel="modulepreload" crossorigin href="./assets/ChangedOutsideBadge-Bb-re-nG.js">
184
+ <link rel="modulepreload" crossorigin href="./assets/use-open-skill-Ljj3_grf.js">
185
+ <link rel="modulepreload" crossorigin href="./assets/use-settings-route-B1Atzr9C.js">
186
186
  <link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-DPkNOslT.js">
187
- <link rel="modulepreload" crossorigin href="./assets/skill-actions-Bm9dmT9V.js">
187
+ <link rel="modulepreload" crossorigin href="./assets/skill-actions-BVQGnmjM.js">
188
188
  <link rel="modulepreload" crossorigin href="./assets/radio-group-CmCnommQ.js">
189
189
  <link rel="modulepreload" crossorigin href="./assets/separator-C4EdGs_S.js">
190
190
  <link rel="modulepreload" crossorigin href="./assets/toggle-group-DAYvcc1F.js">
191
191
  <link rel="modulepreload" crossorigin href="./assets/useQuery-ZeEDLtxh.js">
192
- <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-Rkcv8fFX.js">
192
+ <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-B3txwN8d.js">
193
193
  <link rel="modulepreload" crossorigin href="./assets/arrow-up-right-Gp4MuO-g.js">
194
194
  <link rel="modulepreload" crossorigin href="./assets/case-sensitive-DyF7sIpA.js">
195
195
  <link rel="modulepreload" crossorigin href="./assets/chevron-left-BRFq0qcJ.js">
@@ -198,38 +198,38 @@
198
198
  <link rel="modulepreload" crossorigin href="./assets/lint-plugin-meta-BnniPb1r.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/panel-UxAkffLp.js">
200
200
  <link rel="modulepreload" crossorigin href="./assets/skeleton-DS8zjX9Q.js">
201
- <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-NUP-QLEw.js">
201
+ <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-DCq4EEJa.js">
202
202
  <link rel="modulepreload" crossorigin href="./assets/download-QOlmqXQ8.js">
203
203
  <link rel="modulepreload" crossorigin href="./assets/field-iFofWrdC.js">
204
- <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-DtDuE8TC.js">
204
+ <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-B-pK5XlG.js">
205
205
  <link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-B3cHkf8G.js">
206
- <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-BQi_7hNu.js">
207
- <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-AQ_xnG-R.js">
208
- <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-CkjRYJU3.js">
209
- <link rel="modulepreload" crossorigin href="./assets/use-skill-directory-CEid-P_G.js">
206
+ <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-yAE2j52e.js">
207
+ <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-CIEJD8Ca.js">
208
+ <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-CRB-rvl-.js">
209
+ <link rel="modulepreload" crossorigin href="./assets/use-skill-directory-Ie653N2P.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/panel-right-open-Cc56I_GE.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/square-pen-CEIus1aL.js">
212
212
  <link rel="modulepreload" crossorigin href="./assets/undo-2-bYFSgQwb.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/form-CGbOgaUs.js">
214
- <link rel="modulepreload" crossorigin href="./assets/follow-file-LHobDt_S.js">
214
+ <link rel="modulepreload" crossorigin href="./assets/follow-file-Ad0qyANw.js">
215
215
  <link rel="modulepreload" crossorigin href="./assets/text-viewer-languages-DEjz8Rlz.js">
216
- <link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-DTHXAfTy.js">
216
+ <link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-NV902SqC.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/ConfigSharingInfoTooltip-BhNgrS2h.js">
218
218
  <link rel="modulepreload" crossorigin href="./assets/project-paths--7l9Mqe-.js">
219
219
  <link rel="modulepreload" crossorigin href="./assets/SkillModeBanner-DFgrdWyf.js">
220
- <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-VrQojY1R.js">
221
- <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-DefFCgDx.js">
222
- <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-BgP4rk-A.js">
223
- <link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-KbfqWxbp.js">
220
+ <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-VPm5Cnie.js">
221
+ <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-BABq_wfE.js">
222
+ <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-ur7EfH9N.js">
223
+ <link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-DEdN-vX3.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/input-group-BgDCDWUR.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/use-installed-clis-B7_xP0xS.js">
226
- <link rel="modulepreload" crossorigin href="./assets/use-skill-origin-DR4xcMJo.js">
227
- <link rel="modulepreload" crossorigin href="./assets/terminal-telemetry-BMEqHABV.js">
226
+ <link rel="modulepreload" crossorigin href="./assets/use-skill-origin-LsbeWa_R.js">
227
+ <link rel="modulepreload" crossorigin href="./assets/terminal-telemetry-D3CzWhx2.js">
228
228
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-C8KjkxgZ.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/auth-prompt-store-DQ_HcDxh.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-Dz4H-8gV.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/overlay-layers-CBGNHxJK.js">
232
- <link rel="modulepreload" crossorigin href="./assets/receive-store-Zkulsnri.js">
232
+ <link rel="modulepreload" crossorigin href="./assets/receive-store-C3RyDFMU.js">
233
233
  <link rel="modulepreload" crossorigin href="./assets/timeline-diff-store-sC1fl4YV.js">
234
234
  <link rel="stylesheet" crossorigin href="./assets/globals-rA-7Xs6l.css">
235
235
  <link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
@@ -32,18 +32,18 @@
32
32
  script above.
33
33
  -->
34
34
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
35
- <script type="module" crossorigin src="./assets/uninstall-38Y5JJ_e.js"></script>
35
+ <script type="module" crossorigin src="./assets/uninstall-oyd1jRGx.js"></script>
36
36
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
37
37
  <link rel="modulepreload" crossorigin href="./assets/dist-CpRBr-Ct.js">
38
38
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
39
39
  <link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
40
- <link rel="modulepreload" crossorigin href="./assets/globals-isQ8TLSF.js">
40
+ <link rel="modulepreload" crossorigin href="./assets/globals-CGSd7dgM.js">
41
41
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-Chd9yIcd.js">
42
42
  <link rel="modulepreload" crossorigin href="./assets/trace-api-DH580DYm.js">
43
43
  <link rel="modulepreload" crossorigin href="./assets/lib-CtlgmvnR.js">
44
44
  <link rel="modulepreload" crossorigin href="./assets/markdownit-DoX6x6DK.js">
45
45
  <link rel="modulepreload" crossorigin href="./assets/w3c-keyname-hgmz1BF7.js">
46
- <link rel="modulepreload" crossorigin href="./assets/dist-DYnLkWYw2.js">
46
+ <link rel="modulepreload" crossorigin href="./assets/dist-D0lKV18u2.js">
47
47
  <link rel="modulepreload" crossorigin href="./assets/jsx-runtime-BUgB2tll.js">
48
48
  <link rel="modulepreload" crossorigin href="./assets/dist-Nvb76hAm.js">
49
49
  <link rel="modulepreload" crossorigin href="./assets/dist-DUWYPul7.js">
@@ -1,2 +1,2 @@
1
- import{t as e}from"./launch-json-removal-CW5dt-YP.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`||o.kind===`removed-file`;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-DSzK0I0T.mjs.map
1
+ import{t as e}from"./launch-json-removal-DaoUddem.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`||o.kind===`removed-file`;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-D2WeY50Y.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e,g as t,s as n}from"./write-project-skill-D_wY5RR9.mjs";import{d as r,v as i}from"./init-CFsgSbpu.mjs";import{t as a}from"./mcp-migrate-event-B1gJf6bG.mjs";import{homedir as o}from"node:os";function s(t){let r=t.logger??u,i=t.home??o(),a=[];if(t.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of e){let e=n[o],s=c(()=>e.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:e,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),e.projectConfigPath){let n=e.projectConfigPath,i=c(()=>n(t.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:e,home:void 0,cwd:t.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let n={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=r(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...n,outcome:`no-entry`};if(t(o))return{...n,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=i(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let t=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:t}),{...n,outcome:`write-failed`,error:t}}return s.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:s.declineReason}),{...n,outcome:`declined`}):{...n,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
- //# sourceMappingURL=repair-mcp-configs-Drmmkvoh.mjs.map
1
+ import{a as e,g as t,s as n}from"./write-project-skill-DQTCLDNM.mjs";import{d as r,v as i}from"./init-DKGnIaVq.mjs";import{t as a}from"./mcp-migrate-event-B1gJf6bG.mjs";import{homedir as o}from"node:os";function s(t){let r=t.logger??u,i=t.home??o(),a=[];if(t.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of e){let e=n[o],s=c(()=>e.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:e,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),e.projectConfigPath){let n=e.projectConfigPath,i=c(()=>n(t.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:e,home:void 0,cwd:t.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let n={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=r(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...n,outcome:`no-entry`};if(t(o))return{...n,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=i(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let t=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:t}),{...n,outcome:`write-failed`,error:t}}return s.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:s.declineReason}),{...n,outcome:`declined`}):{...n,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
+ //# sourceMappingURL=repair-mcp-configs-BJ9v8T7k.mjs.map
@@ -1,4 +1,4 @@
1
- import{R as e}from"./src-Bnk118Ag.mjs";import{Xn as t,Zn as n,dr as r,er as i,ir as a,nr as o,or as s,tr as c,ur as l}from"./src-CX7TfFa6.mjs";import{c as u,s as d,t as f,x as p}from"./write-project-skill-D_wY5RR9.mjs";import{n as m,s as h,t as g}from"./colors-BsmVIwfM.mjs";import{n as _,r as v,t as y}from"./skill-teardown-Crg4l1lZ.mjs";import{dirname as b,join as x,relative as S,resolve as C}from"node:path";import{existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,statSync as k,writeFileSync as A}from"node:fs";import{homedir as j}from"node:os";import{createInterface as M}from"node:readline/promises";const N={existsSync:e=>w(e),isDirectory:e=>{try{return k(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>D(e),readFileSync:e=>E(e),writeFileSync:(e,t)=>{A(e,t)},mkdirSync:(e,t)=>{T(e,t)},rmSync:(e,t)=>{O(e,t)}},P={resolveProjectBundledSkillDir:()=>s(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>s(e,{checkDesktop:!1}),readBundledVersion:()=>n(),readRecordedVersion:e=>i(e,`cli-hosts`),writeRecordedVersion:(e,t)=>o(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>a(e),readBundleDecision:(e,n)=>t(e,n),writeBundleDecision:(e,t,n)=>c(e,t,n),removeBundleFromDisk:(e,t)=>v(e,t)};function F(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function I(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(b(t),{recursive:!0}),L(e,t,n)}function L(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=x(e,r),a=x(t,r);n.isDirectory(i)?L(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function R(e,t,n,r,i,a){let o=[],s=x(e,`.agents`,`skills`,t),c=!1;if(r.existsSync(s))o.push({kind:`central`,path:s,outcome:`skipped-present`});else try{I(n,s,r),c=!0,o.push({kind:`central`,path:s,outcome:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:!1,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of u){let l=x(e,c.hostDir),u=x(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(r.existsSync(u)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-present`});continue}try{I(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:!1,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:c}}function z(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function B(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of u){let o=x(e,t.hostDir,`skills`,`open-knowledge`),s=x(o,`SKILL.md`);if(n.existsSync(s)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`present`});continue}let c=d[t.editorId]?.projectConfigPath?.(e);if(!z(c,n)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{f(o,e),I(i,o,n),a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`created`}),r({event:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function V(t,n,i,a){let o=e=>{n.recordEvent(e).catch(()=>{})},s=()=>new Date().toISOString(),c;try{c=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return a({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await n.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of r)try{d.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return a({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let r of d){let o=l[r.id],s=i.existsSync(x(t,`.agents`,`skills`,o)),c=await n.readBundleDecision(t,o).catch(()=>null);if(!e(c,{installedOnDisk:s})){if(s)try{n.removeBundleFromDisk(t,r.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:r.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:r.id,error:e instanceof Error?e.message:String(e)})}continue}if(c===null&&s)try{await n.writeBundleDecision(t,o,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:r.id,error:e instanceof Error?e.message:String(e)})}p.push(r)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>i.existsSync(x(t,`.agents`,`skills`,l[e.id])));if(u!==null&&u===c&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:c}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===r.length,_=[];for(let{id:e,sourceDir:n}of p){let r=R(t,l[e],n,i,a,c);h.push(...r.entries),_.push({id:e,centralWritten:r.centralWritten})}let v=h.some(e=>e.kind===`central`&&e.outcome===`failed`);if(g&&!v){let e=null;try{await n.writeRecordedVersion(t,c),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:c})}catch(t){e=t instanceof Error?t.message:String(t),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:c,error:e})}for(let{id:t,centralWritten:n}of _)o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?n?`installed`:`skip-current`:`failed`,version:c,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:c,reason:g?e?`all-writes-failed`:`central-write-failed`:`bundle-unresolved`})}return{outcome:`done`,version:c,entries:h}}async function H(e){let t=e.logger??F,n=e.fs??N,r=e.home??j(),i={...P,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=B(e.projectDir,i,n,t),o=await V(r,i,n,t),s=_(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=y(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 U(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 W(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;t.push(` Project: ${n} present, ${r} created, ${i} no-token, ${a} failed.`)}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{R as e}from"./src-y-VpYk60.mjs";import{Qn as t,Zn as n,cr as r,fr as i,nr as a,or as o,pr as s,rr as c,tr as l}from"./src-BTCvmkZK.mjs";import{c as u,s as d,t as f,x as p}from"./write-project-skill-DQTCLDNM.mjs";import{n as m,s as h,t as g}from"./colors-BsmVIwfM.mjs";import{n as _,r as v,t as y}from"./skill-teardown-BQ0YQ9rO.mjs";import{dirname as b,join as x,relative as S,resolve as C}from"node:path";import{existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,statSync as k,writeFileSync as A}from"node:fs";import{homedir as j}from"node:os";import{createInterface as M}from"node:readline/promises";const N={existsSync:e=>w(e),isDirectory:e=>{try{return k(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>D(e),readFileSync:e=>E(e),writeFileSync:(e,t)=>{A(e,t)},mkdirSync:(e,t)=>{T(e,t)},rmSync:(e,t)=>{O(e,t)}},P={resolveProjectBundledSkillDir:()=>r(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>r(e,{checkDesktop:!1}),readBundledVersion:()=>t(),readRecordedVersion:e=>l(e,`cli-hosts`),writeRecordedVersion:(e,t)=>c(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>o(e),readBundleDecision:(e,t)=>n(e,t),writeBundleDecision:(e,t,n)=>a(e,t,n),removeBundleFromDisk:(e,t)=>v(e,t)};function F(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function I(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(b(t),{recursive:!0}),L(e,t,n)}function L(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=x(e,r),a=x(t,r);n.isDirectory(i)?L(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function R(e,t,n,r,i,a){let o=[],s=x(e,`.agents`,`skills`,t),c=!1;if(r.existsSync(s))o.push({kind:`central`,path:s,outcome:`skipped-present`});else try{I(n,s,r),c=!0,o.push({kind:`central`,path:s,outcome:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:!1,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of u){let l=x(e,c.hostDir),u=x(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(r.existsSync(u)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-present`});continue}try{I(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:!1,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:c}}function z(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function B(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of u){let o=x(e,t.hostDir,`skills`,`open-knowledge`),s=x(o,`SKILL.md`);if(n.existsSync(s)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`present`});continue}let c=d[t.editorId]?.projectConfigPath?.(e);if(!z(c,n)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{f(o,e),I(i,o,n),a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`created`}),r({event:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function V(t,n,r,a){let o=e=>{n.recordEvent(e).catch(()=>{})},c=()=>new Date().toISOString(),l;try{l=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return a({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),o({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await n.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of s)try{d.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return a({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),o({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let o of d){let s=i[o.id],c=r.existsSync(x(t,`.agents`,`skills`,s)),l=await n.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{n.removeBundleFromDisk(t,o.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:o.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:o.id,error:e instanceof Error?e.message:String(e)})}continue}if(l===null&&c)try{await n.writeBundleDecision(t,s,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:o.id,error:e instanceof Error?e.message:String(e)})}p.push(o)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>r.existsSync(x(t,`.agents`,`skills`,i[e.id])));if(u!==null&&u===l&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:l}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===s.length,_=[];for(let{id:e,sourceDir:n}of p){let o=R(t,i[e],n,r,a,l);h.push(...o.entries),_.push({id:e,centralWritten:o.centralWritten})}let v=h.some(e=>e.kind===`central`&&e.outcome===`failed`);if(g&&!v){let e=null;try{await n.writeRecordedVersion(t,l),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:l})}catch(t){e=t instanceof Error?t.message:String(t),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:l,error:e})}for(let{id:t,centralWritten:n}of _)o({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?n?`installed`:`skip-current`:`failed`,version:l,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);o({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:l,reason:g?e?`all-writes-failed`:`central-write-failed`:`bundle-unresolved`})}return{outcome:`done`,version:l,entries:h}}async function H(e){let t=e.logger??F,n=e.fs??N,r=e.home??j(),i={...P,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=B(e.projectDir,i,n,t),o=await V(r,i,n,t),s=_(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=y(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 U(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 W(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;t.push(` Project: ${n} present, ${r} created, ${i} no-token, ${a} failed.`)}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 G(){return new p(`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 H({projectDir:C(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null,confirmLegacyCleanup:t=>K(t,{yes:e.yes===!0})});process.stdout.write(`${W(t)}\n`),process.exitCode=U(t)})}async function K(e,t){let n=j(),r=e=>`~/${S(n,e)}`,i=t.input??process.stdin,a=[``,g(`A previous version of OpenKnowledge installed its skill into agent tools you may never have used.`),m(`(Versions before 0.42 wrote to every host a third-party installer knew about — see issue #820.)`)];if(e.skillDirs.length>0&&a.push(``,`${g(`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(``,`${g(t)} ${e.emptyDirs.length}`,...e.emptyDirs.map(e=>` ${r(e)}`))}if(a.push(``,m(`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(`${h("Not a terminal — skipping cleanup. Re-run with `ok repair-skills --yes` to remove these.")}\n`),!1;let o=M({input:i,output:process.stdout});try{let e=(await o.question(`\n${g(`Remove them?`)} ${m(`[y/N] `)}`)).trim().toLowerCase();return e===`y`||e===`yes`}finally{o.close()}}export{G as n,H as t};
4
- //# sourceMappingURL=repair-skills-BzVqzuuo.mjs.map
4
+ //# sourceMappingURL=repair-skills-Cm70zKLA.mjs.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./repair-skills-Cm70zKLA.mjs";export{e as repairSkills};
@@ -0,0 +1 @@
1
+ import{a as e,o as t,r as n}from"./server-lock-DQJq-D9V.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
@@ -1,2 +1,2 @@
1
- import"./src-Bnk118Ag.mjs";import{r as e}from"./logger-BZPV1wv8.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{fileURLToPath as i}from"node:url";import{closeSync as a,existsSync as o,mkdirSync as s,openSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d,writeSync as f}from"node:fs";import{homedir as p,hostname as m}from"node:os";import{randomUUID as h}from"node:crypto";function g(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function _(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function v(e){return new URL(e.url??``,`http://localhost`).searchParams}function y(e){let t=e?.code;return typeof t==`string`?t:void 0}const b=/^[A-Za-z0-9-]{8,64}$/;let x=null;function S(e){return n(e??p(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=l(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{s(t(r),{recursive:!0}),d(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(x=i),i}function w(){try{let e=r(t(i(import.meta.url)),`..`,`package.json`),n=JSON.parse(l(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const T=w(),E=1,D=e(`process-lock`);var O=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function k(e,t){return r(e,`${t}.lock`)}const A=new Map;function j(e){A.set(e,(A.get(e)??0)+1)}function M(e){let t=A.get(e);return t===void 0||t<=1?(A.delete(e),!0):(A.set(e,t-1),!1)}function N(e){return typeof e.machineId==`string`?e.machineId===C():e.hostname===m()}const P=new Set;let F=!1;function I(e){P.add(e),!F&&(F=!0,process.on(`exit`,()=>{for(let e of P)try{let t=JSON.parse(l(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==C()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==m())continue;u(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(l(e,`utf-8`));return n&&typeof n==`object`&&_(n.pid)?n:(D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function R(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;s(n,{recursive:!0});let l=k(n,t),p={pid:process.pid,hostname:m(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:C(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??T},h=JSON.stringify(p,null,2);for(let e=0;e<3;e++){if(!o(l))try{let e=c(l,`wx`,384);try{f(e,h)}finally{a(e)}return j(l),I(l),z({lockName:t,lockDir:n,lockPath:l})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(l,i);if(e){if(N(e)&&e.pid===process.pid)return d(l,h,{encoding:`utf-8`,mode:384}),j(l),I(l),z({lockName:t,lockDir:n,lockPath:l});if(g(e.pid))throw new O(e,l,t);D.warn({pid:e.pid,host:e.hostname},`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{u(l)}catch{}}throw Error(`${i} Failed to acquire ${l} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>G({lockName:t,lockDir:n}),updatePort:e=>B({lockName:t,lockDir:n,port:e})}}function B(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=k(n,t);if(!o(a)){D.warn({lockPath:a},`${i} Lock file missing at ${a} during port update — skipping`);return}let s;try{let e=JSON.parse(l(a,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:a},`${i} Corrupt lock at ${a} during port update — skipping`);return}s=e}catch{D.warn({lockPath:a},`${i} Unreadable lock at ${a} during port update — skipping`);return}if(s.pid===process.pid&&N(s)){s.port=r;try{d(a,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:a,err:e},`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function V(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=k(n,t);if((A.get(i)??0)>1)return;let a;try{let e=JSON.parse(l(i,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){y(e)!==`ENOENT`&&D.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&N(a)&&a.draining!==!0){a.draining=!0;try{d(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function H(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!o(r))return null;let i;try{let e=JSON.parse(l(r,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid))return null;i=e}catch{return null}if(!N(i))return null;if(!g(i.pid)){try{u(r)}catch{}return null}return i}function U(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!o(r))return{status:`absent`};let i;try{i=JSON.parse(l(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!_(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,machineId:typeof a.machineId==`string`?a.machineId:void 0,draining:a.draining===!0?!0:void 0,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{u(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function W(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>H({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function G(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,a=k(n,t);if(M(a)){if(r){V({lockName:t,lockDir:n});return}if(o(a))try{let e=JSON.parse(l(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;u(a),P.delete(a)}catch(e){D.warn({lockPath:a,err:e},`${i} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}}var K=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function q(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new K(e.existing,e.lockPath):e}}function J(e,t){B({lockName:`server`,lockDir:e,port:t})}function Y(e){return H({lockName:`server`,lockDir:e})}function X(e,t){G({lockName:`server`,lockDir:e,...t})}function Z(e){V({lockName:`server`,lockDir:e})}function Q(e,t){return W({lockName:`server`,lockDir:e,...t})}export{_ as S,E as _,X as a,v as b,O as c,V as d,H as f,T as g,B as h,Y as i,R as l,G as m,q as n,J as o,U as p,Z as r,Q as s,K as t,k as u,C as v,g as x,y};
2
- //# sourceMappingURL=server-lock--0V-ESY4.mjs.map
1
+ import"./src-y-VpYk60.mjs";import{r as e}from"./logger-BZPV1wv8.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{fileURLToPath as i}from"node:url";import{closeSync as a,existsSync as o,mkdirSync as s,openSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d,writeSync as f}from"node:fs";import{homedir as p,hostname as m}from"node:os";import{randomUUID as h}from"node:crypto";function g(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function _(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function v(e){return new URL(e.url??``,`http://localhost`).searchParams}function y(e){let t=e?.code;return typeof t==`string`?t:void 0}const b=/^[A-Za-z0-9-]{8,64}$/;let x=null;function S(e){return n(e??p(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=l(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{s(t(r),{recursive:!0}),d(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(x=i),i}function w(){try{let e=r(t(i(import.meta.url)),`..`,`package.json`),n=JSON.parse(l(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const T=w(),E=1,D=e(`process-lock`);var O=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function k(e,t){return r(e,`${t}.lock`)}const A=new Map;function j(e){A.set(e,(A.get(e)??0)+1)}function M(e){let t=A.get(e);return t===void 0||t<=1?(A.delete(e),!0):(A.set(e,t-1),!1)}function N(e){return typeof e.machineId==`string`?e.machineId===C():e.hostname===m()}const P=new Set;let F=!1;function I(e){P.add(e),!F&&(F=!0,process.on(`exit`,()=>{for(let e of P)try{let t=JSON.parse(l(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==C()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==m())continue;u(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(l(e,`utf-8`));return n&&typeof n==`object`&&_(n.pid)?n:(D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function R(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;s(n,{recursive:!0});let l=k(n,t),p={pid:process.pid,hostname:m(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:C(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??T},h=JSON.stringify(p,null,2);for(let e=0;e<3;e++){if(!o(l))try{let e=c(l,`wx`,384);try{f(e,h)}finally{a(e)}return j(l),I(l),z({lockName:t,lockDir:n,lockPath:l})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(l,i);if(e){if(N(e)&&e.pid===process.pid)return d(l,h,{encoding:`utf-8`,mode:384}),j(l),I(l),z({lockName:t,lockDir:n,lockPath:l});if(g(e.pid))throw new O(e,l,t);D.warn({pid:e.pid,host:e.hostname},`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{u(l)}catch{}}throw Error(`${i} Failed to acquire ${l} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>G({lockName:t,lockDir:n}),updatePort:e=>B({lockName:t,lockDir:n,port:e})}}function B(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=k(n,t);if(!o(a)){D.warn({lockPath:a},`${i} Lock file missing at ${a} during port update — skipping`);return}let s;try{let e=JSON.parse(l(a,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:a},`${i} Corrupt lock at ${a} during port update — skipping`);return}s=e}catch{D.warn({lockPath:a},`${i} Unreadable lock at ${a} during port update — skipping`);return}if(s.pid===process.pid&&N(s)){s.port=r;try{d(a,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:a,err:e},`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function V(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=k(n,t);if((A.get(i)??0)>1)return;let a;try{let e=JSON.parse(l(i,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){y(e)!==`ENOENT`&&D.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&N(a)&&a.draining!==!0){a.draining=!0;try{d(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function H(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!o(r))return null;let i;try{let e=JSON.parse(l(r,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid))return null;i=e}catch{return null}if(!N(i))return null;if(!g(i.pid)){try{u(r)}catch{}return null}return i}function U(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!o(r))return{status:`absent`};let i;try{i=JSON.parse(l(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!_(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,machineId:typeof a.machineId==`string`?a.machineId:void 0,draining:a.draining===!0?!0:void 0,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{u(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function W(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>H({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function G(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,a=k(n,t);if(M(a)){if(r){V({lockName:t,lockDir:n});return}if(o(a))try{let e=JSON.parse(l(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;u(a),P.delete(a)}catch(e){D.warn({lockPath:a,err:e},`${i} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}}var K=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function q(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new K(e.existing,e.lockPath):e}}function J(e,t){B({lockName:`server`,lockDir:e,port:t})}function Y(e){return H({lockName:`server`,lockDir:e})}function X(e,t){G({lockName:`server`,lockDir:e,...t})}function Z(e){V({lockName:`server`,lockDir:e})}function Q(e,t){return W({lockName:`server`,lockDir:e,...t})}export{_ as S,E as _,X as a,v as b,O as c,V as d,H as f,T as g,B as h,Y as i,R as l,G as m,q as n,J as o,U as p,Z as r,Q as s,K as t,k as u,C as v,g as x,y};
2
+ //# sourceMappingURL=server-lock-DQJq-D9V.mjs.map
@@ -1,2 +1,2 @@
1
- import{dr as e,ur as t}from"./src-CX7TfFa6.mjs";import{c as n}from"./write-project-skill-D_wY5RR9.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=[...e.map(e=>t[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 e){let e=t[r];o.push({path:a(i,`.agents`,`skills`,e),bundleId:r,scope:`central`});for(let t of n)o.push({path:a(i,t.hostDir,`skills`,e),bundleId:r,scope:`host`,hostDir:t.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-Crg4l1lZ.mjs.map
1
+ import{fr as e,pr as t}from"./src-BTCvmkZK.mjs";import{c as n}from"./write-project-skill-DQTCLDNM.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(t=>e[t]),`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=e[r];o.push({path:a(i,`.agents`,`skills`,t),bundleId:r,scope:`central`});for(let e of n)o.push({path:a(i,e.hostDir,`skills`,t),bundleId:r,scope:`host`,hostDir:e.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-BQ0YQ9rO.mjs.map