@kitelev/exocortex-cli 13.170.0 → 13.171.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.170.0
2
+ // @kitelev/exocortex-cli v13.171.0
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -288,7 +288,7 @@ globstar while`,e,p,t,g,w),this.matchOne(e.slice(p),t.slice(g),i))return this.de
288
288
  \u{1F4CB} Failed Files:`);for(let t of e.results.filter(i=>!i.success))console.log(` \u274C ${t.filepath}: ${t.error}`)}if(e.movedCount>0&&r==="text"){console.log(`
289
289
  \u{1F4CB} Moved Files:`);for(let t of e.results.filter(i=>i.success&&i.changes?.moved))console.log(` \u{1F4C1} ${t.filepath} \u2192 ${t.changes?.newPath}`)}}}o(LI,"outputResult");function AS(){return new mr("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";ye.setFormat(t);try{let i=(0,xS.resolve)(e.vault),n=new Vn(i),s=r;if(!await n.directoryExists(s))throw new Je(`Directory not found: ${s}`,"exocortex batch-repair <existing-directory>");let c=await n.getMarkdownFiles(s);if(c.length===0){if(t==="json"){let O=ct.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(`
290
290
  \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(`
291
- \u{1F50D} Processing ${c.length} files in ${s}...`);let p=await new As(i,e.dryRun).executeBatch(u,!1),g=0,w=0,_=0;for(let O of p.results)if(O.success?O.changes?.moved?g++: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 A={...p,movedCount:g,alreadyCorrectCount:w,errorCount:_};LI(t,A),process.exit(A.success?0:5)}catch(i){ye.handle(i)}})}o(AS,"batchRepairCommand");var uf=require("fs"),yi=require("path");function CS(){return new mr("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";ye.setFormat(t);try{let i=Date.now();if(!MI(r))throw new Je(`Invalid UUID format: ${r}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:r});let n=(0,yi.resolve)(e.vault);if(!(0,uf.existsSync)(n))throw new un(n);let s=VI(n,r,e.partial??!1),a=Date.now()-i;if(s.length===0){if(t==="json"){let c=ct.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?qI(s,n,e.format,t,r,a):$I(s[0],n,e.format,t,r,a)}catch(i){ye.handle(i)}})}o(CS,"resolveCommand");function MI(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(MI,"isValidUuidFormat");function VI(r,e,t){let i=[],n=e.toLowerCase();function s(a){let c=(0,uf.readdirSync)(a,{withFileTypes:!0});for(let u of c){let l=(0,yi.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(n)&&i.push(l):(f.startsWith(n+".md")||f.startsWith(n+" ")||f.startsWith(n+"-"))&&i.push(l)}}}return o(s,"walk"),s(r),i}o(VI,"findFilesWithUuid");function OS(r){return`obsidian://vault/${encodeURI(r)}`}o(OS,"pathToObsidianUri");function FS(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,yi.basename)(r,".md")}o(FS,"extractUuidFromFilename");function $I(r,e,t,i,n,s){let a=(0,yi.relative)(e,r),c=OS(a),u=FS((0,yi.basename)(r));if(i==="json"){let l={uuid:u,path:a,absolutePath:r,uri:c},f=ct.success(l,{durationMs:s,searchUuid:n});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($I,"outputSingleResult");function qI(r,e,t,i,n,s){let a=r.map(c=>{let u=(0,yi.relative)(e,c),l=OS(u);return{uuid:FS((0,yi.basename)(c)),path:u,absolutePath:c,uri:l}});if(i==="json"){let c=ct.success({matches:a,count:a.length},{durationMs:s,searchUuid:n,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(qI,"outputMultipleResults");var qn=new mr;qn.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.170.0");qn.command("sparql").description("SPARQL query execution").addCommand(dw());qn.addCommand(wS());qn.addCommand(ES());qn.addCommand(TS());qn.addCommand(AS());qn.addCommand(CS());qn.parse();
291
+ \u{1F50D} Processing ${c.length} files in ${s}...`);let p=await new As(i,e.dryRun).executeBatch(u,!1),g=0,w=0,_=0;for(let O of p.results)if(O.success?O.changes?.moved?g++: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 A={...p,movedCount:g,alreadyCorrectCount:w,errorCount:_};LI(t,A),process.exit(A.success?0:5)}catch(i){ye.handle(i)}})}o(AS,"batchRepairCommand");var uf=require("fs"),yi=require("path");function CS(){return new mr("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";ye.setFormat(t);try{let i=Date.now();if(!MI(r))throw new Je(`Invalid UUID format: ${r}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:r});let n=(0,yi.resolve)(e.vault);if(!(0,uf.existsSync)(n))throw new un(n);let s=VI(n,r,e.partial??!1),a=Date.now()-i;if(s.length===0){if(t==="json"){let c=ct.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?qI(s,n,e.format,t,r,a):$I(s[0],n,e.format,t,r,a)}catch(i){ye.handle(i)}})}o(CS,"resolveCommand");function MI(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(MI,"isValidUuidFormat");function VI(r,e,t){let i=[],n=e.toLowerCase();function s(a){let c=(0,uf.readdirSync)(a,{withFileTypes:!0});for(let u of c){let l=(0,yi.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(n)&&i.push(l):(f.startsWith(n+".md")||f.startsWith(n+" ")||f.startsWith(n+"-"))&&i.push(l)}}}return o(s,"walk"),s(r),i}o(VI,"findFilesWithUuid");function OS(r){return`obsidian://vault/${encodeURI(r)}`}o(OS,"pathToObsidianUri");function FS(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,yi.basename)(r,".md")}o(FS,"extractUuidFromFilename");function $I(r,e,t,i,n,s){let a=(0,yi.relative)(e,r),c=OS(a),u=FS((0,yi.basename)(r));if(i==="json"){let l={uuid:u,path:a,absolutePath:r,uri:c},f=ct.success(l,{durationMs:s,searchUuid:n});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($I,"outputSingleResult");function qI(r,e,t,i,n,s){let a=r.map(c=>{let u=(0,yi.relative)(e,c),l=OS(u);return{uuid:FS((0,yi.basename)(c)),path:u,absolutePath:c,uri:l}});if(i==="json"){let c=ct.success({matches:a,count:a.length},{durationMs:s,searchUuid:n,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(qI,"outputMultipleResults");var qn=new mr;qn.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.171.0");qn.command("sparql").description("SPARQL query execution").addCommand(dw());qn.addCommand(wS());qn.addCommand(ES());qn.addCommand(TS());qn.addCommand(AS());qn.addCommand(CS());qn.parse();
292
292
  /*! Bundled license information:
293
293
 
294
294
  reflect-metadata/Reflect.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitelev/exocortex-cli",
3
- "version": "13.170.0",
3
+ "version": "13.171.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": {