@reddb-io/red-skills 2.51.0 → 2.52.0

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.
@@ -6563,7 +6563,7 @@ Usage:
6563
6563
  ${n} archive --candidate <json> [--root <dir>] [--archive-dir <rel>]
6564
6564
  ${n} restore <name> [--root <dir>] [--archive-dir <rel>]`}function fx(n){return fNn(typeof n.root=="string"?n.root:process.cwd())}function got(n){return typeof n["archive-dir"]=="string"?n["archive-dir"]:void 0}async function yj(n){let a=await Co(n);return a?a.mode!=="graph"?{ok:!1,message:`curate: skill telemetry needs graph mode (this project is "${a.mode}") \u2014 run \`${Ywe}\``}:sZ(a)?{ok:!0}:{ok:!1,message:`curate: skill telemetry is not enabled here \u2014 run \`${Ywe}\``}:{ok:!1,message:`curate: memory is not initialized here \u2014 run \`${Ywe}\``}}function HNn(){let n=XNn(wNn(import.meta.url));return n.includes("dist/curate-skill")||n.endsWith("dist/curate-skill")?Yot(n,"..","cli.js"):Yot(n,"..","cli.ts")}async function QNn(n,a){let i=["curate","skills","--json"];a!==void 0&&i.push("--stale-days",String(a));let d=HNn(),h=d.endsWith(".ts")?Not(process.execPath,["--import","tsx",d,...i,"--root",n],{encoding:"utf8"}):Not(process.execPath,[d,...i,"--root",n],{encoding:"utf8"}),y=h.status??1;if(y!==0)throw new Error(`memory curate skills exited ${y}`);return Zot(h.stdout??"")}function ENn(n){return typeof n.flags["stale-days"]=="string"?Number(n.flags["stale-days"]):void 0}async function yot(n,a){return(a.loadCuratorReport??QNn)(fx(n.flags),ENn(n))}async function _Nn(n){let a=fx(n.flags),i=await yj(a);return i.ok?(console.log("curate: skill telemetry is enabled \u2014 ready to curate"),0):(console.error(i.message),2)}async function CNn(n,a){let i=fx(n.flags),d=await yj(i);if(!d.ok)return console.error(d.message),2;let b;try{b=await yot(n,a)}catch(J){return console.error(`curate: ${J.message}`),1}let{candidates:h,byCategory:y,filtered:w}=Wwe(b);return console.log(JSON.stringify({candidates:h,byCategory:y,filtered:w,totals:{totalSkills:b.totalSkills,curatableSkills:b.curatableSkills,readOnlySkills:b.readOnlySkills}},null,2)),0}async function JNn(n,a){let i=fx(n.flags),d=await yj(i);if(!d.ok)return console.error(d.message),2;let b;try{b=await yot(n,a)}catch(J){return console.error(`curate: ${J.message}`),1}let{byCategory:h}=Wwe(b);if(Nwe(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,w=await Wot({byCategory:h,totals:{totalSkills:b.totalSkills,curatableSkills:b.curatableSkills,readOnlySkills:b.readOnlySkills},generatedAt:b.generatedAt},{cwd:i,label:y});return console.log(`curate: filed background issue \u2014 ${w.output||w.title}`),0}async function kNn(n){let a=fx(n.flags),i=await yj(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 b;try{b=JSON.parse(d)}catch(y){return console.error(`curate archive: invalid --candidate JSON: ${y.message}`),2}let h=await uot(b,{rootDir:a,archiveDir:got(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 ANn(n){let a=fx(n.flags),i=await yj(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 b=await pot(d,{rootDir:a,archiveDir:got(n.flags)});return console.log(`curate: restored "${b.name}" \u2192 ${b.restoredRoot} (${b.files.length} file(s) hash-verified)`),0}async function Rot(n,a={}){switch(n.command){case"check":return _Nn(n);case"list":return CNn(n,a);case"background":return JNn(n,a);case"archive":return kNn(n);case"restore":return ANn(n);case void 0:case"--help":case"-h":return console.log(Vot(a.usageCommand)),0;default:return console.error(`unknown curate subcommand: ${n.command}
6565
6565
 
6566
- ${Vot(a.usageCommand)}`),2}}function vot(n){let a={app:n,version:LNn(wx("__RED_BUILD_VERSION__",()=>"2.51.0")??"0.0.0-dev"),gitSha:wx("__RED_BUILD_GIT_SHA__",()=>"58b9b3fd1adf312059aadc0af37ef5d7ee054d5a")??"unknown",buildTime:wx("__RED_BUILD_TIME__",()=>"2026-07-13T10:07:10-03:00")??"unknown",bundleAsset:wx("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=wx("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=wx("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(a.reddbSdkVersion=i),d&&(a.reddbBinaryTag=d),a}function LNn(n){return n.startsWith("v")?n.slice(1):n}function Fot(n){return`${n.app} ${n.version} ${n.gitSha}`}function wx(n,a){try{let i=a();return typeof i=="string"&&i.length>0?i:void 0}catch{return process.env[n.replace(/^__|__$/g,"")]}}var Xot=`memory \u2014 governed operational memory for code agents
6566
+ ${Vot(a.usageCommand)}`),2}}function vot(n){let a={app:n,version:LNn(wx("__RED_BUILD_VERSION__",()=>"2.52.0")??"0.0.0-dev"),gitSha:wx("__RED_BUILD_GIT_SHA__",()=>"c81d861c9217cb6952df944a466aa611ea1e6b1f")??"unknown",buildTime:wx("__RED_BUILD_TIME__",()=>"2026-07-13T10:28:25-03:00")??"unknown",bundleAsset:wx("__RED_BUNDLE_ASSET__",()=>"memory.bundle.min.mjs")??"unknown"},i=wx("__REDDB_SDK_VERSION__",()=>"1.23.1"),d=wx("__REDDB_BINARY_TAG__",()=>"v1.23.1");return i&&(a.reddbSdkVersion=i),d&&(a.reddbBinaryTag=d),a}function LNn(n){return n.startsWith("v")?n.slice(1):n}function Fot(n){return`${n.app} ${n.version} ${n.gitSha}`}function wx(n,a){try{let i=a();return typeof i=="string"&&i.length>0?i:void 0}catch{return process.env[n.replace(/^__|__$/g,"")]}}var Xot=`memory \u2014 governed operational memory for code agents
6567
6567
 
6568
6568
  Common workflows:
6569
6569
  remember one fact memory store "Decision: ..."
@@ -80,7 +80,7 @@ ${n[n.length-1]}`,i=Buffer.from(r);return i.length<=t?r:i.subarray(0,t).toString
80
80
  `:""}`,truncated:o.length<i.length}}function Em(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n].trim(),s=/^(?:export\s+)?(?:default\s+)?(?:abstract\s+)?(class|interface|type)\s+([A-Za-z_$][\w$]*)/.exec(i);if(s){t.push({kind:s[1],name:s[2],line:n+1,signature:i});continue}let o=/^(?:export\s+)?(?:default\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\([^)]*\)\s*(?::[^{]+)?/.exec(i);if(o){t.push({kind:"function",name:o[1],line:n+1,signature:i});continue}let a=/^(?:public\s+|private\s+|protected\s+|static\s+|async\s+)*([A-Za-z_$][\w$]*)\s*\([^)]*\)\s*(?::[^{]+)?\s*\{/.exec(i);a&&!km(a[1])&&t.push({kind:"method",name:a[1],line:n+1,signature:i})}return t}function un(e){let t=e.split(`
81
81
  `);return t.at(-1)===""?t.slice(0,-1):t}function ma(e){return e.includes(0)||!dm(e)}function la(e){return gm.has(mm(e).toLowerCase())}function km(e){return["for","if","switch","while"].includes(e)}function ua(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function da(e,t){let n=Number(e);return Number.isInteger(n)&&n>0?n:t}var ca,jr,pm,ym,gm,Fr=k(()=>{"use strict";ke();Ie();ca=8*1024,jr=10,pm=8,ym=2,gm=new Set([".c",".cc",".cpp",".cs",".go",".java",".js",".jsx",".mjs",".py",".rs",".ts",".tsx"])});var dn={};A(dn,{parseExecCommandLine:()=>ga,renderExecContract:()=>ya,runExecWrapper:()=>$m});import{isUtf8 as Sm}from"node:buffer";import{spawn as vm}from"node:child_process";async function $m(e,t){let n=ga(e),r=await Am(n);return await ya(n,r,t)}async function ya(e,t,n){let r=Buffer.from(t.stdout,"binary"),i=Buffer.from(t.stderr,"binary");if(r.length===0)return{stdout:r,stderr:i,status:t.status,signal:t.signal,rawOutput:r};let s=Dm(r);if(s.kind==="text"){let d=await ut(s.text,{level:n.level,command:e,store:n.store?{mint:async(...m)=>await n.store.mint(...m)}:void 0});if(d.detected)return{stdout:Buffer.from(d.output),stderr:i,status:t.status,signal:t.signal,mintedHandle:d.handle,bytesElided:d.lossy?r.length:void 0,rawOutput:r}}let o=s.kind==="text"?Buffer.from(s.text):r,a=Bm(n.heavyByteThreshold,Tm);if(o.length<=a&&n.level!=="terse")return{stdout:o,stderr:i,status:t.status,signal:t.signal,rawOutput:r};let c=r.length,l=n.level==="lossless"?"terse":n.level,u=await n.store?.mint(r,{command:e,loss:{level:l,bytes_elided:c}});if(!u)throw new Error("rsp exec output elision requires an elision store");return{stdout:Buffer.from(Im(o,r.length,u,n.level)),stderr:i,status:t.status,signal:t.signal,mintedHandle:u,bytesElided:c,rawOutput:r}}function ga(e){if(e[0]!=="exec")throw new Error("expected rsp exec -- <command line>");let t=e.indexOf("--"),n=t>=0?e.slice(t+1):e.slice(1),r=n.length===1?n[0]:n.join(" ");if(!r.trim())throw new Error("usage: rsp exec -- <command line>");return r}async function Am(e){let t=vm(e,{shell:!0,stdio:["inherit","pipe","pipe"]}),n=[],r=[];return t.stdout.on("data",i=>n.push(i)),t.stderr.on("data",i=>r.push(i)),await new Promise((i,s)=>{t.on("error",s),t.on("close",(o,a)=>{i({stdout:Buffer.concat(n).toString("binary"),stderr:Buffer.concat(r).toString("binary"),status:o,signal:a})})})}function Dm(e){return Sm(e)?{kind:"text",text:Ve(e.toString("utf8"))}:{kind:"bytes"}}function Im(e,t,n,r){let s=Math.max(1,Math.floor((r==="terse"?Om:xm)/2)),o=pa(e.subarray(0,s)),a=pa(e.subarray(Math.max(0,e.length-s))),c=Pm(e),l=["stdout summary",`bytes: ${t}`,`lines: ${c}`,"head:",o];return a&&a!==o&&l.push("tail:",a),l.push(`\u2026 elided stdout (+${t}) \u2014 ${G(n)}`),`${l.join(`
82
82
  `)}
83
- `}function pa(e){return e.toString("utf8").replace(/�$/g,"")}function Pm(e){if(e.length===0)return 0;let t=0;for(let n of e)n===10&&t++;return e[e.length-1]===10?t:t+1}function Bm(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}var Tm,xm,Om,fn=k(()=>{"use strict";Ie();Gt();Tm=8*1024,xm=2*1024,Om=1024});ke();import{appendFileSync as ha,existsSync as Vr,mkdirSync as Nm,readdirSync as Lm}from"node:fs";import{dirname as Cm,join as Mm}from"node:path";function wi(e){let t={app:e,version:_c(Fe("__RED_BUILD_VERSION__",()=>"2.51.0")??"0.0.0-dev"),gitSha:Fe("__RED_BUILD_GIT_SHA__",()=>"58b9b3fd1adf312059aadc0af37ef5d7ee054d5a")??"unknown",buildTime:Fe("__RED_BUILD_TIME__",()=>"2026-07-13T10:07:10-03:00")??"unknown",bundleAsset:Fe("__RED_BUNDLE_ASSET__",()=>"rsp.bundle.min.mjs")??"unknown"},n=Fe("__REDDB_SDK_VERSION__",()=>"1.23.1"),r=Fe("__REDDB_BINARY_TAG__",()=>"v1.23.1");return n&&(t.reddbSdkVersion=n),r&&(t.reddbBinaryTag=r),t}function _c(e){return e.startsWith("v")?e.slice(1):e}function Fe(e,t){try{let n=t();return typeof n=="string"&&n.length>0?n:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}xn();async function jm(e=process.argv.slice(2)){let t=wi("rsp"),n=zm(e);if(n.command==="hook"&&n.positional[1]==="claude-pre-exec"){let{runClaudePreExecHook:f}=await Promise.resolve().then(()=>(jn(),Ki));return await f()}if(n.command==="hook"&&n.positional[1]==="claude-post-exec"){let{runClaudePostExecHook:f}=await Promise.resolve().then(()=>(Gt(),as));return await f()}if(n.command==="setup"){let{provisionRspRepoStore:f}=await Promise.resolve().then(()=>(Ks(),Ws)),p=await f(process.cwd());return process.stdout.write(sp(p)),0}if(n.command==="mcp"){let{runRspMcpServer:f}=await Promise.resolve().then(()=>(to(),eo));return await f(),0}if(n.command==="shell-init"){let f=n.positional[1];if(f!=="fish"&&f!=="bash"&&f!=="zsh")return process.stdout.write(`error: usage rsp shell-init fish|bash|zsh
83
+ `}function pa(e){return e.toString("utf8").replace(/�$/g,"")}function Pm(e){if(e.length===0)return 0;let t=0;for(let n of e)n===10&&t++;return e[e.length-1]===10?t:t+1}function Bm(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}var Tm,xm,Om,fn=k(()=>{"use strict";Ie();Gt();Tm=8*1024,xm=2*1024,Om=1024});ke();import{appendFileSync as ha,existsSync as Vr,mkdirSync as Nm,readdirSync as Lm}from"node:fs";import{dirname as Cm,join as Mm}from"node:path";function wi(e){let t={app:e,version:_c(Fe("__RED_BUILD_VERSION__",()=>"2.52.0")??"0.0.0-dev"),gitSha:Fe("__RED_BUILD_GIT_SHA__",()=>"c81d861c9217cb6952df944a466aa611ea1e6b1f")??"unknown",buildTime:Fe("__RED_BUILD_TIME__",()=>"2026-07-13T10:28:25-03:00")??"unknown",bundleAsset:Fe("__RED_BUNDLE_ASSET__",()=>"rsp.bundle.min.mjs")??"unknown"},n=Fe("__REDDB_SDK_VERSION__",()=>"1.23.1"),r=Fe("__REDDB_BINARY_TAG__",()=>"v1.23.1");return n&&(t.reddbSdkVersion=n),r&&(t.reddbBinaryTag=r),t}function _c(e){return e.startsWith("v")?e.slice(1):e}function Fe(e,t){try{let n=t();return typeof n=="string"&&n.length>0?n:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}xn();async function jm(e=process.argv.slice(2)){let t=wi("rsp"),n=zm(e);if(n.command==="hook"&&n.positional[1]==="claude-pre-exec"){let{runClaudePreExecHook:f}=await Promise.resolve().then(()=>(jn(),Ki));return await f()}if(n.command==="hook"&&n.positional[1]==="claude-post-exec"){let{runClaudePostExecHook:f}=await Promise.resolve().then(()=>(Gt(),as));return await f()}if(n.command==="setup"){let{provisionRspRepoStore:f}=await Promise.resolve().then(()=>(Ks(),Ws)),p=await f(process.cwd());return process.stdout.write(sp(p)),0}if(n.command==="mcp"){let{runRspMcpServer:f}=await Promise.resolve().then(()=>(to(),eo));return await f(),0}if(n.command==="shell-init"){let f=n.positional[1];if(f!=="fish"&&f!=="bash"&&f!=="zsh")return process.stdout.write(`error: usage rsp shell-init fish|bash|zsh
84
84
  `),2;let{renderShellInit:p}=await Promise.resolve().then(()=>(io(),ro));return process.stdout.write(p(f)),0}let{resolveRspConfig:r}=await Promise.resolve().then(()=>(V(),Ci)),i=r(process.cwd(),process.env,n.storeUri),s=Wm(n.command);if(!i.enabled)return s?await Hm(n.positional):(process.stdout.write(`${Yr()}
85
85
  `),0);let o=n.command==="git"&&Hr(n.positional)?await Um(process.cwd()):null;if(o){let f=process.hrtime.bigint();return await C(n,await Wr(),f,void 0,o.rootDir)}let{resolveResidentPaths:a,ResidentRspElisionStore:c,ensureResidentServer:l}=await Promise.resolve().then(()=>(Je(),Ut));if(n.command==="server"){let{runResidentServer:f}=await Promise.resolve().then(()=>(Go(),Uo)),p=be(n.positional,"--socket")??a(process.cwd()).socketPath,_=r(process.cwd(),process.env,n.storeUri??be(n.positional,"--store-uri"));return _.enabled?(await f({socketPath:p,storeUri:_.storeUri,ttlDays:N(n.positional,"--ttl-days")??_.ttlDays,byteBudget:N(n.positional,"--byte-budget")??_.byteBudget,telemetryTtlDays:N(n.positional,"--telemetry-ttl-days")??_.telemetryTtlDays,telemetryByteBudget:N(n.positional,"--telemetry-byte-budget")??_.telemetryByteBudget,telemetryDrainIntervalMs:N(n.positional,"--telemetry-drain-interval-ms")??_.telemetryDrainIntervalMs,telemetryDrainTimeoutMs:N(n.positional,"--telemetry-drain-timeout-ms")??_.telemetryDrainTimeoutMs,idleMs:N(n.positional,"--idle-ms")??_.idleMs,residentVersion:be(n.positional,"--resident-version")??t.version}),0):(process.stdout.write(`${Yr()}
86
86
  `),0)}if(n.command==="warm-resident"){let f=a(process.cwd()),p=be(n.positional,"--socket")??f.socketPath,_=be(n.positional,"--wake-lock")??f.wakeLockPath,E=r(process.cwd(),process.env,n.storeUri??be(n.positional,"--store-uri"));if(!E.enabled)return 0;let{warmResidentServer:h}=await Promise.resolve().then(()=>(Je(),Ut));return await h({...f,socketPath:p,wakeLockPath:_},{storeUri:E.storeUri,ttlDays:N(n.positional,"--ttl-days")??E.ttlDays,byteBudget:N(n.positional,"--byte-budget")??E.byteBudget,telemetryTtlDays:N(n.positional,"--telemetry-ttl-days")??E.telemetryTtlDays,telemetryByteBudget:N(n.positional,"--telemetry-byte-budget")??E.telemetryByteBudget,telemetryDrainIntervalMs:N(n.positional,"--telemetry-drain-interval-ms")??E.telemetryDrainIntervalMs,telemetryDrainTimeoutMs:N(n.positional,"--telemetry-drain-timeout-ms")??E.telemetryDrainTimeoutMs,idleMs:N(n.positional,"--idle-ms")??E.idleMs,clientVersion:t.version}),0}let{existsSync:u}=await import("node:fs"),{fileURLToPath:d}=await import("node:url"),m=a(process.cwd());if(!n.storeUri&&i.storeUri.startsWith("file://")&&!u(d(i.storeUri)))return s?await nt(n,i,m.rootDir):(process.stdout.write(`error: rsp repo store is not provisioned - run /red-setup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddb-io/red-skills",
3
- "version": "2.51.0",
3
+ "version": "2.52.0",
4
4
  "description": "RedSkills plugin runtime bundles (dev, code-nav, memory, brain) distributed over npm — the v2 client transport (ADR 0091). Carries the platform-independent JS bundles inside the tarball plus thin bin shims; no postinstall download.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",