@kitelev/exocortex-cli 13.301.7 → 13.301.9
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.301.
|
|
2
|
+
// @kitelev/exocortex-cli v13.301.9
|
|
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 zi,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(l8,"formatAsTable");function f8(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(f8,"formatAsJson");async function u2(n,e,t,r){let i=n.output||"text";z.setFormat(i);try{let s=(0,Pd.resolve)(n.vault);if(!(0,l2.existsSync)(s))throw new Lt(s);let a=(0,Pd.resolve)(s,n.file);if(!(0,l2.existsSync)(a))throw new _i(a);let{tripleStore:c}=await c8(s,i),u=u8(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=a8.replace(/ASSET_URI/g,u);r&&(f=f.replace("FILTER(STRSTARTS",`FILTER(?predicate = <${r}>) FILTER(STRSTARTS`));let h=await JA(c,f);l.inbound=ZA(h,"inbound")}if(t){let f=o8.replace(/ASSET_URI/g,u);r&&(f=f.replace("FILTER(STRSTARTS",`FILTER(?predicate = <${r}>) FILTER(STRSTARTS`));let h=await JA(c,f);l.outbound=ZA(h,"outbound")}n.format==="json"||i==="json"?f8(l,e,t,i):l8(l,e,t)}catch(s){z.handle(s)}}o(u2,"executeAssetRelations");function tC(){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 u2(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 u2(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=h8(t)),await u2(e,!1,!0,t)})),n}o(tC,"assetCommand");function h8(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(h8,"expandPrefixedUri");var vn=new ft;vn.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.301.
|
|
529
|
+
`));let l={file:n.file,assetUri:u,inbound:[],outbound:[]};if(e){let f=a8.replace(/ASSET_URI/g,u);r&&(f=f.replace("FILTER(STRSTARTS",`FILTER(?predicate = <${r}>) FILTER(STRSTARTS`));let h=await JA(c,f);l.inbound=ZA(h,"inbound")}if(t){let f=o8.replace(/ASSET_URI/g,u);r&&(f=f.replace("FILTER(STRSTARTS",`FILTER(?predicate = <${r}>) FILTER(STRSTARTS`));let h=await JA(c,f);l.outbound=ZA(h,"outbound")}n.format==="json"||i==="json"?f8(l,e,t,i):l8(l,e,t)}catch(s){z.handle(s)}}o(u2,"executeAssetRelations");function tC(){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 u2(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 u2(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=h8(t)),await u2(e,!1,!0,t)})),n}o(tC,"assetCommand");function h8(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(h8,"expandPrefixedUri");var vn=new ft;vn.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("13.301.9");vn.command("sparql").description("SPARQL query execution").addCommand(x3());vn.addCommand(NA());vn.addCommand(kA());vn.addCommand(jA());vn.addCommand(VA());vn.addCommand(UA());vn.addCommand(HA());vn.addCommand(KA());vn.addCommand(XA());vn.addCommand(tC());vn.parse();
|
|
530
530
|
/*! Bundled license information:
|
|
531
531
|
|
|
532
532
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED