@inkeep/open-knowledge 0.88.9-beta.3 → 0.88.9-beta.5

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 (138) hide show
  1. package/dist/{cli-heKKE0h6.mjs → cli-BWG-Aq4r.mjs} +8 -8
  2. package/dist/cli.mjs +1 -1
  3. package/dist/constants-DqD-WwtH.mjs +1 -0
  4. package/dist/{dist-B0DBnzRw.mjs → dist-By4Q8HCV.mjs} +488 -488
  5. package/dist/{dist-4Xy44rzG.mjs → dist-Ttulen40.mjs} +1 -1
  6. package/dist/index.mjs +187 -187
  7. package/dist/init-CMXr3PqV.mjs +1 -0
  8. package/dist/{init-BiiaRaJc.mjs → init-DgagwO3Q.mjs} +2 -2
  9. package/dist/{launch-json-removal-CPMxuob7.mjs → launch-json-removal-RTdY_4MQ.mjs} +1 -1
  10. package/dist/loader-B_W8tqBx.mjs +1 -0
  11. package/dist/{loader-CF7WIVMA.mjs → loader-bqg6WDaz.mjs} +1 -1
  12. package/dist/{md-manager-BGnqyqi1-DnGz4mVK.mjs → md-manager-BGnqyqi1-B5Gyjk_N.mjs} +149 -149
  13. package/dist/{open-browser-CKOAlkdm.mjs → open-browser-kL892VYi.mjs} +1 -1
  14. package/dist/parse-worker.mjs +1 -1
  15. package/dist/{preview-Ch8NwweL.mjs → preview-CpwcPVCo.mjs} +1 -1
  16. package/dist/preview-uakaw7R6.mjs +1 -0
  17. package/dist/public/assets/{AccountSection-qENJ037Z.js → AccountSection-OC5q0omm.js} +1 -1
  18. package/dist/public/assets/{ActivityModeContent-uTfzywnv.js → ActivityModeContent-BrTDTihv.js} +1 -1
  19. package/dist/public/assets/{AddPropertiesButton-CWvueDgR.js → AddPropertiesButton-DzmO7lPO.js} +1 -1
  20. package/dist/public/assets/{AgentDiffPane-BhFOm-c8.js → AgentDiffPane-D3NHWroZ.js} +1 -1
  21. package/dist/public/assets/{AttachmentsSection-BglRmlI2.js → AttachmentsSection-BRw5iHsN.js} +1 -1
  22. package/dist/public/assets/{CodeMirrorPropInput-DpGpVASC.js → CodeMirrorPropInput-_xlIZfnP.js} +69 -69
  23. package/dist/public/assets/{ContentRulesSection-Bqg5cHzL.js → ContentRulesSection-C3zJL3XT.js} +1 -1
  24. package/dist/public/assets/DocumentContext-DudOKaBE.js +110 -0
  25. package/dist/public/assets/EditorModeToggle-C6XVQvNH.js +1 -0
  26. package/dist/public/assets/{ExcalidrawDocEditor-DaiaNhCg.js → ExcalidrawDocEditor-CNbYH26b.js} +1 -1
  27. package/dist/public/assets/FeedbackForm-JqmULtp1.js +1 -0
  28. package/dist/public/assets/{ImportSkillDialog-DBwK66d6.js → ImportSkillDialog-BvMF42t1.js} +1 -1
  29. package/dist/public/assets/{LinkPreviewsSection-Dz-FXsxK.js → LinkPreviewsSection-CfBE3a3F.js} +1 -1
  30. package/dist/public/assets/LintConfigEditor-C5OeqI_-.js +1 -0
  31. package/dist/public/assets/LintingSection-CA0Fab7L.js +1 -0
  32. package/dist/public/assets/{ManagedArtifactProperties-DD5MRuAW.js → ManagedArtifactProperties-9GJ7LIgQ.js} +1 -1
  33. package/dist/public/assets/ManagedArtifactProperties-CiPHTfJ5.js +1 -0
  34. package/dist/public/assets/{MermaidDocEditor-BZg78G3J.js → MermaidDocEditor-BkAp4SwO.js} +1 -1
  35. package/dist/public/assets/{NetworkAccessSection-DFTxrwZl.js → NetworkAccessSection-5853q-6H.js} +1 -1
  36. package/dist/public/assets/{PropertyDisplayRow-CbF44Jsc.js → PropertyDisplayRow-BfPIxbJe.js} +1 -1
  37. package/dist/public/assets/PublishToGitHubDialog-D-DLQtYQ.js +1 -0
  38. package/dist/public/assets/{SchemaConfigEditor-BheAGWoK.js → SchemaConfigEditor-CCWn7X-u.js} +1 -1
  39. package/dist/public/assets/{SearchSection-Cs4KQUa1.js → SearchSection-2KCDB2VA.js} +1 -1
  40. package/dist/public/assets/{SessionsHost-B4VnJSVy.js → SessionsHost-CRPnzYN1.js} +2 -2
  41. package/dist/public/assets/{SettingsDialogBody-BfNVNXOX.js → SettingsDialogBody-1yLR-GsZ.js} +2 -2
  42. package/dist/public/assets/{ShareReceiveMissDialog-CiW8SA14.js → ShareReceiveMissDialog-BXKUoF1i.js} +1 -1
  43. package/dist/public/assets/{SkillToolbarControls-BwvWExD-.js → SkillToolbarControls-B6E5iiKJ.js} +1 -1
  44. package/dist/public/assets/{SourceEditor-BCDbD-lX.js → SourceEditor-BLtDTcHX.js} +1 -1
  45. package/dist/public/assets/{SpellingSettings-D184toob.js → SpellingSettings-BnekUXi0.js} +1 -1
  46. package/dist/public/assets/{SyncSection-zY-Hk6_u.js → SyncSection-BsLX6-vW.js} +1 -1
  47. package/dist/public/assets/{SyncStatusBadge-BeCo1R8Y.js → SyncStatusBadge-C36jYktv.js} +1 -1
  48. package/dist/public/assets/{TerminalSection-DP3QvSyD.js → TerminalSection-DZKCNM7y.js} +1 -1
  49. package/dist/public/assets/{TerminalWindowApp-B5WuXD5M.js → TerminalWindowApp-CmU1Cb8o.js} +1 -1
  50. package/dist/public/assets/{TextDocEditor-CMiHX9T4.js → TextDocEditor-BabRgTt7.js} +1 -1
  51. package/dist/public/assets/{ThemePluginSection-BJho-OPX.js → ThemePluginSection-htJshVsF.js} +1 -1
  52. package/dist/public/assets/{ThreadView-CFhT-yDc.js → ThreadView-C_zy2m7k.js} +7 -7
  53. package/dist/public/assets/{TimelineDiffPane-BDvNV1AG.js → TimelineDiffPane-DYpDj0gb.js} +1 -1
  54. package/dist/public/assets/{client-version-QyucWXca.js → client-version-C1mluhO6.js} +1 -1
  55. package/dist/public/assets/{comment-chips-Ct3n-Ocd.js → comment-chips-Bg_fHZit.js} +2 -2
  56. package/dist/public/assets/{config-provider-B084_P-F.js → config-provider-rlX-hNO5.js} +1 -1
  57. package/dist/public/assets/config-schema-BFeDYLCd.js +1 -0
  58. package/dist/public/assets/{doc-undo-manager-DusTYvFB.js → doc-undo-manager-BeKYlR4y.js} +1 -1
  59. package/dist/public/assets/field-controls-lq4qcuvr.js +1 -0
  60. package/dist/public/assets/{field-controls-BE-gXCyP.js → field-controls-uK27_e3u.js} +1 -1
  61. package/dist/public/assets/ime-composition-CjypcBXs.js +1 -0
  62. package/dist/public/assets/index-CcicSOZg.js +2209 -0
  63. package/dist/public/assets/{lint-config-client-Bpn28Gqc.js → lint-config-client-D7WzQSDg.js} +1 -1
  64. package/dist/public/assets/{lint-plugins-WKwhKAIC.js → lint-plugins-C777a3Eb.js} +1 -1
  65. package/dist/public/assets/{markdown-lint-DyGTskus.js → markdown-lint-DwFRnZJ_.js} +1 -1
  66. package/dist/public/assets/{markdownlint-rule-browser-CiuM3Wwm.js → markdownlint-rule-browser-DBy2EH_P.js} +1 -1
  67. package/dist/public/assets/messages-B-J4Z2Yr.js +1 -0
  68. package/dist/public/assets/messages-BB8d9jn4.js +1 -0
  69. package/dist/public/assets/messages-BY7FXc1p.js +1 -0
  70. package/dist/public/assets/messages-BiYVPcog.js +1 -0
  71. package/dist/public/assets/messages-C7Sj-spy.js +1 -0
  72. package/dist/public/assets/messages-CBV_8Tbx.js +1 -0
  73. package/dist/public/assets/messages-CIQENxYJ.js +1 -0
  74. package/dist/public/assets/{messages-BG06D2oG.js → messages-CLhrlR3j.js} +1 -1
  75. package/dist/public/assets/messages-CYZHw0xR.js +1 -0
  76. package/dist/public/assets/messages-CjUTocV-.js +1 -0
  77. package/dist/public/assets/messages-DVWfLKLP.js +1 -0
  78. package/dist/public/assets/messages-DlnDJqXj.js +1 -0
  79. package/dist/public/assets/messages-GTtZSPU8.js +1 -0
  80. package/dist/public/assets/{pending-receive-nav-store-DpVXFUf1.js → pending-receive-nav-store-CV2evy8J.js} +1 -1
  81. package/dist/public/assets/{preferred-session-events-DJCdCQuc.js → preferred-session-events-_cY_seNN.js} +1 -1
  82. package/dist/public/assets/{progress-G97DGgRz.js → progress-Bq_b5Dwi.js} +3 -3
  83. package/dist/public/assets/{saved-themes-client-BV81hPag.js → saved-themes-client-DX5dCXi5.js} +1 -1
  84. package/dist/public/assets/{schema-section-DIb5umEe.js → schema-section-Cp00yQR2.js} +1 -1
  85. package/dist/public/assets/{selection-context-QdjbPI3E.js → selection-context-DsN_o-oO.js} +1 -1
  86. package/dist/public/assets/{src-B_RRa5ZI.js → src-MfTCWnJS.js} +1 -1
  87. package/dist/public/assets/{tag-pill-input-DfZfc6Af.js → tag-pill-input-B6OegoPJ.js} +1 -1
  88. package/dist/public/assets/{telemetry-impl-DLO_0UAa.js → telemetry-impl-DoFXV7zT.js} +1 -1
  89. package/dist/public/assets/{telemetry-startup-BMWOHbB6.js → telemetry-startup-Dh6dlltT.js} +1 -1
  90. package/dist/public/assets/typing-burst-detector-CQpkMJPV.js +6 -0
  91. package/dist/public/assets/{uninstall-DHlBU1US.js → uninstall-BRba0hi_.js} +1 -1
  92. package/dist/public/assets/{use-activity-panel-CObfBAb1.js → use-activity-panel-DK_CY04P.js} +1 -1
  93. package/dist/public/assets/{use-apply-config-language-N3OMaFbH.js → use-apply-config-language-9fLQZCsK.js} +2 -2
  94. package/dist/public/assets/{use-open-skill-CzOAeSq6.js → use-open-skill-B0yLjGNV.js} +1 -1
  95. package/dist/public/assets/{use-terminal-enabled-D4EqjdQP.js → use-terminal-enabled-x6P_EH4P.js} +1 -1
  96. package/dist/public/assets/use-timeline-entry-diff-BAgwVMRs.js +7 -0
  97. package/dist/public/index.html +26 -26
  98. package/dist/public/uninstall.html +3 -3
  99. package/dist/{registry-probes-BO8LQnnq.mjs → registry-probes-B2fn4XJx.mjs} +2 -2
  100. package/dist/{removal-file-path-BU5oybZW.mjs → removal-file-path-HAS5JVGt.mjs} +1 -1
  101. package/dist/{repair-launch-json-3kR-vJqB.mjs → repair-launch-json-Crbpi7Jj.mjs} +1 -1
  102. package/dist/{repair-mcp-configs-Bjdl4e04.mjs → repair-mcp-configs-CV-7zYuV.mjs} +1 -1
  103. package/dist/{src-DAphXmts.mjs → src-B_q1_C1R.mjs} +1 -1
  104. package/dist/src-BjiiSghS.mjs +1 -0
  105. package/dist/{start-BAvitkf3.mjs → start-BjstUFs5.mjs} +3 -3
  106. package/dist/start-MRWYWYqt.mjs +1 -0
  107. package/package.json +4 -4
  108. package/dist/constants-DD0dQrNW.mjs +0 -1
  109. package/dist/init-BlvN269t.mjs +0 -1
  110. package/dist/loader-B2I9sa8s.mjs +0 -1
  111. package/dist/preview-BaIBGVsN.mjs +0 -1
  112. package/dist/public/assets/DocumentContext-C7f-2j3S.js +0 -108
  113. package/dist/public/assets/EditorModeToggle-D_CPJnkr.js +0 -1
  114. package/dist/public/assets/FeedbackForm-CckRtMRS.js +0 -1
  115. package/dist/public/assets/LintConfigEditor-D80LBug6.js +0 -1
  116. package/dist/public/assets/LintingSection-iTdBTXpn.js +0 -1
  117. package/dist/public/assets/ManagedArtifactProperties-CgwjRrjW.js +0 -1
  118. package/dist/public/assets/PublishToGitHubDialog-Bi4yg3gA.js +0 -1
  119. package/dist/public/assets/config-schema-PFswUEY8.js +0 -1
  120. package/dist/public/assets/field-controls-CYM5AE4q.js +0 -1
  121. package/dist/public/assets/ime-composition-Dqv-F42e.js +0 -1
  122. package/dist/public/assets/index-EG4CXoqu.js +0 -2209
  123. package/dist/public/assets/messages-AhR6hFhG.js +0 -1
  124. package/dist/public/assets/messages-BWf_mE1f.js +0 -1
  125. package/dist/public/assets/messages-CC_nyZaD.js +0 -1
  126. package/dist/public/assets/messages-CCpyckwF.js +0 -1
  127. package/dist/public/assets/messages-Caz0X-QI.js +0 -1
  128. package/dist/public/assets/messages-Cl664i6S.js +0 -1
  129. package/dist/public/assets/messages-DF-5evdp.js +0 -1
  130. package/dist/public/assets/messages-I4dOt3Id.js +0 -1
  131. package/dist/public/assets/messages-asQSLar1.js +0 -1
  132. package/dist/public/assets/messages-gyTavuOO.js +0 -1
  133. package/dist/public/assets/messages-uNPe6akt.js +0 -1
  134. package/dist/public/assets/messages-v-wOP1Ps.js +0 -1
  135. package/dist/public/assets/typing-burst-detector-CSLkAaYr.js +0 -8
  136. package/dist/public/assets/use-timeline-entry-diff-B2h1ZYkY.js +0 -7
  137. package/dist/src-4tLs8QTq.mjs +0 -1
  138. package/dist/start-Bd3DQKN3.mjs +0 -1
