@kitelev/exocortex-cli 13.198.0 → 13.198.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.198.0
2
+ // @kitelev/exocortex-cli v13.198.1
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -293,7 +293,7 @@ globstar while`,e,d,t,m,w),this.matchOne(e.slice(d),t.slice(m),n))return this.de
293
293
  \u{1F4CB} Failed Files:`);for(let t of e.results.filter(n=>!n.success))console.log(` \u274C ${t.filepath}: ${t.error}`)}if(e.movedCount>0&&r==="text"){console.log(`
294
294
  \u{1F4CB} Moved Files:`);for(let t of e.results.filter(n=>n.success&&n.changes?.moved))console.log(` \u{1F4C1} ${t.filepath} \u2192 ${t.changes?.newPath}`)}}}o(R7,"outputResult");function gS(){return new wr("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(r,e)=>{let t=e.format||"text";ge.setFormat(t);try{let n=(0,mS.resolve)(e.vault),i=new Wi(n),s=r;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(`
295
295
  \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(`
296
- \u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Ms(n,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 P=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${P}%)...`)}l&&process.stdout.write("\r"+" ".repeat(60)+"\r");let C={...d,movedCount:m,alreadyCorrectCount:w,errorCount:_};R7(t,C),process.exit(C.success?0:5)}catch(n){ge.handle(n)}})}o(gS,"batchRepairCommand");var jf=require("fs"),Sn=require("path");function yS(){return new wr("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(r,e)=>{let t=e.output||"text";ge.setFormat(t);try{let n=Date.now();if(!N7(r))throw new rt(`Invalid UUID format: ${r}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:r});let i=(0,Sn.resolve)(e.vault);if(!(0,jf.existsSync)(i))throw new hi(i);let s=k7(i,r,e.partial??!1),a=Date.now()-n;if(s.length===0){if(t==="json"){let c=lt.error("VALIDATION_FILE_NOT_FOUND",`UUID not found: ${r}`,3,{context:{uuid:r}});console.log(JSON.stringify(c,null,2))}else console.error(`UUID not found: ${r}`);process.exit(1)}e.partial||s.length>1?L7(s,i,e.format,t,r,a):j7(s[0],i,e.format,t,r,a)}catch(n){ge.handle(n)}})}o(yS,"resolveCommand");function N7(r){if(r.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(r)||t.test(r)}o(N7,"isValidUuidFormat");function k7(r,e,t){let n=[],i=e.toLowerCase();function s(a){let c=(0,jf.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)&&n.push(l):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&n.push(l)}}}return o(s,"walk"),s(r),n}o(k7,"findFilesWithUuid");function vS(r){return`obsidian://vault/${encodeURI(r)}`}o(vS,"pathToObsidianUri");function wS(r){let e=r.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)(r,".md")}o(wS,"extractUuidFromFilename");function j7(r,e,t,n,i,s){let a=(0,Sn.relative)(e,r),c=vS(a),u=wS((0,Sn.basename)(r));if(n==="json"){let l={uuid:u,path:a,absolutePath:r,uri:c},f=lt.success(l,{durationMs:s,searchUuid:i});console.log(JSON.stringify(f,null,2))}else switch(t){case"path":console.log(r);break;case"json":console.log(JSON.stringify({uuid:u,path:a,absolutePath:r,uri:c},null,2));break;case"uri":default:console.log(c);break}}o(j7,"outputSingleResult");function L7(r,e,t,n,i,s){let a=r.map(c=>{let u=(0,Sn.relative)(e,c),l=vS(u);return{uuid:wS((0,Sn.basename)(c)),path:u,absolutePath:c,uri:l}});if(n==="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(L7,"outputMultipleResults");var Hi=new wr;Hi.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.198.0");Hi.command("sparql").description("SPARQL query execution").addCommand(nb());Hi.addCommand(lS());Hi.addCommand(dS());Hi.addCommand(pS());Hi.addCommand(gS());Hi.addCommand(yS());Hi.parse();
296
+ \u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Ms(n,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 P=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${P}%)...`)}l&&process.stdout.write("\r"+" ".repeat(60)+"\r");let C={...d,movedCount:m,alreadyCorrectCount:w,errorCount:_};R7(t,C),process.exit(C.success?0:5)}catch(n){ge.handle(n)}})}o(gS,"batchRepairCommand");var jf=require("fs"),Sn=require("path");function yS(){return new wr("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(r,e)=>{let t=e.output||"text";ge.setFormat(t);try{let n=Date.now();if(!N7(r))throw new rt(`Invalid UUID format: ${r}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:r});let i=(0,Sn.resolve)(e.vault);if(!(0,jf.existsSync)(i))throw new hi(i);let s=k7(i,r,e.partial??!1),a=Date.now()-n;if(s.length===0){if(t==="json"){let c=lt.error("VALIDATION_FILE_NOT_FOUND",`UUID not found: ${r}`,3,{context:{uuid:r}});console.log(JSON.stringify(c,null,2))}else console.error(`UUID not found: ${r}`);process.exit(1)}e.partial||s.length>1?L7(s,i,e.format,t,r,a):j7(s[0],i,e.format,t,r,a)}catch(n){ge.handle(n)}})}o(yS,"resolveCommand");function N7(r){if(r.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(r)||t.test(r)}o(N7,"isValidUuidFormat");function k7(r,e,t){let n=[],i=e.toLowerCase();function s(a){let c=(0,jf.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)&&n.push(l):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&n.push(l)}}}return o(s,"walk"),s(r),n}o(k7,"findFilesWithUuid");function vS(r){return`obsidian://vault/${encodeURI(r)}`}o(vS,"pathToObsidianUri");function wS(r){let e=r.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)(r,".md")}o(wS,"extractUuidFromFilename");function j7(r,e,t,n,i,s){let a=(0,Sn.relative)(e,r),c=vS(a),u=wS((0,Sn.basename)(r));if(n==="json"){let l={uuid:u,path:a,absolutePath:r,uri:c},f=lt.success(l,{durationMs:s,searchUuid:i});console.log(JSON.stringify(f,null,2))}else switch(t){case"path":console.log(r);break;case"json":console.log(JSON.stringify({uuid:u,path:a,absolutePath:r,uri:c},null,2));break;case"uri":default:console.log(c);break}}o(j7,"outputSingleResult");function L7(r,e,t,n,i,s){let a=r.map(c=>{let u=(0,Sn.relative)(e,c),l=vS(u);return{uuid:wS((0,Sn.basename)(c)),path:u,absolutePath:c,uri:l}});if(n==="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(L7,"outputMultipleResults");var Hi=new wr;Hi.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.198.1");Hi.command("sparql").description("SPARQL query execution").addCommand(nb());Hi.addCommand(lS());Hi.addCommand(dS());Hi.addCommand(pS());Hi.addCommand(gS());Hi.addCommand(yS());Hi.parse();
297
297
  /*! Bundled license information:
298
298
 
299
299
  reflect-metadata/Reflect.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitelev/exocortex-cli",
3
- "version": "13.198.0",
3
+ "version": "13.198.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": {