@kitelev/exocortex-cli 13.299.0 → 13.299.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.
- package/dist/index.js +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.299.
|
|
2
|
+
// @kitelev/exocortex-cli v13.299.1
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -526,7 +526,7 @@ ORDER BY ?targetLabel
|
|
|
526
526
|
`);if(t&&n.outbound.length>0){console.log(`\u{1F4E4} Outbound Relations (References):
|
|
527
527
|
`);let r=n.outbound.map(a=>({Target:a.target||"Unknown",Predicate:a.predicateLabel||a.predicate})),i=new Wi,s=r.map(a=>{let c=new Map;return c.set("Target",a.Target),c.set("Predicate",a.Predicate),c});console.log(i.format(s))}else t&&console.log(`\u{1F4E4} No outbound relations found.
|
|
528
528
|
`)}o(Zj,"formatAsTable");function e8(n,e,t,r){let i={file:n.file,assetUri:n.assetUri};if(e&&(i.inbound=n.inbound),t&&(i.outbound=n.outbound),r==="json"){let s=Be.success(i,{itemCount:(i.inbound?.length||0)+(i.outbound?.length||0)});console.log(JSON.stringify(s,null,2))}else console.log(JSON.stringify(i,null,2))}o(e8,"formatAsJson");async function i2(n,e,t,r){let i=n.output||"text";z.setFormat(i);try{let s=(0,xd.resolve)(n.vault);if(!(0,s2.existsSync)(s))throw new Nt(s);let a=(0,xd.resolve)(s,n.file);if(!(0,s2.existsSync)(a))throw new Si(a);let{tripleStore:c}=await Xj(s,i),u=Jj(s,n.file);i==="text"&&(console.log(`\u{1F50D} Querying relations for: ${n.file}`),console.log(` Asset URI: ${u}
|
|
529
|
-
`));let l={file:n.file,assetUri:u,inbound:[],outbound:[]};if(e){let f=Yj.replace(/ASSET_URI/g,u);r&&(f=f.replace("FILTER(STRSTARTS",`FILTER(?predicate = <${r}>) FILTER(STRSTARTS`));let h=await WA(c,f);l.inbound=HA(h,"inbound")}if(t){let f=Kj.replace(/ASSET_URI/g,u);r&&(f=f.replace("FILTER(STRSTARTS",`FILTER(?predicate = <${r}>) FILTER(STRSTARTS`));let h=await WA(c,f);l.outbound=HA(h,"outbound")}n.format==="json"||i==="json"?e8(l,e,t,i):Zj(l,e,t)}catch(s){z.handle(s)}}o(i2,"executeAssetRelations");function QA(){let n=new ft("asset").description("Asset relation queries (backlinks, references)");return n.addCommand(new ft("relations").description("Get all relations (inbound and outbound) for an asset").requiredOption("--file <path>","Path to asset file (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async e=>{await i2(e,!0,!0)})),n.addCommand(new ft("backlinks").description("Get inbound relations (backlinks) for an asset").requiredOption("--file <path>","Path to asset file (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async e=>{await i2(e,!0,!1)})),n.addCommand(new ft("references").description("Get outbound relations (references) for an asset").requiredOption("--file <path>","Path to asset file (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--predicate <uri>","Filter by predicate URI (e.g., exo:Asset_relates)").action(async e=>{let t=e.predicate;t&&(t=t8(t)),await i2(e,!1,!0,t)})),n}o(QA,"assetCommand");function t8(n){let e={"exo:":"https://exocortex.my/ontology/exo#","dcterms:":"http://purl.org/dc/terms/","rdf:":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdfs:":"http://www.w3.org/2000/01/rdf-schema#"};for(let[t,r]of Object.entries(e))if(n.startsWith(t))return n.replace(t,r);return n}o(t8,"expandPrefixedUri");var yn=new ft;yn.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.299.
|
|
529
|
+
`));let l={file:n.file,assetUri:u,inbound:[],outbound:[]};if(e){let f=Yj.replace(/ASSET_URI/g,u);r&&(f=f.replace("FILTER(STRSTARTS",`FILTER(?predicate = <${r}>) FILTER(STRSTARTS`));let h=await WA(c,f);l.inbound=HA(h,"inbound")}if(t){let f=Kj.replace(/ASSET_URI/g,u);r&&(f=f.replace("FILTER(STRSTARTS",`FILTER(?predicate = <${r}>) FILTER(STRSTARTS`));let h=await WA(c,f);l.outbound=HA(h,"outbound")}n.format==="json"||i==="json"?e8(l,e,t,i):Zj(l,e,t)}catch(s){z.handle(s)}}o(i2,"executeAssetRelations");function QA(){let n=new ft("asset").description("Asset relation queries (backlinks, references)");return n.addCommand(new ft("relations").description("Get all relations (inbound and outbound) for an asset").requiredOption("--file <path>","Path to asset file (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async e=>{await i2(e,!0,!0)})),n.addCommand(new ft("backlinks").description("Get inbound relations (backlinks) for an asset").requiredOption("--file <path>","Path to asset file (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async e=>{await i2(e,!0,!1)})),n.addCommand(new ft("references").description("Get outbound relations (references) for an asset").requiredOption("--file <path>","Path to asset file (relative to vault root)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--predicate <uri>","Filter by predicate URI (e.g., exo:Asset_relates)").action(async e=>{let t=e.predicate;t&&(t=t8(t)),await i2(e,!1,!0,t)})),n}o(QA,"assetCommand");function t8(n){let e={"exo:":"https://exocortex.my/ontology/exo#","dcterms:":"http://purl.org/dc/terms/","rdf:":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdfs:":"http://www.w3.org/2000/01/rdf-schema#"};for(let[t,r]of Object.entries(e))if(n.startsWith(t))return n.replace(t,r);return n}o(t8,"expandPrefixedUri");var yn=new ft;yn.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.299.1");yn.command("sparql").description("SPARQL query execution").addCommand(_T());yn.addCommand(xA());yn.addCommand(PA());yn.addCommand(RA());yn.addCommand(FA());yn.addCommand(NA());yn.addCommand($A());yn.addCommand(qA());yn.addCommand(GA());yn.addCommand(QA());yn.parse();
|
|
530
530
|
/*! Bundled license information:
|
|
531
531
|
|
|
532
532
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED