@reddb-io/red-skills 3.3.2 → 3.3.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.
@@ -6596,7 +6596,7 @@ Usage:
6596
6596
  ${n} archive --candidate <json> [--root <dir>] [--archive-dir <rel>]
6597
6597
  ${n} restore <name> [--root <dir>] [--archive-dir <rel>]`}function q3(n){return kgn(typeof n.root=="string"?n.root:process.cwd())}function cbt(n){return typeof n["archive-dir"]=="string"?n["archive-dir"]:void 0}async function sK(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 \`${UEe}\``}:Du(r)?{ok:!0}:{ok:!1,message:`curate: skill telemetry is not enabled here \u2014 run \`${UEe}\``}:{ok:!1,message:`curate: memory is not initialized here \u2014 run \`${UEe}\``}}function Lgn(){let n=Jgn(Agn(import.meta.url));return n.includes("dist/curate-skill")||n.endsWith("dist/curate-skill")?rbt(n,"..","cli.js"):rbt(n,"..","cli.ts")}async function xgn(n,r){let i=["curate","skills","--json"];r!==void 0&&i.push("--stale-days",String(r));let d=Lgn(),h=d.endsWith(".ts")?lbt(process.execPath,["--import","tsx",d,...i,"--root",n],{encoding:"utf8"}):lbt(process.execPath,[d,...i,"--root",n],{encoding:"utf8"}),g=h.status??1;if(g!==0)throw new Error(`memory curate skills exited ${g}`);return tbt(h.stdout??"")}function zgn(n){return typeof n.flags["stale-days"]=="string"?Number(n.flags["stale-days"]):void 0}async function ibt(n,r){return(r.loadCuratorReport??xgn)(q3(n.flags),zgn(n))}async function Ogn(n){let r=q3(n.flags),i=await sK(r);return i.ok?(console.log("curate: skill telemetry is enabled \u2014 ready to curate"),0):(console.error(i.message),2)}async function Mgn(n,r){let i=q3(n.flags),d=await sK(i);if(!d.ok)return console.error(d.message),2;let u;try{u=await ibt(n,r)}catch(J){return console.error(`curate: ${J.message}`),1}let{candidates:h,byCategory:g,filtered:F}=MEe(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 Sgn(n,r){let i=q3(n.flags),d=await sK(i);if(!d.ok)return console.error(d.message),2;let u;try{u=await ibt(n,r)}catch(J){return console.error(`curate: ${J.message}`),1}let{byCategory:h}=MEe(u);if(SEe(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 Ibt({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 Ugn(n){let r=q3(n.flags),i=await sK(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 $ut(u,{rootDir:r,archiveDir:cbt(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 Bgn(n){let r=q3(n.flags),i=await sK(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 ebt(d,{rootDir:r,archiveDir:cbt(n.flags)});return console.log(`curate: restored "${u.name}" \u2192 ${u.restoredRoot} (${u.files.length} file(s) hash-verified)`),0}async function BEe(n,r={}){switch(n.command){case"check":return Ogn(n);case"list":return Mgn(n,r);case"background":return Sgn(n,r);case"archive":return Ugn(n);case"restore":return Bgn(n);case void 0:case"--help":case"-h":return console.log(abt(r.usageCommand)),0;default:return console.error(`unknown curate subcommand: ${n.command}
6598
6598
 
6599
- ${abt(r.usageCommand)}`),2}}function TEe(n){let r={app:n,version:Tgn($3("__RED_BUILD_VERSION__",()=>"3.3.2")??"0.0.0-dev"),gitSha:$3("__RED_BUILD_GIT_SHA__",()=>"509fa2d95dcaa616b4195a2d7989826c33bbab13")??"unknown",buildTime:$3("__RED_BUILD_TIME__",()=>"2026-08-01T21:43:41Z")??"unknown",bundleAsset:$3("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=$3("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=$3("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(r.reddbSdkVersion=i),d&&(r.reddbBinaryTag=d),r}function Tgn(n){return n.startsWith("v")?n.slice(1):n}function jEe(n){return`${n.app} ${n.version} ${n.gitSha}`}function $3(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 ubt(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 bbt(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 p5(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=$D(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 pbt(n){let{store:r}=await gr(n);try{let i=Ia(n.flags,"stale-days")??90,d=await uy(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(`
6599
+ ${abt(r.usageCommand)}`),2}}function TEe(n){let r={app:n,version:Tgn($3("__RED_BUILD_VERSION__",()=>"3.3.3")??"0.0.0-dev"),gitSha:$3("__RED_BUILD_GIT_SHA__",()=>"48bced2cd328d5bdba9643bb4019f89d054bcdfe")??"unknown",buildTime:$3("__RED_BUILD_TIME__",()=>"2026-08-02T01:21:24Z")??"unknown",bundleAsset:$3("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=$3("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=$3("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(r.reddbSdkVersion=i),d&&(r.reddbBinaryTag=d),r}function Tgn(n){return n.startsWith("v")?n.slice(1):n}function jEe(n){return`${n.app} ${n.version} ${n.gitSha}`}function $3(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 ubt(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 bbt(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 p5(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=$D(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 pbt(n){let{store:r}=await gr(n);try{let i=Ia(n.flags,"stale-days")??90,d=await uy(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(`
6600
6600
  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(`
6601
6601
  refusing to prune without confirmation \u2014 re-run with --yes in a non-interactive shell`);return}let g=Sie({input:process.stdin,output:process.stdout}),F=(await g.question(`
6602
6602
  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 lXe(r,d.stale);console.log(`memory: pruned ${h} stale node(s)`)}finally{await r.close()}}async function Zbt(n){let r=Wr(n.flags),i=n.positional[0]??".red/memory/export",d=Am(i)?i:xa(r,i),u=n.flags.communities===!0,h=n.flags.interop===!0,{store:g}=await gr(n);try{let F=await IQ(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 hbt(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 Kgn(n,r){let i=Vl(n.flags,"from");if(i){let u=Am(i)?i:xa(r,i),h=JSON.parse(await Ub(u,"utf8")),g=h.contract??h,F=BFe(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 Wbt(n){let r=Wr(n.flags),i=await Kgn(n,r),d=Ffe(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=Am(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 y5(){if(process.stdin.isTTY)return"";let n=[];for await(let r of process.stdin)n.push(r);return Buffer.concat(n).toString("utf8")}var Pgn=["SessionStart","PostToolUse","Stop","PreCompact"];async function Nbt(n){let r=n.positional[0],i=n.flags.runner==="codex"?"codex":"claude";if(!r||!Pgn.includes(r)){process.stdout.write("{}");return}try{let d=await y5(),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 Qfe(i,r,u);try{r==="SessionStart"?await Vy(h,g.sessionId?{id:g.sessionId}:{}):await nN(h)||(g.sessionId?await Vy(h,{id:g.sessionId}):await Pwe(h))}catch{}let F=await tHe(g,h);process.stdout.write(Efe(i,r,F))}catch{process.stdout.write("{}")}}var qgn=["post-commit","post-checkout"];async function Ybt(n){switch(n.positional[0]){case"refresh":return $gn(n);case"install-hooks":return tyn(n);case"uninstall-hooks":return nyn(n);default:throw new Error("vcs needs a subcommand \u2014 memory vcs refresh|install-hooks|uninstall-hooks")}}async function $gn(n){let r=Wr(n.flags),i=Vl(n.flags,"event"),d=n.flags.json===!0;if(!i||!qgn.includes(i)){d&&console.log(JSON.stringify({noop:!0,reason:"unknown vcs event"}));return}try{let u=await nHe(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 Vbt(n){try{let{stdout:r}=await vy("git",["-C",n,"rev-parse","--git-path","hooks"],{encoding:"utf8"}),i=r.trim();return i?Am(i)?i:xa(n,i):xa(n,".git/hooks")}catch{return xa(n,".git/hooks")}}function eyn(){let n=process.env.CLAUDE_PLUGIN_ROOT??process.env.CODEX_PLUGIN_ROOT,r=Gbt(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&&oK(d))return d}async function tyn(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 Vbt(r),u=await lHe({hooksDir:d,bootstrapPath:eyn(),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 nyn(n){let r=Wr(n.flags),i=await Vbt(r),d=await rHe(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 gbt(n){let r=n.positional[0];if(r==="learn")return Iyn(n);if(r!=="record")throw new Error("unknown worker command \u2014 expected: memory worker record|learn");let i=await y5();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 QEe(u,d);console.log(`memory: recorded worker ${d.repository}#${d.issueNumber}/${d.attemptNumber} (rid ${h.workerRid})`)}finally{await u.close()}}async function Iyn(n){let r=n.positional[1];if(r==="apply")return lyn(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 EEe(h),F=u?await _Ee(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 M of g.proposals)console.log(` [${M.kind}] ${M.title}`),console.log(` evidence: ${M.evidenceSummary}`);for(let M of g.rejected)console.log(` ${M.action}: ${M.kind} - ${M.reason}`);F&&console.log(` proposal: ${F}`),console.log(`