@reddb-io/red-skills 3.3.21 → 3.3.22

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.
@@ -6605,7 +6605,7 @@ Usage:
6605
6605
  ${n} archive --candidate <json> [--root <dir>] [--archive-dir <rel>]
6606
6606
  ${n} restore <name> [--root <dir>] [--archive-dir <rel>]`}function d9(n){return dRn(typeof n.root=="string"?n.root:process.cwd())}function rpt(n){return typeof n["archive-dir"]=="string"?n["archive-dir"]:void 0}async function VK(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 \`${p_e}\``}:Ku(r)?{ok:!0}:{ok:!1,message:`curate: skill telemetry is not enabled here \u2014 run \`${p_e}\``}:{ok:!1,message:`curate: memory is not initialized here \u2014 run \`${p_e}\``}}function mRn(){let n=oRn(GRn(import.meta.url));return n.includes("dist/curate-skill")||n.endsWith("dist/curate-skill")?Ipt(n,"..","cli.js"):Ipt(n,"..","cli.ts")}async function uRn(n,r){let i=["curate","skills","--json"];r!==void 0&&i.push("--stale-days",String(r));let d=mRn(),h=d.endsWith(".ts")?npt(process.execPath,["--import","tsx",d,...i,"--root",n],{encoding:"utf8"}):npt(process.execPath,[d,...i,"--root",n],{encoding:"utf8"}),V=h.status??1;if(V!==0)throw new Error(`memory curate skills exited ${V}`);return $bt(h.stdout??"")}function bRn(n){return typeof n.flags["stale-days"]=="string"?Number(n.flags["stale-days"]):void 0}async function apt(n,r){return(r.loadCuratorReport??uRn)(d9(n.flags),bRn(n))}async function pRn(n){let r=d9(n.flags),i=await VK(r);return i.ok?(console.log("curate: skill telemetry is enabled \u2014 ready to curate"),0):(console.error(i.message),2)}async function ZRn(n,r){let i=d9(n.flags),d=await VK(i);if(!d.ok)return console.error(d.message),2;let m;try{m=await apt(n,r)}catch(_){return console.error(`curate: ${_.message}`),1}let{candidates:h,byCategory:V,filtered:v}=u_e(m);return console.log(JSON.stringify({candidates:h,byCategory:V,filtered:v,totals:{totalSkills:m.totalSkills,curatableSkills:m.curatableSkills,readOnlySkills:m.readOnlySkills}},null,2)),0}async function hRn(n,r){let i=d9(n.flags),d=await VK(i);if(!d.ok)return console.error(d.message),2;let m;try{m=await apt(n,r)}catch(_){return console.error(`curate: ${_.message}`),1}let{byCategory:h}=u_e(m);if(b_e(h)===0)return console.error("curate: no candidates \u2014 no issue filed"),0;let V=typeof n.flags.label=="string"?n.flags.label:void 0,v=await tpt({byCategory:h,totals:{totalSkills:m.totalSkills,curatableSkills:m.curatableSkills,readOnlySkills:m.readOnlySkills},generatedAt:m.generatedAt},{cwd:i,label:V});return console.log(`curate: filed background issue \u2014 ${v.output||v.title}`),0}async function WRn(n){let r=d9(n.flags),i=await VK(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 m;try{m=JSON.parse(d)}catch(V){return console.error(`curate archive: invalid --candidate JSON: ${V.message}`),2}let h=await Pbt(m,{rootDir:r,archiveDir:rpt(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 NRn(n){let r=d9(n.flags),i=await VK(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 m=await qbt(d,{rootDir:r,archiveDir:rpt(n.flags)});return console.log(`curate: restored "${m.name}" \u2192 ${m.restoredRoot} (${m.files.length} file(s) hash-verified)`),0}async function Z_e(n,r={}){switch(n.command){case"check":return pRn(n);case"list":return ZRn(n,r);case"background":return hRn(n,r);case"archive":return WRn(n);case"restore":return NRn(n);case void 0:case"--help":case"-h":return console.log(lpt(r.usageCommand)),0;default:return console.error(`unknown curate subcommand: ${n.command}
6607
6607
 
6608
- ${lpt(r.usageCommand)}`),2}}function h_e(n){let r={app:n,version:YRn(G9("__RED_BUILD_VERSION__",()=>"3.3.21")??"0.0.0-dev"),gitSha:G9("__RED_BUILD_GIT_SHA__",()=>"bae98be31c9aa17a4bd850e053045c2ffb276781")??"unknown",buildTime:G9("__RED_BUILD_TIME__",()=>"2026-08-03T15:53:12Z")??"unknown",bundleAsset:G9("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=G9("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=G9("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(r.reddbSdkVersion=i),d&&(r.reddbBinaryTag=d),r}function YRn(n){return n.startsWith("v")?n.slice(1):n}function W_e(n){return`${n.app} ${n.version} ${n.gitSha}`}function G9(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 Gpt(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 mpt(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 V=await R5(d,h,{limit:la(n.flags,"limit")});if(n.flags.json===!0){console.log(JSON.stringify(V,null,2));return}if(V.status==="unavailable"){let v=V.error?` \u2014 ${V.error}`:"";console.log(`memory: vector search unavailable${v}`);return}console.log(`memory: vector search ${V.hits.length}/${V.limit} hit(s) for "${h}"`);for(let v of V.hits){let _=v.source?` source=${v.source}`:"";console.log(` ${v.score.toFixed(3)} memory_nodes:${v.rid} (${v.node_type}) ${v.title}${_}`),v.excerpt&&console.log(` ${v.excerpt}`)}return}if(r==="status-viewer"){let h=Wr(n.flags),V=Vl(n.flags,"out")??qa(h,".red/memory/vector-status-viewer.html"),v=mK(await d.vectorStatus());await hs(Ps(V),{recursive:!0}),await Xi(V,v.html,"utf8"),console.log(`memory: vector status viewer written ${V}`),console.log(` status: ${v.report.overall}`),console.log(` contract: ${v.contract.consumes}`);return}let m=r==="maintain"?await d.maintainVectorProjection({strict:n.flags.strict===!0}):await d.vectorStatus();if(n.flags.json===!0){console.log(JSON.stringify(m,null,2));return}console.log(`memory: vector projection ${m.overall} \u2014 ${m.ready}/${m.total} ready`),m.stale>0&&console.log(` stale: ${m.stale}`),m.unavailable>0&&console.log(` unavailable: ${m.unavailable}`),m.failed>0&&console.log(` failed: ${m.failed}`);for(let h of m.nodes.filter(V=>V.status!=="ready")){let V=h.error?` \u2014 ${h.error}`:"";console.log(` ${h.rid} (${h.node_type}) ${h.label}: ${h.status}${V}`)}for(let h of m.docs.filter(V=>V.status!=="ready")){let V=h.error?` \u2014 ${h.error}`:"";console.log(` doc:${h.rid} ${h.path}: ${h.status}${V}`)}}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 upt(n){let{store:r}=await gr(n);try{let i=la(n.flags,"stale-days")??90,d=await hy(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 V of d.stale)console.log(` ${V.rid} (${V.node_type}) ${V.title} \u2014 ${V.ageDays}d idle`);if(n.flags.prune!==!0){console.log(`
6608
+ ${lpt(r.usageCommand)}`),2}}function h_e(n){let r={app:n,version:YRn(G9("__RED_BUILD_VERSION__",()=>"3.3.22")??"0.0.0-dev"),gitSha:G9("__RED_BUILD_GIT_SHA__",()=>"61db0dc2964c9e3d76234252dee063c9b129f53d")??"unknown",buildTime:G9("__RED_BUILD_TIME__",()=>"2026-08-03T19:10:50Z")??"unknown",bundleAsset:G9("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=G9("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=G9("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(r.reddbSdkVersion=i),d&&(r.reddbBinaryTag=d),r}function YRn(n){return n.startsWith("v")?n.slice(1):n}function W_e(n){return`${n.app} ${n.version} ${n.gitSha}`}function G9(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 Gpt(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 mpt(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 V=await R5(d,h,{limit:la(n.flags,"limit")});if(n.flags.json===!0){console.log(JSON.stringify(V,null,2));return}if(V.status==="unavailable"){let v=V.error?` \u2014 ${V.error}`:"";console.log(`memory: vector search unavailable${v}`);return}console.log(`memory: vector search ${V.hits.length}/${V.limit} hit(s) for "${h}"`);for(let v of V.hits){let _=v.source?` source=${v.source}`:"";console.log(` ${v.score.toFixed(3)} memory_nodes:${v.rid} (${v.node_type}) ${v.title}${_}`),v.excerpt&&console.log(` ${v.excerpt}`)}return}if(r==="status-viewer"){let h=Wr(n.flags),V=Vl(n.flags,"out")??qa(h,".red/memory/vector-status-viewer.html"),v=mK(await d.vectorStatus());await hs(Ps(V),{recursive:!0}),await Xi(V,v.html,"utf8"),console.log(`memory: vector status viewer written ${V}`),console.log(` status: ${v.report.overall}`),console.log(` contract: ${v.contract.consumes}`);return}let m=r==="maintain"?await d.maintainVectorProjection({strict:n.flags.strict===!0}):await d.vectorStatus();if(n.flags.json===!0){console.log(JSON.stringify(m,null,2));return}console.log(`memory: vector projection ${m.overall} \u2014 ${m.ready}/${m.total} ready`),m.stale>0&&console.log(` stale: ${m.stale}`),m.unavailable>0&&console.log(` unavailable: ${m.unavailable}`),m.failed>0&&console.log(` failed: ${m.failed}`);for(let h of m.nodes.filter(V=>V.status!=="ready")){let V=h.error?` \u2014 ${h.error}`:"";console.log(` ${h.rid} (${h.node_type}) ${h.label}: ${h.status}${V}`)}for(let h of m.docs.filter(V=>V.status!=="ready")){let V=h.error?` \u2014 ${h.error}`:"";console.log(` doc:${h.rid} ${h.path}: ${h.status}${V}`)}}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 upt(n){let{store:r}=await gr(n);try{let i=la(n.flags,"stale-days")??90,d=await hy(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 V of d.stale)console.log(` ${V.rid} (${V.node_type}) ${V.title} \u2014 ${V.ageDays}d idle`);if(n.flags.prune!==!0){console.log(`
6609
6609
  Re-run with --prune to delete these (asks for confirmation first).`);return}let m=n.flags.yes===!0;if(!m){if(!process.stdin.isTTY){console.log(`
6610
6610
  refusing to prune without confirmation \u2014 re-run with --yes in a non-interactive shell`);return}let V=ise({input:process.stdin,output:process.stdout}),v=(await V.question(`
6611
6611
  Delete ${d.stale.length} stale node(s)? Type "yes" to confirm: `)).trim();V.close(),m=v==="yes"}if(!m){console.log("memory: aborted \u2014 nothing deleted");return}let{pruned:h}=await Xfe(r,d.stale);console.log(`memory: pruned ${h} stale node(s)`)}finally{await r.close()}}async function bpt(n){let r=Wr(n.flags),i=n.positional[0]??".red/memory/export",d=Lm(i)?i:za(r,i),m=n.flags.communities===!0,h=n.flags.interop===!0,{store:V}=await gr(n);try{let v=await dQ(V,d,{communities:m,interop:h});console.log(`memory: exported ${v.nodes} node(s), ${v.edges} edge(s)`),m&&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 V.close()}}async function ppt(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:m}=await gr(n);try{let h=await tF("memory.global-search",{store:d,providerConfig:m.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 V of h.evidence)console.log(` ${V.community_id}: score ${V.score}, ${V.size} node(s)`),console.log(` matched: ${V.matched_terms.join(", ")}`),console.log(` top label: ${V.top_label}`),console.log(` top type: ${V.top_node_type}`),V.narrative_summary&&console.log(` summary: ${V.narrative_summary}`)}finally{await d.close()}}async function yRn(n,r){let i=Vl(n.flags,"from");if(i){let m=Lm(i)?i:za(r,i),h=JSON.parse(await Bb(m,"utf8")),V=h.contract??h,v=Zfe(V);if(!v.valid)throw new Error(`architecture-overview: ${m} is not a valid graph contract \u2014 ${v.errors.join("; ")}`);return V}let{store:d}=await gr(n);try{let[m,h,V]=await Promise.all([d.listNodes(),d.listEdges(),d.communities()]);return AX({nodes:m,edges:h.map(qX),communities:V})}finally{await d.close()}}async function Zpt(n){let r=Wr(n.flags),i=await yRn(n,r),d=qXe(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 m=Vl(n.flags,"out")??".red/memory/architecture-overview.md",h=Lm(m)?m:za(r,m);await hs(Ps(h),{recursive:!0}),await Xi(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 _5(){if(process.stdin.isTTY)return"";let n=[];for await(let r of process.stdin)n.push(r);return Buffer.concat(n).toString("utf8")}var RRn=["SessionStart","PostToolUse","Stop","PreCompact"];async function hpt(n){let r=n.positional[0],i=n.flags.runner==="codex"?"codex":"claude";if(!r||!RRn.includes(r)){process.stdout.write("{}");return}try{let d=await _5(),m=d.trim()?JSON.parse(d):{},h=Wr(n.flags)!==process.cwd()?Wr(n.flags):typeof m.cwd=="string"?m.cwd:process.cwd(),V=await I1e(i,r,m);try{r==="SessionStart"?await vy(h,V.sessionId?{id:V.sessionId}:{}):await rN(h)||(V.sessionId?await vy(h,{id:V.sessionId}):await VHe(h))}catch{}let v=await vHe(V,h);process.stdout.write(l1e(i,r,v))}catch{process.stdout.write("{}")}}var vRn=["post-commit","post-checkout"];async function Wpt(n){switch(n.positional[0]){case"refresh":return FRn(n);case"install-hooks":return XRn(n);case"uninstall-hooks":return wRn(n);default:throw new Error("vcs needs a subcommand \u2014 memory vcs refresh|install-hooks|uninstall-hooks")}}async function FRn(n){let r=Wr(n.flags),i=Vl(n.flags,"event"),d=n.flags.json===!0;if(!i||!vRn.includes(i)){d&&console.log(JSON.stringify({noop:!0,reason:"unknown vcs event"}));return}try{let m=await FHe(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(m,null,2));return}if(m.noop){console.log(`memory: ${i} \u2014 no-op (${m.reason})`);return}let h=m.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`),m.exported&&console.log(` exported ${m.exported.nodes} node(s) \u2192 ${m.exported.jsonPath}`)}catch(m){let h=`error: ${m instanceof Error?m.message:String(m)}`;console.log(d?JSON.stringify({noop:!0,reason:h}):`memory: ${i} \u2014 no-op (${h})`)}}async function Npt(n){try{let{stdout:r}=await wy("git",["-C",n,"rev-parse","--git-path","hooks"],{encoding:"utf8"}),i=r.trim();return i?Lm(i)?i:za(n,i):za(n,".git/hooks")}catch{return za(n,".git/hooks")}}function fRn(){let n=process.env.CLAUDE_PLUGIN_ROOT??process.env.CODEX_PLUGIN_ROOT,r=opt(new URL("../cli.ts",import.meta.url)),i=[n?qa(n,"scripts","bootstrap.mjs"):void 0,qa(Ps(Ps(r)),"scripts","bootstrap.mjs")];for(let d of i)if(d&&gK(d))return d}async function XRn(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 Npt(r),m=await XHe({hooksDir:d,bootstrapPath:fRn(),force:n.flags.force===!0});if(n.flags.json===!0){console.log(JSON.stringify({hooksDir:d,...m},null,2));return}m.installed.length>0&&console.log(`memory: installed ${m.installed.join(", ")} into ${d}`);for(let h of m.backedUp)console.log(` backed up existing hook \u2192 ${h}`);for(let h of m.skipped)console.log(` skipped ${h.hook}: ${h.reason}`)}async function wRn(n){let r=Wr(n.flags),i=await Npt(r),d=await wHe(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 m of d.restored)console.log(` restored backed-up hook \u2192 ${m}`);for(let m of d.skipped)console.log(` ${m.reason}`)}async function Ypt(n){let r=n.positional[0];if(r==="learn")return HRn(n);if(r!=="record")throw new Error("unknown worker command \u2014 expected: memory worker record|learn");let i=await _5();if(!i.trim())throw new Error("worker record needs a JSON payload on stdin");let d=JSON.parse(i),{store:m}=await gr(n);try{let h=await I_e(m,d);console.log(`memory: recorded worker ${d.repository}#${d.issueNumber}/${d.attemptNumber} (rid ${h.workerRid})`)}finally{await m.close()}}async function HRn(n){let r=n.positional[1];if(r==="apply")return QRn(n);if(r!=null)throw new Error("memory worker learn supports: apply");let i=Wr(n.flags),d=n.flags.json===!0,m=n.flags["write-proposal"]===!0,{store:h}=await gr(n);try{let V=await l_e(h),v=m?await r_e(i,V):null,_=V.proposals.length===0?"no-candidates":m?"proposal-written":"proposal-ready";if(d){console.log(JSON.stringify({state:_,proposalFile:v,...V},null,2));return}console.log(`memory: worker learning - ${_}`);for(let M of V.proposals)console.log(` [${M.kind}] ${M.title}`),console.log(` evidence: ${M.evidenceSummary}`);for(let M of V.rejected)console.log(` ${M.action}: ${M.kind} - ${M.reason}`);v&&console.log(` proposal: ${v}`),console.log(`