@reddb-io/red-skills 2.87.6 → 2.87.7

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.
@@ -6581,7 +6581,7 @@ Usage:
6581
6581
  ${n} archive --candidate <json> [--root <dir>] [--archive-dir <rel>]
6582
6582
  ${n} restore <name> [--root <dir>] [--archive-dir <rel>]`}function Tx(n){return JVn(typeof n.root=="string"?n.root:process.cwd())}function fut(n){return typeof n["archive-dir"]=="string"?n["archive-dir"]:void 0}async function nK(n){let r=await xs(n);return r?r.mode!=="graph"?{ok:!1,message:`curate: skill telemetry needs graph mode (this project is "${r.mode}") \u2014 run \`${wEe}\``}:ju(r)?{ok:!0}:{ok:!1,message:`curate: skill telemetry is not enabled here \u2014 run \`${wEe}\``}:{ok:!1,message:`curate: memory is not initialized here \u2014 run \`${wEe}\``}}function AVn(){let n=CVn(kVn(import.meta.url));return n.includes("dist/curate-skill")||n.endsWith("dist/curate-skill")?Fut(n,"..","cli.js"):Fut(n,"..","cli.ts")}async function LVn(n,r){let i=["curate","skills","--json"];r!==void 0&&i.push("--stale-days",String(r));let d=AVn(),h=d.endsWith(".ts")?vut(process.execPath,["--import","tsx",d,...i,"--root",n],{encoding:"utf8"}):vut(process.execPath,[d,...i,"--root",n],{encoding:"utf8"}),g=h.status??1;if(g!==0)throw new Error(`memory curate skills exited ${g}`);return gut(h.stdout??"")}function xVn(n){return typeof n.flags["stale-days"]=="string"?Number(n.flags["stale-days"]):void 0}async function wut(n,r){return(r.loadCuratorReport??LVn)(Tx(n.flags),xVn(n))}async function zVn(n){let r=Tx(n.flags),i=await nK(r);return i.ok?(console.log("curate: skill telemetry is enabled \u2014 ready to curate"),0):(console.error(i.message),2)}async function OVn(n,r){let i=Tx(n.flags),d=await nK(i);if(!d.ok)return console.error(d.message),2;let u;try{u=await wut(n,r)}catch(J){return console.error(`curate: ${J.message}`),1}let{candidates:h,byCategory:g,filtered:f}=XEe(u);return console.log(JSON.stringify({candidates:h,byCategory:g,filtered:f,totals:{totalSkills:u.totalSkills,curatableSkills:u.curatableSkills,readOnlySkills:u.readOnlySkills}},null,2)),0}async function MVn(n,r){let i=Tx(n.flags),d=await nK(i);if(!d.ok)return console.error(d.message),2;let u;try{u=await wut(n,r)}catch(J){return console.error(`curate: ${J.message}`),1}let{byCategory:h}=XEe(u);if(fEe(h)===0)return console.error("curate: no candidates \u2014 no issue filed"),0;let g=typeof n.flags.label=="string"?n.flags.label:void 0,f=await Rut({byCategory:h,totals:{totalSkills:u.totalSkills,curatableSkills:u.curatableSkills,readOnlySkills:u.readOnlySkills},generatedAt:u.generatedAt},{cwd:i,label:g});return console.log(`curate: filed background issue \u2014 ${f.output||f.title}`),0}async function SVn(n){let r=Tx(n.flags),i=await nK(r);if(!i.ok)return console.error(i.message),2;let d=n.flags.candidate;if(typeof d!="string")return console.error("curate archive: --candidate <json> is required"),2;let u;try{u=JSON.parse(d)}catch(g){return console.error(`curate archive: invalid --candidate JSON: ${g.message}`),2}let h=await Yut(u,{rootDir:r,archiveDir:fut(n.flags)});return h.ok?(console.log(`curate: archived "${h.receipt.name}" \u2192 ${h.receipt.archiveRoot} (${h.receipt.files.length} file(s), manifest at ${h.receipt.manifestPath})`),0):(console.error(`curate archive: refused \u2014 ${h.rejection.reason}: ${h.rejection.detail}`),3)}async function UVn(n){let r=Tx(n.flags),i=await nK(r);if(!i.ok)return console.error(i.message),2;let d=n.positional[0];if(!d)return console.error("curate restore: skill name is required"),2;let u=await Vut(d,{rootDir:r,archiveDir:fut(n.flags)});return console.log(`curate: restored "${u.name}" \u2192 ${u.restoredRoot} (${u.files.length} file(s) hash-verified)`),0}async function HEe(n,r={}){switch(n.command){case"check":return zVn(n);case"list":return OVn(n,r);case"background":return MVn(n,r);case"archive":return SVn(n);case"restore":return UVn(n);case void 0:case"--help":case"-h":return console.log(Xut(r.usageCommand)),0;default:return console.error(`unknown curate subcommand: ${n.command}
6583
6583
 
6584
- ${Xut(r.usageCommand)}`),2}}function QEe(n){let r={app:n,version:BVn(jx("__RED_BUILD_VERSION__",()=>"2.87.6")??"0.0.0-dev"),gitSha:jx("__RED_BUILD_GIT_SHA__",()=>"698c85881b043eb712d489860986832fb05c29cb")??"unknown",buildTime:jx("__RED_BUILD_TIME__",()=>"2026-07-28T19:08:02-03:00")??"unknown",bundleAsset:jx("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=jx("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=jx("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(r.reddbSdkVersion=i),d&&(r.reddbBinaryTag=d),r}function BVn(n){return n.startsWith("v")?n.slice(1):n}function EEe(n){return`${n.app} ${n.version} ${n.gitSha}`}function jx(n,r){try{let i=r();return typeof i=="string"&&i.length>0?i:void 0}catch{return process.env[n.replace(/^__|__$/g,"")]}}async function Jut(n){let{store:r}=await gr(n);try{let i=await r.stats();console.log(`memory: ${i.nodes} node(s), ${i.edges} edge(s)`)}finally{await r.close()}}async function kut(n){let r=n.positional[0];if(r!=="status"&&r!=="status-viewer"&&r!=="maintain"&&r!=="search")throw new Error("vector needs an action \u2014 supported: memory vector status|status-viewer|maintain|search");let i=process.env.RED_MEMORY_VECTOR_PROVIDER;n.flags.local===!0&&(process.env.RED_MEMORY_VECTOR_PROVIDER="local");let{store:d}=await gr(n);try{if(r==="search"){let h=n.positional.slice(1).join(" ").trim();if(!h)throw new Error("nothing to search \u2014 pass a query: memory vector search <query>");let g=await m5(d,h,{limit:Ia(n.flags,"limit")});if(n.flags.json===!0){console.log(JSON.stringify(g,null,2));return}if(g.status==="unavailable"){let f=g.error?` \u2014 ${g.error}`:"";console.log(`memory: vector search unavailable${f}`);return}console.log(`memory: vector search ${g.hits.length}/${g.limit} hit(s) for "${h}"`);for(let f of g.hits){let J=f.source?` source=${f.source}`:"";console.log(` ${f.score.toFixed(3)} memory_nodes:${f.rid} (${f.node_type}) ${f.title}${J}`),f.excerpt&&console.log(` ${f.excerpt}`)}return}if(r==="status-viewer"){let h=Wr(n.flags),g=Vl(n.flags,"out")??Pa(h,".red/memory/vector-status-viewer.html"),f=jD(await d.vectorStatus());await hs(Ps(g),{recursive:!0}),await fi(g,f.html,"utf8"),console.log(`memory: vector status viewer written ${g}`),console.log(` status: ${f.report.overall}`),console.log(` contract: ${f.contract.consumes}`);return}let u=r==="maintain"?await d.maintainVectorProjection({strict:n.flags.strict===!0}):await d.vectorStatus();if(n.flags.json===!0){console.log(JSON.stringify(u,null,2));return}console.log(`memory: vector projection ${u.overall} \u2014 ${u.ready}/${u.total} ready`),u.stale>0&&console.log(` stale: ${u.stale}`),u.unavailable>0&&console.log(` unavailable: ${u.unavailable}`),u.failed>0&&console.log(` failed: ${u.failed}`);for(let h of u.nodes.filter(g=>g.status!=="ready")){let g=h.error?` \u2014 ${h.error}`:"";console.log(` ${h.rid} (${h.node_type}) ${h.label}: ${h.status}${g}`)}for(let h of u.docs.filter(g=>g.status!=="ready")){let g=h.error?` \u2014 ${h.error}`:"";console.log(` doc:${h.rid} ${h.path}: ${h.status}${g}`)}}finally{await d.close(),n.flags.local===!0&&(i==null?delete process.env.RED_MEMORY_VECTOR_PROVIDER:process.env.RED_MEMORY_VECTOR_PROVIDER=i)}}async function Aut(n){let{store:r}=await gr(n);try{let i=Ia(n.flags,"stale-days")??90,d=await my(r,{staleDays:i});if(d.stale.length===0){console.log(`memory: healthy \u2014 0 of ${d.totalNodes} node(s) stale (unaccessed ${i}+ days, never recalled)`);return}console.log(`memory: ${d.stale.length} of ${d.totalNodes} node(s) stale (unaccessed ${i}+ days, never recalled):`);for(let g of d.stale)console.log(` ${g.rid} (${g.node_type}) ${g.title} \u2014 ${g.ageDays}d idle`);if(n.flags.prune!==!0){console.log(`
6584
+ ${Xut(r.usageCommand)}`),2}}function QEe(n){let r={app:n,version:BVn(jx("__RED_BUILD_VERSION__",()=>"2.87.7")??"0.0.0-dev"),gitSha:jx("__RED_BUILD_GIT_SHA__",()=>"5b4f35b7513e6bfd5ef2269f9b7f5276704148d8")??"unknown",buildTime:jx("__RED_BUILD_TIME__",()=>"2026-07-29T00:50:06-03:00")??"unknown",bundleAsset:jx("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=jx("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=jx("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(r.reddbSdkVersion=i),d&&(r.reddbBinaryTag=d),r}function BVn(n){return n.startsWith("v")?n.slice(1):n}function EEe(n){return`${n.app} ${n.version} ${n.gitSha}`}function jx(n,r){try{let i=r();return typeof i=="string"&&i.length>0?i:void 0}catch{return process.env[n.replace(/^__|__$/g,"")]}}async function Jut(n){let{store:r}=await gr(n);try{let i=await r.stats();console.log(`memory: ${i.nodes} node(s), ${i.edges} edge(s)`)}finally{await r.close()}}async function kut(n){let r=n.positional[0];if(r!=="status"&&r!=="status-viewer"&&r!=="maintain"&&r!=="search")throw new Error("vector needs an action \u2014 supported: memory vector status|status-viewer|maintain|search");let i=process.env.RED_MEMORY_VECTOR_PROVIDER;n.flags.local===!0&&(process.env.RED_MEMORY_VECTOR_PROVIDER="local");let{store:d}=await gr(n);try{if(r==="search"){let h=n.positional.slice(1).join(" ").trim();if(!h)throw new Error("nothing to search \u2014 pass a query: memory vector search <query>");let g=await m5(d,h,{limit:Ia(n.flags,"limit")});if(n.flags.json===!0){console.log(JSON.stringify(g,null,2));return}if(g.status==="unavailable"){let f=g.error?` \u2014 ${g.error}`:"";console.log(`memory: vector search unavailable${f}`);return}console.log(`memory: vector search ${g.hits.length}/${g.limit} hit(s) for "${h}"`);for(let f of g.hits){let J=f.source?` source=${f.source}`:"";console.log(` ${f.score.toFixed(3)} memory_nodes:${f.rid} (${f.node_type}) ${f.title}${J}`),f.excerpt&&console.log(` ${f.excerpt}`)}return}if(r==="status-viewer"){let h=Wr(n.flags),g=Vl(n.flags,"out")??Pa(h,".red/memory/vector-status-viewer.html"),f=jD(await d.vectorStatus());await hs(Ps(g),{recursive:!0}),await fi(g,f.html,"utf8"),console.log(`memory: vector status viewer written ${g}`),console.log(` status: ${f.report.overall}`),console.log(` contract: ${f.contract.consumes}`);return}let u=r==="maintain"?await d.maintainVectorProjection({strict:n.flags.strict===!0}):await d.vectorStatus();if(n.flags.json===!0){console.log(JSON.stringify(u,null,2));return}console.log(`memory: vector projection ${u.overall} \u2014 ${u.ready}/${u.total} ready`),u.stale>0&&console.log(` stale: ${u.stale}`),u.unavailable>0&&console.log(` unavailable: ${u.unavailable}`),u.failed>0&&console.log(` failed: ${u.failed}`);for(let h of u.nodes.filter(g=>g.status!=="ready")){let g=h.error?` \u2014 ${h.error}`:"";console.log(` ${h.rid} (${h.node_type}) ${h.label}: ${h.status}${g}`)}for(let h of u.docs.filter(g=>g.status!=="ready")){let g=h.error?` \u2014 ${h.error}`:"";console.log(` doc:${h.rid} ${h.path}: ${h.status}${g}`)}}finally{await d.close(),n.flags.local===!0&&(i==null?delete process.env.RED_MEMORY_VECTOR_PROVIDER:process.env.RED_MEMORY_VECTOR_PROVIDER=i)}}async function Aut(n){let{store:r}=await gr(n);try{let i=Ia(n.flags,"stale-days")??90,d=await my(r,{staleDays:i});if(d.stale.length===0){console.log(`memory: healthy \u2014 0 of ${d.totalNodes} node(s) stale (unaccessed ${i}+ days, never recalled)`);return}console.log(`memory: ${d.stale.length} of ${d.totalNodes} node(s) stale (unaccessed ${i}+ days, never recalled):`);for(let g of d.stale)console.log(` ${g.rid} (${g.node_type}) ${g.title} \u2014 ${g.ageDays}d idle`);if(n.flags.prune!==!0){console.log(`
6585
6585
  Re-run with --prune to delete these (asks for confirmation first).`);return}let u=n.flags.yes===!0;if(!u){if(!process.stdin.isTTY){console.log(`
6586
6586
  refusing to prune without confirmation \u2014 re-run with --yes in a non-interactive shell`);return}let g=Jie({input:process.stdin,output:process.stdout}),f=(await g.question(`
6587
6587
  Delete ${d.stale.length} stale node(s)? Type "yes" to confirm: `)).trim();g.close(),u=f==="yes"}if(!u){console.log("memory: aborted \u2014 nothing deleted");return}let{pruned:h}=await DFe(r,d.stale);console.log(`memory: pruned ${h} stale node(s)`)}finally{await r.close()}}async function Lut(n){let r=Wr(n.flags),i=n.positional[0]??".red/memory/export",d=km(i)?i:xa(r,i),u=n.flags.communities===!0,h=n.flags.interop===!0,{store:g}=await gr(n);try{let f=await nQ(g,d,{communities:u,interop:h});console.log(`memory: exported ${f.nodes} node(s), ${f.edges} edge(s)`),u&&console.log(" communities: coloured via native Louvain"),console.log(` graph: ${f.htmlPath}`),console.log(` json: ${f.jsonPath}`),console.log(` audit: ${f.auditPath}`),f.interop&&(console.log(` nodes: ${f.interop.nodesJsonlPath}`),console.log(` edges: ${f.interop.edgesJsonlPath}`),console.log(` graphml:${f.interop.graphmlPath}`),console.log(` cypher: ${f.interop.cypherPath}`))}finally{await g.close()}}async function xut(n){let r=n.positional.join(" ").trim();if(!r)throw new Error("nothing to search \u2014 pass a query: memory global-search <query>");let i=typeof n.flags.limit=="string"?Number(n.flags.limit):void 0,{store:d,config:u}=await gr(n);try{let h=await Dv("memory.global-search",{store:d,providerConfig:u.provider},{query:r,limit:i,cache:n.flags["no-cache"]===!0?"off":"read-only"});if(n.flags.json===!0){console.log(JSON.stringify(h,null,2));return}console.log(`memory: ${h.total_hits} global-search hit(s) for "${h.query}"`),console.log(` source: ${h.generated_from.operation_id}`),console.log(` graph hash: ${h.generated_from.graph_hash}`),console.log(` provider: ${h.generated_from.provider.status}${h.generated_from.provider.error?` (${h.generated_from.provider.error})`:""}`);for(let g of h.evidence)console.log(` ${g.community_id}: score ${g.score}, ${g.size} node(s)`),console.log(` matched: ${g.matched_terms.join(", ")}`),console.log(` top label: ${g.top_label}`),console.log(` top type: ${g.top_node_type}`),g.narrative_summary&&console.log(` summary: ${g.narrative_summary}`)}finally{await d.close()}}async function DVn(n,r){let i=Vl(n.flags,"from");if(i){let u=km(i)?i:xa(r,i),h=JSON.parse(await Sb(u,"utf8")),g=h.contract??h,f=kFe(g);if(!f.valid)throw new Error(`architecture-overview: ${u} is not a valid graph contract \u2014 ${f.errors.join("; ")}`);return g}let{store:d}=await gr(n);try{let[u,h,g]=await Promise.all([d.listNodes(),d.listEdges(),d.communities()]);return Xf({nodes:u,edges:h.map(Of),communities:g})}finally{await d.close()}}async function zut(n){let r=Wr(n.flags),i=await DVn(n,r),d=hfe(i);if(n.flags.json===!0){console.log(JSON.stringify(d,null,2));return}if(n.flags.stdout===!0){process.stdout.write(d.markdown);return}let u=Vl(n.flags,"out")??".red/memory/architecture-overview.md",h=km(u)?u:xa(r,u);await hs(Ps(h),{recursive:!0}),await fi(h,d.markdown,"utf8"),console.log(`memory: architecture overview written ${h}`),console.log(` contract: ${d.generated_from.contract_version}`),console.log(` ${d.totals.nodes} node(s), ${d.layers.length} layer(s), ${d.communities.length} community(ies)`)}async function N5(){if(process.stdin.isTTY)return"";let n=[];for await(let r of process.stdin)n.push(r);return Buffer.concat(n).toString("utf8")}var KVn=["SessionStart","PostToolUse","Stop","PreCompact"];async function Out(n){let r=n.positional[0],i=n.flags.runner==="codex"?"codex":"claude";if(!r||!KVn.includes(r)){process.stdout.write("{}");return}try{let d=await N5(),u=d.trim()?JSON.parse(d):{},h=Wr(n.flags)!==process.cwd()?Wr(n.flags):typeof u.cwd=="string"?u.cwd:process.cwd(),g=await gfe(i,r,u);try{r==="SessionStart"?await Yy(h,g.sessionId?{id:g.sessionId}:{}):await eN(h)||(g.sessionId?await Yy(h,{id:g.sessionId}):await Owe(h))}catch{}let f=await Bwe(g,h);process.stdout.write(yfe(i,r,f))}catch{process.stdout.write("{}")}}var PVn=["post-commit","post-checkout"];async function Mut(n){switch(n.positional[0]){case"refresh":return qVn(n);case"install-hooks":return egn(n);case"uninstall-hooks":return tgn(n);default:throw new Error("vcs needs a subcommand \u2014 memory vcs refresh|install-hooks|uninstall-hooks")}}async function qVn(n){let r=Wr(n.flags),i=Vl(n.flags,"event"),d=n.flags.json===!0;if(!i||!PVn.includes(i)){d&&console.log(JSON.stringify({noop:!0,reason:"unknown vcs event"}));return}try{let u=await Twe(r,{event:i,prevHead:Vl(n.flags,"prev"),newHead:Vl(n.flags,"new"),flag:Vl(n.flags,"flag"),export:n.flags["no-export"]!==!0});if(d){console.log(JSON.stringify(u,null,2));return}if(u.noop){console.log(`memory: ${i} \u2014 no-op (${u.reason})`);return}let h=u.refresh;console.log(`memory: ${i} refreshed ${h?.files??0} changed file(s) \u2014 ${h?.added??0} added, ${h?.updated??0} updated, ${h?.stale??0} stale`),u.exported&&console.log(` exported ${u.exported.nodes} node(s) \u2192 ${u.exported.jsonPath}`)}catch(u){let h=`error: ${u instanceof Error?u.message:String(u)}`;console.log(d?JSON.stringify({noop:!0,reason:h}):`memory: ${i} \u2014 no-op (${h})`)}}async function Sut(n){try{let{stdout:r}=await Ry("git",["-C",n,"rev-parse","--git-path","hooks"],{encoding:"utf8"}),i=r.trim();return i?km(i)?i:xa(n,i):xa(n,".git/hooks")}catch{return xa(n,".git/hooks")}}function $Vn(){let n=process.env.CLAUDE_PLUGIN_ROOT??process.env.CODEX_PLUGIN_ROOT,r=_ut(new URL("../cli.ts",import.meta.url)),i=[n?Pa(n,"scripts","bootstrap.mjs"):void 0,Pa(Ps(Ps(r)),"scripts","bootstrap.mjs")];for(let d of i)if(d&&IK(d))return d}async function egn(n){let r=Wr(n.flags),i=await xs(r);if(!i){console.log("memory: not initialized here \u2014 run `memory init --mode graph` before installing git hooks");return}if(i.mode!=="graph"){console.log(`memory: git hooks need graph mode \u2014 this project is "${i.mode}". Re-run \`memory init --mode graph\` first`);return}let d=await Sut(r),u=await Dwe({hooksDir:d,bootstrapPath:$Vn(),force:n.flags.force===!0});if(n.flags.json===!0){console.log(JSON.stringify({hooksDir:d,...u},null,2));return}u.installed.length>0&&console.log(`memory: installed ${u.installed.join(", ")} into ${d}`);for(let h of u.backedUp)console.log(` backed up existing hook \u2192 ${h}`);for(let h of u.skipped)console.log(` skipped ${h.hook}: ${h.reason}`)}async function tgn(n){let r=Wr(n.flags),i=await Sut(r),d=await Kwe(i);if(n.flags.json===!0){console.log(JSON.stringify({hooksDir:i,...d},null,2));return}d.removed.length>0?console.log(`memory: removed ${d.removed.join(", ")} from ${i}`):console.log(`memory: no managed hooks found in ${i}`);for(let u of d.restored)console.log(` restored backed-up hook \u2192 ${u}`);for(let u of d.skipped)console.log(` ${u.reason}`)}async function Uut(n){let r=n.positional[0];if(r==="learn")return ngn(n);if(r!=="record")throw new Error("unknown worker command \u2014 expected: memory worker record|learn");let i=await N5();if(!i.trim())throw new Error("worker record needs a JSON payload on stdin");let d=JSON.parse(i),{store:u}=await gr(n);try{let h=await VEe(u,d);console.log(`memory: recorded worker ${d.repository}#${d.issueNumber}/${d.attemptNumber} (rid ${h.workerRid})`)}finally{await u.close()}}async function ngn(n){let r=n.positional[1];if(r==="apply")return Ign(n);if(r!=null)throw new Error("memory worker learn supports: apply");let i=Wr(n.flags),d=n.flags.json===!0,u=n.flags["write-proposal"]===!0,{store:h}=await gr(n);try{let g=await gEe(h),f=u?await yEe(i,g):null,J=g.proposals.length===0?"no-candidates":u?"proposal-written":"proposal-ready";if(d){console.log(JSON.stringify({state:J,proposalFile:f,...g},null,2));return}console.log(`memory: worker learning - ${J}`);for(let S of g.proposals)console.log(` [${S.kind}] ${S.title}`),console.log(` evidence: ${S.evidenceSummary}`);for(let S of g.rejected)console.log(` ${S.action}: ${S.kind} - ${S.reason}`);f&&console.log(` proposal: ${f}`),console.log(`