@kitelev/exocortex-cli 16.49.0 → 16.50.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.
- 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 v16.
|
|
2
|
+
// @kitelev/exocortex-cli v16.50.0
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -769,7 +769,7 @@ ${r}`}a(aZ,"serializeFile");function kN(n,e,t={}){let r=Ty.default.dirname(n),i=
|
|
|
769
769
|
\u{1F4CA} Applied to ${p}/${h.length} target(s) (${g} failed).`),g>0&&process.exit(5)}catch(r){se.handle(r),process.exit(5)}})}a(JN,"applyCommand");var pa=require("fs"),_u=require("path");var ZN=/^---\s*$/,qZ=/^exocmd__Grounding_type:\s*(.+?)\s*$/,GZ=/^"?\[\[[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?:\|[^\]]*)?\]\]"?$/i,WZ=new Set(["node_modules"]);function zZ(n){return n.startsWith(".")||WZ.has(n)}a(zZ,"shouldSkipDir");function*eL(n){let e;try{e=(0,pa.readdirSync)(n,{withFileTypes:!0})}catch(t){let r=t;if(r.code==="EPERM"||r.code==="EACCES"||r.code==="ENOENT")return;throw t}for(let t of e){let r=(0,_u.join)(n,t.name);if(t.isDirectory()){if(zZ(t.name))continue;yield*eL(r)}else t.isFile()&&t.name.endsWith(".md")&&(yield r)}}a(eL,"walkMarkdownFiles");function HZ(n){let e=n.split(/\r?\n/);if(e.length<2||!ZN.test(e[0]))return null;for(let t=1;t<e.length;t++)if(ZN.test(e[t]))return{lines:e.slice(1,t),startLine:2};return null}a(HZ,"extractFrontmatter");function QZ(n){let e=n.trim();return e===""||e==="null"||e==="~"?!1:!GZ.test(e)}a(QZ,"isLiteralForm");function YZ(n){let e=[];for(let t of eL(n)){let r;try{r=(0,pa.readFileSync)(t,"utf-8")}catch{continue}let i=HZ(r);if(i)for(let s=0;s<i.lines.length;s++){let o=i.lines[s].match(qZ);if(!o)continue;let l=o[1];QZ(l)&&e.push({path:(0,_u.relative)(n,t),line:i.startLine+s,value:l})}}return e}a(YZ,"scanVaultForLiteralForm");function tL(){return new fe("grounding-type-literal-form").description("Detect post-Phase-4+1 regressions: any exocmd__Grounding_type literal-string form (not wikilink) in vault frontmatter").requiredOption("--vault <path>","Vault root directory").option("--output <type>","Response format: text|json","text").action(n=>{let e=n.output??"text";se.setFormat(e);try{let t=(0,_u.resolve)(n.vault);if(!(0,pa.existsSync)(t)||!(0,pa.statSync)(t).isDirectory())throw new Oe(t);let r=YZ(t);if(e==="json")console.log(JSON.stringify({vaultPath:t,violationCount:r.length,violations:r,clean:r.length===0},null,2));else if(r.length===0)console.log(`OK ${t}: 0 exocmd__Grounding_type literal-form violations`);else{console.error(`FAIL ${t}: ${r.length} exocmd__Grounding_type literal-form violation(s):`);for(let i of r)console.error(` ${i.path}:${i.line} \u2014 value: ${i.value}`);console.error("\nRFC 9d20c91f Phase 3 migrated all values to wikilink form `[[<uid>]]`. Re-run the Phase 3 migration script or hand-edit offending files.")}r.length>0&&(process.exitCode=1)}catch(t){se.handle(t)}})}a(tL,"auditGroundingTypeLiteralFormCommand");function rL(){let n=new fe("audit").description("Audit vault for regression patterns (RFC cutover detectors)");return n.addCommand(tL()),n}a(rL,"auditCommand");var nL=require("fs"),iL=require("path");var KZ=a(n=>{process.stderr.write(`${n}
|
|
770
770
|
`)},"DEFAULT_LOG"),Oy=class{static{a(this,"HeadlessConfirmGate")}constructor(e){this.yes=e.yes,this.verbose=e.verbose??!1,this.log=e.log??KZ}async confirmHardSwitch(e){if(this.verbose){let t=Array.from(e.filesToDestroy.values()).reduce((r,i)=>r+i.length,0);this.log(`[hard-switch] Target: ${e.targetProfileLabel} (${e.targetProfileUid})`),this.log(`[hard-switch] Source: ${e.sourceProfileLabel}`),this.log(`[hard-switch] ${t} files to remove, ${e.assetSpacesBeingTornDown.length} AS to tear down, ${e.assetSpacesBeingMaterialized.length} AS to materialize`)}return this.yes?!0:(this.log("[hard-switch] Refused: --yes flag required for headless mode (Decision #2 safety)."),!1)}};var XZ="[hard-switch] CLI command scaffolded. hardSwitchProfile() implementation pending Phase 3.";function JZ(n,e){return{targetProfileUid:n,targetProfileLabel:e,sourceProfileUid:null,sourceProfileLabel:"<unknown>",filesToDestroy:new Map,assetSpacesBeingTornDown:[],assetSpacesBeingMaterialized:[]}}a(JZ,"buildScaffoldPlan");async function ZZ(n,e,t={}){let r=[],i=[],s=t.out??(_=>process.stdout.write(`${_}
|
|
771
771
|
`)),o=t.err??(_=>process.stderr.write(`${_}
|
|
772
|
-
`)),l=a(_=>{r.push(_),s(_)},"out"),c=a(_=>{i.push(_),o(_)},"err");if(!e.vault)throw new It("--vault is required");let u=(0,iL.resolve)(e.vault);if(!(0,nL.existsSync)(u))throw new Oe(u);if(!n||n.length===0)throw new It("profile-uid argument is required","exocortex hard-switch <profile-uid> --vault <path>");let d=await(t.resolverFactory?.(e)??new lu({vaultPath:u,warn:a(_=>c(_),"warn")})).resolveFilter(n);if(d.outcome==="missing-profile")throw new It(`Profile not found: ${n}`,"Run `exocortex find --class exo__FocusProfile` to list available profiles");if(d.outcome==="error")return c(`[hard-switch] Resolver error: ${d.reason}`),{exitCode:5,stdout:r,stderr:i};if(d.outcome==="degraded")return c(`[hard-switch] Refused: profile resolution degraded \u2014 ${d.reason}. Hard switch aborted to prevent vault corruption.`),{exitCode:5,stdout:r,stderr:i};let h=t.confirmGate??new Oy({yes:e.yes??!1,verbose:e.verbose??!1,log:a(_=>c(_),"log")}),p=JZ(n,n);return await h.confirmHardSwitch(p)?(l(XZ),{exitCode:0,stdout:r,stderr:i}):{exitCode:0,stdout:r,stderr:i}}a(ZZ,"runHardSwitch");function sL(){return new fe("hard-switch").description("Hard switch to specified FocusProfile (filesystem mutation, Phase 3+). Requires --yes for headless mode.").argument("<profile-uid>","Target FocusProfile UID").requiredOption("--vault <path>","Path to Obsidian vault").option("--yes","Confirm hard switch (headless mode safety override per RFC 22b50a17 Decision #2)",!1).option("--verbose","Print plan summary to stderr before deciding",!1).action(async(e,t)=>{try{let r=await ZZ(e,t);process.exit(r.exitCode)}catch(r){se.handle(r)}})}a(sL,"hardSwitchCommand");function oL(n){let e=new fe;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.
|
|
772
|
+
`)),l=a(_=>{r.push(_),s(_)},"out"),c=a(_=>{i.push(_),o(_)},"err");if(!e.vault)throw new It("--vault is required");let u=(0,iL.resolve)(e.vault);if(!(0,nL.existsSync)(u))throw new Oe(u);if(!n||n.length===0)throw new It("profile-uid argument is required","exocortex hard-switch <profile-uid> --vault <path>");let d=await(t.resolverFactory?.(e)??new lu({vaultPath:u,warn:a(_=>c(_),"warn")})).resolveFilter(n);if(d.outcome==="missing-profile")throw new It(`Profile not found: ${n}`,"Run `exocortex find --class exo__FocusProfile` to list available profiles");if(d.outcome==="error")return c(`[hard-switch] Resolver error: ${d.reason}`),{exitCode:5,stdout:r,stderr:i};if(d.outcome==="degraded")return c(`[hard-switch] Refused: profile resolution degraded \u2014 ${d.reason}. Hard switch aborted to prevent vault corruption.`),{exitCode:5,stdout:r,stderr:i};let h=t.confirmGate??new Oy({yes:e.yes??!1,verbose:e.verbose??!1,log:a(_=>c(_),"log")}),p=JZ(n,n);return await h.confirmHardSwitch(p)?(l(XZ),{exitCode:0,stdout:r,stderr:i}):{exitCode:0,stdout:r,stderr:i}}a(ZZ,"runHardSwitch");function sL(){return new fe("hard-switch").description("Hard switch to specified FocusProfile (filesystem mutation, Phase 3+). Requires --yes for headless mode.").argument("<profile-uid>","Target FocusProfile UID").requiredOption("--vault <path>","Path to Obsidian vault").option("--yes","Confirm hard switch (headless mode safety override per RFC 22b50a17 Decision #2)",!1).option("--verbose","Print plan summary to stderr before deciding",!1).action(async(e,t)=>{try{let r=await ZZ(e,t);process.exit(r.exitCode)}catch(r){se.handle(r)}})}a(sL,"hardSwitchCommand");function oL(n){let e=new fe;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.50.0"),e.addCommand(GN()),e.addCommand(JN()),e.addCommand(_D()),e.addCommand(vD()),e.addCommand(QD()),e.addCommand(AD()),e.addCommand(ID()),e.addCommand(PD()),e.addCommand(XD()),e.addCommand(lN()),e.addCommand(fN()),e.addCommand(dN()),e.addCommand(pN()),e.addCommand(AN()),e.addCommand(IN()),e.addCommand(DN()),e.addCommand(qN()),e.addCommand(rL()),e.addCommand(sL()),e}a(oL,"createProgram");oL().parse();0&&(module.exports={createProgram});
|
|
773
773
|
/*! Bundled license information:
|
|
774
774
|
|
|
775
775
|
reflect-metadata/Reflect.js:
|