@reddb-io/red-skills 3.18.2 → 3.18.3

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.
@@ -6608,7 +6608,7 @@ Usage:
6608
6608
  ${n} archive --candidate <json> [--root <dir>] [--archive-dir <rel>]
6609
6609
  ${n} restore <name> [--root <dir>] [--archive-dir <rel>]`}function _9(n){return yXn(typeof n.root=="string"?n.root:process.cwd())}function Oht(n){return typeof n["archive-dir"]=="string"?n["archive-dir"]:void 0}async function TK(n){let r=await Ts(n);return r?r.mode!=="graph"?{ok:!1,message:`curate: skill telemetry needs graph mode (this project is "${r.mode}") \u2014 run \`${HCe}\``}:lb(r)?{ok:!0}:{ok:!1,message:`curate: skill telemetry is not enabled here \u2014 run \`${HCe}\``}:{ok:!1,message:`curate: memory is not initialized here \u2014 run \`${HCe}\``}}function RXn(){let n=gXn(VXn(import.meta.url));return n.includes("dist/curate-skill")||n.endsWith("dist/curate-skill")?xht(n,"..","cli.js"):xht(n,"..","cli.ts")}async function vXn(n,r){let c=["curate","skills","--json"];r!==void 0&&c.push("--stale-days",String(r));let d=RXn(),h=d.endsWith(".ts")?Lht(process.execPath,["--import","tsx",d,...c,"--root",n],{encoding:"utf8"}):Lht(process.execPath,[d,...c,"--root",n],{encoding:"utf8"}),N=h.status??1;if(N!==0)throw new Error(`memory curate skills exited ${N}`);return JZt(h.stdout??"")}function FXn(n){return typeof n.flags["stale-days"]=="string"?Number(n.flags["stale-days"]):void 0}async function Sht(n,r){return(r.loadCuratorReport??vXn)(_9(n.flags),FXn(n))}async function fXn(n){let r=_9(n.flags),c=await TK(r);return c.ok?(console.log("curate: skill telemetry is enabled \u2014 ready to curate"),0):(console.error(c.message),2)}async function XXn(n,r){let c=_9(n.flags),d=await TK(c);if(!d.ok)return console.error(d.message),2;let G;try{G=await Sht(n,r)}catch(Q){return console.error(`curate: ${Q.message}`),1}let{candidates:h,byCategory:N,filtered:v}=nCe(G);return console.log(JSON.stringify({candidates:h,byCategory:N,filtered:v,totals:{totalSkills:G.totalSkills,curatableSkills:G.curatableSkills,readOnlySkills:G.readOnlySkills}},null,2)),0}async function wXn(n,r){let c=_9(n.flags),d=await TK(c);if(!d.ok)return console.error(d.message),2;let G;try{G=await Sht(n,r)}catch(Q){return console.error(`curate: ${Q.message}`),1}let{byCategory:h}=nCe(G);if(wCe(h)===0)return console.error("curate: no candidates \u2014 no issue filed"),0;let N=typeof n.flags.label=="string"?n.flags.label:void 0,v=await Aht({byCategory:h,totals:{totalSkills:G.totalSkills,curatableSkills:G.curatableSkills,readOnlySkills:G.readOnlySkills},generatedAt:G.generatedAt},{cwd:c,label:N});return console.log(`curate: filed background issue \u2014 ${v.output||v.title}`),0}async function HXn(n){let r=_9(n.flags),c=await TK(r);if(!c.ok)return console.error(c.message),2;let d=n.flags.candidate;if(typeof d!="string")return console.error("curate archive: --candidate <json> is required"),2;let G;try{G=JSON.parse(d)}catch(N){return console.error(`curate archive: invalid --candidate JSON: ${N.message}`),2}let h=await _Zt(G,{rootDir:r,archiveDir:Oht(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 QXn(n){let r=_9(n.flags),c=await TK(r);if(!c.ok)return console.error(c.message),2;let d=n.positional[0];if(!d)return console.error("curate restore: skill name is required"),2;let G=await CZt(d,{rootDir:r,archiveDir:Oht(n.flags)});return console.log(`curate: restored "${G.name}" \u2192 ${G.restoredRoot} (${G.files.length} file(s) hash-verified)`),0}async function QCe(n,r={}){switch(n.command){case"check":return fXn(n);case"list":return XXn(n,r);case"background":return wXn(n,r);case"archive":return HXn(n);case"restore":return QXn(n);case void 0:case"--help":case"-h":return console.log(zht(r.usageCommand)),0;default:return console.error(`unknown curate subcommand: ${n.command}
6610
6610
 
6611
- ${zht(r.usageCommand)}`),2}}function ECe(n){let r={app:n,version:EXn(C9("__RED_BUILD_VERSION__",()=>"3.18.2")??"0.0.0-dev"),gitSha:C9("__RED_BUILD_GIT_SHA__",()=>"303b09c61e893e90c283f0a42888f0e2df3abc44")??"unknown",buildTime:C9("__RED_BUILD_TIME__",()=>"2026-08-13T03:47:23-03:00")??"unknown",bundleAsset:C9("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},c=C9("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=C9("__REDDB_BINARY_TAG__",()=>"v1.23.1");return c&&(r.reddbSdkVersion=c),d&&(r.reddbBinaryTag=d),r}function EXn(n){return n.startsWith("v")?n.slice(1):n}function _Ce(n){return`${n.app} ${n.version} ${n.gitSha}`}function C9(n,r){try{let c=r();return typeof c=="string"&&c.length>0?c:void 0}catch{return process.env[n.replace(/^__|__$/g,"")]}}async function Dht(n){let{store:r}=await Fr(n);try{let c=await r.stats();console.log(`memory: ${c.nodes} node(s), ${c.edges} edge(s)`)}finally{await r.close()}}async function Kht(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 c=process.env.RED_MEMORY_VECTOR_PROVIDER;n.flags.local===!0&&(process.env.RED_MEMORY_VECTOR_PROVIDER="local");let{store:d}=await Fr(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 N=await M5(d,h,{limit:oa(n.flags,"limit")});if(n.flags.json===!0){console.log(JSON.stringify(N,null,2));return}if(N.status==="unavailable"){let v=N.error?` \u2014 ${N.error}`:"";console.log(`memory: vector search unavailable${v}`);return}console.log(`memory: vector search ${N.hits.length}/${N.limit} hit(s) for "${h}"`);for(let v of N.hits){let Q=v.source?` source=${v.source}`:"";console.log(` ${v.score.toFixed(3)} memory_nodes:${v.rid} (${v.node_type}) ${v.title}${Q}`),v.excerpt&&console.log(` ${v.excerpt}`)}return}if(r==="status-viewer"){let h=yr(n.flags),N=vl(n.flags,"out")??Ic(h,".red/memory/vector-status-viewer.html"),v=JK(await d.vectorStatus());await vs(lo(N),{recursive:!0}),await Ji(N,v.html,"utf8"),console.log(`memory: vector status viewer written ${N}`),console.log(` status: ${v.report.overall}`),console.log(` contract: ${v.contract.consumes}`);return}let G=r==="maintain"?await d.maintainVectorProjection({strict:n.flags.strict===!0}):await d.vectorStatus();if(n.flags.json===!0){console.log(JSON.stringify(G,null,2));return}console.log(`memory: vector projection ${G.overall} \u2014 ${G.ready}/${G.total} ready`),G.stale>0&&console.log(` stale: ${G.stale}`),G.unavailable>0&&console.log(` unavailable: ${G.unavailable}`),G.failed>0&&console.log(` failed: ${G.failed}`);for(let h of G.nodes.filter(N=>N.status!=="ready")){let N=h.error?` \u2014 ${h.error}`:"";console.log(` ${h.rid} (${h.node_type}) ${h.label}: ${h.status}${N}`)}for(let h of G.docs.filter(N=>N.status!=="ready")){let N=h.error?` \u2014 ${h.error}`:"";console.log(` doc:${h.rid} ${h.path}: ${h.status}${N}`)}}finally{await d.close(),n.flags.local===!0&&(c==null?delete process.env.RED_MEMORY_VECTOR_PROVIDER:process.env.RED_MEMORY_VECTOR_PROVIDER=c)}}async function Pht(n){let{store:r}=await Fr(n);try{let c=oa(n.flags,"stale-days")??90,d=await JV(r,{staleDays:c});if(d.stale.length===0){console.log(`memory: healthy \u2014 0 of ${d.totalNodes} node(s) stale (unaccessed ${c}+ days, never recalled)`);return}console.log(`memory: ${d.stale.length} of ${d.totalNodes} node(s) stale (unaccessed ${c}+ days, never recalled):`);for(let N of d.stale)console.log(` ${N.rid} (${N.node_type}) ${N.title} \u2014 ${N.ageDays}d idle`);if(n.flags.prune!==!0){console.log(`
6611
+ ${zht(r.usageCommand)}`),2}}function ECe(n){let r={app:n,version:EXn(C9("__RED_BUILD_VERSION__",()=>"3.18.3")??"0.0.0-dev"),gitSha:C9("__RED_BUILD_GIT_SHA__",()=>"363d1e310815e293aa4d408d8d90df6d85700f62")??"unknown",buildTime:C9("__RED_BUILD_TIME__",()=>"2026-08-13T11:13:38-03:00")??"unknown",bundleAsset:C9("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},c=C9("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=C9("__REDDB_BINARY_TAG__",()=>"v1.23.1");return c&&(r.reddbSdkVersion=c),d&&(r.reddbBinaryTag=d),r}function EXn(n){return n.startsWith("v")?n.slice(1):n}function _Ce(n){return`${n.app} ${n.version} ${n.gitSha}`}function C9(n,r){try{let c=r();return typeof c=="string"&&c.length>0?c:void 0}catch{return process.env[n.replace(/^__|__$/g,"")]}}async function Dht(n){let{store:r}=await Fr(n);try{let c=await r.stats();console.log(`memory: ${c.nodes} node(s), ${c.edges} edge(s)`)}finally{await r.close()}}async function Kht(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 c=process.env.RED_MEMORY_VECTOR_PROVIDER;n.flags.local===!0&&(process.env.RED_MEMORY_VECTOR_PROVIDER="local");let{store:d}=await Fr(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 N=await M5(d,h,{limit:oa(n.flags,"limit")});if(n.flags.json===!0){console.log(JSON.stringify(N,null,2));return}if(N.status==="unavailable"){let v=N.error?` \u2014 ${N.error}`:"";console.log(`memory: vector search unavailable${v}`);return}console.log(`memory: vector search ${N.hits.length}/${N.limit} hit(s) for "${h}"`);for(let v of N.hits){let Q=v.source?` source=${v.source}`:"";console.log(` ${v.score.toFixed(3)} memory_nodes:${v.rid} (${v.node_type}) ${v.title}${Q}`),v.excerpt&&console.log(` ${v.excerpt}`)}return}if(r==="status-viewer"){let h=yr(n.flags),N=vl(n.flags,"out")??Ic(h,".red/memory/vector-status-viewer.html"),v=JK(await d.vectorStatus());await vs(lo(N),{recursive:!0}),await Ji(N,v.html,"utf8"),console.log(`memory: vector status viewer written ${N}`),console.log(` status: ${v.report.overall}`),console.log(` contract: ${v.contract.consumes}`);return}let G=r==="maintain"?await d.maintainVectorProjection({strict:n.flags.strict===!0}):await d.vectorStatus();if(n.flags.json===!0){console.log(JSON.stringify(G,null,2));return}console.log(`memory: vector projection ${G.overall} \u2014 ${G.ready}/${G.total} ready`),G.stale>0&&console.log(` stale: ${G.stale}`),G.unavailable>0&&console.log(` unavailable: ${G.unavailable}`),G.failed>0&&console.log(` failed: ${G.failed}`);for(let h of G.nodes.filter(N=>N.status!=="ready")){let N=h.error?` \u2014 ${h.error}`:"";console.log(` ${h.rid} (${h.node_type}) ${h.label}: ${h.status}${N}`)}for(let h of G.docs.filter(N=>N.status!=="ready")){let N=h.error?` \u2014 ${h.error}`:"";console.log(` doc:${h.rid} ${h.path}: ${h.status}${N}`)}}finally{await d.close(),n.flags.local===!0&&(c==null?delete process.env.RED_MEMORY_VECTOR_PROVIDER:process.env.RED_MEMORY_VECTOR_PROVIDER=c)}}async function Pht(n){let{store:r}=await Fr(n);try{let c=oa(n.flags,"stale-days")??90,d=await JV(r,{staleDays:c});if(d.stale.length===0){console.log(`memory: healthy \u2014 0 of ${d.totalNodes} node(s) stale (unaccessed ${c}+ days, never recalled)`);return}console.log(`memory: ${d.stale.length} of ${d.totalNodes} node(s) stale (unaccessed ${c}+ days, never recalled):`);for(let N of d.stale)console.log(` ${N.rid} (${N.node_type}) ${N.title} \u2014 ${N.ageDays}d idle`);if(n.flags.prune!==!0){console.log(`
6612
6612
  Re-run with --prune to delete these (asks for confirmation first).`);return}let G=n.flags.yes===!0;if(!G){if(!process.stdin.isTTY){console.log(`
6613
6613
  refusing to prune without confirmation \u2014 re-run with --yes in a non-interactive shell`);return}let N=Use({input:process.stdin,output:process.stdout}),v=(await N.question(`
6614
6614
  Delete ${d.stale.length} stale node(s)? Type "yes" to confirm: `)).trim();N.close(),G=v==="yes"}if(!G){console.log("memory: aborted \u2014 nothing deleted");return}let{pruned:h}=await ZXe(r,d.stale);console.log(`memory: pruned ${h} stale node(s)`)}finally{await r.close()}}async function qht(n){let r=yr(n.flags),c=n.positional[0]??".red/memory/export",d=jm(c)?c:Ba(r,c),G=n.flags.communities===!0,h=n.flags.interop===!0,{store:N}=await Fr(n);try{let v=await RQ(N,d,{communities:G,interop:h});console.log(`memory: exported ${v.nodes} node(s), ${v.edges} edge(s)`),G&&console.log(" communities: coloured via native Louvain"),console.log(` graph: ${v.htmlPath}`),console.log(` json: ${v.jsonPath}`),console.log(` audit: ${v.auditPath}`),v.interop&&(console.log(` nodes: ${v.interop.nodesJsonlPath}`),console.log(` edges: ${v.interop.edgesJsonlPath}`),console.log(` graphml:${v.interop.graphmlPath}`),console.log(` cypher: ${v.interop.cypherPath}`))}finally{await N.close()}}async function $ht(n){let r=n.positional.join(" ").trim();if(!r)throw new Error("nothing to search \u2014 pass a query: memory global-search <query>");let c=typeof n.flags.limit=="string"?Number(n.flags.limit):void 0,{store:d,config:G}=await Fr(n);try{let h=await WF("memory.global-search",{store:d,providerConfig:G.provider},{query:r,limit:c,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 N of h.evidence)console.log(` ${N.community_id}: score ${N.score}, ${N.size} node(s)`),console.log(` matched: ${N.matched_terms.join(", ")}`),console.log(` top label: ${N.top_label}`),console.log(` top type: ${N.top_node_type}`),N.narrative_summary&&console.log(` summary: ${N.narrative_summary}`)}finally{await d.close()}}async function JXn(n,r){let c=vl(n.flags,"from");if(c){let G=jm(c)?c:Ba(r,c),h=JSON.parse(await np(G,"utf8")),N=h.contract??h,v=rXe(N);if(!v.valid)throw new Error(`architecture-overview: ${G} is not a valid graph contract \u2014 ${v.errors.join("; ")}`);return N}let{store:d}=await Fr(n);try{let[G,h,N]=await Promise.all([d.listNodes(),d.listEdges(),d.communities()]);return $X({nodes:G,edges:h.map(mw),communities:N})}finally{await d.close()}}async function eWt(n){let r=yr(n.flags),c=await JXn(n,r),d=xwe(c);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 G=vl(n.flags,"out")??".red/memory/architecture-overview.md",h=jm(G)?G:Ba(r,G);await vs(lo(h),{recursive:!0}),await Ji(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 ek(){if(process.stdin.isTTY)return"";let n=[];for await(let r of process.stdin)n.push(r);return Buffer.concat(n).toString("utf8")}var kXn=["SessionStart","PostToolUse","Stop","PreCompact"];async function tWt(n){let r=n.positional[0],c=n.flags.runner==="codex"?"codex":"claude";if(!r||!kXn.includes(r)){process.stdout.write("{}");return}try{let d=await ek(),G=d.trim()?JSON.parse(d):{},h=yr(n.flags)!==process.cwd()?yr(n.flags):typeof G.cwd=="string"?G.cwd:process.cwd(),N=await Uwe(c,r,G);try{r==="SessionStart"?await MV(h,N.sessionId?{id:N.sessionId}:{}):await ZN(h)||(N.sessionId?await MV(h,{id:N.sessionId}):await oQe(h))}catch{}let v=await uQe(N,h);process.stdout.write(Bwe(c,r,v))}catch{process.stdout.write("{}")}}var AXn=["post-commit","post-checkout"];async function nWt(n){switch(n.positional[0]){case"refresh":return LXn(n);case"install-hooks":return zXn(n);case"uninstall-hooks":return OXn(n);default:throw new Error("vcs needs a subcommand \u2014 memory vcs refresh|install-hooks|uninstall-hooks")}}async function LXn(n){let r=yr(n.flags),c=vl(n.flags,"event"),d=n.flags.json===!0;if(!c||!AXn.includes(c)){d&&console.log(JSON.stringify({noop:!0,reason:"unknown vcs event"}));return}try{let G=await bQe(r,{event:c,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(G,null,2));return}if(G.noop){console.log(`memory: ${c} \u2014 no-op (${G.reason})`);return}let h=G.refresh;console.log(`memory: ${c} refreshed ${h?.files??0} changed file(s) \u2014 ${h?.added??0} added, ${h?.updated??0} updated, ${h?.stale??0} stale`),G.exported&&console.log(` exported ${G.exported.nodes} node(s) \u2192 ${G.exported.jsonPath}`)}catch(G){let h=`error: ${G instanceof Error?G.message:String(G)}`;console.log(d?JSON.stringify({noop:!0,reason:h}):`memory: ${c} \u2014 no-op (${h})`)}}async function IWt(n){try{let{stdout:r}=await KV("git",["-C",n,"rev-parse","--git-path","hooks"],{encoding:"utf8"}),c=r.trim();return c?jm(c)?c:Ba(n,c):Ba(n,".git/hooks")}catch{return Ba(n,".git/hooks")}}function xXn(){let n=process.env.CLAUDE_PLUGIN_ROOT??process.env.CODEX_PLUGIN_ROOT,r=Tht(new URL("../cli.ts",import.meta.url)),c=[n?Ic(n,"scripts","bootstrap.mjs"):void 0,Ic(lo(lo(r)),"scripts","bootstrap.mjs")];for(let d of c)if(d&&jK(d))return d}async function zXn(n){let r=yr(n.flags),c=await Ts(r);if(!c){console.log("memory: not initialized here \u2014 run `memory init --mode graph` before installing git hooks");return}if(c.mode!=="graph"){console.log(`memory: git hooks need graph mode \u2014 this project is "${c.mode}". Re-run \`memory init --mode graph\` first`);return}let d=await IWt(r),G=await ZQe({hooksDir:d,bootstrapPath:xXn(),force:n.flags.force===!0});if(n.flags.json===!0){console.log(JSON.stringify({hooksDir:d,...G},null,2));return}G.installed.length>0&&console.log(`memory: installed ${G.installed.join(", ")} into ${d}`);for(let h of G.backedUp)console.log(` backed up existing hook \u2192 ${h}`);for(let h of G.skipped)console.log(` skipped ${h.hook}: ${h.reason}`)}async function OXn(n){let r=yr(n.flags),c=await IWt(r),d=await hQe(c);if(n.flags.json===!0){console.log(JSON.stringify({hooksDir:c,...d},null,2));return}d.removed.length>0?console.log(`memory: removed ${d.removed.join(", ")} from ${c}`):console.log(`memory: no managed hooks found in ${c}`);for(let G of d.restored)console.log(` restored backed-up hook \u2192 ${G}`);for(let G of d.skipped)console.log(` ${G.reason}`)}async function lWt(n){let r=n.positional[0];if(r==="learn")return SXn(n);if(r!=="record")throw new Error("unknown worker command \u2014 expected: memory worker record|learn");let c=await ek();if(!c.trim())throw new Error("worker record needs a JSON payload on stdin");let d=JSON.parse(c),{store:G}=await Fr(n);try{let h=await U_e(G,d);console.log(`memory: recorded worker ${d.repository}#${d.issueNumber}/${d.attemptNumber} (rid ${h.workerRid})`)}finally{await G.close()}}async function SXn(n){let r=n.positional[1];if(r==="apply")return MXn(n);if(r!=null)throw new Error("memory worker learn supports: apply");let c=yr(n.flags),d=n.flags.json===!0,G=n.flags["write-proposal"]===!0,{store:h}=await Fr(n);try{let N=await B_e(h),v=G?await T_e(c,N):null,Q=N.proposals.length===0?"no-candidates":G?"proposal-written":"proposal-ready";if(d){console.log(JSON.stringify({state:Q,proposalFile:v,...N},null,2));return}console.log(`memory: worker learning - ${Q}`);for(let x of N.proposals)console.log(` [${x.kind}] ${x.title}`),console.log(` evidence: ${x.evidenceSummary}`);for(let x of N.rejected)console.log(` ${x.action}: ${x.kind} - ${x.reason}`);v&&console.log(` proposal: ${v}`),console.log(`