@inkeep/open-knowledge 0.63.3 → 0.63.4
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.
- package/dist/{acp-harness-probe-BRVdx2Mx.mjs → acp-harness-probe-BVPmScTu.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-DbnPdCKs.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-Bl9Z2pHB.mjs +1 -0
- package/dist/{init-BLfb1sRA.mjs → init-CKiiDDjS.mjs} +3 -3
- package/dist/{launch-json-removal-ChFdNqlh.mjs → launch-json-removal-lbo2BfvL.mjs} +2 -2
- package/dist/{loader-CXFdSeyk.mjs → loader-AoOfPnaW.mjs} +2 -2
- package/dist/loader-DBwpGCHz.mjs +1 -0
- package/dist/{open-browser-DLqct6YK.mjs → open-browser-C8W8YLUr.mjs} +2 -2
- package/dist/preview-Bes4c5UX.mjs +1 -0
- package/dist/{preview-Bb4XYlBa.mjs → preview-DUg0Bjtu.mjs} +2 -2
- package/dist/{repair-launch-json-DZV-i0OU.mjs → repair-launch-json-Bu0L2kla.mjs} +2 -2
- package/dist/{repair-mcp-configs-Dr8SRYVX.mjs → repair-mcp-configs-CrR_x0jk.mjs} +2 -2
- package/dist/{repair-skills-C0uJGBYH.mjs → repair-skills-B7T9ybuC.mjs} +2 -2
- package/dist/repair-skills-D33RJQek.mjs +1 -0
- package/dist/{resolve-project-root-CIQP5bae.mjs → resolve-project-root-BF1NyEri.mjs} +2 -2
- package/dist/{skill-teardown-CZx0nQAt.mjs → skill-teardown-B9-HO2ID.mjs} +2 -2
- package/dist/{src-_jFQMicT.mjs → src-CUv_mIbV.mjs} +2 -2
- package/dist/src-CwaiifCf.mjs +1 -0
- package/dist/{src-0BnQ9xtm.mjs → src-DQyTLMJF.mjs} +1 -1
- package/dist/{src-yn8SArMz.mjs → src-bhsVUHJJ.mjs} +343 -343
- package/dist/{start-CcGDBrj-.mjs → start-CcNhbHl_.mjs} +3 -3
- package/dist/start-zS9Dby1v.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-ece63OR8.mjs +0 -2
- package/dist/init-BRXjI9La.mjs +0 -1
- package/dist/loader-B-5qtkZG.mjs +0 -1
- package/dist/preview-CmIBMra7.mjs +0 -1
- package/dist/repair-skills-BflLjGjq.mjs +0 -1
- package/dist/src-BVv588fI.mjs +0 -1
- package/dist/start-IXlE2_Hb.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{pt as r}from"./sleep-D4NlDISj.mjs";import{Fs as i,ec as a,fs as o,ot as s,rt as c}from"./src-Bt6_UxL9.mjs";import{Ai as l,Ar as u,Fa as d,Mr as f,Or as p,Ri as m,_i as h,d as g,dn as _,er as v,f as y,fn as b,fr as x,hn as S,ji as C,kr as w,mn as ee,rr as te,tr as ne,u as re,ur as ie,vi as T,vn as ae,yi as oe}from"./src-yn8SArMz.mjs";import{F as E,N as se}from"./fs-traced-Dm4NQ6S5.mjs";import{C as ce,a as D,d as le,f as ue,i as de,l as fe,n as pe,o as me,s as he,t as ge,u as _e,x as ve,y as ye}from"./resolve-project-root-CIQP5bae.mjs";import{i as O,n as k,o as A,r as be,s as j,t as M}from"./colors-DSyAT9Cz.mjs";import{t as xe}from"./constants-ece63OR8.mjs";import{t as N}from"./is-object-Bw0-z8qH.mjs";import{t as Se}from"./preview-Bb4XYlBa.mjs";import{createRequire as Ce}from"node:module";import{execFileSync as we}from"node:child_process";import Te,{dirname as P,isAbsolute as Ee,join as F,relative as I,resolve as L,sep as De}from"node:path";import R from"node:process";import{fileURLToPath as Oe}from"node:url";import{existsSync as z,lstatSync as ke,mkdirSync as Ae,readFileSync as B,readlinkSync as je,realpathSync as Me,statSync as Ne,writeFileSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import*as Ie from"node:readline";import{inspect as Le,stripVTControlCharacters as Re,styleText as V}from"node:util";import{AsyncLocalStorage as ze,AsyncResource as Be}from"node:async_hooks";const Ve=new Set([`emacs`,`vim`]);function He(e){return Ve.has(e)}function Ue(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(He))):[]}const H=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,We=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Ge=e=>e.name===`space`,Ke=e=>e.name===`backspace`,qe=e=>`1234567890`.includes(e.name),Je=e=>e.name===`enter`||e.name===`return`;var Ye=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Xe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Ze=class extends Error{name=`ExitPromptError`},Qe=class extends Error{name=`HookError`},$e=class extends Error{name=`ValidationError`};const et=new ze;function tt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function nt(e,t){let n=tt(e);return et.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function U(){let e=et.getStore();if(!e)throw new Qe(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function rt(){return U().rl}function it(e){return Be.bind((...t)=>{let n=U(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function at(e){let t=U(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ot(){U().handleChange()}const W={queue(e){let t=U(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(rt());if(r!=null&&typeof r!=`function`)throw new $e(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=U();it(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=U();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function st(e){return typeof e==`function`}function G(e){return at(t=>{let n=Be.bind(function(e){t.get()!==e&&(t.set(e),ot())});if(t.initialized)return[t.get(),n];let r=st(e)?e():e;return t.set(r),[r,n]})}function ct(e,t){at(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&W.queue(e),n.set(t)})}function lt(){return R.platform.startsWith(`win`)?!!R.env.CI||!!R.env.WT_SESSION||!!R.env.TERMINUS_SUBLIME||R.env.ConEmuTask===`{cmd::Cmder}`||R.env.TERM_PROGRAM===`Terminus-Sublime`||R.env.TERM_PROGRAM===`vscode`||R.env.TERM===`xterm-256color`||R.env.TERM===`alacritty`||R.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:R.env.TERM!==`linux`}const ut={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},dt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},ft={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},pt={...ut,...dt},mt={...ut,...ft},K=lt()?pt:mt;Object.entries(dt);const ht={prefix:{idle:V(`blue`,`?`),done:V(`green`,K.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>V(`yellow`,e))},keybindings:[],style:{answer:e=>V(`cyan`,e),message:e=>V(`bold`,e),error:e=>V(`red`,`> ${e}`),defaultAnswer:e=>V(`dim`,`(${e})`),help:e=>V(`dim`,e),highlight:e=>V(`cyan`,e),key:e=>V(`cyan`,V(`bold`,`<${e}>`))}};function gt(){return{...ht,keybindings:Ue()}}function _t(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function vt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=_t(n)&&_t(r)?vt(n,r):r}return t}function yt(...e){return vt(gt(),...e.filter(e=>e!=null))}function bt({status:e=`idle`,theme:t}){let[n,r]=G(!1),[i,a]=G(0),{prefix:o,spinner:s}=yt(t);return ct(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function xt(e,t){return at(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function St(e){return G({current:e})[0]}function Ct(e){let t=St(e);t.current=e,ct(e=>{let n=!1,r=it((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var wt=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const Tt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Et=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Dt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,Ot=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,kt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,At=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,jt=/\t{1,1000}/y,Mt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Nt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Pt=/\p{M}+/gu,Ft={limit:1/0,ellipsis:``},It=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?It(i,Ft,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Nt,l],[Ot,0],[kt,o],[jt,s],[Mt,c],[At,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Pt,``)){let t=e.codePointAt(0)||0;if(S=Et(t)?2:Dt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===At?Tt(e.slice(p,n.lastIndex)):n===Mt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Lt={limit:1/0,ellipsis:``,ellipsisWidth:0},q=(e,t={})=>It(e,Lt,t).width,Rt=`]8;;`,zt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Rt}(?<uri>.*))`,`y`),Bt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Vt=e=>`[${e}m`,Ht=e=>`${Rt}${e}`,Ut=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:q(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=q(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Rt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Wt=e=>{let t=e.split(` `),n=t.length;for(;n&&!q(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Gt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=q(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=q(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Ut(s,r,t),c=q(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Ut(s,r,t),c=q(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Ut(s,r,t),c=q(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Wt(e)));let l=s.join(`
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{pt as r}from"./sleep-D4NlDISj.mjs";import{Fs as i,ec as a,fs as o,ot as s,rt as c}from"./src-Bt6_UxL9.mjs";import{Ai as l,Ar as u,Fa as d,Mr as f,Or as p,Ri as m,_i as h,d as g,dn as _,er as v,f as y,fn as b,fr as x,hn as S,ji as C,kr as w,mn as ee,rr as te,tr as ne,u as re,ur as ie,vi as T,vn as ae,yi as oe}from"./src-bhsVUHJJ.mjs";import{F as E,N as se}from"./fs-traced-Dm4NQ6S5.mjs";import{C as ce,a as D,d as le,f as ue,i as de,l as fe,n as pe,o as me,s as he,t as ge,u as _e,x as ve,y as ye}from"./resolve-project-root-BF1NyEri.mjs";import{i as O,n as k,o as A,r as be,s as j,t as M}from"./colors-DSyAT9Cz.mjs";import{t as xe}from"./constants-DbnPdCKs.mjs";import{t as N}from"./is-object-Bw0-z8qH.mjs";import{t as Se}from"./preview-DUg0Bjtu.mjs";import{createRequire as Ce}from"node:module";import{execFileSync as we}from"node:child_process";import Te,{dirname as P,isAbsolute as Ee,join as F,relative as I,resolve as L,sep as De}from"node:path";import R from"node:process";import{fileURLToPath as Oe}from"node:url";import{existsSync as z,lstatSync as ke,mkdirSync as Ae,readFileSync as B,readlinkSync as je,realpathSync as Me,statSync as Ne,writeFileSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import*as Ie from"node:readline";import{inspect as Le,stripVTControlCharacters as Re,styleText as V}from"node:util";import{AsyncLocalStorage as ze,AsyncResource as Be}from"node:async_hooks";const Ve=new Set([`emacs`,`vim`]);function He(e){return Ve.has(e)}function Ue(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(He))):[]}const H=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,We=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Ge=e=>e.name===`space`,Ke=e=>e.name===`backspace`,qe=e=>`1234567890`.includes(e.name),Je=e=>e.name===`enter`||e.name===`return`;var Ye=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Xe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Ze=class extends Error{name=`ExitPromptError`},Qe=class extends Error{name=`HookError`},$e=class extends Error{name=`ValidationError`};const et=new ze;function tt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function nt(e,t){let n=tt(e);return et.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function U(){let e=et.getStore();if(!e)throw new Qe(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function rt(){return U().rl}function it(e){return Be.bind((...t)=>{let n=U(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function at(e){let t=U(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ot(){U().handleChange()}const W={queue(e){let t=U(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(rt());if(r!=null&&typeof r!=`function`)throw new $e(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=U();it(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=U();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function st(e){return typeof e==`function`}function G(e){return at(t=>{let n=Be.bind(function(e){t.get()!==e&&(t.set(e),ot())});if(t.initialized)return[t.get(),n];let r=st(e)?e():e;return t.set(r),[r,n]})}function ct(e,t){at(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&W.queue(e),n.set(t)})}function lt(){return R.platform.startsWith(`win`)?!!R.env.CI||!!R.env.WT_SESSION||!!R.env.TERMINUS_SUBLIME||R.env.ConEmuTask===`{cmd::Cmder}`||R.env.TERM_PROGRAM===`Terminus-Sublime`||R.env.TERM_PROGRAM===`vscode`||R.env.TERM===`xterm-256color`||R.env.TERM===`alacritty`||R.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:R.env.TERM!==`linux`}const ut={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},dt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},ft={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},pt={...ut,...dt},mt={...ut,...ft},K=lt()?pt:mt;Object.entries(dt);const ht={prefix:{idle:V(`blue`,`?`),done:V(`green`,K.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>V(`yellow`,e))},keybindings:[],style:{answer:e=>V(`cyan`,e),message:e=>V(`bold`,e),error:e=>V(`red`,`> ${e}`),defaultAnswer:e=>V(`dim`,`(${e})`),help:e=>V(`dim`,e),highlight:e=>V(`cyan`,e),key:e=>V(`cyan`,V(`bold`,`<${e}>`))}};function gt(){return{...ht,keybindings:Ue()}}function _t(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function vt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=_t(n)&&_t(r)?vt(n,r):r}return t}function yt(...e){return vt(gt(),...e.filter(e=>e!=null))}function bt({status:e=`idle`,theme:t}){let[n,r]=G(!1),[i,a]=G(0),{prefix:o,spinner:s}=yt(t);return ct(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function xt(e,t){return at(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function St(e){return G({current:e})[0]}function Ct(e){let t=St(e);t.current=e,ct(e=>{let n=!1,r=it((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var wt=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const Tt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Et=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Dt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,Ot=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,kt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,At=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,jt=/\t{1,1000}/y,Mt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Nt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Pt=/\p{M}+/gu,Ft={limit:1/0,ellipsis:``},It=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?It(i,Ft,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Nt,l],[Ot,0],[kt,o],[jt,s],[Mt,c],[At,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Pt,``)){let t=e.codePointAt(0)||0;if(S=Et(t)?2:Dt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===At?Tt(e.slice(p,n.lastIndex)):n===Mt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Lt={limit:1/0,ellipsis:``,ellipsisWidth:0},q=(e,t={})=>It(e,Lt,t).width,Rt=`]8;;`,zt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Rt}(?<uri>.*))`,`y`),Bt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Vt=e=>`[${e}m`,Ht=e=>`${Rt}${e}`,Ut=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:q(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=q(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Rt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Wt=e=>{let t=e.split(` `),n=t.length;for(;n&&!q(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Gt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=q(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=q(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Ut(s,r,t),c=q(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Ut(s,r,t),c=q(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Ut(s,r,t),c=q(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Wt(e)));let l=s.join(`
|
|
2
2
|
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){zt.lastIndex=e+1;let t=zt.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
3
3
|
`){a&&(r+=Ht(``));let e=i?Bt(i):void 0;i&&e&&(r+=Vt(e))}else t===`
|
|
4
4
|
`&&(i&&Bt(i)&&(r+=Vt(i)),a&&(r+=Ht(a)))}return r},Kt=/\r?\n/;function qt(e,t,n){return String(e).normalize().split(Kt).map(e=>Gt(e,t,n)).join(`
|
|
@@ -633,6 +633,6 @@ export default function okBridge(pi: {
|
|
|
633
633
|
`));let p=`${a?``:``}${d}`;return p!==i&&E(e,p,{mode:Gn(e)}),{kind:l?`overwritten`:`written`}}const wi=e=>e!==`project`,Ti=e=>e!==`user`;async function Ei(){let e=await er({message:`Where should the MCP server be configured?
|
|
634
634
|
`,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 Di(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Ei)():`both`}async function Oi(e){return ar({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json, project skills)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function ki(e){if(e.sharing!==void 0)return e.sharing;let t=Mn(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??Oi)(t):t}var $=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function Ai(e){if(e===void 0||e===!0)return new Set(T);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(oe.filter(e=>t.includes(e)))}function ji(e,t,n){let r=L(n,e),i;try{i=Ne(r)}catch(e){let t=e.code;throw t===`ENOENT`?new $(`--content-dir path does not exist: ${r}`):new $(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new $(`--content-dir must be a directory: ${r}`);let a=I(Mi(t),Mi(r));if(a.startsWith(`..`)||Ee(a))throw new $(`--content-dir must be inside the project root (${t}); got ${r}`);return a===``?`.`:a}function Mi(e){try{return Me(e)}catch{return e}}const Ni=`open-knowledge-ui`;function Pi(e,t,n){try{return z(e.detectPath?.(t,n)??P(e.configPath(t,n)))}catch{return!1}}function Fi(e,t,n){try{let r=L(P(e.configPath(t,n))),i=L(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+De)}catch{return!1}}function Ii(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.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||Fi(e,t,r);if(!i&&s&&!Pi(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{pe(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 Ri(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=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{Ae(P(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 l={action:`written`},u;try{se(`${o}.lock`,()=>{let t=Jr(o).writePath;if(Ae(P(t),{recursive:!0}),e.format===`toml`){let n=Si(ni(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=Ci(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=xi(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Li={pi:Br};function Ri(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=Li[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{Ae(P(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{se(`${t}.lock`,()=>{let e=null;try{e=B(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}E(t,c,e===null?void 0:{mode:Gn(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 zi(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!z(n)))return{editorId:e.id,label:e.label,path:n}}function Bi(e,t,n,r){let i=Hi(e,t,n,r);return i.kind===`present`?i.entry:null}function Vi(e,t,n,r){let i=bi(e,t,r);if(!N(i))return{kind:`no-entry`};let a=i[n];return N(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Hi(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!z(i))return{kind:`absent`};try{if(Ne(i).size>di)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=B(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:zr(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=ni().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Vi(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,En.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Vi(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=oi(a);return s?si(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Vi(w(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ui(e={}){let t=L(e.cwd??process.cwd()),n=ge(t,{homeDir:e.home}),r=n.projectRoot;if(ae(r,e.home??Fe()))throw new S(r);let i=!z(F(r,`.ok`)),a=n.gitRootPromoted?I(r,t):void 0,s=e.contentDir===void 0?n.defaultContentDir:ji(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&s===`.`&&process.stderr.write(`${j(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let c={mode:e.devMcp?`dev`:`published`},l=await y(r),u;try{u=b(r,{contentDir:s})}catch(t){let i=he.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:l.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,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 d=u.created.includes(xe),f=!1;if(l.didInit)try{f=ee(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{_(r)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore entry at ${r}: ${e instanceof Error?e.message:String(e)}`)}let p=await re(r);p.kind===`untracked`&&console.warn(`[ok] Untracked the OpenKnowledge project skill (${p.dirs.join(`, `)}) — it is now local-only. Teammates will see this as a deletion on their next pull.`);let m=await Di({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),g=e.editors??Yi(r,e.home),C=e.editors??g,w=ye(g),T=ye(C),E=e.mcp===!1||m===null,se=Array.from(new Map([...w,...E?[]:T].map(e=>[e.id,e])).values()),ce=w.filter(t=>Pi(t,r,e.home)),D=[],le=[],ue=new Set;for(let t of se){if(E){let n=``;try{n=t.configPath(r,e.home)}catch{}D.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(wi(m)&&w.includes(t)&&t.scope===`global`&&D.push(Ii(t,r,c,e.home)),Ti(m)&&T.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ii(t,r,c,e.home,n);D.push(i),(i.action===`written`||i.action===`overwritten`)&&ue.add(n)}}let fe=new Set;for(let t of T){let n=t.projectSkillPath?.(r);!n||fe.has(n)||(fe.add(n),le.push(de(t,r,{home:e.home})))}let pe=le.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(pe.length>0){let t=e.home??Fe();te({source:o,skills:[h.project],agents:pe,scope:r},{home:t,enabled:x(t).enabled})}let me=!E&&m!==null&&Ti(m)?T.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,_e=E?[]:ce.map(e=>zi(e,r)).filter(e=>e!==void 0).filter(e=>!ue.has(e.path)),ve=e.installUserSkill??ne,O=e.home??Fe(),k=Ai(e.skills),A=!1,be=!1,M=!1,N=!1,Se=!1;for(let t of oe){if(!k.has(t))continue;await ie(O,h[t],!0).catch(()=>{}),A=!0;let n=await ve({home:e.home,bundleId:t,force:!0});n===`installed`?be=!0:n===`failed`?M=!0:n===`no-hosts`?Se=!0:N=!0}let Ce=M?`failed`:be?`installed`:A&&N?`skip-current`:A&&Se?`no-hosts`:`declined`,we=be?v(O).map(e=>e.editorId):[],Te=E?`skipped-flag`:`skipped-missing`,P=D.find(e=>e.editorId===`claude`)??D[0]??{action:Te,configPath:he.claude.configPath(r,e.home)},Ee=await Wi({projectRoot:r,desiredMode:await ki({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:u.created,contentUpdated:u.updated,contentSkipped:u.skipped,editors:D,projectSkills:le,legacyProjectConfigs:_e,skillInstall:Ce,skillHosts:we,didGitInit:l.didInit,rootGitignoreCreated:f,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:d?s:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:P.action,mcpPath:P.configPath,mcpError:`error`in P?P.error:void 0,projectScopeUnsupportedLabels:me,sharing:Ee}}async function Wi(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Mn(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=kn(t);if(n===`local-only`){let e=An(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`}:Gi(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=jn(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Gi(t,o,`remove`)}function Gi(e,t,n){let r=Mn(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:[]}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Ki(e){switch(e){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`;default:return`config not readable`}}function qi(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=F(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(M(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(M(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(M(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(M(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(M(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?I(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${A(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${A(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${be(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Ki(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(M(`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?I(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${A(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${A(`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} ${be(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${I(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(M(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>me[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${A(`installed for ${r}`)}`),n.push(` ${k(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${k(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${A(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${k(`skipped for this run (--no-skills)`)}`),n.push(` ${k(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${k(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${k(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${k(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${j(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${j(` ok repair-skills`)}`);break}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(j(`⚠ --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(j(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(Se(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...Qi(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${A(`✓`)} ${M(`Next steps:`)}`),n.push(` 1. Open your editor (${O(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${O(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${O(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
|
|
635
635
|
`)}function Ji(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 Yi(e,t){let n=[];for(let r of D)Pi(he[r],e,t)&&n.push(r);return n}function Xi(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Le(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 Zi(){return new ve(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new ce(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new ce(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new ce(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Xi():null;try{let r;try{r=await Ui({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof $||e instanceof S){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof l||e instanceof C){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof g){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.
|
|
636
|
-
`),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-
|
|
636
|
+
`),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-DBwpGCHz.mjs`),{resolveContentDir:s}=await import(`./src-DQyTLMJF.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-Bes4c5UX.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(Ji(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${qi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Qi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(M(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?n.push(` ${A(`local-only`)} — appended ${e.appended.length} path(s) to ${M(`${t}/.git/info/exclude`)} (per-clone, not committed).`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${A(`local-only`)} — already excluded; nothing to do.`):n.push(` ${A(`local-only`)}`):e.action===`removed`?n.push(` ${A(`shared`)} — removed OK paths from ${M(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${A(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(j(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
|
|
637
637
|
`))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${O(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(j(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${O(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${O(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(j(`Sharing mode unavailable: ${e.reason}.`));return n}}export{Nn as A,yt as B,ar as C,Kn as D,Wn as E,jn as F,Je as H,Tn as I,pn as L,Fn as M,Mn as N,An as O,Pn as P,Ct as R,Rr as S,Gn as T,G as V,vi as _,Ji as a,ni as b,qi as c,Bi as d,Ai as f,Ui as g,ki as h,Wi as i,kn as j,In as k,Qi as l,ji as m,Ni as n,Hi as o,Di as p,Li as r,Yi as s,$ as t,Zi as u,Ii as v,er as w,Br as x,ri as y,bt as z};
|
|
638
|
-
//# sourceMappingURL=init-
|
|
638
|
+
//# sourceMappingURL=init-CKiiDDjS.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Mr as e,kr as t}from"./src-
|
|
2
|
-
//# sourceMappingURL=launch-json-removal-
|
|
1
|
+
import{Mr as e,kr as t}from"./src-bhsVUHJJ.mjs";import{F as n}from"./fs-traced-Dm4NQ6S5.mjs";import{D as r,T as i}from"./init-CKiiDDjS.mjs";import{t as a}from"./is-object-Bw0-z8qH.mjs";import{join as o}from"node:path";import{existsSync as s,readFileSync as c}from"node:fs";const l={allowTrailingComma:!0,disallowComments:!1};function u(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function d(a){let d=o(a,`.claude`,`launch.json`);if(!s(d))return{kind:`not-present`};let p;try{p=c(d,`utf-8`)}catch{return{kind:`declined`}}let m=[],h=e(p,m,l)??void 0;if(m.some(e=>!u(e,p))||!h||h.type!==`object`)return{kind:`declined`};let g=t(h).configurations;if(!Array.isArray(g))return{kind:`not-present`};let _=g.findIndex(f);if(_===-1)return{kind:`not-present`};let{text:v,changed:y}=r(p,[`configurations`,_]);return y?(n(d,v,{mode:i(d)}),{kind:`removed`}):{kind:`not-present`}}function f(e){if(!a(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`?p.some(e=>m(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 p=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function m(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{d as t};
|
|
2
|
+
//# sourceMappingURL=launch-json-removal-lbo2BfvL.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e,l as t,p as n,pt as r,u as i}from"./sleep-D4NlDISj.mjs";import{bc as a,xc as o}from"./src-Bt6_UxL9.mjs";import{y as s}from"./src-
|
|
2
|
-
//# sourceMappingURL=loader-
|
|
1
|
+
import{h as e,l as t,p as n,pt as r,u as i}from"./sleep-D4NlDISj.mjs";import{bc as a,xc as o}from"./src-Bt6_UxL9.mjs";import{y as s}from"./src-bhsVUHJJ.mjs";import{I as c,k as l}from"./fs-traced-Dm4NQ6S5.mjs";import{t as u}from"./constants-DbnPdCKs.mjs";import{t as d}from"./is-object-Bw0-z8qH.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=r();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 d(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(t,n){return t.map(t=>{let r=t.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:t.message,issueCode:t.code};if(n.doc!==null&&n.source!==null){let t=e({file:n.path,source:n.source,doc:n.doc,path:r});if(t!==void 0)return{...i,source:t}}return i})}function b(e){let r=e??process.cwd(),d=[],p=[],m=[],h=[],g=l(`user`,r),_=c({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&d.push(g);let b=(e,n=!1)=>{let r=v(e);if(r.diagnostic!==void 0&&p.push(r.diagnostic),r.value===null)return{};let a=t({value:r.value,file:r.path,source:r.source,doc:r.doc});p.push(...a),d.push(e);let s=a.length>0?i(r.value):r.value;return n&&h.push(...o({value:s,file:r.path,source:r.source,doc:r.doc})),s},x=f(r,`.ok`,u),S=b(x,!0),C=b(l(`project-local`,r)),w=a(_.value,S,C),T=s.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(n(t))}return{config:T.data,sources:d,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};
|
|
2
|
+
//# sourceMappingURL=loader-AoOfPnaW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-AoOfPnaW.mjs";export{e as loadConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Ri as e}from"./src-
|
|
2
|
-
//# sourceMappingURL=open-browser-
|
|
1
|
+
import{Ri as e}from"./src-bhsVUHJJ.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}t(process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,process.platform===`win32`?[`/c`,`start`,``,a]:[a],e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
|
|
2
|
+
//# sourceMappingURL=open-browser-C8W8YLUr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-DUg0Bjtu.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Nr as e}from"./src-
|
|
1
|
+
import{Nr as e}from"./src-bhsVUHJJ.mjs";import"./constants-DbnPdCKs.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
|
|
2
2
|
`)}export{c as n,l as t};
|
|
3
|
-
//# sourceMappingURL=preview-
|
|
3
|
+
//# sourceMappingURL=preview-DUg0Bjtu.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./launch-json-removal-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{t as e}from"./launch-json-removal-lbo2BfvL.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-Bu0L2kla.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Cs as e}from"./src-Bt6_UxL9.mjs";import{a as t,m as n,s as r}from"./resolve-project-root-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{Cs as e}from"./src-Bt6_UxL9.mjs";import{a as t,m as n,s as r}from"./resolve-project-root-BF1NyEri.mjs";import{d as i,v as a}from"./init-CKiiDDjS.mjs";import{t as o}from"./mcp-migrate-event-9DFnNzHa.mjs";import{homedir as s}from"node:os";function c(e){let n=e.logger??d,i=e.home??s(),a=[];if(e.reclaimDisableEnv===`1`)return n({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=r[o],s=l(()=>t.configPath(``,i));if(s!==null&&a.push(u({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:n})),t.projectConfigPath){let r=t.projectConfigPath,i=l(()=>r(e.projectDir));i!==null&&a.push(u({scope:`project`,editorId:o,target:t,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:n}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function l(e){try{return e()}catch{return null}}function u(t){let r={scope:t.scope,editorId:t.editorId,configPath:t.configPath},s=i(t.target,t.cwd,t.home,t.configPathOverride);if(s===null)return{...r,outcome:`no-entry`};if(t.editorId===`pi`){if(n(s))return{...r,outcome:`canonical`}}else{let n=e(s);if(n.kind===`recognized`&&n.disposition===`keep`)return{...r,outcome:`canonical`};if(n.kind===`declined`&&t.scope===`project`)return t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:n.reason}),{...r,outcome:`declined`,reason:n.reason}}t.logger(o({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:s}));let c=a(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(c.action===`failed`){let e=c.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...r,outcome:`write-failed`,error:e}}return c.action===`declined`?(t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:c.declineReason}),{...r,outcome:`declined`}):{...r,outcome:`repaired`}}function d(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{c as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-CrR_x0jk.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{J as e,Us as t}from"./src-Bt6_UxL9.mjs";import{_i as n,_n as r,ar as i,dr as a,lr as o,mr as s,or as c,pi as l,ur as u,yi as d}from"./src-yn8SArMz.mjs";import{c as f,n as p,s as m,x as h}from"./resolve-project-root-CIQP5bae.mjs";import{n as g,s as _,t as v}from"./colors-DSyAT9Cz.mjs";import{n as y,r as b,t as x}from"./skill-teardown-CZx0nQAt.mjs";import{basename as S,dirname as C,join as w,relative as T,resolve as E}from"node:path";import{existsSync as D,mkdirSync as O,readFileSync as k,readdirSync as A,rmSync as j,statSync as M,writeFileSync as N}from"node:fs";import{homedir as P}from"node:os";import{createInterface as F}from"node:readline/promises";const I={existsSync:e=>D(e),isDirectory:e=>{try{return M(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>A(e),readFileSync:e=>k(e),writeFileSync:(e,t)=>{N(e,t)},mkdirSync:(e,t)=>{O(e,t)},rmSync:(e,t)=>{j(e,t)}},L={resolveProjectBundledSkillDir:()=>l(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>l(e,{checkDesktop:!1}),readBundledVersion:()=>c(),readRecordedVersion:e=>o(e,`cli-hosts`),writeRecordedVersion:(e,t)=>a(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>s(e),readBundleDecision:(e,t)=>i(e,t),writeBundleDecision:(e,t,n)=>u(e,t,n),removeBundleFromDisk:(e,t)=>b(e,t)};function R(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function z(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(C(t),{recursive:!0}),B(e,t,n)}function B(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=w(e,r),a=w(t,r);n.isDirectory(i)?B(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function V(e,n,r){return r.existsSync(w(e,`.agents`,`skills`,n))||t.some(t=>r.existsSync(w(e,t.skillsRoot,n)))}function H(e,n,r,i,a,o){let s=[],c=w(e,`.agents`,`skills`,n);if(V(e,n,i)){i.existsSync(c)&&s.push({kind:`central`,path:c,outcome:`skipped-present`});for(let r of t){let t=w(e,r.skillsRoot,n);if(t!==c){if(!i.existsSync(w(e,r.hostDir))){s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-host-absent`});continue}i.existsSync(t)&&s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-present`})}}return{entries:s,anyWritten:!1,anyDestinationSucceeded:!0}}let l=i.existsSync(w(e,`.agents`));if(l&&i.existsSync(c))s.push({kind:`central`,path:c,outcome:`skipped-present`});else if(l)try{z(r,c,i),s.push({kind:`central`,path:c,outcome:`written`}),a({event:`user-skill-reclaim-central-written`,scope:`user`,path:c,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`central`,path:c,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-central-failed`,scope:`user`,path:c,error:t})}for(let l of t){let t=w(e,l.hostDir),u=w(e,l.skillsRoot,n);if(u===c){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!i.existsSync(t)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(i.existsSync(u)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-present`});continue}try{z(r,u,i),s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`written`}),a({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,error:t})}}return{entries:s,anyWritten:s.some(e=>e.outcome===`written`),anyDestinationSucceeded:s.some(e=>e.outcome===`written`||e.outcome===`skipped-present`)}}function U(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function W(e,t,n,i){if(!e||!t)return!1;let a;try{a=e.configPath(n,i)}catch{return!1}let o=e=>w(r(C(e)),S(e));return o(t)===o(a)}function G(e,t,n,r,i){let a;try{a=n.resolveProjectBundledSkillDir()}catch(e){return i({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let o=[];for(let n of f){let s=w(e,n.hostDir,`skills`,`open-knowledge`),c=w(s,`SKILL.md`);if(r.existsSync(c)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`present`});continue}let l=m[n.editorId],u=l?.projectConfigPath?.(e);if(W(l,u,e,t)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`skipped-global-collision`}),i({event:`project-skill-reclaim-skipped-global-collision`,scope:`project`,editorId:n.editorId,path:s});continue}if(!U(u,r)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`no-token`}),i({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:n.editorId,path:s});continue}try{p(s,e),z(a,s,r),o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`created`}),i({event:`project-skill-reclaim-created`,scope:`project`,editorId:n.editorId,path:s})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`failed`,error:t}),i({event:`project-skill-reclaim-failed`,scope:`project`,editorId:n.editorId,path:s,error:t})}}return{outcome:`done`,entries:o}}async function K(t,r,i,a){let o=e=>{r.recordEvent(e).catch(()=>{})},s=()=>new Date().toISOString(),c;try{c=await r.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 l;try{l=await r.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),l=null}let u=[],f=null;for(let e of d)try{u.push({id:e,sourceDir:r.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(u.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 o of u){let s=n[o.id],c=V(t,s,i),l=await r.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{r.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 r.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=>V(t,n[e.id],i));if(l!==null&&l===c&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:c}),{outcome:`skipped`,reason:`version-current`};let h=[],g=u.length===d.length,_=[];for(let{id:e,sourceDir:r}of p){let o=H(t,n[e],r,i,a,c);h.push(...o.entries),_.push({id:e,anyWritten:o.anyWritten,landed:o.anyDestinationSucceeded,centralFailed:o.entries.some(e=>e.kind===`central`&&e.outcome===`failed`),hostFailed:o.entries.some(e=>e.kind===`host`&&e.outcome===`failed`)})}let v=_.some(e=>e.centralFailed),y=_.every(e=>e.landed);if(g&&y&&!v){let e=null;try{await r.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,anyWritten: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{g||o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:c,reason:`bundle-unresolved`});for(let{id:e,centralFailed:t,hostFailed:n}of _)!t&&!n||o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:`failed`,version:c,reason:n?`all-writes-failed`:`central-write-failed`})}return{outcome:`done`,version:c,entries:h}}async function q(e){let t=e.logger??R,n=e.fs??I,r=e.home??P(),i={...L,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=G(e.projectDir,r,i,n,t),o=await K(r,i,n,t),s=y(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=x(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function J(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function Y(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`present`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length,o=e.project.entries.filter(e=>e.outcome===`skipped-global-collision`).length;t.push(` Project: ${n} present, ${r} created, ${i} no-token, ${a} failed.`),o>0&&t.push(` Skipped ${o} host(s) whose project config path is their user-global config (not a project directory).`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-present`).length,i=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,a=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} present, ${i} skipped, ${a} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
|
|
1
|
+
import{J as e,Us as t}from"./src-Bt6_UxL9.mjs";import{_i as n,_n as r,ar as i,dr as a,lr as o,mr as s,or as c,pi as l,ur as u,yi as d}from"./src-bhsVUHJJ.mjs";import{c as f,n as p,s as m,x as h}from"./resolve-project-root-BF1NyEri.mjs";import{n as g,s as _,t as v}from"./colors-DSyAT9Cz.mjs";import{n as y,r as b,t as x}from"./skill-teardown-B9-HO2ID.mjs";import{basename as S,dirname as C,join as w,relative as T,resolve as E}from"node:path";import{existsSync as D,mkdirSync as O,readFileSync as k,readdirSync as A,rmSync as j,statSync as M,writeFileSync as N}from"node:fs";import{homedir as P}from"node:os";import{createInterface as F}from"node:readline/promises";const I={existsSync:e=>D(e),isDirectory:e=>{try{return M(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>A(e),readFileSync:e=>k(e),writeFileSync:(e,t)=>{N(e,t)},mkdirSync:(e,t)=>{O(e,t)},rmSync:(e,t)=>{j(e,t)}},L={resolveProjectBundledSkillDir:()=>l(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>l(e,{checkDesktop:!1}),readBundledVersion:()=>c(),readRecordedVersion:e=>o(e,`cli-hosts`),writeRecordedVersion:(e,t)=>a(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>s(e),readBundleDecision:(e,t)=>i(e,t),writeBundleDecision:(e,t,n)=>u(e,t,n),removeBundleFromDisk:(e,t)=>b(e,t)};function R(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function z(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(C(t),{recursive:!0}),B(e,t,n)}function B(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=w(e,r),a=w(t,r);n.isDirectory(i)?B(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function V(e,n,r){return r.existsSync(w(e,`.agents`,`skills`,n))||t.some(t=>r.existsSync(w(e,t.skillsRoot,n)))}function H(e,n,r,i,a,o){let s=[],c=w(e,`.agents`,`skills`,n);if(V(e,n,i)){i.existsSync(c)&&s.push({kind:`central`,path:c,outcome:`skipped-present`});for(let r of t){let t=w(e,r.skillsRoot,n);if(t!==c){if(!i.existsSync(w(e,r.hostDir))){s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-host-absent`});continue}i.existsSync(t)&&s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-present`})}}return{entries:s,anyWritten:!1,anyDestinationSucceeded:!0}}let l=i.existsSync(w(e,`.agents`));if(l&&i.existsSync(c))s.push({kind:`central`,path:c,outcome:`skipped-present`});else if(l)try{z(r,c,i),s.push({kind:`central`,path:c,outcome:`written`}),a({event:`user-skill-reclaim-central-written`,scope:`user`,path:c,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`central`,path:c,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-central-failed`,scope:`user`,path:c,error:t})}for(let l of t){let t=w(e,l.hostDir),u=w(e,l.skillsRoot,n);if(u===c){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!i.existsSync(t)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(i.existsSync(u)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-present`});continue}try{z(r,u,i),s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`written`}),a({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,error:t})}}return{entries:s,anyWritten:s.some(e=>e.outcome===`written`),anyDestinationSucceeded:s.some(e=>e.outcome===`written`||e.outcome===`skipped-present`)}}function U(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function W(e,t,n,i){if(!e||!t)return!1;let a;try{a=e.configPath(n,i)}catch{return!1}let o=e=>w(r(C(e)),S(e));return o(t)===o(a)}function G(e,t,n,r,i){let a;try{a=n.resolveProjectBundledSkillDir()}catch(e){return i({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let o=[];for(let n of f){let s=w(e,n.hostDir,`skills`,`open-knowledge`),c=w(s,`SKILL.md`);if(r.existsSync(c)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`present`});continue}let l=m[n.editorId],u=l?.projectConfigPath?.(e);if(W(l,u,e,t)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`skipped-global-collision`}),i({event:`project-skill-reclaim-skipped-global-collision`,scope:`project`,editorId:n.editorId,path:s});continue}if(!U(u,r)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`no-token`}),i({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:n.editorId,path:s});continue}try{p(s,e),z(a,s,r),o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`created`}),i({event:`project-skill-reclaim-created`,scope:`project`,editorId:n.editorId,path:s})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`failed`,error:t}),i({event:`project-skill-reclaim-failed`,scope:`project`,editorId:n.editorId,path:s,error:t})}}return{outcome:`done`,entries:o}}async function K(t,r,i,a){let o=e=>{r.recordEvent(e).catch(()=>{})},s=()=>new Date().toISOString(),c;try{c=await r.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 l;try{l=await r.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),l=null}let u=[],f=null;for(let e of d)try{u.push({id:e,sourceDir:r.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(u.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 o of u){let s=n[o.id],c=V(t,s,i),l=await r.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{r.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 r.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=>V(t,n[e.id],i));if(l!==null&&l===c&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:c}),{outcome:`skipped`,reason:`version-current`};let h=[],g=u.length===d.length,_=[];for(let{id:e,sourceDir:r}of p){let o=H(t,n[e],r,i,a,c);h.push(...o.entries),_.push({id:e,anyWritten:o.anyWritten,landed:o.anyDestinationSucceeded,centralFailed:o.entries.some(e=>e.kind===`central`&&e.outcome===`failed`),hostFailed:o.entries.some(e=>e.kind===`host`&&e.outcome===`failed`)})}let v=_.some(e=>e.centralFailed),y=_.every(e=>e.landed);if(g&&y&&!v){let e=null;try{await r.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,anyWritten: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{g||o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:c,reason:`bundle-unresolved`});for(let{id:e,centralFailed:t,hostFailed:n}of _)!t&&!n||o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:`failed`,version:c,reason:n?`all-writes-failed`:`central-write-failed`})}return{outcome:`done`,version:c,entries:h}}async function q(e){let t=e.logger??R,n=e.fs??I,r=e.home??P(),i={...L,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=G(e.projectDir,r,i,n,t),o=await K(r,i,n,t),s=y(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=x(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function J(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function Y(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`present`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length,o=e.project.entries.filter(e=>e.outcome===`skipped-global-collision`).length;t.push(` Project: ${n} present, ${r} created, ${i} no-token, ${a} failed.`),o>0&&t.push(` Skipped ${o} host(s) whose project config path is their user-global config (not a project directory).`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-present`).length,i=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,a=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} present, ${i} skipped, ${a} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
|
|
2
2
|
`)}function X(){return new h(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").option(`-y, --yes`,`Skip the confirmation prompt for removing directories left by a pre-0.42 install.`).action(async e=>{let t=await q({projectDir:E(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null,confirmLegacyCleanup:t=>Z(t,{yes:e.yes===!0})});process.stdout.write(`${Y(t)}\n`),process.exitCode=J(t)})}async function Z(e,t){let n=P(),r=e=>`~/${T(n,e)}`,i=t.input??process.stdin,a=[``,v(`A previous version of OpenKnowledge installed its skill into agent tools you may never have used.`),g(`(Versions before 0.42 wrote to every host a third-party installer knew about — see issue #820.)`)];if(e.skillDirs.length>0&&a.push(``,`${v(`Remove OpenKnowledge skills:`)} ${e.skillDirs.length}`,...e.skillDirs.map(e=>` ${r(e)}`)),e.emptyDirs.length>0){let t=e.skillDirs.length>0?`Then remove these, which hold nothing else once the above are gone:`:`Remove these empty directories, left behind by that install:`;a.push(``,`${v(t)} ${e.emptyDirs.length}`,...e.emptyDirs.map(e=>` ${r(e)}`))}if(a.push(``,g(`Nothing outside these paths is touched. A directory that still holds anything is kept.`)),process.stdout.write(`${a.join(`
|
|
3
3
|
`)}\n`),t.yes)return!0;if(!i.isTTY)return process.stdout.write(`${_("Not a terminal — skipping cleanup. Re-run with `ok repair-skills --yes` to remove these.")}\n`),!1;let o=F({input:i,output:process.stdout});try{let e=(await o.question(`\n${v(`Remove them?`)} ${g(`[y/N] `)}`)).trim().toLowerCase();return e===`y`||e===`yes`}finally{o.close()}}export{X as n,q as t};
|
|
4
|
-
//# sourceMappingURL=repair-skills-
|
|
4
|
+
//# sourceMappingURL=repair-skills-B7T9ybuC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./repair-skills-B7T9ybuC.mjs";export{e as repairSkills};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{Ls as r,Ms as i,Ns as a,Vs as o,ws as s}from"./src-Bt6_UxL9.mjs";import{An as c,Ri as l,_n as u,jr as d,pi as f}from"./src-
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{Ls as r,Ms as i,Ns as a,Vs as o,ws as s}from"./src-Bt6_UxL9.mjs";import{An as c,Ri as l,_n as u,jr as d,pi as f}from"./src-bhsVUHJJ.mjs";import{execFileSync as p}from"node:child_process";import{basename as m,dirname as h,isAbsolute as g,join as _,posix as v,relative as y,resolve as b,sep as x,win32 as S}from"node:path";import{cpSync as ee,existsSync as C,lstatSync as te,mkdirSync as ne,readFileSync as re,realpathSync as w,rmSync as ie,statSync as ae}from"node:fs";import{homedir as T}from"node:os";var E=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),D=n((e=>{let{InvalidArgumentError:t}=E();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),O=n((e=>{let{humanReadableArgName:t}=D();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
2
2
|
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
3
3
|
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
4
4
|
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),k=n((e=>{let{InvalidArgumentError:t}=E();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
@@ -53,4 +53,4 @@ foreach ($d in $dirs) {
|
|
|
53
53
|
}
|
|
54
54
|
[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
|
|
55
55
|
exit 127`,I=`// ok-pi-bridge`,L=`${I}-v1`,be=`ok-pi-managed-extension`;function xe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(L)}return!1}function R(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=b(e);if(m(t)===`cli.mjs`&&m(h(t))===`dist`)return t;let n=t.split(x),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return _(i.length===0?x:i.join(x),`packages`,`cli`,`dist`,`cli.mjs`)}function z(e={}){return e.mode===`dev`?{command:M,args:[R(),`mcp`],env:{...N}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{command:`/bin/sh`,args:[`-l`,`-c`,P]}}function Se(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[M,R(),`mcp`],environment:{...N}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,P]}}function Ce(e){if(typeof e!=`object`||!e)return!1;let t=e;return B(t,z({mode:`published`,platformName:`darwin`}))||B(t,z({mode:`published`,platformName:`win32`}))}function B(e,t){return Object.keys(e).length===Object.keys(t).length?we(e,t):!1}function we(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function V(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:V(t.args,t.command)}function Ee(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&V(r,n)}function H(e){return e===`win32`?S:v}function De(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env,i=H(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA||i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME||i.join(n,`.config`)}function Oe(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.claude.json`)}function U(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env;if(t===`darwin`)return v.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??S.join(n,`AppData`,`Roaming`);return S.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function W(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.cursor`,`mcp.json`)}function ke(e={}){let t=e.platformName??process.platform,n=e.home??T();return(e.env??process.env).CODEX_HOME??H(t).join(n,`.codex`)}function G(e={}){return H(e.platformName??process.platform).join(ke(e),`config.toml`)}function K(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=(e.env??process.env).COPILOT_HOME??H(t).join(n,`.copilot`);return H(t).join(r,`mcp-config.json`)}function Ae(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env,i=H(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function q(e={}){return H(e.platformName??process.platform).join(Ae(e),`opencode.json`)}function je(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.openclaw`,`openclaw.json`)}function Me(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.hermes`,`config.yaml`)}function J(e={}){let t=e.platformName??process.platform,n=e.home??T();return(e.env??process.env).PI_CODING_AGENT_DIR??H(t).join(n,`.pi`,`agent`)}function Ne(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Pe(e,t){let n=H(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function Y(e={}){let t=e.platformName??process.platform,n=Pe(e.home??T(),t);return n.find(e=>C(e))||n.find(e=>C(h(e)))||n[0]}const X={claude:{id:`claude`,label:j.claude,configPath:(e,t)=>Oe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.claude`),projectConfigPath:e=>_(e,`.mcp.json`),projectSkillPath:e=>_(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:j[`claude-desktop`],configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(U({home:t}))},cursor:{id:`cursor`,label:j.cursor,configPath:(e,t)=>W({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(W({home:t})),projectConfigPath:e=>_(e,`.cursor`,`mcp.json`),projectSkillPath:e=>_(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:j.codex,configPath:(e,t)=>G({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(G({home:t})),projectConfigPath:e=>_(e,`.codex`,`config.toml`),projectSkillPath:e=>_(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:j.copilot,configPath:(e,t)=>K({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(K({home:t})),projectSkillPath:e=>_(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:j.opencode,configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>s,buildEntry:(e,t)=>Se(t),scope:`global`,detectPath:(e,t)=>h(q({home:t})),projectConfigPath:e=>_(e,`opencode.json`),projectSkillPath:e=>_(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:j.openclaw,configPath:(e,t)=>je({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:j.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>J({home:t}),projectConfigPath:e=>_(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>_(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:j.antigravity,configPath:(e,t)=>Ne({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:j[`lm-studio`],configPath:(e,t)=>Y({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(Y({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:j.hermes,configPath:(e,t)=>Me({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.hermes`),offerOnlyWhenDetected:!0}};function Fe(e){let t=e.filter(e=>!Object.hasOwn(X,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${A.join(`, `)}`);return e.map(e=>X[e])}function Z(e,t){let n;try{n=te(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);Q(e,t)}function Ie(e,t){Q(e,t)}function Q(e,t){let n;try{n=w(t)}catch{n=b(t)}let r=h(e);for(;r.length>1&&r!==x;){let t;try{t=w(r)}catch(e){if(e.code===`ENOENT`){r=h(r);continue}throw e}let i=y(n,t);if(i===``||!i.startsWith(`..`)&&!g(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Le(e,t,n){try{if(ae(n).size>10485760)return!1}catch{return!1}let r;try{r=re(n,`utf-8`)}catch{return!1}let i=[],a=d(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!$(a))return!1;let o=a[e.topLevelKey];if(!$(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return $(s)?$(s[e.serverName(t)]):!1}function Re(e,t,n={}){if(!o.includes(e.id))return!0;try{return Le(e,t,e.configPath(t,n.home))}catch{return!1}}function ze(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!Re(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=f(`project`,{checkDesktop:!0}),i=h(r);Z(i,t);let a=C(r)?`overwritten`:`written`;return ie(i,{recursive:!0,force:!0}),ne(h(i),{recursive:!0}),ee(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function Be(e,t){let n=y(u(t),u(e));return n.length>0&&!n.startsWith(`..`)&&!g(n)}const Ve=e=>{try{let t=p(`git`,[`rev-parse`,`--show-toplevel`],l({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function He(e,t={}){let n=t.homeDir??T(),r=t.gitTopLevel??Ve,i=b(e),a;try{a=w(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(c(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=h(o);if(e===o)break;o=e,s+=1}let l=r(a);return l!==null&&Be(l,n)?l===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:l,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}export{_e as C,pe as S,H as _,A as a,J as b,ye as c,be as d,z as f,Ee as g,Ce as h,ze as i,I as l,xe as m,Z as n,j as o,Te as p,Ie as r,X as s,He as t,L as u,De as v,he as x,Fe as y};
|
|
56
|
-
//# sourceMappingURL=resolve-project-root-
|
|
56
|
+
//# sourceMappingURL=resolve-project-root-BF1NyEri.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Us as e}from"./src-Bt6_UxL9.mjs";import{_i as t,yi as n}from"./src-
|
|
2
|
-
//# sourceMappingURL=skill-teardown-
|
|
1
|
+
import{Us as e}from"./src-Bt6_UxL9.mjs";import{_i as t,yi as n}from"./src-bhsVUHJJ.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=[...n.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 n){let n=t[r];o.push({path:a(i,`.agents`,`skills`,n),bundleId:r,scope:`central`});for(let t of e)o.push({path:a(i,t.skillsRoot,n),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-B9-HO2ID.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sleep-D4NlDISj.mjs";import{Ac as i,Co as a,Fc as o,Ic as s,jc as c,lt as l,ut as u}from"./src-Bt6_UxL9.mjs";import{Ri as d,ct as f,di as p,kn as m,lt as h,ot as g,st as ee}from"./src-
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sleep-D4NlDISj.mjs";import{Ac as i,Co as a,Fc as o,Ic as s,jc as c,lt as l,ut as u}from"./src-Bt6_UxL9.mjs";import{Ri as d,ct as f,di as p,kn as m,lt as h,ot as g,st as ee}from"./src-bhsVUHJJ.mjs";import{D as _,F as v,I as y,k as b}from"./fs-traced-Dm4NQ6S5.mjs";import{C as x,S,_ as C,f as w,r as T}from"./server-lock-C0j1Yr_I.mjs";import{t as E}from"./yazl-DejPO9b3.mjs";import{h as D,m as te,x as ne}from"./resolve-project-root-BF1NyEri.mjs";import{c as O}from"./colors-DSyAT9Cz.mjs";import{a as k,i as re}from"./acp-harness-probe-BVPmScTu.mjs";import{D as ie,E as A,S as ae,T as j,_ as oe,b as se,o as ce}from"./init-CKiiDDjS.mjs";import{n as le}from"./constants-DbnPdCKs.mjs";import{t as M}from"./is-object-Bw0-z8qH.mjs";import"./loader-AoOfPnaW.mjs";import"./skill-teardown-B9-HO2ID.mjs";import"./preview-DUg0Bjtu.mjs";import{execSync as ue,spawnSync as de}from"node:child_process";import{basename as N,dirname as P,join as F,relative as fe,resolve as I,sep as pe}from"node:path";import{cpSync as me,createWriteStream as he,existsSync as L,lstatSync as ge,mkdirSync as R,mkdtempSync as _e,readFileSync as z,readdirSync as B,readlinkSync as ve,rmSync as ye,statSync as be,writeFileSync as V}from"node:fs";import{arch as xe,freemem as Se,homedir as H,hostname as Ce,platform as we,release as Te,tmpdir as Ee,totalmem as De,type as Oe,uptime as ke}from"node:os";import"node:fs/promises";import{createHash as Ae}from"node:crypto";var je=n();const Me=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ne(e,t,n=m){if(e!==void 0&&!Me.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Pe=null;function Fe(e){Pe=e}function Ie(){return Pe??process.cwd()}function U(){return F(H(),`.ok`,`bug-reports`)}function Le(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=U(),r=`${t}-bugreport`,i=F(n,`${r}.zip`);for(let e=2;L(i);e+=1)i=F(n,`${r}-${e}.zip`);return i}function Re(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let e=z(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return L(F(e,`.ok`))?Ae(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function ze(){let e={timestamp:new Date().toISOString(),platform:we(),osType:Oe(),osRelease:Te(),hostname:`[redacted]`,uptime:ke(),freeMem:Se(),totalMem:De(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ue(`sw_vers -productVersion 2>/dev/null`,d({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}const Be=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function Ve(e){let t=N(e);return Be.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function He(e,t){return Ke(e,t).files}const Ue=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function We(e,t=k){let n=F(e,`${t}.ShipIt`);return L(n)?Ue.map(e=>F(n,e)).filter(e=>L(e)):[]}function Ge(e){if(!L(e))return[];try{let t=new Map;for(let n of B(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-o.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>F(e,t))}catch{return[]}}function Ke(e,t){if(!L(t))return{files:[],excludedByProjectSlug:0};let n=B(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(Ve),i=[],a=r.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!Ve(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function qe(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,l].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Je(e){let t=F(e,`.ok`,`local`,`logs`);return L(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ye(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=c(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function W(e){for(let t of e.files)try{Ye({zipfile:e.zipfile,name:`${e.prefix}/${N(t)}`,content:z(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Xe(t){let{redact:n,outputPath:r,logger:a}=t,o=t.userLogsDir??F(H(),`.ok`,`logs`),c=t.projectDir?Re(t.projectDir,a):null;R(P(r),{recursive:!0}),a?.info({projectSlug:c},`gathering diagnostic data`);let l=ze();l.desktop=t.desktop??null,l.language=t.language??null;let{files:u,excludedByProjectSlug:d}=Ke(c,o),{files:f}=t.projectDir?qe(t.projectDir):{files:[]},{files:p}=t.projectDir?Je(t.projectDir):{files:[]},m=t.shipItLogFiles??[];a?.info({logFileCount:u.length,logFilesExcludedByProjectSlug:d,lockFileCount:f.length,localSinkFileCount:p.length,shipItLogFileCount:m.length},`files collected`);let h=[],g=[],{ZipFile:ee}=await import(`./yazl-BwMlCqRQ.mjs`).then(t=>e(t.default,1)),_=new ee;W({zipfile:_,files:[...u,...m],prefix:`logs`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:f,prefix:`lockdir`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:p,prefix:`local-logs`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:t.bugReportLedgerFiles??[],prefix:s,redact:n,bundleFiles:g,redactions:h,logger:a});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;_.addBuffer(t,n),g.push(n)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ye({zipfile:_,name:`note.txt`,content:t.note,redact:n,bundleFiles:g,redactions:h});let v=JSON.stringify(l,null,2);_.addBuffer(Buffer.from(v,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let y={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:c,files:g,redactions:h,sysinfo:l};_.addBuffer(Buffer.from(JSON.stringify(y,null,2),`utf8`),`MANIFEST.json`);let b=h.reduce((e,t)=>e+t.lineCount,0),x=new Set(m.map(e=>`logs/${N(e)}`)),S=g.filter(e=>x.has(e)),C=new Set((t.bugReportLedgerFiles??[]).map(e=>`${s}/${N(e)}`)),w=g.filter(e=>C.has(e)),T=c?g.filter(e=>e.startsWith(`logs/`)&&!Ve(e)&&!x.has(e)):[],E=[`# Bug Report Bundle`,``,`Generated: ${y.generatedAt}`,`Project: ${c??`(unscoped)`}`,`Discipline version: ${y.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...T.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...T.map(e=>`- ${e}`),``]:[],...S.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...S.map(e=>`- ${e}`),``]:[],...w.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...w.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${i.join(`, `)}`,b>0?`${b} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
2
2
|
`);_.addBuffer(Buffer.from(E,`utf8`),`README.md`),_.end();let D=he(r);return _.outputStream.pipe(D),await new Promise((e,t)=>{D.on(`close`,e),D.on(`error`,t)}),a?.info({bundlePath:r,fileCount:g.length,redactionCount:b},`bundle written`),{zipPath:r,summary:{projectSlug:c,files:g,redactions:h,redactedLineCount:b,generatedAt:y.generatedAt}}}var Ze=e(E(),1),G=e(O(),1);function Qe(e){return y({absPath:b(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function $e({home:e=H(),env:n=process.env}={}){let i=Qe(e),{override:o,preferenceList:s}=_(n),{locale:c,source:l}=a({override:o,storedPreference:i,supportedLocales:r,preferenceList:s,autoDetectableLocales:t});return{preference:i,locale:c,source:l,systemLanguages:s}}function et(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function tt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return et(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!tt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=K(i,t);return n}function nt(e,t){let n=z(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
3
3
|
`),i=n.split(`
|
|
4
4
|
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=K(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}V(e,r?`${a.join(`
|
|
@@ -17,4 +17,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sle
|
|
|
17
17
|
`).replace(/\n/g,`\r
|
|
18
18
|
`));let u=`${i?``:``}${l}`;return u!==r&&v(e,u,{mode:j(e)}),{kind:`removed`}}function gn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function _n(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function vn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&T(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:ee(n),command:n,isDesktop:gn(n)}}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const yn=new Set([`running`,`desktop`,`foreign`]);function bn(e){switch(e){case`running`:return G.default.green(e);case`desktop`:return G.default.blue(e);case`foreign`:return G.default.cyan(e);case`stale`:return G.default.yellow(e)}}function xn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Sn(e){return`${xn(e.server.usage)} | ${xn(e.ui?.usage??null)}`}function Cn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function wn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory,Cn(e),Sn(e),Q(e),String(e.server.pid),_n(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=bn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=G.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
19
19
|
`)}async function Tn(e={}){let t=e.discover??g,n=e.inspect??X,r=e.log??(e=>console.log(e)),i=e.resolveCommand??f,a=e.resolveUsage??h,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=vn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(wn(e.all?s:s.filter(e=>yn.has(Q(e)))))}function En(){return new ne(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Tn({all:t.all===!0||e===`all`,json:t.json===!0})})}function Dn(e,t,n={}){let r=n.isAlive??S,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function On(e){let t=e.inspect??(t=>t===`ui`?Z(e.lockDir):X(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=Dn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function kn(e,t=S){let n=await g(),r=null;for(let i of n){let n=X(i,`server`),a=Z(i);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function An(e){let t=On({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function jn(e){return new ne(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=On({lockDir:p(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await Tn({});return}if(n===`all`){let e=await g();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=X(n,`server`),r=Z(n);!$(e,S)&&!$(r,S)||(An(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await kn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}An(t);return}An(p(I(Ie(),n)))})}export{U as _,rn as a,Ne as b,sn as c,Z as d,X as f,Le as g,Xt as h,fn as i,cn as l,Yt as m,jn as n,ln as o,$t as p,En as r,an as s,On as t,nn as u,Ie as v,Fe as y};
|
|
20
|
-
//# sourceMappingURL=src-
|
|
20
|
+
//# sourceMappingURL=src-CUv_mIbV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-Bt6_UxL9.mjs";import"./resolve-project-root-BF1NyEri.mjs";import"./src-CUv_mIbV.mjs";import"./acp-harness-probe-BVPmScTu.mjs";import"./init-CKiiDDjS.mjs";import{n as e}from"./loader-AoOfPnaW.mjs";import"./skill-teardown-B9-HO2ID.mjs";import"./preview-DUg0Bjtu.mjs";import"./mcp-migrate-event-9DFnNzHa.mjs";export{e as loadConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ds as e,J as t,Js as n,Ks as r,Os as i,Pc as a,W as o,ic as s,ws as c,x as l,y as u}from"./src-Bt6_UxL9.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Aa as _,Ai as v,An as y,At as b,B as x,Bi as S,Bn as C,Br as w,Bt as T,C as E,Ca as D,Ci as O,Cn as k,Cr as A,Ct as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Dt as L,E as R,Ea as z,Ei as B,En as V,Er as H,Et as U,F as W,Fi as G,Fn as K,Fr as q,Ft as J,G as Y,Gi as X,Gn as Z,Gr as Q,Gt as $,H as ee,Hi as te,Hn as ne,Hr as re,Ht as ie,I as ae,Ii as oe,In as se,Ir as ce,It as le,J as ue,Ji as de,Jn as fe,Jr as pe,Jt as me,K as he,Ki as ge,Kn as _e,Kr as ve,Kt as ye,L as be,Li as xe,Ln as Se,Lr as Ce,Lt as we,M as Te,Ma as Ee,Mi as De,Mn as Oe,Mt as ke,N as Ae,Ni as je,Nn as Me,Nr as Ne,Nt as Pe,O as Fe,Oa as Ie,Oi as Le,On as Re,Ot as ze,P as Be,Pi as Ve,Pn as He,Pr as Ue,Pt as We,Q as Ge,Qi as Ke,Qn as qe,Qr as Je,Qt as Ye,R as Xe,Ri as Ze,Rn as Qe,Rr as $e,Rt as et,S as tt,Sa as nt,Si as rt,Sn as it,Sr as at,St as ot,T as st,Ta as ct,Ti as lt,Tn as ut,Tr as dt,Tt as ft,U as pt,Ui as mt,Un as ht,Ur as gt,Ut as _t,V as vt,Vi as yt,Vn as bt,Vr as xt,Vt as St,W as Ct,Wi as wt,Wn as Tt,Wr as Et,Wt as Dt,X as Ot,Xi as kt,Xn as At,Xr as jt,Xt as Mt,Y as Nt,Yi as Pt,Yn as Ft,Yr as It,Yt as Lt,Z as Rt,Zi as zt,Zn as Bt,Zr as Vt,Zt as Ht,_ as Ut,_a as Wt,_i as Gt,_n as Kt,_r as qt,a as Jt,aa as Yt,ai as Xt,an as Zt,ar as Qt,at as $t,b as en,ba as tn,bi as nn,bn as rn,br as an,bt as on,c as sn,ca as cn,ci as ln,cn as un,cr as dn,ct as fn,d as pn,da as mn,di as hn,dn as gn,dr as _n,dt as vn,ea as yn,ei as bn,en as xn,er as Sn,et as Cn,f as wn,fa as Tn,fi as En,fn as Dn,fr as On,ft as kn,g as An,ga as jn,gi as Mn,gn as Nn,gr as Pn,h as Fn,ha as In,hi as Ln,hn as Rn,hr as zn,i as Bn,ia as Vn,ii as Hn,in as Un,ir as Wn,it as Gn,j as Kn,ja as qn,ji as Jn,jn as Yn,jt as Xn,k as Zn,ka as Qn,ki as $n,kn as er,kt as tr,l as nr,la as rr,li as ir,ln as ar,lr as or,lt as sr,m as cr,ma as lr,mi as ur,mn as dr,mr as fr,n as pr,na as mr,ni as hr,nn as gr,nr as _r,nt as vr,o as yr,oa as br,oi as xr,on as Sr,or as Cr,ot as wr,p as Tr,pa as Er,pi as Dr,pn as Or,pr as kr,q as Ar,qi as jr,qn as Mr,qr as Nr,qt as Pr,r as Fr,ra as Ir,ri as Lr,rn as Rr,rr as zr,rt as Br,s as Vr,sa as Hr,si as Ur,sn as Wr,sr as Gr,st as Kr,t as qr,ta as Jr,ti as Yr,tn as Xr,tr as Zr,tt as Qr,u as $r,ua as ei,ui as ti,un as ni,ur as ri,ut as ii,v as ai,va as oi,vi as si,vn as ci,vr as li,w as ui,wa as di,wi as fi,wn as pi,wr as mi,wt as hi,x as gi,xa as _i,xn as vi,xr as yi,xt as bi,y as xi,ya as Si,yi as Ci,yn as wi,yr as Ti,yt as Ei,z as Di,zi as Oi,zn as ki,zr as Ai,zt as ji}from"./src-yn8SArMz.mjs";import{C as Mi,E as Ni,T as Pi,_ as Fi,b as Ii,c as Li,d as Ri,g as zi,i as Bi,l as Vi,m as Hi,n as Ui,p as Wi,s as Gi,t as Ki,u as qi,v as Ji,w as Yi,x as Xi,y as Zi}from"./fs-traced-Dm4NQ6S5.mjs";import{a as Qi,d as $i,f as ea,i as ta,l as na,n as ra,r as ia,t as aa,u as oa}from"./logger-Dq-cRhcP.mjs";import{C as sa,S as ca,_ as la,a as ua,b as da,c as fa,d as pa,f as ma,g as ha,h as ga,i as _a,l as va,m as ya,n as ba,o as xa,p as Sa,r as Ca,s as wa,t as Ta,u as Ea,x as Da}from"./server-lock-C0j1Yr_I.mjs";export{D as AGENT_ID_MAX_LEN,di as AGENT_ID_RE,Oi as AGENT_WRITE_ORIGIN,_ as AcpPermissionStore,N as AcpRegistry,lt as AcpThreadManager,O as AgentFocusBroadcaster,rt as AgentPresenceBroadcaster,S as AgentSessionCapacityError,yt as AgentSessionManager,on as AutoStartDisabledError,Ln as BUNDLE_IDS,Mn as BUNDLE_SCOPE,Gt as BUNDLE_SKILL_NAME,Bt as BacklinkIndex,zt as CC1Broadcaster,n as CC1_CONTRACT_VERSION,Wr as CONFIG_FILENAME,Z as CONFLICT_MARKER_RE,q as CURSOR_BUNDLE_PATHS_BY_PLATFORM,xi as ConfigSchema,Ir as DEFAULT_CHECKPOINT_RETENTION,m as DEFAULT_EMBEDDINGS_DIMENSIONS,T as DEFAULT_PACK_ID,Ct as DocumentDurabilityState,bn as EMBEDDINGS_API_KEY_ENV,qr as EPHEMERAL_PROJECT_DIR_PREFIX,wi as ExposureConsentError,Ie as FEATURED_AGENT_IDS,Vn as FILE_SYSTEM_WRITER,Ft as FILE_WATCHER_ORIGIN,Nr as FileEmbeddingsBackend,gr as GIT_PREFLIGHT_FAIL_SPAN_NAME,Yt as GIT_UPSTREAM_WRITER,qn as GitDirAccessError,v as GitNotAvailableError,Jn as GitTooOldError,bi as HOCUSPOCUS_AUTH_REJECTION_REASONS,ot as HocuspocusAuthRejection,j as HocuspocusAuthTokenSchema,Rn as HomeProjectRootError,xt as INSTALLED_AGENTS_SCHEMES,vn as JSON_SCHEMA_DIALECT_2020_12,r as LINEAGE_EPOCH_KEY,vt as LIVE_DERIVED_INDEX_DEBOUNCE_MS,St as LOG_MD_TEMPLATE,b as MANAGED_RENAME_ORIGIN,B as MAX_ACP_THREADS,te as MAX_AGENT_SESSIONS,Le as MCP_CONNECTION_ID_HEADER,c as MCP_SERVER_NAME,mt as MIN_EVICTABLE_IDLE_MS,De as MIN_GIT_VERSION,Y as MISSING_OK_CONFIG_MESSAGE,Ee as MalformedGitPointerError,Br as McpLogger,he as MissingOkConfigError,X as OBSERVER_SYNC_ORIGIN,un as OK_OKIGNORE_TEMPLATE,si as ONBOARDING_BUNDLE_IDS,e as ORPHAN_MODES,a as PROTOCOL_VERSION,aa as PinoLogger,va as ProcessLockCollisionError,pn as ProjectGitInitError,Xn as ROLLBACK_ORIGIN,ar as ROOT_GITIGNORE_TEMPLATE,da as RUNTIME_VERSION,br as SERVICE_WRITER,kr as SKILL_INSTALL_EVENTS_FILE_REL,o as SKILL_STATE_TARGETS,ie as STARTER_FOLDERS,_t as STARTER_FOLDER_FRONTMATTER_FILENAME,Dt as STARTER_PACKS,$ as STARTER_PACK_IDS,ye as STARTER_TEMPLATES,Fe as STATE_MANIFEST_FILENAME,Da as STATE_SCHEMA_VERSION,s as SYSTEM_DOC_NAME,Ye as SeedPrerequisiteError,h as SeedRootDirError,Ta as ServerLockCollisionError,pr as SingleFileNotAFileError,Fr as SingleFileNotFoundError,Bn as SingleFileNotMarkdownError,Zn as StateManifestError,At as TagIndex,Ci as USER_GLOBAL_BUNDLE_IDS,ke as __getShowAllWalkStatsForTesting,Pe as __resetShowAllWalkStatsForTesting,Ea as acquireProcessLock,ba as acquireServerLock,wt as applyAgentMarkdownWrite,ht as applyExternalChange,ji as applySeed,g as assertCompatibleStateManifest,je as assertGitAvailable,Yn as assertNeverDiskEvent,Nn as assertNotHomeProjectRoot,fi as attachAcpThreadSocket,Ei as attachIdleShutdown,en as bootServer,p as buildAndOpenSkill,ni as buildConfigYmlContent,Ge as buildExecResult,rn as buildIngressPolicy,P as buildOkMcpStdioCommand,En as buildSkillZip,Pr as buildStarterFolderFrontmatterYaml,Hr as buildWipTree,nn as bundleSkillMdPath,pe as canonicalProjectKey,Kt as canonicalizeForCompare,Oe as classifyEvents,Ki as classifyFsPath,It as clearAllEmbeddingsKeys,hr as clearContributors,me as coercePackId,u as colorFromSeed,cn as commitUpstreamImport,rr as commitWip,ei as commitWipFromTree,Ve as compareSemver,an as composeEffectiveLinterConfig,yi as composeFrontmatterSchemasConfig,_e as containsConflictMarkers,Me as contentHash,Lr as contributorCount,be as countShadowObjects,Xe as countStaleAgentWipRefs,Di as countWipRefs,We as createApiExtension,tr as createAssetServeMiddleware,ue as createCollaborationHost,Ne as createContentFilter,Ue as createContentFilterAsync,jt as createEmbeddingsSecretStore,Jt as createEphemeralProjectDir,Tt as createExternalChangeHandler,cr as createFileLogger,ee as createLiveDerivedIndexExtension,Ot as createMcpHttpHandler,re as createOsProbe,ae as createPersistenceExtension,st as createServer,Be as createServerObserverExtension,de as createStreamingErrorWriter,ra as createTestLogger,Vt as describeStoredEmbeddingsKey,ai as detectClaudeDesktopPresence,G as detectGit,Kn as detectProjectShape,Sn as detectUserSkillHosts,wr as discoverLockDirs,mi as discoverMarkdownlintConfig,Rr as emitPreflightFailureSpan,d as encodeDocName,Cn as encodeFolderRoute,Qr as encodeSkillRoute,wn as ensureProjectGit,gn as ensureProjectSkillGitignore,Pt as errorResponse,He as evictStaleTrackerEntries,J as extractHeadings,Kr as extractOkBinaryPath,qe as extractWikiLinksFromMarkdown,oe as fallbackPaths,Tr as findEnclosingGitRoot,er as findEnclosingProjectRoot,dt as findNativeMarkdownlintFile,Fn as flushFileLogger,hi as formatAuthRejectionWire,Hn as formatContributors,Xt as formatContributorsFrom,we as formatPackRationale,mn as gcCheckpointRefs,Gn as getCurrentMcpLogger,vi as getIngressContext,ir as getLocalDir,An as getLogFilePath,ia as getLogger,Ut as getLogsDir,la as getMachineId,Zi as getMeter,oi as getMetrics,Ii as getTracer,Si as handleCollabSocketError,ce as handleSpawnCursor,it as hasForwardingHeaders,x as hasGcLogLatch,l as iconFromClientName,tn as incrementCollabSocketFilteredError,_i as incrementServerObserverFire,Dn as initContent,Tn as initShadowRepo,Xi as initTelemetry,tt as initToleranceTelemetryWriter,kn as installJsonSchemaDialect,ii as installPrettyZodErrors,ta as installTestLoggers,Zr as installUserSkill,Re as isAllowedApiOrigin,V as isAllowedWorkspaceHostHeader,Ke as isConfigDoc,ft as isHocuspocusAuthRejectionReason,ci as isHomeDir,k as isHostAdmitted,Lt as isKnownPackId,f as isLinkIndexExcludedDoc,F as isLoopbackAddress,yn as isManagedArtifactDoc,pi as isOriginAdmitted,i as isOrphanMode,ge as isPairedWriteOrigin,Ce as isPathWithinDir,ut as isPeerAdmitted,ca as isProcessAlive,y as isProjectRoot,Jr as isReservedForUserTree,K as isSelfWrite,mr as isSystemDoc,E as isToleranceTelemetryEnabled,sa as isValidLockPid,se as lastKnownHash,Er as listRescueCheckpoints,Mt as listStarterPacks,Qn as loadCustomAgents,W as loadPrincipal,Ca as lockAdvertisesUi,pa as lockBaseUrl,ma as lockFilePath,Qi as loggerFactory,Pn as loginShapedUserinfoUser,na as logsCurrentPath,oa as logsPreviousPath,Je as makeLazyEmbeddingsKeyStore,_a as markServerLockDraining,Ar as mountMcpAndApi,Ui as normalizeFsPath,qt as originGitHubHost,Or as packageVersionMajorMinor,U as parseAuthRejectionWire,xe as parseGitVersion,L as parseHocuspocusAuthToken,Nt as parseKeepaliveConnectionId,Se as pathToDocName,et as planSeed,yr as prepareSingleFileOpen,fn as processCommand,sr as processUsage,Wn as readAllTargets,Qt as readBundleDecision,H as readOwnNativeRules,Sa as readProcessLock,ya as readProcessLockDetailed,pt as readProjectHeadState,ve as readProjectLocalSemanticConfig,ua as readServerLock,Cr as readServerPackageVersion,Gr as readSkillInstallStateSnapshot,Te as readStateManifest,dn as readTargetRecordedAt,or as readTargetVersion,Mr as reconcile,xr as recordContributor,fr as recordSkillInstallEvent,zn as redactShareSubprocessStderr,Rt as registerAllTools,Qe as registerWrite,ga as releaseProcessLock,xa as releaseServerLock,ki as removeLastKnownHash,zr as reportSkillInstall,nt as resetMetrics,_r as resolveBuiltinSkillHosts,t as resolveBundleEnabled,Dr as resolveBundledSkillDir,ti as resolveContentDir,$e as resolveCursorBinaryDefault,Ai as resolveCursorSpawnInvocation,at as resolveEffectiveLinterConfig,Yr as resolveEmbeddingsCredential,M as resolveGitHubAccountFromUrl,hn as resolveLockDir,A as resolveNativeConfigForDoc,I as resolveNativeMarkdownlintConfig,Ht as resolvePack,nr as resolvePackageVersion,On as resolveSkillInstallReportSettings,vr as resolveUiInfo,Ur as restoreContributors,gi as restoreLifecycleFromConflictsJson,Et as rewriteMarkdownLinksForDocumentRename,Q as rewriteWikiLinksForDocumentRename,Un as runAuthReposSubprocess,Zt as runAuthStatusSubprocess,xn as runCloneSubprocess,Sr as runDeviceFlowSubprocess,$t as runWithMcpLogger,gt as safeContentPath,le as safeSubdir,lr as safetyCheckpoint,li as sameGitHubLogin,$n as sanitizeClientName,In as saveInMemoryCheckpoint,jn as saveVersion,ze as seedBasenameIndex,Vr as seedEphemeralProjectDir,sn as serializeError,Mi as setActiveSpanAttributes,jr as setupServerObservers,Wt as shadowGit,Yi as shutdownTelemetry,$i as spansCurrentPath,ea as spansPreviousPath,w as spawnDetached,fe as splitMarkdownBlocks,C as startWatcher,kt as streamingProblemEvent,ln as swapContributors,ui as teardownToleranceTelemetryWriter,ct as toBroadcasterKey,Bi as tracedAppendFileSync,Gi as tracedLinkSync,Li as tracedMkdir,Vi as tracedMkdirSync,qi as tracedRename,Ri as tracedRenameSync,Wi as tracedRmSync,Hi as tracedRmdirSync,zi as tracedUnlinkSync,Fi as tracedWriteFile,Ji as tracedWriteFileSync,R as trustSystemCertificates,$r as untrackTrackedProjectSkillProjection,bt as updateLastKnownHash,ha as updateProcessLockPort,wa as updateServerLockPort,z as validateAgentId,Xr as validateCloneInputs,ur as validateSkillZip,fa as waitForServerLockDrain,Ze as withHiddenWindowsConsole,Pi as withSpan,Ni as withSpanSync,ri as writeBundleDecision,Ti as writeMarkdownlintRule,dr as writeRootGitignoreForNewRepo,Ae as writeStateManifest,_n as writeTargetVersion,ne as writeTracker};
|
|
1
|
+
import{Ds as e,J as t,Js as n,Ks as r,Os as i,Pc as a,W as o,ic as s,ws as c,x as l,y as u}from"./src-Bt6_UxL9.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Aa as _,Ai as v,An as y,At as b,B as x,Bi as S,Bn as C,Br as w,Bt as T,C as E,Ca as D,Ci as O,Cn as k,Cr as A,Ct as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Dt as L,E as R,Ea as z,Ei as B,En as V,Er as H,Et as U,F as W,Fi as G,Fn as K,Fr as q,Ft as J,G as Y,Gi as X,Gn as Z,Gr as Q,Gt as $,H as ee,Hi as te,Hn as ne,Hr as re,Ht as ie,I as ae,Ii as oe,In as se,Ir as ce,It as le,J as ue,Ji as de,Jn as fe,Jr as pe,Jt as me,K as he,Ki as ge,Kn as _e,Kr as ve,Kt as ye,L as be,Li as xe,Ln as Se,Lr as Ce,Lt as we,M as Te,Ma as Ee,Mi as De,Mn as Oe,Mt as ke,N as Ae,Ni as je,Nn as Me,Nr as Ne,Nt as Pe,O as Fe,Oa as Ie,Oi as Le,On as Re,Ot as ze,P as Be,Pi as Ve,Pn as He,Pr as Ue,Pt as We,Q as Ge,Qi as Ke,Qn as qe,Qr as Je,Qt as Ye,R as Xe,Ri as Ze,Rn as Qe,Rr as $e,Rt as et,S as tt,Sa as nt,Si as rt,Sn as it,Sr as at,St as ot,T as st,Ta as ct,Ti as lt,Tn as ut,Tr as dt,Tt as ft,U as pt,Ui as mt,Un as ht,Ur as gt,Ut as _t,V as vt,Vi as yt,Vn as bt,Vr as xt,Vt as St,W as Ct,Wi as wt,Wn as Tt,Wr as Et,Wt as Dt,X as Ot,Xi as kt,Xn as At,Xr as jt,Xt as Mt,Y as Nt,Yi as Pt,Yn as Ft,Yr as It,Yt as Lt,Z as Rt,Zi as zt,Zn as Bt,Zr as Vt,Zt as Ht,_ as Ut,_a as Wt,_i as Gt,_n as Kt,_r as qt,a as Jt,aa as Yt,ai as Xt,an as Zt,ar as Qt,at as $t,b as en,ba as tn,bi as nn,bn as rn,br as an,bt as on,c as sn,ca as cn,ci as ln,cn as un,cr as dn,ct as fn,d as pn,da as mn,di as hn,dn as gn,dr as _n,dt as vn,ea as yn,ei as bn,en as xn,er as Sn,et as Cn,f as wn,fa as Tn,fi as En,fn as Dn,fr as On,ft as kn,g as An,ga as jn,gi as Mn,gn as Nn,gr as Pn,h as Fn,ha as In,hi as Ln,hn as Rn,hr as zn,i as Bn,ia as Vn,ii as Hn,in as Un,ir as Wn,it as Gn,j as Kn,ja as qn,ji as Jn,jn as Yn,jt as Xn,k as Zn,ka as Qn,ki as $n,kn as er,kt as tr,l as nr,la as rr,li as ir,ln as ar,lr as or,lt as sr,m as cr,ma as lr,mi as ur,mn as dr,mr as fr,n as pr,na as mr,ni as hr,nn as gr,nr as _r,nt as vr,o as yr,oa as br,oi as xr,on as Sr,or as Cr,ot as wr,p as Tr,pa as Er,pi as Dr,pn as Or,pr as kr,q as Ar,qi as jr,qn as Mr,qr as Nr,qt as Pr,r as Fr,ra as Ir,ri as Lr,rn as Rr,rr as zr,rt as Br,s as Vr,sa as Hr,si as Ur,sn as Wr,sr as Gr,st as Kr,t as qr,ta as Jr,ti as Yr,tn as Xr,tr as Zr,tt as Qr,u as $r,ua as ei,ui as ti,un as ni,ur as ri,ut as ii,v as ai,va as oi,vi as si,vn as ci,vr as li,w as ui,wa as di,wi as fi,wn as pi,wr as mi,wt as hi,x as gi,xa as _i,xn as vi,xr as yi,xt as bi,y as xi,ya as Si,yi as Ci,yn as wi,yr as Ti,yt as Ei,z as Di,zi as Oi,zn as ki,zr as Ai,zt as ji}from"./src-bhsVUHJJ.mjs";import{C as Mi,E as Ni,T as Pi,_ as Fi,b as Ii,c as Li,d as Ri,g as zi,i as Bi,l as Vi,m as Hi,n as Ui,p as Wi,s as Gi,t as Ki,u as qi,v as Ji,w as Yi,x as Xi,y as Zi}from"./fs-traced-Dm4NQ6S5.mjs";import{a as Qi,d as $i,f as ea,i as ta,l as na,n as ra,r as ia,t as aa,u as oa}from"./logger-Dq-cRhcP.mjs";import{C as sa,S as ca,_ as la,a as ua,b as da,c as fa,d as pa,f as ma,g as ha,h as ga,i as _a,l as va,m as ya,n as ba,o as xa,p as Sa,r as Ca,s as wa,t as Ta,u as Ea,x as Da}from"./server-lock-C0j1Yr_I.mjs";export{D as AGENT_ID_MAX_LEN,di as AGENT_ID_RE,Oi as AGENT_WRITE_ORIGIN,_ as AcpPermissionStore,N as AcpRegistry,lt as AcpThreadManager,O as AgentFocusBroadcaster,rt as AgentPresenceBroadcaster,S as AgentSessionCapacityError,yt as AgentSessionManager,on as AutoStartDisabledError,Ln as BUNDLE_IDS,Mn as BUNDLE_SCOPE,Gt as BUNDLE_SKILL_NAME,Bt as BacklinkIndex,zt as CC1Broadcaster,n as CC1_CONTRACT_VERSION,Wr as CONFIG_FILENAME,Z as CONFLICT_MARKER_RE,q as CURSOR_BUNDLE_PATHS_BY_PLATFORM,xi as ConfigSchema,Ir as DEFAULT_CHECKPOINT_RETENTION,m as DEFAULT_EMBEDDINGS_DIMENSIONS,T as DEFAULT_PACK_ID,Ct as DocumentDurabilityState,bn as EMBEDDINGS_API_KEY_ENV,qr as EPHEMERAL_PROJECT_DIR_PREFIX,wi as ExposureConsentError,Ie as FEATURED_AGENT_IDS,Vn as FILE_SYSTEM_WRITER,Ft as FILE_WATCHER_ORIGIN,Nr as FileEmbeddingsBackend,gr as GIT_PREFLIGHT_FAIL_SPAN_NAME,Yt as GIT_UPSTREAM_WRITER,qn as GitDirAccessError,v as GitNotAvailableError,Jn as GitTooOldError,bi as HOCUSPOCUS_AUTH_REJECTION_REASONS,ot as HocuspocusAuthRejection,j as HocuspocusAuthTokenSchema,Rn as HomeProjectRootError,xt as INSTALLED_AGENTS_SCHEMES,vn as JSON_SCHEMA_DIALECT_2020_12,r as LINEAGE_EPOCH_KEY,vt as LIVE_DERIVED_INDEX_DEBOUNCE_MS,St as LOG_MD_TEMPLATE,b as MANAGED_RENAME_ORIGIN,B as MAX_ACP_THREADS,te as MAX_AGENT_SESSIONS,Le as MCP_CONNECTION_ID_HEADER,c as MCP_SERVER_NAME,mt as MIN_EVICTABLE_IDLE_MS,De as MIN_GIT_VERSION,Y as MISSING_OK_CONFIG_MESSAGE,Ee as MalformedGitPointerError,Br as McpLogger,he as MissingOkConfigError,X as OBSERVER_SYNC_ORIGIN,un as OK_OKIGNORE_TEMPLATE,si as ONBOARDING_BUNDLE_IDS,e as ORPHAN_MODES,a as PROTOCOL_VERSION,aa as PinoLogger,va as ProcessLockCollisionError,pn as ProjectGitInitError,Xn as ROLLBACK_ORIGIN,ar as ROOT_GITIGNORE_TEMPLATE,da as RUNTIME_VERSION,br as SERVICE_WRITER,kr as SKILL_INSTALL_EVENTS_FILE_REL,o as SKILL_STATE_TARGETS,ie as STARTER_FOLDERS,_t as STARTER_FOLDER_FRONTMATTER_FILENAME,Dt as STARTER_PACKS,$ as STARTER_PACK_IDS,ye as STARTER_TEMPLATES,Fe as STATE_MANIFEST_FILENAME,Da as STATE_SCHEMA_VERSION,s as SYSTEM_DOC_NAME,Ye as SeedPrerequisiteError,h as SeedRootDirError,Ta as ServerLockCollisionError,pr as SingleFileNotAFileError,Fr as SingleFileNotFoundError,Bn as SingleFileNotMarkdownError,Zn as StateManifestError,At as TagIndex,Ci as USER_GLOBAL_BUNDLE_IDS,ke as __getShowAllWalkStatsForTesting,Pe as __resetShowAllWalkStatsForTesting,Ea as acquireProcessLock,ba as acquireServerLock,wt as applyAgentMarkdownWrite,ht as applyExternalChange,ji as applySeed,g as assertCompatibleStateManifest,je as assertGitAvailable,Yn as assertNeverDiskEvent,Nn as assertNotHomeProjectRoot,fi as attachAcpThreadSocket,Ei as attachIdleShutdown,en as bootServer,p as buildAndOpenSkill,ni as buildConfigYmlContent,Ge as buildExecResult,rn as buildIngressPolicy,P as buildOkMcpStdioCommand,En as buildSkillZip,Pr as buildStarterFolderFrontmatterYaml,Hr as buildWipTree,nn as bundleSkillMdPath,pe as canonicalProjectKey,Kt as canonicalizeForCompare,Oe as classifyEvents,Ki as classifyFsPath,It as clearAllEmbeddingsKeys,hr as clearContributors,me as coercePackId,u as colorFromSeed,cn as commitUpstreamImport,rr as commitWip,ei as commitWipFromTree,Ve as compareSemver,an as composeEffectiveLinterConfig,yi as composeFrontmatterSchemasConfig,_e as containsConflictMarkers,Me as contentHash,Lr as contributorCount,be as countShadowObjects,Xe as countStaleAgentWipRefs,Di as countWipRefs,We as createApiExtension,tr as createAssetServeMiddleware,ue as createCollaborationHost,Ne as createContentFilter,Ue as createContentFilterAsync,jt as createEmbeddingsSecretStore,Jt as createEphemeralProjectDir,Tt as createExternalChangeHandler,cr as createFileLogger,ee as createLiveDerivedIndexExtension,Ot as createMcpHttpHandler,re as createOsProbe,ae as createPersistenceExtension,st as createServer,Be as createServerObserverExtension,de as createStreamingErrorWriter,ra as createTestLogger,Vt as describeStoredEmbeddingsKey,ai as detectClaudeDesktopPresence,G as detectGit,Kn as detectProjectShape,Sn as detectUserSkillHosts,wr as discoverLockDirs,mi as discoverMarkdownlintConfig,Rr as emitPreflightFailureSpan,d as encodeDocName,Cn as encodeFolderRoute,Qr as encodeSkillRoute,wn as ensureProjectGit,gn as ensureProjectSkillGitignore,Pt as errorResponse,He as evictStaleTrackerEntries,J as extractHeadings,Kr as extractOkBinaryPath,qe as extractWikiLinksFromMarkdown,oe as fallbackPaths,Tr as findEnclosingGitRoot,er as findEnclosingProjectRoot,dt as findNativeMarkdownlintFile,Fn as flushFileLogger,hi as formatAuthRejectionWire,Hn as formatContributors,Xt as formatContributorsFrom,we as formatPackRationale,mn as gcCheckpointRefs,Gn as getCurrentMcpLogger,vi as getIngressContext,ir as getLocalDir,An as getLogFilePath,ia as getLogger,Ut as getLogsDir,la as getMachineId,Zi as getMeter,oi as getMetrics,Ii as getTracer,Si as handleCollabSocketError,ce as handleSpawnCursor,it as hasForwardingHeaders,x as hasGcLogLatch,l as iconFromClientName,tn as incrementCollabSocketFilteredError,_i as incrementServerObserverFire,Dn as initContent,Tn as initShadowRepo,Xi as initTelemetry,tt as initToleranceTelemetryWriter,kn as installJsonSchemaDialect,ii as installPrettyZodErrors,ta as installTestLoggers,Zr as installUserSkill,Re as isAllowedApiOrigin,V as isAllowedWorkspaceHostHeader,Ke as isConfigDoc,ft as isHocuspocusAuthRejectionReason,ci as isHomeDir,k as isHostAdmitted,Lt as isKnownPackId,f as isLinkIndexExcludedDoc,F as isLoopbackAddress,yn as isManagedArtifactDoc,pi as isOriginAdmitted,i as isOrphanMode,ge as isPairedWriteOrigin,Ce as isPathWithinDir,ut as isPeerAdmitted,ca as isProcessAlive,y as isProjectRoot,Jr as isReservedForUserTree,K as isSelfWrite,mr as isSystemDoc,E as isToleranceTelemetryEnabled,sa as isValidLockPid,se as lastKnownHash,Er as listRescueCheckpoints,Mt as listStarterPacks,Qn as loadCustomAgents,W as loadPrincipal,Ca as lockAdvertisesUi,pa as lockBaseUrl,ma as lockFilePath,Qi as loggerFactory,Pn as loginShapedUserinfoUser,na as logsCurrentPath,oa as logsPreviousPath,Je as makeLazyEmbeddingsKeyStore,_a as markServerLockDraining,Ar as mountMcpAndApi,Ui as normalizeFsPath,qt as originGitHubHost,Or as packageVersionMajorMinor,U as parseAuthRejectionWire,xe as parseGitVersion,L as parseHocuspocusAuthToken,Nt as parseKeepaliveConnectionId,Se as pathToDocName,et as planSeed,yr as prepareSingleFileOpen,fn as processCommand,sr as processUsage,Wn as readAllTargets,Qt as readBundleDecision,H as readOwnNativeRules,Sa as readProcessLock,ya as readProcessLockDetailed,pt as readProjectHeadState,ve as readProjectLocalSemanticConfig,ua as readServerLock,Cr as readServerPackageVersion,Gr as readSkillInstallStateSnapshot,Te as readStateManifest,dn as readTargetRecordedAt,or as readTargetVersion,Mr as reconcile,xr as recordContributor,fr as recordSkillInstallEvent,zn as redactShareSubprocessStderr,Rt as registerAllTools,Qe as registerWrite,ga as releaseProcessLock,xa as releaseServerLock,ki as removeLastKnownHash,zr as reportSkillInstall,nt as resetMetrics,_r as resolveBuiltinSkillHosts,t as resolveBundleEnabled,Dr as resolveBundledSkillDir,ti as resolveContentDir,$e as resolveCursorBinaryDefault,Ai as resolveCursorSpawnInvocation,at as resolveEffectiveLinterConfig,Yr as resolveEmbeddingsCredential,M as resolveGitHubAccountFromUrl,hn as resolveLockDir,A as resolveNativeConfigForDoc,I as resolveNativeMarkdownlintConfig,Ht as resolvePack,nr as resolvePackageVersion,On as resolveSkillInstallReportSettings,vr as resolveUiInfo,Ur as restoreContributors,gi as restoreLifecycleFromConflictsJson,Et as rewriteMarkdownLinksForDocumentRename,Q as rewriteWikiLinksForDocumentRename,Un as runAuthReposSubprocess,Zt as runAuthStatusSubprocess,xn as runCloneSubprocess,Sr as runDeviceFlowSubprocess,$t as runWithMcpLogger,gt as safeContentPath,le as safeSubdir,lr as safetyCheckpoint,li as sameGitHubLogin,$n as sanitizeClientName,In as saveInMemoryCheckpoint,jn as saveVersion,ze as seedBasenameIndex,Vr as seedEphemeralProjectDir,sn as serializeError,Mi as setActiveSpanAttributes,jr as setupServerObservers,Wt as shadowGit,Yi as shutdownTelemetry,$i as spansCurrentPath,ea as spansPreviousPath,w as spawnDetached,fe as splitMarkdownBlocks,C as startWatcher,kt as streamingProblemEvent,ln as swapContributors,ui as teardownToleranceTelemetryWriter,ct as toBroadcasterKey,Bi as tracedAppendFileSync,Gi as tracedLinkSync,Li as tracedMkdir,Vi as tracedMkdirSync,qi as tracedRename,Ri as tracedRenameSync,Wi as tracedRmSync,Hi as tracedRmdirSync,zi as tracedUnlinkSync,Fi as tracedWriteFile,Ji as tracedWriteFileSync,R as trustSystemCertificates,$r as untrackTrackedProjectSkillProjection,bt as updateLastKnownHash,ha as updateProcessLockPort,wa as updateServerLockPort,z as validateAgentId,Xr as validateCloneInputs,ur as validateSkillZip,fa as waitForServerLockDrain,Ze as withHiddenWindowsConsole,Pi as withSpan,Ni as withSpanSync,ri as writeBundleDecision,Ti as writeMarkdownlintRule,dr as writeRootGitignoreForNewRepo,Ae as writeStateManifest,_n as writeTargetVersion,ne as writeTracker};
|