@kitelev/exocortex-cli 16.174.0 → 16.175.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 +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v16.
|
|
2
|
+
// @kitelev/exocortex-cli v16.175.1
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -484,7 +484,7 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
484
484
|
`),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new or.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let o=new or.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&o.type!=="construct")o=new or.AlgebraOptimizer().optimize(o);else if(!e.noOptimize&&o.type==="construct"){let c=new or.AlgebraOptimizer,l=o;o={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=ot.success({valid:!0,queryType:bj(i),message:"Query syntax is valid"});console.log(JSON.stringify(s,null,2))}else console.log("\u2705 Query syntax is valid"),console.log(` Query type: ${bj(i)}`)}catch(i){wj(i,n,t)}}a(wne,"executeDryRun");function bj(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}a(bj,"getQueryType");function vne(n,e){switch(e){case"json":let t=new P0;console.log(t.format(n));break;case"csv":let r=new D0;console.log(r.format(n));break;case"table":default:let i=new x0;console.log(i.format(n));break}}a(vne,"formatSelectResults");function Ene(n,e){let t=new Mu;switch(e){case"json":console.log(t.formatJson(n));break;case"ntriples":console.log(t.formatNTriples(n));break;case"table":default:console.log(t.formatTable(n));break}}a(Ene,"formatConstructResults");function Tne(n,e){switch(e){case"json":console.log(JSON.stringify(n,null,2));break;case"csv":if(n.length===0){console.log("");return}let t=Object.keys(n[0]);console.log(t.join(","));for(let i of n){let s=t.map(o=>{let c=i[o];return c==null?"":String(c).includes(",")?`"${c}"`:String(c)});console.log(s.join(","))}break;case"table":default:if(n.length===0){console.log("No results.");return}let r=Object.keys(n[0]);console.log(r.join(" ")),console.log(r.map(()=>"---").join(" "));for(let i of n){let s=r.map(o=>String(i[o]??""));console.log(s.join(" "))}break}}a(Tne,"formatCachedSelectResults");function Ine(n,e){switch(e){case"json":console.log(JSON.stringify(n,null,2));break;case"ntriples":for(let t of n)console.log(`<${t.subject}> <${t.predicate}> ${Ane(t.object)} .`);break;case"table":default:console.log("Subject Predicate Object"),console.log("--- --- ---");for(let t of n)console.log(`${t.subject} ${t.predicate} ${t.object}`);break}}a(Ine,"formatCachedConstructResults");function Ane(n){return K0.formatObject(n)}a(Ane,"formatNTriplesObject");function Rne(n,e){for(let t of n){let r=[`${t.type.toUpperCase()}`];switch(t.inserted!==void 0&&r.push(`inserted: ${t.inserted}`),t.deleted!==void 0&&r.push(`deleted: ${t.deleted}`),r.push(t.success?"OK":"FAILED"),e){case"json":console.log(JSON.stringify(t,null,2));break;case"csv":n.indexOf(t)===0&&console.log("type,inserted,deleted,success"),console.log(`${t.type},${t.inserted??""},${t.deleted??""},${t.success}`);break;case"table":default:console.log(`\u2705 ${r.join(" | ")}`);break}}}a(Rne,"formatUpdateResults");var vj=require("fs"),Ej=require("path"),zs=_e(at());function Tj(){return new ke("index").description("Build or refresh the triple cache for faster SPARQL queries").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--stats","Show cache statistics after building").option("--force","Force rebuild even if cache is valid").option("--strict","Fail on first invalid IRI instead of skipping").option("--no-inference","Disable RDFS subClassOf inference materialization").action(async n=>{let e=n.output||"text";be.setFormat(e);try{let t=(0,Ej.resolve)(n.vault);if(!(0,vj.existsSync)(t))throw new Qe(t);let r=new yi(t),i=r.getCachePath();n.force&&(e==="text"&&console.log("\u{1F5D1}\uFE0F Invalidating existing cache..."),await r.invalidate()),e==="text"&&console.log(`\u{1F4E6} Building triple cache for: ${t}...`);let s=Date.now(),o=await r.buildCacheWithValidation({strict:n.strict??!1}),c=0;if(n.inference!==!1){let{triples:u}=await r.loadOrBuild(),f=new zs.InMemoryTripleStore;await f.addAll(u),c=await new zs.RDFSInferenceEngine().materialize(f);let h=new zs.NonInheritablePropertyRegistry;await h.initialize(f);let p=new zs.PropertyCardinalityRegistry;await p.initialize(f);let _=await new zs.PrototypeChainMaterializer(h,p).materialize(f);if(c+=_,c>0){let w=await f.match();await r.saveTriples(w),o.tripleCount+=c}e==="text"&&c>0&&console.log(`\u{1F9E0} Materialized ${c} inferred triples (RDFS + prototype chain)`)}let l=Date.now()-s;if(e==="json"){let u={action:"build",cachePath:i,tripleCount:o.tripleCount,durationMs:o.durationMs},f={summary:o.summary,skippedFiles:o.skippedFiles};if(n.stats){let d=await r.getCacheStats();if(d){let h={tripleCount:d.tripleCount,createdAt:d.createdAt.toISOString(),isValid:d.isValid,sizeBytes:d.sizeBytes,cachePath:i},p=ot.success({cache:u,stats:h,validation:f},{durationMs:l});console.log(JSON.stringify(p,null,2))}}else{let d=ot.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(d,null,2))}}else{if(o.skippedFiles.length>0){console.log(`
|
|
485
485
|
\u26A0\uFE0F Files skipped due to IRI issues:`);for(let u of o.skippedFiles)console.log(` - ${u.path}`),console.log(` ${u.reason}`);console.log("")}if(console.log(`\u2705 Indexed ${o.summary.indexed} files, skipped ${o.summary.skipped} (total: ${o.summary.total})`),console.log(`\u{1F4CA} Created cache with ${o.tripleCount.toLocaleString()} triples at ${i}`),console.log(`\u23F1\uFE0F Build time: ${o.durationMs}ms`),n.stats){let u=await r.getCacheStats();u&&(console.log(`
|
|
486
486
|
\u{1F4CA} Cache Statistics:`),console.log(` Triples: ${u.tripleCount.toLocaleString()}`),console.log(` Created: ${u.createdAt.toISOString()}`),console.log(` Valid: ${u.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${One(u.sizeBytes)}`))}}}catch(t){be.handle(t)}})}a(Tj,"sparqlIndexCommand");function One(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}a(One,"formatBytes");var J0=require("fs"),us=require("path");function Ij(){return new ke("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";be.setFormat(t);try{let r=Date.now();if(!Cne(n))throw new lt(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,us.resolve)(e.vault);if(!(0,J0.existsSync)(i))throw new Qe(i);let s=xne(i,n,e.partial??!1),o=Date.now()-r;if(s.length===0){if(t==="json"){let c=ot.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?Dne(s,i,e.format,t,n,o):Pne(s[0],i,e.format,t,n,o)}catch(r){be.handle(r)}})}a(Ij,"resolveCommand");function Cne(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)}a(Cne,"isValidUuidFormat");function xne(n,e,t){let r=[],i=e.toLowerCase();function s(o){let c=(0,J0.readdirSync)(o,{withFileTypes:!0});for(let l of c){let u=(0,us.join)(o,l.name);if(l.isDirectory())!l.name.startsWith(".")&&l.name!=="node_modules"&&s(u);else if(l.isFile()&&l.name.endsWith(".md")){let f=l.name.toLowerCase();t?f.includes(i)&&r.push(u):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&r.push(u)}}}return a(s,"walk"),s(n),r}a(xne,"findFilesWithUuid");function Aj(n){return`obsidian://vault/${encodeURI(n)}`}a(Aj,"pathToObsidianUri");function Rj(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,us.basename)(n,".md")}a(Rj,"extractUuidFromFilename");function Pne(n,e,t,r,i,s){let o=(0,us.relative)(e,n),c=Aj(o),l=Rj((0,us.basename)(n));if(r==="json"){let u={uuid:l,path:o,absolutePath:n,uri:c},f=ot.success(u,{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:l,path:o,absolutePath:n,uri:c},null,2));break;case"uri":default:console.log(c);break}}a(Pne,"outputSingleResult");function Dne(n,e,t,r,i,s){let o=n.map(c=>{let l=(0,us.relative)(e,c),u=Aj(l);return{uuid:Rj((0,us.basename)(c)),path:l,absolutePath:c,uri:u}});if(r==="json"){let c=ot.success({matches:o,count:o.length},{durationMs:s,searchUuid:i,itemCount:o.length});console.log(JSON.stringify(c,null,2))}else switch(t){case"path":for(let c of o)console.log(c.absolutePath);break;case"json":console.log(JSON.stringify(o,null,2));break;case"uri":default:for(let c of o)console.log(c.uri);break}}a(Dne,"outputMultipleResults");var aA=require("fs"),fs=require("path"),ar=_e(at());var Oj=_e(at());function Z0(n,e){return t=>{let r=typeof t.filePath=="string"&&t.filePath.length>0?t.filePath:null;if(r===null||r.split("/").includes("09 Templates"))return!1;let i=n.getAbstractFileByPath(r);if(i===null||!("basename"in i))return!1;let s=i,o=n.getFrontmatter(s)??{},c=e.getExpectedFolderSync(s,o),l=typeof t.currentFolder=="string"?t.currentFolder:s.parent?.path??"";return(0,Oj.needsFolderRepair)(l,c)}}a(Z0,"createIsInWrongFolderHostFunction");var Cj=_e(at());function e_(n){return e=>{let t=typeof e.filePath=="string"&&e.filePath.length>0?e.filePath:null;if(t===null||t.split("/").includes("09 Templates"))return!1;let r=n.getAbstractFileByPath(t);if(r===null||!("basename"in r))return!1;let i=r,s=n.getFrontmatter(i)??{};return(0,Cj.hasEmptyProperties)(s)}}a(e_,"createHasEmptyPropertiesHostFunction");var Fne=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function xj(n){if(typeof n!="string")return null;let e=n.replace(/["'[\]]/g,"").trim(),t=e.indexOf("|");return t!==-1&&(e=e.slice(0,t).trim()),e.length>0?e:null}a(xj,"cleanRef");function Lne(n){if(!n)return[];let e=n.exo__Instance_class,t=[],r=a(i=>{let s=xj(i);s&&!t.includes(s)&&t.push(s)},"collect");if(typeof e=="string")r(e);else if(Array.isArray(e))for(let i of e)r(i);return t}a(Lne,"extractClasses");function Nne(n){let e=n.match(/\/ontology\/([^#/]+)#(.+)$/);return e?`${e[1]}__${e[2]}`:null}a(Nne,"ontologyIriToSymbolic");async function kne(n,e){let t=await n.match(new ar.IRI(e),ar.Namespace.EXO.term("Instance_class"),void 0),r=[];for(let i of t){let s=typeof i.object.value=="string"?i.object.value:String(i.object),o=Nne(s);o&&!r.includes(o)&&r.push(o)}return r}a(kne,"deriveStoreSymbolicClasses");async function Mne(n){let e=new ar.IRI("https://exocortex.my/ontology/exocmd#Command_cliName"),t=await n.match(void 0,e,void 0),r=new Map;for(let i of t){let s=typeof i.subject.value=="string"?i.subject.value:String(i.subject),o=typeof i.object.value=="string"?i.object.value:String(i.object),c=s.match(Fne);c&&o.length>0&&r.set(c[1],o)}return r}a(Mne,"buildCliNameMap");async function jne(n,e,t=(0,ar.liveClock)()){let r=(0,fs.resolve)(n);if(!(0,aA.existsSync)(r))throw new Qe(r);let i=(0,fs.resolve)(r,e);if(!(0,aA.existsSync)(i))throw new Error(`Target file not found: ${e}`);let s=(0,fs.relative)(r,i);if(s===".."||s.startsWith(`..${fs.sep}`)||(0,fs.isAbsolute)(s))throw new Error(`Target is outside the vault: ${e} (vault: ${r})`);let o=new jt(r),l=await new ar.NoteToRDFConverter(o).convertVault(),u=new ar.InMemoryTripleStore;await u.addAll(l);let f=(0,ar.vaultPathToIRI)(s),d=o.getAbstractFileByPath(s),h=d!==null&&"basename"in d?d:null,p=h?o.getFrontmatter(h):null,y=Lne(p),_=await kne(u,f),w=[...new Set([...y,..._])],S=xj(p?.exo__Asset_prototype),E=p?.exo__Asset_uid,x=typeof E=="string"?E:void 0,C=await new ar.CommandResolver(u).resolveForAssetMulti(f,w,S??void 0),F=new ar.FolderRepairService(o),Q=new ar.PreconditionEvaluator(u,void 0,{clock:t});(0,ar.registerDefaultHostFunctions)(Q),Q.registerHostFunction("isInWrongFolder",Z0(o,F)),Q.registerHostFunction("hasObsoleteProperties",e_(o));let U=(0,fs.dirname)(s),j={targetIRI:f,filePath:s,fileBasename:h?.basename,currentFolder:U==="."?"":U,assetUid:x},K=await Mne(u),N=await Promise.all(C.map(async ge=>{let Y;try{Y=await Q.evaluate(ge.command.precondition,f,j)}catch{Y=!1}return{rc:ge,available:Y}})),le=a(ge=>({id:ge.command.id,label:ge.command.name,cliName:K.get(ge.command.id)??null,category:ge.command.category??null}),"toEntry"),Se=N.filter(ge=>ge.available).map(ge=>le(ge.rc)),Z=N.filter(ge=>!ge.available).map(ge=>({...le(ge.rc),reason:"precondition-false"}));return{target:s,classes:w,prototype:S,visible:Se,hidden:Z}}a(jne,"resolveButtons");function $ne(n,e){let t=a(r=>`${r.label}${r.cliName?` (${r.cliName})`:""}`,"fmt");if(console.log(`Command buttons on "${n.target}" (${n.visible.length} visible):`),n.visible.length===0)console.log(" (none)");else for(let r of n.visible)console.log(` \u2713 ${t(r)}`);if(e)if(console.log(`
|
|
487
|
-
Hidden by precondition (${n.hidden.length}):`),n.hidden.length===0)console.log(" (none)");else for(let r of n.hidden)console.log(` \u2717 ${t(r)} \u2014 precondition not satisfied`)}a($ne,"printHuman");function Pj(){return new ke("resolve-buttons").description("Print the actual command button-set for an asset \u2014 binding-match \u2229 precondition-eval (Issue #3833). The authoritative button-visibility oracle; strictly more complete than `apply --dry-run` (precondition-only).").argument("<target>","Vault-relative path to the target asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--json","Emit structured JSON instead of human-readable text").option("--show-hidden","Also list commands that bind but are hidden by their precondition").action(async(n,e)=>{be.setFormat("text");try{let t=await jne(e.vault,n);if(e.json){let r=e.showHidden?t:{...t,hidden:[]};console.log(JSON.stringify(r,null,2))}else $ne(t,e.showHidden??!1)}catch(t){be.handle(t),process.exit(5)}})}a(Pj,"resolveButtonsCommand");var Kj=require("fs"),Yj=require("path");var Ks=require("fs"),Go=require("path"),Dj=require("child_process"),ut=_e(at());var Une=new Set(["aliases","archived","tags","cssclasses","publish","permalink","description","image","cover","banner","title","share","share_link","share_updated","metadata","uri"]),lA=new Map([["exo__","https://exocortex.my/ontology/exo#"],["ems__","https://exocortex.my/ontology/ems#"],["exocmd__","https://exocortex.my/ontology/exocmd#"],["ims__","https://exocortex.my/ontology/ims#"],["exoql__","https://exocortex.my/ontology/exoql#"],["query__","https://exocortex.my/ontology/query#"],["ztlk__","https://exocortex.my/ontology/ztlk#"],["ptms__","https://exocortex.my/ontology/ptms#"],["lit__","https://exocortex.my/ontology/lit#"],["inbox__","https://exocortex.my/ontology/inbox#"],["place__","https://exocortex.my/ontology/place#"],["exoob__","https://exocortex.my/ontology/exoob#"],["pn__","https://exocortex.my/ontology/pn#"],["period__","https://exocortex.my/ontology/period#"],["rdf__","http://www.w3.org/1999/02/22-rdf-syntax-ns#"],["rdfs__","http://www.w3.org/2000/01/rdf-schema#"],["owl__","http://www.w3.org/2002/07/owl#"]]);function Bne(n,e){if(!n)return!1;let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/),o=s?s[1]:i;if(o===e||o.includes(e))return!0}return!1}a(Bne,"frontmatterMatchesClass");async function Fj(n,e){let t,r=!1;if(e){let s=await new yi(n).loadOrBuild();t=s.triples,r=s.cacheHit}else{let i=new jt(n);t=await new ut.NoteToRDFConverter(i).convertVault()}return{triples:t,cacheHit:r}}a(Fj,"loadTriplesFromAllVaults");var Vne="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function Lj(n){let e=n.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return n.match(/^---\r?\n---/)?{}:null;let t=e[1].split(`
|
|
487
|
+
Hidden by precondition (${n.hidden.length}):`),n.hidden.length===0)console.log(" (none)");else for(let r of n.hidden)console.log(` \u2717 ${t(r)} \u2014 precondition not satisfied`)}a($ne,"printHuman");function Pj(){return new ke("resolve-buttons").description("Print the actual command button-set for an asset \u2014 binding-match \u2229 precondition-eval (Issue #3833). The authoritative button-visibility oracle; strictly more complete than `apply --dry-run` (precondition-only).").argument("<target>","Vault-relative path to the target asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--json","Emit structured JSON instead of human-readable text").option("--show-hidden","Also list commands that bind but are hidden by their precondition").action(async(n,e)=>{be.setFormat(e.json?"json":"text");try{let t=await jne(e.vault,n);if(e.json){let r=e.showHidden?t:{...t,hidden:[]};console.log(JSON.stringify(r,null,2))}else $ne(t,e.showHidden??!1)}catch(t){be.handle(t),process.exit(5)}})}a(Pj,"resolveButtonsCommand");var Kj=require("fs"),Yj=require("path");var Ks=require("fs"),Go=require("path"),Dj=require("child_process"),ut=_e(at());var Une=new Set(["aliases","archived","tags","cssclasses","publish","permalink","description","image","cover","banner","title","share","share_link","share_updated","metadata","uri"]),lA=new Map([["exo__","https://exocortex.my/ontology/exo#"],["ems__","https://exocortex.my/ontology/ems#"],["exocmd__","https://exocortex.my/ontology/exocmd#"],["ims__","https://exocortex.my/ontology/ims#"],["exoql__","https://exocortex.my/ontology/exoql#"],["query__","https://exocortex.my/ontology/query#"],["ztlk__","https://exocortex.my/ontology/ztlk#"],["ptms__","https://exocortex.my/ontology/ptms#"],["lit__","https://exocortex.my/ontology/lit#"],["inbox__","https://exocortex.my/ontology/inbox#"],["place__","https://exocortex.my/ontology/place#"],["exoob__","https://exocortex.my/ontology/exoob#"],["pn__","https://exocortex.my/ontology/pn#"],["period__","https://exocortex.my/ontology/period#"],["rdf__","http://www.w3.org/1999/02/22-rdf-syntax-ns#"],["rdfs__","http://www.w3.org/2000/01/rdf-schema#"],["owl__","http://www.w3.org/2002/07/owl#"]]);function Bne(n,e){if(!n)return!1;let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/),o=s?s[1]:i;if(o===e||o.includes(e))return!0}return!1}a(Bne,"frontmatterMatchesClass");async function Fj(n,e){let t,r=!1;if(e){let s=await new yi(n).loadOrBuild();t=s.triples,r=s.cacheHit}else{let i=new jt(n);t=await new ut.NoteToRDFConverter(i).convertVault()}return{triples:t,cacheHit:r}}a(Fj,"loadTriplesFromAllVaults");var Vne="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function Lj(n){let e=n.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return n.match(/^---\r?\n---/)?{}:null;let t=e[1].split(`
|
|
488
488
|
`),r={};for(let i of t){let s=i.match(/^(\w[\w]*):\s*(.*)$/);s&&(r[s[1]]=!0)}return r}a(Lj,"extractFrontmatter");function Nj(n){for(let e of lA.keys())if(n.startsWith(e))return!0;return!1}a(Nj,"hasKnownPrefix");function kj(n){for(let[e,t]of lA)if(n.startsWith(e))return t+n.substring(e.length);return null}a(kj,"keyToURI");function qne(n){let e=[],t=[];for(let r of n)Une.has(r)||(Nj(r)?e.push(r):t.push(r));return{toValidate:e,unknownPrefix:t}}a(qne,"classifyKeys");function Mj(n){try{return(0,Dj.execSync)("git diff --cached --name-only",{cwd:n,encoding:"utf-8"}).split(`
|
|
489
489
|
`).filter(t=>t.endsWith(".md")&&t.trim().length>0)}catch{return[]}}a(Mj,"getStagedMdFiles");function Gne(n){let e=[];function t(r){let i=(0,Ks.readdirSync)(r);for(let s of i){if(s.startsWith(".")||s==="node_modules")continue;let o=(0,Go.join)(r,s);(0,Ks.statSync)(o).isDirectory()?t(o):s.endsWith(".md")&&e.push((0,Go.relative)(n,o))}}return a(t,"walk"),t(n),e}a(Gne,"collectMdFiles");function Wne(n){let e=n.lastIndexOf("/");if(e===-1)return null;let t=decodeURIComponent(n.substring(e+1));return t.endsWith(".md")&&(t=t.slice(0,-3)),Nj(t)?t:null}a(Wne,"extractPropertyNameFromURI");async function Hne(n){let e=new ut.InMemoryTripleStore;await e.addAll(n);let t=new ut.ExoQLParser,r=Vu(`SELECT ?s ?label WHERE {
|
|
490
490
|
{
|
|
@@ -638,7 +638,7 @@ Duplicate bindings (${n.duplicates.length}) \u2014 uid claimed by >1 test (warni
|
|
|
638
638
|
Skipped floor check for ${n.unknownPriority} requirement(s) with unparseable priority (fail-open).`),n.clean?e==="hard"&&!n.rampReady?console.error(`
|
|
639
639
|
FAIL (hard gate): ramp not ready \u2014 ${n.p0Orphans} P0 requirement(s) unbound`+(n.p0Total===0?" (no P0 requirements found)":"")+"."):console.log(`
|
|
640
640
|
OK: no hard findings (dangling tags + binding-class floor are clean).`):console.error(`
|
|
641
|
-
FAIL: ${n.dangling.length} dangling + ${n.floorViolations.length} floor violation(s) + ${n.activeViolations.length} active-requirement invariant violation(s) + ${n.danglingEvidence.length} dangling evidence link(s).`)}a(Ioe,"renderText");function Aoe(n,e,t){return!n.clean||t&&n.orphans.length>0||e==="hard"&&!n.rampReady}a(Aoe,"isHardFail");function x9(){return new ke("audit").description("Audit requirement\u2194test traceability: orphans, dangling @req tags, duplicate bindings, binding-class floor, coverage, P0 ramp-readiness").requiredOption("--reqs <path>","Directory tree containing req__Requirement assets (a vault or a reqs assetspace clone)").option("--tests <path>","Test-corpus root scanned for @req:<uid> tags",".").option("--output <type>","Response format: text|json","text").option("--strict","Also exit 1 on orphan requirements",!1).option("--gate <mode>","Gate mode: soft (warn only on hard findings) | hard (also block when the P0 checklist is not ramp-ready)","soft").action(async n=>{let e=n.output??"text";be.setFormat(e);let t=n.gate==="hard"?"hard":"soft";try{let r=(0,qa.resolve)(n.reqs);if(!(0,Ga.existsSync)(r)||!(0,Ga.statSync)(r).isDirectory())throw new Qe(r);let i=(0,qa.resolve)(n.tests??".");if(!(0,Ga.existsSync)(i)||!(0,Ga.statSync)(i).isDirectory())throw new Qe(i);let[s,o]=await Promise.all([Soe(r),voe(i)]),c=Eoe(s,o);e==="json"?console.log(JSON.stringify({...c,gate:t},null,2)):Ioe(c,t),Aoe(c,t,n.strict===!0)&&(process.exitCode=1)}catch(r){be.handle(r)}})}a(x9,"requirementsAuditCommand");function P9(){let n=new ke("requirements").description("Requirements-management tooling (RFC 0003): traceability checker");return n.addCommand(x9()),n}a(P9,"requirementsCommand");function P_(n){let e=new ke;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(n??"16.
|
|
641
|
+
FAIL: ${n.dangling.length} dangling + ${n.floorViolations.length} floor violation(s) + ${n.activeViolations.length} active-requirement invariant violation(s) + ${n.danglingEvidence.length} dangling evidence link(s).`)}a(Ioe,"renderText");function Aoe(n,e,t){return!n.clean||t&&n.orphans.length>0||e==="hard"&&!n.rampReady}a(Aoe,"isHardFail");function x9(){return new ke("audit").description("Audit requirement\u2194test traceability: orphans, dangling @req tags, duplicate bindings, binding-class floor, coverage, P0 ramp-readiness").requiredOption("--reqs <path>","Directory tree containing req__Requirement assets (a vault or a reqs assetspace clone)").option("--tests <path>","Test-corpus root scanned for @req:<uid> tags",".").option("--output <type>","Response format: text|json","text").option("--strict","Also exit 1 on orphan requirements",!1).option("--gate <mode>","Gate mode: soft (warn only on hard findings) | hard (also block when the P0 checklist is not ramp-ready)","soft").action(async n=>{let e=n.output??"text";be.setFormat(e);let t=n.gate==="hard"?"hard":"soft";try{let r=(0,qa.resolve)(n.reqs);if(!(0,Ga.existsSync)(r)||!(0,Ga.statSync)(r).isDirectory())throw new Qe(r);let i=(0,qa.resolve)(n.tests??".");if(!(0,Ga.existsSync)(i)||!(0,Ga.statSync)(i).isDirectory())throw new Qe(i);let[s,o]=await Promise.all([Soe(r),voe(i)]),c=Eoe(s,o);e==="json"?console.log(JSON.stringify({...c,gate:t},null,2)):Ioe(c,t),Aoe(c,t,n.strict===!0)&&(process.exitCode=1)}catch(r){be.handle(r)}})}a(x9,"requirementsAuditCommand");function P9(){let n=new ke("requirements").description("Requirements-management tooling (RFC 0003): traceability checker");return n.addCommand(x9()),n}a(P9,"requirementsCommand");function P_(n){let e=new ke;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(n??"16.175.1"),e.addCommand(R4()),e.addCommand(N4()),e.addCommand(Sj()),e.addCommand(Tj()),e.addCommand(Xj()),e.addCommand(Ij()),e.addCommand(Pj()),e.addCommand(Zj()),e.addCommand(c4()),e.addCommand(u4()),e.addCommand(T4()),e.addCommand(Q4()),e.addCommand(e9()),e.addCommand(g9()),e.addCommand(_9()),e.addCommand(w9()),e.addCommand(v9()),e.addCommand(A9()),e.addCommand(a9()),e.addCommand(h9()),e.addCommand(P9()),e}a(P_,"createProgram");P_().parse();0&&(module.exports={createProgram});
|
|
642
642
|
/*! Bundled license information:
|
|
643
643
|
|
|
644
644
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED