@kitelev/exocortex-cli 13.254.0 → 13.255.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.
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.254.0
2
+ // @kitelev/exocortex-cli v13.255.0
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(o8,"outputResult");function yE(){return new Er("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,gE.resolve)(e.vault),i=new Zi(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 Hs(r,e.dryRun).executeBatch(u,!1),m=0,w=0,b=0;for(let O of d.results)if(O.success?O.changes?.moved?m++:w++:b++,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:b};o8(t,A),process.exit(A.success?0:5)}catch(r){ye.handle(r)}})}o(yE,"batchRepairCommand");var dh=require("fs"),On=require("path");function vE(){return new Er("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(!c8(n))throw new nt(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,On.resolve)(e.vault);if(!(0,dh.existsSync)(i))throw new wi(i);let s=u8(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?f8(s,i,e.format,t,n,a):l8(s[0],i,e.format,t,n,a)}catch(r){ye.handle(r)}})}o(vE,"resolveCommand");function c8(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(c8,"isValidUuidFormat");function u8(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,dh.readdirSync)(a,{withFileTypes:!0});for(let u of c){let l=(0,On.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(u8,"findFilesWithUuid");function wE(n){return`obsidian://vault/${encodeURI(n)}`}o(wE,"pathToObsidianUri");function _E(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,On.basename)(n,".md")}o(_E,"extractUuidFromFilename");function l8(n,e,t,r,i,s){let a=(0,On.relative)(e,n),c=wE(a),u=_E((0,On.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(l8,"outputSingleResult");function f8(n,e,t,r,i,s){let a=n.map(c=>{let u=(0,On.relative)(e,c),l=wE(u);return{uuid:_E((0,On.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(f8,"outputMultipleResults");var ts=new Er;ts.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.254.0");ts.command("sparql").description("SPARQL query execution").addCommand(iS());ts.addCommand(fE());ts.addCommand(pE());ts.addCommand(mE());ts.addCommand(yE());ts.addCommand(vE());ts.parse();
302
+ \u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Hs(r,e.dryRun).executeBatch(u,!1),m=0,w=0,b=0;for(let O of d.results)if(O.success?O.changes?.moved?m++:w++:b++,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:b};o8(t,A),process.exit(A.success?0:5)}catch(r){ye.handle(r)}})}o(yE,"batchRepairCommand");var dh=require("fs"),On=require("path");function vE(){return new Er("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(!c8(n))throw new nt(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,On.resolve)(e.vault);if(!(0,dh.existsSync)(i))throw new wi(i);let s=u8(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?f8(s,i,e.format,t,n,a):l8(s[0],i,e.format,t,n,a)}catch(r){ye.handle(r)}})}o(vE,"resolveCommand");function c8(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(c8,"isValidUuidFormat");function u8(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,dh.readdirSync)(a,{withFileTypes:!0});for(let u of c){let l=(0,On.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(u8,"findFilesWithUuid");function wE(n){return`obsidian://vault/${encodeURI(n)}`}o(wE,"pathToObsidianUri");function _E(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,On.basename)(n,".md")}o(_E,"extractUuidFromFilename");function l8(n,e,t,r,i,s){let a=(0,On.relative)(e,n),c=wE(a),u=_E((0,On.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(l8,"outputSingleResult");function f8(n,e,t,r,i,s){let a=n.map(c=>{let u=(0,On.relative)(e,c),l=wE(u);return{uuid:_E((0,On.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(f8,"outputMultipleResults");var ts=new Er;ts.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.255.0");ts.command("sparql").description("SPARQL query execution").addCommand(iS());ts.addCommand(fE());ts.addCommand(pE());ts.addCommand(mE());ts.addCommand(yE());ts.addCommand(vE());ts.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.254.0",
3
+ "version": "13.255.0",
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": {