@inkeep/open-knowledge 0.6.0-beta.2 → 0.6.0-beta.21
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/THIRD_PARTY_NOTICES.md +36 -1
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +52 -20
- package/dist/cli.mjs +41 -41
- package/dist/config-schema.json +20 -0
- package/dist/config.project.schema.json +20 -0
- package/dist/constants-BkjoNZLk.mjs +2 -0
- package/dist/dist-BJWJRYPN.mjs +1 -0
- package/dist/{dist-soQLoIV1.mjs → dist-DRLITAOV.mjs} +65 -55
- package/dist/{git-handle-DwfYp_z--CfyPz4Dz.mjs → git-handle-CjyGVy33-CK0dYQ8y.mjs} +2 -2
- package/dist/git-handle-CjyGVy33-DVACqhWk.mjs +1 -0
- package/dist/index.d.mts +15 -9
- package/dist/index.mjs +1 -1
- package/dist/init-Dfka2b6b.mjs +1 -0
- package/dist/{init-DjF_or_S.mjs → init-ODP7H2_D.mjs} +10 -10
- package/dist/loader-BlZXyEZs.mjs +1 -0
- package/dist/{loader-D39G1Qj8.mjs → loader-WypjL6D-.mjs} +3 -3
- package/dist/preview-CjUoxpAO.mjs +1 -0
- package/dist/{preview-BrADtCN4.mjs → preview-DLoNOk0M.mjs} +2 -2
- package/dist/public/assets/ActivityModeContent-CgPfEhMS.js +2 -0
- package/dist/public/assets/ActivityPanelDiffView-LNHry3BJ.js +13 -0
- package/dist/public/assets/ConsentDialogBody-CImrdpFX.js +2 -0
- package/dist/public/assets/DocumentContext-DCEXS67b.js +52 -0
- package/dist/public/assets/GraphPanel-mQmRhod_.js +46 -0
- package/dist/public/assets/{McpConsentDialogBody-Dw8kQ_BH.js → McpConsentDialogBody-Bh3i0mQ8.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-25y-yVAm.js +7 -0
- package/dist/public/assets/SourceEditor-D4uMes9S.js +2 -0
- package/dist/public/assets/{agent-presence-DUe_PdKt.js → agent-presence-DxGcS3q2.js} +1 -1
- package/dist/public/assets/{architectureDiagram-Q4EWVU46-C4pUyyy6.js → architectureDiagram-Q4EWVU46-CIVh0TLx.js} +1 -1
- package/dist/public/assets/{blockDiagram-DXYQGD6D-VkwkYpUF.js → blockDiagram-DXYQGD6D-Cg-UHasz.js} +1 -1
- package/dist/public/assets/button-DenIdY-r.js +1 -0
- package/dist/public/assets/{c4Diagram-AHTNJAMY-uR85wHTj.js → c4Diagram-AHTNJAMY-KFeHAAOO.js} +1 -1
- package/dist/public/assets/channel-BqqURnVG.js +1 -0
- package/dist/public/assets/checkbox-BGXb5iL3.js +1 -0
- package/dist/public/assets/{chunk-336JU56O-CcUNcCyG.js → chunk-336JU56O-DHqaXNrn.js} +2 -2
- package/dist/public/assets/{chunk-426QAEUC-D-Drhg6m.js → chunk-426QAEUC-CuPmuy8t.js} +1 -1
- package/dist/public/assets/{chunk-4TB4RGXK-DylOpICA.js → chunk-4TB4RGXK-QLafKs7A.js} +1 -1
- package/dist/public/assets/{chunk-5FUZZQ4R-COpN1802.js → chunk-5FUZZQ4R-DoG5zk7O.js} +1 -1
- package/dist/public/assets/{chunk-5PVQY5BW-SLEOUaCC.js → chunk-5PVQY5BW--zDnbXdQ.js} +1 -1
- package/dist/public/assets/{chunk-EDXVE4YY-Cr4fB83o.js → chunk-EDXVE4YY-BfT15Ufb.js} +1 -1
- package/dist/public/assets/{chunk-ENJZ2VHE-jO5Yn0Ti.js → chunk-ENJZ2VHE-DEtEhITq.js} +1 -1
- package/dist/public/assets/{chunk-ICPOFSXX-DO-wz1LJ.js → chunk-ICPOFSXX-C8AElYY_.js} +1 -1
- package/dist/public/assets/{chunk-OYMX7WX6-DlOfgU2U.js → chunk-OYMX7WX6-CX3nrwxJ.js} +1 -1
- package/dist/public/assets/{chunk-U2HBQHQK-fFQ_IUwS.js → chunk-U2HBQHQK-CfAyyLJz.js} +1 -1
- package/dist/public/assets/{chunk-X2U36JSP-JbIA9pf5.js → chunk-X2U36JSP-CmACymAN.js} +1 -1
- package/dist/public/assets/{chunk-YZCP3GAM-Cx9wuApW.js → chunk-YZCP3GAM-CiWxV9XS.js} +1 -1
- package/dist/public/assets/{chunk-ZZ45TVLE-CdiDiZYV.js → chunk-ZZ45TVLE-B7t5_MqN.js} +1 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-DrN_pUa5.js +1 -0
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-C1MJ1Ukt.js +1 -0
- package/dist/public/assets/clone-CecJCxEU.js +1 -0
- package/dist/public/assets/{collapsible-DfUFsfqv.js → collapsible-BhpeB6tu.js} +1 -1
- package/dist/public/assets/compiler-runtime-Cs91PcD2.js +1 -0
- package/dist/public/assets/config-validation-events-BinSH1WI.js +11 -0
- package/dist/public/assets/{dagre-D0NgAcgy.js → dagre-BuFRtOcC.js} +1 -1
- package/dist/public/assets/{dagre-KV5264BT-D00jhTEj.js → dagre-KV5264BT-BpBW6R71.js} +1 -1
- package/dist/public/assets/{diagram-5BDNPKRD-53lAVvrc.js → diagram-5BDNPKRD-B5phtkJp.js} +1 -1
- package/dist/public/assets/{diagram-G4DWMVQ6-DvnMPxCL.js → diagram-G4DWMVQ6-tjReW6yx.js} +1 -1
- package/dist/public/assets/{diagram-MMDJMWI5-bSOxNuvv.js → diagram-MMDJMWI5-b4CgKryF.js} +1 -1
- package/dist/public/assets/{diagram-TYMM5635-ftQ9f3sM.js → diagram-TYMM5635-D5B0g2lj.js} +1 -1
- package/dist/public/assets/dialog-CoRJrIIb.js +45 -0
- package/dist/public/assets/{dist-BUk_vKk2.js → dist-CadHdAvi.js} +1 -1
- package/dist/public/assets/{dist-SeK3HGs7.js → dist-CdAufVHw.js} +1 -1
- package/dist/public/assets/{dist-DiQSHtaM.js → dist-Cwt7KtW7.js} +1 -1
- package/dist/public/assets/{dist-CruwjFAC.js → dist-DRBAXDc3.js} +1 -1
- package/dist/public/assets/{dist-semR8ZB_.js → dist-DkR43q3h.js} +1 -1
- package/dist/public/assets/{dist-DNQ2xKmK.js → dist-sw9fzKjM.js} +1 -1
- package/dist/public/assets/{dist-C8kKU7Ya.js → dist-y5PvfJVO.js} +1 -1
- package/dist/public/assets/{erDiagram-SMLLAGMA-B1J-oh72.js → erDiagram-SMLLAGMA-CRJz10Jv.js} +1 -1
- package/dist/public/assets/{flowDiagram-DWJPFMVM-lLrSyhC0.js → flowDiagram-DWJPFMVM-BDCJTgJ7.js} +1 -1
- package/dist/public/assets/{ganttDiagram-T4ZO3ILL-CUjectuq.js → ganttDiagram-T4ZO3ILL-cPQKlGYc.js} +1 -1
- package/dist/public/assets/{gitGraphDiagram-UUTBAWPF-vFBdpaIg.js → gitGraphDiagram-UUTBAWPF-BMyjc352.js} +1 -1
- package/dist/public/assets/{graphlib-C3wGX8GR.js → graphlib-BU8FnRz1.js} +1 -1
- package/dist/public/assets/index-CYbQDyZm.css +1 -0
- package/dist/public/assets/index-D7awTFRW.js +1915 -0
- package/dist/public/assets/{infoDiagram-42DDH7IO-p5UnX5VQ.js → infoDiagram-42DDH7IO-BZ6v5y-j.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-UXIWVN3A-Dc_uLtDG.js → ishikawaDiagram-UXIWVN3A-DA7_P2Up.js} +1 -1
- package/dist/public/assets/{journeyDiagram-VCZTEJTY-D-OWzt5X.js → journeyDiagram-VCZTEJTY-CzZoB161.js} +1 -1
- package/dist/public/assets/{kanban-definition-6JOO6SKY-Dg3mF5uv.js → kanban-definition-6JOO6SKY-DKg7pXv1.js} +1 -1
- package/dist/public/assets/{label-Bdsqm1CY.js → label-DCMZaJ38.js} +1 -1
- package/dist/public/assets/{line-Blj6fR0j.js → line-DGc-MCyQ.js} +1 -1
- package/dist/public/assets/{mermaid.core-DKgSmEOt.js → mermaid.core-DRx0wZe0.js} +3 -3
- package/dist/public/assets/{mindmap-definition-QFDTVHPH-CzdOizWD.js → mindmap-definition-QFDTVHPH-C9GRZxO6.js} +1 -1
- package/dist/public/assets/{panel-CxlToFCs.js → panel-BNBODYwB.js} +1 -1
- package/dist/public/assets/{pieDiagram-DEJITSTG-CCKPY52f.js → pieDiagram-DEJITSTG-L6I3ft9Z.js} +1 -1
- package/dist/public/assets/{doc-hash-BrKkCdCz.js → prop-types-BEbeSvI1.js} +157 -147
- package/dist/public/assets/{propagation-api-CobBjsTC.js → propagation-api-3kmMXRwS.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-34T5L4WZ-7k7hUHeX.js → quadrantDiagram-34T5L4WZ-Dp2IeEPC.js} +1 -1
- package/dist/public/assets/{requirementDiagram-MS252O5E-DtBI2UGc.js → requirementDiagram-MS252O5E-BxNWyIZg.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-XADWPNL6-CsyAV-jZ.js → sankeyDiagram-XADWPNL6-CRn0_xkw.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-FGHM5R23-BVVas0PB.js → sequenceDiagram-FGHM5R23-Drkjb1j4.js} +1 -1
- package/dist/public/assets/{stateDiagram-FHFEXIEX-DSU8iqSJ.js → stateDiagram-FHFEXIEX-BBUFKS0u.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-BtYsWsIg.js +1 -0
- package/dist/public/assets/target-navigation-intent-B6yRgiCk.js +1 -0
- package/dist/public/assets/{telemetry-impl-BiWd9bHi.js → telemetry-impl-DPRMO_b_.js} +1 -1
- package/dist/public/assets/{textarea-CQGiqhkV.js → textarea-C_bHQrXh.js} +1 -1
- package/dist/public/assets/{timeline-definition-GMOUNBTQ-Cz06Vse0.js → timeline-definition-GMOUNBTQ-CLoe9y-z.js} +1 -1
- package/dist/public/assets/toggle-group-Llc9I0Vm.js +1 -0
- package/dist/public/assets/typing-burst-detector-DbcZJAdl.js +2 -0
- package/dist/public/assets/{vennDiagram-DHZGUBPP-Cf-DwVPO.js → vennDiagram-DHZGUBPP-q2zdiy4F.js} +1 -1
- package/dist/public/assets/{wardleyDiagram-NUSXRM2D-CYXaSU9R.js → wardleyDiagram-NUSXRM2D-Njg6YHso.js} +1 -1
- package/dist/public/assets/{xychartDiagram-5P7HB3ND-Czjmctj-.js → xychartDiagram-5P7HB3ND-Ct8Wgp45.js} +1 -1
- package/dist/public/index.html +28 -28
- package/dist/{repair-launch-json-BbKHWVwS.mjs → repair-launch-json-55ssuDzZ.mjs} +2 -2
- package/dist/{repair-mcp-configs-DwbKFYJm.mjs → repair-mcp-configs-CIvcZke3.mjs} +2 -2
- package/dist/schemas/v0/config.project.schema.json +20 -0
- package/dist/{server-lock-D7DXNVql-BRVVzA6T.mjs → server-lock-BniQ3qki-CadPGoZN.mjs} +1 -1
- package/dist/server-lock-BniQ3qki-DjKtnzVr.mjs +1 -0
- package/dist/src-BtjvV77A.mjs +2 -0
- package/dist/start-BndZl5gJ.mjs +1 -0
- package/dist/{start-DZJdwuup.mjs → start-DHqoq5kh.mjs} +2 -2
- package/package.json +2 -2
- package/dist/constants-xZa5P4wL.mjs +0 -2
- package/dist/dist-7_PKsuCz.mjs +0 -1
- package/dist/git-handle-DwfYp_z--DreW3fNC.mjs +0 -1
- package/dist/init-CFkaUfzc.mjs +0 -1
- package/dist/loader-Bmw95q2S.mjs +0 -1
- package/dist/preview-COcwGoDu.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-nwB2ciii.js +0 -2
- package/dist/public/assets/ActivityPanelDiffView-d4ec9M69.js +0 -13
- package/dist/public/assets/ConsentDialogBody-BncX7dD1.js +0 -2
- package/dist/public/assets/DocumentContext-Bc83ypCd.js +0 -52
- package/dist/public/assets/GraphPanel-DwHnIo6r.js +0 -46
- package/dist/public/assets/SettingsDialogBody-o-ExGcAl.js +0 -11
- package/dist/public/assets/SourceEditor-DF322IKX.js +0 -2
- package/dist/public/assets/button-JrGyO3-P.js +0 -1
- package/dist/public/assets/channel-DtU-CCDV.js +0 -1
- package/dist/public/assets/checkbox-CTrUepCv.js +0 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-BZpd1T4J.js +0 -1
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-C6GyLa0q.js +0 -1
- package/dist/public/assets/clone-CvvNDZ2x.js +0 -1
- package/dist/public/assets/compiler-runtime-CVnuRdak.js +0 -1
- package/dist/public/assets/config-validation-events-BCNaZEDf.js +0 -10
- package/dist/public/assets/dialog-bA5Nvc2p.js +0 -45
- package/dist/public/assets/index-Bzs40SFf.css +0 -1
- package/dist/public/assets/index-zU1ANKhn.js +0 -1928
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-B8ew63Gv.js +0 -1
- package/dist/public/assets/target-navigation-intent-B5Xuyiwx.js +0 -1
- package/dist/public/assets/toggle-group-Cimrwku9.js +0 -1
- package/dist/public/assets/typing-burst-detector-ByUXt_f8.js +0 -2
- package/dist/server-lock-D7DXNVql-B5nINglj.mjs +0 -1
- package/dist/src-C9SFj148.mjs +0 -2
- package/dist/start-BYnDVYJN.mjs +0 -1
- /package/dist/public/assets/{katex-qwlL5fSd.js → katex-DX-tM4Fr.js} +0 -0
- /package/dist/public/assets/{mcp-consent-store-BPw6Zd40.js → mcp-consent-store-19Boxoxe.js} +0 -0
- /package/dist/public/assets/{project-paths-DKT5BePl.js → project-paths-eyh51nmQ.js} +0 -0
- /package/dist/public/assets/{stex-ChE_gMQ6.js → stex-DxnLy7rA.js} +0 -0
- /package/dist/public/assets/{trace-api-3dczfLSc.js → trace-api-CiCjX4Sz.js} +0 -0
- /package/dist/public/assets/{w3c-keyname-BSTW6KzM.js → w3c-keyname-B5t0fahT.js} +0 -0
|
@@ -6,5 +6,5 @@ import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{t as r}from"./roll
|
|
|
6
6
|
`){return e.split(n).reduce((e,n)=>{let r=t?n.trim():n;return r&&e.push(r),e},[])}function rt(e,t){return A(e,!0).map(e=>t(e))}function it(e){return(0,He.exists)(e,He.FOLDER)}function j(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function at(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function ot(e,t){if(Array.isArray(e)){let n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function M(e){return Array.isArray(e)?e:[e]}function st(e){return e.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function N(e){return M(e).map(e=>e instanceof String?e:String(e))}function P(e,t=0){if(e==null)return t;let n=parseInt(e,10);return Number.isNaN(n)?t:n}function F(e,t){let n=[];for(let r=0,i=e.length;r<i;r++)n.push(t,e[r]);return n}function I(e){return(Array.isArray(e)?Buffer.concat(e):e).toString(`utf-8`)}function ct(e,t){let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function lt(e=0){return new Promise(t=>setTimeout(t,e))}function ut(e){if(e!==!1)return e}var L,R,z,dt=S({"src/lib/utils/util.ts"(){yt(),L=`\0`,R=()=>{},z=Object.prototype.toString.call.bind(Object.prototype.toString)}});function B(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function ft(e,t){let n=h(e)?`string`:typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function pt(e){return!!e&&z(e)===`[object Object]`}function mt(e){return typeof e==`function`}var ht,gt,V,_t,vt,yt=S({"src/lib/utils/argument-filters.ts"(){dt(),ht=e=>Array.isArray(e),gt=e=>typeof e==`number`,V=e=>typeof e==`string`||h(e),_t=e=>V(e)||Array.isArray(e)&&e.every(V),vt=e=>e==null||`number|boolean|function`.includes(typeof e)?!1:typeof e.length==`number`}}),bt,xt=S({"src/lib/utils/exit-codes.ts"(){bt=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e[e.ERROR=1]=`ERROR`,e[e.NOT_FOUND=-2]=`NOT_FOUND`,e[e.UNCLEAN=128]=`UNCLEAN`,e))(bt||{})}}),St,Ct=S({"src/lib/utils/git-output-streams.ts"(){St=class e{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new e(this.stdOut.toString(`utf8`),this.stdErr.toString(`utf8`))}}}});function wt(){throw Error(`LineParser:useMatches not implemented`)}var H,U,Tt=S({"src/lib/utils/line-parser.ts"(){H=class{constructor(e,t){this.matches=[],this.useMatches=wt,this.parse=(e,t)=>(this.resetMatches(),this._regExp.every((t,n)=>this.addMatch(t,n,e(n)))?this.useMatches(t,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let r=n&&e.exec(n);return r&&this.pushMatch(t,r),!!r}pushMatch(e,t){this.matches.push(...t.slice(1))}},U=class extends H{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function Et(...e){let t=process.cwd(),n=Object.assign({baseDir:t,...Dt},...e.filter(e=>typeof e==`object`&&e));return n.baseDir=n.baseDir||t,n.trimmed=n.trimmed===!0,n}var Dt,Ot=S({"src/lib/utils/simple-git-options.ts"(){Dt={binary:`git`,maxConcurrentProcesses:5,config:[],trimmed:!1}}});function kt(e,t=[]){return pt(e)?Object.keys(e).reduce((t,n)=>{let r=e[n];if(h(r))t.push(r);else if(ft(r,[`boolean`]))t.push(n+`=`+r);else if(Array.isArray(r))for(let e of r)ft(e,[`string`,`number`])||t.push(n+`=`+e);else t.push(n);return t},t):t}function W(e,t=0,n=!1){let r=[];for(let n=0,i=t<0?e.length:t;n<i;n++)`string|number`.includes(typeof e[n])&&r.push(String(e[n]));return kt(jt(e),r),n||r.push(...At(e)),r}function At(e){return N(B(k(e,typeof k(e)==`function`?1:0),ht,[]))}function jt(e){return B(k(e,mt(k(e))?1:0),pt)}function G(e,t=!0){let n=Qe(k(e));return t||$e(n)?n:void 0}var Mt=S({"src/lib/utils/task-options.ts"(){yt(),dt()}});function Nt(e,t){return e(t.stdOut,t.stdErr)}function K(e,t,n,r=!0){return M(n).forEach(n=>{for(let i=A(n,r),a=0,o=i.length;a<o;a++){let n=(e=0)=>{if(!(a+e>=o))return i[a+e]};t.some(({parse:t})=>t(n,e))}}),e}var Pt=S({"src/lib/utils/task-parser.ts"(){dt()}}),Ft={};C(Ft,{ExitCodes:()=>bt,GitOutputStreams:()=>St,LineParser:()=>H,NOOP:()=>R,NULL:()=>L,RemoteLineParser:()=>U,append:()=>j,appendTaskOptions:()=>kt,asArray:()=>M,asCamelCase:()=>st,asFunction:()=>Qe,asNumber:()=>P,asStringArray:()=>N,bufferToString:()=>I,callTaskParser:()=>Nt,createInstanceConfig:()=>Et,delay:()=>lt,filterArray:()=>ht,filterFunction:()=>mt,filterHasLength:()=>vt,filterNumber:()=>gt,filterPlainObject:()=>pt,filterPrimitives:()=>ft,filterString:()=>V,filterStringOrStringArray:()=>_t,filterType:()=>B,first:()=>tt,folderExists:()=>it,forEachLineWithContent:()=>rt,getTrailingOptions:()=>W,including:()=>at,isUserFunction:()=>$e,last:()=>k,objectToString:()=>z,orVoid:()=>ut,parseStringResponse:()=>K,pick:()=>ct,prefixedArray:()=>F,remove:()=>ot,splitOn:()=>et,toLinesWithContent:()=>A,trailingFunctionArgument:()=>G,trailingOptionsArgument:()=>jt});var q=S({"src/lib/utils/index.ts"(){yt(),xt(),Ct(),Tt(),Ot(),Mt(),Pt(),dt()}}),It={};C(It,{CheckRepoActions:()=>Vt,checkIsBareRepoTask:()=>zt,checkIsRepoRootTask:()=>Rt,checkIsRepoTask:()=>Lt});function Lt(e){switch(e){case`bare`:return zt();case`root`:return Rt()}return{commands:[`rev-parse`,`--is-inside-work-tree`],format:`utf-8`,onError:Ht,parser:Ut}}function Rt(){return{commands:[`rev-parse`,`--git-dir`],format:`utf-8`,onError:Ht,parser(e){return/^\.(git)?$/.test(e.trim())}}}function zt(){return{commands:[`rev-parse`,`--is-bare-repository`],format:`utf-8`,onError:Ht,parser:Ut}}function Bt(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var Vt,Ht,Ut,Wt=S({"src/lib/tasks/check-is-repo.ts"(){q(),Vt=(e=>(e.BARE=`bare`,e.IN_TREE=`tree`,e.IS_REPO_ROOT=`root`,e))(Vt||{}),Ht=({exitCode:e},t,n,r)=>{if(e===128&&Bt(t))return n(Buffer.from(`false`));r(t)},Ut=e=>e.trim()===`true`}});function Gt(e,t){let n=new Kt(e),r=e?Jt:qt;return A(t).forEach(e=>{let t=e.replace(r,``);n.paths.push(t),(Yt.test(t)?n.folders:n.files).push(t)}),n}var Kt,qt,Jt,Yt,Xt=S({"src/lib/responses/CleanSummary.ts"(){q(),Kt=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},qt=/^[a-z]+\s*/i,Jt=/^[a-z]+\s+[a-z]+\s*/i,Yt=/\/$/}}),Zt={};C(Zt,{EMPTY_COMMANDS:()=>nn,adhocExecTask:()=>Qt,configurationErrorTask:()=>J,isBufferTask:()=>en,isEmptyTask:()=>tn,straightThroughBufferTask:()=>$t,straightThroughStringTask:()=>Y});function Qt(e){return{commands:nn,format:`empty`,parser:e}}function J(e){return{commands:nn,format:`empty`,parser(){throw typeof e==`string`?new Xe(e):e}}}function Y(e,t=!1){return{commands:e,format:`utf-8`,parser(e){return t?String(e).trim():e}}}function $t(e){return{commands:e,format:`buffer`,parser(e){return e}}}function en(e){return e.format===`buffer`}function tn(e){return e.format===`empty`||!e.commands.length}var nn,X=S({"src/lib/tasks/task.ts"(){Ze(),nn=[]}}),rn={};C(rn,{CONFIG_ERROR_INTERACTIVE_MODE:()=>fn,CONFIG_ERROR_MODE_REQUIRED:()=>pn,CONFIG_ERROR_UNKNOWN_OPTION:()=>mn,CleanOptions:()=>hn,cleanTask:()=>on,cleanWithOptionsTask:()=>an,isCleanOptionsArray:()=>sn});function an(e,t){let{cleanMode:n,options:r,valid:i}=cn(e);return n?i.options?(r.push(...t),r.some(dn)?J(fn):on(n,r)):J(mn+JSON.stringify(e)):J(pn)}function on(e,t){return{commands:[`clean`,`-${e}`,...t],format:`utf-8`,parser(t){return Gt(e===`n`,t)}}}function sn(e){return Array.isArray(e)&&e.every(e=>gn.has(e))}function cn(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,``).split(``).forEach(e=>{ln(e)?(t=e,r.cleanMode=!0):r.options=r.options&&un(n[n.length]=`-${e}`)}),{cleanMode:t,options:n,valid:r}}function ln(e){return e===`f`||e===`n`}function un(e){return/^-[a-z]$/i.test(e)&&gn.has(e.charAt(1))}function dn(e){return/^-[^\-]/.test(e)?e.indexOf(`i`)>0:e===`--interactive`}var fn,pn,mn,hn,gn,_n=S({"src/lib/tasks/clean.ts"(){Xt(),q(),X(),fn=`Git clean interactive mode is not supported`,pn=`Git clean mode parameter ("n" or "f") is required`,mn=`Git clean unknown option found in: `,hn=(e=>(e.DRY_RUN=`n`,e.FORCE=`f`,e.IGNORED_INCLUDED=`x`,e.IGNORED_ONLY=`X`,e.EXCLUDING=`e`,e.QUIET=`q`,e.RECURSIVE=`d`,e))(hn||{}),gn=new Set([`i`,...N(Object.values(hn))])}});function vn(e){let t=new Sn;for(let n of xn(e))t.addValue(n.file,String(n.key),n.value);return t}function yn(e,t){let n=null,r=[],i=new Map;for(let a of xn(e,t))a.key===t&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:t,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function bn(e){return e.replace(/^(file):/,``)}function*xn(e,t=null){let n=e.split(`\0`);for(let e=0,r=n.length-1;e<r;){let r=bn(n[e++]),i=n[e++],a=t;if(i.includes(`
|
|
7
7
|
`)){let e=et(i,`
|
|
8
8
|
`);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var Sn,Cn=S({"src/lib/responses/ConfigList.ts"(){q(),Sn=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{}),this._all}addFile(e){if(!(e in this.values)){let t=k(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let r=this.addFile(e);Object.hasOwn(r,t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}});function wn(e,t){return typeof e==`string`&&Object.hasOwn(kn,e)?e:t}function Tn(e,t,n,r){let i=[`config`,`--${r}`];return n&&i.push(`--add`),i.push(e,t),{commands:i,format:`utf-8`,parser(e){return e}}}function En(e,t){let n=[`config`,`--null`,`--show-origin`,`--get-all`,e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:`utf-8`,parser(t){return yn(t,e)}}}function Dn(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return vn(e)}}}function On(){return{addConfig(e,t,...n){return this._runTask(Tn(e,t,n[0]===!0,wn(n[1],`local`)),G(arguments))},getConfig(e,t){return this._runTask(En(e,wn(t,void 0)),G(arguments))},listConfig(...e){return this._runTask(Dn(wn(e[0],void 0)),G(arguments))}}}var kn,An=S({"src/lib/tasks/config.ts"(){Cn(),q(),kn=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(kn||{})}});function jn(e){return Nn.has(e)}var Mn,Nn,Pn=S({"src/lib/tasks/diff-name-status.ts"(){Mn=(e=>(e.ADDED=`A`,e.COPIED=`C`,e.DELETED=`D`,e.MODIFIED=`M`,e.RENAMED=`R`,e.CHANGED=`T`,e.UNMERGED=`U`,e.UNKNOWN=`X`,e.BROKEN=`B`,e))(Mn||{}),Nn=new Set(Object.values(Mn))}});function Fn(...e){return new Vn().param(...e)}function In(e){let t=new Set,n={};return rt(e,e=>{let[r,i,a]=e.split(L);t.add(r),(n[r]=n[r]||[]).push({line:P(i),path:r,preview:a})}),{paths:t,results:n}}function Ln(){return{grep(e){let t=G(arguments),n=W(arguments);for(let e of Rn)if(n.includes(e))return this._runTask(J(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=Fn().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return In(e)}},t)}}}var Rn,zn,Bn,Vn,Hn=S({"src/lib/tasks/grep.ts"(){q(),X(),Rn=[`-h`],zn=Symbol(`grepQuery`),Vn=class{constructor(){this[Bn]=[]}*[(Bn=zn,Symbol.iterator)](){for(let e of this[zn])yield e}and(...e){return e.length&&this[zn].push(`--and`,`(`,...F(e,`-e`),`)`),this}param(...e){return this[zn].push(...F(e,`-e`)),this}}}}),Un={};C(Un,{ResetMode:()=>qn,getResetMode:()=>Gn,resetTask:()=>Wn});function Wn(e,t){let n=[`reset`];return Kn(e)&&n.push(`--${e}`),n.push(...t),Y(n)}function Gn(e){if(Kn(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function Kn(e){return typeof e==`string`&&Jn.includes(e)}var qn,Jn,Yn=S({"src/lib/tasks/reset.ts"(){q(),X(),qn=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(qn||{}),Jn=N(Object.values(qn))}});function Xn(){return(0,Ue.default)(`simple-git`)}function Zn(e,t,n){return!t||!String(t).replace(/\s*/,``)?n?(t,...r)=>{e(t,...r),n(t,...r)}:e:(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}}function Qn(e,t,{namespace:n}){if(typeof e==`string`)return e;let r=t&&t.namespace||``;return r.startsWith(n)?r.substr(n.length+1):r||n}function $n(e,t,n,r=Xn()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=Qn(B(t,V),o,r);return l(n);function c(t,n){return j(a,$n(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&Zn(o,n)||R,s=Zn(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var er=S({"src/lib/git-logger.ts"(){q(),Ue.default.formatters.L=e=>String(vt(e)?e.length:`-`),Ue.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):z(e)}}),tr,nr=S({"src/lib/runners/tasks-pending-queue.ts"(){E(),er(),tr=class e{constructor(e=`GitExecutor`){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(t){let n=e.getName(t.commands[0]);return{task:t,logger:$n(this.logLabel,n),name:n}}push(e){let t=this.createProgress(e);return t.logger(`Adding task to the queue, commands = %o`,e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info(`Failed %o`,e),n(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)):n.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,e.message),this.complete(t);if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new T(void 0,`TasksPendingQueue: attempt called for an unknown task`);return t.logger(`Starting task`),t}static getName(t=`empty`){return`task:${t}:${++e.counter}`}static{this.counter=0}}}});function Z(e,t){return{method:tt(e.commands)||``,commands:t}}function rr(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function ir(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var ar,or=S({"src/lib/runners/git-executor-chain.ts"(){E(),X(),q(),nr(),ar=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new tr}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:t}=this._queue.attempt(e);return await(tn(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t))}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof T?Object.assign(t,{task:e}):new T(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec(`spawn.binary`,``,Z(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{...Z(e,e.commands),env:{...this.env}}),i=await this.gitResponse(e,n,r,this.outputHandler,t.step(`SPAWN`)),a=await this.handleTaskData(e,r,i,t.step(`HANDLE`));return t(`passing response to task's parser as a %s`,e.format),en(e)?Nt(e.parser,a):Nt(e.parser,a.asStrings())}async attemptEmptyTask(e,t){return t(`empty task bypassing child process to call to task's parser`),e.parser(this)}handleTaskData(e,t,n,r){let{exitCode:i,rejection:a,stdOut:o,stdErr:s}=n;return new Promise((c,l)=>{r(`Preparing to handle process response exitCode=%d stdOut=`,i);let{error:u}=this._plugins.exec(`task.error`,{error:a},{...Z(e,t),...n});if(u&&e.onError)return r.info(`exitCode=%s handling with custom error handler`),e.onError(n,u,e=>{r.info(`custom error handler treated as success`),r(`custom error returned a %s`,z(e)),c(new St(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(s)))},l);if(u)return r.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,i,s.length,a),l(u);r.info(`retrieving task output complete`),c(new St(Buffer.concat(o),Buffer.concat(s)))})}async gitResponse(e,t,n,r,i){let a=i.sibling(`output`),o=this._plugins.exec(`spawn.options`,{cwd:this.cwd,env:this.env,windowsHide:!0},Z(e,e.commands));return new Promise(c=>{let l=[],u=[];i.info(`%s %o`,t,n),i(`%O`,o);let d=this._beforeSpawn(e,n);if(d)return c({stdOut:l,stdErr:u,exitCode:9901,rejection:d});this._plugins.exec(`spawn.before`,void 0,{...Z(e,n),kill(e){d=e||d}});let f=s(t,n,o);f.stdout.on(`data`,ir(l,`stdOut`,i,a.step(`stdOut`))),f.stderr.on(`data`,ir(u,`stdErr`,i,a.step(`stdErr`))),f.on(`error`,rr(u,i)),r&&(i(`Passing child process stdOut/stdErr to custom outputHandler`),r(t,f.stdout,f.stderr,[...n])),this._plugins.exec(`spawn.after`,void 0,{...Z(e,n),spawned:f,close(e,t){c({stdOut:l,stdErr:u,exitCode:e,rejection:d||t})},kill(e){f.killed||(d=e,f.kill(`SIGINT`))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec(`spawn.before`,void 0,{...Z(e,t),kill(e){n=e||n}}),n}}}}),sr={};C(sr,{GitExecutor:()=>cr});var cr,lr=S({"src/lib/runners/git-executor.ts"(){or(),cr=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new ar(this,this._scheduler,this._plugins)}chain(){return new ar(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function ur(e,t,n=R){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof D?dr(t):t,void 0)})}function dr(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=R};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(n,{}));function n(n,r){return r in e||(n[r]={enumerable:!1,configurable:!1,get(){return t(r),e.git[r]}}),n}}var fr=S({"src/lib/task-callback.ts"(){O(),q()}});function pr(e,t){return Qt(n=>{if(!it(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var mr=S({"src/lib/tasks/change-working-directory.ts"(){q(),X()}});function hr(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=ot(t,`-B`)),Y(t)}function gr(){return{checkout(){return this._runTask(hr(W(arguments,1)),G(arguments))},checkoutBranch(e,t){return this._runTask(hr([`-b`,e,t,...W(arguments)]),G(arguments))},checkoutLocalBranch(e){return this._runTask(hr([`-b`,e,...W(arguments)]),G(arguments))}}}var _r=S({"src/lib/tasks/checkout.ts"(){q(),X()}});function vr(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function yr(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return K(vr(),[br],e)}})}}}var br,xr=S({"src/lib/tasks/count-objects.ts"(){q(),br=new H(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=st(t);Object.hasOwn(e,r)&&(e[r]=P(n))})}});function Sr(e){return K({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},Cr,e)}var Cr,wr=S({"src/lib/parsers/parse-commit.ts"(){q(),Cr=[new H(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new H(/\s*Author:\s(.+)/i,(e,[t])=>{let n=t.split(`<`),r=n.pop();!r||!r.includes(`@`)||(e.author={email:r.substr(0,r.length-1),name:n.join(`<`).trim()})}),new H(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0}),new H(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(n,10)||0;r===`-`?e.summary.deletions=i:r===`+`&&(e.summary.insertions=i)})]}});function Tr(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...F(e,`-m`),...t,...n],format:`utf-8`,parser:Sr}}function Er(){return{commit(t,...n){let r=G(arguments),i=e(t)||Tr(M(t),M(B(n[0],_t,[])),[...N(B(n[1],ht,[])),...W(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!_t(e)&&J(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Dr=S({"src/lib/tasks/commit.ts"(){wr(),q(),X()}});function Or(){return{firstCommit(){return this._runTask(Y([`rev-list`,`--max-parents=0`,`HEAD`],!0),G(arguments))}}}var kr=S({"src/lib/tasks/first-commit.ts"(){q(),X()}});function Ar(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),Y(n,!0)}var jr=S({"src/lib/tasks/hash-object.ts"(){X()}});function Mr(e,t,n){let r=String(n).trim(),i;if(i=Pr.exec(r))return new Nr(e,t,!1,i[1]);if(i=Fr.exec(r))return new Nr(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new Nr(e,t,/^re/i.test(r),a)}var Nr,Pr,Fr,Ir=S({"src/lib/responses/InitSummary.ts"(){Nr=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},Pr=/^Init.+ repository in (.+)$/,Fr=/^Rein.+ in (.+)$/}});function Lr(e){return e.includes(zr)}function Rr(e=!1,t,n){let r=[`init`,...n];return e&&!Lr(r)&&r.splice(1,0,zr),{commands:r,format:`utf-8`,parser(e){return Mr(r.includes(`--bare`),t,e)}}}var zr,Br=S({"src/lib/tasks/init.ts"(){Ir(),zr=`--bare`}});function Vr(e){for(let t=0;t<e.length;t++){let n=Ur.exec(e[t]);if(n)return`--${n[1]}`}return``}function Hr(e){return Ur.test(e)}var Ur,Wr=S({"src/lib/args/log-format.ts"(){Ur=/^--(stat|numstat|name-only|name-status)(=|$)/}}),Gr,Kr=S({"src/lib/responses/DiffSummary.ts"(){Gr=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function qr(e=``){let t=Qr[e];return e=>K(new Gr,t,e,!1)}var Jr,Yr,Xr,Zr,Qr,$r=S({"src/lib/parsers/parse-diff-summary.ts"(){Wr(),Kr(),Pn(),q(),Jr=[new H(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:P(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new H(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:P(n),after:P(r),binary:!0})}),new H(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=P(t),e.insertions=P(r?.[1]),e.deletions=P(i?.[1])})],Yr=[new H(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=P(t),a=P(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new H(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],Xr=[new H(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],Zr=[new H(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,n,r,i,a])=>{e.changed++,e.files.push({file:a??r,changes:0,insertions:0,deletions:0,binary:!1,status:ut(jn(t)&&t),from:ut(!!a&&r!==a&&r),similarity:P(n)})})],Qr={"":Jr,"--stat":Jr,"--numstat":Yr,"--name-status":Zr,"--name-only":Xr}}});function ei(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function ti(e=ii,t=ai,n=``){let r=qr(n);return function(n){let i=A(n.trim(),!1,ni).map(function(n){let i=n.split(ri),a=ei(i[0].split(e),t);return i.length>1&&i[1].trim()&&(a.diff=r(i[1])),a});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var ni,ri,ii,ai,oi=S({"src/lib/parsers/parse-list-log-summary.ts"(){q(),$r(),Wr(),ni=`òòòòòò `,ri=` òò`,ii=` ò `,ai=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),si={};C(si,{diffSummaryTask:()=>ci,validateLogFormatConfig:()=>li});function ci(e){let t=Vr(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),li(n)||{commands:n,format:`utf-8`,parser:qr(t)}}function li(e){let t=e.filter(Hr);if(t.length>1)return J(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return J(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var ui=S({"src/lib/tasks/diff.ts"(){Wr(),$r(),X()}});function di(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function fi(e){return Object.keys(e).reduce((t,n)=>(n in gi||(t[n]=e[n]),t),{})}function pi(e={},t=[]){let n=B(e.splitter,V,ii),[r,i]=di(pt(e.format)?e.format:{hash:`%H`,date:e.strictDate===!1?`%ai`:`%aI`,message:`%s`,refs:`%D`,body:e.multiLine?`%B`:`%b`,author_name:e.mailMap===!1?`%an`:`%aN`,author_email:e.mailMap===!1?`%ae`:`%aE`},n),a=[],o=[`--pretty=format:${ni}${i}${ri}`,...t],s=e.n||e[`max-count`]||e.maxCount;if(s&&o.push(`--max-count=${s}`),e.from||e.to){let t=e.symmetric===!1?`..`:`...`;a.push(`${e.from||``}${t}${e.to||``}`)}return V(e.file)&&o.push(`--follow`,re(e.file)),kt(fi(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function mi(e,t,n){let r=ti(e,t,Vr(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function hi(){return{log(...n){let r=G(arguments),i=pi(jt(arguments),N(B(arguments[0],ht,[]))),a=t(...n)||li(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return mi(e.splitter,e.fields,e.commands)}function t(e,t){return V(e)&&V(t)&&J(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var gi,_i=S({"src/lib/tasks/log.ts"(){Wr(),oi(),q(),X(),ui(),gi=(e=>(e[e[`--pretty`]=0]=`--pretty`,e[e[`max-count`]=1]=`max-count`,e[e.maxCount=2]=`maxCount`,e[e.n=3]=`n`,e[e.file=4]=`file`,e[e.format=5]=`format`,e[e.from=6]=`from`,e[e.to=7]=`to`,e[e.splitter=8]=`splitter`,e[e.symmetric=9]=`symmetric`,e[e.mailMap=10]=`mailMap`,e[e.multiLine=11]=`multiLine`,e[e.strictDate=12]=`strictDate`,e))(gi||{})}}),vi,yi,bi=S({"src/lib/responses/MergeSummary.ts"(){vi=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},yi=class{constructor(){this.conflicts=[],this.merges=[],this.result=`success`}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(`, `)}`:`OK`}}}}),xi,Si,Ci=S({"src/lib/responses/PullSummary.ts"(){xi=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},Si=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function wi(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function Ti(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:P(t&&t[1]||`0`),delta:P(n&&n[1]||`0`)}}var Ei,Di=S({"src/lib/parsers/parse-remote-objects.ts"(){q(),Ei=[new U(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=wi(e.remoteMessages);Object.assign(i,{[r]:P(n)})}),new U(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=wi(e.remoteMessages);Object.assign(i,{[r]:P(n)})}),new U(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=wi(e.remoteMessages);i.total=Ti(t),i.reused=Ti(n),i.packReused=P(r)})]}});function Oi(e,t){return K({remoteMessages:new Ai},ki,t)}var ki,Ai,ji=S({"src/lib/parsers/parse-remote-messages.ts"(){q(),Di(),ki=[new U(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...Ei,new U([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new U([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:P(t),summary:n,url:r}})],Ai=class{constructor(){this.all=[]}}}});function Mi(e,t){let n=K(new Si,Li,[e,t]);return n.message&&n}var Ni,Pi,Fi,Ii,Li,Ri,zi,Bi=S({"src/lib/parsers/parse-pull.ts"(){Ci(),q(),ji(),Ni=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,Pi=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,Fi=/^(create|delete) mode \d+ (.+)/,Ii=[new H(Ni,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new H(Pi,(e,[t,,n,,r])=>n!==void 0||r!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0):!1),new H(Fi,(e,[t,n])=>{j(e.files,n),j(t===`create`?e.created:e.deleted,n)})],Li=[new H(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new H(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new H(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n})],Ri=(e,t)=>K(new xi,Ii,[e,t]),zi=(e,t)=>Object.assign(new xi,Ri(e,t),Oi(e,t))}}),Vi,Hi,Ui,Wi=S({"src/lib/parsers/parse-merge.ts"(){bi(),q(),Bi(),Vi=[new H(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new H(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new vi(t,n))}),new H(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new vi(t,n,{deleteRef:r}))}),new H(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new vi(t,null))}),new H(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],Hi=(e,t)=>Object.assign(Ui(e,t),zi(e,t)),Ui=e=>K(new yi,Vi,e)}});function Gi(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=Hi(e,t);if(n.failed)throw new D(n);return n}}:J(`Git.merge requires at least one option`)}var Ki=S({"src/lib/tasks/merge.ts"(){O(),Wi(),X()}});function qi(e,t,n){let r=n.includes(`deleted`),i=n.includes(`tag`)||/^refs\/tags/.test(e),a=!n.includes(`new`);return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var Ji,Yi,Xi,Zi=S({"src/lib/parsers/parse-push.ts"(){q(),ji(),Ji=[new H(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new H(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new H(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push(qi(t,n,r))}),new H(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new H(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}})],Yi=(e,t)=>{let n=Xi(e,t),r=Oi(e,t);return{...n,...r}},Xi=(e,t)=>K({pushed:[]},Ji,[e,t])}}),Qi={};C(Qi,{pushTagsTask:()=>$i,pushTask:()=>ea});function $i(e={},t){return j(t,`--tags`),ea(e,t)}function ea(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),ot(n,`-v`),j(n,`--verbose`),j(n,`--porcelain`),{commands:n,format:`utf-8`,parser:Yi}}var ta=S({"src/lib/tasks/push.ts"(){Zi(),q()}});function na(){return{showBuffer(){let e=[`show`,...W(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask($t(e),G(arguments))},show(){let e=[`show`,...W(arguments,1)];return this._runTask(Y(e),G(arguments))}}}var ra=S({"src/lib/tasks/show.ts"(){q(),X()}}),ia,aa,oa=S({"src/lib/responses/FileStatusSummary.ts"(){ia=/^(.+)\0(.+)$/,aa=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=ia.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function sa(e){let[t,n]=e.split(L);return{from:n||t,to:t}}function Q(e,t,n){return[`${e}${t}`,n]}function ca(e,...t){return t.map(t=>Q(e,t,(e,t)=>e.conflicted.push(t)))}function la(e,t){let n=t.trim();switch(` `){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.slice(3));case n.charAt(1):return r(` `,n.charAt(0),n.slice(2));default:return}function r(t,n,r){let i=`${t}${n}`,a=da.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new aa(r,t,n))}}var ua,da,fa,pa=S({"src/lib/responses/StatusSummary.ts"(){q(),oa(),ua=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},da=new Map([Q(` `,`A`,(e,t)=>e.created.push(t)),Q(` `,`D`,(e,t)=>e.deleted.push(t)),Q(` `,`M`,(e,t)=>e.modified.push(t)),Q(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),Q(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),Q(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),Q(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),Q(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),Q(`R`,` `,(e,t)=>{e.renamed.push(sa(t))}),Q(`R`,`M`,(e,t)=>{let n=sa(t);e.renamed.push(n),e.modified.push(n.to)}),Q(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),Q(`?`,`?`,(e,t)=>e.not_added.push(t)),...ca(`A`,`A`,`U`),...ca(`D`,`D`,`U`),...ca(`U`,`A`,`D`,`U`),[`##`,(e,t)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,s=n.exec(t);e.ahead=s&&+s[1]||0,s=r.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=B(s?.[1],V,null),s=a.exec(t),e.tracking=B(s?.[1],V,null),s=o.exec(t),s&&(e.current=B(s?.[1],V,e.current)),e.detached=/\(no branch\)/.test(t)}]]),fa=function(e){let t=e.split(L),n=new ua;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=L+(t[e++]||``)),la(n,r))}return n}}});function ma(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!ha.includes(e))],parser(e){return fa(e)}}}var ha,ga=S({"src/lib/tasks/status.ts"(){pa(),ha=[`--null`,`-z`]}});function _a(e=0,t=0,n=0,r=``,i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},`toString`,{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function va(){return _a(0,0,0,``,!1)}function ya(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:ba,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(xa));r(t)}})}}}function ba(e){return e===xa?va():K(_a(0,0,0,e),Sa,e)}var xa,Sa,Ca=S({"src/lib/tasks/version.ts"(){q(),xa=`installed=false`,Sa=[new H(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,_a(P(t),P(n),P(r),i))}),new H(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,_a(P(t),P(n),r,i))})]}});function wa(e,t,n,...r){return V(n)?t(n,B(r[0],V),W(arguments)):J(`git.${e}() requires a string 'repoPath'`)}function Ta(){return{clone(e,...t){return this._runTask(wa(`clone`,Ea,B(e,V),...t),G(arguments))},mirror(e,...t){return this._runTask(wa(`mirror`,Da,B(e,V),...t),G(arguments))}}}var Ea,Da,Oa=S({"src/lib/tasks/clone.ts"(){X(),q(),Ea=(e,t,n)=>{let r=[`clone`,...n];return V(e)&&r.push(re(e)),V(t)&&r.push(re(t)),Y(r)},Da=(e,t,n)=>(j(n,`--mirror`),Ea(e,t,n))}}),ka={};C(ka,{SimpleGitApi:()=>Aa});var Aa,ja=S({"src/lib/simple-git-api.ts"(){fr(),mr(),_r(),xr(),Dr(),An(),kr(),Hn(),jr(),Br(),_i(),Ki(),ta(),ra(),ga(),X(),Ca(),q(),Oa(),Aa=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&ur(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(Y([`add`,...M(e)]),G(arguments))}cwd(e){let t=G(arguments);return typeof e==`string`?this._runTask(pr(e,this._executor),t):typeof e?.path==`string`?this._runTask(pr(e.path,e.root&&this._executor||void 0),t):this._runTask(J(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(Ar(e,t===!0),G(arguments))}init(e){return this._runTask(Rr(e===!0,this._executor.cwd,W(arguments)),G(arguments))}merge(){return this._runTask(Gi(W(arguments)),G(arguments))}mergeFromTo(e,t){return V(e)&&V(t)?this._runTask(Gi([e,t,...W(arguments)]),G(arguments,!1)):this._runTask(J(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=ea({remote:B(arguments[0],V),branch:B(arguments[1],V)},W(arguments));return this._runTask(e,G(arguments))}stash(){return this._runTask(Y([`stash`,...W(arguments)]),G(arguments))}status(){return this._runTask(ma(W(arguments)),G(arguments))}},Object.assign(Aa.prototype,gr(),Ta(),Er(),On(),yr(),Or(),Ln(),hi(),na(),ya())}}),Ma={};C(Ma,{Scheduler:()=>Pa});var Na,Pa,Fa=S({"src/lib/runners/scheduler.ts"(){q(),er(),Na=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,x.createDeferred)();return{promise:t,done:n,id:e}}})(),Pa=class{constructor(e=2){this.concurrency=e,this.logger=$n(``,`scheduler`),this.pending=[],this.running=[],this.logger(`Constructed, concurrency=%s`,e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}let e=j(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),ot(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=j(this.pending,Na());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),Ia={};C(Ia,{applyPatchTask:()=>La});function La(e,t){return Y([`apply`,...t,...e])}var Ra=S({"src/lib/tasks/apply-patch.ts"(){X()}});function za(e,t){return{branch:e,hash:t,success:!0}}function Ba(e){return{branch:e,hash:null,success:!1}}var Va,Ha=S({"src/lib/responses/BranchDeleteSummary.ts"(){Va=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function Ua(e,t){return t===1&&Ga.test(e)}var Wa,Ga,Ka,qa,Ja=S({"src/lib/parsers/parse-branch-delete.ts"(){Ha(),q(),Wa=/(\S+)\s+\(\S+\s([^)]+)\)/,Ga=/^error[^']+'([^']+)'/m,Ka=[new H(Wa,(e,[t,n])=>{let r=za(t,n);e.all.push(r),e.branches[t]=r}),new H(Ga,(e,[t])=>{let n=Ba(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],qa=(e,t)=>K(new Va,Ka,[e,t])}}),Ya,Xa=S({"src/lib/responses/BranchSummary.ts"(){Ya=class{constructor(){this.all=[],this.branches={},this.current=``,this.detached=!1}push(e,t,n,r,i){e===`*`&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e===`*`,linkedWorkTree:e===`+`,name:n,commit:r,label:i}}}}});function Za(e){return e?e.charAt(0):``}function Qa(e,t=!1){return K(new Ya,t?[eo]:$a,e)}var $a,eo,to=S({"src/lib/parsers/parse-branch.ts"(){Xa(),q(),$a=[new H(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(Za(t),!0,n,r,i)}),new H(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(Za(t),!1,n,r,i)})],eo=new H(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),no={};C(no,{branchLocalTask:()=>ao,branchTask:()=>io,containsDeleteBranchCommand:()=>ro,deleteBranchTask:()=>so,deleteBranchesTask:()=>oo});function ro(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function io(e){let t=ro(e),n=e.includes(`--show-current`),r=[`branch`,...e];return r.length===1&&r.push(`-a`),r.includes(`-v`)||r.splice(1,0,`-v`),{format:`utf-8`,commands:r,parser(e,r){return t?qa(e,r).all[0]:Qa(e,n)}}}function ao(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return Qa(e)}}}function oo(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return qa(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!Ua(String(n),e))return i(n);r(t)}}}function so(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return qa(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!Ua(String(i),e))return o(i);throw new D(n.parser(I(r),I(t)),String(i))}};return n}var co=S({"src/lib/tasks/branch.ts"(){O(),Ja(),to(),q()}});function lo(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&a(t)}var uo,fo=S({"src/lib/responses/CheckIgnore.ts"(){uo=e=>e.split(/\n/g).map(lo).filter(Boolean)}}),po={};C(po,{checkIgnoreTask:()=>mo});function mo(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:uo}}var ho=S({"src/lib/tasks/check-ignore.ts"(){fo()}});function go(e,t){return K({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},_o,[e,t])}var _o,vo=S({"src/lib/parsers/parse-fetch.ts"(){q(),_o=[new H(/From (.+)$/,(e,[t])=>{e.remote=t}),new H(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new H(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new H(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new H(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),yo={};C(yo,{fetchTask:()=>xo});function bo(e){return/^--upload-pack(=|$)/.test(e)}function xo(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(bo)?J(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:go}}var So=S({"src/lib/tasks/fetch.ts"(){vo(),X()}});function Co(e){return K({moves:[]},wo,e)}var wo,To=S({"src/lib/parsers/parse-move.ts"(){q(),wo=[new H(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),Eo={};C(Eo,{moveTask:()=>Do});function Do(e,t){return{commands:[`mv`,`-v`,...M(e),t],format:`utf-8`,parser:Co}}var Oo=S({"src/lib/tasks/move.ts"(){To(),q()}}),ko={};C(ko,{pullTask:()=>Ao});function Ao(e,t,n){let r=[`pull`,...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:`utf-8`,parser(e,t){return zi(e,t)},onError(e,t,n,r){let i=Mi(I(e.stdOut),I(e.stdErr));if(i)return r(new D(i));r(t)}}}var jo=S({"src/lib/tasks/pull.ts"(){O(),Bi(),q()}});function Mo(e){let t={};return Po(e,([e])=>t[e]={name:e}),Object.values(t)}function No(e){let t={};return Po(e,([e,n,r])=>{Object.hasOwn(t,e)||(t[e]={name:e,refs:{fetch:``,push:``}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,``)]=n)}),Object.values(t)}function Po(e,t){rt(e,e=>t(e.split(/\s+/)))}var Fo=S({"src/lib/responses/GetRemoteSummary.ts"(){q()}}),Io={};C(Io,{addRemoteTask:()=>Lo,getRemotesTask:()=>Ro,listRemotesTask:()=>zo,remoteTask:()=>Bo,removeRemoteTask:()=>Vo});function Lo(e,t,n){return Y([`remote`,`add`,...n,e,t])}function Ro(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?No:Mo}}function zo(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),Y(t)}function Bo(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),Y(t)}function Vo(e){return Y([`remote`,`remove`,e])}var Ho=S({"src/lib/tasks/remote.ts"(){Fo(),X()}}),Uo={};C(Uo,{stashListTask:()=>Wo});function Wo(e={},t){let n=pi(e),r=[`stash`,`list`,...n.commands,...t],i=ti(n.splitter,n.fields,Vr(r));return li(r)||{commands:r,format:`utf-8`,parser:i}}var Go=S({"src/lib/tasks/stash-list.ts"(){Wr(),oi(),ui(),_i()}}),Ko={};C(Ko,{addSubModuleTask:()=>qo,initSubModuleTask:()=>Jo,subModuleTask:()=>Yo,updateSubModuleTask:()=>Xo});function qo(e,t){return Yo([`add`,e,t])}function Jo(e){return Yo([`init`,...e])}function Yo(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),Y(t)}function Xo(e){return Yo([`update`,...e])}var Zo=S({"src/lib/tasks/sub-module.ts"(){X()}});function Qo(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?$o(e,t):0:n?1:-1}function $o(e,t){return e===t?0:e>t?1:-1}function es(e){return e.trim()}function ts(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var ns,rs,is=S({"src/lib/responses/TagList.ts"(){ns=class{constructor(e,t){this.all=e,this.latest=t}},rs=function(e,t=!1){let n=e.split(`
|
|
9
|
-
`).map(es).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return Qo(ts(n[0]),ts(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=$o(ts(n[e]),ts(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new ns(n,r)}}}),as={};C(as,{addAnnotatedTagTask:()=>cs,addTagTask:()=>ss,tagListTask:()=>os});function os(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return rs(e,t)}}}function ss(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function cs(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var ls=S({"src/lib/tasks/tag.ts"(){is()}}),us=Je({"src/git.js"(e,t){var{GitExecutor:n}=(lr(),w(sr)),{SimpleGitApi:r}=(ja(),w(ka)),{Scheduler:i}=(Fa(),w(Ma)),{adhocExecTask:a,configurationErrorTask:o}=(X(),w(Zt)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:ee}=(q(),w(Ft)),{applyPatchTask:te}=(Ra(),w(Ia)),{branchTask:ne,branchLocalTask:re,deleteBranchesTask:h,deleteBranchTask:g}=(co(),w(no)),{checkIgnoreTask:ie}=(ho(),w(po)),{checkIsRepoTask:ae}=(Wt(),w(It)),{cleanWithOptionsTask:oe,isCleanOptionsArray:se}=(_n(),w(rn)),{diffSummaryTask:ce}=(ui(),w(si)),{fetchTask:le}=(So(),w(yo)),{moveTask:ue}=(Oo(),w(Eo)),{pullTask:_}=(jo(),w(ko)),{pushTagsTask:de}=(ta(),w(Qi)),{addRemoteTask:fe,getRemotesTask:pe,listRemotesTask:me,remoteTask:he,removeRemoteTask:ge}=(Ho(),w(Io)),{getResetMode:_e,resetTask:ve}=(Yn(),w(Un)),{stashListTask:ye}=(Go(),w(Uo)),{addSubModuleTask:be,initSubModuleTask:xe,subModuleTask:Se,updateSubModuleTask:Ce}=(Zo(),w(Ko)),{addAnnotatedTagTask:we,addTagTask:Te,tagListTask:Ee}=(ls(),w(as)),{straightThroughBufferTask:De,straightThroughStringTask:v}=(X(),w(Zt));function y(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(y.prototype=Object.create(r.prototype)).constructor=y,y.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},y.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},y.prototype.stashList=function(e){return this._runTask(ye(ee(arguments)||{},c(e)&&e||[]),m(arguments))},y.prototype.mv=function(e,t){return this._runTask(ue(e,t),m(arguments))},y.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},y.prototype.pull=function(e,t,n,r){return this._runTask(_(f(e,u),f(t,u),p(arguments)),m(arguments))},y.prototype.fetch=function(e,t){return this._runTask(le(f(e,u),f(t,u),p(arguments)),m(arguments))},y.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},y.prototype.tags=function(e,t){return this._runTask(Ee(p(arguments)),m(arguments))},y.prototype.rebase=function(){return this._runTask(v([`rebase`,...p(arguments)]),m(arguments))},y.prototype.reset=function(e){return this._runTask(ve(_e(e),p(arguments)),m(arguments))},y.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(v([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},y.prototype.addTag=function(e){let t=typeof e==`string`?Te(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},y.prototype.addAnnotatedTag=function(e,t){return this._runTask(we(e,t),m(arguments))},y.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(g(e,typeof t==`boolean`?t:!1),m(arguments))},y.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(h(e,typeof t==`boolean`?t:!1),m(arguments))},y.prototype.branch=function(e,t){return this._runTask(ne(p(arguments)),m(arguments))},y.prototype.branchLocal=function(e){return this._runTask(re(),m(arguments))},y.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(v(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},y.prototype.submoduleAdd=function(e,t,n){return this._runTask(be(e,t),m(arguments))},y.prototype.submoduleUpdate=function(e,t){return this._runTask(Ce(p(arguments,!0)),m(arguments))},y.prototype.submoduleInit=function(e,t){return this._runTask(xe(p(arguments,!0)),m(arguments))},y.prototype.subModule=function(e,t){return this._runTask(Se(p(arguments)),m(arguments))},y.prototype.listRemote=function(){return this._runTask(me(p(arguments)),m(arguments))},y.prototype.addRemote=function(e,t,n){return this._runTask(fe(e,t,p(arguments)),m(arguments))},y.prototype.removeRemote=function(e,t){return this._runTask(ge(e),m(arguments))},y.prototype.getRemotes=function(e,t){return this._runTask(pe(e===!0),m(arguments))},y.prototype.remote=function(e,t){return this._runTask(he(p(arguments)),m(arguments))},y.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(v(n),m(arguments))},y.prototype.updateServerInfo=function(e){return this._runTask(v([`update-server-info`]),m(arguments))},y.prototype.pushTags=function(e,t){let n=de({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},y.prototype.rm=function(e){return this._runTask(v([`rm`,`-f`,...s(e)]),m(arguments))},y.prototype.rmKeepLocal=function(e){return this._runTask(v([`rm`,`--cached`,...s(e)]),m(arguments))},y.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},y.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},y.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?De(r):v(r);return this._runTask(a,n)},y.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):v([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},y.prototype.diffSummary=function(){return this._runTask(ce(p(arguments,1)),m(arguments))},y.prototype.applyPatch=function(e){let t=d(e)?te(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},y.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(v(e,!0),m(arguments))},y.prototype.clean=function(e,t,n){let r=se(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,r?1:0));return this._runTask(oe(i,a),m(arguments))},y.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},y.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},y.prototype.checkIgnore=function(e,t){return this._runTask(ie(s(f(e,d,[]))),m(arguments))},y.prototype.checkIsRepo=function(e,t){return this._runTask(ae(f(e,u)),m(arguments))},t.exports=y}});E();var ds=class extends T{constructor(e,t){super(void 0,t),this.config=e}};E(),E();var $=class extends T{constructor(e,t,n){super(e,n),this.task=e,this.plugin=t,Object.setPrototypeOf(this,new.target.prototype)}};O(),Ze(),Wt(),_n(),An(),Pn(),Hn(),Yn();function fs(e){if(e)return[{type:`spawn.before`,action(t,n){e.aborted&&n.kill(new $(void 0,`abort`,`Abort already signaled`))}},{type:`spawn.after`,action(t,n){function r(){n.kill(new $(void 0,`abort`,`Abort signal received`))}e.addEventListener(`abort`,r),n.spawned.on(`close`,()=>e.removeEventListener(`abort`,r))}}]}function ps(e={}){return{type:`spawn.args`,action(t,{env:n}){for(let r of Ve(t,n))if(e[r.category]!==!0)throw new $(void 0,`unsafe`,r.message);return t}}}q();function ms(e){let t=F(e,`-c`);return{type:`spawn.args`,action(e){return[...t,...e]}}}q();var hs=(0,x.deferred)().promise;function gs({onClose:e=!0,onExit:t=50}={}){function n(){let n=-1,i={close:(0,x.deferred)(),closeTimeout:(0,x.deferred)(),exit:(0,x.deferred)(),exitTimeout:(0,x.deferred)()},a=Promise.race([e===!1?hs:i.closeTimeout.promise,t===!1?hs:i.exitTimeout.promise]);return r(e,i.close,i.closeTimeout),r(t,i.exit,i.exitTimeout),{close(e){n=e,i.close.done()},exit(e){n=e,i.exit.done()},get exitCode(){return n},result:a}}function r(e,t,n){e!==!1&&(e===!0?t.promise:t.promise.then(()=>lt(e))).then(n.done)}return{type:`spawn.after`,async action(e,{spawned:t,close:r}){let i=n(),a=!0,o=()=>void(a=!1);t.stdout?.on(`data`,o),t.stderr?.on(`data`,o),t.on(`error`,o),t.on(`close`,e=>i.close(e)),t.on(`exit`,e=>i.exit(e));try{await i.result,a&&await lt(50),r(i.exitCode)}catch(e){r(i.exitCode,e)}}}}q();var _s=`Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`,vs=`Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;function ys(e){return!e||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(e)}function bs(e,t){if(e.length<1||e.length>2)throw new $(void 0,`binary`,_s);if(e.some(ys))if(t)console.warn(vs);else throw new $(void 0,`binary`,vs);let[n,r]=e;return{binary:n,prefix:r}}function xs(e,t=[`git`],n=!1){let r=bs(M(t),n);e.on(`binary`,e=>{r=bs(M(e),n)}),e.append(`spawn.binary`,()=>r.binary),e.append(`spawn.args`,e=>r.prefix?[r.prefix,...e]:e)}E();function Ss(e){return!!(e.exitCode&&e.stdErr.length)}function Cs(e){return Buffer.concat([...e.stdOut,...e.stdErr])}function ws(e=!1,t=Ss,n=Cs){return(r,i)=>!e&&r||!t(i)?r:n(i)}function Ts(e){return{type:`task.error`,action(t,n){let r=e(t.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new T(void 0,r.toString(`utf-8`))}:{error:r}}}}q();var Es=class{constructor(){this.plugins=new Set,this.events=new i}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){let n=j(this.plugins,{type:e,action:t});return()=>this.plugins.delete(n)}add(e){let t=[];return M(e).forEach(e=>e&&this.plugins.add(j(t,e))),()=>{t.forEach(e=>this.plugins.delete(e))}}exec(e,t,n){let r=t,i=Object.freeze(Object.create(n));for(let t of this.plugins)t.type===e&&(r=t.action(r,i));return r}};q();function Ds(e){let t=`--progress`,n=[`checkout`,`clone`,`fetch`,`pull`,`push`];return[{type:`spawn.args`,action(e,r){return n.includes(r.method)?at(e,t):e}},{type:`spawn.after`,action(n,r){r.commands.includes(t)&&r.spawned.stderr?.on(`data`,t=>{let n=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(t.toString(`utf8`));n&&e({method:r.method,stage:Os(n[1]),progress:P(n[2]),processed:P(n[3]),total:P(n[4])})})}}]}function Os(e){return String(e.toLowerCase().split(` `,1))||`unknown`}q();function ks(e){let t=ct(e,[`uid`,`gid`]);return{type:`spawn.options`,action(e){return{...t,...e}}}}function As({block:e,stdErr:t=!0,stdOut:n=!0}){if(e>0)return{type:`spawn.after`,action(r,i){let a;function o(){a&&clearTimeout(a),a=setTimeout(c,e)}function s(){i.spawned.stdout?.off(`data`,o),i.spawned.stderr?.off(`data`,o),i.spawned.off(`exit`,s),i.spawned.off(`close`,s),a&&clearTimeout(a)}function c(){s(),i.kill(new $(void 0,`timeout`,`block timeout reached`))}n&&i.spawned.stdout?.on(`data`,o),t&&i.spawned.stderr?.on(`data`,o),i.spawned.on(`exit`,s),i.spawned.on(`close`,s),o()}}}function js(){return{type:`spawn.args`,action(e){let t=[],n;function r(e){(n||=[]).push(...e)}for(let n=0;n<e.length;n++){let i=e[n];if(h(i)){r(g(i));continue}if(i===`--`){r(e.slice(n+1).flatMap(e=>h(e)&&g(e)||e));break}t.push(i)}return n?[...t,`--`,...n.map(String)]:t}}}q();var Ms=us();function Ns(e,t){let n=new Es,r=Et(e&&(typeof e==`string`?{baseDir:e}:e)||{},t);if(!it(r.baseDir))throw new ds(r,`Cannot use simple-git on a directory that does not exist`);return Array.isArray(r.config)&&n.add(ms(r.config)),n.add(ps(r.unsafe)),n.add(gs(r.completion)),r.abort&&n.add(fs(r.abort)),r.progress&&n.add(Ds(r.progress)),r.timeout&&n.add(As(r.timeout)),r.spawnOptions&&n.add(ks(r.spawnOptions)),n.add(js()),n.add(Ts(ws(!0))),r.errors&&n.add(Ts(r.errors)),xs(n,r.binary,r.unsafe?.allowUnsafeCustomBinary),new Ms(r,n)}O();var Ps=Ns;const Fs=new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};function Is(e){return Fs.enqueue(e)}var Ls=r({createGitInstance:()=>Rs});function Rs(e,t={}){let{credentialArgs:n=[],gitIndexFile:r}=t,i={};return r&&(i.GIT_INDEX_FILE=o(e,r)),{git:Ps({baseDir:e,config:n.length>=2?[n[1]]:[],unsafe:{allowUnsafeCredentialHelper:!0}}).env(i),projectDir:e,credentialArgs:n}}export{m as a,Ps as i,Ls as n,Is as r,Rs as t};
|
|
10
|
-
//# sourceMappingURL=git-handle-
|
|
9
|
+
`).map(es).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return Qo(ts(n[0]),ts(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=$o(ts(n[e]),ts(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new ns(n,r)}}}),as={};C(as,{addAnnotatedTagTask:()=>cs,addTagTask:()=>ss,tagListTask:()=>os});function os(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return rs(e,t)}}}function ss(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function cs(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var ls=S({"src/lib/tasks/tag.ts"(){is()}}),us=Je({"src/git.js"(e,t){var{GitExecutor:n}=(lr(),w(sr)),{SimpleGitApi:r}=(ja(),w(ka)),{Scheduler:i}=(Fa(),w(Ma)),{adhocExecTask:a,configurationErrorTask:o}=(X(),w(Zt)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:ee}=(q(),w(Ft)),{applyPatchTask:te}=(Ra(),w(Ia)),{branchTask:ne,branchLocalTask:re,deleteBranchesTask:h,deleteBranchTask:g}=(co(),w(no)),{checkIgnoreTask:ie}=(ho(),w(po)),{checkIsRepoTask:ae}=(Wt(),w(It)),{cleanWithOptionsTask:oe,isCleanOptionsArray:se}=(_n(),w(rn)),{diffSummaryTask:ce}=(ui(),w(si)),{fetchTask:le}=(So(),w(yo)),{moveTask:ue}=(Oo(),w(Eo)),{pullTask:_}=(jo(),w(ko)),{pushTagsTask:de}=(ta(),w(Qi)),{addRemoteTask:fe,getRemotesTask:pe,listRemotesTask:me,remoteTask:he,removeRemoteTask:ge}=(Ho(),w(Io)),{getResetMode:_e,resetTask:ve}=(Yn(),w(Un)),{stashListTask:ye}=(Go(),w(Uo)),{addSubModuleTask:be,initSubModuleTask:xe,subModuleTask:Se,updateSubModuleTask:Ce}=(Zo(),w(Ko)),{addAnnotatedTagTask:we,addTagTask:Te,tagListTask:Ee}=(ls(),w(as)),{straightThroughBufferTask:De,straightThroughStringTask:v}=(X(),w(Zt));function y(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(y.prototype=Object.create(r.prototype)).constructor=y,y.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},y.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},y.prototype.stashList=function(e){return this._runTask(ye(ee(arguments)||{},c(e)&&e||[]),m(arguments))},y.prototype.mv=function(e,t){return this._runTask(ue(e,t),m(arguments))},y.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},y.prototype.pull=function(e,t,n,r){return this._runTask(_(f(e,u),f(t,u),p(arguments)),m(arguments))},y.prototype.fetch=function(e,t){return this._runTask(le(f(e,u),f(t,u),p(arguments)),m(arguments))},y.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},y.prototype.tags=function(e,t){return this._runTask(Ee(p(arguments)),m(arguments))},y.prototype.rebase=function(){return this._runTask(v([`rebase`,...p(arguments)]),m(arguments))},y.prototype.reset=function(e){return this._runTask(ve(_e(e),p(arguments)),m(arguments))},y.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(v([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},y.prototype.addTag=function(e){let t=typeof e==`string`?Te(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},y.prototype.addAnnotatedTag=function(e,t){return this._runTask(we(e,t),m(arguments))},y.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(g(e,typeof t==`boolean`?t:!1),m(arguments))},y.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(h(e,typeof t==`boolean`?t:!1),m(arguments))},y.prototype.branch=function(e,t){return this._runTask(ne(p(arguments)),m(arguments))},y.prototype.branchLocal=function(e){return this._runTask(re(),m(arguments))},y.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(v(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},y.prototype.submoduleAdd=function(e,t,n){return this._runTask(be(e,t),m(arguments))},y.prototype.submoduleUpdate=function(e,t){return this._runTask(Ce(p(arguments,!0)),m(arguments))},y.prototype.submoduleInit=function(e,t){return this._runTask(xe(p(arguments,!0)),m(arguments))},y.prototype.subModule=function(e,t){return this._runTask(Se(p(arguments)),m(arguments))},y.prototype.listRemote=function(){return this._runTask(me(p(arguments)),m(arguments))},y.prototype.addRemote=function(e,t,n){return this._runTask(fe(e,t,p(arguments)),m(arguments))},y.prototype.removeRemote=function(e,t){return this._runTask(ge(e),m(arguments))},y.prototype.getRemotes=function(e,t){return this._runTask(pe(e===!0),m(arguments))},y.prototype.remote=function(e,t){return this._runTask(he(p(arguments)),m(arguments))},y.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(v(n),m(arguments))},y.prototype.updateServerInfo=function(e){return this._runTask(v([`update-server-info`]),m(arguments))},y.prototype.pushTags=function(e,t){let n=de({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},y.prototype.rm=function(e){return this._runTask(v([`rm`,`-f`,...s(e)]),m(arguments))},y.prototype.rmKeepLocal=function(e){return this._runTask(v([`rm`,`--cached`,...s(e)]),m(arguments))},y.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},y.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},y.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?De(r):v(r);return this._runTask(a,n)},y.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):v([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},y.prototype.diffSummary=function(){return this._runTask(ce(p(arguments,1)),m(arguments))},y.prototype.applyPatch=function(e){let t=d(e)?te(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},y.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(v(e,!0),m(arguments))},y.prototype.clean=function(e,t,n){let r=se(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,r?1:0));return this._runTask(oe(i,a),m(arguments))},y.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},y.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},y.prototype.checkIgnore=function(e,t){return this._runTask(ie(s(f(e,d,[]))),m(arguments))},y.prototype.checkIsRepo=function(e,t){return this._runTask(ae(f(e,u)),m(arguments))},t.exports=y}});E();var ds=class extends T{constructor(e,t){super(void 0,t),this.config=e}};E(),E();var $=class extends T{constructor(e,t,n){super(e,n),this.task=e,this.plugin=t,Object.setPrototypeOf(this,new.target.prototype)}};O(),Ze(),Wt(),_n(),An(),Pn(),Hn(),Yn();function fs(e){if(e)return[{type:`spawn.before`,action(t,n){e.aborted&&n.kill(new $(void 0,`abort`,`Abort already signaled`))}},{type:`spawn.after`,action(t,n){function r(){n.kill(new $(void 0,`abort`,`Abort signal received`))}e.addEventListener(`abort`,r),n.spawned.on(`close`,()=>e.removeEventListener(`abort`,r))}}]}function ps(e={}){return{type:`spawn.args`,action(t,{env:n}){for(let r of Ve(t,n))if(e[r.category]!==!0)throw new $(void 0,`unsafe`,r.message);return t}}}q();function ms(e){let t=F(e,`-c`);return{type:`spawn.args`,action(e){return[...t,...e]}}}q();var hs=(0,x.deferred)().promise;function gs({onClose:e=!0,onExit:t=50}={}){function n(){let n=-1,i={close:(0,x.deferred)(),closeTimeout:(0,x.deferred)(),exit:(0,x.deferred)(),exitTimeout:(0,x.deferred)()},a=Promise.race([e===!1?hs:i.closeTimeout.promise,t===!1?hs:i.exitTimeout.promise]);return r(e,i.close,i.closeTimeout),r(t,i.exit,i.exitTimeout),{close(e){n=e,i.close.done()},exit(e){n=e,i.exit.done()},get exitCode(){return n},result:a}}function r(e,t,n){e!==!1&&(e===!0?t.promise:t.promise.then(()=>lt(e))).then(n.done)}return{type:`spawn.after`,async action(e,{spawned:t,close:r}){let i=n(),a=!0,o=()=>void(a=!1);t.stdout?.on(`data`,o),t.stderr?.on(`data`,o),t.on(`error`,o),t.on(`close`,e=>i.close(e)),t.on(`exit`,e=>i.exit(e));try{await i.result,a&&await lt(50),r(i.exitCode)}catch(e){r(i.exitCode,e)}}}}q();var _s=`Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`,vs=`Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;function ys(e){return!e||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(e)}function bs(e,t){if(e.length<1||e.length>2)throw new $(void 0,`binary`,_s);if(e.some(ys))if(t)console.warn(vs);else throw new $(void 0,`binary`,vs);let[n,r]=e;return{binary:n,prefix:r}}function xs(e,t=[`git`],n=!1){let r=bs(M(t),n);e.on(`binary`,e=>{r=bs(M(e),n)}),e.append(`spawn.binary`,()=>r.binary),e.append(`spawn.args`,e=>r.prefix?[r.prefix,...e]:e)}E();function Ss(e){return!!(e.exitCode&&e.stdErr.length)}function Cs(e){return Buffer.concat([...e.stdOut,...e.stdErr])}function ws(e=!1,t=Ss,n=Cs){return(r,i)=>!e&&r||!t(i)?r:n(i)}function Ts(e){return{type:`task.error`,action(t,n){let r=e(t.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new T(void 0,r.toString(`utf-8`))}:{error:r}}}}q();var Es=class{constructor(){this.plugins=new Set,this.events=new i}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){let n=j(this.plugins,{type:e,action:t});return()=>this.plugins.delete(n)}add(e){let t=[];return M(e).forEach(e=>e&&this.plugins.add(j(t,e))),()=>{t.forEach(e=>this.plugins.delete(e))}}exec(e,t,n){let r=t,i=Object.freeze(Object.create(n));for(let t of this.plugins)t.type===e&&(r=t.action(r,i));return r}};q();function Ds(e){let t=`--progress`,n=[`checkout`,`clone`,`fetch`,`pull`,`push`];return[{type:`spawn.args`,action(e,r){return n.includes(r.method)?at(e,t):e}},{type:`spawn.after`,action(n,r){r.commands.includes(t)&&r.spawned.stderr?.on(`data`,t=>{let n=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(t.toString(`utf8`));n&&e({method:r.method,stage:Os(n[1]),progress:P(n[2]),processed:P(n[3]),total:P(n[4])})})}}]}function Os(e){return String(e.toLowerCase().split(` `,1))||`unknown`}q();function ks(e){let t=ct(e,[`uid`,`gid`]);return{type:`spawn.options`,action(e){return{...t,...e}}}}function As({block:e,stdErr:t=!0,stdOut:n=!0}){if(e>0)return{type:`spawn.after`,action(r,i){let a;function o(){a&&clearTimeout(a),a=setTimeout(c,e)}function s(){i.spawned.stdout?.off(`data`,o),i.spawned.stderr?.off(`data`,o),i.spawned.off(`exit`,s),i.spawned.off(`close`,s),a&&clearTimeout(a)}function c(){s(),i.kill(new $(void 0,`timeout`,`block timeout reached`))}n&&i.spawned.stdout?.on(`data`,o),t&&i.spawned.stderr?.on(`data`,o),i.spawned.on(`exit`,s),i.spawned.on(`close`,s),o()}}}function js(){return{type:`spawn.args`,action(e){let t=[],n;function r(e){(n||=[]).push(...e)}for(let n=0;n<e.length;n++){let i=e[n];if(h(i)){r(g(i));continue}if(i===`--`){r(e.slice(n+1).flatMap(e=>h(e)&&g(e)||e));break}t.push(i)}return n?[...t,`--`,...n.map(String)]:t}}}q();var Ms=us();function Ns(e,t){let n=new Es,r=Et(e&&(typeof e==`string`?{baseDir:e}:e)||{},t);if(!it(r.baseDir))throw new ds(r,`Cannot use simple-git on a directory that does not exist`);return Array.isArray(r.config)&&n.add(ms(r.config)),n.add(ps(r.unsafe)),n.add(gs(r.completion)),r.abort&&n.add(fs(r.abort)),r.progress&&n.add(Ds(r.progress)),r.timeout&&n.add(As(r.timeout)),r.spawnOptions&&n.add(ks(r.spawnOptions)),n.add(js()),n.add(Ts(ws(!0))),r.errors&&n.add(Ts(r.errors)),xs(n,r.binary,r.unsafe?.allowUnsafeCustomBinary),new Ms(r,n)}O();var Ps=Ns,Fs=Ns;const Is=new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};function Ls(e){return Is.enqueue(e)}var Rs=r({createGitInstance:()=>zs});function zs(e,t={}){let{credentialArgs:n=[],gitIndexFile:r}=t,i={LANG:`C`,LC_ALL:`C`};return r&&(i.GIT_INDEX_FILE=o(e,r)),{git:Fs({baseDir:e,config:n.length>=2?[n[1]]:[],unsafe:{allowUnsafeCredentialHelper:!0}}).env(i),projectDir:e,credentialArgs:n}}export{Ps as a,Fs as i,Rs as n,m as o,Ls as r,zs as t};
|
|
10
|
+
//# sourceMappingURL=git-handle-CjyGVy33-CK0dYQ8y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./git-handle-CjyGVy33-CK0dYQ8y.mjs";export{e as n};
|
package/dist/index.d.mts
CHANGED
|
@@ -139,6 +139,16 @@ interface ParsedGitHubBlobUrl {
|
|
|
139
139
|
declare function parseGitUrl(input: string): ParsedGitUrl | null;
|
|
140
140
|
declare function parseGitHubBlobUrl(input: string): ParsedGitHubBlobUrl | null;
|
|
141
141
|
//#endregion
|
|
142
|
+
//#region src/integrations/project-integration-writers.d.ts
|
|
143
|
+
type IntegrationId = 'mcp-config' | 'project-skill';
|
|
144
|
+
interface IntegrationWriteOutcome {
|
|
145
|
+
readonly integration: IntegrationId;
|
|
146
|
+
readonly editorId: EditorId;
|
|
147
|
+
readonly action: 'written' | 'overwritten' | 'skipped-unsupported' | 'failed';
|
|
148
|
+
readonly path?: string;
|
|
149
|
+
readonly error?: string;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
142
152
|
//#region src/integrations/resolve-project-root.d.ts
|
|
143
153
|
interface ResolveProjectRootResult {
|
|
144
154
|
/** Where `.ok/` lives or will live. Equals `realpath(cwd)` when no
|
|
@@ -168,19 +178,15 @@ interface ResolveProjectRootOptions {
|
|
|
168
178
|
declare function resolveProjectRoot(cwd: string, opts?: ResolveProjectRootOptions): ResolveProjectRootResult;
|
|
169
179
|
//#endregion
|
|
170
180
|
//#region src/integrations/write-project-ai-integrations.d.ts
|
|
171
|
-
type ProjectAiIntegrationOutcome = 'written' | 'overwritten' | 'failed' | 'skipped-no-project-surface';
|
|
172
|
-
interface ProjectAiEditorOutcome {
|
|
173
|
-
readonly editorId: EditorId;
|
|
174
|
-
readonly outcome: ProjectAiIntegrationOutcome;
|
|
175
|
-
readonly error?: string;
|
|
176
|
-
}
|
|
177
181
|
interface ProjectAiIntegrationsResult {
|
|
178
|
-
|
|
182
|
+
/** Per-(editor × integration) outcomes — MCP config and the project-local
|
|
183
|
+
* runtime skill for every selected editor. */
|
|
184
|
+
readonly integrations: IntegrationWriteOutcome[];
|
|
179
185
|
/** Result of `<projectDir>/.claude/launch.json` scaffolding; present iff
|
|
180
|
-
*
|
|
186
|
+
* `'claude'` was in `selectedEditorIds`. */
|
|
181
187
|
readonly claudeLaunchJson?: LaunchJsonResult;
|
|
182
188
|
}
|
|
183
189
|
declare function writeProjectAiIntegrations(projectDir: string, selectedEditorIds: readonly EditorId[], installOptions?: McpInstallOptions): ProjectAiIntegrationsResult;
|
|
184
190
|
//#endregion
|
|
185
|
-
export { ALL_EDITOR_IDS, EDITOR_LABELS, EDITOR_TARGETS, type EditorId, type EditorMcpResult, type EditorMcpTarget, type ExpectedShareRepo, LAUNCH_CONFIG_NAME, type LaunchJsonResult, type LoadConfigResult, type McpEntryClassification, type McpInstallOptions, type ParsedGitHubBlobUrl, type PreviewResult, type
|
|
191
|
+
export { ALL_EDITOR_IDS, EDITOR_LABELS, EDITOR_TARGETS, type EditorId, type EditorMcpResult, type EditorMcpTarget, type ExpectedShareRepo, type IntegrationWriteOutcome, LAUNCH_CONFIG_NAME, type LaunchJsonResult, type LoadConfigResult, type McpEntryClassification, type McpInstallOptions, type ParsedGitHubBlobUrl, type PreviewResult, type ProjectAiIntegrationsResult, type ResolveProjectRootOptions, type ResolveProjectRootResult, type ShareFolderValidationResult, type UserMcpConfigsOptions, classifyExistingMcpEntry, detectInstalledEditors, initContent, loadConfig, parseGitHubBlobUrl, parseGitUrl, previewContent, readExistingMcpEntry, resolveProjectRoot, scaffoldLaunchJson, validateLocalFolderForShare, writeEditorMcpConfig, writeProjectAiIntegrations, writeUserMcpConfigs };
|
|
186
192
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as e,d as t,f as n,g as r,h as i,i as a,m as o,r as s,s as c,t as l,u,y as d}from"./init-ODP7H2_D.mjs";import{i as f,n as p,r as m,t as h}from"./src-BtjvV77A.mjs";import{n as g}from"./loader-WypjL6D-.mjs";import{n as _}from"./preview-DLoNOk0M.mjs";export{o as ALL_EDITOR_IDS,i as EDITOR_LABELS,r as EDITOR_TARGETS,l as LAUNCH_CONFIG_NAME,s as classifyExistingMcpEntry,a as detectInstalledEditors,e as initContent,g as loadConfig,m as parseGitHubBlobUrl,f as parseGitUrl,_ as previewContent,c as readExistingMcpEntry,d as resolveProjectRoot,u as scaffoldLaunchJson,p as validateLocalFolderForShare,t as writeEditorMcpConfig,h as writeProjectAiIntegrations,n as writeUserMcpConfigs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./init-ODP7H2_D.mjs";export{e as runInit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,N as s,Nt as c,Qr as l,Un as u,ai as d,an as f,di as p,fn as m,gi as h,hi as g,ii as _,in as v,jt as y,ln as b,ri as x,rn as S,si as C}from"./dist-soQLoIV1.mjs";import{n as ee,t as te}from"./constants-xZa5P4wL.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-BrADtCN4.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={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:`╱`},xe={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:`⅒`},Se={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`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=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}}));const Ee=(()=>{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}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=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,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\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,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,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(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(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===je?Ee(e.slice(p,n.lastIndex)):n===Ne?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}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=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},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ze,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())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(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=G(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=G(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(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(e)));let l=s.join(`
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,N as s,Nt as c,Un as l,_i as u,ai as d,an as f,ci as p,ei as m,fi as h,fn as g,ii as _,in as v,jt as y,ln as b,oi as x,rn as S,vi as C}from"./dist-DRLITAOV.mjs";import{n as ee,t as te}from"./constants-BkjoNZLk.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-DLoNOk0M.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={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:`╱`},xe={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:`⅒`},Se={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`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=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}}));const Ee=(()=>{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}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=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,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\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,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,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(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(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===je?Ee(e.slice(p,n.lastIndex)):n===Ne?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}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=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},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ze,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())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(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=G(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=G(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(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(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===``){Be.lastIndex=e+1;let t=Be.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+=Ue(``));let e=i?Ve(i):void 0;i&&e&&(r+=He(e))}else t===`
|
|
4
4
|
`&&(i&&Ve(i)&&(r+=He(i)),a&&(r+=Ue(a)))}return r},qe=/\r?\n/;function Je(e,t,n){return String(e).normalize().split(qe).map(e=>Ke(e,t,n)).join(`
|
|
@@ -262,7 +262,7 @@ let In=/^[a-z0-9-_]+$/i;function Ln(e){let t=typeof e;if(t===`object`){if(Array.
|
|
|
262
262
|
`)+Wn(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=Bn(t[c],e,r,i),a+=`
|
|
263
263
|
`}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function Gn(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(Ln(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=Wn(0,e,``,t,n);return r[r.length-1]===`
|
|
264
264
|
`?r:r+`
|
|
265
|
-
`}function Kn(e,t){let n;try{n=ce(e)}catch(e){if(e.code===`ENOENT`)return;throw e}if(n.isSymbolicLink())throw Error(`Refusing to follow symlink at ${t} (${e}). An untrusted upstream may have committed this symlink to redirect writes outside the project. Remove the symlink and re-run.`)}function qn(e){return/^[A-Za-z0-9._\-/]+$/.test(e)?e:JSON.stringify(e)}function Jn(e,t){let n=`# yaml-language-server: $schema=https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${
|
|
265
|
+
`}function Kn(e,t){let n;try{n=ce(e)}catch(e){if(e.code===`ENOENT`)return;throw e}if(n.isSymbolicLink())throw Error(`Refusing to follow symlink at ${t} (${e}). An untrusted upstream may have committed this symlink to redirect writes outside the project. Remove the symlink and re-run.`)}function qn(e){return/^[A-Za-z0-9._\-/]+$/.test(e)?e:JSON.stringify(e)}function Jn(e,t){let n=`# yaml-language-server: $schema=https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${u}/config.project.schema.json
|
|
266
266
|
# Open Knowledge — project configuration
|
|
267
267
|
#
|
|
268
268
|
# This file overrides built-in defaults for this project. Every key below
|
|
@@ -376,7 +376,7 @@ let In=/^[a-z0-9-_]+$/i;function Ln(e){let t=typeof e;if(t===`object`){if(Array.
|
|
|
376
376
|
`)}\n`,`utf-8`),`updated`)}const Zn=`# .ok/local/ holds per-machine runtime state. Anything inside is
|
|
377
377
|
# machine-local and never committed. New runtime files (caches, locks,
|
|
378
378
|
# manifests, telemetry, error logs) are auto-ignored — no edit needed here.
|
|
379
|
-
${
|
|
379
|
+
${C}/
|
|
380
380
|
|
|
381
381
|
# Per-machine runtime state at the .ok/ root. Contains PII (principal email,
|
|
382
382
|
# UUID), hostnames, and absolute filesystem paths — never commit. The only
|
|
@@ -400,10 +400,10 @@ last-spawn-error.log
|
|
|
400
400
|
# drafts/ # exclude a directory
|
|
401
401
|
# *.draft.md # exclude files matching a pattern
|
|
402
402
|
# !keep.md # re-include a file .gitignore excluded
|
|
403
|
-
`,`.okignore`)?r.push(`.okignore`):a.push(`.okignore`),{created:r,updated:i,skipped:a}}function $n(e,t){let n=N(t,e);return n.length>0&&!n.startsWith(`..`)&&!A(n)}const er=e=>{try{let t=ie(`git`,[`rev-parse`,`--show-toplevel`],{cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return t.length>0?t:null}catch{return null}};function tr(e,t={}){let n=t.homeDir??H(),r=t.gitTopLevel??er,i=P(e),a;try{a=le(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(
|
|
404
|
-
`)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const
|
|
405
|
-
`)?n:`${n}\n`,`utf-8`)}
|
|
406
|
-
`,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 Gr(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Wr)():`both`}const Kr=`0.0.1`,qr=`open-knowledge-ui`,Jr=[`-y`,`@inkeep/open-knowledge@latest`,`ui`];function Yr(e,t={}){let n=j(e,`.claude`,`launch.json`),r=t.cliPath===void 0?t.mode===`dev`?{name:qr,runtimeExecutable:`node`,runtimeArgs:[or(),`ui`],port:kr,autoPort:!0}:{name:qr,runtimeExecutable:`npx`,runtimeArgs:[...Jr],port:kr,autoPort:!0}:{name:qr,runtimeExecutable:t.cliPath,runtimeArgs:[`ui`],port:kr,autoPort:!0};try{if(Vr(n,e),!L(n))return R(k(n),{recursive:!0}),B(n,`${JSON.stringify({version:Kr,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=z(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!w(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>w(e)&&e.name===`open-knowledge-ui`);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??Kr,configurations:a};return B(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function Xr(e,t,n){try{return L(e.detectPath?.(t,n)??k(e.configPath(t,n)))}catch{return!1}}function Zr(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)}}if(!i&&!n.skipAvailabilityCheck&&!Xr(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{Vr(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`}}let s;try{s=e.format===`toml`?Rr(o):Lr(o)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let c=s[e.topLevelKey]??{},l=c[a],u;try{u=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)}}let d={...s,[e.topLevelKey]:{...c,[a]:u}};try{e.format===`toml`?Br(o,d):zr(o,d)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:l===void 0?`written`:`overwritten`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function Qr(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=u(`project`,{checkDesktop:!0}),i=k(n);Vr(i,t);let a=L(n)?`overwritten`:`written`;return ue(i,{recursive:!0,force:!0}),R(k(i),{recursive:!0}),se(r,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function $r(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function ei(e){let t=vr(e.editors),n={mode:`published`,cliPath:e.cliPath,skipAvailabilityCheck:!0};return t.map(t=>Zr(t,``,n,e.home))}function ti(e,t,n,r){let i=ni(e,t,n,r);return i.kind===`present`?i.entry:null}function ni(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};let a;try{a=z(i,`utf-8`)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}if(a.trim()===``)return{kind:`corrupt`,error:`file is empty`};let o;try{o=e.format===`toml`?Rr(i):Lr(i)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}let s=o[e.topLevelKey];if(!w(s))return{kind:`no-entry`};let c=s[e.serverName(t)];return w(c)?{kind:`present`,entry:c}:{kind:`no-entry`}}async function ri(e={}){let t=P(e.cwd??process.cwd()),n=tr(t,{homeDir:e.home}),r=n.projectRoot,i=!L(j(r,`.ok`));n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&console.log(`[ok] Initialized OK at ${r} — opened parent of ${N(r,t)} because it contains a .git folder`);let a={mode:e.devMcp?`dev`:`published`},o=await c(r),s;try{s=Qn(r,{contentDir:n.defaultContentDir})}catch(t){let n=Q.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:o.didInit,claudeDesktopDetected:!1,mcpAction:`failed`,mcpPath:n,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`}}let l=await Gr({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),u=e.editors??ai(r,e.home),d=e.editors??nr.filter(e=>Q[e].projectConfigPath!==void 0),f=vr(u),p=vr(d),m=e.mcp===!1||l===null,h=Array.from(new Map([...f,...m?[]:p].map(e=>[e.id,e])).values()),g=f.filter(t=>Xr(t,r,e.home)),_=[],v=[],b=new Set;for(let t of h){if(m){let n=``;try{n=t.configPath(r,e.home)}catch{}_.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(Hr(l)&&f.includes(t)&&_.push(Zr(t,r,a,e.home)),Ur(l)&&p.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Zr(t,r,a,e.home,n);_.push(i),(i.action===`written`||i.action===`overwritten`)&&b.add(n)}}for(let e of p)e.projectSkillPath&&v.push(Qr(e,r));let x=!m&&l!==null&&Ur(l)?p.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,C=m?[]:g.map(e=>$r(e,r)).filter(e=>e!==void 0).filter(e=>!b.has(e.path)),ee=g.some(e=>e.id===`claude`)&&!m?Yr(r,a):void 0,te=await(e.installUserSkill??S)({home:e.home}),w=y({home:e.home}),T=m?`skipped-flag`:`skipped-missing`,E=_.find(e=>e.editorId===`claude`)??_[0]??{action:T,configPath:Q.claude.configPath(r,e.home)};return{projectRoot:r,contentCreated:s.created,contentUpdated:s.updated,contentSkipped:s.skipped,editors:_,projectSkills:v,legacyProjectConfigs:C,launchJson:ee,skillInstall:te,didGitInit:o.didInit,claudeDesktopDetected:w,mcpAction:E.action,mcpPath:E.configPath,mcpError:`error`in E?E.error:void 0,projectScopeUnsupportedLabels:x}}function ii(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`),s=e=>{let n=e.configPath.startsWith(t)?N(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`);let c=j(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(O(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(O(`Content already present at ${c}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(O(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(O(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(O(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${E(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${E(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${ne(`FAILED`)}: ${r.error}`);break;case`skipped-flag`:break}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(O(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${ne(`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} ${N(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(O(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${E(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`failed`:n.push(` ${D(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${D(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.claudeDesktopDetected&&(n.push(``),n.push(`Claude Desktop App detected. To enable in Claude Chat & Cowork, run: ${O(`ok install-skill`)}`)),e.preview?(n.push(``),n.push(re(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${E(`✓`)} ${O(`Next steps:`)}`),n.push(` 1. Open your editor (${T(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${T(`ok seed`)} — empty repo, Karpathy 3-layer`),n.push(` - ${T(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${T(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${T(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${T(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
|
|
407
|
-
`)}function ai(e,t){let n=[];for(let r of
|
|
408
|
-
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-
|
|
409
|
-
//# sourceMappingURL=init-
|
|
403
|
+
`,`.okignore`)?r.push(`.okignore`):a.push(`.okignore`),{created:r,updated:i,skipped:a}}function $n(e,t){let n=N(t,e);return n.length>0&&!n.startsWith(`..`)&&!A(n)}const er=e=>{try{let t=ie(`git`,[`rev-parse`,`--show-toplevel`],{cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return t.length>0?t:null}catch{return null}};function tr(e,t={}){let n=t.homeDir??H(),r=t.gitTopLevel??er,i=P(e),a;try{a=le(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(g(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=k(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&$n(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function nr(e,t){let n;try{n=le(t)}catch{n=P(t)}let r;try{r=ce(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(r?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);let i=k(e);for(;i.length>1&&i!==F;){let t;try{t=le(i)}catch(e){if(e.code===`ENOENT`){i=k(i);continue}throw e}let r=N(n,t);if(r===``||!r.startsWith(`..`)&&!A(r))return;throw Error(`Refusing to write at ${e}: ancestor ${i} 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 rr(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=l(`project`,{checkDesktop:!0}),i=k(n);nr(i,t);let a=L(n)?`overwritten`:`written`;return ue(i,{recursive:!0,force:!0}),R(k(i),{recursive:!0}),se(r,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}const ir=a,ar=_,or=[`-y`,`@inkeep/open-knowledge@latest`,`mcp`],sr={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`};function cr(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=P(e);if(oe(t)===`cli.mjs`&&oe(k(t))===`dist`)return t;let n=t.split(F),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 j(i.length===0?F:i.join(F),`packages`,`cli`,`dist`,`cli.mjs`)}function lr(e={}){return e.cliPath?{command:e.cliPath,args:[`mcp`]}:e.mode===`dev`?{command:`node`,args:[cr(),`mcp`],env:{...sr}}:{command:`npx`,args:[...or]}}function ur(e){return e===`win32`?I:M}function dr(e={}){let t=e.platformName??process.platform,n=e.home??H();return ur(t).join(n,`.claude.json`)}function fr(e={}){let t=e.platformName??process.platform,n=e.home??H(),r=e.env??process.env;if(t===`darwin`)return M.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??I.join(n,`AppData`,`Roaming`);return I.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function pr(e={}){let t=e.platformName??process.platform,n=e.home??H();return ur(t).join(n,`.cursor`,`mcp.json`)}function mr(e={}){let t=e.platformName??process.platform,n=e.home??H();return(e.env??process.env).CODEX_HOME??ur(t).join(n,`.codex`)}function hr(e={}){return ur(e.platformName??process.platform).join(mr(e),`config.toml`)}function gr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>gr(e,t[n]));if(w(e)&&w(t)){let n=Object.keys(e).sort(),r=Object.keys(t).sort();return n.length===r.length&&n.every((e,t)=>e===r[t])&&n.every(n=>gr(e[n],t[n]))}return!1}function _r(e,t){return Object.entries(t).every(([t,n])=>gr(e[t],n))}function vr(e,t){return{...e,...t}}function yr(e){return{...e,isCompatible(t,n,r){return _r(t,e.buildEntry(n,r))},mergeManagedFields(t,n,r){return vr(t,e.buildEntry(n,r))}}}const Q={claude:yr({id:`claude`,label:ar.claude,configPath:(e,t)=>dr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>j(t??H(),`.claude`),projectConfigPath:e=>j(e,`.mcp.json`),projectSkillPath:e=>j(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)}),"claude-desktop":yr({id:`claude-desktop`,label:ar[`claude-desktop`],configPath:(e,t)=>fr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(fr({home:t}))}),cursor:yr({id:`cursor`,label:ar.cursor,configPath:(e,t)=>pr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(pr({home:t})),projectConfigPath:e=>j(e,`.cursor`,`mcp.json`),projectSkillPath:e=>j(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)}),codex:yr({id:`codex`,label:ar.codex,configPath:(e,t)=>hr({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(hr({home:t})),projectConfigPath:e=>j(e,`.codex`,`config.toml`),projectSkillPath:e=>j(e,`.agents`,`skills`,`open-knowledge`,`SKILL.md`)})};function br(e){let t=e.filter(e=>!Object.hasOwn(Q,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${ir.join(`, `)}`);return e.map(e=>Q[e])}function $(e,t,n,r,i){let a=`urn:uuid:${he()}`;if(e.headersSent||e.writableEnded||e.destroyed){console.error(`[ok ui] emitProblem called after headers sent — suppressed`,{type:n,status:t,instance:a});return}let o={type:n,title:r,status:t,instance:a,...i===void 0?{}:{detail:i}},s=p.safeParse(o);if(!s.success){console.error(`[ok ui] emitProblem produced an invalid ProblemDetails body:`,{issues:s.error.issues,originalStatus:t,body:o}),e.writeHead(500,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify({type:`urn:ok:error:internal-server-error`,title:`Internal server error.`,status:500,instance:a}));return}e.writeHead(t,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify(o))}const xr=1e4;function Sr(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!b(n))return $(t,403,`urn:ok:error:loopback-required`,`Request must originate from a loopback address.`),!0;if(!f(e.headers.host))return $(t,403,`urn:ok:error:host-not-allowed`,`Host header is not in the loopback allowlist.`),!0;let r=e.headers.origin;return r!==void 0&&!v(r)?($(t,403,`urn:ok:error:invalid-origin`,`Origin header is not in the loopback allowlist.`),!0):!1}const Cr=3e4;function wr(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!b(n)||!f(e.headers.host))return t.destroy(),!0;let r=e.headers.origin;return typeof r==`string`&&!v(r)?(t.destroy(),!0):!1}function Tr(e,t,n,r,i,a){a.add(t),t.once(`close`,()=>a.delete(t));let o=ve({host:r,port:i,timeout:xr});a.add(o),o.once(`close`,()=>a.delete(o));let s=!1,c=n=>{if(!s){if(s=!0,n!==void 0){let t=n.err;console.warn(JSON.stringify({event:n.event,upstreamHost:r,upstreamPort:i,url:e.url,code:t instanceof Error?t.code:void 0,message:t instanceof Error?t.message:void 0}))}try{o.destroy()}catch{}try{t.destroy()}catch{}}};o.once(`connect`,()=>{o.setTimeout(0);let a=[`${e.method??`GET`} ${e.url??`/`} HTTP/1.1`,`host: ${r}:${i}`];for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()!==`host`&&n!==void 0)if(Array.isArray(n))for(let e of n)a.push(`${t}: ${e}`);else a.push(`${t}: ${n}`);try{o.write(`${a.join(`\r
|
|
404
|
+
`)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const Er=[`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`cookie`,`set-cookie`];async function Dr(e){let t=e.upstreamTimeoutMs??xr,n=new Set,r=ge((n,r)=>{Sr(n,r)||kr(n,r,e.upstreamHost,e.upstreamPort,t)});r.on(`upgrade`,(t,r,i)=>{wr(t,r)||Tr(t,r,i,e.upstreamHost,e.upstreamPort,n)}),await new Promise((t,n)=>{let i=e=>n(e);r.once(`error`,i),r.listen(e.listenPort,e.host,()=>{r.off(`error`,i),t()})});let i=r.address();return{httpServer:r,port:typeof i==`object`&&i?i.port:e.listenPort,close:()=>new Promise(e=>{for(let e of n)try{e.destroy()}catch{}n.clear(),r.close(()=>e()),r.closeIdleConnections()})}}function Or(e,t,n){kr(e,t,n.upstreamHost,n.upstreamPort,n.upstreamTimeoutMs??xr)}function kr(e,t,n,r,i){let a={...e.headers};delete a.host;for(let e of Er)delete a[e];e.setTimeout(Cr,()=>{if(t.headersSent)try{t.end()}catch{}else try{$(t,408,`urn:ok:error:request-timeout`,`Proxy request exceeded the per-request deadline.`,`Slow-loris-class: client did not finish within ${Cr/1e3}s.`)}catch{}try{e.socket?.destroy()}catch{}});let o=_e({host:n,port:r,method:e.method,path:e.url,headers:{...a,host:`${n}:${r}`}},e=>{let n={...e.headers};for(let e of Er)delete n[e];t.writeHead(e.statusCode??502,n),e.pipe(t),e.once(`error`,()=>{try{t.end()}catch{}})});i>0&&o.setTimeout(i,()=>{if(!t.headersSent)$(t,504,`urn:ok:error:gateway-timeout`,`Upstream did not respond before the gateway deadline.`,`Upstream timeout: ${i/1e3}s elapsed without a response.`);else try{t.end()}catch{}o.destroy()}),o.on(`error`,()=>{if(!t.headersSent)$(t,502,`urn:ok:error:collab-server-not-running`,`Collab server is unreachable.`,`Upstream connection failed or dropped before a response was received.`);else try{t.end()}catch{}}),e.on(`error`,()=>{o.destroy()}),e.pipe(o)}const Ar=39847,jr=39848;async function Mr(e){await Promise.all(e.map(e=>new Promise(t=>{e.close(()=>t())})))}async function Nr(e){let{existsSync:t}=await import(`node:fs`),{createServer:n}=await import(`node:http`),{resolve:r}=await import(`node:path`),{acquireUiLock:i,createAssetServeMiddleware:a,createContentFilter:o,readServerLock:s,releaseUiLock:c,updateUiLockPort:l}=await import(`./dist-BJWJRYPN.mjs`),{default:u}=await import(`./build-B4ZT2GMK.mjs`),{resolveContentDir:f,resolveLockDir:p}=await import(`./dist-BJWJRYPN.mjs`),g=f(e.config,e.cwd),_=p(e.cwd);i(_,{port:0,worktreeRoot:e.cwd});let v=import.meta.dirname??new URL(`.`,import.meta.url).pathname,y=[r(v,`public`),r(v,`../../app/dist`),r(v,`../../../app/dist`)].find(e=>t(e)),b=y?u(y,{single:!0,gzip:!0,immutable:!0,extensions:[]}):null,S=t(g)?a({contentFilter:o({projectDir:e.cwd,contentDir:g}),contentSirv:u(g,{dotfiles:!1,dev:!0,extensions:[]}),inlineExtensions:x,assetExtensions:m,blocklistExtensions:d}):null,C=e.port,ee=null,te=(e,t)=>{let n=e.url?.split(`?`)[0];if((n===`/`||n===``)&&(e.url=`/index.html`),!(n?.startsWith(`/api/`)&&Sr(e,t))){if(n===`/api/config`&&(e.method===`GET`||e.method===`HEAD`)){ee?.();let n=s(_),r=e.headers.host??`localhost:${C}`,i=n&&n.port>0?`ws://${r}/collab`:null,a=JSON.stringify({collabUrl:i,previewUrl:null,port:C});t.setHeader(`Content-Type`,`application/json`),t.setHeader(`Cache-Control`,`no-store`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.statusCode=200,e.method===`HEAD`?t.end():t.end(a);return}if(n?.startsWith(`/api/`)){ee?.();let r=s(_);if(!r||r.port<=0){$(t,503,`urn:ok:error:collab-server-not-running`,"Collab server not running. Start `ok start` or run `ok status`.",`Path: ${n}`);return}Or(e,t,{upstreamHost:`localhost`,upstreamPort:r.port});return}if(b&&n?.startsWith(`/assets/`)){b(e,t,()=>{S?S(e,t,()=>Pr(t,n)):Pr(t,n)});return}if(S){S(e,t,()=>{b?b(e,t):Pr(t,n)});return}if(b){b(e,t);return}Pr(t,n)}},w=new Set,T=(e,t,n)=>{if(wr(e,t))return;let r=e.url?.split(`?`)[0]??``;if(r!==`/collab`&&!r.startsWith(`/collab/`)){t.destroy();return}let i=s(_);if(!i||i.port<=0){console.warn(JSON.stringify({event:`ok-ui-upgrade-no-collab-lock`,url:r,reason:"server.lock missing or port unbound — is `ok start` running?"})),t.destroy();return}Tr(e,t,n,`localhost`,i.port,w)},E=()=>{for(let e of w)try{e.destroy()}catch{}w.clear()},ne=e.host===void 0?[`::1`,`127.0.0.1`]:[e.host],D=[],O=e.port,re=e=>e instanceof Error&&e.code===`EADDRINUSE`,ie=async()=>{await Promise.all(D.splice(0).map(e=>new Promise(t=>{try{e.close(()=>t())}catch{t()}})))},ae=async e=>{O=e;for(let e of ne){let t=n(te);t.on(`upgrade`,T),D.push(t),await new Promise((n,r)=>{let i=e=>r(e);t.once(`error`,i),t.listen(O,e,()=>{t.off(`error`,i);let e=t.address();typeof e==`object`&&e&&(O=e.port),n()})})}};try{try{await ae(e.port)}catch(t){if(e.fallbackToKernel===!0&&re(t))await ie(),await ae(0);else throw t}}catch(e){await ie();try{c(_)}catch{}throw e}let oe=O;C=oe,l(_,oe);let k=e.scheduler??h,A=e.safetyNetMs??432e5,j=null,M=!1,N=!1,P=()=>{M||(M=!0,j!==null&&(k.clearTimeout(j),j=null))},F=()=>{if(P(),!N){N=!0;try{c(_)}catch{}}},I=()=>{M||A<=0||(j!==null&&(k.clearTimeout(j),j=null),j=k.setTimeout(()=>{j=null,console.warn(`[ui] safety-net (${A}ms) reached — shutting down (D-025 backstop)`);try{e.onSafetyNet?.()}catch{}E();for(let e of D)try{e.close()}catch{}F()},A))},se=()=>{M||A<=0||I()};return ee=se,I(),{httpServers:D,port:oe,release:F,detachSafetyNet:P,nudgeSafetyNet:se,drainUpgradeSockets:E}}function Pr(e,t){$(e,404,`urn:ok:error:not-found`,`Resource not found.`,t===void 0?void 0:`Path: ${t}`)}function Fr(e,t){if(e!==void 0){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<0||t>65535)throw Error(`Invalid --port value '${e}'`);return{port:t,fallbackToKernel:!1}}if(t!==void 0&&t!==``){let e=Number.parseInt(t,10);if(Number.isNaN(e)||e<0||e>65535)throw Error(`Invalid PORT env value '${t}'`);return{port:e,fallbackToKernel:!1}}return{port:Ar,fallbackToKernel:!0}}async function Ir(e){let t=e.readLock??(async()=>{let{readUiLock:t}=await import(`./dist-BJWJRYPN.mjs`);return t(e.lockDir)}),n=await t();if(!n)throw Error(`UI lock collision reported but the lock disappeared before handling — retry acquiring.`);if(n.port===e.requestedPort&&n.port>0)return{mode:`already-running`,port:n.port};let r=n.port;if(r===0){let n=Date.now()+(e.pollDeadlineMs??2e3),i=e.pollIntervalMs??100;for(;Date.now()<n;){await new Promise(e=>{setTimeout(e,i)});let e=await t();if(e&&e.port>0){r=e.port;break}}if(r===0)throw Error("UI did not bind within 2s; run `ok clean`");if(r===e.requestedPort)return{mode:`already-running`,port:r}}return{mode:`proxy`,handle:await Dr({listenPort:e.requestedPort,host:e.host,upstreamHost:`localhost`,upstreamPort:r}),upstreamPort:r}}function Lr(e){return new i(`ui`).description(`Serve the Open Knowledge React editor UI`).option(`-p, --port <port>`,`UI port (default: $PORT env or ${Ar}, kernel-allocated fallback if busy)`).option(`-H, --host <host>`,"UI host. Default: two-socket loopback bind (`[::1]` + `127.0.0.1`) so cross-family collisions fail loud. Pass an explicit host (e.g. `127.0.0.1`, `0.0.0.0`) to bind a single socket on that host.").action(async t=>{let{dim:n}=await import(`./colors-BCE2jNgl.mjs`),{UiLockCollisionError:r}=await import(`./dist-BJWJRYPN.mjs`),{resolveLockDir:i}=await import(`./dist-BJWJRYPN.mjs`),a=e(),o=t.host,s;try{s=Fr(t.port,process.env.PORT)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1;return}let c=s.port;try{let e=await Nr({config:a,cwd:process.cwd(),port:c,fallbackToKernel:s.fallbackToKernel,host:o}),t=o===void 0||o===`::`||o===`0.0.0.0`?`localhost`:o;console.log(`${n(`[ui]`)} listening on http://${t}:${e.port}`);let r=!1,i=t=>{if(r)return;r=!0,console.log(n(`\n[ui] Shutting down (${t})`)),e.detachSafetyNet();let i=()=>{try{e.release()}finally{process.exit(process.exitCode??0)}};e.drainUpgradeSockets(),Mr(e.httpServers).then(i,i),setTimeout(i,2e3).unref()};process.once(`SIGINT`,()=>i(`SIGINT`)),process.once(`SIGTERM`,()=>i(`SIGTERM`));return}catch(e){if(!(e instanceof r))throw e;let t=i(process.cwd()),a=o??`localhost`,s;try{s=await Ir({requestedPort:c,host:a,lockDir:t})}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}if(s.mode===`already-running`){if(console.log(`UI already running at http://${a}:${s.port}`),Rr(process)){await new Promise(e=>{let t=t=>{console.log(n(`\n[ui-keepalive] Shutting down (${t})`)),e()};process.once(`SIGINT`,()=>t(`SIGINT`)),process.once(`SIGTERM`,()=>t(`SIGTERM`))});return}process.exit(0)}console.log(`UI running at http://${a}:${s.upstreamPort}; acting as HTTP proxy on port ${s.handle.port}`);let l=!1,u=e=>{l||(l=!0,console.log(n(`\n[ui-proxy] Shutting down (${e})`)),s.handle.close().finally(()=>process.exit(process.exitCode??0)),setTimeout(()=>process.exit(process.exitCode??0),2e3).unref())};process.once(`SIGINT`,()=>u(`SIGINT`)),process.once(`SIGTERM`,()=>u(`SIGTERM`))}})}function Rr(e){let t=e.stdout.isTTY===!0,n=typeof e.env.PORT==`string`&&e.env.PORT!==``;return!t||n}function zr(e){if(!L(e))return{};let t=z(e,`utf-8`).trim();if(t===``)return{};try{let n=JSON.parse(t);if(w(n))return n;throw Error(`${e} root must be a JSON object`)}catch(t){throw t instanceof SyntaxError?Error(`${e} contains invalid JSON: ${t.message}`):t}}function Br(e){if(!L(e))return{};let t=z(e,`utf-8`).trim();if(t===``)return{};try{let n=Fn(t);if(w(n))return n;throw Error(`${e} root must be a TOML table`)}catch(t){throw Error(`${e} contains invalid TOML: ${t instanceof Error?t.message:String(t)}`)}}function Vr(e,t){R(k(e),{recursive:!0}),B(e,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function Hr(e,t){R(k(e),{recursive:!0});let n=Gn(t);B(e,n.endsWith(`
|
|
405
|
+
`)?n:`${n}\n`,`utf-8`)}const Ur=e=>e!==`project`,Wr=e=>e!==`user`;async function Gr(){let e=await dn({message:`Where should the MCP server be configured?
|
|
406
|
+
`,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 Kr(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Gr)():`both`}const qr=`0.0.1`,Jr=`open-knowledge-ui`,Yr=[`-y`,`@inkeep/open-knowledge@latest`,`ui`];function Xr(e,t={}){let n=j(e,`.claude`,`launch.json`),r=t.cliPath===void 0?t.mode===`dev`?{name:Jr,runtimeExecutable:`node`,runtimeArgs:[cr(),`ui`],port:jr,autoPort:!0}:{name:Jr,runtimeExecutable:`npx`,runtimeArgs:[...Yr],port:jr,autoPort:!0}:{name:Jr,runtimeExecutable:t.cliPath,runtimeArgs:[`ui`],port:jr,autoPort:!0};try{if(nr(n,e),!L(n))return R(k(n),{recursive:!0}),B(n,`${JSON.stringify({version:qr,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=z(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!w(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>w(e)&&e.name===`open-knowledge-ui`);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??qr,configurations:a};return B(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function Zr(e,t,n){try{return L(e.detectPath?.(t,n)??k(e.configPath(t,n)))}catch{return!1}}function Qr(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)}}if(!i&&!n.skipAvailabilityCheck&&!Zr(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{nr(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`}}let s;try{s=e.format===`toml`?Br(o):zr(o)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let c=s[e.topLevelKey]??{},l=c[a],u;try{u=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)}}let d={...s,[e.topLevelKey]:{...c,[a]:u}};try{e.format===`toml`?Hr(o,d):Vr(o,d)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:l===void 0?`written`:`overwritten`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function $r(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function ei(e){let t=br(e.editors),n={mode:`published`,cliPath:e.cliPath,skipAvailabilityCheck:!0};return t.map(t=>Qr(t,``,n,e.home))}function ti(e,t,n,r){let i=ni(e,t,n,r);return i.kind===`present`?i.entry:null}function ni(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};let a;try{a=z(i,`utf-8`)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}if(a.trim()===``)return{kind:`corrupt`,error:`file is empty`};let o;try{o=e.format===`toml`?Br(i):zr(i)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}let s=o[e.topLevelKey];if(!w(s))return{kind:`no-entry`};let c=s[e.serverName(t)];return w(c)?{kind:`present`,entry:c}:{kind:`no-entry`}}async function ri(e={}){let t=P(e.cwd??process.cwd()),n=tr(t,{homeDir:e.home}),r=n.projectRoot,i=!L(j(r,`.ok`));n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&console.log(`[ok] Initialized OK at ${r} — opened parent of ${N(r,t)} because it contains a .git folder`);let a={mode:e.devMcp?`dev`:`published`},o=await c(r),s;try{s=Qn(r,{contentDir:n.defaultContentDir})}catch(t){let n=Q.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:o.didInit,claudeDesktopDetected:!1,mcpAction:`failed`,mcpPath:n,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`}}let l=await Kr({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),u=e.editors??ai(r,e.home),d=e.editors??ir.filter(e=>Q[e].projectConfigPath!==void 0),f=br(u),p=br(d),m=e.mcp===!1||l===null,h=Array.from(new Map([...f,...m?[]:p].map(e=>[e.id,e])).values()),g=f.filter(t=>Zr(t,r,e.home)),_=[],v=[],b=new Set;for(let t of h){if(m){let n=``;try{n=t.configPath(r,e.home)}catch{}_.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(Ur(l)&&f.includes(t)&&_.push(Qr(t,r,a,e.home)),Wr(l)&&p.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Qr(t,r,a,e.home,n);_.push(i),(i.action===`written`||i.action===`overwritten`)&&b.add(n)}}for(let e of p)e.projectSkillPath&&v.push(rr(e,r));let x=!m&&l!==null&&Wr(l)?p.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,C=m?[]:g.map(e=>$r(e,r)).filter(e=>e!==void 0).filter(e=>!b.has(e.path)),ee=g.some(e=>e.id===`claude`)&&!m?Xr(r,a):void 0,te=await(e.installUserSkill??S)({home:e.home}),w=y({home:e.home}),T=m?`skipped-flag`:`skipped-missing`,E=_.find(e=>e.editorId===`claude`)??_[0]??{action:T,configPath:Q.claude.configPath(r,e.home)};return{projectRoot:r,contentCreated:s.created,contentUpdated:s.updated,contentSkipped:s.skipped,editors:_,projectSkills:v,legacyProjectConfigs:C,launchJson:ee,skillInstall:te,didGitInit:o.didInit,claudeDesktopDetected:w,mcpAction:E.action,mcpPath:E.configPath,mcpError:`error`in E?E.error:void 0,projectScopeUnsupportedLabels:x}}function ii(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`),s=e=>{let n=e.configPath.startsWith(t)?N(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`);let c=j(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(O(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(O(`Content already present at ${c}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(O(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(O(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(O(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${E(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${E(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${ne(`FAILED`)}: ${r.error}`);break;case`skipped-flag`:break}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(O(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${ne(`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} ${N(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(O(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${E(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`failed`:n.push(` ${D(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${D(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.claudeDesktopDetected&&(n.push(``),n.push(`Claude Desktop App detected. To enable in Claude Chat & Cowork, run: ${O(`ok install-skill`)}`)),e.preview?(n.push(``),n.push(re(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${E(`✓`)} ${O(`Next steps:`)}`),n.push(` 1. Open your editor (${T(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${T(`ok seed`)} — empty repo, Karpathy 3-layer`),n.push(` - ${T(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${T(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${T(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${T(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
|
|
407
|
+
`)}function ai(e,t){let n=[];for(let r of ir)Zr(Q[r],e,t)&&n.push(r);return n}function oi(){return new i(`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`).addOption(new r(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).action(async e=>{let t=process.cwd(),n;try{n=await ri({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope})}catch(e){if(e instanceof s){process.stderr.write(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.
|
|
408
|
+
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-CjUoxpAO.mjs`),{loadConfig:t}=await import(`./loader-BlZXyEZs.mjs`),{resolveContentDir:r}=await import(`./dist-BJWJRYPN.mjs`),{config:i}=t(n.projectRoot),a=r(i,n.projectRoot);n.preview=e({projectDir:n.projectRoot,contentDir:a})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${ii(n,n.projectRoot)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{Te as A,ut as C,ot as D,ht as E,Ye as O,lt as S,dt as T,or as _,ii as a,Qn as b,Kr as c,Qr as d,ei as f,Q as g,ar as h,ai as i,W as j,Je as k,ri as l,ir as m,Yr as n,oi as o,Lr as p,ni as r,ti as s,Jr as t,Xr as u,rr as v,pt as w,ft as x,tr as y};
|
|
409
|
+
//# sourceMappingURL=init-ODP7H2_D.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-WypjL6D-.mjs";export{e as loadConfig};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Jr as e,
|
|
1
|
+
import{Jr as e,Ni as t,Yr as n,bi as r,f as i,pi as a}from"./dist-DRLITAOV.mjs";import{t as o}from"./constants-BkjoNZLk.mjs";import{t as s}from"./is-object-C-4FJ0rP.mjs";import{resolve as c}from"node:path";import{existsSync as l,readFileSync as u}from"node:fs";import{realpath as d}from"node:fs/promises";async function f(e){let t=c(e);try{return await d(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}}var p=t();function m(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];s(a)&&s(i)?n[r]=m(i,a):a!==void 0&&(n[r]=a)}return n}function h(e){if(!l(e))return{value:null,path:e,source:null,doc:null};let t;try{t=u(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,p.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return s(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}const g=[`include`,`exclude`];function _(e){let t="Run `ok config migrate` to strip the obsolete key from config.yml automatically, or remove it by hand.";return e===`exclude`?[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,t].join(` `):[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,t].join(` `)}function v(e){let t=e.value;if(!s(t))return[];let n=t.content;if(!s(n))return[];let i=[];for(let t of g)if(t in n){let n=[`content`,t],a;e.doc!==null&&e.source!==null&&(a=r({file:e.path,source:e.source,doc:e.doc,path:n})),i.push({code:`REMOVED_KEY`,path:n,redirect:_(t),...a===void 0?{}:{source:a}})}return i}function y(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=r({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...i,source:e}}return i})}function b(t){let r=t??process.cwd(),s=[],l=n(`user`,r),u=e({absPath:l}),d={};u.valid&&u.source!==void 0?(d=m(d,u.value),s.push(l)):u.valid;let f=c(r,`.ok`,o),p=h(f);if(p.value!==null){let e=v(p);if(e.length>0)throw Error(e.map(a).join(`
|
|
2
2
|
|
|
3
|
-
`));d=m(d,p.value),s.push(f)}x(d,[`upload`,`maxBytes`],`streaming uploads have no user-facing cap`),x(d,[`github`,`oauthAppClientId`],`use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID env var instead`),x(d,[`server`,`host`],`use the --host flag or HOST env var instead`),x(d,[`server`,`openOnAgentEdit`]),x(d,[`mcp`,`autoStart`],`to disable auto-start, set OK_MCP_AUTOSTART=0`),x(d,[`mcp`,`tools`,`read_document`,`historyDepth`]),x(d,[`mcp`,`tools`,`grep`,`maxResults`]),x(d,[`mcp`,`tools`,`search`,`maxResults`]),x(d,[`preview`,`baseUrl`],"preview URLs now resolve only to the running UI process — start one with `ok ui`");let g=
|
|
4
|
-
//# sourceMappingURL=loader-
|
|
3
|
+
`));d=m(d,p.value),s.push(f)}x(d,[`upload`,`maxBytes`],`streaming uploads have no user-facing cap`),x(d,[`github`,`oauthAppClientId`],`use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID env var instead`),x(d,[`server`,`host`],`use the --host flag or HOST env var instead`),x(d,[`server`,`openOnAgentEdit`]),x(d,[`mcp`,`autoStart`],`to disable auto-start, set OK_MCP_AUTOSTART=0`),x(d,[`mcp`,`tools`,`read_document`,`historyDepth`]),x(d,[`mcp`,`tools`,`grep`,`maxResults`]),x(d,[`mcp`,`tools`,`search`,`maxResults`]),x(d,[`preview`,`baseUrl`],"preview URLs now resolve only to the running UI process — start one with `ok ui`");let g=i.safeParse(d);if(!g.success){let e={code:`SCHEMA_INVALID`,issues:y(g.error.issues,p)};throw Error(a(e))}return{config:g.data,sources:s}}function x(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){if(!s(r))return;r=r[t[e]]}if(!s(r))return;let i=t[t.length-1];if(r[i]===void 0)return;let a=t.join(`.`);console.warn(`[config] ${a} is no longer user-configurable; ${n??`the value is hardcoded in @inkeep/open-knowledge-core`}. Remove the key to silence this warning.`)}function S(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=f(e.startupCwd);return async o=>{let s=await f(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,S as t};
|
|
4
|
+
//# sourceMappingURL=loader-WypjL6D-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-DLoNOk0M.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{bt as e}from"./dist-
|
|
1
|
+
import{bt as e}from"./dist-DRLITAOV.mjs";import"./constants-BkjoNZLk.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-DLoNOk0M.mjs.map
|