typebulb 0.11.9 → 0.12.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -735,6 +735,6 @@ ${Zi}
735
735
  `);async function w(){await(await import("esbuild")).build({entryPoints:[O.join(c,"client","index.ts")],bundle:!0,platform:"browser",format:"esm",outfile:O.join(a,"client.js")});for(let T of["styles.css","index.html"])qa(O.join(c,T),O.join(a,T))}let D;if(r.watch&&n){let E=Ga(c),T=!1;D=Jt({dir:E?c:a,onChange:async()=>{if(!T){T=!0;try{E&&await w(),console.log(`Viewer rebuilt. Browser reloading...
736
736
  `),n.emit("reload")}catch(p){console.error("Viewer rebuild failed:",p instanceof Error?p.message:p)}finally{T=!1}}}})}r.open&&await Pe(h);let M=async()=>{console.log(`
737
737
  Shutting down...`),m.close(),D?.(),t(),await et(process.pid),process.exit(0)};process.on("SIGINT",M),process.on("SIGTERM",M)}import*as eo from"path";import{EventEmitter as Xa}from"events";async function to(r,e,t,n,s){let o=ne(t),i=!1,a=async()=>{let{bulb:c,config:l}=await G(r);i||(Ae(o,r,c.server),i=!0),await fr(c.server,s,n,l.dependencies)};if(console.log(`Running ${eo.basename(r)}...`),await a(),e){console.log(`Watching for changes...
738
- `);let c=new Xa;c.on("reload",async()=>{try{console.log("Re-running..."),await a()}catch(l){console.error("Error:",l)}}),Wt({bulbPath:r,emitter:c})}}var ro="0.11.9";async function Qa(){let r=Zr(process.argv.slice(2));if(r.version&&(console.log(`typebulb ${ro}`),process.exit(0)),r.help&&(en(),process.exit(0)),r.subcommand==="logs"){await us(r.file||void 0,{follow:r.follow,lines:r.lines});return}if(r.subcommand==="stop"){r.stopScope?await fs(r.stopScope):await ps(r.file||void 0);return}if(r.subcommand==="skill"){await as(ro);return}if(r.subcommand==="models"){await os(r.mode);return}if(r.subcommand==="agent"){if(!r.agentTarget){await ts();return}Bn(r.agentTarget)||(console.error(`Unknown agent '${r.agentTarget}'. Known: ${yr().join(", ")}.`),process.exit(1));let l=await Sr(process.cwd(),r.agentTarget);if(l){console.log(`Viewer '${r.agentTarget}' is already running for this project:
738
+ `);let c=new Xa;c.on("reload",async()=>{try{console.log("Re-running..."),await a()}catch(l){console.error("Error:",l)}}),Wt({bulbPath:r,emitter:c})}}var ro="0.12.0";async function Qa(){let r=Zr(process.argv.slice(2));if(r.version&&(console.log(`typebulb ${ro}`),process.exit(0)),r.help&&(en(),process.exit(0)),r.subcommand==="logs"){await us(r.file||void 0,{follow:r.follow,lines:r.lines});return}if(r.subcommand==="stop"){r.stopScope?await fs(r.stopScope):await ps(r.file||void 0);return}if(r.subcommand==="skill"){await as(ro);return}if(r.subcommand==="models"){await os(r.mode);return}if(r.subcommand==="agent"){if(!r.agentTarget){await ts();return}Bn(r.agentTarget)||(console.error(`Unknown agent '${r.agentTarget}'. Known: ${yr().join(", ")}.`),process.exit(1));let l=await Sr(process.cwd(),r.agentTarget);if(l){console.log(`Viewer '${r.agentTarget}' is already running for this project:
739
739
  ${l.url}`),r.open&&await Pe(l.url);return}await Zs(r);return}if(r.subcommand==="trust"||r.subcommand==="untrust"){await Vn(r.file||void 0,r.subcommand==="trust");return}let e;if(!r.file||r.file==="."){let l=await In(process.cwd());l||(console.error("No .bulb.md file found in current directory"),process.exit(1)),e=l}else e=X.resolve(r.file);await no.access(e).then(()=>!0,()=>!1)||(yr().includes(r.file)&&(console.error(`To open the ${r.file} agent viewer, 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:X.relative(process.cwd(),e)||X.basename(e),s=`npx typebulb --trust ${n.includes(" ")?`"${n}"`:n}`;if(r.subcommand==="predict"){await Hn(e,s);return}let o=!r.noTrust&&le(e);o&&!r.trust&&console.log("trust: granted from memory (run `typebulb untrust` to revoke)"),r.trust=r.noTrust?!1:r.trust||o;let i;try{i=await G(e)}catch{}let a;if(r.local){i&&!(r.local.name in(i.config.dependencies??{}))&&(console.error(`--replace: '${r.local.name}' is not a dependency in this bulb's config.json; nothing to replace.`),process.exit(1)),i&&(!i.bulb.code||r.server)&&console.warn("warning: --replace has no effect in server mode (the override is client-only).");try{a=await Xr(r.local)}catch(l){console.error(l instanceof Error?l.message:String(l)),process.exit(1)}console.log(`replace: ${a.name} \u2192 ${X.relative(process.cwd(),a.dir)||"."}`)}if(r.subcommand==="check"){await Jn(e,a);return}let c=X.dirname(e);if(i&&i.bulb.server&&(!i.bulb.code||r.server)){r.trust||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
740
740
  ${s}`),process.exit(1)),await to(e,r.watch,r.mode,a,c);return}await Ps(e,r,s,a,c)}Qa().catch(r=>{console.error("Error:",r.message),process.exit(1)});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typebulb",
3
- "version": "0.11.9",
4
- "description": "Local bulb runner CLI for Typebulb",
3
+ "version": "0.12.0",
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
  "engines": { "node": ">=18" },
7
7
  "type": "module",