typebulb 0.31.2 → 0.31.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.
@@ -2280,7 +2280,7 @@ var Patcher = class {
2280
2280
 
2281
2281
  // cli/agents/pi/server/piPatcherExtension.ts
2282
2282
  var DESCRIPTION = true ? "Apply unified diffs to files \u2014 tolerant of form, strict about intent. Repairs sloppy AI-generated diffs (mangled headers, whitespace drift, missing prefixes; line numbers can be wrong or absent \u2014 hunks anchor by fuzzy-matched context lines) and applies all hunks atomically when the intent is unambiguous; fails with a precise, typed error when it isn't. Use for multi-hunk edits in one step, or when exact string-replacement editing fails on whitespace or invisible characters." : "Apply unified diffs to files.";
2283
- var BUILD_TAG = true ? "matchu-patchu-pi 0.3.1, built 2026-07-19 06:41:31" : "matchu-patchu-pi dev";
2283
+ var BUILD_TAG = true ? "matchu-patchu-pi 0.3.1, built 2026-07-19 07:17:56" : "matchu-patchu-pi dev";
2284
2284
  var errorBlocks = (errors) => {
2285
2285
  const parts = [`Patch failed with ${errors.length} error(s):`];
2286
2286
  for (const e of errors) parts.push("", e.toString());
package/dist/index.js CHANGED
@@ -1600,7 +1600,7 @@ declare const tb: {${Sg}${Eg}${Ag}${xg}${kg}
1600
1600
  `);await this.prefetchBareDeps(y,l,d,p,s);let m=c.format(),b=e===m?[e]:[e,m],x=b.some(k=>this.ambientlyDeclares(i,k));return x?this.markFileAmbient(d,f):p.push(...b.map(k=>({module:k,path:f}))),{pkg:e,mainPath:f,files:d,shims:p,ambient:x}}};import*as Ir from"path";var TT=Ir.join(ti,"pkg"),PT=Ir.join(ti,"files"),OT=Ir.join(ti,"negative.json"),So=class{pkgMem=new Map;fileMem=new Map;negativeCache=new It(new dr(OT));async getCachedDts(e){if(this.pkgMem.has(e))return this.pkgMem.get(e);await V();let t=await Je(Cg(e));return this.pkgMem.set(e,t),t}async setCachedDts(e,t,n){let s={content:t,url:n};this.pkgMem.set(e,s),await vo(async()=>{await V(),await me(Cg(e),JSON.stringify(s))})}async getCachedFile(e){if(this.fileMem.has(e))return this.fileMem.get(e);await V();let t=await ei(Rg(e));return this.fileMem.set(e,t),t}async setCachedFile(e,t){this.fileMem.set(e,t),await vo(async()=>{await V(),await me(Rg(e),t)})}isNegative(e){return this.negativeCache.isNegative(e)}async recordNegative(e){await vo(async()=>{await V(),await this.negativeCache.recordNegative(e)})}clearNegative(e){return vo(()=>this.negativeCache.clearNegative(e))}};async function vo(r){try{await r()}catch{}}function Cg(r){return Ir.join(TT,ve(r)+".json")}function Rg(r){return Ir.join(PT,ve(r)+".txt")}var Wl;function _T(){return Wl||(Wl=new qn({cache:new So,cdnClient:Gp,packageService:ii,versionResolver:Vp})),Wl}var Ng="file:///node_modules/";async function Ig(r){let e=ri(r.emitKey,"typecheck");await V(),await oe.rm(e,{recursive:!0,force:!0}),await oe.mkdir(e,{recursive:!0});let t=IT(r.jsxImportSource,r.dependencies),n=await _T().resolve(r.code,r.dependencies,t),s=r.local?.name,i=s?n.filter(f=>f.pkg!==s):n,o=new Set;for(let f of i)for(let u of f.files){let d=xo(u.path);if(!d||o.has(d))continue;o.add(d);let p=ne.join(e,"node_modules",d);await oe.mkdir(ne.dirname(p),{recursive:!0}),await oe.writeFile(p,u.content,"utf8")}let a={};for(let f of i)for(let u of f.shims){let d=xo(u.path);d&&(a[u.module]=[`./node_modules/${d}`])}for(let f of i){if(f.ambient)continue;let u=xo(f.mainPath);u&&(a[f.pkg]=[`./node_modules/${u}`])}let c=new Set;for(let f of i)for(let u of f.files){if(!u.ambient)continue;let d=xo(u.path);d&&c.add(`node_modules/${d}`)}if(r.local){delete a[r.local.name];let f=await $T(r.local,e);f?a[r.local.name]=[`./node_modules/${r.local.name}/${f}`]:console.warn(` local: '${r.local.name}' ships no type defs; check cannot type against it.`)}let l=CT(r.jsxImportSource,a,[...c]);return await oe.writeFile(ne.join(e,"tsconfig.json"),JSON.stringify(l,null,2)+`
1601
1601
  `,"utf8"),await oe.writeFile(ne.join(e,"code.tsx"),r.code,"utf8"),await oe.writeFile(ne.join(e,"tb.d.ts"),Jl,"utf8"),{dir:e}}var Yl={target:"es2023",module:"esnext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,forceConsistentCasingInFileNames:!0};function CT(r,e,t=[]){return{compilerOptions:{...Yl,lib:RT([...Fl,...ql]),jsx:"react-jsx",jsxImportSource:r??"react",paths:e},include:["code.tsx","tb.d.ts",...t]}}function RT(r){return Ul(r).map(e=>NT(e.name))}function NT(r){return r.split(".").map(e=>/^es\d+$/i.test(e)?e.toUpperCase():e==="dom"?"DOM":e==="esnext"?"ESNext":e.charAt(0).toUpperCase()+e.slice(1)).join(".")}function IT(r,e){let t=r??("react"in e?"react":void 0);return t?[`${t}/jsx-runtime`,`${t}/jsx-dev-runtime`]:[]}function xo(r){if(!r.startsWith(Ng))return;let e=r.slice(Ng.length),t=e.indexOf("/");if(!(t<0))return e.slice(t+1)}async function $T(r,e){if(!r.typesAbs)return;let t=ne.dirname(r.typesAbs),n=ne.join(e,"node_modules",r.name);for(let s of await LT(t)){let i=ne.join(n,ne.relative(t,s));await oe.mkdir(ne.dirname(i),{recursive:!0}),await oe.copyFile(s,i)}return ne.basename(r.typesAbs)}async function LT(r){let e=[];async function t(n){let s=await oe.readdir(n,{withFileTypes:!0});for(let i of s){let o=ne.join(n,i.name);i.isDirectory()?await t(o):/\.d\.ts(\.map)?$/.test(i.name)&&e.push(o)}}return await t(r),e}import*as ye from"fs/promises";import*as Xe from"path";import{existsSync as MT}from"fs";var DT="^22";async function $g(r){let e=ri(r.emitKey,"typecheck-server");await V(),await ye.rm(e,{recursive:!0,force:!0}),await ye.mkdir(e,{recursive:!0});let t=Xe.join(r.bulbDir,".typebulb"),n=fi(r.server).filter(o=>o!==r.local?.name);await di([`@types/node@${DT}`,...n],t,r.dependencies,{ignoreScripts:!0});let s=Xe.join(t,"node_modules"),i=Xe.join(e,"node_modules");return await jT(s,i),await ye.writeFile(Xe.join(e,"server.ts"),r.server,"utf8"),await ye.writeFile(Xe.join(e,"tb.d.ts"),Kl,"utf8"),await ye.writeFile(Xe.join(e,"tsconfig.json"),JSON.stringify(BT(r.local),null,2)+`
1602
1602
  `,"utf8"),{dir:e}}function BT(r){let e={...Yl,lib:["ES2023"],types:["node"]};if(r?.typesAbs){let t=i=>i.replace(/\\/g,"/"),n=t(Xe.dirname(r.typesAbs)),s=t(r.typesAbs).replace(/\.d\.ts$/,"");e.paths={[r.name]:[s],[`${r.name}/*`]:[`${n}/*`]}}return{compilerOptions:e,include:["server.ts","tb.d.ts"]}}async function jT(r,e){if(!MT(r)){await ye.mkdir(e,{recursive:!0});return}await ye.rm(e,{recursive:!0,force:!0});let t=process.platform==="win32"?"junction":"dir";await ye.symlink(r,e,t)}Qs();async function Mg(r,e){let{bulb:t,config:n,warnings:s}=await ke(r);!t.code&&!t.server&&(console.error("Bulb has neither **code.tsx** nor **server.ts**; nothing to check."),process.exit(1));let i=!1;for(let l of s)console.log(`structure ${l}`);s.length&&(i=!0),t.code&&(i=Lg(yn(t.code,{target:"client",dependencies:n.dependencies??{}}),"client")||i),t.server&&(i=Lg(yn(t.server,{target:"server"}),"server")||i);let o=WT([process.cwd(),xt.dirname(r)]);if(!o){let l=xt.relative(process.cwd(),r)||r;console.error("check: TypeScript not found \u2014 install it once, then re-run:"),console.error(" npm i -g typescript"),console.error(` typebulb check ${l}`),process.exit(2)}let a=[];if(t.code){let{dir:l}=await Ig({code:t.code,dependencies:n.dependencies??{},jsxImportSource:n.ts?.jsxImportSource,emitKey:r,local:e});a.push({role:"client",dir:l})}if(t.server){let{dir:l}=await $g({server:t.server,bulbDir:xt.dirname(r),emitKey:r,local:e?{name:e.name,typesAbs:e.typesAbs}:void 0,dependencies:n.dependencies});a.push({role:"server",dir:l})}for(let{role:l,dir:f}of a){let{stdout:u,exitCode:d}=await KT(o,f);for(let p of u.split(/\r?\n/))p.trim()&&console.log(`${l} ${p}`);d!==0&&(i=!0)}i&&process.exit(1);let c=[t.code&&"code.tsx",t.server&&"server.ts"].filter(Boolean).join(", ");console.error(`\u2713 no issues (${c})`)}function Lg(r,e){for(let t of r)for(let n of t.message.split(`
1603
- `))console.log(`${e} ${n}`);return r.length>0}function KT(r,e){return new Promise(t=>{let n=FT(process.execPath,[r,"--noEmit"],{cwd:e}),s="";n.stdout?.on("data",i=>{s+=i.toString()}),n.stderr?.on("data",i=>{s+=i.toString()}),n.on("close",i=>t({stdout:s,exitCode:i??1}))})}var HT=UT(import.meta.url);function WT(r){let e=n=>{try{let s=HT.resolve("typescript/package.json",{paths:n}),i=xt.join(xt.dirname(s),"lib","tsc.js");return JT(i)?i:void 0}catch{return}},t=e(r);if(t)return t;try{let n=qT("npm root -g",{encoding:"utf8"}).trim();return e([n])}catch{return}}Bi();Cn();async function Dg(r,e){let{bulb:t}=await ke(r),n=kr(t);if(jt(r)){console.log("remembered-trusted \u2014 runs with filesystem / AI / server.ts automatically (`typebulb untrust` to revoke)."),n&&console.log(` (it uses ${n})`);return}n?(console.log(`This bulb appears to use ${n}; it runs Restricted unless you grant trust:`),console.log(` ${e}`)):console.log("No privileged capability detected \u2014 runs Restricted by default. (A clean scan is a hint, not a guarantee.)")}Cn();import*as Un from"path";async function Bg(r,e){if(!r){e||(console.error("Usage: typebulb untrust <file.bulb.md>"),process.exit(1));let n=Xc();if(!n.length){console.log("No bulbs are remembered as trusted.");return}console.log("Trusted bulbs (run with fs/AI/server.ts without --trust):");for(let s of n)console.log(` ${s}`);return}let t=Un.resolve(r);t.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1)),wr(t,e),console.log(e?`Trusted ${Un.basename(t)} \u2014 runs with fs / AI / server.ts (no --trust needed).`:`Untrusted ${Un.basename(t)} \u2014 runs Restricted.`),console.log(` ${t}`)}Ne();import*as Ug from"readline";var Jn=yg();function jg(){for(let r of Object.values(Jn))try{r().ensureHarnessSupport()}catch{}}function Kn(){for(let r of Object.keys(Jn))try{if(Jn[r]().detectsSelf())return r}catch{}}function Fg(r){let e=Rr(),t=new Map(e.filter(i=>Jn[i]).map(i=>[i,Jn[i]()]));for(let[i,o]of t)if(o.detectsSelf())return{name:i};let n=[...t].filter(([,i])=>i.detectsInstalled()).map(([i])=>i);if(n.length===0)return{name:e[0]};if(n.length===1)return{name:n[0]};let s=i=>t.get(i).listSessionFiles(r).length>0;return{ambiguous:[...n].sort((i,o)=>Number(s(o))-Number(s(i)))}}ji();function Vl(r){let e=t=>n=>r?`\x1B[${t}m${n}\x1B[0m`:n;return{lit:e("38;5;70"),litLink:e("4;38;5;70"),brand:e("38;5;135")}}async function Jg(r){let e=Fg(process.cwd());if("ambiguous"in e){let t=await YT(r,e.ambiguous);return t?qg(r,t):VT(r,e.ambiguous)}return qg(r,e.name)}async function qg(r,e){let t,n;try{t=await Cm(e)}catch(f){n=f instanceof Error?f.message:String(f)}let{lit:s,litLink:i,brand:o}=Vl(process.stdout.isTTY===!0),a=[" Read the authoring skill before writing a bulb:",` \u2022 ${s("npx typebulb skill")} \u2014 assembles one SKILL.md`," \u2022 or, open its parts:",` ${s(Er())}`,` ${s(Ut())}`],c=t?[" Agent mirror is live\u{1F4A1}",` ${s("\u25CF")} ${i(t.url)}`," Embedded bulbs render live here."," Agents:",` Reusable app/tool \u2192 write a ${s(".bulb.md")}`," Show something inline \u2192 embed a bulb",e==="pi"?" arm a wait for its render verdict \u2014 run it plainly:":" background a wait for its render verdict:",` \u2022 ${s('typebulb wait agent --match "[embed <name>"')}`,...a," End your reply with the mirror link above"," \u2022 easy to miss the link mid-message"]:[` The mirror did not start (${n})`,` \u25CF Start it manually: ${s(`npx typebulb agent:${e}`)}`," Agents:",...a],l=[` ${o(`typebulb v${r}`)}`,...c,""];process.stdout.write(l.join(`
1603
+ `))console.log(`${e} ${n}`);return r.length>0}function KT(r,e){return new Promise(t=>{let n=FT(process.execPath,[r,"--noEmit"],{cwd:e}),s="";n.stdout?.on("data",i=>{s+=i.toString()}),n.stderr?.on("data",i=>{s+=i.toString()}),n.on("close",i=>t({stdout:s,exitCode:i??1}))})}var HT=UT(import.meta.url);function WT(r){let e=n=>{try{let s=HT.resolve("typescript/package.json",{paths:n}),i=xt.join(xt.dirname(s),"lib","tsc.js");return JT(i)?i:void 0}catch{return}},t=e(r);if(t)return t;try{let n=qT("npm root -g",{encoding:"utf8"}).trim();return e([n])}catch{return}}Bi();Cn();async function Dg(r,e){let{bulb:t}=await ke(r),n=kr(t);if(jt(r)){console.log("remembered-trusted \u2014 runs with filesystem / AI / server.ts automatically (`typebulb untrust` to revoke)."),n&&console.log(` (it uses ${n})`);return}n?(console.log(`This bulb appears to use ${n}; it runs Restricted unless you grant trust:`),console.log(` ${e}`)):console.log("No privileged capability detected \u2014 runs Restricted by default. (A clean scan is a hint, not a guarantee.)")}Cn();import*as Un from"path";async function Bg(r,e){if(!r){e||(console.error("Usage: typebulb untrust <file.bulb.md>"),process.exit(1));let n=Xc();if(!n.length){console.log("No bulbs are remembered as trusted.");return}console.log("Trusted bulbs (run with fs/AI/server.ts without --trust):");for(let s of n)console.log(` ${s}`);return}let t=Un.resolve(r);t.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1)),wr(t,e),console.log(e?`Trusted ${Un.basename(t)} \u2014 runs with fs / AI / server.ts (no --trust needed).`:`Untrusted ${Un.basename(t)} \u2014 runs Restricted.`),console.log(` ${t}`)}Ne();import*as Ug from"readline";var Jn=yg();function jg(){for(let r of Object.values(Jn))try{r().ensureHarnessSupport()}catch{}}function Kn(){for(let r of Object.keys(Jn))try{if(Jn[r]().detectsSelf())return r}catch{}}function Fg(r){let e=Rr(),t=new Map(e.filter(i=>Jn[i]).map(i=>[i,Jn[i]()]));for(let[i,o]of t)if(o.detectsSelf())return{name:i};let n=[...t].filter(([,i])=>i.detectsInstalled()).map(([i])=>i);if(n.length===0)return{name:e[0]};if(n.length===1)return{name:n[0]};let s=i=>t.get(i).listSessionFiles(r).length>0;return{ambiguous:[...n].sort((i,o)=>Number(s(o))-Number(s(i)))}}ji();function Vl(r){let e=t=>n=>r?`\x1B[${t}m${n}\x1B[0m`:n;return{lit:e("38;5;70"),litLink:e("4;38;5;70"),brand:e("38;5;135")}}async function Jg(r){let e=Fg(process.cwd());if("ambiguous"in e){let t=await YT(r,e.ambiguous);return t?qg(r,t):VT(r,e.ambiguous)}return qg(r,e.name)}async function qg(r,e){let t,n;try{t=await Cm(e)}catch(f){n=f instanceof Error?f.message:String(f)}let{lit:s,litLink:i,brand:o}=Vl(process.stdout.isTTY===!0),a=[" Read the authoring skill before writing a bulb:",` \u2022 ${s("npx typebulb skill")} \u2014 assembles one SKILL.md`," \u2022 or, open its parts:",` ${s(Er())}`,` ${s(Ut())}`],c=t?[` Agent mirror (${e}) is live\u{1F4A1}`,` ${s("\u25CF")} ${i(t.url)}`," Embedded bulbs render live here."," Agents:",` Reusable app/tool \u2192 write a ${s(".bulb.md")}`," Show something inline \u2192 embed a bulb",e==="pi"?" arm a wait for its render verdict \u2014 run it plainly:":" background a wait for its render verdict:",` \u2022 ${s('typebulb wait agent --match "[embed <name>"')}`,...a," End your reply with the mirror link above"," \u2022 easy to miss the link mid-message"]:[` The mirror did not start (${n})`,` \u25CF Start it manually: ${s(`npx typebulb agent:${e}`)}`," Agents:",...a],l=[` ${o(`typebulb v${r}`)}`,...c,""];process.stdout.write(l.join(`
1604
1604
  `)+`
1605
1605
  `)}async function YT(r,e){if(!process.stdin.isTTY||!process.stdout.isTTY)return;let{lit:t,brand:n}=Vl(!0),s=[` ${n(`typebulb v${r}`)}`," More than one agent harness is available here.",...e.map((o,a)=>` ${t(String(a+1))}) ${o}`),""];process.stdout.write(s.join(`
1606
1606
  `)+`
@@ -1993,5 +1993,5 @@ ${pP}
1993
1993
  `);let c=0,l=Promise.resolve();Vt({target:r,onChange:()=>{let f=++c;l=l.then(async()=>{if(f===c)try{console.log("Re-running..."),await a()}catch(u){console.error("Error:",u)}})}})}}yt();import{Console as bP}from"node:console";Ne();async function wy(r,e,t,n,s){kP();try{let p=xr(await z(),r)[0];p&&(Ii(p.pid,Re(p.pid).offset),console.error(`note: 'call' boots a fresh server.ts instance; the running server (${p.url}) is not contacted \u2014 state shared with it must live on disk.`))}catch{}let i=ge(t),{bulb:o,config:a}=await ke(r);o.server||Vn("This bulb has no **server.ts** block; nothing to call."),gt(i,r,o.server);let c;try{c=await _n(o.server,r,n,a.dependencies,s)}catch(p){Vn(p instanceof Error?p.message:String(p))}let l=To(c,e.fn);if(!l){let p=[...Object.keys(c).filter(y=>typeof c[y]=="function"),...Object.keys(Ao)];Vn(`Function '${e.fn}' not found. Available: ${p.length?p.join(", "):"(none)"}.`)}let f=await wP(e);if(Po(l)){try{for await(let p of l(...f))await by(JSON.stringify(p,vy)+`
1994
1994
  `)}catch(p){Vn(p instanceof Error?p.stack??p.message:String(p))}return yy(0)}let u;try{u=await l(...f)}catch(p){Vn(p instanceof Error?p.stack??p.message:String(p))}let d=xP(u);d!==void 0&&await by(d+`
1995
1995
  `),yy(0)}function yy(r){process.exitCode=r,setTimeout(()=>process.exit(r),2e3).unref?.()}async function wP(r){if(r.hasArgsFlag){let e=r.argsJson??"";return e==="-"&&(e=await EP()),SP(e)}return vP(r.positional)}function vP(r){return r.map(e=>{try{return JSON.parse(e)}catch{return e}})}function SP(r){let e;try{e=JSON.parse(r)}catch(t){throw new Error(`--args must be a JSON array: ${t instanceof Error?t.message:String(t)}`)}if(!Array.isArray(e))throw new Error(`--args must be a JSON array, got ${e===null?"null":typeof e}`);return e}function xP(r){if(r!==void 0)return JSON.stringify(r,vy,2)}function vy(r,e){return typeof e=="bigint"?e.toString():e}function Vn(r){process.stderr.write(r+`
1996
- `),process.exit(1)}function kP(){let r=new bP(process.stderr,process.stderr);console.log=r.log.bind(r),console.info=r.info.bind(r),console.debug=r.debug.bind(r),console.dir=r.dir.bind(r)}function by(r){return new Promise((e,t)=>{process.stdout.write(r,n=>n?t(n):e())})}async function EP(){let r=[];for await(let e of process.stdin)r.push(e);return Buffer.concat(r).toString("utf-8")}var ru="0.31.2";function Sy(r,e){r||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
1996
+ `),process.exit(1)}function kP(){let r=new bP(process.stderr,process.stderr);console.log=r.log.bind(r),console.info=r.info.bind(r),console.debug=r.debug.bind(r),console.dir=r.dir.bind(r)}function by(r){return new Promise((e,t)=>{process.stdout.write(r,n=>n?t(n):e())})}async function EP(){let r=[];for await(let e of process.stdin)r.push(e);return Buffer.concat(r).toString("utf-8")}var ru="0.31.3";function Sy(r,e){r||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
1997
1997
  ${e}`),process.exit(1))}async function AP(){let r=bu(process.argv.slice(2));if(r.version&&(console.log(`typebulb ${ru}`),process.exit(0)),r.help&&(wu(),process.exit(0)),jg(),r.subcommand==="logs"){await Gg(r.file||void 0,{follow:r.follow,clear:r.clear,run:r.run,lines:r.lines});return}if(r.subcommand==="wait"){await zg(r.file||void 0,{match:r.match,timeoutSec:r.timeoutSec});return}if(r.subcommand==="stop"){r.stopScope?await Qg(r.stopScope):await Xg(r.file||void 0);return}if(r.subcommand==="send"){await ey(r.file,r.sendMessage,r.sendWaitMs??0);return}if(r.subcommand==="skill"){await Wg(ru);return}if(r.subcommand==="models"){await Kg(r.mode);return}if(r.subcommand==="pull"){await Jm(r.file||void 0,{force:r.force,mode:r.mode});return}if(r.subcommand==="push"){await Wm(r.file||void 0,{force:r.force,mode:r.mode});return}if(r.subcommand==="agent"){await(r.agentTarget?my(r):Jg(ru));return}if(r.subcommand==="trust"||r.subcommand==="untrust"){await Bg(r.file||void 0,r.subcommand==="trust");return}let e;if(!r.file||r.file==="."){let c=await dm(process.cwd());c||(console.error("No .bulb.md file found in current directory"),process.exit(1)),e=c}else e=Gt.resolve(r.file);await xy.access(e).then(()=>!0,()=>!1)||(Rr().includes(r.file)&&(console.error(`To open the ${r.file} agent mirror, run: npx typebulb agent:${r.file}`),process.exit(1)),console.error(`File not found: ${e}`),process.exit(1)),e.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1));let n=r.file&&r.file!=="."?r.file:Gt.relative(process.cwd(),e)||Gt.basename(e),s=`npx typebulb --trust ${n.includes(" ")?`"${n}"`:n}`;if(r.subcommand==="predict"){await Dg(e,s);return}let i=!r.noTrust&&jt(e);i&&!r.trust&&console.error("trust: granted from memory (run `typebulb untrust` to revoke)"),r.trust=r.noTrust?!1:r.trust||i;let o;try{o=await ke(e)}catch{}let a;if(r.local){o&&!(r.local.name in(o.config.dependencies??{}))&&(console.error(`--replace: '${r.local.name}' is not a dependency in this bulb's config.json; nothing to replace.`),process.exit(1)),o&&r.subcommand!=="call"&&(!o.bulb.code||r.server)&&console.warn("warning: --replace has no effect in server mode (the override is client-only).");try{a=await hu(r.local)}catch(c){console.error(c instanceof Error?c.message:String(c)),process.exit(1)}console.error(`replace: ${a.name} \u2192 ${Gt.relative(process.cwd(),a.dir)||"."}`)}if(r.subcommand==="check"){await Mg(e,a);return}if(r.subcommand==="call"){Sy(r.trust,s),await wy(e,{fn:r.fn,positional:r.callArgs,argsJson:r.argsJson,hasArgsFlag:r.hasArgsFlag},r.mode,a,r.dir);return}if(o&&o.bulb.server&&(Xs(o.bulb)||r.server)){Sy(r.trust,s),await gy(e,r.watch,r.mode,a,r.dir);return}await uy(e,r,s,a)}AP().catch(r=>{console.error("Error:",r.message),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typebulb",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "description": "Typebulb CLI to run single-file markdown apps called bulbs, either as standalone web apps or embedded in agent responses.",
5
5
  "license": "MIT",
6
6
  "repository": {