shellbell 0.12.0 → 0.13.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.
- package/dist/cli.js +27 -96
- package/dist/doctor-D5r55XE5.js +85 -0
- package/dist/native-controller.js +2 -2
- package/dist/native-service.js +1 -1
- package/dist/{service-entry-BBSp8-ir.js → service-entry-DOaFYmLa.js} +1 -1
- package/dist/{service-lifecycle-De-Hj3Tl.js → service-lifecycle-BYn-3kRH.js} +2 -2
- package/package.json +1 -1
package/dist/native-service.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Nt as e,tt as t,ut as n,w as r}from"./service-lifecycle-
|
|
2
|
+
import{Nt as e,tt as t,ut as n,w as r}from"./service-lifecycle-BYn-3kRH.js";import{a as i,n as a,r as o}from"./service-entry-DOaFYmLa.js";import{createReadStream as s,fstatSync as c,realpathSync as l}from"node:fs";import{userInfo as u}from"node:os";import{dirname as d,join as f,resolve as p}from"node:path";import{fileURLToPath as m}from"node:url";async function h(){if(process.argv.length===3&&[`--help`,`--version`].includes(process.argv[2])){process.stdout.write(process.argv[2]===`--version`?`${e}\n`:`Shellbell native service
|
|
3
3
|
`);return}let l=r.parse(process.argv[2]);if(process.argv.length!==3||process.execArgv.length||process.env.NODE_OPTIONS||process.env.NODE_PATH)throw Error();let h=u();if(process.platform!==`darwin`||h.uid<=0)throw Error();let g=p(d(m(import.meta.url)),`../../../..`),_=await i(g);if(_.agentVersion!==e)throw Error();let v=f(h.homedir,`Library/Application Support/Shellbell`),y=await a(l,{...l===`desktop`?{ownerInput:(()=>{let e=c(3);if(!e.isFIFO()&&!e.isSocket())throw Error(`invalid owner channel`);return s(``,{fd:3,autoClose:!0})})(),onOwnerLost:e=>process.exit(e===null?0:1)}:{},bundlePath:g,root:v,uid:h.uid,async start(e){if(e.agentVersion!==_.agentVersion)throw Error();let r=o(e,h.homedir,process.env);for(let e of Object.keys(process.env))delete process.env[e];Object.assign(process.env,r);let{buildAgent:i,shutdown:a}=await import(new URL(`./cli.js`,import.meta.url).href),s=n(e.stateDir),c=t({file:s.log,stdout:!1}),l={debug:()=>{},info:()=>c.info(`agent-event`),warn:()=>c.warn(`agent-event`),error:()=>c.error(`agent-event`),child:()=>l},u=await i(l,void 0,!1,{paths:s,serviceInstance:e.serviceInstance,nativeService:!0});try{await u.control.start(),u.agent.start()}catch(e){throw u.stopBackendDetectors(),u.agent.stop(),await u.control.stop(),e}let d;return{stop(){return d??=a(u.agent,u.control,e=>{e&&process.exit(1)},u.stopBackendDetectors),d}}}}),b=()=>{y.stop().then(()=>process.exit(0),()=>process.exit(1))};process.once(`SIGTERM`,b),process.once(`SIGINT`,b)}process.argv[1]&&l(process.argv[1])===m(import.meta.url)&&h().catch(()=>{process.stderr.write(`Shellbell service unavailable
|
|
4
4
|
`),process.exitCode=1});export{};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,Dt as r,E as i,O as a,Ot as o,T as s,Tt as c,c as l,dt as u,f as d,i as f,k as p,kt as m,m as h,p as g,pt as _,ut as v,v as y,x as b,y as x}from"./service-lifecycle-
|
|
1
|
+
import{A as e,C as t,D as n,Dt as r,E as i,O as a,Ot as o,T as s,Tt as c,c as l,dt as u,f as d,i as f,k as p,kt as m,m as h,p as g,pt as _,ut as v,v as y,x as b,y as x}from"./service-lifecycle-BYn-3kRH.js";import{createRequire as S}from"node:module";import{closeSync as C,constants as w,fstatSync as T,mkdirSync as E,openSync as ee,readdirSync as D,realpathSync as O,unlinkSync as k}from"node:fs";import{basename as te,dirname as A,join as j}from"node:path";import{z as M}from"zod";const N=`sh.bilal.shellbell.host.manual`;function P(e){(!s.safeParse(e).success||e!==j(e))&&F();for(let t=e;;t=A(t)){let e=r(t);if(e&&(!e.isDirectory()||e.isSymbolicLink())&&F(),A(t)===t)break}}function F(){throw new h(`unsafe-state`)}function I(e){return(!s.safeParse(e).success||[...e].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)===127))&&F(),e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function L(e){return(e!==j(e)||!e.endsWith(`/Shellbell.app/Contents/MacOS/Shellbell`))&&F(),Buffer.from(`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
3
|
<plist version="1.0"><dict>
|
|
4
4
|
<key>Label</key><string>${N}</string>
|