@inkeep/open-knowledge 0.36.0-beta.16 → 0.36.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-harness-probe-DzzmnVA9.mjs → acp-harness-probe-DtDd2u6r.mjs} +2 -2
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +14 -14
- package/dist/constants-q91ejZ7-.mjs +2 -0
- package/dist/git-handle-CLfKANP-.mjs +1 -0
- package/dist/{git-handle-YAE9YR9Q.mjs → git-handle-DJkXvQyT.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/init-BLU-WorV.mjs +1 -0
- package/dist/{init-Du1ej_je.mjs → init-COsFMQjY.mjs} +4 -4
- package/dist/{launch-json-removal-Co2Hh8Vw.mjs → launch-json-removal-BROlk022.mjs} +2 -2
- package/dist/loader-BJ9NUALr.mjs +1 -0
- package/dist/{loader-BahUa-3b.mjs → loader-RxK4JpJU.mjs} +2 -2
- package/dist/{open-browser-DCvMiuE2.mjs → open-browser-D5VB75t8.mjs} +2 -2
- package/dist/{preview-BYw1WeBG.mjs → preview-CeY3lUbe.mjs} +2 -2
- package/dist/preview-fkAWAOui.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-qrbfN_hT.js → ActivityModeContent-7Ju1D07l.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-Cvfawhbk.js → AgentDiffPane-Cub6qbMY.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-bJx9SPAk.js → AgentThreadClientBinder-DxlNn6Mx.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-FVyKUYn4.js → CodeMirrorPropInput-CJY8KWEi.js} +1 -1
- package/dist/public/assets/{DocumentContext-CqohW6HK.js → DocumentContext-D3kF9wYA.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-CcgSvQ6A.js → EnableSyncConfirmDialog-idXXn7xs.js} +1 -1
- package/dist/public/assets/{FeedbackForm-DBvah19I.js → FeedbackForm-27jX0dcM.js} +1 -1
- package/dist/public/assets/{GraphPanel-Mjv-X5q3.js → GraphPanel-BRaW5AJ8.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-Bo2SKCvD.js → ManagedArtifactProperties-BanX7mdQ.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-CHwk8X9A.js → McpConsentDialogBody-BniZeIL7.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-Lc_wkeTk.js → MermaidDocEditor-F8DqjnE9.js} +1 -1
- package/dist/public/assets/{PropertyPanel-CWk7Owsh.js → PropertyPanel-OEo2jkx9.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-CK-DnyaL.js → ReportBugDialogBody-BVYXAdHq.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-ze-PiYXj.js → SettingsDialogBody-DpIAa7tb.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-DpaA3c73.js → ShareBranchSwitchDialog-C1OUzjdZ.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-YFTm0V7j.js → ShareReceiveDialog-CzPBYHjM.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-BKohygIN.js → ShareReceiveMissDialog-jeMWaW7-.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-NFgoTzth.js → SkillEditorActions-DOGSkeW2.js} +1 -1
- package/dist/public/assets/{SourceEditor-SkmtOPTX.js → SourceEditor-0PsKl2po.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Cnb9VX0H.js → TerminalPanel-BOvBHivU.js} +1 -1
- package/dist/public/assets/{TerminalSessionsHost-CvmeW7ge.js → TerminalSessionsHost-D3GT5F61.js} +2 -2
- package/dist/public/assets/{TerminalWindowApp-ffE-YlAF.js → TerminalWindowApp-DumSTDXA.js} +1 -1
- package/dist/public/assets/{ThreadView-CPK3cy1g.js → ThreadView-BHMbeBxX.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-C0-96_f4.js → TimelineDiffPane-BdGwBcWi.js} +1 -1
- package/dist/public/assets/{agent-diff-store-FqhWnB1D.js → agent-diff-store-ioTKnrp1.js} +1 -1
- package/dist/public/assets/{agent-visibility-DBtc7Shk.js → agent-visibility-DUG3FocN.js} +1 -1
- package/dist/public/assets/{auth-state-cache-B1bVTqEC.js → auth-state-cache-D3_VBPHk.js} +1 -1
- package/dist/public/assets/{client-version-CQymDMCB.js → client-version-CTfq7LXl.js} +1 -1
- package/dist/public/assets/{config-provider-DI7r73Nd.js → config-provider-B-7_o96p.js} +1 -1
- package/dist/public/assets/{dist-BkWgKwL8.js → dist-Bk124lrj.js} +127 -127
- package/dist/public/assets/{dist-DxFAhXtF.js → dist-Zzd2nZxv.js} +1 -1
- package/dist/public/assets/{doc-hash-C2yzLzvC.js → doc-hash-_aupPB7B.js} +1 -1
- package/dist/public/assets/{documents-events-DFEJCEAH.js → documents-events-D-zJruLR.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-DsS-GlIJ.js → file-tree-adapter-DcNETY_g.js} +1 -1
- package/dist/public/assets/{index-DfsjrLRd.js → index-CFRDunzS.js} +8 -8
- package/dist/public/assets/{keyboard-shortcuts-BGMZ9cie.js → keyboard-shortcuts-DxVjq-52.js} +1 -1
- package/dist/public/assets/{lint-config-client-CZn0-gAF.js → lint-config-client-BWBjtL6r.js} +1 -1
- package/dist/public/assets/{navigation-targets-Cpyiq5H8.js → navigation-targets-DhBfisfD.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-CQh16KDe.js → open-managed-artifact-tab-n1dyNhLH.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-DqtCdodL.js → pending-receive-nav-store-DMPvyqg1.js} +1 -1
- package/dist/public/assets/{prop-types-RdE5afNb.js → prop-types-75t_SaGz.js} +1 -1
- package/dist/public/assets/{receive-store-Ee26DxGG.js → receive-store-Birqy1T9.js} +1 -1
- package/dist/public/assets/{selection-context-CMx7CxBa.js → selection-context-BtAV4KL_.js} +1 -1
- package/dist/public/assets/{skill-actions-CQXOnr4t.js → skill-actions-BcObxQjV.js} +1 -1
- package/dist/public/assets/{skills-api-C96PbajH.js → skills-api-PvJ_IOtz.js} +1 -1
- package/dist/public/assets/{src-Cagh2-BH.js → src-CTFg8_9J.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-DzipyQZ8.js → target-navigation-intent-BeK3bA-h.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-Bl2a7__w.js → terminal-launch-events-DhHDzRBy.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-CVI6nvoX.js → terminal-telemetry-BK9o_BV3.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BrJ0HHfX.js → typing-burst-detector-CXmCEdH9.js} +1 -1
- package/dist/public/assets/{use-activity-panel-D9QIVAJd.js → use-activity-panel-ylq6PWCA.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-C5vmf6FI.js → use-apply-config-color-theme-CT1gUeuw.js} +1 -1
- package/dist/public/assets/{use-collab-url-Cxq57E64.js → use-collab-url-DO9Z6k14.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-BPIU0Cdf.js → use-live-xterm-theme-D-qXKY6i.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-ZRX9c0vL.js → use-terminal-enabled-BQn-DIW1.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-oV4K3ZWd.js → use-timeline-entry-diff-DJJrq2j4.js} +1 -1
- package/dist/public/assets/{use-workspace-DARs7MLm.js → use-workspace-BRK6bndk.js} +1 -1
- package/dist/public/assets/{workspace-paths-CVu5q0EP.js → workspace-paths-BaMTcn1O.js} +1 -1
- package/dist/public/assets/{zod-D8hNdqFI.js → zod-dP0-6rtx.js} +1 -1
- package/dist/public/index.html +35 -35
- package/dist/{repair-launch-json-BTMqUbuK.mjs → repair-launch-json-O2wT2hWm.mjs} +2 -2
- package/dist/{repair-mcp-configs-DDFw8jyo.mjs → repair-mcp-configs-BAPHGYKS.mjs} +2 -2
- package/dist/repair-skills-CLnEB5DY.mjs +1 -0
- package/dist/{repair-skills-Ds2IYnpp.mjs → repair-skills-CNHotj-z.mjs} +2 -2
- package/dist/server-lock-BECLNx_T.mjs +1 -0
- package/dist/server-lock-CZUtoKxB.mjs +2 -0
- package/dist/src-BG_IUe5R.mjs +3262 -0
- package/dist/{src-DgWjvSDo.mjs → src-DEZ0AEqj.mjs} +4 -4
- package/dist/{src-Cus5RnL8.mjs → src-DTPLCYnP.mjs} +77 -77
- package/dist/{src-BI0dWmz0.mjs → src-VjJUBnUL.mjs} +1 -1
- package/dist/start-BR23L7tq.mjs +1 -0
- package/dist/start-COR_P6jO.mjs +3 -0
- package/dist/{write-project-skill-Ct6JxGJ6.mjs → write-project-skill-thWIVGxh.mjs} +4 -4
- package/package.json +5 -5
- package/dist/constants-DMEiZNZI.mjs +0 -2
- package/dist/git-handle-ip9_uwkn.mjs +0 -1
- package/dist/init-DC_diOY8.mjs +0 -1
- package/dist/loader-iNgaaI6Q.mjs +0 -1
- package/dist/preview-Cg9TMkgu.mjs +0 -1
- package/dist/repair-skills-CuU6zHmH.mjs +0 -1
- package/dist/server-lock-0xVm4FnC.mjs +0 -2
- package/dist/server-lock-CTzXqyfA.mjs +0 -1
- package/dist/src-CZe5oBcp.mjs +0 -3262
- package/dist/start-DKzs2lPa.mjs +0 -3
- package/dist/start-DsChVTte.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Aa as e,C as t,Ha as n,ba as r,d as i,ia as a,l as o,na as s,ra as c,va as l,y as u}from"./src-Cus5RnL8.mjs";import{$ as d,$i as f,$r as p,$t as m,A as h,Ai as g,An as _,Ar as v,At as y,B as b,Bi as x,Bn as S,Br as C,Bt as w,C as T,Ci as E,Cn as D,Cr as O,Ct as k,D as A,Di as j,Dn as M,Dr as N,Dt as P,E as F,Ei as I,En as L,Er as R,Et as z,F as B,Fi as V,Fn as H,Fr as U,Ft as W,G,Gi as K,Gn as q,Gr as J,Gt as Y,H as X,Hi as Z,Hn as Q,Hr as $,Ht as ee,I as te,Ii as ne,In as re,Ir as ie,It as ae,J as oe,Ji as se,Jn as ce,Jr as le,Jt as ue,K as de,Ki as fe,Kn as pe,Kr as me,Kt as he,L as ge,Li as _e,Ln as ve,Lr as ye,Lt as be,M as xe,Mi as Se,Mn as Ce,Mr as we,Mt as Te,N as Ee,Ni as De,Nn as Oe,Nr as ke,Nt as Ae,O as je,Oi as Me,On as Ne,Or as Pe,Ot as Fe,P as Ie,Pi as Le,Pn as Re,Pr as ze,Pt as Be,Q as Ve,Qi as He,Qn as Ue,Qr as We,Qt as Ge,R as Ke,Ri as qe,Rn as Je,Rr as Ye,Rt as Xe,S as Ze,Si as Qe,Sn as $e,Sr as et,St as tt,T as nt,Ti as rt,Tn as it,Tr as at,Tt as ot,U as st,Ui as ct,Un as lt,Ur as ut,Ut as dt,V as ft,Vi as pt,Vn as mt,Vr as ht,Vt as gt,W as _t,Wi as vt,Wn as yt,Wr as bt,Wt as xt,X as St,Xi as Ct,Xn as wt,Xr as Tt,Xt as Et,Y as Dt,Yi as Ot,Yn as kt,Yr as At,Yt as jt,Z as Mt,Zi as Nt,Zn as Pt,Zr as Ft,Zt as It,_ as Lt,_i as Rt,_n as zt,_r as Bt,_t as Vt,a as Ht,aa as Ut,ai as Wt,an as Gt,ar as Kt,at as qt,b as Jt,bi as Yt,bn as Xt,br as Zt,bt as Qt,c as $t,ca as en,ci as tn,cn as nn,cr as rn,d as an,di as on,dn as sn,dr as cn,ea as ln,ei as un,en as dn,et as fn,f as pn,fi as mn,fn as hn,fr as gn,g as _n,gi as vn,gn as yn,gr as bn,gt as xn,h as Sn,hi as Cn,hn as wn,hr as Tn,ht as En,i as Dn,ia as On,ii as kn,in as An,ir as jn,it as Mn,j as Nn,ji as Pn,jn as Fn,jr as In,jt as Ln,k as Rn,ki as zn,kn as Bn,kr as Vn,kt as Hn,l as Un,la as Wn,li as Gn,ln as Kn,lr as qn,m as Jn,mi as Yn,mn as Xn,mr as Zn,mt as Qn,n as $n,na as er,ni as tr,nn as nr,nt as rr,o as ir,oa as ar,oi as or,on as sr,or as cr,ot as lr,p as ur,pi as dr,pn as fr,pr,q as mr,qi as hr,qn as gr,qr as _r,qt as vr,r as yr,ra as br,ri as xr,rn as Sr,rt as Cr,s as wr,sa as Tr,si as Er,sn as Dr,sr as Or,st as kr,t as Ar,ta as jr,ti as Mr,tn as Nr,tt as Pr,u as Fr,ua as Ir,ui as Lr,un as Rr,ur as zr,v as Br,vi as Vr,vn as Hr,vr as Ur,vt as Wr,w as Gr,wi as Kr,wn as qr,wr as Jr,wt as Yr,x as Xr,xi as Zr,xn as Qr,xr as $r,xt as ei,y as ti,yi as ni,yn as ri,yr as ii,yt as ai,z as oi,zi as si,zn as ci,zr as li,zt as ui}from"./src-CZe5oBcp.mjs";import{C as di,E as fi,T as pi,_ as mi,b as hi,c as gi,d as _i,g as vi,i as yi,l as bi,m as xi,n as Si,p as Ci,s as wi,t as Ti,u as Ei,v as Di,w as Oi,x as ki,y as Ai}from"./fs-traced-BISd_YTv.mjs";import{a as ji,d as Mi,f as Ni,i as Pi,l as Fi,n as Ii,r as Li,t as Ri,u as zi}from"./logger-CFNLuVy2.mjs";import{_ as Bi,a as Vi,b as Hi,c as Ui,f as Wi,g as Gi,h as Ki,i as qi,l as Ji,m as Yi,n as Xi,o as Zi,p as Qi,r as $i,s as ea,t as ta,u as na,v as ra,y as ia}from"./server-lock-0xVm4FnC.mjs";export{jr as AGENT_ID_MAX_LEN,er as AGENT_ID_RE,V as AGENT_WRITE_ORIGIN,en as AcpPermissionStore,Ut as AcpRegistry,Se as AcpThreadManager,g as AgentFocusBroadcaster,zn as AgentPresenceBroadcaster,ne as AgentSessionCapacityError,_e as AgentSessionManager,En as AutoStartDisabledError,ci as BUNDLE_IDS,S as BUNDLE_SCOPE,mt as BUNDLE_SKILL_NAME,Gt as BacklinkIndex,vt as CC1Broadcaster,r as CC1_CONTRACT_VERSION,jt as CONFIG_FILENAME,Lr as CONFLICT_MARKER_RE,rn as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Lt as ConfigSchema,At as DEFAULT_CHECKPOINT_RETENTION,et as DEFAULT_EMBEDDINGS_DIMENSIONS,z as DEFAULT_PACK_ID,O as EMBEDDINGS_API_KEY_ENV,ar as FEATURED_AGENT_IDS,Tt as FILE_SYSTEM_WRITER,me as FILE_WATCHER_ORIGIN,Bt as FileEmbeddingsBackend,xt as GIT_PREFLIGHT_FAIL_SPAN_NAME,Ft as GIT_UPSTREAM_WRITER,Wn as GitDirAccessError,hn as GitNotAvailableError,fr as GitTooOldError,Zr as HOCUSPOCUS_AUTH_REJECTION_REASONS,Qe as HocuspocusAuthRejection,E as HocuspocusAuthTokenSchema,Zn as INSTALLED_AGENTS_SCHEMES,l as LINEAGE_EPOCH_KEY,Ke as LIVE_DERIVED_INDEX_DEBOUNCE_MS,P as LOG_MD_TEMPLATE,Vt as MANAGED_RENAME_ORIGIN,De as MAX_ACP_THREADS,qe as MAX_AGENT_SESSIONS,lr as MCP_CONNECTION_ID_HEADER,s as MCP_SERVER_NAME,si as MIN_EVICTABLE_IDLE_MS,Xn as MIN_GIT_VERSION,ft as MISSING_OK_CONFIG_MESSAGE,Ir as MalformedGitPointerError,Ve as McpLogger,X as MissingOkConfigError,v as OBSERVER_SYNC_ORIGIN,Et as OK_OKIGNORE_TEMPLATE,c as ORPHAN_MODES,n as PROTOCOL_VERSION,Ri as PinoLogger,Ui as ProcessLockCollisionError,Un as ProjectGitInitError,Wr as ROLLBACK_ORIGIN,It as ROOT_GITIGNORE_TEMPLATE,Gi as RUNTIME_VERSION,We as SERVICE_WRITER,Re as SKILL_INSTALL_EVENTS_FILE_REL,u as SKILL_STATE_TARGETS,Fe as STARTER_FOLDERS,Hn as STARTER_FOLDER_FRONTMATTER_FILENAME,y as STARTER_PACKS,Ln as STARTER_PACK_IDS,Te as STARTER_TEMPLATES,F as STATE_MANIFEST_FILENAME,Bi as STATE_SCHEMA_VERSION,e as SYSTEM_DOC_NAME,Xe as SeedPrerequisiteError,ui as SeedRootDirError,ta as ServerLockCollisionError,Ar as SingleFileNotAFileError,$n as SingleFileNotFoundError,yr as SingleFileNotMarkdownError,A as StateManifestError,nt as TagIndex,Q as USER_GLOBAL_BUNDLE_IDS,Dr as UiLockCollisionError,ai as __getShowAllWalkStatsForTesting,Qt as __resetShowAllWalkStatsForTesting,Ji as acquireProcessLock,Xi as acquireServerLock,nn as acquireUiLock,x as applyAgentMarkdownWrite,_r as applyExternalChange,ot as applySeed,je as assertCompatibleStateManifest,wn as assertGitAvailable,ze as assertNeverDiskEvent,Pn as attachAcpThreadSocket,Qn as attachIdleShutdown,Br as bootServer,qr as buildAndOpenSkill,Ge as buildConfigYmlContent,mr as buildExecResult,Le as buildOkMcpStdioCommand,re as buildSkillZip,Ae as buildStarterFolderFrontmatterYaml,p as buildWipTree,lt as bundleSkillMdPath,U as classifyEvents,Ti as classifyFsPath,Yn as clearContributors,Ur as clearEmbeddingsKeyFromAllBackends,Be as coercePackId,o as colorFromSeed,un as commitUpstreamImport,Mr as commitWip,tr as commitWipFromTree,yn as compareSemver,pe as composeEffectiveLinterConfig,on as containsConflictMarkers,ie as contentHash,Cn as contributorCount,Ie as countShadowObjects,B as countStaleAgentWipRefs,te as countWipRefs,ei as createApiExtension,N as createAssetServeMiddleware,jn as createContentFilter,Kt as createContentFilterAsync,ii as createEmbeddingsSecretStore,Dn as createEphemeralProjectDir,le as createExternalChangeHandler,pn as createFileLogger,oi as createLiveDerivedIndexExtension,G as createMcpHttpHandler,Tn as createOsProbe,Pe as createPersistenceExtension,T as createServer,xe as createServerObserverExtension,pt as createStreamingErrorWriter,Ii as createTestLogger,Zt as describeStoredEmbeddingsKey,_n as detectClaudeDesktopPresence,zt as detectGit,Rn as detectProjectShape,Pr as discoverLockDirs,kt as discoverMarkdownlintConfig,Y as emitPreflightFailureSpan,oe as encodeDocName,Dt as encodeFolderRoute,St as encodeSkillRoute,Fr as ensureProjectGit,m as ensureProjectSkillGitignore,Z as errorResponse,ye as evictStaleTrackerEntries,rr as extractOkBinaryPath,sr as extractWikiLinksFromMarkdown,Hr as fallbackPaths,an as findEnclosingGitRoot,Sr as findEnclosingProjectRoot,wt as findNativeMarkdownlintFile,ur as flushFileLogger,Kr as formatAuthRejectionWire,vn as formatContributors,Rt as formatContributorsFrom,k as formatPackRationale,xr as gcCheckpointRefs,d as getCurrentMcpLogger,Jr as getLocalDir,Jn as getLogFilePath,Li as getLogger,Sn as getLogsDir,ra as getMachineId,Ai as getMeter,Ct as getMetrics,hi as getTracer,Nt as handleCollabSocketError,qn as handleSpawnCursor,ge as hasGcLogLatch,i as iconFromClientName,He as incrementCollabSocketFilteredError,f as incrementServerObserverFire,dn as initContent,kn as initShadowRepo,ki as initTelemetry,Jt as initToleranceTelemetryWriter,qt as installPrettyZodErrors,Pi as installTestLoggers,it as installUserSkill,Me as isAllowedApiOrigin,w as isAllowedWorkspaceHostHeader,K as isConfigDoc,rt as isHocuspocusAuthRejectionReason,W as isKnownPackId,fe as isLinkIndexExcludedDoc,gt as isLoopbackAddress,hr as isManagedArtifactDoc,a as isOrphanMode,In as isPairedWriteOrigin,zr as isPathWithinDir,ia as isProcessAlive,An as isProjectRoot,Xt as isProjectSkillManaged,se as isReservedForUserTree,Ye as isSelfWrite,Ot as isSystemDoc,Xr as isToleranceTelemetryEnabled,Hi as isValidLockPid,li as lastKnownHash,Wt as listRescueCheckpoints,ae as listStarterPacks,Tr as loadCustomAgents,Ee as loadPrincipal,na as lockFilePath,ji as loggerFactory,Fi as logsCurrentPath,zi as logsPreviousPath,$r as makeLazyEmbeddingsKeyStore,$i as markServerLockDraining,st as mountMcpAndApi,Si as normalizeFsPath,yt as originGitHubHost,Nr as packageVersionMajorMinor,I as parseAuthRejectionWire,ri as parseGitVersion,j as parseHocuspocusAuthToken,_t as parseKeepaliveConnectionId,C as pathToDocName,Yr as planSeed,Ht as prepareSingleFileOpen,Cr as processCommand,Mn as processUsage,L as readAllTargets,M as readBundleDecision,Pt as readOwnNativeRules,Wi as readProcessLock,Qi as readProcessLockDetailed,b as readProjectHeadState,bn as readProjectLocalSemanticConfig,qi as readServerLock,Ne as readServerPackageVersion,Bn as readSkillInstallStateSnapshot,Qr as readSkillManagement,h as readStateManifest,_ as readTargetRecordedAt,Fn as readTargetVersion,Kn as readUiLock,mn as reconcile,Vr as recordContributor,H as recordSkillInstallEvent,de as registerAllTools,ht as registerWrite,Yi as releaseProcessLock,Vi as releaseServerLock,Rr as releaseUiLock,$ as removeLastKnownHash,ln as resetMetrics,t as resolveBundleEnabled,ve as resolveBundledSkillDir,at as resolveContentDir,cn as resolveCursorBinaryDefault,gn as resolveCursorSpawnInvocation,gr as resolveEffectiveLinterConfig,R as resolveLockDir,ce as resolveNativeConfigForDoc,Ue as resolveNativeMarkdownlintConfig,be as resolvePack,wr as resolvePackageVersion,Mt as resolveUiInfo,ni as restoreContributors,ti as restoreLifecycleFromConflictsJson,cr as rewriteMarkdownLinksForDocumentRename,Or as rewriteWikiLinksForDocumentRename,he as runAuthReposSubprocess,vr as runAuthStatusSubprocess,ee as runCloneSubprocess,ue as runDeviceFlowSubprocess,fn as runWithMcpLogger,Vn as safeContentPath,tt as safeSubdir,or as safetyCheckpoint,kr as sanitizeClientName,Er as saveInMemoryCheckpoint,tn as saveVersion,xn as seedBasenameIndex,ir as serializeError,di as setActiveSpanAttributes,we as setupServerObservers,Gn as shadowGit,Oi as shutdownTelemetry,$e as skillManagementPath,Mi as spansCurrentPath,Ni as spansPreviousPath,pr as spawnDetached,dr as splitMarkdownBlocks,ut as startWatcher,ct as streamingProblemEvent,Yt as swapContributors,Ze as teardownToleranceTelemetryWriter,br as toBroadcasterKey,yi as tracedAppendFileSync,wi as tracedLinkSync,gi as tracedMkdir,bi as tracedMkdirSync,Ei as tracedRename,_i as tracedRenameSync,Ci as tracedRmSync,xi as tracedRmdirSync,vi as tracedUnlinkSync,mi as tracedWriteFile,Di as tracedWriteFileSync,Gr as trustSystemCertificates,$t as untrackTrackedProjectSkillProjection,bt as updateLastKnownHash,Ki as updateProcessLockPort,Zi as updateServerLockPort,sn as updateUiLockPort,On as validateAgentId,dt as validateCloneInputs,Je as validateSkillZip,ea as waitForServerLockDrain,ke as withHiddenWindowsConsole,pi as withSpan,fi as withSpanSync,Ce as writeBundleDecision,q as writeMarkdownlintRule,nr as writeRootGitignoreForNewRepo,D as writeSkillManagement,Nn as writeStateManifest,Oe as writeTargetVersion,J as writeTracker};
|
|
1
|
+
import{C as e,Ma as t,Sa as n,Wa as r,aa as i,ba as a,d as o,ia as s,l as c,oa as l,y as u}from"./src-DTPLCYnP.mjs";import{$ as d,$i as f,$r as p,$t as m,A as h,Ai as g,An as _,Ar as v,At as y,B as b,Bi as x,Bn as S,Br as C,Bt as w,C as T,Ci as E,Cn as D,Cr as O,Ct as k,D as A,Di as j,Dn as M,Dr as N,Dt as P,E as F,Ei as I,En as L,Er as R,Et as z,F as B,Fi as V,Fn as H,Fr as U,Ft as W,G,Gi as K,Gn as q,Gr as J,Gt as Y,H as X,Hi as Z,Hn as Q,Hr as $,Ht as ee,I as te,Ii as ne,In as re,Ir as ie,It as ae,J as oe,Ji as se,Jn as ce,Jr as le,Jt as ue,K as de,Ki as fe,Kn as pe,Kr as me,Kt as he,L as ge,Li as _e,Ln as ve,Lr as ye,Lt as be,M as xe,Mi as Se,Mn as Ce,Mr as we,Mt as Te,N as Ee,Ni as De,Nn as Oe,Nr as ke,Nt as Ae,O as je,Oi as Me,On as Ne,Or as Pe,Ot as Fe,P as Ie,Pi as Le,Pn as Re,Pr as ze,Pt as Be,Q as Ve,Qi as He,Qn as Ue,Qr as We,Qt as Ge,R as Ke,Ri as qe,Rn as Je,Rr as Ye,Rt as Xe,S as Ze,Si as Qe,Sn as $e,Sr as et,St as tt,T as nt,Ti as rt,Tn as it,Tr as at,Tt as ot,U as st,Ui as ct,Un as lt,Ur as ut,Ut as dt,V as ft,Vi as pt,Vn as mt,Vr as ht,Vt as gt,W as _t,Wi as vt,Wn as yt,Wr as bt,Wt as xt,X as St,Xi as Ct,Xn as wt,Xr as Tt,Xt as Et,Y as Dt,Yi as Ot,Yn as kt,Yr as At,Yt as jt,Z as Mt,Zi as Nt,Zn as Pt,Zr as Ft,Zt as It,_ as Lt,_i as Rt,_n as zt,_r as Bt,_t as Vt,a as Ht,aa as Ut,ai as Wt,an as Gt,ar as Kt,at as qt,b as Jt,bi as Yt,bn as Xt,br as Zt,bt as Qt,c as $t,ca as en,ci as tn,cn as nn,cr as rn,d as an,di as on,dn as sn,dr as cn,ea as ln,ei as un,en as dn,et as fn,f as pn,fi as mn,fn as hn,fr as gn,g as _n,gi as vn,gn as yn,gr as bn,gt as xn,h as Sn,hi as Cn,hn as wn,hr as Tn,ht as En,i as Dn,ia as On,ii as kn,in as An,ir as jn,it as Mn,j as Nn,ji as Pn,jn as Fn,jr as In,jt as Ln,k as Rn,ki as zn,kn as Bn,kr as Vn,kt as Hn,l as Un,la as Wn,li as Gn,ln as Kn,lr as qn,m as Jn,mi as Yn,mn as Xn,mr as Zn,mt as Qn,n as $n,na as er,ni as tr,nn as nr,nt as rr,o as ir,oa as ar,oi as or,on as sr,or as cr,ot as lr,p as ur,pi as dr,pn as fr,pr,q as mr,qi as hr,qn as gr,qr as _r,qt as vr,r as yr,ra as br,ri as xr,rn as Sr,rt as Cr,s as wr,sa as Tr,si as Er,sn as Dr,sr as Or,st as kr,t as Ar,ta as jr,ti as Mr,tn as Nr,tt as Pr,u as Fr,ua as Ir,ui as Lr,un as Rr,ur as zr,v as Br,vi as Vr,vn as Hr,vr as Ur,vt as Wr,w as Gr,wi as Kr,wn as qr,wr as Jr,wt as Yr,x as Xr,xi as Zr,xn as Qr,xr as $r,xt as ei,y as ti,yi as ni,yn as ri,yr as ii,yt as ai,z as oi,zi as si,zn as ci,zr as li,zt as ui}from"./src-BG_IUe5R.mjs";import{C as di,E as fi,T as pi,_ as mi,b as hi,c as gi,d as _i,g as vi,i as yi,l as bi,m as xi,n as Si,p as Ci,s as wi,t as Ti,u as Ei,v as Di,w as Oi,x as ki,y as Ai}from"./fs-traced-BISd_YTv.mjs";import{a as ji,d as Mi,f as Ni,i as Pi,l as Fi,n as Ii,r as Li,t as Ri,u as zi}from"./logger-CFNLuVy2.mjs";import{S as Bi,_ as Vi,a as Hi,c as Ui,f as Wi,g as Gi,h as Ki,i as qi,l as Ji,m as Yi,n as Xi,o as Zi,p as Qi,r as $i,s as ea,t as ta,u as na,v as ra,x as ia}from"./server-lock-CZUtoKxB.mjs";export{jr as AGENT_ID_MAX_LEN,er as AGENT_ID_RE,V as AGENT_WRITE_ORIGIN,en as AcpPermissionStore,Ut as AcpRegistry,Se as AcpThreadManager,g as AgentFocusBroadcaster,zn as AgentPresenceBroadcaster,ne as AgentSessionCapacityError,_e as AgentSessionManager,En as AutoStartDisabledError,ci as BUNDLE_IDS,S as BUNDLE_SCOPE,mt as BUNDLE_SKILL_NAME,Gt as BacklinkIndex,vt as CC1Broadcaster,n as CC1_CONTRACT_VERSION,jt as CONFIG_FILENAME,Lr as CONFLICT_MARKER_RE,rn as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Lt as ConfigSchema,At as DEFAULT_CHECKPOINT_RETENTION,et as DEFAULT_EMBEDDINGS_DIMENSIONS,z as DEFAULT_PACK_ID,O as EMBEDDINGS_API_KEY_ENV,ar as FEATURED_AGENT_IDS,Tt as FILE_SYSTEM_WRITER,me as FILE_WATCHER_ORIGIN,Bt as FileEmbeddingsBackend,xt as GIT_PREFLIGHT_FAIL_SPAN_NAME,Ft as GIT_UPSTREAM_WRITER,Wn as GitDirAccessError,hn as GitNotAvailableError,fr as GitTooOldError,Zr as HOCUSPOCUS_AUTH_REJECTION_REASONS,Qe as HocuspocusAuthRejection,E as HocuspocusAuthTokenSchema,Zn as INSTALLED_AGENTS_SCHEMES,a as LINEAGE_EPOCH_KEY,Ke as LIVE_DERIVED_INDEX_DEBOUNCE_MS,P as LOG_MD_TEMPLATE,Vt as MANAGED_RENAME_ORIGIN,De as MAX_ACP_THREADS,qe as MAX_AGENT_SESSIONS,lr as MCP_CONNECTION_ID_HEADER,s as MCP_SERVER_NAME,si as MIN_EVICTABLE_IDLE_MS,Xn as MIN_GIT_VERSION,ft as MISSING_OK_CONFIG_MESSAGE,Ir as MalformedGitPointerError,Ve as McpLogger,X as MissingOkConfigError,v as OBSERVER_SYNC_ORIGIN,Et as OK_OKIGNORE_TEMPLATE,i as ORPHAN_MODES,r as PROTOCOL_VERSION,Ri as PinoLogger,Ui as ProcessLockCollisionError,Un as ProjectGitInitError,Wr as ROLLBACK_ORIGIN,It as ROOT_GITIGNORE_TEMPLATE,Gi as RUNTIME_VERSION,We as SERVICE_WRITER,Re as SKILL_INSTALL_EVENTS_FILE_REL,u as SKILL_STATE_TARGETS,Fe as STARTER_FOLDERS,Hn as STARTER_FOLDER_FRONTMATTER_FILENAME,y as STARTER_PACKS,Ln as STARTER_PACK_IDS,Te as STARTER_TEMPLATES,F as STATE_MANIFEST_FILENAME,Vi as STATE_SCHEMA_VERSION,t as SYSTEM_DOC_NAME,Xe as SeedPrerequisiteError,ui as SeedRootDirError,ta as ServerLockCollisionError,Ar as SingleFileNotAFileError,$n as SingleFileNotFoundError,yr as SingleFileNotMarkdownError,A as StateManifestError,nt as TagIndex,Q as USER_GLOBAL_BUNDLE_IDS,Dr as UiLockCollisionError,ai as __getShowAllWalkStatsForTesting,Qt as __resetShowAllWalkStatsForTesting,Ji as acquireProcessLock,Xi as acquireServerLock,nn as acquireUiLock,x as applyAgentMarkdownWrite,_r as applyExternalChange,ot as applySeed,je as assertCompatibleStateManifest,wn as assertGitAvailable,ze as assertNeverDiskEvent,Pn as attachAcpThreadSocket,Qn as attachIdleShutdown,Br as bootServer,qr as buildAndOpenSkill,Ge as buildConfigYmlContent,mr as buildExecResult,Le as buildOkMcpStdioCommand,re as buildSkillZip,Ae as buildStarterFolderFrontmatterYaml,p as buildWipTree,lt as bundleSkillMdPath,U as classifyEvents,Ti as classifyFsPath,Yn as clearContributors,Ur as clearEmbeddingsKeyFromAllBackends,Be as coercePackId,c as colorFromSeed,un as commitUpstreamImport,Mr as commitWip,tr as commitWipFromTree,yn as compareSemver,pe as composeEffectiveLinterConfig,on as containsConflictMarkers,ie as contentHash,Cn as contributorCount,Ie as countShadowObjects,B as countStaleAgentWipRefs,te as countWipRefs,ei as createApiExtension,N as createAssetServeMiddleware,jn as createContentFilter,Kt as createContentFilterAsync,ii as createEmbeddingsSecretStore,Dn as createEphemeralProjectDir,le as createExternalChangeHandler,pn as createFileLogger,oi as createLiveDerivedIndexExtension,G as createMcpHttpHandler,Tn as createOsProbe,Pe as createPersistenceExtension,T as createServer,xe as createServerObserverExtension,pt as createStreamingErrorWriter,Ii as createTestLogger,Zt as describeStoredEmbeddingsKey,_n as detectClaudeDesktopPresence,zt as detectGit,Rn as detectProjectShape,Pr as discoverLockDirs,kt as discoverMarkdownlintConfig,Y as emitPreflightFailureSpan,oe as encodeDocName,Dt as encodeFolderRoute,St as encodeSkillRoute,Fr as ensureProjectGit,m as ensureProjectSkillGitignore,Z as errorResponse,ye as evictStaleTrackerEntries,rr as extractOkBinaryPath,sr as extractWikiLinksFromMarkdown,Hr as fallbackPaths,an as findEnclosingGitRoot,Sr as findEnclosingProjectRoot,wt as findNativeMarkdownlintFile,ur as flushFileLogger,Kr as formatAuthRejectionWire,vn as formatContributors,Rt as formatContributorsFrom,k as formatPackRationale,xr as gcCheckpointRefs,d as getCurrentMcpLogger,Jr as getLocalDir,Jn as getLogFilePath,Li as getLogger,Sn as getLogsDir,ra as getMachineId,Ai as getMeter,Ct as getMetrics,hi as getTracer,Nt as handleCollabSocketError,qn as handleSpawnCursor,ge as hasGcLogLatch,o as iconFromClientName,He as incrementCollabSocketFilteredError,f as incrementServerObserverFire,dn as initContent,kn as initShadowRepo,ki as initTelemetry,Jt as initToleranceTelemetryWriter,qt as installPrettyZodErrors,Pi as installTestLoggers,it as installUserSkill,Me as isAllowedApiOrigin,w as isAllowedWorkspaceHostHeader,K as isConfigDoc,rt as isHocuspocusAuthRejectionReason,W as isKnownPackId,fe as isLinkIndexExcludedDoc,gt as isLoopbackAddress,hr as isManagedArtifactDoc,l as isOrphanMode,In as isPairedWriteOrigin,zr as isPathWithinDir,ia as isProcessAlive,An as isProjectRoot,Xt as isProjectSkillManaged,se as isReservedForUserTree,Ye as isSelfWrite,Ot as isSystemDoc,Xr as isToleranceTelemetryEnabled,Bi as isValidLockPid,li as lastKnownHash,Wt as listRescueCheckpoints,ae as listStarterPacks,Tr as loadCustomAgents,Ee as loadPrincipal,na as lockFilePath,ji as loggerFactory,Fi as logsCurrentPath,zi as logsPreviousPath,$r as makeLazyEmbeddingsKeyStore,$i as markServerLockDraining,st as mountMcpAndApi,Si as normalizeFsPath,yt as originGitHubHost,Nr as packageVersionMajorMinor,I as parseAuthRejectionWire,ri as parseGitVersion,j as parseHocuspocusAuthToken,_t as parseKeepaliveConnectionId,C as pathToDocName,Yr as planSeed,Ht as prepareSingleFileOpen,Cr as processCommand,Mn as processUsage,L as readAllTargets,M as readBundleDecision,Pt as readOwnNativeRules,Wi as readProcessLock,Qi as readProcessLockDetailed,b as readProjectHeadState,bn as readProjectLocalSemanticConfig,qi as readServerLock,Ne as readServerPackageVersion,Bn as readSkillInstallStateSnapshot,Qr as readSkillManagement,h as readStateManifest,_ as readTargetRecordedAt,Fn as readTargetVersion,Kn as readUiLock,mn as reconcile,Vr as recordContributor,H as recordSkillInstallEvent,de as registerAllTools,ht as registerWrite,Yi as releaseProcessLock,Hi as releaseServerLock,Rr as releaseUiLock,$ as removeLastKnownHash,ln as resetMetrics,e as resolveBundleEnabled,ve as resolveBundledSkillDir,at as resolveContentDir,cn as resolveCursorBinaryDefault,gn as resolveCursorSpawnInvocation,gr as resolveEffectiveLinterConfig,R as resolveLockDir,ce as resolveNativeConfigForDoc,Ue as resolveNativeMarkdownlintConfig,be as resolvePack,wr as resolvePackageVersion,Mt as resolveUiInfo,ni as restoreContributors,ti as restoreLifecycleFromConflictsJson,cr as rewriteMarkdownLinksForDocumentRename,Or as rewriteWikiLinksForDocumentRename,he as runAuthReposSubprocess,vr as runAuthStatusSubprocess,ee as runCloneSubprocess,ue as runDeviceFlowSubprocess,fn as runWithMcpLogger,Vn as safeContentPath,tt as safeSubdir,or as safetyCheckpoint,kr as sanitizeClientName,Er as saveInMemoryCheckpoint,tn as saveVersion,xn as seedBasenameIndex,ir as serializeError,di as setActiveSpanAttributes,we as setupServerObservers,Gn as shadowGit,Oi as shutdownTelemetry,$e as skillManagementPath,Mi as spansCurrentPath,Ni as spansPreviousPath,pr as spawnDetached,dr as splitMarkdownBlocks,ut as startWatcher,ct as streamingProblemEvent,Yt as swapContributors,Ze as teardownToleranceTelemetryWriter,br as toBroadcasterKey,yi as tracedAppendFileSync,wi as tracedLinkSync,gi as tracedMkdir,bi as tracedMkdirSync,Ei as tracedRename,_i as tracedRenameSync,Ci as tracedRmSync,xi as tracedRmdirSync,vi as tracedUnlinkSync,mi as tracedWriteFile,Di as tracedWriteFileSync,Gr as trustSystemCertificates,$t as untrackTrackedProjectSkillProjection,bt as updateLastKnownHash,Ki as updateProcessLockPort,Zi as updateServerLockPort,sn as updateUiLockPort,On as validateAgentId,dt as validateCloneInputs,Je as validateSkillZip,ea as waitForServerLockDrain,ke as withHiddenWindowsConsole,pi as withSpan,fi as withSpanSync,Ce as writeBundleDecision,q as writeMarkdownlintRule,nr as writeRootGitignoreForNewRepo,D as writeSkillManagement,Nn as writeStateManifest,Oe as writeTargetVersion,J as writeTracker};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,f as t,r as n}from"./start-COR_P6jO.mjs";export{n as bootStartServer,t as resolveHost,e as startCommand};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{L as e,P as t}from"./src-DTPLCYnP.mjs";import{Nr as n,a as r,in as i,xr as a}from"./src-BG_IUe5R.mjs";import{C as o,w as s}from"./write-project-skill-thWIVGxh.mjs";import{a as c,n as l,t as u}from"./acp-harness-probe-DtDd2u6r.mjs";import{n as d}from"./constants-q91ejZ7-.mjs";import{spawn as f}from"node:child_process";import{basename as p,dirname as m,join as h}from"node:path";import{closeSync as g,existsSync as _,mkdirSync as v,openSync as y,statSync as b}from"node:fs";import{homedir as x}from"node:os";import{rm as S}from"node:fs/promises";import{setTimeout as C}from"node:timers/promises";function w(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function T(e,t,r={}){let i=(r.spawn??f)(e,[...t],n({detached:!0,stdio:`ignore`,env:w(r.env??process.env)}));return i.unref(),i}const E=`OpenKnowledge.app`,D=`/Applications/${E}`;function O(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return b(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function k(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(A(e,D))return D;let t=h(e.homeDir??x(),`Applications`,E);return A(e,t)?t:null}function A(e,t){try{let n=h(t,`Contents`,`MacOS`,`OpenKnowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function j(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=k(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function M(e){(e.log??(e=>console.error(e)))("Launching OpenKnowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)"),T(`open`,[`-b`,`com.inkeep.open-knowledge`],{spawn:e.spawn})}function N(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${D}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${D} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${D} but launch dispatch did not fire (caller bug).`}}function P(e){return h(m(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const F=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function I(e){if(e.platform!==`darwin`||!F.test(e.execPath))return null;let t=P(e.execPath);return e.exists(t)?t:null}function L(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??_,a=r[1];return a?{command:I({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function R(e,t){return e.host??t.HOST??`127.0.0.1`}function z(e){let t=p(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var B=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function V(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function H(t){_(t.lockDir)||v(t.lockDir,{recursive:!0});let n=y(h(t.lockDir,e),`w`),r=t.spawn??f,{PORT:i,...a}=process.env,o=L();try{let e=r(o.command,[...o.prefixArgs,...t.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,n],windowsHide:!0,cwd:t.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return e.unref(),e}finally{try{g(n)}catch{}}}function U(e,t,n){return e??(n===void 0?t:void 0)}function W(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function G(e,t,n){return e??+(t!=null&&!n)}async function K(e){let t=e.spawn??f,n=L(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,windowsHide:!0,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=G(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function q(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const ee=t;function J(e,t,n=e=>S(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}}}}function Y(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}function X(e){let t=e.sigtermGraceMs??ee,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>C(e));return async()=>{try{let i=e.readUiLock(),a=e.spawnedUiPid();if(i&&e.isAlive(i.pid)&&i.pid!==a)e.log?.info({pid:i.pid,port:i.port,spawnedUiPid:a},`idle-shutdown: ui.lock holder is not our spawned sibling — leaving it alone`);else if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function Z(e){let{config:t,cwd:n,host:o}=e,s=e.skipAutoInit??!1,d=e.skipUiAutoSpawn??!1,f=e.idleThresholdMs??18e5,{existsSync:p,mkdirSync:m}=await import(`node:fs`),{basename:h,dirname:g}=await import(`node:path`),{bootServer:_,getLogger:v,isProcessAlive:y,readUiLock:b,resolveContentDir:x,resolveLockDir:S,waitForServerLockDrain:w}=await import(`./src-VjJUBnUL.mjs`),T=e.log??v(`start`),E=e.singleFile!==void 0,D=e.projectDir??n,O=E?r(e.singleFile).canonicalFilePath:void 0,k=O?g(O):void 0,A=O?h(O):void 0;if(!E){if(!s&&!i(n))throw new B(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&T.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-BAPHGYKS.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){T.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-O2wT2hWm.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){T.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-CLnEB5DY.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){T.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let j=k??x(t,n);!E&&!p(j)&&(m(j,{recursive:!0}),T.info({contentDir:j},`Created content directory`));let M=null,N=null,P=async({lockDir:t})=>{if(M=V({uiLock:b(t),isAlive:y}),M.action===`spawn`&&!d)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];N=H({lockDir:t,cwd:n,spawn:e.spawn,args:r}).pid??null,T.info({reason:M.reason,uiPort:e.uiPort},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else M.action===`skip`&&T.info({port:M.port,pid:M.pid},`UI already running at port ${M.port}`)},F=e.reactShellDistDir===void 0,I=c(),L=a();{let e=S(E?D:n),t=Date.now(),r=await w(e);r!==`no-drain`&&T.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let R=await _({config:t,contentDir:j,projectDir:E?D:n,contentRoot:E?void 0:t.content.dir,port:e.port,host:o,quiet:!1,detectGh:l,tokenStore:I,embeddingsKeyStore:L,...E?{ephemeral:!0,singleDocRelPath:A,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>u(e,t),attachUiSibling:F,idleShutdownMs:f,skipAutoInit:!0,...F?{spawnUiSiblingFn:P}:{},idleShutdownHandler:t=>{let n=X({readUiLock:()=>b(R.lockDir),spawnedUiPid:()=>N,isAlive:y,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:T});return Y(E?J(n,D):n,{log:T,exit:e.idleExit})},log:T,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});M||={action:`skip`,reason:`alive`,pid:0,port:0};let z=M,U=null;if(z.action===`skip`)U=z.port>0?z.port:null;else if(!d){let t=e.uiBindTimeoutMs??3e3;U=await q({readUiLock:()=>b(R.lockDir),now:Date.now,sleep:e=>C(e),timeoutMs:t,pollIntervalMs:50}),U===null&&T.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:R.httpServer,destroy:R.destroy,lockDir:R.lockDir,contentDir:j,port:R.port,ready:R.ready,degraded:R.degraded,uiSpawnDecision:M,resolvedUiPort:U}}function te(e){if(e===`browser`||e===`app`)return e;throw new s(`--mode must be 'browser' or 'app'`)}function ne(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new s(`--ui-port must be a port number between 1 and 65535`);return t}function Q(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function $(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function re(e,t){let n=Q(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-5C76vSEs.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-BR7qZmj-.mjs`),c=process.cwd(),l=e;process.title=z(c);let u=R(t,process.env),f=t.port===void 0?void 0:Number(t.port),p=process.env.PORT?Number(process.env.PORT):void 0,m=t.uiPort===void 0?void 0:Number(t.uiPort),h=U(f,p,m);if(m!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./src-VjJUBnUL.mjs`);if(W(m,e(t(c)))){await K({cwd:c,uiPort:m});return}}let g;try{g=await Z({config:l,cwd:c,host:u,port:h,...m===void 0?{}:{uiPort:m},...t.serveContentAssets===void 0?{}:{serveContentAssets:t.serveContentAssets},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof B&&(console.error(o(e.message)),process.exit(1));let t=await import(`./src-VjJUBnUL.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(o(e.message)),process.exit(1)),m!==void 0&&ie(e,t)){await K({cwd:c,uiPort:m});return}let n=ae(e,c,t);n!==null&&(console.error(o(n)),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let _=!1,v=async e=>{if(_)return;_=!0;let[t,...n]=$(e);console.log(i(`\n${t}`));for(let e of n)console.log(a(` ${e}`));try{await g.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)};process.once(`SIGINT`,()=>{v(`SIGINT`)}),process.once(`SIGTERM`,()=>{v(`SIGTERM`)});let y=`http://${u}:${g.port}`,b=u===`0.0.0.0`||u===`::`?`http://0.0.0.0:${g.port}`:void 0,x=g.resolvedUiPort,S=x!==null&&x>0?`http://${u}:${x}`:y;console.log(r({name:`open-knowledge`,version:d,localUrl:S,apiUrl:S===y?void 0:y,networkUrl:b,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let C={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};g.ready.then(async()=>{if(g.degraded.length>0){console.log();for(let e of g.degraded){let t=C[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${a(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-D5VB75t8.mjs`);e(S)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function ie(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function ae(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=h(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`OpenKnowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function oe(e){return new o(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`--ui-port <port>`,`Pin the ok ui sibling to <port> and connect (not exit) if a server already runs here — the worktree-preview recipe path`,ne).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,te).option(`--serve-content-assets`,`Serve content assets from this server (now the default; kept for compatibility)`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path> (suppresses ok ui sibling)`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
2
|
+
`),process.exit(2));let e=[];if(t.port!==void 0&&e.push(`--port`),t.uiPort!==void 0&&e.push(`--ui-port`),t.host!==void 0&&e.push(`--host`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=j(O());if(n.available){M({spawn:f});return}console.error(N(n.reason)),process.exit(1)}await re(n,t)})}export{j as C,O as S,T,oe as _,G as a,Y as b,z as c,U as d,R as f,H as g,W as h,X as i,$ as l,re as m,q as n,K as o,Q as p,Z as r,V as s,B as t,ie as u,ae as v,M as w,L as x,J as y};
|
|
3
|
+
//# sourceMappingURL=start-COR_P6jO.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{da as r,fa as i,ha as a,ia as o}from"./src-DTPLCYnP.mjs";import{Hn as s,Ln as c,Vn as l,nr as u}from"./src-BG_IUe5R.mjs";import{basename as d,dirname as f,isAbsolute as p,join as m,posix as h,relative as g,resolve as _,sep as v,win32 as y}from"node:path";import{cpSync as ee,existsSync as b,lstatSync as te,mkdirSync as ne,readFileSync as re,realpathSync as x,rmSync as S,statSync as ie}from"node:fs";import{homedir as C}from"node:os";var w=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),T=n((e=>{let{InvalidArgumentError:t}=w();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),E=n((e=>{let{humanReadableArgName:t}=T();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
2
2
|
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
3
3
|
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
4
4
|
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),D=n((e=>{let{InvalidArgumentError:t}=w();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
@@ -16,7 +16,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
17
|
- ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
18
18
|
`),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
19
|
-
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}t.Command=h,t.useColor=_}));const{program:se,createCommand:ce,createArgument:le,createOption:ue,CommanderError:de,InvalidArgumentError:fe,InvalidOptionArgumentError:pe,Command:me,Argument:he,Option:ge,Help:_e}=t(n((e=>{let{Argument:t}=T(),{Command:n}=oe(),{CommanderError:r,InvalidArgumentError:i}=w(),{Help:a}=E(),{Option:o}=D();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default,O=r,k=
|
|
19
|
+
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}t.Command=h,t.useColor=_}));const{program:se,createCommand:ce,createArgument:le,createOption:ue,CommanderError:de,InvalidArgumentError:fe,InvalidOptionArgumentError:pe,Command:me,Argument:he,Option:ge,Help:_e}=t(n((e=>{let{Argument:t}=T(),{Command:n}=oe(),{CommanderError:r,InvalidArgumentError:i}=w(),{Help:a}=E(),{Option:o}=D();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default,O=r,k=i,A=a,j=`node`,M={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},ve=`# ok-mcp-v1`,N=`# ok-mcp-v1
|
|
20
20
|
USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
|
|
21
21
|
[ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
|
|
22
22
|
BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
|
|
@@ -50,5 +50,5 @@ foreach ($d in $dirs) {
|
|
|
50
50
|
if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
|
|
51
51
|
}
|
|
52
52
|
[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
|
|
53
|
-
exit 127`,F=`// ok-pi-bridge`,I=`${F}-v1`,be=`ok-pi-managed-extension`;function xe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v1`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v1`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(I)}return!1}function L(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=_(e);if(d(t)===`cli.mjs`&&d(f(t))===`dist`)return t;let n=t.split(v),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 m(i.length===0?v:i.join(v),`packages`,`cli`,`dist`,`cli.mjs`)}function R(e={}){return e.mode===`dev`?{command:j,args:[L(),`mcp`],env:{...M}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,P]}:{command:`/bin/sh`,args:[`-l`,`-c`,N]}}function Se(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[j,L(),`mcp`],environment:{...M}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,P]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,N]}}function Ce(e){if(typeof e!=`object`||!e)return!1;let t=e;return z(t,R({mode:`published`,platformName:`darwin`}))||z(t,R({mode:`published`,platformName:`win32`}))}function z(e,t){return Object.keys(e).length===Object.keys(t).length?we(e,t):!1}function we(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function B(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:B(t.args,t.command)}function Ee(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&B(r,n)}function V(e){return e===`win32`?y:h}function De(e={}){let t=e.platformName??process.platform,n=e.home??C(),r=e.env??process.env,i=V(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA??i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME??i.join(n,`.config`)}function Oe(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.claude.json`)}function H(e={}){let t=e.platformName??process.platform,n=e.home??C(),r=e.env??process.env;if(t===`darwin`)return h.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??y.join(n,`AppData`,`Roaming`);return y.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function U(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.cursor`,`mcp.json`)}function ke(e={}){let t=e.platformName??process.platform,n=e.home??C();return(e.env??process.env).CODEX_HOME??V(t).join(n,`.codex`)}function W(e={}){return V(e.platformName??process.platform).join(ke(e),`config.toml`)}function G(e={}){let t=e.platformName??process.platform,n=e.home??C(),r=(e.env??process.env).COPILOT_HOME??V(t).join(n,`.copilot`);return V(t).join(r,`mcp-config.json`)}function Ae(e={}){let t=e.platformName??process.platform,n=e.home??C(),r=e.env??process.env,i=V(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function K(e={}){return V(e.platformName??process.platform).join(Ae(e),`opencode.json`)}function je(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.openclaw`,`openclaw.json`)}function Me(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.hermes`,`config.yaml`)}function Ne(e={}){let t=e.platformName??process.platform,n=e.home??C();return(e.env??process.env).PI_CODING_AGENT_DIR??V(t).join(n,`.pi`,`agent`)}function Pe(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Fe(e,t){let n=V(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function q(e={}){let t=e.platformName??process.platform,n=Fe(e.home??C(),t);return n.find(e=>b(e))||n.find(e=>b(f(e)))||n[0]}const J={claude:{id:`claude`,label:k.claude,configPath:(e,t)=>Oe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>m(t??C(),`.claude`),projectConfigPath:e=>m(e,`.mcp.json`),projectSkillPath:e=>m(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:k[`claude-desktop`],configPath:(e,t)=>H({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(H({home:t}))},cursor:{id:`cursor`,label:k.cursor,configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(U({home:t})),projectConfigPath:e=>m(e,`.cursor`,`mcp.json`),projectSkillPath:e=>m(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:k.codex,configPath:(e,t)=>W({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(W({home:t})),projectConfigPath:e=>m(e,`.codex`,`config.toml`),projectSkillPath:e=>m(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:k.copilot,configPath:(e,t)=>G({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(G({home:t})),projectSkillPath:e=>m(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:k.opencode,configPath:(e,t)=>K({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>i,buildEntry:(e,t)=>Se(t),scope:`global`,detectPath:(e,t)=>f(K({home:t})),projectConfigPath:e=>m(e,`opencode.json`),projectSkillPath:e=>m(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:k.openclaw,configPath:(e,t)=>je({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>m(t??C(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:k.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>Ne({home:t}),projectConfigPath:e=>m(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>m(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:k.antigravity,configPath:(e,t)=>Pe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>m(t??C(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:k[`lm-studio`],configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(q({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:k.hermes,configPath:(e,t)=>Me({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>i,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>m(t??C(),`.hermes`),offerOnlyWhenDetected:!0}};function Ie(e){let t=e.filter(e=>!Object.hasOwn(J,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${O.join(`, `)}`);return e.map(e=>J[e])}function Y(e){let t=[];for(let n of s){let r=l[n];t.push({path:m(e,`.agents`,`skills`,r),bundleId:n,scope:`central`});for(let i of A)t.push({path:m(e,i.hostDir,`skills`,r),bundleId:n,scope:`host`,hostDir:i.hostDir})}return t}function Le(e,t){let n=[];for(let r of Y(e))if(r.bundleId===t)try{S(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function X(e,t){let n;try{n=te(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);Q(e,t)}function Z(e,t){Q(e,t)}function Q(e,t){let n;try{n=x(t)}catch{n=_(t)}let r=f(e);for(;r.length>1&&r!==v;){let t;try{t=x(r)}catch(e){if(e.code===`ENOENT`){r=f(r);continue}throw e}let i=g(n,t);if(i===``||!i.startsWith(`..`)&&!p(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Re(e,t,n){try{if(ie(n).size>10485760)return!1}catch{return!1}let r;try{r=re(n,`utf-8`)}catch{return!1}let i=[],a=u(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!$(a))return!1;let o=a[e.topLevelKey];if(!$(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return $(s)?$(s[e.serverName(t)]):!1}function ze(e,t,n={}){if(e.id!==`copilot`)return!0;try{return Re(e,t,e.configPath(t,n.home))}catch{return!1}}function Be(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!ze(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=c(`project`,{checkDesktop:!0}),i=f(r);X(i,t);let a=b(r)?`overwritten`:`written`;return S(i,{recursive:!0,force:!0}),ne(f(i),{recursive:!0}),ee(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function Ve(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=f(n);return b(n)?(Z(r,t),S(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}export{me as C,Ie as S,ge as T,Te as _,Le as a,Ee as b,ve as c,J as d,A as f,R as g,be as h,Be as i,ye as l,I as m,Z as n,Y as o,F as p,Ve as r,O as s,X as t,k as u,xe as v,fe as w,De as x,Ce as y};
|
|
54
|
-
//# sourceMappingURL=write-project-skill-
|
|
53
|
+
exit 127`,F=`// ok-pi-bridge`,I=`${F}-v1`,be=`ok-pi-managed-extension`;function xe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v1`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v1`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(I)}return!1}function L(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=_(e);if(d(t)===`cli.mjs`&&d(f(t))===`dist`)return t;let n=t.split(v),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 m(i.length===0?v:i.join(v),`packages`,`cli`,`dist`,`cli.mjs`)}function R(e={}){return e.mode===`dev`?{command:j,args:[L(),`mcp`],env:{...M}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,P]}:{command:`/bin/sh`,args:[`-l`,`-c`,N]}}function Se(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[j,L(),`mcp`],environment:{...M}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,P]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,N]}}function Ce(e){if(typeof e!=`object`||!e)return!1;let t=e;return z(t,R({mode:`published`,platformName:`darwin`}))||z(t,R({mode:`published`,platformName:`win32`}))}function z(e,t){return Object.keys(e).length===Object.keys(t).length?we(e,t):!1}function we(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function B(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:B(t.args,t.command)}function Ee(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&B(r,n)}function V(e){return e===`win32`?y:h}function De(e={}){let t=e.platformName??process.platform,n=e.home??C(),r=e.env??process.env,i=V(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA??i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME??i.join(n,`.config`)}function Oe(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.claude.json`)}function H(e={}){let t=e.platformName??process.platform,n=e.home??C(),r=e.env??process.env;if(t===`darwin`)return h.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??y.join(n,`AppData`,`Roaming`);return y.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function U(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.cursor`,`mcp.json`)}function ke(e={}){let t=e.platformName??process.platform,n=e.home??C();return(e.env??process.env).CODEX_HOME??V(t).join(n,`.codex`)}function W(e={}){return V(e.platformName??process.platform).join(ke(e),`config.toml`)}function G(e={}){let t=e.platformName??process.platform,n=e.home??C(),r=(e.env??process.env).COPILOT_HOME??V(t).join(n,`.copilot`);return V(t).join(r,`mcp-config.json`)}function Ae(e={}){let t=e.platformName??process.platform,n=e.home??C(),r=e.env??process.env,i=V(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function K(e={}){return V(e.platformName??process.platform).join(Ae(e),`opencode.json`)}function je(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.openclaw`,`openclaw.json`)}function Me(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.hermes`,`config.yaml`)}function Ne(e={}){let t=e.platformName??process.platform,n=e.home??C();return(e.env??process.env).PI_CODING_AGENT_DIR??V(t).join(n,`.pi`,`agent`)}function Pe(e={}){let t=e.platformName??process.platform,n=e.home??C();return V(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Fe(e,t){let n=V(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function q(e={}){let t=e.platformName??process.platform,n=Fe(e.home??C(),t);return n.find(e=>b(e))||n.find(e=>b(f(e)))||n[0]}const J={claude:{id:`claude`,label:k.claude,configPath:(e,t)=>Oe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>m(t??C(),`.claude`),projectConfigPath:e=>m(e,`.mcp.json`),projectSkillPath:e=>m(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:k[`claude-desktop`],configPath:(e,t)=>H({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(H({home:t}))},cursor:{id:`cursor`,label:k.cursor,configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(U({home:t})),projectConfigPath:e=>m(e,`.cursor`,`mcp.json`),projectSkillPath:e=>m(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:k.codex,configPath:(e,t)=>W({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(W({home:t})),projectConfigPath:e=>m(e,`.codex`,`config.toml`),projectSkillPath:e=>m(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:k.copilot,configPath:(e,t)=>G({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(G({home:t})),projectSkillPath:e=>m(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:k.opencode,configPath:(e,t)=>K({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>o,buildEntry:(e,t)=>Se(t),scope:`global`,detectPath:(e,t)=>f(K({home:t})),projectConfigPath:e=>m(e,`opencode.json`),projectSkillPath:e=>m(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:k.openclaw,configPath:(e,t)=>je({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>m(t??C(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:k.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>Ne({home:t}),projectConfigPath:e=>m(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>m(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:k.antigravity,configPath:(e,t)=>Pe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>m(t??C(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:k[`lm-studio`],configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>f(q({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:k.hermes,configPath:(e,t)=>Me({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>o,buildEntry:(e,t)=>R(t),scope:`global`,detectPath:(e,t)=>m(t??C(),`.hermes`),offerOnlyWhenDetected:!0}};function Ie(e){let t=e.filter(e=>!Object.hasOwn(J,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${O.join(`, `)}`);return e.map(e=>J[e])}function Y(e){let t=[];for(let n of s){let r=l[n];t.push({path:m(e,`.agents`,`skills`,r),bundleId:n,scope:`central`});for(let i of A)t.push({path:m(e,i.hostDir,`skills`,r),bundleId:n,scope:`host`,hostDir:i.hostDir})}return t}function Le(e,t){let n=[];for(let r of Y(e))if(r.bundleId===t)try{S(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function X(e,t){let n;try{n=te(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);Q(e,t)}function Z(e,t){Q(e,t)}function Q(e,t){let n;try{n=x(t)}catch{n=_(t)}let r=f(e);for(;r.length>1&&r!==v;){let t;try{t=x(r)}catch(e){if(e.code===`ENOENT`){r=f(r);continue}throw e}let i=g(n,t);if(i===``||!i.startsWith(`..`)&&!p(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Re(e,t,n){try{if(ie(n).size>10485760)return!1}catch{return!1}let r;try{r=re(n,`utf-8`)}catch{return!1}let i=[],a=u(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!$(a))return!1;let o=a[e.topLevelKey];if(!$(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return $(s)?$(s[e.serverName(t)]):!1}function ze(e,t,n={}){if(e.id!==`copilot`)return!0;try{return Re(e,t,e.configPath(t,n.home))}catch{return!1}}function Be(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!ze(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=c(`project`,{checkDesktop:!0}),i=f(r);X(i,t);let a=b(r)?`overwritten`:`written`;return S(i,{recursive:!0,force:!0}),ne(f(i),{recursive:!0}),ee(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function Ve(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=f(n);return b(n)?(Z(r,t),S(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}export{me as C,Ie as S,ge as T,Te as _,Le as a,Ee as b,ve as c,J as d,A as f,R as g,be as h,Be as i,ye as l,I as m,Z as n,Y as o,F as p,Ve as r,O as s,X as t,k as u,xe as v,fe as w,De as x,Ce as y};
|
|
54
|
+
//# sourceMappingURL=write-project-skill-thWIVGxh.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/open-knowledge",
|
|
3
|
-
"version": "0.36.0-beta.
|
|
3
|
+
"version": "0.36.0-beta.18",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"ajv-formats": "^3.0.1",
|
|
62
62
|
"tsdown": "^0.21.7",
|
|
63
63
|
"typescript": "^5.9.3",
|
|
64
|
-
"@inkeep/open-knowledge-
|
|
65
|
-
"@inkeep/open-knowledge-
|
|
66
|
-
"@inkeep/open-knowledge-server": "0.36.0-beta.
|
|
67
|
-
"@inkeep/open-knowledge-
|
|
64
|
+
"@inkeep/open-knowledge-core": "0.36.0-beta.18",
|
|
65
|
+
"@inkeep/open-knowledge-native-config": "0.0.0",
|
|
66
|
+
"@inkeep/open-knowledge-server": "0.36.0-beta.18",
|
|
67
|
+
"@inkeep/open-knowledge-app": "0.36.0-beta.18"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build:cli": "tsdown",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./git-handle-YAE9YR9Q.mjs";export{e as createGitInstance};
|
package/dist/init-DC_diOY8.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./init-Du1ej_je.mjs";export{e as runInit};
|
package/dist/loader-iNgaaI6Q.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-BahUa-3b.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-BYw1WeBG.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./repair-skills-Ds2IYnpp.mjs";export{e as repairSkills};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./src-Cus5RnL8.mjs";import{r as e}from"./logger-CFNLuVy2.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s,readFileSync as c,unlinkSync as l,writeFileSync as u,writeSync as d}from"node:fs";import{homedir as f,hostname as p}from"node:os";import{fileURLToPath as m}from"node:url";import{randomUUID as h}from"node:crypto";function g(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function _(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}const v=/^[A-Za-z0-9-]{8,64}$/;let y=null;function b(e){return n(e??f(),`.ok`,`machine-id`)}function x(n){if(n===void 0&&y!==null)return y;let r=b(n),i=null;try{let e=c(r,`utf-8`).trim();v.test(e)&&(i=e)}catch{}if(i===null){i=h();try{o(t(r),{recursive:!0}),u(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(y=i),i}function S(){try{let e=r(t(m(import.meta.url)),`..`,`package.json`),n=JSON.parse(c(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const C=S(),w=1,T=e(`process-lock`);var E=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function D(e,t){return r(e,`${t}.lock`)}const O=new Map;function k(e){O.set(e,(O.get(e)??0)+1)}function A(e){let t=O.get(e);return t===void 0||t<=1?(O.delete(e),!0):(O.set(e,t-1),!1)}function j(e){return typeof e.machineId==`string`?e.machineId===x():e.hostname===p()}const M=new Set;let N=!1;function P(e){M.add(e),!N&&(N=!0,process.on(`exit`,()=>{for(let e of M)try{let t=JSON.parse(c(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==x()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==p())continue;l(e)}catch{}}))}function F(e,t){try{let n=JSON.parse(c(e,`utf-8`));return n&&typeof n==`object`&&_(n.pid)?n:(T.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return T.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function I(e){let{lockName:t,lockDir:n,metadata:r}=e,c=`[${t}-lock]`;o(n,{recursive:!0});let f=D(n,t),m={pid:process.pid,hostname:p(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:x(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??C},h=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!a(f))try{let e=s(f,`wx`,384);try{d(e,h)}finally{i(e)}return k(f),P(f),L({lockName:t,lockDir:n,lockPath:f})}catch(e){if(e.code!==`EEXIST`)throw e}let e=F(f,c);if(e){if(j(e)&&e.pid===process.pid)return u(f,h,{encoding:`utf-8`,mode:384}),k(f),P(f),L({lockName:t,lockDir:n,lockPath:f});if(g(e.pid))throw new E(e,f,t);T.warn({pid:e.pid,host:e.hostname},`${c} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{l(f)}catch{}}throw Error(`${c} Failed to acquire ${f} after 3 attempts (concurrent acquire contention).`)}function L(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>U({lockName:t,lockDir:n}),updatePort:e=>R({lockName:t,lockDir:n,port:e})}}function R(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,o=D(n,t);if(!a(o)){T.warn({lockPath:o},`${i} Lock file missing at ${o} during port update — skipping`);return}let s;try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){T.warn({lockPath:o},`${i} Corrupt lock at ${o} during port update — skipping`);return}s=e}catch{T.warn({lockPath:o},`${i} Unreadable lock at ${o} during port update — skipping`);return}if(s.pid===process.pid&&j(s)){s.port=r;try{u(o,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){T.warn({lockPath:o,err:e},`${i} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function z(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=D(n,t);if((O.get(i)??0)>1)return;let a;try{let e=JSON.parse(c(i,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){T.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){e.code!==`ENOENT`&&T.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&j(a)&&a.draining!==!0){a.draining=!0;try{u(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){T.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function B(e){let{lockName:t,lockDir:n}=e,r=D(n,t);if(!a(r))return null;let i;try{let e=JSON.parse(c(r,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid))return null;i=e}catch{return null}if(!j(i))return null;if(!g(i.pid)){try{l(r)}catch{}return null}return i}function V(e){let{lockName:t,lockDir:n}=e,r=D(n,t);if(!a(r))return{status:`absent`};let i;try{i=JSON.parse(c(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o=i;if(!_(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!j(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{l(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function H(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>B({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function U(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,o=D(n,t);if(A(o)){if(r){z({lockName:t,lockDir:n});return}if(a(o))try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!j(e))return;l(o),M.delete(o)}catch(e){T.warn({lockPath:o,err:e},`${i} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var W=class extends E{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function G(e,t){try{return I({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof E&&e.lockName===`server`?new W(e.existing,e.lockPath):e}}function K(e,t){R({lockName:`server`,lockDir:e,port:t})}function q(e){return B({lockName:`server`,lockDir:e})}function J(e,t){U({lockName:`server`,lockDir:e,...t})}function Y(e){z({lockName:`server`,lockDir:e})}function X(e,t){return H({lockName:`server`,lockDir:e,...t})}export{w as _,J as a,_ as b,E as c,z as d,B as f,C as g,R as h,q as i,I as l,U as m,G as n,K as o,V as p,Y as r,X as s,W as t,D as u,x as v,g as y};
|
|
2
|
-
//# sourceMappingURL=server-lock-0xVm4FnC.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,o as t,r as n}from"./server-lock-0xVm4FnC.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
|