@kitelev/exocortex-cli 17.22.8 → 17.22.9
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/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v17.22.
|
|
2
|
+
// @kitelev/exocortex-cli v17.22.9
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -727,7 +727,7 @@ Next steps:
|
|
|
727
727
|
`).map(n=>n.trim()).filter(n=>n.length>0),t=e[e.length-1];if(t!==void 0)try{return JSON.parse(t)}catch{return}}a(XRe,"parseLastJsonLine");function Uz(r,e){return e.filter(t=>{let n=r[t];return typeof n!="string"||n.trim().length===0})}a(Uz,"missingStringFields");var _T=class{constructor(e){this.deps=e}static{a(this,"McpServer")}async handle(e){if(typeof e!="object"||e===null||Array.isArray(e))return{jsonrpc:"2.0",id:null,error:{code:Bz,message:"Invalid request: expected a JSON-RPC object"}};let t=e.id,n=t===void 0;if(typeof e.method!="string")return n?null:{jsonrpc:"2.0",id:t??null,error:{code:Bz,message:"Invalid request: missing method"}};if(n)return null;let i=t??null;switch(e.method){case"initialize":return{jsonrpc:"2.0",id:i,result:{protocolVersion:YRe,capabilities:{tools:{}},serverInfo:{name:"exocortex",version:this.deps.version}}};case"ping":return{jsonrpc:"2.0",id:i,result:{}};case"tools/list":return{jsonrpc:"2.0",id:i,result:{tools:jz}};case"tools/call":return{jsonrpc:"2.0",id:i,result:await this.callTool(e.params??{})};default:return{jsonrpc:"2.0",id:i,error:{code:QRe,message:`Method not found: ${e.method}`}}}}async callTool(e){let t=e.name,n=e.arguments??{},i;if(t==="create_asset"){let l=Uz(n,["vault","class","label"]);if(l.length>0)return mh(`create_asset: missing required argument(s): ${l.join(", ")}`,!0);let c=kz(n);if(c!==null)return mh(`create_asset: ${c}`,!0);i=Mz(n)}else if(t==="create_effort"){let l=Uz(n,["vault","command","target"]);if(l.length>0)return mh(`create_effort: missing required argument(s): ${l.join(", ")}`,!0);i=$z(n)}else return mh(`Unknown tool: ${String(t)}`,!0);let s=await this.deps.runCli(i);if(s.exitCode!==0){let l=s.stderr.trim()||s.stdout.trim()||"(no diagnostic output)";return mh(`exocortex-cli exited ${s.exitCode}
|
|
728
728
|
${l}`,!0)}let o=XRe(s.stdout);return mh(o===void 0?s.stdout.trim():JSON.stringify(o))}};var qz=require("child_process");var JRe=32*1024*1024;function Wz(r){return e=>new Promise(t=>{(0,qz.execFile)(process.execPath,[r,...e],{maxBuffer:JRe},(n,i,s)=>{let o=0;if(n){let l=n.code;o=typeof l=="number"?l:1}t({stdout:i,stderr:s,exitCode:o})})})}a(Wz,"createSelfCliRunner");async function ZRe(r,e,t){let n=(0,Kz.createInterface)({input:e,crlfDelay:1/0});for await(let i of n){let s=i.trim();if(s.length===0)continue;let o;try{o=JSON.parse(s)}catch{t(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:Vz,message:"Parse error: invalid JSON"}})+`
|
|
729
729
|
`);continue}let l;try{l=await r.handle(o)}catch(c){l={jsonrpc:"2.0",id:typeof o?.id=="string"||typeof o?.id=="number"?o.id:null,error:{code:Gz,message:`Internal error: ${c instanceof Error?c.message:String(c)}`}}}l!==null&&t(JSON.stringify(l)+`
|
|
730
|
-
`)}}a(ZRe,"runStdioServer");function zz(r){return new pe("mcp").description("Run an MCP (Model Context Protocol) stdio server exposing create_asset / create_effort tools backed by this CLI").option("--entry <path>","Path to the CLI entry script the tools invoke (defaults to this process's script)").action(async e=>{let t=e.entry??process.argv[1],n=new _T({runCli:Wz(t),version:r??"unknown"});await ZRe(n,process.stdin,i=>process.stdout.write(i))})}a(zz,"mcpCommand");function ST(r){let e=new pe;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(r??"17.22.
|
|
730
|
+
`)}}a(ZRe,"runStdioServer");function zz(r){return new pe("mcp").description("Run an MCP (Model Context Protocol) stdio server exposing create_asset / create_effort tools backed by this CLI").option("--entry <path>","Path to the CLI entry script the tools invoke (defaults to this process's script)").action(async e=>{let t=e.entry??process.argv[1],n=new _T({runCli:Wz(t),version:r??"unknown"});await ZRe(n,process.stdin,i=>process.stdout.write(i))})}a(zz,"mcpCommand");function ST(r){let e=new pe;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(r??"17.22.9"),e.addCommand(pK()),e.addCommand(vK()),e.addCommand(Vq()),e.addCommand(zq()),e.addCommand(hW()),e.addCommand(Hq()),e.addCommand(Zq()),e.addCommand(eW()),e.addCommand(EW()),e.addCommand(xW()),e.addCommand(XW()),e.addCommand(rK()),e.addCommand(oK()),e.addCommand(aK()),e.addCommand(lK()),e.addCommand(cK()),e.addCommand(uK()),e.addCommand(zK()),e.addCommand(QK()),e.addCommand(Tz()),e.addCommand(Iz()),e.addCommand(Oz()),e.addCommand(xz()),e.addCommand(Fz()),e.addCommand(pz()),e.addCommand(wz()),e.addCommand(Dz()),e.addCommand(zz(r??"17.22.9")),e}a(ST,"createProgram");ST().parse();0&&(module.exports={createProgram});
|
|
731
731
|
/*! Bundled license information:
|
|
732
732
|
|
|
733
733
|
reflect-metadata/Reflect.js:
|