@kitelev/exocortex-cli 13.243.3 → 13.244.1

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.243.3
2
+ // @kitelev/exocortex-cli v13.244.1
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -299,7 +299,7 @@ globstar while`,e,d,t,m,w),this.matchOne(e.slice(d),t.slice(m),r))return this.de
299
299
  \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(`
300
300
  \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(I7,"outputResult");function Hb(){return new br("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,zb.resolve)(e.vault),i=new Qi(r),s=n;if(!await i.directoryExists(s))throw new nt(`Directory not found: ${s}`,"exocortex batch-repair <existing-directory>");let c=await i.getMarkdownFiles(s);if(c.length===0){if(t==="json"){let O=ht.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(`
301
301
  \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(`
302
- \u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Gs(r,e.dryRun).executeBatch(u,!1),m=0,w=0,_=0;for(let O of d.results)if(O.success?O.changes?.moved?m++:w++:_++,l&&!e.dryRun){f++;let D=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${D}%)...`)}l&&process.stdout.write("\r"+" ".repeat(60)+"\r");let A={...d,movedCount:m,alreadyCorrectCount:w,errorCount:_};I7(t,A),process.exit(A.success?0:5)}catch(r){ye.handle(r)}})}o(Hb,"batchRepairCommand");var rh=require("fs"),xn=require("path");function Yb(){return new br("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(!D7(n))throw new nt(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,xn.resolve)(e.vault);if(!(0,rh.existsSync)(i))throw new gi(i);let s=P7(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=ht.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?R7(s,i,e.format,t,n,a):F7(s[0],i,e.format,t,n,a)}catch(r){ye.handle(r)}})}o(Yb,"resolveCommand");function D7(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(D7,"isValidUuidFormat");function P7(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,rh.readdirSync)(a,{withFileTypes:!0});for(let u of c){let l=(0,xn.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(P7,"findFilesWithUuid");function Kb(n){return`obsidian://vault/${encodeURI(n)}`}o(Kb,"pathToObsidianUri");function Qb(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,xn.basename)(n,".md")}o(Qb,"extractUuidFromFilename");function F7(n,e,t,r,i,s){let a=(0,xn.relative)(e,n),c=Kb(a),u=Qb((0,xn.basename)(n));if(r==="json"){let l={uuid:u,path:a,absolutePath:n,uri:c},f=ht.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(F7,"outputSingleResult");function R7(n,e,t,r,i,s){let a=n.map(c=>{let u=(0,xn.relative)(e,c),l=Kb(u);return{uuid:Qb((0,xn.basename)(c)),path:u,absolutePath:c,uri:l}});if(r==="json"){let c=ht.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(R7,"outputMultipleResults");var Ji=new br;Ji.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.243.3");Ji.command("sparql").description("SPARQL query execution").addCommand(NS());Ji.addCommand(Bb());Ji.addCommand(Gb());Ji.addCommand(Wb());Ji.addCommand(Hb());Ji.addCommand(Yb());Ji.parse();
302
+ \u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Gs(r,e.dryRun).executeBatch(u,!1),m=0,w=0,_=0;for(let O of d.results)if(O.success?O.changes?.moved?m++:w++:_++,l&&!e.dryRun){f++;let D=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${D}%)...`)}l&&process.stdout.write("\r"+" ".repeat(60)+"\r");let A={...d,movedCount:m,alreadyCorrectCount:w,errorCount:_};I7(t,A),process.exit(A.success?0:5)}catch(r){ye.handle(r)}})}o(Hb,"batchRepairCommand");var rh=require("fs"),xn=require("path");function Yb(){return new br("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(!D7(n))throw new nt(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,xn.resolve)(e.vault);if(!(0,rh.existsSync)(i))throw new gi(i);let s=P7(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=ht.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?R7(s,i,e.format,t,n,a):F7(s[0],i,e.format,t,n,a)}catch(r){ye.handle(r)}})}o(Yb,"resolveCommand");function D7(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(D7,"isValidUuidFormat");function P7(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,rh.readdirSync)(a,{withFileTypes:!0});for(let u of c){let l=(0,xn.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(P7,"findFilesWithUuid");function Kb(n){return`obsidian://vault/${encodeURI(n)}`}o(Kb,"pathToObsidianUri");function Qb(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,xn.basename)(n,".md")}o(Qb,"extractUuidFromFilename");function F7(n,e,t,r,i,s){let a=(0,xn.relative)(e,n),c=Kb(a),u=Qb((0,xn.basename)(n));if(r==="json"){let l={uuid:u,path:a,absolutePath:n,uri:c},f=ht.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(F7,"outputSingleResult");function R7(n,e,t,r,i,s){let a=n.map(c=>{let u=(0,xn.relative)(e,c),l=Kb(u);return{uuid:Qb((0,xn.basename)(c)),path:u,absolutePath:c,uri:l}});if(r==="json"){let c=ht.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(R7,"outputMultipleResults");var Ji=new br;Ji.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.244.1");Ji.command("sparql").description("SPARQL query execution").addCommand(NS());Ji.addCommand(Bb());Ji.addCommand(Gb());Ji.addCommand(Wb());Ji.addCommand(Hb());Ji.addCommand(Yb());Ji.parse();
303
303
  /*! Bundled license information:
304
304
 
305
305
  reflect-metadata/Reflect.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitelev/exocortex-cli",
3
- "version": "13.243.3",
3
+ "version": "13.244.1",
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": {