@@ -0,0 +1 @@
1
+ import"./dist-By4Q8HCV.mjs";import{v as e}from"./init-DgagwO3Q.mjs";export{e as runInit};
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{A as r,C as i,I as a,L as o,O as s,S as c,d as l,j as u,k as d,w as f,x as p}from"./constants-ok-dir-DZ25OS9-.mjs";import{K as m,V as h,Xa as g,Ya as _,_ as v,_d as y,_f as b,a as x,af as S,bd as ee,cf as C,df as te,ff as ne,gf as re,if as ie,kc as ae,rf as oe,sf as se,tt as ce,z as le}from"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import{B as ue,Ca as de,F as fe,Fr as pe,Ji as me,Ko as he,Ns as ge,Nt as _e,Oa as ve,R as ye,Va as be,Vo as xe,Vr as Se,W as Ce,Wo as we,Yr as Te,as as w,at as Ee,cr as De,ct as Oe,di as ke,hn as Ae,hs as je,is as Me,m as Ne,os as Pe,qr as Fe,rs as Ie,ss as Le,tr as Re,wa as ze,z as Be}from"./dist-B0DBnzRw.mjs";import{n as Ve,s as T}from"./fs-find-project-root-BYV07wjn.mjs";import{i as He,n as E,o as D,r as Ue,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as We}from"./constants-DD0dQrNW.mjs";import{t as Ge}from"./preview-Ch8NwweL.mjs";import{createRequire as Ke}from"node:module";import{fileURLToPath as qe}from"node:url";import Je,{basename as Ye,dirname as j,isAbsolute as Xe,join as M,posix as Ze,relative as N,resolve as P,sep as F,win32 as Qe}from"node:path";import I from"node:process";import{copyFileSync as $e,existsSync as L,lstatSync as et,mkdirSync as tt,readFileSync as R,readdirSync as nt,readlinkSync as rt,realpathSync as it,rmSync as at,statSync as ot,writeFileSync as st}from"node:fs";import{homedir as z}from"node:os";import{AsyncLocalStorage as ct,AsyncResource as lt}from"node:async_hooks";import{execFileSync as ut}from"node:child_process";import{inspect as dt,stripVTControlCharacters as ft,styleText as B}from"node:util";import*as pt from"node:readline";var mt=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})),ht=n((e=>{let{InvalidArgumentError:t}=mt();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),gt=n((e=>{let{humanReadableArgName:t}=ht();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1
+ import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{A as r,C as i,I as a,L as o,O as s,S as c,d as l,j as u,k as d,w as f,x as p}from"./constants-ok-dir-DZ25OS9-.mjs";import{K as m,V as h,Xa as g,Ya as _,_ as v,_d as y,_f as b,a as x,af as S,bd as ee,cf as C,df as te,ff as ne,gf as re,if as ie,kc as ae,rf as oe,sf as se,tt as ce,z as le}from"./md-manager-BGnqyqi1-B5Gyjk_N.mjs";import{B as ue,Ca as de,F as fe,Fr as pe,Ji as me,Ko as he,Ns as ge,Nt as _e,Oa as ve,R as ye,Va as be,Vo as xe,Vr as Se,W as Ce,Wo as we,Yr as Te,as as w,at as Ee,cr as De,ct as Oe,di as ke,hn as Ae,hs as je,is as Me,m as Ne,os as Pe,qr as Fe,rs as Ie,ss as Le,tr as Re,wa as ze,z as Be}from"./dist-By4Q8HCV.mjs";import{n as Ve,s as T}from"./fs-find-project-root-BYV07wjn.mjs";import{i as He,n as E,o as D,r as Ue,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as We}from"./constants-DqD-WwtH.mjs";import{t as Ge}from"./preview-CpwcPVCo.mjs";import{createRequire as Ke}from"node:module";import{fileURLToPath as qe}from"node:url";import Je,{basename as Ye,dirname as j,isAbsolute as Xe,join as M,posix as Ze,relative as N,resolve as P,sep as F,win32 as Qe}from"node:path";import I from"node:process";import{copyFileSync as $e,existsSync as L,lstatSync as et,mkdirSync as tt,readFileSync as R,readdirSync as nt,readlinkSync as rt,realpathSync as it,rmSync as at,statSync as ot,writeFileSync as st}from"node:fs";import{homedir as z}from"node:os";import{AsyncLocalStorage as ct,AsyncResource as lt}from"node:async_hooks";import{execFileSync as ut}from"node:child_process";import{inspect as dt,stripVTControlCharacters as ft,styleText as B}from"node:util";import*as pt from"node:readline";var mt=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})),ht=n((e=>{let{InvalidArgumentError:t}=mt();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),gt=n((e=>{let{humanReadableArgName:t}=ht();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})),_t=n((e=>{let{InvalidArgumentError:t}=mt();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -689,5 +689,5 @@ export default function okBridge(pi: {
689
689
  `));let g=`${s?``:``}${m}`;return g!==o&&T(e,g,{mode:Ka(e)}),a&&g===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const zo=e=>e!==`project`,Bo=e=>e!==`user`;async function Vo(){let e=await to({message:`Where should the MCP server be configured?
690
690
  `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function Ho(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Vo)():`both`}async function Uo(e){return oo({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:`OK config stays on this machine only; teammates do not see it. Safe escape hatch via \`${s()} config-sharing share\`.`}]})}async function Wo(e){if(e.sharing!==void 0)return e.sharing;let t=ma(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??Uo)(t):t}var Go=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}},Ko=class extends Error{constructor(e){super(`A dev MCP entry is written to project config only, never to user-level editor config, so --scope ${e} is not supported with --dev-mcp or OK_CHANNEL=dev. Re-run with --scope project or without --scope.`),this.name=`DevMcpScopeError`}};const qo=`A dev build registers OpenKnowledge MCP in project config only, never in user-level editor config. Run \`${c} init --dev-mcp\` in the project, or set OK_CHANNEL=stable.`;function Jo(e){if(e===void 0||e===!0)return new Set(Ee);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(_e.filter(e=>t.includes(e)))}function Yo(e,t,n){let r=P(n,e),i;try{i=ot(r)}catch(e){let t=e.code;throw t===`ENOENT`?new Go(`--content-dir path does not exist: ${r}`):new Go(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new Go(`--content-dir must be a directory: ${r}`);let a=Xo(t),o=Xo(r),s=N(a,o);if(s.startsWith(`..`)||Xe(s))throw new Go(`--content-dir must be inside the project root (${t}); got ${r}`);return s===``?`.`:s}function Xo(e){try{return it(e)}catch{return e}}const Zo=`open-knowledge-ui`;function Qo(e,t,n){try{let r=e.detectPath?.(t,n)??j(e.configPath(t,n));return L(r)}catch{return!1}}function $o(e,t,n){try{let r=P(j(e.configPath(t,n))),i=P(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+F)}catch{return!1}}function es(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!L(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||$o(e,t,r);if(!i&&c&&!Qo(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{Aa(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return ns(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||tt(j(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{ge(`${o}.lock`,()=>{let t=yo(o).writePath;if(s||tt(j(t),{recursive:!0}),e.format===`toml`){let r=Fo(oi(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=Ro(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=Po(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const ts={pi:uo};function ns(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=ts[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{tt(j(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{ge(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}T(t,c,e===null?void 0:{mode:Ka(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function rs(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function is(e){let t=sa(e.editors).filter(e=>e.scope===`global`);if(a())return t.map(t=>({editorId:t.id,label:t.label,action:`failed`,configPath:t.configPath(``,e.home),serverName:t.serverName(``),error:qo}));let n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>es(t,``,n,e.home))}function as(e,t,n,r){let i=ss(e,t,n,r);return i.kind===`present`?i.entry:null}function os(e,t,n,r){let i=No(e,t,r);if(!A(i))return{kind:`no-entry`};let a=i[n];return A(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function ss(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};try{if(ot(i).size>Do)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:Ha(e)}}let a;try{a=R(i,`utf-8`)}catch(e){return{kind:`decline`,reason:Ha(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:lo(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=oi().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return os(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,qr.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:os(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=So(a);return s?Co(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:os(Me(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function cs(e={}){let t=P(e.cwd??process.cwd()),n=e.projectRootMode===`cwd`?{projectRoot:t,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:mo(t,{homeDir:e.home}),r=n.projectRoot;if(Te(r,e.home??z()))throw new Ce(r);if(Fe(r))throw new fe(r);let i=!L(M(r,`.ok`)),o=n.gitRootPromoted?N(r,t):void 0,c=e.contentDir===void 0?n.defaultContentDir:Yo(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&c===`.`&&process.stderr.write(`${O(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${o}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`${s()} init --content-dir .\`, or set content.dir: ${o} in .ok/config.yml.\n`);let l={mode:e.devMcp?`dev`:`published`},u=e.devMcp===!0||a();if(u&&e.mcp!==!1&&e.scope&&e.scope!==`project`)throw new Ko(e.scope);let d=await De(r),f;try{f=pe(r,{contentDir:c})}catch(t){let i=$.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:d.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let p=f.created.includes(We),m=!1;if(d.didInit)try{m=he(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{de(r)===`removed`&&console.warn(`[ok] Removed the OpenKnowledge project-skill lines from .gitignore. The skill is ordinary project content now — commit it if your team wants it on clone.`)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore cleanup at ${r}: ${e instanceof Error?e.message:String(e)}`)}let h=await Ho({scope:u?`project`:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),_=e.editors??ms(r,e.home),v=e.editors??_,y=sa(_),b=sa(v),x=e.mcp===!1||h===null,S=Array.from(new Map([...y,...x?[]:b].map(e=>[e.id,e])).values()),ee=y.filter(t=>Qo(t,r,e.home)),C=[],te=[],ne=new Set;for(let t of S){if(x){let n=``;try{n=t.configPath(r,e.home)}catch{}C.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(zo(h)&&y.includes(t)&&t.scope===`global`&&C.push(es(t,r,l,e.home)),Bo(h)&&b.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=es(t,r,l,e.home,n);C.push(i),(i.action===`written`||i.action===`overwritten`)&&ne.add(n)}}let re=new Set;for(let t of b){let n=t.projectSkillPath?.(r);!n||re.has(n)||(re.add(n),te.push(Ba(t,r,{home:e.home})))}let ie=za(r,b.map(e=>e.id));ie&&te.push(ie);let ae=te.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(ae.length>0){let t=e.home??z();ze({source:g,skills:[Ne.project],agents:ae,scope:r},{home:t,enabled:be(t).enabled})}let oe=!x&&h!==null&&Bo(h)?b.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,se=x?[]:ee.map(e=>rs(e,r)).filter(e=>e!==void 0).filter(e=>!ne.has(e.path)),ce=e.installUserSkill??Se,le=e.home??z(),ue=Jo(e.skills),ge=typeof e.skills!=`string`,ve=!1,ye=!1,xe=!1,w=!1,Ee=!1,Oe=!1,Ae=!1,je=[];for(let t of _e){if(!ue.has(t))continue;if(ve=!0,ge){let e=await me(le,Ne[t]).then(e=>({ok:!0,value:e}),()=>({ok:!1}));if(!e.ok){je.push({bundleId:t,result:`decision-read-failed`}),Ae=!0;continue}if(e.value===!1){je.push({bundleId:t,result:`opted-out`}),Oe=!0;continue}}await we(le,Ne[t],!0).catch(()=>{});let n=await ce({home:e.home,bundleId:t,force:!0});je.push({bundleId:t,result:n}),n===`installed`?ye=!0:n===`failed`?xe=!0:n===`no-hosts`?Ee=!0:w=!0}let Me=xe?`failed`:Ae?`decision-read-failed`:ye?`installed`:ve&&w?`skip-current`:ve&&Ee?`no-hosts`:Oe?`opted-out`:`declined`,Pe=ye?Re(le).map(e=>e.editorId):[],Ie=be(le).enabled&&!ke(),Le=x?`skipped-flag`:`skipped-missing`,Be=C.find(e=>e.editorId===`claude`)??C[0]??{action:Le,configPath:$.claude.configPath(r,e.home)},Ve=await ls({projectRoot:r,desiredMode:await Wo({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:f.created,contentUpdated:f.updated,contentSkipped:f.skipped,editors:C,projectSkills:te,legacyProjectConfigs:se,skillInstall:Me,skillBundles:je,skillsRequested:e.skills,skillHosts:Pe,skillInstallsCounted:Ie,didGitInit:d.didInit,rootGitignoreCreated:m,gitRootPromoted:n.gitRootPromoted,promotedFromDir:o,contentDir:p?c:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:Be.action,mcpPath:Be.configPath,mcpError:`error`in Be?Be.error:void 0,projectScopeUnsupportedLabels:oe,sharing:Ve}}async function ls(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=ma(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=ua(t);if(n===`local-only`){let e=fa(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:us(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=pa(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:us(t,o,`remove`)}function us(e,t,n){let r=ma(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.removed}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function ds(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions`;case`unresolved-symlink`:return`could not resolve the path or symlink; check permissions and symlink cycles`;case`not-a-file`:return`config path is not a regular file`;case`disappeared`:return`config disappeared while being read; retry to check its current state`;case`unreadable`:return`could not read the config file; check that the path is accessible`;case`unparseable`:return`config could not be parsed`;case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;case void 0:return`config not readable`;default:throw Error(`unhandled MCP decline reason: ${e}`)}}function fs(e,t){let n=[],a=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),o=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),c=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),u=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let d=M(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(k(`Content scaffolded at ${d}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(k(`Content already present at ${d}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0){if(n.push(k(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`)}else if(c)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(u)n.push(k(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(k(`MCP server configuration:`));for(let i of e.editors){let e=i.configPath.startsWith(t)?N(t,i.configPath):i.configPath.replace(/^\/Users\/[^/]+/,`~`),a=i.serverName===r()?``:` (${i.serverName})`,o=i.configScope===`project`?` (project)`:``,s=`${i.label}${o}`,c=` `.repeat(Math.max(1,20-s.length)),l=i.editorId===`claude-desktop`&&(i.action===`written`||i.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(i.action){case`written`:n.push(` ${s}${c}${e} ${D(`registered`)}${a}${l}`);break;case`overwritten`:n.push(` ${s}${c}${e} ${D(`updated`)}${a}${l}`);break;case`skipped-missing`:n.push(` ${s}${c}${e} config root missing; skipped`);break;case`failed`:n.push(` ${s}${c}${e} ${Ue(`FAILED`)}: ${i.error}`);break;case`declined`:n.push(` ${s}${c}${e} left unchanged (${ds(i.declineReason)})`);break;case`skipped-flag`:break;default:i.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}let a=i.dev.mcpServerName;e.editors.some(e=>e.serverName===a&&(e.action===`written`||e.action===`overwritten`))&&n.push(` The ${a} entry runs this checkout on this machine only; keep it out of commits.`)}if(e.projectSkills.length>0){n.push(``),n.push(k(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${D(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${D(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${Ue(`FAILED`)}: ${r.error}`)}}}if(o&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${N(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall===`declined`)n.push(``),n.push(k(`User-global skills:`)),typeof e.skillsRequested==`string`?(n.push(` ${E(`none installed — --skills "${e.skillsRequested}" names no known skill bundle (known: ${_e.join(`, `)})`)}`),n.push(` ${E(`No user-global skill was installed or removed.`)}`)):(n.push(` ${E(`none installed — skipped for this run (--no-skills)`)}`),n.push(` ${E(`No user-global skill was installed or removed; any already on this`)}`),n.push(` ${E(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${E(` ${s()} init`)}`),n.push(` ${E(`--no-skills covers user-global skills only, not project-local skills.`)}`));else if(e.skillInstall){n.push(``),n.push(k(`User-global skills:`));let t=e.skillBundles??[],r=Math.max(0,...t.map(e=>Ne[e.bundleId].length));for(let i of t){let t=Ne[i.bundleId].padEnd(r);switch(i.result){case`installed`:{let r=(e.skillHosts??[]).map(e=>X[e]??e),i=r.length>0?r.join(`, `):`the shared ~/.agents store`;n.push(` ${t} ${D(`installed for ${i}`)}`);break}case`skip-current`:n.push(` ${t} ${D(`already installed at current version`)}`);break;case`no-hosts`:n.push(` ${t} ${E(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${O(`${t} install failed`)}`);break;case`opted-out`:n.push(` ${t} ${E(`not installed — turned off on this machine; reinstall with ${s()} init --skills ${i.bundleId} or Settings → Skills Studio`)}`);break;case`decision-read-failed`:n.push(` ${O(`${t} not installed — could not read whether it is turned off on this machine; rerun ${s()} init once ${l(v)} is readable`)}`);break;default:i.result}}e.skillInstallsCounted&&t.some(e=>e.result===`installed`)&&(n.push(` ${E(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${E(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`)),t.some(e=>e.result===`failed`)&&n.push(` ${O(`Retry with: ${s()} repair-skills`)}`)}e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(O(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(O(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`${s()} init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(` To scope to just that sub-folder, re-run \`${s()} init --content-dir .\` from there, or set`),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(Ge(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(..._s(e.sharing,t));let f=e=>[`${e}- ${He(`${s()} seed --list-packs`)} — browse the starter packs`,`${e}- ${He(`${s()} seed`)} — scaffold an empty repo`];if(a){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${D(`✓`)} ${k(`Next steps:`)}`),n.push(` 1. Open your editor (${He(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`);let i=3;e.contentScaffoldFailed||(n.push(` ${i++}. (Optional) scaffold the starter knowledge-base structure:`),n.push(...f(` `))),n.push(` ${i}. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}else e.contentScaffoldFailed||(n.push(``),n.push(`${k(`Next steps:`)} (optional) scaffold the starter knowledge-base structure:`),n.push(...f(` `)));return n.join(`
691
691
  `)}function ps(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function ms(e,t){let n=[];for(let r of ci)r!==`claude-desktop`&&Qo($[r],e,t)&&n.push(r);return n}function hs(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:dt(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function gs(){return new Dt(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry (node + packages/cli/dist/cli.mjs, debug logging) in project config only, as the dev channel unless OK_CHANNEL is set`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new kt(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new kt(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new kt(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd();e.devMcp&&u(process.env);let n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?hs():null;try{let r;try{r=await cs({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof Go||e instanceof Ko||e instanceof Ce||e instanceof fe){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof ye||e instanceof Be||e instanceof ue){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof Oe){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
692
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-B2I9sa8s.mjs`),{resolveContentDir:s}=await import(`./dist-4Xy44rzG.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-BaIBGVsN.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(ps(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${fs(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function _s(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${D(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${D(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${D(`local-only`)} — already excluded; nothing to do.`):n.push(` ${D(`local-only`)}`):e.action===`removed`?n.push(` ${D(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${D(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
692
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-B_W8tqBx.mjs`),{resolveContentDir:s}=await import(`./dist-Ttulen40.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-uakaw7R6.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(ps(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${fs(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function _s(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${D(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${D(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${D(`local-only`)} — already excluded; nothing to do.`):n.push(` ${D(`local-only`)}`):e.action===`removed`?n.push(` ${D(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${D(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
693
693
  `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${He(`${s()} config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(O(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${He(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${He(`${s()} config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(O(`Sharing mode unavailable: ${e.reason}.`));return n}}export{Z as $,Ga as A,Da as B,yo as C,zt as Ct,oo as D,co as E,kt as Et,Na as F,ua as G,ba as H,Aa as I,pa as J,ga as K,ja as L,Ua as M,Ha as N,to as O,ka as P,li as Q,Va as R,$o as S,H as St,uo as T,Tt,ha as U,fa as V,da as W,X,ci as Y,$ as Z,Wo as _,gr as _t,ls as a,Ei as at,es as b,pn as bt,ms as c,Gi as ct,gs as d,si as dt,Vi as et,Qo as f,oi as ft,Yo as g,Qr as gt,Ho as h,Yr as ht,ts as i,Ci as it,qa as j,Ka as k,fs as l,na as lt,Jo as m,Xr as mt,Ko as n,Hi as nt,ps as o,Wi as ot,as as p,Y as pt,ma as q,Zo as r,Ui as rt,ss as s,Q as st,Go as t,Bi as tt,_s as u,Ai as ut,cs as v,ar as vt,mo as w,Dt as wt,is as x,fn as xt,jo as y,gn as yt,Ba as z};
@@ -1 +1 @@
1
- import{is as e,ss as t}from"./dist-B0DBnzRw.mjs";import{s as n}from"./fs-find-project-root-BYV07wjn.mjs";import{N as r,j as i,k as a}from"./init-BiiaRaJc.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-BU5oybZW.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:r(e)}}let g=[],_=t(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=e(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=i(h,[`configurations`,y]);return x?(n(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
1
+ import{is as e,ss as t}from"./dist-By4Q8HCV.mjs";import{s as n}from"./fs-find-project-root-BYV07wjn.mjs";import{N as r,j as i,k as a}from"./init-DgagwO3Q.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-HAS5JVGt.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:r(e)}}let g=[],_=t(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=e(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=i(h,[`configurations`,y]);return x?(n(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-bqg6WDaz.mjs";export{e as loadConfig};
@@ -1 +1 @@
1
- import{x as e}from"./constants-ok-dir-DZ25OS9-.mjs";import{Gc as t,al as n,k as r,ll as i,qc as a,rl as o}from"./md-manager-BGnqyqi1-DnGz4mVK.mjs";import{js as s,ks as c,x as l}from"./dist-B0DBnzRw.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-DD0dQrNW.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=e();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(e){let n=e??process.cwd(),u=[],p=[],m=[],h=[],g=s(`user`,n),_=c({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(e,t=!1)=>{let n=v(e);if(n.diagnostic!==void 0&&p.push(n.diagnostic),n.value===null)return{};let a=o({value:n.value,file:n.path,source:n.source,doc:n.doc});p.push(...a),u.push(e);let s=a.length>0?i(n.value):n.value;return t&&h.push(...r({value:s,file:n.path,source:n.source,doc:n.doc})),s},x=f(n,`.ok`,d),S=b(x,!0),C=b(s(`project-local`,n)),w=t(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(a(t))}return{config:T.data,sources:u,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
1
+ import{x as e}from"./constants-ok-dir-DZ25OS9-.mjs";import{Gc as t,al as n,k as r,ll as i,qc as a,rl as o}from"./md-manager-BGnqyqi1-B5Gyjk_N.mjs";import{js as s,ks as c,x as l}from"./dist-By4Q8HCV.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-DqD-WwtH.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=e();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(e){let n=e??process.cwd(),u=[],p=[],m=[],h=[],g=s(`user`,n),_=c({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(e,t=!1)=>{let n=v(e);if(n.diagnostic!==void 0&&p.push(n.diagnostic),n.value===null)return{};let a=o({value:n.value,file:n.path,source:n.source,doc:n.doc});p.push(...a),u.push(e);let s=a.length>0?i(n.value):n.value;return t&&h.push(...r({value:s,file:n.path,source:n.source,doc:n.doc})),s},x=f(n,`.ok`,d),S=b(x,!0),C=b(s(`project-local`,n)),w=t(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(a(t))}return{config:T.data,sources:u,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};