@kitelev/exocortex-cli 16.230.2 → 16.230.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 v16.230.
|
|
2
|
+
// @kitelev/exocortex-cli v16.230.4
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -639,7 +639,7 @@ Next steps:
|
|
|
639
639
|
`).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(mhe,"parseLastJsonLine");function _B(n,e){return e.filter(t=>{let r=n[t];return typeof r!="string"||r.trim().length===0})}a(_B,"missingStringFields");var wS=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:yB,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:yB,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:phe,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:gB}};case"tools/call":return{jsonrpc:"2.0",id:i,result:await this.callTool(e.params??{})};default:return{jsonrpc:"2.0",id:i,error:{code:hhe,message:`Method not found: ${e.method}`}}}}async callTool(e){let t=e.name,r=e.arguments??{},i;if(t==="create_asset"){let l=_B(r,["vault","class","label"]);if(l.length>0)return ed(`create_asset: missing required argument(s): ${l.join(", ")}`,!0);let c=pB(r);if(c!==null)return ed(`create_asset: ${c}`,!0);i=hB(r)}else if(t==="create_effort"){let l=_B(r,["vault","command","target"]);if(l.length>0)return ed(`create_effort: missing required argument(s): ${l.join(", ")}`,!0);i=mB(r)}else return ed(`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 ed(`exocortex-cli exited ${s.exitCode}
|
|
640
640
|
${l}`,!0)}let o=mhe(s.stdout);return ed(o===void 0?s.stdout.trim():JSON.stringify(o))}};var wB=require("child_process");var ghe=32*1024*1024;function EB(n){return e=>new Promise(t=>{(0,wB.execFile)(process.execPath,[n,...e],{maxBuffer:ghe},(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(EB,"createSelfCliRunner");async function yhe(n,e,t){let r=(0,vB.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:bB,message:"Parse error: invalid JSON"}})+`
|
|
641
641
|
`);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:SB,message:`Internal error: ${c instanceof Error?c.message:String(c)}`}}}l!==null&&t(JSON.stringify(l)+`
|
|
642
|
-
`)}}a(yhe,"runStdioServer");function TB(n){return new Ie("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 wS({runCli:EB(t),version:n??"unknown"});await yhe(r,process.stdin,i=>process.stdout.write(i))})}a(TB,"mcpCommand");function ES(n){let e=new Ie;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(n??"16.230.
|
|
642
|
+
`)}}a(yhe,"runStdioServer");function TB(n){return new Ie("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 wS({runCli:EB(t),version:n??"unknown"});await yhe(r,process.stdin,i=>process.stdout.write(i))})}a(TB,"mcpCommand");function ES(n){let e=new Ie;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(n??"16.230.4"),e.addCommand(aU()),e.addCommand(gU()),e.addCommand(n6()),e.addCommand(a6()),e.addCommand(C6()),e.addCommand(l6()),e.addCommand(h6()),e.addCommand(m6()),e.addCommand(k6()),e.addCommand(B6()),e.addCommand(Z6()),e.addCommand(eU()),e.addCommand(tU()),e.addCommand(nU()),e.addCommand(iU()),e.addCommand(kU()),e.addCommand($U()),e.addCommand(eB()),e.addCommand(rB()),e.addCommand(sB()),e.addCommand(oB()),e.addCommand(uB()),e.addCommand(WU()),e.addCommand(XU()),e.addCommand(fB()),e.addCommand(TB(n??"16.230.4")),e}a(ES,"createProgram");ES().parse();0&&(module.exports={createProgram});
|
|
643
643
|
/*! Bundled license information:
|
|
644
644
|
|
|
645
645
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED