@kitelev/exocortex-cli 13.207.18 → 13.207.20

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -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 v13.207.18
2
+ // @kitelev/exocortex-cli v13.207.20
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -297,7 +297,7 @@ globstar while`,e,d,t,m,_),this.matchOne(e.slice(d),t.slice(m),r))return this.de
297
297
  \u{1F4CB} Failed Files:`);for(let t of e.results.filter(r=>!r.success))console.log(` \u274C ${t.filepath}: ${t.error}`)}if(e.movedCount>0&&n==="text"){console.log(`
298
298
  \u{1F4CB} Moved Files:`);for(let t of e.results.filter(r=>r.success&&r.changes?.moved))console.log(` \u{1F4C1} ${t.filepath} \u2192 ${t.changes?.newPath}`)}}}o(X7,"outputResult");function FS(){return new _r("batch-repair").description("Batch repair folder locations for all markdown files in a directory").argument("<directory>","Directory to process (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--dry-run","Preview changes without modifying files").option("--format <type>","Output format: text|json (default: text)","text").option("--progress","Show progress during processing (default: true)",!0).option("--no-progress","Disable progress output").action(async(n,e)=>{let t=e.format||"text";ye.setFormat(t);try{let r=(0,PS.resolve)(e.vault),i=new Wi(r),s=n;if(!await i.directoryExists(s))throw new rt(`Directory not found: ${s}`,"exocortex batch-repair <existing-directory>");let c=await i.getMarkdownFiles(s);if(c.length===0){if(t==="json"){let O=lt.success({success:!0,total:0,movedCount:0,alreadyCorrectCount:0,errorCount:0,results:[],durationMs:0,atomic:!1});console.log(JSON.stringify(O,null,2))}else console.log(`
299
299
  \u{1F4C2} No markdown files found in ${s}`);process.exit(0)}let u=c.map(O=>({command:"repair-folder",filepath:O})),l=e.progress!==!1&&t==="text",f=0;l&&console.log(`
300
- \u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Vs(r,e.dryRun).executeBatch(u,!1),m=0,_=0,b=0;for(let O of d.results)if(O.success?O.changes?.moved?m++:_++:b++,l&&!e.dryRun){f++;let I=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${I}%)...`)}l&&process.stdout.write("\r"+" ".repeat(60)+"\r");let C={...d,movedCount:m,alreadyCorrectCount:_,errorCount:b};X7(t,C),process.exit(C.success?0:5)}catch(r){ye.handle(r)}})}o(FS,"batchRepairCommand");var Wf=require("fs"),Sn=require("path");function RS(){return new _r("resolve").description("Resolve UUID to file path").argument("<uuid>","Full or partial UUID to resolve").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: uri|path|json (default: uri)","uri").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--partial","Match partial UUIDs (returns all matches)").action(async(n,e)=>{let t=e.output||"text";ye.setFormat(t);try{let r=Date.now();if(!J7(n))throw new rt(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,Sn.resolve)(e.vault);if(!(0,Wf.existsSync)(i))throw new hi(i);let s=Z7(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=lt.error("VALIDATION_FILE_NOT_FOUND",`UUID not found: ${n}`,3,{context:{uuid:n}});console.log(JSON.stringify(c,null,2))}else console.error(`UUID not found: ${n}`);process.exit(1)}e.partial||s.length>1?tN(s,i,e.format,t,n,a):eN(s[0],i,e.format,t,n,a)}catch(r){ye.handle(r)}})}o(RS,"resolveCommand");function J7(n){if(n.length<4)return!1;let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,t=/^[0-9a-f-]+$/i;return e.test(n)||t.test(n)}o(J7,"isValidUuidFormat");function Z7(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,Wf.readdirSync)(a,{withFileTypes:!0});for(let u of c){let l=(0,Sn.join)(a,u.name);if(u.isDirectory())!u.name.startsWith(".")&&u.name!=="node_modules"&&s(l);else if(u.isFile()&&u.name.endsWith(".md")){let f=u.name.toLowerCase();t?f.includes(i)&&r.push(l):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&r.push(l)}}}return o(s,"walk"),s(n),r}o(Z7,"findFilesWithUuid");function NS(n){return`obsidian://vault/${encodeURI(n)}`}o(NS,"pathToObsidianUri");function kS(n){let e=n.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);return e?e[1]:(0,Sn.basename)(n,".md")}o(kS,"extractUuidFromFilename");function eN(n,e,t,r,i,s){let a=(0,Sn.relative)(e,n),c=NS(a),u=kS((0,Sn.basename)(n));if(r==="json"){let l={uuid:u,path:a,absolutePath:n,uri:c},f=lt.success(l,{durationMs:s,searchUuid:i});console.log(JSON.stringify(f,null,2))}else switch(t){case"path":console.log(n);break;case"json":console.log(JSON.stringify({uuid:u,path:a,absolutePath:n,uri:c},null,2));break;case"uri":default:console.log(c);break}}o(eN,"outputSingleResult");function tN(n,e,t,r,i,s){let a=n.map(c=>{let u=(0,Sn.relative)(e,c),l=NS(u);return{uuid:kS((0,Sn.basename)(c)),path:u,absolutePath:c,uri:l}});if(r==="json"){let c=lt.success({matches:a,count:a.length},{durationMs:s,searchUuid:i,itemCount:a.length});console.log(JSON.stringify(c,null,2))}else switch(t){case"path":for(let c of a)console.log(c.absolutePath);break;case"json":console.log(JSON.stringify(a,null,2));break;case"uri":default:for(let c of a)console.log(c.uri);break}}o(tN,"outputMultipleResults");var Hi=new _r;Hi.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.207.18");Hi.command("sparql").description("SPARQL query execution").addCommand(wb());Hi.addCommand(xS());Hi.addCommand(DS());Hi.addCommand(IS());Hi.addCommand(FS());Hi.addCommand(RS());Hi.parse();
300
+ \u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Vs(r,e.dryRun).executeBatch(u,!1),m=0,_=0,b=0;for(let O of d.results)if(O.success?O.changes?.moved?m++:_++:b++,l&&!e.dryRun){f++;let I=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${I}%)...`)}l&&process.stdout.write("\r"+" ".repeat(60)+"\r");let C={...d,movedCount:m,alreadyCorrectCount:_,errorCount:b};X7(t,C),process.exit(C.success?0:5)}catch(r){ye.handle(r)}})}o(FS,"batchRepairCommand");var Wf=require("fs"),Sn=require("path");function RS(){return new _r("resolve").description("Resolve UUID to file path").argument("<uuid>","Full or partial UUID to resolve").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: uri|path|json (default: uri)","uri").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--partial","Match partial UUIDs (returns all matches)").action(async(n,e)=>{let t=e.output||"text";ye.setFormat(t);try{let r=Date.now();if(!J7(n))throw new rt(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,Sn.resolve)(e.vault);if(!(0,Wf.existsSync)(i))throw new hi(i);let s=Z7(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=lt.error("VALIDATION_FILE_NOT_FOUND",`UUID not found: ${n}`,3,{context:{uuid:n}});console.log(JSON.stringify(c,null,2))}else console.error(`UUID not found: ${n}`);process.exit(1)}e.partial||s.length>1?tN(s,i,e.format,t,n,a):eN(s[0],i,e.format,t,n,a)}catch(r){ye.handle(r)}})}o(RS,"resolveCommand");function J7(n){if(n.length<4)return!1;let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,t=/^[0-9a-f-]+$/i;return e.test(n)||t.test(n)}o(J7,"isValidUuidFormat");function Z7(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,Wf.readdirSync)(a,{withFileTypes:!0});for(let u of c){let l=(0,Sn.join)(a,u.name);if(u.isDirectory())!u.name.startsWith(".")&&u.name!=="node_modules"&&s(l);else if(u.isFile()&&u.name.endsWith(".md")){let f=u.name.toLowerCase();t?f.includes(i)&&r.push(l):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&r.push(l)}}}return o(s,"walk"),s(n),r}o(Z7,"findFilesWithUuid");function NS(n){return`obsidian://vault/${encodeURI(n)}`}o(NS,"pathToObsidianUri");function kS(n){let e=n.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);return e?e[1]:(0,Sn.basename)(n,".md")}o(kS,"extractUuidFromFilename");function eN(n,e,t,r,i,s){let a=(0,Sn.relative)(e,n),c=NS(a),u=kS((0,Sn.basename)(n));if(r==="json"){let l={uuid:u,path:a,absolutePath:n,uri:c},f=lt.success(l,{durationMs:s,searchUuid:i});console.log(JSON.stringify(f,null,2))}else switch(t){case"path":console.log(n);break;case"json":console.log(JSON.stringify({uuid:u,path:a,absolutePath:n,uri:c},null,2));break;case"uri":default:console.log(c);break}}o(eN,"outputSingleResult");function tN(n,e,t,r,i,s){let a=n.map(c=>{let u=(0,Sn.relative)(e,c),l=NS(u);return{uuid:kS((0,Sn.basename)(c)),path:u,absolutePath:c,uri:l}});if(r==="json"){let c=lt.success({matches:a,count:a.length},{durationMs:s,searchUuid:i,itemCount:a.length});console.log(JSON.stringify(c,null,2))}else switch(t){case"path":for(let c of a)console.log(c.absolutePath);break;case"json":console.log(JSON.stringify(a,null,2));break;case"uri":default:for(let c of a)console.log(c.uri);break}}o(tN,"outputMultipleResults");var Hi=new _r;Hi.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.207.20");Hi.command("sparql").description("SPARQL query execution").addCommand(wb());Hi.addCommand(xS());Hi.addCommand(DS());Hi.addCommand(IS());Hi.addCommand(FS());Hi.addCommand(RS());Hi.parse();
301
301
  /*! Bundled license information:
302
302
 
303
303
  reflect-metadata/Reflect.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitelev/exocortex-cli",
3
- "version": "13.207.18",
3
+ "version": "13.207.20",
4
4
  "description": "CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more",
5
5
  "main": "dist/index.js",
6
6
  "bin": {