sootsim 0.1.36 → 0.1.37
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/README.md +20 -5
- package/dist-cli/bin.js +15 -20
- package/dist-cli/chunks/{agent-YZB6D3DR.js → agent-EQRQGSBL.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-VHCVS22I.js → agent-wrapper-AWKZ67GN.js} +10 -10
- package/dist-cli/chunks/{assert-AIVCKKLG.js → assert-ZVGELUZB.js} +2 -2
- package/dist-cli/chunks/auto-bootstrap-UEOLNAWJ.js +2 -0
- package/dist-cli/chunks/beta-4MD7WSI4.js +2 -0
- package/dist-cli/chunks/chunk-2ZPJHSIJ.js +11 -0
- package/dist-cli/chunks/{chunk-A5BRCXYE.js → chunk-4IO3D5XG.js} +1 -1
- package/dist-cli/chunks/chunk-4OHVCGMF.js +2 -0
- package/dist-cli/chunks/chunk-56BIMCDH.js +2 -0
- package/dist-cli/chunks/chunk-5FLDI6CV.js +66 -0
- package/dist-cli/chunks/{chunk-LHDWH7VS.js → chunk-B3RAGRK6.js} +1 -1
- package/dist-cli/chunks/{chunk-27P763IZ.js → chunk-BGAPLYMS.js} +2 -2
- package/dist-cli/chunks/chunk-CX3ZIPD3.js +3 -0
- package/dist-cli/chunks/{chunk-HWCKZXNJ.js → chunk-DSTV2VJT.js} +2 -2
- package/dist-cli/chunks/chunk-EDBFYOQB.js +2 -0
- package/dist-cli/chunks/chunk-ERLA3F77.js +1 -0
- package/dist-cli/chunks/chunk-FCQLQ7NA.js +117 -0
- package/dist-cli/chunks/chunk-H2HSOHXN.js +7 -0
- package/dist-cli/chunks/chunk-HYYMBXIX.js +2 -0
- package/dist-cli/chunks/chunk-JMGDVXAV.js +3 -0
- package/dist-cli/chunks/chunk-JMU5IGIU.js +1 -0
- package/dist-cli/chunks/chunk-KA5JJCWL.js +1 -0
- package/dist-cli/chunks/chunk-L4F4JRKJ.js +348 -0
- package/dist-cli/chunks/{chunk-G7XQD4KC.js → chunk-LDWXH43L.js} +2 -2
- package/dist-cli/chunks/chunk-PERKPZ7T.js +4 -0
- package/dist-cli/chunks/chunk-PN6FWLD4.js +5 -0
- package/dist-cli/chunks/chunk-QD7YIVPS.js +64 -0
- package/dist-cli/chunks/chunk-QWKO62QM.js +2 -0
- package/dist-cli/chunks/{chunk-VFDRZNPN.js → chunk-QXMZNJV5.js} +1 -1
- package/dist-cli/chunks/chunk-R77F5J3X.js +4 -0
- package/dist-cli/chunks/chunk-RLNIKWFO.js +27 -0
- package/dist-cli/chunks/chunk-RX6RHGSI.js +2 -0
- package/dist-cli/chunks/{chunk-IJMYFYDZ.js → chunk-S74RCIVB.js} +2 -2
- package/dist-cli/chunks/chunk-SK4SOISL.js +1 -0
- package/dist-cli/chunks/{chunk-YIO6S3R5.js → chunk-T5L73GJB.js} +1 -1
- package/dist-cli/chunks/{chunk-KAXZHEKM.js → chunk-UIQ3536J.js} +1 -1
- package/dist-cli/chunks/chunk-URSEYCC5.js +16 -0
- package/dist-cli/chunks/chunk-WFXYY3DU.js +3 -0
- package/dist-cli/chunks/{chunk-EWSQSALM.js → chunk-WHLHA5R5.js} +4 -4
- package/dist-cli/chunks/chunk-WLIVBPPY.js +3 -0
- package/dist-cli/chunks/{chunk-CYCXOAVZ.js → chunk-X6BP5JFC.js} +4 -4
- package/dist-cli/chunks/chunk-YFXTO4QX.js +5 -0
- package/dist-cli/chunks/{chunk-RMW5BO3S.js → chunk-Z5SVSAZO.js} +2 -2
- package/dist-cli/chunks/{chunk-OXN2PEB7.js → chunk-Z5X3PITK.js} +3 -3
- package/dist-cli/chunks/chunk-ZBOIGEGO.js +5 -0
- package/dist-cli/chunks/chunk-ZERYEI3L.js +17 -0
- package/dist-cli/chunks/{compat-Y2O2U7FL.js → compat-QQ3OJDBI.js} +2 -2
- package/dist-cli/chunks/{config-SRBOFUCI.js → config-LT27SC25.js} +2 -2
- package/dist-cli/chunks/control-3BO54QMO.js +2 -0
- package/dist-cli/chunks/cpu-profile-XEO3JCVB.js +22 -0
- package/dist-cli/chunks/daemon-3J2SAVQZ.js +83 -0
- package/dist-cli/chunks/{debug-BIDMW2PE.js → debug-OGQLIH4U.js} +4 -4
- package/dist-cli/chunks/demo-app-registry-5RZCXLWB.js +2 -0
- package/dist-cli/chunks/detox-Z2OSCIQU.js +49 -0
- package/dist-cli/chunks/device-RPTVD25S.js +16 -0
- package/dist-cli/chunks/diagnose-LAEXBNOQ.js +41 -0
- package/dist-cli/chunks/drivers-PSQUUAYC.js +2 -0
- package/dist-cli/chunks/electron-S2463O3P.js +18 -0
- package/dist-cli/chunks/flow-34YCVQDB.js +2 -0
- package/dist-cli/chunks/hints-E5PXPWFT.js +2 -0
- package/dist-cli/chunks/home-paths-F5SGBTRZ.js +2 -0
- package/dist-cli/chunks/inspect-EVGMEZ3G.js +1101 -0
- package/dist-cli/chunks/install-AM5PTJT3.js +2 -0
- package/dist-cli/chunks/{install-desktop-2MYEI4FM.js → install-desktop-ZNWYKTWQ.js} +3 -3
- package/dist-cli/chunks/{keys-7PNASIQR.js → keys-5ETF6DYO.js} +2 -2
- package/dist-cli/chunks/{launch-JNS47LAQ.js → launch-DHUCNFX6.js} +3 -3
- package/dist-cli/chunks/{login-YWZWUHBS.js → login-KDR34JIP.js} +4 -4
- package/dist-cli/chunks/{logout-O6SXMSBP.js → logout-R6WIJYCW.js} +2 -2
- package/dist-cli/chunks/maestro-ZOOJ2YVH.js +80 -0
- package/dist-cli/chunks/{preview-WGKJO5FS.js → preview-YFADHNBD.js} +2 -2
- package/dist-cli/chunks/profile-CQSC32HB.js +22 -0
- package/dist-cli/chunks/react-QSQD6CJE.js +30 -0
- package/dist-cli/chunks/{record-QPWLYH5R.js → record-IWLEYATN.js} +5 -5
- package/dist-cli/chunks/{runtime-KEMO2MSB.js → runtime-WKMNKYTN.js} +3 -3
- package/dist-cli/chunks/screenshot-VJXHV57I.js +28 -0
- package/dist-cli/chunks/screenshot-mode-FA4VQ76K.js +17 -0
- package/dist-cli/chunks/screenshots-U4FQXHVK.js +70 -0
- package/dist-cli/chunks/server-7WZLM5NQ.js +35 -0
- package/dist-cli/chunks/setup-repo-3BXLAX5E.js +2 -0
- package/dist-cli/chunks/{skills-MO7BFNVM.js → skills-KO7RCY24.js} +2 -2
- package/dist-cli/chunks/start-EBD7T2GW.js +23 -0
- package/dist-cli/chunks/store-ONX3EBS4.js +2 -0
- package/dist-cli/chunks/telemetry-MFR7TUW7.js +2 -0
- package/dist-cli/chunks/{test-XUI3KNNQ.js → test-OSVUG54G.js} +3 -3
- package/dist-cli/chunks/three-mode-MDBXZQG4.js +39 -0
- package/dist-cli/chunks/timeline-UJOKZKQR.js +22 -0
- package/dist-cli/chunks/upload-H2SMWP6T.js +2 -0
- package/dist-cli/chunks/what-happened-LFWH74FR.js +15 -0
- package/dist-cli/chunks/whoami-CUF56TLP.js +2 -0
- package/dist-lib/agent-daemon-client.cjs +4 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +41 -39
- package/dist-lib/attached-projects.cjs +30 -28
- package/dist-lib/auth/shared-session.cjs +35 -27
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +6 -2
- package/dist-lib/dev-bundle-resolution.cjs +5 -21
- package/dist-lib/home-paths.cjs +94 -38
- package/dist-lib/host/bridge-host.cjs +2131 -1333
- package/dist-lib/host/fetch-proxy-handler.cjs +248 -0
- package/dist-lib/index.cjs +21 -21
- package/dist-lib/metro.cjs +21 -21
- package/dist-lib/profiles.cjs +246 -0
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/vite-base.cjs +3402 -1640
- package/dist-lib/vite.cjs +1 -1
- package/package.json +7 -1
- package/dist-cli/chunks/auto-bootstrap-MLNTX23H.js +0 -2
- package/dist-cli/chunks/chunk-3UIWOHC2.js +0 -62
- package/dist-cli/chunks/chunk-5KGFHWVR.js +0 -1
- package/dist-cli/chunks/chunk-5QIUJNT3.js +0 -5
- package/dist-cli/chunks/chunk-6GGMKFWJ.js +0 -4
- package/dist-cli/chunks/chunk-6Z275LCY.js +0 -2
- package/dist-cli/chunks/chunk-75LBYBKW.js +0 -11
- package/dist-cli/chunks/chunk-DFN3GGH7.js +0 -5
- package/dist-cli/chunks/chunk-EBEHZJRG.js +0 -117
- package/dist-cli/chunks/chunk-EJLNUMMP.js +0 -3
- package/dist-cli/chunks/chunk-FE7UI3MT.js +0 -4
- package/dist-cli/chunks/chunk-G663654J.js +0 -1
- package/dist-cli/chunks/chunk-GW7XY5KC.js +0 -2
- package/dist-cli/chunks/chunk-H2QO4TDV.js +0 -22
- package/dist-cli/chunks/chunk-HWFHBMAQ.js +0 -27
- package/dist-cli/chunks/chunk-J7CTD37P.js +0 -1
- package/dist-cli/chunks/chunk-N32NCVL2.js +0 -3
- package/dist-cli/chunks/chunk-NIZBR7EK.js +0 -2
- package/dist-cli/chunks/chunk-NYY36OKU.js +0 -308
- package/dist-cli/chunks/chunk-PJL25JQV.js +0 -5
- package/dist-cli/chunks/chunk-SHO54NET.js +0 -2
- package/dist-cli/chunks/chunk-SMVJOWSV.js +0 -16
- package/dist-cli/chunks/chunk-TC6V7YFC.js +0 -3
- package/dist-cli/chunks/chunk-YLIIVTTQ.js +0 -3
- package/dist-cli/chunks/chunk-YR7BGGYE.js +0 -2
- package/dist-cli/chunks/chunk-ZEW3RF5Q.js +0 -1
- package/dist-cli/chunks/control-PL2V2O6S.js +0 -2
- package/dist-cli/chunks/daemon-IZC32PZW.js +0 -50
- package/dist-cli/chunks/demo-app-registry-5JFOUU3D.js +0 -2
- package/dist-cli/chunks/detox-B3FDOIS3.js +0 -49
- package/dist-cli/chunks/device-ZZSI363W.js +0 -16
- package/dist-cli/chunks/drivers-S4NGK4DB.js +0 -2
- package/dist-cli/chunks/electron-5YFHXEOI.js +0 -15
- package/dist-cli/chunks/flow-JJBO6TFY.js +0 -2
- package/dist-cli/chunks/hints-G5HBBV2O.js +0 -2
- package/dist-cli/chunks/home-paths-VWC3FWA3.js +0 -2
- package/dist-cli/chunks/inspect-POOPWUQI.js +0 -1034
- package/dist-cli/chunks/install-MP6FHXNZ.js +0 -2
- package/dist-cli/chunks/install-dev-desktop-SKH3KEHY.js +0 -100
- package/dist-cli/chunks/maestro-CW6XVUKV.js +0 -75
- package/dist-cli/chunks/profile-SUOBRPIC.js +0 -22
- package/dist-cli/chunks/screenshot-JTY46V7G.js +0 -26
- package/dist-cli/chunks/screenshot-mode-7OYBBX6D.js +0 -17
- package/dist-cli/chunks/screenshots-QISKC4GD.js +0 -70
- package/dist-cli/chunks/server-YSFJAKAV.js +0 -34
- package/dist-cli/chunks/setup-repo-LFB3HBEO.js +0 -2
- package/dist-cli/chunks/store-6MFL53I4.js +0 -2
- package/dist-cli/chunks/telemetry-CN42GMVC.js +0 -2
- package/dist-cli/chunks/upload-6FUT7AX5.js +0 -2
- package/dist-cli/chunks/whoami-TQFHY42N.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as o}from"./chunk-BGAPLYMS.js";import"./chunk-QXMZNJV5.js";import"./chunk-H2HSOHXN.js";import"./chunk-S74RCIVB.js";import"./chunk-WFXYY3DU.js";import"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";async function t(n){console.error(" note: `sootsim install` is now `sootsim setup-repo`. forwarding\u2026\n"),await o(n)}export{t as runInstall};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as b}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as b}from"./chunk-QXMZNJV5.js";import{a as x}from"./chunk-YFXTO4QX.js";import"./chunk-B3RAGRK6.js";import{spawn as k,spawnSync as u}from"child_process";import{chmodSync as S,createWriteStream as E,existsSync as w,mkdirSync as y,renameSync as T,rmSync as g,statSync as P}from"fs";import{tmpdir as D}from"os";import{dirname as M,join as f,resolve as v}from"path";var h="https://sootbean.com/api/electron-release";function A(){let r=process.arch;if(process.platform==="darwin"){let o=r==="arm64"?"mac-arm64":"mac-x64",n=`sootsim-latest-${o}.dmg`;return{platform:o,filename:n,url:`${h}/${n}`,install:_}}if(process.platform==="linux"){let o="sootsim-latest-linux-x64.AppImage";return{platform:"linux-x64",filename:o,url:`${h}/${o}`,install:L}}if(process.platform==="win32"){let o="sootsim-latest-win-x64.exe";return{platform:"win-x64",filename:o,url:`${h}/${o}`,install:C}}return null}async function O({url:r,dest:o,onProgress:n}){let s=await fetch(r,{redirect:"follow"});if(!s.ok)throw new Error(`download failed: ${s.status} ${s.statusText} (${r})`);let t=s.headers.get("content-length"),a=t?Number(t):null;if(!s.body)throw new Error("download failed: empty response body");y(M(o),{recursive:!0});let i=E(o),d=s.body.getReader(),c=0;try{for(;;){let{done:l,value:p}=await d.read();if(l)break;i.write(Buffer.from(p)),c+=p.byteLength,n?.(c,a)}}finally{await new Promise((l,p)=>{i.end(e=>e?p(e):l())})}}function I(r,o){let n=(r/1048576).toFixed(1);if(!o)return` ${n} MB`;let s=Math.min(100,Math.round(r/o*100)),t=(o/(1024*1024)).toFixed(1),a=24,i=Math.round(s/100*a);return` ${"\u2588".repeat(i)+"\u2591".repeat(a-i)} ${s}% ${n} / ${t} MB`}async function _(r){let o=u("hdiutil",["attach","-nobrowse","-readonly",r],{encoding:"utf8"});if(o.status!==0)throw new Error(`hdiutil attach failed: ${o.stderr||o.stdout}`.trim());let n=o.stdout.trim().split(`
|
|
3
3
|
`),t=n[n.length-1].split(" ").pop()?.trim();if(!t||!w(t))throw new Error(`could not determine dmg mount point (output: ${o.stdout})`);let a=f(t,"sootsim.app");if(!w(a))throw u("hdiutil",["detach","-force",t]),new Error(`sootsim.app not found inside ${t}`);let i="/Applications",d=v(process.env.HOME||"","Applications"),c=i;try{let m=f(i,`.sootsim-write-probe-${process.pid}`);u("touch",[m]),w(m)?g(m,{force:!0}):c=d}catch{c=d}c===d&&y(c,{recursive:!0});let l=f(c,"sootsim.app");w(l)&&g(l,{recursive:!0,force:!0});let p=u("cp",["-R",a,l]),e=u("hdiutil",["detach","-force",t]);if(p.status!==0)throw new Error(`copy to ${l} failed: ${p.stderr?.toString()||""}`.trim());return e.status!==0&&console.warn(` warning: failed to unmount ${t} (${e.stderr?.toString().trim()||"unknown error"})`),u("xattr",["-dr","com.apple.quarantine",l]),l}async function L(r){let o=v(process.env.HOME||"","Applications");y(o,{recursive:!0});let n=f(o,"sootsim.AppImage");return w(n)&&g(n,{force:!0}),T(r,n),S(n,493),n}async function C(r){return await new Promise((o,n)=>{let s=k("cmd",["/c","start",'""',"/wait",r],{stdio:"inherit"});s.once("error",n),s.once("exit",t=>{t===0?o():n(new Error(`installer exited with code ${t}`))})}),r}async function Y(r){(r.includes("--help")||r.includes("-h"))&&(console.log(`
|
|
4
4
|
sootsim install-desktop \u2014 download and install the optional desktop GUI
|
|
5
5
|
|
|
@@ -20,4 +20,4 @@ examples:
|
|
|
20
20
|
`),process.exit(0));let o=r.includes("--yes")||r.includes("-y")||process.env.SOOTSIM_NO_PROMPT==="1"||process.env.CI==="1"||!process.stdin.isTTY,n=r.includes("--force"),s=x();if(s&&!n){console.log(` sootsim desktop already installed at: ${s.path}`),console.log(" pass --force to reinstall.");return}let t=A();if(t||(console.error(` no desktop build available for ${process.platform}/${process.arch}.`),console.error(" supported: darwin-arm64, darwin-x64, linux-x64, win32-x64"),process.exit(1)),console.log(` platform: ${t.platform}`),console.log(` download: ${t.url}`),console.log(),!o){if(!await b("download and install now?",!0)){console.log(" cancelled.");return}console.log()}let a=f(D(),`sootsim-install-${Date.now()}`),i=f(a,t.filename),d=0;process.stdout.write(` downloading ${t.filename}...
|
|
21
21
|
`);try{await O({url:t.url,dest:i,onProgress:(e,m)=>{let $=Date.now();$-d<100&&e<(m??1/0)||(d=$,process.stdout.isTTY&&process.stdout.write(`\r\x1B[2K${I(e,m)}`))}})}catch(e){g(a,{recursive:!0,force:!0}),console.error(`
|
|
22
22
|
download failed: ${e instanceof Error?e.message:String(e)}`),process.exit(1)}process.stdout.isTTY&&process.stdout.write(`
|
|
23
|
-
`);let c=P(i).size;console.log(` downloaded ${(c/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");let{trackCliEvent:l,flushCliTelemetry:p}=await import("./telemetry-
|
|
23
|
+
`);let c=P(i).size;console.log(` downloaded ${(c/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");let{trackCliEvent:l,flushCliTelemetry:p}=await import("./telemetry-MFR7TUW7.js");try{let e=await t.install(i);l({event:"cli_install_desktop_succeeded",properties:{platform:t.platform,size_bytes:c}}),console.log(` installed: ${e}`)}catch(e){l({event:"cli_install_desktop_failed",properties:{platform:t.platform,error:e instanceof Error?e.message:String(e)}}),await p(),console.error(` install failed: ${e instanceof Error?e.message:String(e)}`),console.error(` keeping download at ${i} for manual install.`),process.exit(1)}finally{g(a,{recursive:!0,force:!0})}console.log(),console.log(" next steps:"),console.log(" sootsim electron launch the desktop app"),console.log(" sootsim open <target> open a demo or bundle in it")}export{Y as runInstallDesktop};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as l,b as d,c as k,d as y,e as g}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as l,b as d,c as k,d as y,e as g}from"./chunk-CX3ZIPD3.js";import{d as c}from"./chunk-WFXYY3DU.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";async function a(){let s=await c();return s?.token||(process.stderr.write(" sootsim keys ... needs you to be signed in.\n run `sootsim login` first.\n"),process.exit(1)),{origin:s.origin,token:s.token}}function f(s){if(!s)return"never";try{return new Date(s).toLocaleString()}catch{return s}}async function h(s){let i=s[0];if(!i||i==="--help"||i==="-h"){u();return}if(i==="list"){let{origin:o,token:e}=await a(),n=await fetch(`${o.replace(/\/$/,"")}/api/sootsim/billing/keys`,{headers:{authorization:`Bearer ${e}`}});n.ok||(console.error(` keys list failed (${n.status})`),process.exit(1));let{keys:r}=await n.json();if(r.length===0){console.log(" no keys. create one with `sootsim keys create <label>`.");return}for(let t of r)console.log(` ${t.keyPrefix}\u2026 ${t.label.padEnd(24)} scopes=${t.scopes.join(",")} last=${f(t.lastUsedAt)} id=${t.id}`);return}if(i==="create"){let o=s[1]?.trim();o||(console.error(" usage: sootsim keys create <label>"),process.exit(1));let{origin:e,token:n}=await a(),r=await fetch(`${e.replace(/\/$/,"")}/api/sootsim/billing/keys`,{method:"POST",headers:{authorization:`Bearer ${n}`,"content-type":"application/json"},body:JSON.stringify({label:o})});r.ok||(console.error(` keys create failed (${r.status}): ${await r.text()}`),process.exit(1));let t=await r.json();console.log(`
|
|
3
3
|
created: ${t.record.label} (${t.record.keyPrefix}\u2026)`),console.log(` scopes: ${t.record.scopes.join(",")}`),console.log(`
|
|
4
4
|
secret: ${t.secret}
|
|
5
5
|
`),console.log(` copy this now \u2014 we can't show it again.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-KA5JJCWL.js";import{b as m}from"./chunk-HYYMBXIX.js";import{a as u}from"./chunk-YFXTO4QX.js";import"./chunk-WLIVBPPY.js";import"./chunk-JMU5IGIU.js";import"./chunk-4IO3D5XG.js";import{D as c,E as r,F as l,y as s,z as a}from"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";import{spawn as p}from"child_process";import{existsSync as h}from"fs";async function I(n){if(n.includes("--help")||n.includes("-h")){console.log(`
|
|
3
3
|
sootsim launch \u2014 one-shot: install runtime if needed, start daemon, open app
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -13,4 +13,4 @@ options:
|
|
|
13
13
|
examples:
|
|
14
14
|
sootsim launch
|
|
15
15
|
sootsim launch --version 1.2.3
|
|
16
|
-
`);return}let e=n.includes("--no-runtime-install"),i=n.indexOf("--channel"),t=i>=0&&n[i+1]?n[i+1]:"stable",o=n.indexOf("--version"),f=o>=0&&n[o+1]?n[o+1]:void 0;s(),await v({skipAutoInstall:e,channel:t,explicitVersion:f}),await d(),await x()}async function v(n){let e=a(),i=c();if(e&&i)return;n.skipAutoInstall&&(console.error(" no sootsim runtime installed. run `sootsim runtime install` first, or drop --no-runtime-install."),process.exit(1)),console.log("sootsim: first run \u2014 installing runtime");let{runRuntime:t}=await import("./runtime-
|
|
16
|
+
`);return}let e=n.includes("--no-runtime-install"),i=n.indexOf("--channel"),t=i>=0&&n[i+1]?n[i+1]:"stable",o=n.indexOf("--version"),f=o>=0&&n[o+1]?n[o+1]:void 0;s(),await v({skipAutoInstall:e,channel:t,explicitVersion:f}),await d(),await x()}async function v(n){let e=a(),i=c();if(e&&i)return;n.skipAutoInstall&&(console.error(" no sootsim runtime installed. run `sootsim runtime install` first, or drop --no-runtime-install."),process.exit(1)),console.log("sootsim: first run \u2014 installing runtime");let{runRuntime:t}=await import("./runtime-WKMNKYTN.js"),o=[];n.explicitVersion&&o.push(n.explicitVersion),n.channel!=="stable"&&o.push("--channel",n.channel),await t(["install",...o],{channel:n.channel})}async function d(){let n=r();if(l(n))return;console.log("sootsim: starting daemon");let e=w();p(e,["server","--quiet"],{detached:!0,stdio:"ignore",env:process.env}).unref();let t=Date.now()+8e3;for(;Date.now()<t;){let o=r();if(l(o))return;await g(150)}console.error(" daemon didn't become ready within 8s \u2014 check ~/.sootsim/ or run `sootsim server` in a terminal to see errors"),process.exit(1)}async function x(){u()||(console.error(" no sootsim desktop companion installed. run `sootsim install-desktop` to download electron + the shell."),process.exit(1));let e=await m.launch({});e.launched||(console.error(` ${e.message}`),process.exit(1)),console.log(` ${e.message}`)}function w(){let n=process.argv[1];return n&&h(n)?n:"sootsim"}function g(n){return new Promise(e=>setTimeout(e,n))}async function R(){s(),await d()}export{R as ensureDaemonRunning,I as runLaunch};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{b as f,d as m}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as f,d as m}from"./chunk-WFXYY3DU.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";import{exec as S}from"node:child_process";import{randomBytes as $}from"node:crypto";import _ from"node:http";var I=process.env.SOOTSIM_AUTH_ORIGIN||"https://sootbean.com",h="http://localhost:3000";async function x(t){if(t)return t;if(process.env.SOOTSIM_AUTH_ORIGIN)return process.env.SOOTSIM_AUTH_ORIGIN;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{if((await fetch(`${h}/api/auth/me`)).ok)return h}catch{}return I}function R(){console.log(`
|
|
3
3
|
sootsim login \u2014 sign in so desktop uploads can attach to your account
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -21,6 +21,6 @@ options:
|
|
|
21
21
|
<p style="color:#ccc">${t}</p>
|
|
22
22
|
</div>
|
|
23
23
|
</body>
|
|
24
|
-
</html>`}async function P(t){try{let o=await fetch(`${t.replace(/\/$/,"")}/api/dev-login`,{method:"POST"});if(o.status===403)return{ok:!1,error:"dev-login disabled (not in dev mode)"};if(!o.ok){let c=await o.text().catch(()=>"");return{ok:!1,error:`dev-login ${o.status}: ${c}`}}let e=await o.json();return e.token?{ok:!0,token:e.token,userId:e.user?.id,email:e.email}:{ok:!1,error:"dev-login response missing token"}}catch(o){return{ok:!1,error:o instanceof Error?o.message:"dev-login fetch failed"}}}function A(t){try{let o=new URL(t).hostname;return o==="localhost"||o==="127.0.0.1"||o.endsWith(".local")}catch{return!1}}async function G(t){(t.includes("--help")||t.includes("-h"))&&(R(),process.exit(0));let o=[...t],e=await x(T(o,"--origin"));if(A(e)){console.log(` detected local origin (${e}) \u2014 signing in as dev user`);let r=await P(e);if(r.ok){f({token:r.token,user:r.userId?{id:r.userId,email:r.email}:null,origin:e,source:"cli"});let s=await m(e),l=s?.user?.email||r.email||s?.user?.id||r.userId,{trackCliEvent:n,flushCliTelemetry:a}=await import("./telemetry-
|
|
24
|
+
</html>`}async function P(t){try{let o=await fetch(`${t.replace(/\/$/,"")}/api/dev-login`,{method:"POST"});if(o.status===403)return{ok:!1,error:"dev-login disabled (not in dev mode)"};if(!o.ok){let c=await o.text().catch(()=>"");return{ok:!1,error:`dev-login ${o.status}: ${c}`}}let e=await o.json();return e.token?{ok:!0,token:e.token,userId:e.user?.id,email:e.email}:{ok:!1,error:"dev-login response missing token"}}catch(o){return{ok:!1,error:o instanceof Error?o.message:"dev-login fetch failed"}}}function A(t){try{let o=new URL(t).hostname;return o==="localhost"||o==="127.0.0.1"||o.endsWith(".local")}catch{return!1}}async function G(t){(t.includes("--help")||t.includes("-h"))&&(R(),process.exit(0));let o=[...t],e=await x(T(o,"--origin"));if(A(e)){console.log(` detected local origin (${e}) \u2014 signing in as dev user`);let r=await P(e);if(r.ok){f({token:r.token,user:r.userId?{id:r.userId,email:r.email}:null,origin:e,source:"cli"});let s=await m(e),l=s?.user?.email||r.email||s?.user?.id||r.userId,{trackCliEvent:n,flushCliTelemetry:a}=await import("./telemetry-MFR7TUW7.js");n({event:"cli_login_succeeded",identity:{userId:r.userId??s?.user?.id??null},properties:{origin:e,mode:"dev"}}),await a(),console.log(` signed in${l?` as ${l}`:""} (dev)`);return}console.log(` dev-login not available (${r.error}); falling back to browser`)}let c=$(16).toString("hex"),i=await new Promise(r=>{let s=_.createServer((l,n)=>{try{let a=new URL(l.url||"/","http://127.0.0.1"),w=a.searchParams.get("state"),k=a.searchParams.get("token"),b=a.searchParams.get("email")||void 0,O=a.searchParams.get("userId")||void 0,g=a.searchParams.get("error");if(n.setHeader("content-type","text/html; charset=utf-8"),g){n.end(u(`sign-in failed: ${g}`)),r({ok:!1,error:g}),s.close();return}if(w!==c){n.end(u("state mismatch. close this tab and retry `sootsim login`.")),r({ok:!1,error:"state mismatch"}),s.close();return}if(!k){n.end(u("missing token. close this tab and retry `sootsim login`.")),r({ok:!1,error:"missing token"}),s.close();return}n.end(u("sign-in complete. you can return to the terminal.")),r({ok:!0,token:k,email:b,userId:O}),s.close()}catch(a){n.statusCode=500,n.end(u("sign-in callback failed. retry `sootsim login`.")),r({ok:!1,error:a instanceof Error?a.message:"callback failed"}),s.close()}});s.listen(0,"127.0.0.1",()=>{let l=s.address();if(!l||typeof l=="string"){r({ok:!1,error:"failed to bind callback server"}),s.close();return}let n=new URL(`${e.replace(/\/$/,"")}/auth/sootsim-cli`);n.searchParams.set("state",c),n.searchParams.set("port",String(l.port)),n.searchParams.set("sootbean",e),console.log(" opening browser for sootsim login..."),console.log(` waiting for callback on 127.0.0.1:${l.port}`),console.log(` if nothing opens, visit:
|
|
25
25
|
${n.toString()}
|
|
26
|
-
`),L(n.toString())})});if(!i.ok){let{trackCliEvent:r,flushCliTelemetry:s}=await import("./telemetry-
|
|
26
|
+
`),L(n.toString())})});if(!i.ok){let{trackCliEvent:r,flushCliTelemetry:s}=await import("./telemetry-MFR7TUW7.js");r({event:"cli_login_failed",properties:{origin:e,error:i.error}}),await s(),console.error(` login failed: ${i.error}`),process.exit(1)}f({token:i.token,user:i.userId?{id:i.userId,email:i.email}:null,origin:e,source:"cli"});let d=await m(e),p=d?.user?.email||i.email||d?.user?.id||i.userId,{trackCliEvent:y,flushCliTelemetry:v}=await import("./telemetry-MFR7TUW7.js");y({event:"cli_login_succeeded",identity:{userId:i.userId??d?.user?.id??null},properties:{origin:e}}),await v(),console.log(` signed in${p?` as ${p}`:""}`)}export{G as runLogin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as r,b as i}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as r,b as i}from"./chunk-S74RCIVB.js";import{a as t,c as o}from"./chunk-WFXYY3DU.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";async function s(){let e=t();if(!e?.token){console.log(" not signed in");return}try{await fetch(`${e.origin.replace(/\/$/,"")}/api/auth/sign-out`,{method:"POST",headers:{authorization:`Bearer ${e.token}`}})}catch{}o(),r({event:"cli_logout",identity:{userId:e.user?.id??null},properties:{origin:e.origin}}),await i(),console.log(" signed out")}export{s as runLogout};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as h}from"./chunk-L4F4JRKJ.js";import"./chunk-ZBOIGEGO.js";import"./chunk-WHLHA5R5.js";import"./chunk-SK4SOISL.js";import"./chunk-RLNIKWFO.js";import"./chunk-DSTV2VJT.js";import"./chunk-2ZPJHSIJ.js";import"./chunk-QWKO62QM.js";import"./chunk-Z5X3PITK.js";import"./chunk-HYYMBXIX.js";import"./chunk-YFXTO4QX.js";import"./chunk-WLIVBPPY.js";import"./chunk-QD7YIVPS.js";import"./chunk-5FLDI6CV.js";import"./chunk-CX3ZIPD3.js";import"./chunk-JMU5IGIU.js";import"./chunk-Z5SVSAZO.js";import"./chunk-4OHVCGMF.js";import"./chunk-RX6RHGSI.js";import"./chunk-56BIMCDH.js";import"./chunk-S74RCIVB.js";import"./chunk-WFXYY3DU.js";import"./chunk-4IO3D5XG.js";import"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";import*as i from"fs";import*as l from"path";var y=[".maestro","maestro"];function b(){console.log(`
|
|
3
|
+
sootsim maestro \u2014 run maestro YAML flows against sootsim (drop-in)
|
|
4
|
+
|
|
5
|
+
usage:
|
|
6
|
+
sootsim maestro # discover .maestro/ or maestro/ in cwd, run all
|
|
7
|
+
sootsim maestro test <flow-or-dir> # mirrors "maestro test"
|
|
8
|
+
sootsim maestro test .maestro/ # every *.yaml / *.yml in a directory
|
|
9
|
+
sootsim maestro init # scaffold .maestro/login.yaml
|
|
10
|
+
sootsim maestro --list-compat # print supported/unsupported verbs
|
|
11
|
+
|
|
12
|
+
options:
|
|
13
|
+
--env KEY=VALUE set env vars for \${KEY} interpolation (repeatable)
|
|
14
|
+
--continuous re-run the flow on file changes (alias for --watch)
|
|
15
|
+
--format <fmt> accepted for maestro cli compat (not used)
|
|
16
|
+
--new force a fresh browser window for this run
|
|
17
|
+
--record record a webm while the flow runs
|
|
18
|
+
--preview record events+video, upload, and print /preview/<id>
|
|
19
|
+
--preview-open open the uploaded preview link after a successful run
|
|
20
|
+
--preview-origin <url> upload target for --preview
|
|
21
|
+
--preview-public-origin <url>
|
|
22
|
+
public link origin for --preview
|
|
23
|
+
--slow <ms> delay between steps for natural pacing
|
|
24
|
+
|
|
25
|
+
examples:
|
|
26
|
+
bun sootsim maestro test .maestro/login.yaml
|
|
27
|
+
bun sootsim maestro test .maestro/
|
|
28
|
+
bun sootsim maestro --env USERNAME=alice test .maestro/login.yaml
|
|
29
|
+
bun sootsim maestro init
|
|
30
|
+
`)}function x(){console.log(`
|
|
31
|
+
sootsim maestro \u2014 compatibility matrix
|
|
32
|
+
|
|
33
|
+
supported verbs:
|
|
34
|
+
launchApp, stopApp, clearState, clearKeychain (warn-only),
|
|
35
|
+
tapOn, tapAtCoords, longPressOn (via tapOn),
|
|
36
|
+
inputText, pressKey, dispatchKey, hideKeyboard, eraseText,
|
|
37
|
+
assertVisible, assertNotVisible, assertTreeContains,
|
|
38
|
+
waitFor, extendedWaitUntil, waitForAnimationToEnd,
|
|
39
|
+
scroll, scrollUntilVisible, scrollTo, swipe, pinch,
|
|
40
|
+
takeScreenshot, dumpTree, back,
|
|
41
|
+
repeat, runFlow, when: (visible/notVisible/platform/true),
|
|
42
|
+
optional:, onFlowStart, onFlowComplete,
|
|
43
|
+
copyTextFrom, evalScript, openLink,
|
|
44
|
+
env var interpolation via \${NAME} (process.env + flow-scoped).
|
|
45
|
+
|
|
46
|
+
partial:
|
|
47
|
+
clearKeychain \u2014 warn-only, sootsim has no keychain surface.
|
|
48
|
+
when.platform \u2014 matches "ios" only; sootsim emulates iOS.
|
|
49
|
+
openLink \u2014 uses window.location; no OS-level app routing.
|
|
50
|
+
takeScreenshot \u2014 maestro string form works unchanged; sootsim also accepts
|
|
51
|
+
{ path, withFrame } for framed export.
|
|
52
|
+
|
|
53
|
+
not yet implemented (will throw "unsupported maestro verb"):
|
|
54
|
+
travel, setLocation, setAirplaneMode, killApp,
|
|
55
|
+
addMedia, startRecording, stopRecording (use --record flag),
|
|
56
|
+
repeat.while (only repeat.times is supported).
|
|
57
|
+
`)}function w(t){return t.startsWith("-")}function S(t){let r=[];for(let e=0;e<t.length;e++){if(t[e]==="--env"||t[e]==="-e"){let o=t[e+1];if(!o||!o.includes("="))throw new Error(`--env expects KEY=VALUE (got ${JSON.stringify(o??"")})`);let a=o.indexOf("="),s=o.slice(0,a),p=o.slice(a+1);process.env[s]=p,e+=1;continue}r.push(t[e])}return r}function $(t){let r=[];for(let e=0;e<t.length;e++){let o=t[e];if(o==="--format"||o==="--output"||o==="--device"||o==="-d"){e+=1;continue}if(o==="--continuous"){console.warn(" warn: --continuous is not yet implemented in sootsim \u2014 running once");continue}r.push(o)}return r}function g(t){for(let r of y){let e=l.join(t,r);if(i.existsSync(e)&&i.statSync(e).isDirectory())return e}return null}function k(t){let r=i.statSync(t);if(r.isFile())return[t];if(!r.isDirectory())throw new Error(`not a file or directory: ${t}`);let e=i.readdirSync(t),o=[];for(let a of e){if(a.startsWith("."))continue;let s=l.join(t,a);i.statSync(s).isFile()&&(a.endsWith(".yaml")||a.endsWith(".yml"))&&o.push(s)}return o.sort(),o}async function E(t){let r=l.join(t,".maestro");i.mkdirSync(r,{recursive:!0});let e=l.join(r,"login.yaml");return i.existsSync(e)?(console.error(` error: ${e} already exists`),1):(i.writeFileSync(e,`# sootsim maestro starter flow \u2014 drop-in compatible with the maestro cli.
|
|
58
|
+
# run: bun sootsim maestro test .maestro/login.yaml
|
|
59
|
+
appId: com.example.app
|
|
60
|
+
---
|
|
61
|
+
- launchApp
|
|
62
|
+
- tapOn:
|
|
63
|
+
id: "email"
|
|
64
|
+
- inputText: "user@example.com"
|
|
65
|
+
- tapOn:
|
|
66
|
+
id: "password"
|
|
67
|
+
- inputText: "secret123"
|
|
68
|
+
- tapOn: "Sign in"
|
|
69
|
+
- assertVisible: "Welcome"
|
|
70
|
+
`,"utf8"),console.log(` + wrote ${e}`),console.log(" next: bun sootsim maestro test .maestro/login.yaml"),0)}async function F(t,r={}){if(t.includes("--help")||t.includes("-h"))return b(),0;if(t.includes("--list-compat"))return x(),0;let e;try{e=S(t)}catch(n){return console.error(` error: ${n.message}`),1}e=$(e);let o=process.cwd(),a=e[0];if(a==="init")return E(o);let s=null,p;if(a==="test"){let n=e.slice(1).find(c=>!w(c));n?(s=l.resolve(o,n),p=e.slice(1).filter(c=>c!==n)):(s=g(o),p=e.slice(1))}else a&&!w(a)?(s=l.resolve(o,a),p=e.slice(1)):(s=g(o),p=e);if(!s)return console.error(`
|
|
71
|
+
error: no maestro flows found.
|
|
72
|
+
expected one of: ${y.map(n=>`./${n}/`).join(", ")}
|
|
73
|
+
or pass a flow explicitly: bun sootsim maestro test path/to/flow.yaml
|
|
74
|
+
or scaffold a starter flow: bun sootsim maestro init
|
|
75
|
+
`),1;if(!i.existsSync(s))return console.error(` error: ${s} not found`),1;let m;try{m=k(s)}catch(n){return console.error(` error: ${n.message}`),1}if(m.length===0)return console.error(` error: no *.yaml or *.yml files found in ${s}`),1;console.log(`
|
|
76
|
+
sootsim maestro \u2014 ${m.length} flow${m.length===1?"":"s"}
|
|
77
|
+
root: ${l.relative(o,s)||"."}
|
|
78
|
+
`);let d=0,f=[];for(let n of m){console.log(`
|
|
79
|
+
\u25B6 ${l.relative(o,n)}`);let c=[n,...p];r.port&&!p.includes("--url")&&c.push("--url",String(r.port));let u=0;try{u=await h(c)}catch(v){console.error(` x ${v.message}`),u=1}f.push({file:n,exit:u}),u!==0&&d===0&&(d=u)}if(m.length>1){console.log(`
|
|
80
|
+
maestro summary:`);for(let c of f){let u=c.exit===0?"pass":"fail";console.log(` ${u} ${l.relative(o,c.file)}`)}let n=f.filter(c=>c.exit===0).length;console.log(` ${n}/${f.length} passed`)}return d}export{F as runMaestro};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-B3RAGRK6.js";import{resolve as c,dirname as m}from"path";import{fileURLToPath as a}from"url";var t=m(a(import.meta.resolve("sootsim-engine/package.json")));async function g(o,r){(o.includes("--help")||o.includes("-h"))&&(console.log(`
|
|
3
3
|
sootsim preview \u2014 production-like preview
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as s,c as i,d as t,e as n,f as c}from"./chunk-WLIVBPPY.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";function f(){console.log(`
|
|
3
|
+
sootsim profile \u2014 manage isolated storage profiles
|
|
4
|
+
|
|
5
|
+
usage:
|
|
6
|
+
sootsim profile ls
|
|
7
|
+
sootsim profile create <id>
|
|
8
|
+
sootsim profile clear <id>
|
|
9
|
+
sootsim profile delete <id>
|
|
10
|
+
|
|
11
|
+
profiles isolate cookies, localStorage, IndexedDB, cache, permissions, and
|
|
12
|
+
service workers in Electron and Playwright launches. Plain browser-tab launches
|
|
13
|
+
cannot honor profiles and will fail clearly if a profile is requested.
|
|
14
|
+
|
|
15
|
+
examples:
|
|
16
|
+
sootsim profile ls
|
|
17
|
+
sootsim profile create qa
|
|
18
|
+
sootsim open 8081 --profile qa
|
|
19
|
+
sootsim open 8081 --profile qa --driver playwright
|
|
20
|
+
sootsim profile clear qa
|
|
21
|
+
sootsim profile delete qa
|
|
22
|
+
`)}async function d(o,a){if(o.includes("--help")||o.includes("-h"))return f(),0;let l=o[0]??"ls";try{switch(l){case"ls":case"list":{let e=s();for(let r of e)console.log(` ${r.id}`);return 0}case"create":{let e=o[1];if(!e)return console.error(" profile create expects <id>"),1;let r=t(e);return console.log(` created profile: ${r.id}`),0}case"ensure":{let e=o[1];if(!e)return console.error(" profile ensure expects <id>"),1;let r=i(e);return console.log(` profile: ${r.id}`),0}case"clear":{let e=o[1];return e?(i(e),c(e),console.log(` cleared profile: ${e}`),0):(console.error(" profile clear expects <id>"),1)}case"delete":case"rm":{let e=o[1];if(!e)return console.error(" profile delete expects <id>"),1;let r=n(e);return console.log(` deleted profile: ${r.id}`),0}default:return console.error(` unknown profile command: ${l}`),f(),1}}catch(e){return console.error(` profile failed: ${e instanceof Error?e.message:String(e)}`),1}}export{d as runProfile};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as w,e as b,h as m,i as f}from"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";function h(){console.log(`
|
|
3
|
+
sootsim react \u2014 inspect React component render cost in the tenant worker
|
|
4
|
+
|
|
5
|
+
usage:
|
|
6
|
+
sootsim react profile start [--include-props] [--max-commits N]
|
|
7
|
+
sootsim react profile stop
|
|
8
|
+
sootsim react summary [--limit 10] [--json]
|
|
9
|
+
sootsim react slow [--limit 5] [--json]
|
|
10
|
+
sootsim react rerenders [--limit 5] [--json]
|
|
11
|
+
sootsim react tree [--depth 3] [--find <name>] [--json]
|
|
12
|
+
sootsim react why <fiber-id> [--json]
|
|
13
|
+
|
|
14
|
+
\`react summary\` is the demo-friendly shortcut: it runs both slow and
|
|
15
|
+
rerenders in one round-trip, prints them as a single table per side,
|
|
16
|
+
and surfaces the duration-zero warning prominently when the bundle is
|
|
17
|
+
running without React profiler timers.
|
|
18
|
+
|
|
19
|
+
examples:
|
|
20
|
+
sootsim react profile start
|
|
21
|
+
sootsim do tap-text Inbox
|
|
22
|
+
sootsim react profile stop
|
|
23
|
+
sootsim react summary --limit 10
|
|
24
|
+
sootsim react slow --limit 10
|
|
25
|
+
sootsim react rerenders --json
|
|
26
|
+
`)}function R(r,o){let e=r.indexOf(o);if(e>=0&&e+1<r.length)return r[e+1];let n=`${o}=`,t=r.find(s=>s.startsWith(n));return t?t.slice(n.length):void 0}function u(r,o,e){let n=R(r,o);if(n===void 0)return e;let t=Number(n);return Number.isFinite(t)&&t>0?Math.round(t):e}function S(r,o){let e=r.map((t,s)=>Math.max(t.length,...o.map(a=>a[s]?.length??0))),n=t=>t.map((s,a)=>s.padEnd(e[a])).join(" ").trimEnd();return[n(r),n(r.map(t=>"-".repeat(t.length))),...o.map(n)].map(t=>` ${t}`).join(`
|
|
27
|
+
`)}function c(r){console.log(JSON.stringify(r,null,2))}function $(r){r.error&&console.error(` warning: ${r.error}`),r.durationWarning&&console.error(` warning: ${r.durationWarning}`);let o=r.rows??[];if(o.length===0){console.log(` no React render samples yet (${r.commits??0} commit(s))`);return}console.log(S(["component","total","avg","commits","slowest"],o.map(e=>[e.displayName,`${e.totalMs.toFixed(2)}ms`,`${e.avgMs.toFixed(2)}ms`,String(e.commitCount),`#${e.slowestCommit} ${e.slowestMs.toFixed(2)}ms`])))}function y(r){r.error&&console.error(` warning: ${r.error}`);let o=r.rows??[];if(o.length===0){console.log(` no React render samples yet (${r.commits??0} commit(s))`);return}console.log(S(["component","renders","causes"],o.map(e=>{let n=Object.entries(e.causes??{}).filter(([,t])=>t>0).sort((t,s)=>s[1]-t[1]).slice(0,4).map(([t,s])=>`${t}:${s}`).join(", ");return[e.displayName,String(e.renders??e.count),n||"-"]})))}function x(r){r.error&&console.error(` warning: ${r.error}`);let o=r.rows??[];if(o.length===0){console.log(` no React tree data yet (${r.roots??0} root(s))`);return}for(let e of o){let n=" ".repeat(e.depth);console.log(` ${n}@${e.id} ${e.displayName} [${e.kind}] children=${e.childCount}`)}}function j(r){if(r.error){console.error(` ${r.error}`);return}let o=r.sample;if(!o){console.log(" no sample");return}if(console.log(` @${o.fiberId} ${o.displayName}`),console.log(` duration: ${Number(o.actualDuration??0).toFixed(2)}ms`),console.log(` causes: ${(o.causes??[]).join(", ")||"-"}`),o.propDiffs?.length){console.log(" props:");for(let e of o.propDiffs){let n="old"in e||"new"in e?` ${JSON.stringify(e.old)} \u2192 ${JSON.stringify(e.new)}`:"";console.log(` ${e.key}${n}`)}}o.parentChain?.length&&console.log(` parents: ${o.parentChain.join(" \u2190 ")}`)}async function W(r,o){let e=w(r,{port:o.port,stripBooleanFlags:["--json","--include-props","--help","-h"],stripValueFlags:["--limit","--depth","--find","--max-commits"]});if(r.includes("--help")||r.includes("-h"))return h(),0;let[n,t]=e.positional,s=r.includes("--json"),a=b(e);try{if(n==="profile"&&t==="start"){let i=await f(a,"SootSim.bridges.reactProfile.start",{includeProps:r.includes("--include-props"),maxCommits:u(r,"--max-commits",2e3)});return s?c(i):console.log(" React profile started"),0}if(n==="profile"&&t==="stop"){let i=await f(a,"SootSim.bridges.reactProfile.stop");return s?c(i):(console.log(` React profile stopped (${i.commits??0} commit(s))`),i.error&&console.error(` warning: ${i.error}`)),i.error?1:0}if(n==="summary"){let i=u(r,"--limit",10),[l,d]=await Promise.all([m(a,"SootSim.bridges.reactProfile.slow",{limit:i}),m(a,"SootSim.bridges.reactProfile.rerenders",{limit:i})]);if(s)return c({commits:l.commits??d.commits??0,slow:l,rerenders:d}),0;let N=l.commits??d.commits??0;console.log(` React profile summary (${N} commit(s)):`),l.error&&console.error(` warning: ${l.error}`),l.durationWarning&&console.error(` warning: ${l.durationWarning}`),d.error&&console.error(` warning: ${d.error}`),console.log(`
|
|
28
|
+
slowest renders:`),$(l),console.log(`
|
|
29
|
+
most rerenders:`),y(d);let p=l.rows?.[0];return l.rows&&l.rows.length>0&&l.rows.every(g=>g.totalMs<=0&&g.slowestMs<=0)&&!l.durationWarning&&console.error(`
|
|
30
|
+
warning: every commit reports actualDuration=0ms \u2014 the React profiler timer is disabled in this bundle (rerender counts are still accurate; ${p?.displayName?`top-listed: ${p.displayName}`:"no slow signal"}).`),0}if(n==="slow"){let i=await m(a,"SootSim.bridges.reactProfile.slow",{limit:u(r,"--limit",10)});return s?c(i):$(i),0}if(n==="rerenders"){let i=await m(a,"SootSim.bridges.reactProfile.rerenders",{limit:u(r,"--limit",10)});return s?c(i):y(i),0}if(n==="tree"){let i=await m(a,"SootSim.bridges.reactProfile.tree",{depth:u(r,"--depth",3),find:R(r,"--find")});return s?c(i):x(i),0}if(n==="why"){let i=Number(t);if(!Number.isFinite(i)||i<=0)return console.error(" usage: sootsim react why <fiber-id>"),1;let l=await m(a,"SootSim.bridges.reactProfile.why",Math.round(i));return s?c(l):j(l),l.error?1:0}return h(),n?1:0}finally{a.close()}}export{W as runReact};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as z}from"./chunk-
|
|
3
|
-
sootsim record \u2014 capture the running
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as z}from"./chunk-RLNIKWFO.js";import"./chunk-CX3ZIPD3.js";import"./chunk-JMU5IGIU.js";import"./chunk-WFXYY3DU.js";import{d as W}from"./chunk-4IO3D5XG.js";import{c as R,e as $}from"./chunk-ZERYEI3L.js";import{b as C}from"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";import{existsSync as Z,mkdirSync as _,readFileSync as ee,rmSync as L,writeFileSync as U}from"fs";import{tmpdir as oe}from"os";import{dirname as T,extname as re,join as te,resolve as O}from"path";var D=6e4;async function ve(e,r){if((e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
3
|
+
sootsim record \u2014 capture the running sim
|
|
4
4
|
|
|
5
5
|
usage:
|
|
6
6
|
sootsim record [options] one-shot capture (duration-bounded)
|
|
@@ -22,7 +22,7 @@ options:
|
|
|
22
22
|
toasts) \u2014 records the tenant surfaces only
|
|
23
23
|
--shell-only record only the shell chrome
|
|
24
24
|
--open open the preview URL in the browser after stop (live/combined)
|
|
25
|
-
--
|
|
25
|
+
--sim <sim> target a specific sim
|
|
26
26
|
|
|
27
27
|
examples:
|
|
28
28
|
sootsim record # webm, 10s, ./sootsim-<ts>.webm
|
|
@@ -34,4 +34,4 @@ examples:
|
|
|
34
34
|
sootsim record start --mode combined # start preview-share recording
|
|
35
35
|
sootsim record stop --output flow.mp4 # finalize video
|
|
36
36
|
sootsim record stop --open # finalize live/combined + open URL
|
|
37
|
-
`),process.exit(0)),e[0]==="start"){await ae(e.slice(1),r);return}if(e[0]==="stop"){await le(e.slice(1),r);return}if(e[0]==="cancel"){await ce(e.slice(1),r);return}if(e[0]==="status"){de();return}let o=R(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width"]}),t=V(c(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,i=c(e,"--format"),s=c(e,"--output"),a=Number(c(e,"--duration")??"10"),l=Number(c(e,"--fps")??"30"),d=c(e,"--frames"),w=e.includes("--open"),h=c(e,"--max-width")?Number(c(e,"--max-width")):void 0,v=Math.max(100,Math.round(a*1e3));if(await z("record"),t==="live"||t==="combined"){let u=$({...o,commandTimeoutMs:6e4});try{await j(u),await K(u,t)||(console.error(` start failed: recording store refused to start (${t})`),process.exit(1)),console.log(` recording ${t} for ${a}s`),await new Promise(y=>setTimeout(y,v)),await G(u);let k=await H(u);Q(k,w)}finally{u.close()}return}let M=d?Number(d):null,S=se(i,s,M),p=$({...o,commandTimeoutMs:6e4});try{if(await J(p),S==="png"){let b=M??10,f=O(process.cwd(),s??`./sootsim-frames-${B()}`);_(f,{recursive:!0}),console.log(` sampling ${b} frames over ${a}s \u2192 ${f}`);let g=await p.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${b}, durationMs: ${v} })`});(!g.ok||!g.requestId)&&(console.error(` frame capture start failed: ${g.error??"unknown error"}`),process.exit(1)),await new Promise(m=>setTimeout(m,v));let X=Date.now()+Math.max(5e3,v),A=null;for(;;){let m=await p.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${g.requestId})`});if(m||(console.error(" frame capture result missing"),process.exit(1)),m.done){m.ok||(console.error(` frame capture failed: ${m.error??"unknown error"}`),process.exit(1)),A=m.frames??[];break}Date.now()>=X&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(E=>setTimeout(E,100))}A.forEach((m,E)=>{let Y=`${f}/frame-${String(E+1).padStart(3,"0")}.png`;U(Y,Buffer.from(m.data,"base64"))}),console.log(` saved ${A.length} frames`);return}if(S==="gif"){let b=M??Math.max(10,Math.round(a*l/3)),f=O(process.cwd(),s??`./sootsim-${B()}.gif`);_(T(f),{recursive:!0}),console.log(` encoding gif: ${b} frames over ${a}s \u2192 ${f}`);let g=await p.send({type:"evaluate",code:`window.__sootsimRecorder.captureGif({ frames: ${b}, durationMs: ${v}${h?`, maxWidth: ${h}`:""} })`});g||(console.error(" gif capture returned no frames"),process.exit(1)),U(f,Buffer.from(g.data,"base64")),console.log(` saved: ${f} (${P(g.size)})`);return}let u=O(process.cwd(),s??`./sootsim-${B()}.${S}`);_(T(u),{recursive:!0});let I={format:S,fps:l};n&&(I.layers=n);let k=await p.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(I)})`});k.ok||(console.error(` start failed: ${k.error??"unknown error"}`),process.exit(1)),console.log(` recording ${S} for ${a}s \u2192 ${u}`),await new Promise(b=>setTimeout(b,v));let y=await p.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});y.ok||(console.error(` stop failed: ${y.error??"unknown error"}`),process.exit(1)),y.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await q(p,u),console.log(` saved: ${u} (${P(y.size)})`)}finally{p.close()}}async function J(e){if(!await e.send({type:"evaluate",code:'typeof window.__sootsimRecorder !== "undefined"'}))throw new Error("window.__sootsimRecorder missing \u2014 is sootsim engine running in this
|
|
37
|
+
`),process.exit(0)),e[0]==="start"){await ae(e.slice(1),r);return}if(e[0]==="stop"){await le(e.slice(1),r);return}if(e[0]==="cancel"){await ce(e.slice(1),r);return}if(e[0]==="status"){de();return}let o=R(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width"]}),t=V(c(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,i=c(e,"--format"),s=c(e,"--output"),a=Number(c(e,"--duration")??"10"),l=Number(c(e,"--fps")??"30"),d=c(e,"--frames"),w=e.includes("--open"),h=c(e,"--max-width")?Number(c(e,"--max-width")):void 0,v=Math.max(100,Math.round(a*1e3));if(await z("record"),t==="live"||t==="combined"){let u=$({...o,commandTimeoutMs:6e4});try{await j(u),await K(u,t)||(console.error(` start failed: recording store refused to start (${t})`),process.exit(1)),console.log(` recording ${t} for ${a}s`),await new Promise(y=>setTimeout(y,v)),await G(u);let k=await H(u);Q(k,w)}finally{u.close()}return}let M=d?Number(d):null,S=se(i,s,M),p=$({...o,commandTimeoutMs:6e4});try{if(await J(p),S==="png"){let b=M??10,f=O(process.cwd(),s??`./sootsim-frames-${B()}`);_(f,{recursive:!0}),console.log(` sampling ${b} frames over ${a}s \u2192 ${f}`);let g=await p.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${b}, durationMs: ${v} })`});(!g.ok||!g.requestId)&&(console.error(` frame capture start failed: ${g.error??"unknown error"}`),process.exit(1)),await new Promise(m=>setTimeout(m,v));let X=Date.now()+Math.max(5e3,v),A=null;for(;;){let m=await p.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${g.requestId})`});if(m||(console.error(" frame capture result missing"),process.exit(1)),m.done){m.ok||(console.error(` frame capture failed: ${m.error??"unknown error"}`),process.exit(1)),A=m.frames??[];break}Date.now()>=X&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(E=>setTimeout(E,100))}A.forEach((m,E)=>{let Y=`${f}/frame-${String(E+1).padStart(3,"0")}.png`;U(Y,Buffer.from(m.data,"base64"))}),console.log(` saved ${A.length} frames`);return}if(S==="gif"){let b=M??Math.max(10,Math.round(a*l/3)),f=O(process.cwd(),s??`./sootsim-${B()}.gif`);_(T(f),{recursive:!0}),console.log(` encoding gif: ${b} frames over ${a}s \u2192 ${f}`);let g=await p.send({type:"evaluate",code:`window.__sootsimRecorder.captureGif({ frames: ${b}, durationMs: ${v}${h?`, maxWidth: ${h}`:""} })`});g||(console.error(" gif capture returned no frames"),process.exit(1)),U(f,Buffer.from(g.data,"base64")),console.log(` saved: ${f} (${P(g.size)})`);return}let u=O(process.cwd(),s??`./sootsim-${B()}.${S}`);_(T(u),{recursive:!0});let I={format:S,fps:l};n&&(I.layers=n);let k=await p.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(I)})`});k.ok||(console.error(` start failed: ${k.error??"unknown error"}`),process.exit(1)),console.log(` recording ${S} for ${a}s \u2192 ${u}`),await new Promise(b=>setTimeout(b,v));let y=await p.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});y.ok||(console.error(` stop failed: ${y.error??"unknown error"}`),process.exit(1)),y.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await q(p,u),console.log(` saved: ${u} (${P(y.size)})`)}finally{p.close()}}async function J(e){if(!await e.send({type:"evaluate",code:'typeof window.__sootsimRecorder !== "undefined"'}))throw new Error("window.__sootsimRecorder missing \u2014 is sootsim engine running in this sim?")}async function q(e,r){let o=[],t=0;for(;;){let n=await e.send({type:"evaluate",code:`window.__sootsimRecorder.getBlobBase64({ offset: ${t}, chunk: 2097152 })`});if(!n)throw new Error("no blob available on recorder");if(o.push(Buffer.from(n.data,"base64")),t=n.offset,n.done)break}U(r,Buffer.concat(o))}function c(e,r){let o=e.indexOf(r);if(!(o<0||o===e.length-1))return e[o+1]}function ne(e){if(!e)return;let r=re(e).toLowerCase().replace(/^\./,"");if(r==="webm"||r==="mp4"||r==="gif")return r;if(r==="png")return"png"}function se(e,r,o){return e||(o!=null?"png":ne(r)??"webm")}function B(){return new Date().toISOString().replace(/[:T]/g,"-").replace(/\..+/,"")}function P(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(2)}MB`}function V(e){if(!e)return"video";if(e==="video"||e==="live"||e==="combined")return e;console.error(` invalid --mode "${e}" \u2014 expected video | live | combined`),process.exit(1)}function N(){return te(oe(),`sootsim-recording-${C()}.json`)}function F(){let e=N();if(!Z(e))return null;try{return{mode:"video",...JSON.parse(ee(e,"utf8"))}}catch{return L(e,{force:!0}),null}}function ie(e){U(N(),JSON.stringify(e,null,2))}function x(){L(N(),{force:!0})}async function ae(e,r){let o=F();o&&(console.error(` recording already in progress (started ${o.startedAt}, sim ${o.simId??"?"}). run \`sootsim record stop\` first, or \`sootsim record cancel\` to discard.`),process.exit(1)),await z("record");let t=R(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only"],stripValueFlags:["--mode","--fps","--format","--max-width"]}),n=V(c(e,"--mode")),i=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=c(e,"--format"),a=s==="mp4"?"mp4":"webm";s&&a!==s&&(console.error(` record start only supports webm or mp4 (got: ${s}). for gif/png use atomic mode: sootsim record --format ${s} --duration <s>`),process.exit(1));let l=Number(c(e,"--fps")??"30"),d=$({...t,commandTimeoutMs:15e3});try{if(n==="live"||n==="combined")await j(d),await K(d,n)||(console.error(` start failed: recording store refused to start (${n})`),process.exit(1));else{await J(d);let w={format:a,fps:l};i&&(w.layers=i);let h=await d.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(w)})`});h.ok||(console.error(` start failed: ${h.error??"unknown error"}`),process.exit(1))}ie({simId:t.simId??null,mode:n,format:a,fps:l,layers:i,startedAt:new Date().toISOString()}),console.log(n==="video"?` recording ${a} @ ${l}fps${i?` (${i})`:""} \u2014 run \`sootsim record stop --output <path>\` when done`:` recording ${n} \u2014 run \`sootsim record stop\` when done (add --open to launch the preview URL)`)}finally{d.close()}}function de(){let e=F();if(!e){console.log(" no recording in progress");return}e.mode==="video"?console.log(` recording ${e.mode} (${e.format} @ ${e.fps}fps) on sim ${e.simId??"?"} since ${e.startedAt}`):console.log(` recording ${e.mode} on sim ${e.simId??"?"} since ${e.startedAt}`)}async function ce(e,r){let o=F();if(!o){console.log(" no recording in progress");return}let t=R(e,{port:r.port}),n=t.simId??o.simId??void 0,i=$({...t,simId:n,commandTimeoutMs:15e3});try{o.mode==="live"||o.mode==="combined"?await i.send({type:"evaluate",code:"void window.SootSim?.bridges?.cancelRecording?.()"}):await i.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"})}catch{}finally{x(),i.close()}console.log(" recording cancelled")}async function le(e,r){let o=F();o||(console.error(" no recording in progress. start one with `sootsim record start`."),process.exit(1));let t=R(e,{port:r.port,stripBooleanFlags:["--open"],stripValueFlags:["--output"]}),n=t.simId??o.simId??void 0,i=e.includes("--open"),s=$({...t,simId:n,commandTimeoutMs:6e4});try{if(o.mode==="live"||o.mode==="combined"){await G(s);let w=await H(s);x(),Q(w,i);return}let a=c(e,"--output"),l=O(process.cwd(),a??`./sootsim-${B()}.${o.format}`);_(T(l),{recursive:!0});let d=await s.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});d.ok||(console.error(` stop failed: ${d.error??"unknown error"}`),x(),process.exit(1)),d.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),x(),process.exit(1)),await q(s,l),x(),console.log(` saved: ${l} (${P(d.size)})`)}finally{s.close()}}async function j(e){if(!await e.send({type:"evaluate",code:'typeof window.SootSim?.bridges?.startRecording === "function" && typeof window.SootSim?.bridges?.stopRecording === "function"'}))throw new Error("SootSim.bridges.startRecording missing \u2014 is sootsim engine running in this sim?")}async function K(e,r){return await e.send({type:"evaluate",code:`window.SootSim.bridges.startRecording(${JSON.stringify(r)})`})===!0}async function G(e){await e.send({type:"evaluate",code:"void window.SootSim.bridges.stopRecording()"})}async function H(e){let r=Date.now()+D;for(;Date.now()<r;){let o=await e.send({type:"evaluate",code:"(() => { const s = window.SootSim?.bridges?.getRecordingState?.(); return s ? { state: s.state, lastUpload: s.lastUpload, uploadError: s.uploadError } : null })()"});if(o&&o.state==="idle"){if(o.uploadError)return{uploadError:o.uploadError};if(o.lastUpload?.previewUrl)return{previewUrl:o.lastUpload.previewUrl}}await new Promise(t=>setTimeout(t,300))}return{uploadError:`upload did not settle within ${D/1e3}s`}}function Q(e,r){e.uploadError&&(console.error(` upload failed: ${e.uploadError}`),process.exit(1)),e.previewUrl||(console.error(" upload returned no preview URL"),process.exit(1)),console.log(` preview: ${e.previewUrl}`),r&&W(e.previewUrl)}export{ne as extToFormat,se as resolveFormat,ve as runRecord,c as valueOf};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as p,b as w,c as $,d as y}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as p,b as w,c as $,d as y}from"./chunk-LDWXH43L.js";import{a as d}from"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import{A as g,B as f,i as h,y as m,z as a}from"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";import b from"fs";import{WebSocket as D}from"ws";async function P(n,e={}){let[o,...t]=n;if(!o||o==="--help"||o==="-h"){R();return}switch(o){case"install":return O(t,e);case"list":case"ls":return S(t);case"use":return T(t);case"remove":case"rm":return N(t);case"which":case"active":return F();default:console.error(` unknown runtime subcommand: ${o}`),R(),process.exit(1)}}function R(){console.log(`
|
|
3
3
|
sootsim runtime \u2014 manage engine runtimes under ~/.sootsim/runtimes/
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -22,4 +22,4 @@ examples:
|
|
|
22
22
|
sootsim runtime install 1.2.3
|
|
23
23
|
sootsim runtime install --channel beta
|
|
24
24
|
sootsim runtime use 1.2.3
|
|
25
|
-
`)}async function O(n,e){let{version:o,flags:t}=_(n),s=t.channel??e.channel??"stable",l=t.force===!0,c=t.setActive!==!1;m(),console.log("sootsim runtime install"),console.log(` cdn: ${w()}`);try{let i=await y({version:o,channel:s,force:l,setActive:c});console.log(` version: ${i.version} (channel: ${i.channel})`),i.installed?console.log(` installed ${i.version}`):console.log(` already installed at ${i.runtimeDir}`),c&&await k(i.version)}catch(i){console.error(` ${I(i)}`),process.exit(1)}}async function k(n){g(n),console.log(` active: ${n}`),await A(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function A(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-
|
|
25
|
+
`)}async function O(n,e){let{version:o,flags:t}=_(n),s=t.channel??e.channel??"stable",l=t.force===!0,c=t.setActive!==!1;m(),console.log("sootsim runtime install"),console.log(` cdn: ${w()}`);try{let i=await y({version:o,channel:s,force:l,setActive:c});console.log(` version: ${i.version} (channel: ${i.channel})`),i.installed?console.log(` installed ${i.version}`):console.log(` already installed at ${i.runtimeDir}`),c&&await k(i.version)}catch(i){console.error(` ${I(i)}`),process.exit(1)}}async function k(n){g(n),console.log(` active: ${n}`),await A(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function A(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-F5SGBTRZ.js"),t=o();if(!e(t))return!1;let s=d();return new Promise(l=>{let c=!1,i=!1,u=x=>{c||(c=!0,l(x))},r=new D(`ws://127.0.0.1:${s}`,{handshakeTimeout:800}),v=setTimeout(()=>{try{r.close()}catch{}u(i)},1500);r.on("open",()=>{try{r.send(JSON.stringify({type:"runtime:use",version:n,id:0})),i=!0}catch{}setTimeout(()=>{try{r.close()}catch{}},100)}),r.on("close",()=>{clearTimeout(v),u(i)}),r.on("error",()=>{clearTimeout(v),u(!1)})})}async function S(n){m();let e=f(),o=a();if(console.log("installed:"),e.length===0)console.log(" (none)");else for(let t of e)console.log(` ${t===o?"*":" "} ${t}`);try{let t=await $();console.log("available (latest per channel):");for(let[s,l]of Object.entries(t.channels))console.log(` ${s.padEnd(8)} ${l.latest}`)}catch(t){console.log(`available: (could not fetch manifest: ${I(t)})`)}}async function T(n){let e=n[0];e||(console.error(" usage: sootsim runtime use <version>"),process.exit(1));let o=f();o.includes(e)||(console.error(` version ${e} is not installed`),console.error(` installed: ${o.join(", ")||"(none)"}`),console.error(` run \`sootsim runtime install ${e}\` first`),process.exit(1)),await k(e)}async function N(n){let e=n[0];e||(console.error(" usage: sootsim runtime remove <version>"),process.exit(1)),a()===e&&(console.error(` cannot remove active runtime ${e}`),console.error(" switch with `sootsim runtime use <other>` first, or install another version"),process.exit(1));let t=h(e);if(!b.existsSync(t)){console.error(` ${e} is not installed`);return}b.rmSync(t,{recursive:!0,force:!0}),console.log(` removed ${e}`)}async function F(){let n=a();if(!n){console.log(" no active runtime");return}console.log(n)}function _(n){let e={},o=[];for(let t=0;t<n.length;t++){let s=n[t];if(s==="--channel"&&t+1<n.length){e.channel=n[t+1],t++;continue}if(s.startsWith("--channel=")){e.channel=s.slice(10);continue}if(s==="--force"){e.force=!0;continue}if(s==="--set-active=false"||s==="--no-set-active"){e.setActive=!1;continue}o.push(s)}return{version:o[0]??null,flags:e}}function I(n){return n instanceof Error?n.message:String(n)}export{P as runRuntime};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as x}from"./chunk-T5L73GJB.js";import{a as v}from"./chunk-WHLHA5R5.js";import"./chunk-SK4SOISL.js";import"./chunk-Z5SVSAZO.js";import"./chunk-RX6RHGSI.js";import{f as m}from"./chunk-56BIMCDH.js";import{c as h,d as g,e as w,h as y}from"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";import{mkdirSync as R,writeFileSync as S}from"fs";import{dirname as _,resolve as B}from"path";async function W(e,o){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
3
|
+
sootsim screenshot \u2014 capture the canvas as a PNG
|
|
4
|
+
|
|
5
|
+
usage:
|
|
6
|
+
sootsim screenshot [output] [options]
|
|
7
|
+
sootsim screenshot [options] --output <path>
|
|
8
|
+
|
|
9
|
+
options:
|
|
10
|
+
--output <path> output file path (default: /tmp/sootsim-inspect.png)
|
|
11
|
+
first positional arg works too: \`screenshot /tmp/x.png\`
|
|
12
|
+
--with-frame wrap the captured screen in a tight device frame
|
|
13
|
+
--no-frame capture the raw screen bitmap (default)
|
|
14
|
+
--no-shell exclude the simulated iOS chrome (status bar, keyboard,
|
|
15
|
+
toasts) \u2014 captures the tenant surfaces only
|
|
16
|
+
--shell-only capture only the shell chrome, no tenant content
|
|
17
|
+
--area x,y,w,h crop to a logical sootsim rect
|
|
18
|
+
--id <testID> crop to a node's bounding box
|
|
19
|
+
--text <text> crop to a node found by text content
|
|
20
|
+
--gallery crawl and capture multiple screens as HTML gallery
|
|
21
|
+
--themes capture light and dark variants
|
|
22
|
+
|
|
23
|
+
examples:
|
|
24
|
+
sootsim screenshot
|
|
25
|
+
sootsim screenshot --with-frame --output framed.png
|
|
26
|
+
sootsim screenshot --area 0,200,393,400 --output hero.png
|
|
27
|
+
sootsim screenshot --id loginButton --output button.png
|
|
28
|
+
`),process.exit(0));let t=G(e);if(t.length>0){for(let{flag:u,suggestion:p}of t)console.error(p?` unknown flag: ${u} (did you mean ${p}?)`:` unknown flag: ${u}`);console.error(" run `sootsim screenshot --help` for the list of supported flags"),process.exit(1)}let r=e.includes("--gallery"),a=e.includes("--themes"),n=M(e),l=L(e);if(r||a)return n&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),b(e,o);n&&e.some(u=>u==="--area"||u==="--id"||u==="--text")&&(console.error(" --with-frame only supports full-screen capture for now"),console.error(" remove --area / --id / --text, or capture raw and compose later"),process.exit(1));let s=h(e,{port:o.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only"],stripValueFlags:["--output","--area","--id","--text"]}),i=$(e),c=await P(e);if(await O(s.wsPort)){await T(s,i,c,n,l);return}n&&(console.error(" --with-frame requires a running sootsim bridge"),console.error(" open the app in a live sim first, then rerun the command"),process.exit(1)),c&&(console.error(" --area / --id / --text require a running sootsim bridge"),console.error(" start one with `sootsim server`, `sootsim electron`, or your project dev server"),process.exit(1)),await b(e,o)}async function O(e){let o=g(e,{commandTimeoutMs:1e3});try{return await o.listSims(),!0}catch{return!1}finally{o.close()}}async function P(e){let o=e.find((a,n)=>e[n-1]==="--area");if(o){let a=o.split(",").map(c=>Number(c.trim()));if(a.length!==4||a.some(c=>!Number.isFinite(c)))throw new Error(`--area expects x,y,w,h (got "${o}")`);let[n,l,s,i]=a;return{x:n,y:l,w:s,h:i}}let t=e.find((a,n)=>e[n-1]==="--id"),r=e.find((a,n)=>e[n-1]==="--text");return t||r?{__matcher:{id:t,text:r}}:null}async function T(e,o,t,r,a){let n=w({...e,commandTimeoutMs:1e4});try{let l=t,s=t?.__matcher;if(s){let d=await n.send({type:"evaluate",code:x(s)});if(!d)throw new Error(s.id?`no node with id "${s.id}"`:`no node matching text "${s.text}"`);l=d}let i=l?{x:l.x,y:l.y,w:l.w,h:l.h}:void 0,c={type:"screenshot"};a&&(c.layers=a),i&&(c.crop=i);let u=(await n.send(c)).replace(/^data:image\/png;base64,/,"");i&&console.log(` area: x=${i.x} y=${i.y} w=${i.w} h=${i.h}`),a&&console.log(` layers: ${a}`);let p=B(process.cwd(),o||"/tmp/sootsim-inspect.png");R(_(p),{recursive:!0});let f=Buffer.from(u,"base64");if(r){let d=await k(n);if(!d)throw new Error("could not read current device model from the target sim");let A=await v(f,d);S(p,A),console.log(` frame: ${d}`)}else S(p,f);console.log(` saved: ${p}`)}finally{n.close()}}async function k(e){let o=await y(e,"SootSim.bridges.settings.get")??{deviceModel:null},t=typeof o.deviceModel=="string"?o.deviceModel:null;return!t||!(t in m)?null:t}function M(e){let o=!1;for(let t of e)t==="--with-frame"&&(o=!0),t==="--no-frame"&&(o=!1);return o}function L(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var N=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--gallery","--themes"]),F=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),D={"--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area","--out":"--output","-o":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id"};function G(e){let o=[];for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){if(F.has(r)){t++;continue}N.has(r)||o.push({flag:r,suggestion:D[r]})}}return o}function $(e){let o=e.find((t,r)=>e[r-1]==="--output");if(o)return o;for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){F.has(r)&&t++;continue}return r}}async function b(e,o){let t=$(e)||"sootsim-screenshot.png",r=e.includes("--gallery"),a=e.find((s,i)=>e[i-1]==="--url")||`http://localhost:${o.port||5173}`,{chromium:n}=await import("playwright"),l=await n.launch({headless:!0});try{if(r)console.log(" capturing gallery..."),console.log(" (gallery mode not yet implemented)");else{let s=await l.newPage({viewport:{width:500,height:900}});await s.goto(a,{waitUntil:"networkidle"}),await s.waitForTimeout(2e3);let i=B(process.cwd(),t);R(_(i),{recursive:!0}),await s.screenshot({path:i}),console.log(` saved: ${i}`),await s.close()}}catch(s){console.error(` screenshot failed: ${s.message}`),process.exit(1)}finally{await l.close()}}export{W as runScreenshot};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as o}from"./chunk-URSEYCC5.js";import"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";async function n(e,s){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
3
|
+
sootsim screenshot-mode \u2014 toggle the screenshot-mode chrome overlay
|
|
4
|
+
|
|
5
|
+
usage:
|
|
6
|
+
sootsim screenshot-mode [on|off|toggle]
|
|
7
|
+
|
|
8
|
+
arguments:
|
|
9
|
+
on enable screenshot mode (enables showFrame if needed)
|
|
10
|
+
off disable screenshot mode
|
|
11
|
+
toggle flip the current state (default)
|
|
12
|
+
|
|
13
|
+
examples:
|
|
14
|
+
sootsim screenshot-mode
|
|
15
|
+
sootsim screenshot-mode on
|
|
16
|
+
sootsim screenshot-mode off
|
|
17
|
+
`),process.exit(0)),await o(e,s,{modeKey:"screenshotMode",displayName:"screenshot-mode",actionId:"toggle-screenshot-mode"})}export{n as runScreenshotMode};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*! sootsim v0.1.37 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as Y}from"./chunk-L4F4JRKJ.js";import"./chunk-ZBOIGEGO.js";import{b as j}from"./chunk-WHLHA5R5.js";import"./chunk-SK4SOISL.js";import"./chunk-RLNIKWFO.js";import{b as O}from"./chunk-DSTV2VJT.js";import"./chunk-2ZPJHSIJ.js";import"./chunk-QWKO62QM.js";import"./chunk-Z5X3PITK.js";import"./chunk-HYYMBXIX.js";import"./chunk-YFXTO4QX.js";import"./chunk-WLIVBPPY.js";import"./chunk-QD7YIVPS.js";import"./chunk-5FLDI6CV.js";import"./chunk-CX3ZIPD3.js";import"./chunk-JMU5IGIU.js";import"./chunk-Z5SVSAZO.js";import"./chunk-4OHVCGMF.js";import"./chunk-RX6RHGSI.js";import{a as w,b as D,c as k,d as z,e as x,f as T}from"./chunk-56BIMCDH.js";import"./chunk-S74RCIVB.js";import"./chunk-WFXYY3DU.js";import"./chunk-4IO3D5XG.js";import"./chunk-ZERYEI3L.js";import"./chunk-PERKPZ7T.js";import"./chunk-ERLA3F77.js";import"./chunk-PN6FWLD4.js";import"./chunk-B3RAGRK6.js";import{mkdirSync as B,readFileSync as pe,writeFileSync as G}from"fs";import{tmpdir as je}from"os";import C from"path";import{mkdirSync as I,readFileSync as Q,writeFileSync as H}from"fs";import F from"path";function _(e){return e.replace(/\\/g,"/").replace(/\.png$/i,"").trim().split("/").filter(Boolean).join("--").replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"slide"}function v(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function ee(e){let t=e.trim();return/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function M(e,t){let o=ee(e),i=Math.max(0,Math.min(1,t)),n=o.match(/^#([0-9a-f]{6})$/i);if(n){let s=n[1],r=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),u=Number.parseInt(s.slice(4,6),16);return`rgba(${r}, ${a}, ${u}, ${i})`}return o.startsWith("rgb(")?o.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):o}function te(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,o=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${o})`}function re(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${M(t,.46)} 0%, ${M(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function A(e){switch(e){case"tilted-left":return"perspective(2400px) rotateY(10deg) rotateZ(-2deg)";case"tilted-right":return"perspective(2400px) rotateY(-10deg) rotateZ(2deg)";case"cut-bottom":return"translateY(10%) scale(1.08)";case"cut-top":return"translateY(-16%) scale(1.08)";default:return"none"}}function L(...e){let t=e.map(o=>o.trim()).filter(o=>o.length>0&&o!=="none");return t.length>0?t.join(" "):"none"}function E(e){let t=M(e.color,e.opacity),o=M(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${o}) drop-shadow(0 0 ${e.blur}px ${t})`}function R(e,t){return!t.glow||e.color&&e.color!==w.color?e:{...e,color:t.glow}}function oe(e,t){if(e==="editorial-left"){let n=Math.round(t.height*.056),s=Math.round(t.height*.022);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.12)}px`,`left:${Math.round(t.width*.085)}px`,`width:${Math.round(t.width*.42)}px`,"text-align:left","z-index:3"].join(";"),titleStyle:`font-size:${n}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(r,a,u)=>{let p=Math.round(t.width*.68*(a.scale??r.scale)),l=Math.round(t.height*(.03+r.offsetY+(a.offsetY??0))),c=a.pose||r.pose||"tilted-right",m=R(r.shadow,u);return["position:absolute",`top:${Math.round(t.height*.18)+l}px`,`left:${Math.round(t.width*.56)}px`,`width:${p}px`,"transform-origin:center center",`transform:${A(c)}`,`filter:${E(m)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let n=Math.round(t.height*.041),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`left:${Math.round(t.width*.12)}px`,`right:${Math.round(t.width*.12)}px`,`bottom:${Math.round(t.height*.085)}px`,"text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${n}px;line-height:0.96;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(r,a,u)=>{let p=Math.round(t.width*.84*(a.scale??r.scale)),l=Math.round(t.height*(r.offsetY+(a.offsetY??0))),c=a.pose||r.pose,m=R(r.shadow,u);return["position:absolute",`top:${Math.round(t.height*.075)+l}px`,"left:50%",`width:${p}px`,"transform-origin:center center",`transform:${L("translateX(-50%)",A(c))}`,`filter:${E(m)}`,"z-index:2"].join(";")}}}let o=Math.round(t.height*.04),i=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,s,r)=>{let a=t.name==="ipad-13"?.54:.64,u=Math.round(t.width*a*(s.scale??n.scale)),p=Math.round(t.height*(n.offsetY+(s.offsetY??0))),l=s.pose||n.pose,c=R(n.shadow,r);return["position:absolute",`top:${Math.round(t.height*(t.name==="ipad-13"?.25:.28))+p}px`,"left:50%",`width:${u}px`,"transform-origin:center top",`transform:${L("translateX(-50%)",A(l))}`,`filter:${E(c)}`,"z-index:2"].join(";")}}}function ne({canvas:e,compose:t,slide:o,imageDataUrl:i}){let n=o.background??t.background,s=oe(t.text.preset,e),r=t.text.preset!=="none"&&!!(o.eyebrow||o.headline||o.subheadline),a=s.deviceStyle(t.frame,o,n),u=o.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${v(o.headline)}</div>`:"",p=o.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${s.subStyle}">${v(o.subheadline)}</div>`:"",l=o.eyebrow?`<div style="display:flex;${s.eyebrowStyle}margin-bottom:${Math.round(e.height*.016)}px;"><div style="font-size:${Math.round(e.height*.014)}px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;color:${t.text.eyebrowColor};">${v(o.eyebrow)}</div></div>`:"";return`<!doctype html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<style>
|
|
7
|
+
html, body {
|
|
8
|
+
margin: 0;
|
|
9
|
+
width: ${e.width}px;
|
|
10
|
+
height: ${e.height}px;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
background: transparent;
|
|
13
|
+
}
|
|
14
|
+
body {
|
|
15
|
+
font-family: "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
|
|
16
|
+
}
|
|
17
|
+
#canvas {
|
|
18
|
+
position: relative;
|
|
19
|
+
width: ${e.width}px;
|
|
20
|
+
height: ${e.height}px;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
background: ${te(n)};
|
|
23
|
+
color: ${t.text.color};
|
|
24
|
+
isolation: isolate;
|
|
25
|
+
}
|
|
26
|
+
#glow {
|
|
27
|
+
position: absolute;
|
|
28
|
+
inset: 0;
|
|
29
|
+
background: ${re(n)};
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
}
|
|
32
|
+
#copy {
|
|
33
|
+
${s.copyStyle};
|
|
34
|
+
}
|
|
35
|
+
#device {
|
|
36
|
+
${a};
|
|
37
|
+
}
|
|
38
|
+
#device img {
|
|
39
|
+
display: block;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: auto;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
<div id="canvas">
|
|
47
|
+
<div id="glow"></div>
|
|
48
|
+
${r?`<div id="copy">${l}${u}${p}</div>`:""}
|
|
49
|
+
<div id="device"><img src="${i}" alt="" /></div>
|
|
50
|
+
</div>
|
|
51
|
+
</body>
|
|
52
|
+
</html>`}async function U(e,t,o){let i=[],n=o??await(async()=>{let{chromium:r}=await import("playwright");return r.launch({headless:!0})})();try{let r=await n.newContext({viewport:{width:1280,height:720}});try{for(let a of t){let p=`data:image/png;base64,${Q(a.imagePath).toString("base64")}`;for(let l of e.canvases){let c=await r.newPage();try{await c.setViewportSize({width:l.width,height:l.height}),await c.setContent(ne({canvas:l,compose:e,slide:a.slide,imageDataUrl:p}),{waitUntil:"load"}),await c.waitForTimeout(20);let m=F.join(e.outDir,l.name,e.locale);I(m,{recursive:!0});let f=F.join(m,`${a.slide.assetKey}.png`),P=await c.screenshot({type:"png",clip:{x:0,y:0,width:l.width,height:l.height}});H(f,P),i.push({slideId:a.slide.id,canvas:l.name,locale:e.locale,outputPath:f,sourcePath:a.imagePath})}finally{await c.close()}}}}finally{await r.close()}}finally{!o&&typeof n.close=="function"&&await n.close()}I(e.outDir,{recursive:!0});let s=F.join(e.outDir,"manifest.json");return H(s,JSON.stringify({generatedAt:new Date().toISOString(),locale:e.locale,outputs:i},null,2)),{manifestPath:s,outputs:i.map(r=>r.outputPath),entries:i}}import{readFileSync as se}from"fs";import y from"path";function d(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function $(e,t){if(!d(e))throw new Error(`${t} must be an object`);return e}function h(e,t=""){return typeof e=="string"?e:t}function g(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function K(e,t){return typeof e=="boolean"?e:t}function S(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function q(e,t){return typeof e!="string"||e.trim().length===0?t:Object.prototype.hasOwnProperty.call(T,e)?e:null}function W(e,t){if(typeof e=="string"){let n=x(e);if(!n)throw new Error(`unknown background preset: ${e}`);return n}if(!d(e))return z(t);let o=e.type==="solid"||e.type==="gradient"?e.type:t.type;if(o==="solid")return{type:o,color:h(e.color,t.color??"#000000"),glow:g(e.glow)??t.glow};let i=Array.isArray(e.stops)?e.stops.map(n=>{if(!d(n))return null;let s=S(n.offset,Number.NaN),r=g(n.color);return!Number.isFinite(s)||!r?null:{offset:s,color:r}}).filter(n=>!!n):t.stops?.map(n=>({...n}))??[];return{type:o,direction:S(e.direction,t.direction??180),glow:g(e.glow)??t.glow,stops:i.length>0?i:t.stops?.map(n=>({...n}))??[]}}function ie(e){let o=(Array.isArray(e)?e:["iphone-6-9"]).map(i=>{if(typeof i!="string")throw new Error("compose.canvases entries must be strings");let n=k(i);if(!n)throw new Error(`unknown canvas preset: ${i}`);return n});if(o.length===0)throw new Error("compose.canvases must include at least one preset");return o}function ae(e){switch(e){case"editorial-left":case"minimal-bottom":case"none":case"bold-top":return e;default:return"bold-top"}}function ce(e){switch(e){case"plan":case"flow":case"auto":return e;default:return"auto"}}function X(e){switch(e){case"straight":case"tilted-left":case"tilted-right":case"cut-bottom":case"cut-top":return e;default:return}}function b(e,t){return y.isAbsolute(t)?t:y.resolve(e,t)}function le(e,t){if(!Array.isArray(e)||e.length===0)throw new Error("compose.slides must be a non-empty array");return e.map((o,i)=>{let n=$(o,`compose.slides[${i}]`),s=g(n.screenshot);if(!s)throw new Error(`compose.slides[${i}].screenshot is required`);let r=g(n.id),a=_(r||s);return{id:r||a,assetKey:a,screenshot:s,headline:h(n.headline),subheadline:h(n.subheadline),eyebrow:h(n.eyebrow),pose:X(n.pose),scale:typeof n.scale=="number"&&Number.isFinite(n.scale)?n.scale:void 0,offsetY:typeof n.offsetY=="number"&&Number.isFinite(n.offsetY)?n.offsetY:void 0,background:n.theme||n.background?W(n.theme??n.background,t):void 0}})}function V(e){let t=y.resolve(e),o=y.dirname(t),i=O.parse(se(t,"utf8")),n=$(i,"screenshots plan"),s=$(n.capture??{},"capture"),r=$(n.compose??{},"compose"),a=typeof n.app=="number"?String(n.app):g(n.app),u=q(n.device,null),p=b(o,h(s.out,y.join(".sootsim","screenshots","capture"))),l=g(s.from),c=g(s.flow);if(!l&&!c)throw new Error("capture.flow or capture.from is required");let m=s.mode==="raw"||s.mode==="framed"||s.mode==="raw+framed"?s.mode:"raw+framed",f=ce(s.pathMode),P=W(r.background??"cyan",x("cyan")),J={show:K(r.frame&&d(r.frame)?r.frame.show:void 0,!0),style:q(r.frame&&d(r.frame)?r.frame.style:null,null)||u||D,pose:X(r.frame&&d(r.frame)?r.frame.pose:void 0)||"straight",scale:S(r.frame&&d(r.frame)?r.frame.scale:void 0,1),offsetY:S(r.frame&&d(r.frame)?r.frame.offsetY:void 0,0),shadow:{color:h(r.frame&&d(r.frame)&&d(r.frame.shadow)?r.frame.shadow.color:void 0,w.color),blur:S(r.frame&&d(r.frame)&&d(r.frame.shadow)?r.frame.shadow.blur:void 0,w.blur),spread:S(r.frame&&d(r.frame)&&d(r.frame.shadow)?r.frame.shadow.spread:void 0,w.spread),opacity:S(r.frame&&d(r.frame)&&d(r.frame.shadow)?r.frame.shadow.opacity:void 0,w.opacity)}};return{planPath:t,planDir:o,appTarget:a,deviceModel:u,capture:{flowPath:c?b(o,c):null,fromDir:l?b(o,l):null,outDir:p,rawDir:l?b(o,l):y.join(p,"raw"),framedDir:y.join(p,"framed"),mode:m,pathMode:f,simId:g(s.sim),openInNewSim:K(s.new,!1)},compose:{outDir:b(o,h(r.out,y.join(".sootsim","screenshots","exports"))),locale:h(r.locale,"en"),canvases:ie(r.canvases),frame:J,background:P,text:{preset:ae(r.text&&d(r.text)?r.text.preset:void 0),color:h(r.text&&d(r.text)?r.text.color:void 0,"#ffffff"),subColor:h(r.text&&d(r.text)?r.text.subColor:void 0,"rgba(232,240,247,0.86)"),eyebrowColor:h(r.text&&d(r.text)?r.text.eyebrowColor:void 0,"rgba(229,242,255,0.72)")},slides:le(r.slides,P)}}}function ue(e){return e.capture.pathMode==="plan"||e.capture.pathMode==="flow"?e.capture.pathMode:e.capture.fromDir?"flow":"plan"}function de(e,t){if(!e.capture.flowPath)throw new Error("capture flow path is required to build flow args");let o=[e.capture.flowPath],i=ue(e);o.push("--screenshots",e.capture.rawDir),i==="flow"&&o.push("--screenshot-paths","flow");let n=t.appTarget??e.appTarget,s=t.deviceModel??e.deviceModel,r=t.simId??e.capture.simId;return n&&o.push("--url",n),s&&o.push("--device",s),r&&o.push("--sim",r),e.capture.openInNewSim&&o.push("--new"),o}function N(e,t){return C.isAbsolute(t)?t:C.join(e.capture.rawDir,t)}function me(e){return C.join(e.capture.outDir,"manifest.json")}async function he(e,t){if(!e.capture.flowPath)return;B(e.capture.rawDir,{recursive:!0});let o=de(e,t),i=await Y(o);if(i!==0)throw new Error(`flow capture failed with exit code ${i}`)}async function fe(e,t){let o=new Map;B(e.capture.framedDir,{recursive:!0});let i=t??await(async()=>{let{chromium:n}=await import("playwright");return n.launch({headless:!0})})();try{let n=await j(i);try{for(let s of e.compose.slides){let r=N(e,s.screenshot),a=pe(r),u=await n.compose(a,e.compose.frame.style),p=C.join(e.capture.framedDir,`${s.assetKey}.png`);G(p,u),o.set(s.id,p)}}finally{await n.close()}}finally{!t&&typeof i.close=="function"&&await i.close()}return o}function ge(e,t,o){let i=[],n=[];B(e.capture.outDir,{recursive:!0});let s=me(e),r=e.compose.slides.map(a=>{let u=N(e,a.screenshot),p=t.get(a.id)??null;return i.push(u),p&&n.push(p),{id:a.id,screenshot:a.screenshot,rawPath:u,framedPath:p}});return G(s,JSON.stringify({generatedAt:new Date().toISOString(),deviceModel:o,mode:e.capture.mode,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,slides:r},null,2)),{manifestPath:s,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,rawFiles:i,framedFiles:n}}function we(e,t){return e.compose.slides.map(o=>({slide:o,imagePath:e.compose.frame.show===!0?t.get(o.id)??N(e,o.screenshot):N(e,o.screenshot)}))}async function Z(e,t={}){let o=V(e),i=t.deviceModel??o.deviceModel;t.composeOnly||await he(o,t);let n=o.capture.mode!=="raw"||!t.captureOnly&&o.compose.frame.show===!0,r=n||!t.captureOnly?await(async()=>{let{chromium:a}=await import("playwright");return a.launch({headless:!0})})():null;try{let a=n?await fe(o,r??void 0):new Map,u=ge(o,a,i);if(t.captureOnly)return{plan:o,capture:u,compose:null};let p=we(o,a),l=await U(o.compose,p,r??void 0);return{plan:o,capture:u,compose:l}}finally{r&&typeof r.close=="function"&&await r.close()}}async function qe(e,t={}){if(e.includes("--help")||e.includes("-h"))return console.log(`
|
|
53
|
+
sootsim screenshots \u2014 capture and compose app-store screenshot sets
|
|
54
|
+
|
|
55
|
+
usage:
|
|
56
|
+
sootsim screenshots --plan <plan.yaml> [options]
|
|
57
|
+
|
|
58
|
+
options:
|
|
59
|
+
--plan <path> screenshot plan yaml
|
|
60
|
+
--sim <id> reuse a live sim for capture
|
|
61
|
+
--app <target> override plan app target (port, url, or shell url)
|
|
62
|
+
--device <model> override plan capture device for this run
|
|
63
|
+
--capture-only stop after raw/framed intermediates
|
|
64
|
+
--compose-only skip flow capture, reuse existing raw screenshots
|
|
65
|
+
|
|
66
|
+
examples:
|
|
67
|
+
sootsim screenshots --plan app-store.yaml
|
|
68
|
+
sootsim screenshots --plan app-store.yaml --sim a9
|
|
69
|
+
sootsim screenshots --plan app-store.yaml --device iphone-14
|
|
70
|
+
`),0;let o=c=>e.find((m,f)=>e[f-1]===c),i=new Set(["--plan","--sim","--app","--device"]),n=e.filter((c,m)=>{if(c.startsWith("-"))return!1;let f=e[m-1];return!f||!i.has(f)}),s=o("--plan")||n[0];if(!s)return console.error(" error: screenshots plan path is required (`--plan <path>`)."),1;let r=o("--sim")?.trim()||null,a=o("--app")?.trim()||null,u=o("--device")?.trim()||null,p=e.includes("--capture-only"),l=e.includes("--compose-only");try{let c=await Z(s,{simId:r,appTarget:a,deviceModel:u,captureOnly:p,composeOnly:l});return console.log(` capture manifest: ${c.capture.manifestPath}`),c.compose?(console.log(` compose manifest: ${c.compose.manifestPath}`),console.log(` exports: ${c.compose.outputs.length}`)):console.log(" compose skipped"),0}catch(c){return console.error(` screenshots failed: ${c.message}`),1}}export{qe as runScreenshots};
|