@reddb-io/red-skills 2.87.0 → 2.87.2

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.
@@ -6578,7 +6578,7 @@ Usage:
6578
6578
  ${n} archive --candidate <json> [--root <dir>] [--archive-dir <rel>]
6579
6579
  ${n} restore <name> [--root <dir>] [--archive-dir <rel>]`}function Ux(n){return mVn(typeof n.root=="string"?n.root:process.cwd())}function hut(n){return typeof n["archive-dir"]=="string"?n["archive-dir"]:void 0}async function eK(n){let a=await xs(n);return a?a.mode!=="graph"?{ok:!1,message:`curate: skill telemetry needs graph mode (this project is "${a.mode}") \u2014 run \`${VEe}\``}:ju(a)?{ok:!0}:{ok:!1,message:`curate: skill telemetry is not enabled here \u2014 run \`${VEe}\``}:{ok:!1,message:`curate: memory is not initialized here \u2014 run \`${VEe}\``}}function bVn(){let n=GVn(uVn(import.meta.url));return n.includes("dist/curate-skill")||n.endsWith("dist/curate-skill")?put(n,"..","cli.js"):put(n,"..","cli.ts")}async function pVn(n,a){let i=["curate","skills","--json"];a!==void 0&&i.push("--stale-days",String(a));let d=bVn(),h=d.endsWith(".ts")?but(process.execPath,["--import","tsx",d,...i,"--root",n],{encoding:"utf8"}):but(process.execPath,[d,...i,"--root",n],{encoding:"utf8"}),y=h.status??1;if(y!==0)throw new Error(`memory curate skills exited ${y}`);return Gut(h.stdout??"")}function ZVn(n){return typeof n.flags["stale-days"]=="string"?Number(n.flags["stale-days"]):void 0}async function Wut(n,a){return(a.loadCuratorReport??pVn)(Ux(n.flags),ZVn(n))}async function hVn(n){let a=Ux(n.flags),i=await eK(a);return i.ok?(console.log("curate: skill telemetry is enabled \u2014 ready to curate"),0):(console.error(i.message),2)}async function WVn(n,a){let i=Ux(n.flags),d=await eK(i);if(!d.ok)return console.error(d.message),2;let u;try{u=await Wut(n,a)}catch(J){return console.error(`curate: ${J.message}`),1}let{candidates:h,byCategory:y,filtered:f}=NEe(u);return console.log(JSON.stringify({candidates:h,byCategory:y,filtered:f,totals:{totalSkills:u.totalSkills,curatableSkills:u.curatableSkills,readOnlySkills:u.readOnlySkills}},null,2)),0}async function NVn(n,a){let i=Ux(n.flags),d=await eK(i);if(!d.ok)return console.error(d.message),2;let u;try{u=await Wut(n,a)}catch(J){return console.error(`curate: ${J.message}`),1}let{byCategory:h}=NEe(u);if(YEe(h)===0)return console.error("curate: no candidates \u2014 no issue filed"),0;let y=typeof n.flags.label=="string"?n.flags.label:void 0,f=await uut({byCategory:h,totals:{totalSkills:u.totalSkills,curatableSkills:u.curatableSkills,readOnlySkills:u.readOnlySkills},generatedAt:u.generatedAt},{cwd:i,label:y});return console.log(`curate: filed background issue \u2014 ${f.output||f.title}`),0}async function YVn(n){let a=Ux(n.flags),i=await eK(a);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(y){return console.error(`curate archive: invalid --candidate JSON: ${y.message}`),2}let h=await out(u,{rootDir:a,archiveDir:hut(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 VVn(n){let a=Ux(n.flags),i=await eK(a);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 dut(d,{rootDir:a,archiveDir:hut(n.flags)});return console.log(`curate: restored "${u.name}" \u2192 ${u.restoredRoot} (${u.files.length} file(s) hash-verified)`),0}async function gEe(n,a={}){switch(n.command){case"check":return hVn(n);case"list":return WVn(n,a);case"background":return NVn(n,a);case"archive":return YVn(n);case"restore":return VVn(n);case void 0:case"--help":case"-h":return console.log(Zut(a.usageCommand)),0;default:return console.error(`unknown curate subcommand: ${n.command}
6580
6580
 
6581
- ${Zut(a.usageCommand)}`),2}}function yEe(n){let a={app:n,version:gVn(Bx("__RED_BUILD_VERSION__",()=>"2.87.0")??"0.0.0-dev"),gitSha:Bx("__RED_BUILD_GIT_SHA__",()=>"88420f3ef47be8208e2ea9888fef95633117d797")??"unknown",buildTime:Bx("__RED_BUILD_TIME__",()=>"2026-07-23T12:44:36-03:00")??"unknown",bundleAsset:Bx("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=Bx("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=Bx("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(a.reddbSdkVersion=i),d&&(a.reddbBinaryTag=d),a}function gVn(n){return n.startsWith("v")?n.slice(1):n}function REe(n){return`${n.app} ${n.version} ${n.gitSha}`}function Bx(n,a){try{let i=a();return typeof i=="string"&&i.length>0?i:void 0}catch{return process.env[n.replace(/^__|__$/g,"")]}}async function Rut(n){let{store:a}=await ga(n);try{let i=await a.stats();console.log(`memory: ${i.nodes} node(s), ${i.edges} edge(s)`)}finally{await a.close()}}async function vut(n){let a=n.positional[0];if(a!=="status"&&a!=="status-viewer"&&a!=="maintain"&&a!=="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 ga(n);try{if(a==="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 y=await G5(d,h,{limit:Ir(n.flags,"limit")});if(n.flags.json===!0){console.log(JSON.stringify(y,null,2));return}if(y.status==="unavailable"){let f=y.error?` \u2014 ${y.error}`:"";console.log(`memory: vector search unavailable${f}`);return}console.log(`memory: vector search ${y.hits.length}/${y.limit} hit(s) for "${h}"`);for(let f of y.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(a==="status-viewer"){let h=Wa(n.flags),y=Vl(n.flags,"out")??Pr(h,".red/memory/vector-status-viewer.html"),f=BD(await d.vectorStatus());await hs(Ps(y),{recursive:!0}),await fi(y,f.html,"utf8"),console.log(`memory: vector status viewer written ${y}`),console.log(` status: ${f.report.overall}`),console.log(` contract: ${f.contract.consumes}`);return}let u=a==="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(y=>y.status!=="ready")){let y=h.error?` \u2014 ${h.error}`:"";console.log(` ${h.rid} (${h.node_type}) ${h.label}: ${h.status}${y}`)}for(let h of u.docs.filter(y=>y.status!=="ready")){let y=h.error?` \u2014 ${h.error}`:"";console.log(` doc:${h.rid} ${h.path}: ${h.status}${y}`)}}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 Fut(n){let{store:a}=await ga(n);try{let i=Ir(n.flags,"stale-days")??90,d=await Gy(a,{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 y of d.stale)console.log(` ${y.rid} (${y.node_type}) ${y.title} \u2014 ${y.ageDays}d idle`);if(n.flags.prune!==!0){console.log(`
6581
+ ${Zut(a.usageCommand)}`),2}}function yEe(n){let a={app:n,version:gVn(Bx("__RED_BUILD_VERSION__",()=>"2.87.2")??"0.0.0-dev"),gitSha:Bx("__RED_BUILD_GIT_SHA__",()=>"1cef3403d941742a4d5f2816c91b2ceb45c0b63c")??"unknown",buildTime:Bx("__RED_BUILD_TIME__",()=>"2026-07-23T16:34:37-03:00")??"unknown",bundleAsset:Bx("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=Bx("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=Bx("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(a.reddbSdkVersion=i),d&&(a.reddbBinaryTag=d),a}function gVn(n){return n.startsWith("v")?n.slice(1):n}function REe(n){return`${n.app} ${n.version} ${n.gitSha}`}function Bx(n,a){try{let i=a();return typeof i=="string"&&i.length>0?i:void 0}catch{return process.env[n.replace(/^__|__$/g,"")]}}async function Rut(n){let{store:a}=await ga(n);try{let i=await a.stats();console.log(`memory: ${i.nodes} node(s), ${i.edges} edge(s)`)}finally{await a.close()}}async function vut(n){let a=n.positional[0];if(a!=="status"&&a!=="status-viewer"&&a!=="maintain"&&a!=="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 ga(n);try{if(a==="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 y=await G5(d,h,{limit:Ir(n.flags,"limit")});if(n.flags.json===!0){console.log(JSON.stringify(y,null,2));return}if(y.status==="unavailable"){let f=y.error?` \u2014 ${y.error}`:"";console.log(`memory: vector search unavailable${f}`);return}console.log(`memory: vector search ${y.hits.length}/${y.limit} hit(s) for "${h}"`);for(let f of y.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(a==="status-viewer"){let h=Wa(n.flags),y=Vl(n.flags,"out")??Pr(h,".red/memory/vector-status-viewer.html"),f=BD(await d.vectorStatus());await hs(Ps(y),{recursive:!0}),await fi(y,f.html,"utf8"),console.log(`memory: vector status viewer written ${y}`),console.log(` status: ${f.report.overall}`),console.log(` contract: ${f.contract.consumes}`);return}let u=a==="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(y=>y.status!=="ready")){let y=h.error?` \u2014 ${h.error}`:"";console.log(` ${h.rid} (${h.node_type}) ${h.label}: ${h.status}${y}`)}for(let h of u.docs.filter(y=>y.status!=="ready")){let y=h.error?` \u2014 ${h.error}`:"";console.log(` doc:${h.rid} ${h.path}: ${h.status}${y}`)}}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 Fut(n){let{store:a}=await ga(n);try{let i=Ir(n.flags,"stale-days")??90,d=await Gy(a,{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 y of d.stale)console.log(` ${y.rid} (${y.node_type}) ${y.title} \u2014 ${y.ageDays}d idle`);if(n.flags.prune!==!0){console.log(`
6582
6582
  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(`
6583
6583
  refusing to prune without confirmation \u2014 re-run with --yes in a non-interactive shell`);return}let y=Qie({input:process.stdin,output:process.stdout}),f=(await y.question(`
6584
6584
  Delete ${d.stale.length} stale node(s)? Type "yes" to confirm: `)).trim();y.close(),u=f==="yes"}if(!u){console.log("memory: aborted \u2014 nothing deleted");return}let{pruned:h}=await UFe(a,d.stale);console.log(`memory: pruned ${h} stale node(s)`)}finally{await a.close()}}async function Xut(n){let a=Wa(n.flags),i=n.positional[0]??".red/memory/export",d=km(i)?i:xr(a,i),u=n.flags.communities===!0,h=n.flags.interop===!0,{store:y}=await ga(n);try{let f=await tQ(y,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 y.close()}}async function fut(n){let a=n.positional.join(" ").trim();if(!a)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 ga(n);try{let h=await jv("memory.global-search",{store:d,providerConfig:u.provider},{query:a,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 y of h.evidence)console.log(` ${y.community_id}: score ${y.score}, ${y.size} node(s)`),console.log(` matched: ${y.matched_terms.join(", ")}`),console.log(` top label: ${y.top_label}`),console.log(` top type: ${y.top_node_type}`),y.narrative_summary&&console.log(` summary: ${y.narrative_summary}`)}finally{await d.close()}}async function vVn(n,a){let i=Vl(n.flags,"from");if(i){let u=km(i)?i:xr(a,i),h=JSON.parse(await Sb(u,"utf8")),y=h.contract??h,f=EFe(y);if(!f.valid)throw new Error(`architecture-overview: ${u} is not a valid graph contract \u2014 ${f.errors.join("; ")}`);return y}let{store:d}=await ga(n);try{let[u,h,y]=await Promise.all([d.listNodes(),d.listEdges(),d.communities()]);return Ff({nodes:u,edges:h.map(zf),communities:y})}finally{await d.close()}}async function wut(n){let a=Wa(n.flags),i=await vVn(n,a),d=ufe(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:xr(a,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 h5(){if(process.stdin.isTTY)return"";let n=[];for await(let a of process.stdin)n.push(a);return Buffer.concat(n).toString("utf8")}var FVn=["SessionStart","PostToolUse","Stop","PreCompact"];async function Hut(n){let a=n.positional[0],i=n.flags.runner==="codex"?"codex":"claude";if(!a||!FVn.includes(a)){process.stdout.write("{}");return}try{let d=await h5(),u=d.trim()?JSON.parse(d):{},h=Wa(n.flags)!==process.cwd()?Wa(n.flags):typeof u.cwd=="string"?u.cwd:process.cwd(),y=await Wfe(i,a,u);try{a==="SessionStart"?await Ny(h,y.sessionId?{id:y.sessionId}:{}):await eN(h)||(y.sessionId?await Ny(h,{id:y.sessionId}):await Awe(h))}catch{}let f=await Owe(y,h);process.stdout.write(Nfe(i,a,f))}catch{process.stdout.write("{}")}}var XVn=["post-commit","post-checkout"];async function Qut(n){switch(n.positional[0]){case"refresh":return fVn(n);case"install-hooks":return HVn(n);case"uninstall-hooks":return QVn(n);default:throw new Error("vcs needs a subcommand \u2014 memory vcs refresh|install-hooks|uninstall-hooks")}}async function fVn(n){let a=Wa(n.flags),i=Vl(n.flags,"event"),d=n.flags.json===!0;if(!i||!XVn.includes(i)){d&&console.log(JSON.stringify({noop:!0,reason:"unknown vcs event"}));return}try{let u=await Mwe(a,{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 Eut(n){try{let{stdout:a}=await yy("git",["-C",n,"rev-parse","--git-path","hooks"],{encoding:"utf8"}),i=a.trim();return i?km(i)?i:xr(n,i):xr(n,".git/hooks")}catch{return xr(n,".git/hooks")}}function wVn(){let n=process.env.CLAUDE_PLUGIN_ROOT??process.env.CODEX_PLUGIN_ROOT,a=gut(new URL("../cli.ts",import.meta.url)),i=[n?Pr(n,"scripts","bootstrap.mjs"):void 0,Pr(Ps(Ps(a)),"scripts","bootstrap.mjs")];for(let d of i)if(d&&tK(d))return d}async function HVn(n){let a=Wa(n.flags),i=await xs(a);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 Eut(a),u=await Uwe({hooksDir:d,bootstrapPath:wVn(),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 QVn(n){let a=Wa(n.flags),i=await Eut(a),d=await Bwe(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 _ut(n){let a=n.positional[0];if(a==="learn")return EVn(n);if(a!=="record")throw new Error("unknown attempt command \u2014 expected: memory attempt record|learn");let i=await h5();if(!i.trim())throw new Error("attempt record needs a JSON payload on stdin");let d=JSON.parse(i),{store:u}=await ga(n);try{let h=await uEe(u,d);console.log(`memory: recorded attempt ${d.repository}#${d.issueNumber}/${d.attemptNumber} (rid ${h.attemptRid})`)}finally{await u.close()}}async function EVn(n){let a=n.positional[1];if(a==="apply")return _Vn(n);if(a!=null)throw new Error("memory attempt learn supports: apply");let i=Wa(n.flags),d=n.flags.json===!0,u=n.flags["write-proposal"]===!0,{store:h}=await ga(n);try{let y=await bEe(h),f=u?await pEe(i,y):null,J=y.proposals.length===0?"no-candidates":u?"proposal-written":"proposal-ready";if(d){console.log(JSON.stringify({state:J,proposalFile:f,...y},null,2));return}console.log(`memory: attempt learning - ${J}`);for(let S of y.proposals)console.log(` [${S.kind}] ${S.title}`),console.log(` evidence: ${S.evidenceSummary}`);for(let S of y.rejected)console.log(` ${S.action}: ${S.kind} - ${S.reason}`);f&&console.log(` proposal: ${f}`),console.log(`