@kitelev/exocortex-cli 16.231.3 → 16.232.0
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 v16.
|
|
2
|
+
// @kitelev/exocortex-cli v16.232.0
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -640,7 +640,7 @@ Next steps:
|
|
|
640
640
|
`).map(r=>r.trim()).filter(r=>r.length>0),t=e[e.length-1];if(t!==void 0)try{return JSON.parse(t)}catch{return}}a(Qpe,"parseLastJsonLine");function lB(n,e){return e.filter(t=>{let r=n[t];return typeof r!="string"||r.trim().length===0})}a(lB,"missingStringFields");var RS=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:aB,message:"Invalid request: expected a JSON-RPC object"}};let t=e.id,r=t===void 0;if(typeof e.method!="string")return r?null:{jsonrpc:"2.0",id:t??null,error:{code:aB,message:"Invalid request: missing method"}};if(r)return null;let i=t??null;switch(e.method){case"initialize":return{jsonrpc:"2.0",id:i,result:{protocolVersion:Kpe,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:oB}};case"tools/call":return{jsonrpc:"2.0",id:i,result:await this.callTool(e.params??{})};default:return{jsonrpc:"2.0",id:i,error:{code:Ype,message:`Method not found: ${e.method}`}}}}async callTool(e){let t=e.name,r=e.arguments??{},i;if(t==="create_asset"){let l=lB(r,["vault","class","label"]);if(l.length>0)return id(`create_asset: missing required argument(s): ${l.join(", ")}`,!0);let c=nB(r);if(c!==null)return id(`create_asset: ${c}`,!0);i=iB(r)}else if(t==="create_effort"){let l=lB(r,["vault","command","target"]);if(l.length>0)return id(`create_effort: missing required argument(s): ${l.join(", ")}`,!0);i=sB(r)}else return id(`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 id(`exocortex-cli exited ${s.exitCode}
|
|
641
641
|
${l}`,!0)}let o=Qpe(s.stdout);return id(o===void 0?s.stdout.trim():JSON.stringify(o))}};var fB=require("child_process");var Xpe=32*1024*1024;function dB(n){return e=>new Promise(t=>{(0,fB.execFile)(process.execPath,[n,...e],{maxBuffer:Xpe},(r,i,s)=>{let o=0;if(r){let l=r.code;o=typeof l=="number"?l:1}t({stdout:i,stderr:s,exitCode:o})})})}a(dB,"createSelfCliRunner");async function Jpe(n,e,t){let r=(0,pB.createInterface)({input:e,crlfDelay:1/0});for await(let i of r){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:cB,message:"Parse error: invalid JSON"}})+`
|
|
642
642
|
`);continue}let l;try{l=await n.handle(o)}catch(c){l={jsonrpc:"2.0",id:typeof o?.id=="string"||typeof o?.id=="number"?o.id:null,error:{code:uB,message:`Internal error: ${c instanceof Error?c.message:String(c)}`}}}l!==null&&t(JSON.stringify(l)+`
|
|
643
|
-
`)}}a(Jpe,"runStdioServer");function hB(n){return new Te("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],r=new RS({runCli:dB(t),version:n??"unknown"});await Jpe(r,process.stdin,i=>process.stdout.write(i))})}a(hB,"mcpCommand");function CS(n){let e=new Te;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(n??"16.
|
|
643
|
+
`)}}a(Jpe,"runStdioServer");function hB(n){return new Te("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],r=new RS({runCli:dB(t),version:n??"unknown"});await Jpe(r,process.stdin,i=>process.stdout.write(i))})}a(hB,"mcpCommand");function CS(n){let e=new Te;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(n??"16.232.0"),e.addCommand(X6()),e.addCommand(oU()),e.addCommand(z5()),e.addCommand(X5()),e.addCommand(b6()),e.addCommand(J5()),e.addCommand(i6()),e.addCommand(s6()),e.addCommand(x6()),e.addCommand(P6()),e.addCommand(q6()),e.addCommand(G6()),e.addCommand(W6()),e.addCommand(z6()),e.addCommand(K6()),e.addCommand(xU()),e.addCommand(CU()),e.addCommand(GU()),e.addCommand(HU()),e.addCommand(YU()),e.addCommand(QU()),e.addCommand(eB()),e.addCommand(NU()),e.addCommand(BU()),e.addCommand(tB()),e.addCommand(hB(n??"16.232.0")),e}a(CS,"createProgram");CS().parse();0&&(module.exports={createProgram});
|
|
644
644
|
/*! Bundled license information:
|
|
645
645
|
|
|
646
646
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED