@kitelev/exocortex-cli 17.5.2 → 17.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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.5.
|
|
2
|
+
// @kitelev/exocortex-cli v17.5.4
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -708,7 +708,7 @@ Next steps:
|
|
|
708
708
|
`).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(jEe,"parseLastJsonLine");function uq(r,e){return e.filter(t=>{let n=r[t];return typeof n!="string"||n.trim().length===0})}a(uq,"missingStringFields");var dv=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:lq,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:lq,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:kEe,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:cq}};case"tools/call":return{jsonrpc:"2.0",id:i,result:await this.callTool(e.params??{})};default:return{jsonrpc:"2.0",id:i,error:{code:MEe,message:`Method not found: ${e.method}`}}}}async callTool(e){let t=e.name,n=e.arguments??{},i;if(t==="create_asset"){let c=uq(n,["vault","class","label"]);if(c.length>0)return Dp(`create_asset: missing required argument(s): ${c.join(", ")}`,!0);let l=sq(n);if(l!==null)return Dp(`create_asset: ${l}`,!0);i=oq(n)}else if(t==="create_effort"){let c=uq(n,["vault","command","target"]);if(c.length>0)return Dp(`create_effort: missing required argument(s): ${c.join(", ")}`,!0);i=aq(n)}else return Dp(`Unknown tool: ${String(t)}`,!0);let s=await this.deps.runCli(i);if(s.exitCode!==0){let c=s.stderr.trim()||s.stdout.trim()||"(no diagnostic output)";return Dp(`exocortex-cli exited ${s.exitCode}
|
|
709
709
|
${c}`,!0)}let o=jEe(s.stdout);return Dp(o===void 0?s.stdout.trim():JSON.stringify(o))}};var pq=require("child_process");var $Ee=32*1024*1024;function hq(r){return e=>new Promise(t=>{(0,pq.execFile)(process.execPath,[r,...e],{maxBuffer:$Ee},(n,i,s)=>{let o=0;if(n){let c=n.code;o=typeof c=="number"?c:1}t({stdout:i,stderr:s,exitCode:o})})})}a(hq,"createSelfCliRunner");async function UEe(r,e,t){let n=(0,mq.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:fq,message:"Parse error: invalid JSON"}})+`
|
|
710
710
|
`);continue}let c;try{c=await r.handle(o)}catch(l){c={jsonrpc:"2.0",id:typeof o?.id=="string"||typeof o?.id=="number"?o.id:null,error:{code:dq,message:`Internal error: ${l instanceof Error?l.message:String(l)}`}}}c!==null&&t(JSON.stringify(c)+`
|
|
711
|
-
`)}}a(UEe,"runStdioServer");function gq(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 dv({runCli:hq(t),version:r??"unknown"});await UEe(n,process.stdin,i=>process.stdout.write(i))})}a(gq,"mcpCommand");function pv(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.5.
|
|
711
|
+
`)}}a(UEe,"runStdioServer");function gq(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 dv({runCli:hq(t),version:r??"unknown"});await UEe(n,process.stdin,i=>process.stdout.write(i))})}a(gq,"mcpCommand");function pv(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.5.4"),e.addCommand($V()),e.addCommand(YV()),e.addCommand(S7()),e.addCommand(T7()),e.addCommand(W7()),e.addCommand(A7()),e.addCommand(O7()),e.addCommand(P7()),e.addCommand(Z7()),e.addCommand(iV()),e.addCommand(vV()),e.addCommand(CV()),e.addCommand(FV()),e.addCommand(DV()),e.addCommand(NV()),e.addCommand(kV()),e.addCommand(bG()),e.addCommand(wG()),e.addCommand(HG()),e.addCommand(YG()),e.addCommand(JG()),e.addCommand(ZG()),e.addCommand(rq()),e.addCommand(kG()),e.addCommand(qG()),e.addCommand(nq()),e.addCommand(gq(r??"17.5.4")),e}a(pv,"createProgram");pv().parse();0&&(module.exports={createProgram});
|
|
712
712
|
/*! Bundled license information:
|
|
713
713
|
|
|
714
714
|
reflect-metadata/Reflect.js:
|