sootsim 0.0.1

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 (62) hide show
  1. package/README.md +197 -0
  2. package/dist-cli/bin.js +29 -0
  3. package/dist-cli/chunks/bridge-host-2EY7Z4AO.js +2 -0
  4. package/dist-cli/chunks/chunk-3C3ZH7PP.js +4 -0
  5. package/dist-cli/chunks/chunk-3R4ZZESY.js +119 -0
  6. package/dist-cli/chunks/chunk-64TOMNZX.js +37 -0
  7. package/dist-cli/chunks/chunk-74XPLOV4.js +2 -0
  8. package/dist-cli/chunks/chunk-7LMDCMSI.js +8 -0
  9. package/dist-cli/chunks/chunk-7X6OPSRD.js +2 -0
  10. package/dist-cli/chunks/chunk-A2CZQIWO.js +1 -0
  11. package/dist-cli/chunks/chunk-CKZ376AY.js +322 -0
  12. package/dist-cli/chunks/chunk-E522F5JW.js +2 -0
  13. package/dist-cli/chunks/chunk-E5UBZEYR.js +2 -0
  14. package/dist-cli/chunks/chunk-G5MR66EB.js +180 -0
  15. package/dist-cli/chunks/chunk-GPVPHE2B.js +3 -0
  16. package/dist-cli/chunks/chunk-HOIHCO7S.js +3 -0
  17. package/dist-cli/chunks/chunk-J2S3OCWA.js +69 -0
  18. package/dist-cli/chunks/chunk-JSF5LPNT.js +176 -0
  19. package/dist-cli/chunks/chunk-KQWZZ56P.js +2 -0
  20. package/dist-cli/chunks/chunk-KSACMDXK.js +3 -0
  21. package/dist-cli/chunks/chunk-KSB6MSZ4.js +34 -0
  22. package/dist-cli/chunks/chunk-KXYKAYYB.js +51 -0
  23. package/dist-cli/chunks/chunk-MBFP2LVH.js +3 -0
  24. package/dist-cli/chunks/chunk-MPSZ5EWF.js +16 -0
  25. package/dist-cli/chunks/chunk-OROM7DZI.js +2 -0
  26. package/dist-cli/chunks/chunk-PWXPA745.js +3 -0
  27. package/dist-cli/chunks/chunk-QOBRRY5X.js +4 -0
  28. package/dist-cli/chunks/chunk-X2U72K7X.js +1 -0
  29. package/dist-cli/chunks/chunk-YCETS3B3.js +2 -0
  30. package/dist-cli/chunks/compat-MRN2ORY5.js +33 -0
  31. package/dist-cli/chunks/config-CO5IYWUY.js +45 -0
  32. package/dist-cli/chunks/control-Y7TKKB6D.js +2 -0
  33. package/dist-cli/chunks/daemon-G4XVRFHM.js +49 -0
  34. package/dist-cli/chunks/debug-ZNSZTWT6.js +182 -0
  35. package/dist-cli/chunks/detox-JEGYNTYV.js +49 -0
  36. package/dist-cli/chunks/dev-ZUKCZQEX.js +25 -0
  37. package/dist-cli/chunks/dev-checkout-IEZVVTCN.js +2 -0
  38. package/dist-cli/chunks/device-BS34FAFM.js +16 -0
  39. package/dist-cli/chunks/drivers-46PFFIDF.js +2 -0
  40. package/dist-cli/chunks/electron-P2KOPX2S.js +15 -0
  41. package/dist-cli/chunks/flow-VVOF6UNC.js +2 -0
  42. package/dist-cli/chunks/hints-7Z656W4H.js +2 -0
  43. package/dist-cli/chunks/inspect-NAHXP2M5.js +1042 -0
  44. package/dist-cli/chunks/install-EPUJX4AT.js +67 -0
  45. package/dist-cli/chunks/install-desktop-PYIZIH67.js +19 -0
  46. package/dist-cli/chunks/login-Z5Z54HUJ.js +26 -0
  47. package/dist-cli/chunks/logout-T2QDYGCB.js +2 -0
  48. package/dist-cli/chunks/maestro-4AXTS7OE.js +75 -0
  49. package/dist-cli/chunks/preview-NMGWHWMX.js +17 -0
  50. package/dist-cli/chunks/profile-6RGJA4FR.js +22 -0
  51. package/dist-cli/chunks/record-IE27Z2GA.js +37 -0
  52. package/dist-cli/chunks/screenshot-R3GCCSCI.js +26 -0
  53. package/dist-cli/chunks/screenshot-mode-SZQDNGYE.js +17 -0
  54. package/dist-cli/chunks/screenshots-4UQJE4NC.js +70 -0
  55. package/dist-cli/chunks/server-AN2G5KO4.js +21 -0
  56. package/dist-cli/chunks/skills-2PPKPL4B.js +10 -0
  57. package/dist-cli/chunks/store-PU5ES4YQ.js +2 -0
  58. package/dist-cli/chunks/test-5LFKOQ4M.js +31 -0
  59. package/dist-cli/chunks/upload-BYNPC54C.js +2 -0
  60. package/dist-cli/chunks/vite-plugin-5AEUUBKP.js +9 -0
  61. package/dist-cli/chunks/whoami-H6FW34JS.js +2 -0
  62. package/package.json +56 -0
@@ -0,0 +1,67 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as v,b as P}from"./chunk-QOBRRY5X.js";import"./chunk-E522F5JW.js";import{execSync as R}from"child_process";import{existsSync as w,readFileSync as j,writeFileSync as y}from"fs";import{resolve as u,relative as V}from"path";import{existsSync as a,readFileSync as h,readdirSync as E,statSync as F}from"fs";import{basename as W,dirname as J,join as c}from"path";function M(e){let n=e;for(;;){if(a(c(n,"turbo.json"))||a(c(n,"nx.json"))||a(c(n,"lerna.json"))||a(c(n,"pnpm-workspace.yaml")))return n;let r=c(n,"package.json");if(a(r))try{if(JSON.parse(h(r,"utf8")).workspaces)return n}catch{}let s=J(n);if(s===n)break;n=s}return e}function L(e){return a(c(e,"bun.lock"))||a(c(e,"bun.lockb"))?"bun":a(c(e,"pnpm-lock.yaml"))?"pnpm":a(c(e,"yarn.lock"))?"yarn":"npm"}function N(e){if(a(c(e,"turbo.json")))return"turbo";if(a(c(e,"nx.json")))return"nx";if(a(c(e,"pnpm-workspace.yaml")))return"pnpm";let n=c(e,"package.json");if(a(n))try{if(JSON.parse(h(n,"utf8")).workspaces)return"npm-workspaces"}catch{}return"single"}function T(e){return e.one?"one":e.expo?"expo":e["react-native"]?"bare":"unknown"}function b(e){let n=c(e,"package.json");if(!a(n))return null;let r;try{r=JSON.parse(h(n,"utf8"))}catch{return null}let s={...r.dependencies,...r.devDependencies},i=T(s);return i==="unknown"?null:{dir:e,name:r.name||W(e),framework:i,hasViteConfig:a(c(e,"vite.config.ts"))||a(c(e,"vite.config.js")),hasMetroConfig:a(c(e,"metro.config.js"))||a(c(e,"metro.config.ts")),devCommand:r.scripts?.dev||null}}function _(e){let n=[],r=c(e,"pnpm-workspace.yaml");if(a(r)){let o=h(r,"utf8").match(/packages:\s*\n((?:\s+-\s+.+\n?)+)/);if(o){let t=o[1].split(`
3
+ `).filter(Boolean);for(let f of t){let p=f.replace(/^\s*-\s*['"]?/,"").replace(/['"]?\s*$/,"");p&&n.push(...S(e,p))}}return n}let s=c(e,"package.json");if(a(s))try{let i=JSON.parse(h(s,"utf8")),o=Array.isArray(i.workspaces)?i.workspaces:i.workspaces?.packages||[];for(let t of o)n.push(...S(e,t))}catch{}return n}function S(e,n){let r=n.replace(/\/\*\*?$/,"").replace(/\*$/,""),s=c(e,r);if(!a(s))return[];try{return E(s).map(o=>c(s,o)).filter(o=>{try{return F(o).isDirectory()&&a(c(o,"package.json"))}catch{return!1}})}catch{return[]}}function D(e){let n=N(e),r=L(e);if(n==="single"){let t=b(e);return{root:e,type:n,packageManager:r,apps:t?[t]:[]}}let s=_(e),i=[],o=b(e);o&&i.push(o);for(let t of s){if(t===e)continue;let f=b(t);f&&i.push(f)}return{root:e,type:n,packageManager:r,apps:i}}function C(e){switch(e){case"bun":return"bun add -d sootsim";case"pnpm":return"pnpm add -D sootsim";case"yarn":return"yarn add -D sootsim";case"npm":return"npm install -D sootsim"}}async function re(e){(e.includes("--help")||e.includes("-h"))&&(console.log(`
4
+ sootsim install \u2014 set up sootsim in your project
5
+
6
+ detects your bundler (one, expo, metro), adds sootsim as a
7
+ dependency, configures the bundler plugin, and adds dev scripts.
8
+
9
+ usage:
10
+ sootsim install interactive setup
11
+ sootsim install --yes skip confirmations
12
+ sootsim install --dry-run show what would be done
13
+
14
+ works with monorepos (turbo, pnpm, nx) \u2014 scans for app packages.
15
+ `),process.exit(0));let n=e.includes("--yes")||e.includes("-y"),r=e.includes("--dry-run"),s=process.cwd(),i=M(s),o=D(i);console.log(`
16
+ sootsim \u2014 project setup
17
+ `),o.apps.length===0&&(console.log(" no react native apps found in this project."),console.log(` sootsim works with one, expo, and react-native projects.
18
+ `),process.exit(1));let t;if(o.type!=="single"&&o.apps.length>1){console.log(` monorepo detected (${o.type} + ${o.packageManager})
19
+ `);let g=await P("which app?",o.apps.map(l=>`${(V(i,l.dir)||".").padEnd(30)} (${l.framework})`));t=o.apps[g]}else t=o.apps[0];let f=t.framework==="one"?"metro (via one)":t.framework==="expo"?"metro (via expo)":"metro";console.log(" detected:"),console.log(` framework: ${t.framework}`),console.log(` bundler: ${f}`),console.log(` package: ${t.name}`),console.log(` manager: ${o.packageManager}`),console.log();let p=[],d=C(o.packageManager);p.push({label:"add sootsim as devDependency",run:()=>{R(d,{cwd:t.dir,stdio:"pipe"})}}),t.framework==="one"&&t.hasViteConfig?p.push({label:"add sootsimPlugin() to vite.config.ts",run:()=>$(t.dir)}):(t.framework==="expo"||t.framework==="bare")&&t.hasMetroConfig?p.push({label:"add withSootsim() to metro.config.js",run:()=>A(t.dir)}):t.framework==="one"?p.push({label:"add sootsimPlugin() to vite.config.ts",run:()=>$(t.dir)}):p.push({label:"create metro.config.js with withSootsim()",run:()=>B(t.dir,t.framework)});let m=t.framework==="one"?"one dev":t.devCommand||"expo start";p.push({label:'add "dev:sootsim" script to package.json',run:()=>G(t.dir,m)}),console.log(" will:"),p.forEach((g,l)=>console.log(` ${l+1}. ${g.label}`)),console.log(),r&&(console.log(` (dry run \u2014 no changes made)
20
+ `),process.exit(0)),n||(await v("continue?")||(console.log(`
21
+ cancelled.
22
+ `),process.exit(0)),console.log());for(let g=0;g<p.length;g++){let l=p[g];process.stdout.write(` [${g+1}/${p.length}] ${l.label}...`);try{l.run(),console.log(" done")}catch(x){console.log(` failed: ${x.message}`),(l.label.includes("vite.config")||l.label.includes("metro.config"))&&U(t)}}let k=o.packageManager==="bun"?"bun":o.packageManager;console.log(`
23
+ done! run:
24
+ ${k} run dev:sootsim
25
+
26
+ then open:
27
+ http://localhost:8081/__soot/
28
+ `)}function $(e){let n=u(e,"vite.config.ts")||u(e,"vite.config.js"),r=u(e,"vite.config.ts"),s=u(e,"vite.config.js"),i=w(r)?r:s;if(!w(i))throw new Error(`no vite config found at ${e}`);let o=j(i,"utf8");if(o.includes("sootsimPlugin")){console.log(" (already configured)");return}let t="import { sootsimPlugin } from 'sootsim/vite'",f=/^(import\s+.+)$/gm,p=0,d;for(;(d=f.exec(o))!==null;)p=d.index+d[0].length;p>0?o=o.slice(0,p)+`
29
+ `+t+o.slice(p):o=t+`
30
+ `+o;let m=o.match(/plugins\s*:\s*\[/);if(m&&m.index!==void 0){let k=m.index+m[0].length,g=1,l=k;for(;l<o.length&&g>0;)o[l]==="["&&g++,o[l]==="]"&&g--,g>0&&l++;let x=o.slice(0,l),O=o.slice(l),q=o.slice(k).match(/\n(\s+)\S/)?.[1]||" ",I=o.slice(o.lastIndexOf(`
31
+ `,l),l+1).match(/\n(\s*)/)?.[1]||" ";o=x.trimEnd()+`
32
+ `+q+`sootsimPlugin(),
33
+ `+I+O}else throw new Error("could not find plugins array in vite config");y(i,o)}function A(e){let n=u(e,"metro.config.js"),r=u(e,"metro.config.ts"),s=w(n)?n:r;if(!w(s))throw new Error(`no metro config found at ${e}`);let i=j(s,"utf8");if(i.includes("withSootsim")){console.log(" (already configured)");return}i="const { withSootsim } = require('sootsim/metro')"+`
34
+ `+i,i=i.replace(/(module\.exports\s*=\s*)([^;]+)/,(t,f,p)=>`${f}withSootsim(${p.trim()})`),y(s,i)}function B(e,n){let r=u(e,"metro.config.js"),s;n==="expo"?s=`const { getDefaultConfig } = require('expo/metro-config')
35
+ const { withSootsim } = require('sootsim/metro')
36
+
37
+ const config = getDefaultConfig(__dirname)
38
+
39
+ module.exports = withSootsim(config)
40
+ `:s=`const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config')
41
+ const { withSootsim } = require('sootsim/metro')
42
+
43
+ const config = {}
44
+
45
+ module.exports = withSootsim(mergeConfig(getDefaultConfig(__dirname), config))
46
+ `,y(r,s)}function G(e,n){let r=u(e,"package.json"),s=JSON.parse(j(r,"utf8"));if(s.scripts||(s.scripts={}),s.scripts["dev:sootsim"]){console.log(" (already exists)");return}s.scripts["dev:sootsim"]=n,y(r,JSON.stringify(s,null,2)+`
47
+ `)}function U(e){e.framework==="one"?console.log(`
48
+ manual setup \u2014 add to your vite.config.ts:
49
+
50
+ import { sootsimPlugin } from 'sootsim/vite'
51
+
52
+ export default {
53
+ plugins: [
54
+ one({ /* ... */ }),
55
+ sootsimPlugin(),
56
+ ],
57
+ }
58
+ `):console.log(`
59
+ manual setup \u2014 add to your metro.config.js:
60
+
61
+ const { withSootsim } = require('sootsim/metro')
62
+ module.exports = withSootsim(config)
63
+ `)}async function ie(){console.log(`
64
+ sootsim uninstall is no longer needed.
65
+ to remove sootsim, just remove the plugin from your config
66
+ and remove sootsim from your dependencies.
67
+ `)}export{re as runInstall,ie as runUninstall};
@@ -0,0 +1,19 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as x}from"./chunk-QOBRRY5X.js";import{a as $}from"./chunk-MBFP2LVH.js";import"./chunk-E522F5JW.js";import{spawn as k,spawnSync as u}from"child_process";import{chmodSync as v,createWriteStream as S,existsSync as f,mkdirSync as y,renameSync as P,rmSync as w,statSync as T}from"fs";import{tmpdir as E}from"os";import{dirname as D,join as m,resolve as b}from"path";var h="https://sootbean.com/api/electron-release";function M(){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:I}}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:B}}return null}async function A({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 e=s.headers.get("content-length"),l=e?Number(e):null;if(!s.body)throw new Error("download failed: empty response body");y(D(o),{recursive:!0});let i=S(o),d=s.body.getReader(),a=0;try{for(;;){let{done:t,value:c}=await d.read();if(t)break;i.write(Buffer.from(c)),a+=c.byteLength,n?.(a,l)}}finally{await new Promise((t,c)=>{i.end(p=>p?c(p):t())})}}function O(r,o){let n=(r/1048576).toFixed(1);if(!o)return` ${n} MB`;let s=Math.min(100,Math.round(r/o*100)),e=(o/(1024*1024)).toFixed(1),l=24,i=Math.round(s/100*l);return` ${"\u2588".repeat(i)+"\u2591".repeat(l-i)} ${s}% ${n} / ${e} MB`}async function I(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
+ `),e=n[n.length-1].split(" ").pop()?.trim();if(!e||!f(e))throw new Error(`could not determine dmg mount point (output: ${o.stdout})`);let l=m(e,"sootsim.app");if(!f(l))throw u("hdiutil",["detach","-force",e]),new Error(`sootsim.app not found inside ${e}`);let i="/Applications",d=b(process.env.HOME||"","Applications"),a=i;try{let g=m(i,`.sootsim-write-probe-${process.pid}`);u("touch",[g]),f(g)?w(g,{force:!0}):a=d}catch{a=d}a===d&&y(a,{recursive:!0});let t=m(a,"sootsim.app");f(t)&&w(t,{recursive:!0,force:!0});let c=u("cp",["-R",l,t]),p=u("hdiutil",["detach","-force",e]);if(c.status!==0)throw new Error(`copy to ${t} failed: ${c.stderr?.toString()||""}`.trim());return p.status!==0&&console.warn(` warning: failed to unmount ${e} (${p.stderr?.toString().trim()||"unknown error"})`),u("xattr",["-dr","com.apple.quarantine",t]),t}async function L(r){let o=b(process.env.HOME||"","Applications");y(o,{recursive:!0});let n=m(o,"sootsim.AppImage");return f(n)&&w(n,{force:!0}),P(r,n),v(n,493),n}async function B(r){return await new Promise((o,n)=>{let s=k("cmd",["/c","start",'""',"/wait",r],{stdio:"inherit"});s.once("error",n),s.once("exit",e=>{e===0?o():n(new Error(`installer exited with code ${e}`))})}),r}async function _(r){(r.includes("--help")||r.includes("-h"))&&(console.log(`
4
+ sootsim install-desktop \u2014 download and install the desktop companion
5
+
6
+ usage:
7
+ sootsim install-desktop [options]
8
+
9
+ options:
10
+ -y, --yes skip confirmation and install immediately
11
+ --force reinstall even if the companion is already present
12
+
13
+ examples:
14
+ sootsim install-desktop
15
+ sootsim install-desktop --yes
16
+ `),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=$();if(s&&!n){console.log(` sootsim desktop already installed at: ${s.path}`),console.log(" pass --force to reinstall.");return}let e=M();if(e||(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: ${e.platform}`),console.log(` download: ${e.url}`),console.log(),!o){if(!await x("download and install now?",!0)){console.log(" cancelled.");return}console.log()}let l=m(E(),`sootsim-install-${Date.now()}`),i=m(l,e.filename),d=0;process.stdout.write(` downloading ${e.filename}...
17
+ `);try{await A({url:e.url,dest:i,onProgress:(t,c)=>{let p=Date.now();p-d<100&&t<(c??1/0)||(d=p,process.stdout.isTTY&&process.stdout.write(`\r\x1B[2K${O(t,c)}`))}})}catch(t){w(l,{recursive:!0,force:!0}),console.error(`
18
+ download failed: ${t instanceof Error?t.message:String(t)}`),process.exit(1)}process.stdout.isTTY&&process.stdout.write(`
19
+ `);let a=T(i).size;console.log(` downloaded ${(a/(1024*1024)).toFixed(1)} MB`),console.log(),console.log(" installing...");try{let t=await e.install(i);console.log(` installed: ${t}`)}catch(t){console.error(` install failed: ${t instanceof Error?t.message:String(t)}`),console.error(` keeping download at ${i} for manual install.`),process.exit(1)}finally{w(l,{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{_ as runInstallDesktop};
@@ -0,0 +1,26 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as g,d as f}from"./chunk-PWXPA745.js";import"./chunk-E522F5JW.js";import{exec as S}from"node:child_process";import{randomBytes as v}from"node:crypto";import w from"node:http";var I=process.env.SOOTSIM_AUTH_ORIGIN||"https://sootbean.com",m="http://localhost:3000";async function $(e){if(e)return e;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(`${m}/api/auth/me`)).ok)return m}catch{}return I}function x(){console.log(`
3
+ sootsim login \u2014 sign in so desktop uploads can attach to your account
4
+
5
+ usage:
6
+ sootsim login [--origin <url>]
7
+
8
+ options:
9
+ --origin <url> auth host (default: auto)
10
+ prefers ${m} when available, otherwise
11
+ falls back to ${I}
12
+ override with SOOTSIM_AUTH_ORIGIN env var
13
+ -h, --help
14
+ `)}function R(e,o){let t=e.findIndex(i=>i===o);if(t<0)return;let c=e[t+1];return e.splice(t,2),c}function L(e){let o=process.platform==="darwin"?`open "${e}"`:process.platform==="win32"?`start "" "${e}"`:`xdg-open "${e}"`;S(o,t=>{t&&(console.log(" could not open browser automatically."),console.log(` open this URL manually:
15
+ ${e}
16
+ `))})}function u(e){return`<!doctype html>
17
+ <html>
18
+ <body style="font-family:system-ui;background:#0b0d12;color:#e5e7eb;display:flex;align-items:center;justify-content:center;height:100vh;margin:0">
19
+ <div style="max-width:480px;text-align:center">
20
+ <h1 style="font-size:28px;margin:0 0 12px">SootSim</h1>
21
+ <p style="color:#94a3b8">${e}</p>
22
+ </div>
23
+ </body>
24
+ </html>`}async function _(e){try{let o=await fetch(`${e.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 t=await o.json();return t.token?{ok:!0,token:t.token,userId:t.user?.id,email:t.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 P(e){try{let o=new URL(e).hostname;return o==="localhost"||o==="127.0.0.1"||o.endsWith(".local")}catch{return!1}}async function G(e){(e.includes("--help")||e.includes("-h"))&&(x(),process.exit(0));let o=[...e],t=await $(R(o,"--origin"));if(P(t)){console.log(` detected local origin (${t}) \u2014 signing in as dev user`);let n=await _(t);if(n.ok){g({token:n.token,user:n.userId?{id:n.userId,email:n.email}:null,origin:t,source:"cli"});let s=await f(t),a=s?.user?.email||n.email||s?.user?.id||n.userId;console.log(` signed in${a?` as ${a}`:""} (dev)`);return}console.log(` dev-login not available (${n.error}); falling back to browser`)}let c=v(16).toString("hex"),i=await new Promise(n=>{let s=w.createServer((a,r)=>{try{let l=new URL(a.url||"/","http://127.0.0.1"),b=l.searchParams.get("state"),k=l.searchParams.get("token"),y=l.searchParams.get("email")||void 0,O=l.searchParams.get("userId")||void 0,d=l.searchParams.get("error");if(r.setHeader("content-type","text/html; charset=utf-8"),d){r.end(u(`sign-in failed: ${d}`)),n({ok:!1,error:d}),s.close();return}if(b!==c){r.end(u("state mismatch. close this tab and retry `sootsim login`.")),n({ok:!1,error:"state mismatch"}),s.close();return}if(!k){r.end(u("missing token. close this tab and retry `sootsim login`.")),n({ok:!1,error:"missing token"}),s.close();return}r.end(u("sign-in complete. you can return to the terminal.")),n({ok:!0,token:k,email:y,userId:O}),s.close()}catch(l){r.statusCode=500,r.end(u("sign-in callback failed. retry `sootsim login`.")),n({ok:!1,error:l instanceof Error?l.message:"callback failed"}),s.close()}});s.listen(0,"127.0.0.1",()=>{let a=s.address();if(!a||typeof a=="string"){n({ok:!1,error:"failed to bind callback server"}),s.close();return}let r=new URL(`${t.replace(/\/$/,"")}/auth/sootsim-cli`);r.searchParams.set("state",c),r.searchParams.set("port",String(a.port)),r.searchParams.set("sootbean",t),console.log(" opening browser for sootsim login..."),console.log(` waiting for callback on 127.0.0.1:${a.port}`),console.log(` if nothing opens, visit:
25
+ ${r.toString()}
26
+ `),L(r.toString())})});i.ok||(console.error(` login failed: ${i.error}`),process.exit(1)),g({token:i.token,user:i.userId?{id:i.userId,email:i.email}:null,origin:t,source:"cli"});let h=await f(t),p=h?.user?.email||i.email||h?.user?.id||i.userId;console.log(` signed in${p?` as ${p}`:""}`)}export{G as runLogin};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as e,c as t}from"./chunk-PWXPA745.js";import"./chunk-E522F5JW.js";async function r(){let o=e();if(!o?.token){console.log(" not signed in");return}try{await fetch(`${o.origin.replace(/\/$/,"")}/api/auth/sign-out`,{method:"POST",headers:{authorization:`Bearer ${o.token}`}})}catch{}t(),console.log(" signed out")}export{r as runLogout};
@@ -0,0 +1,75 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as h}from"./chunk-CKZ376AY.js";import"./chunk-G5MR66EB.js";import"./chunk-A2CZQIWO.js";import"./chunk-KXYKAYYB.js";import"./chunk-PWXPA745.js";import"./chunk-KSACMDXK.js";import"./chunk-KQWZZ56P.js";import"./chunk-YCETS3B3.js";import"./chunk-JSF5LPNT.js";import"./chunk-HOIHCO7S.js";import"./chunk-KSB6MSZ4.js";import"./chunk-OROM7DZI.js";import"./chunk-MPSZ5EWF.js";import"./chunk-3C3ZH7PP.js";import"./chunk-E5UBZEYR.js";import"./chunk-X2U72K7X.js";import"./chunk-74XPLOV4.js";import"./chunk-MBFP2LVH.js";import"./chunk-E522F5JW.js";import*as i from"fs";import*as l from"path";var w=[".maestro","maestro"];function v(){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 session for this run
17
+ --record record a webm while the flow runs
18
+ --slow <ms> delay between steps for natural pacing
19
+
20
+ examples:
21
+ bun sootsim maestro test .maestro/login.yaml
22
+ bun sootsim maestro test .maestro/
23
+ bun sootsim maestro --env USERNAME=alice test .maestro/login.yaml
24
+ bun sootsim maestro init
25
+ `)}function x(){console.log(`
26
+ sootsim maestro \u2014 compatibility matrix
27
+
28
+ supported verbs:
29
+ launchApp, stopApp, clearState, clearKeychain (warn-only),
30
+ tapOn, tapAtCoords, longPressOn (via tapOn),
31
+ inputText, pressKey, dispatchKey, hideKeyboard, eraseText,
32
+ assertVisible, assertNotVisible, assertTreeContains,
33
+ waitFor, extendedWaitUntil, waitForAnimationToEnd,
34
+ scroll, scrollUntilVisible, scrollTo, swipe, pinch,
35
+ takeScreenshot, dumpTree, back,
36
+ repeat, runFlow, when: (visible/notVisible/platform/true),
37
+ optional:, onFlowStart, onFlowComplete,
38
+ copyTextFrom, evalScript, openLink,
39
+ env var interpolation via \${NAME} (process.env + flow-scoped).
40
+
41
+ partial:
42
+ clearKeychain \u2014 warn-only, sootsim has no keychain surface.
43
+ when.platform \u2014 matches "ios" only; sootsim emulates iOS.
44
+ openLink \u2014 uses window.location; no OS-level app routing.
45
+ takeScreenshot \u2014 maestro string form works unchanged; sootsim also accepts
46
+ { path, withFrame } for framed export.
47
+
48
+ not yet implemented (will throw "unsupported maestro verb"):
49
+ travel, setLocation, setAirplaneMode, killApp,
50
+ addMedia, startRecording, stopRecording (use --record flag),
51
+ repeat.while (only repeat.times is supported).
52
+ `)}function g(o){return o.startsWith("-")}function S(o){let s=[];for(let t=0;t<o.length;t++){if(o[t]==="--env"||o[t]==="-e"){let e=o[t+1];if(!e||!e.includes("="))throw new Error(`--env expects KEY=VALUE (got ${JSON.stringify(e??"")})`);let a=e.indexOf("="),r=e.slice(0,a),m=e.slice(a+1);process.env[r]=m,t+=1;continue}s.push(o[t])}return s}function $(o){let s=[];for(let t=0;t<o.length;t++){let e=o[t];if(e==="--format"||e==="--output"||e==="--device"||e==="-d"){t+=1;continue}if(e==="--continuous"){console.warn(" warn: --continuous is not yet implemented in sootsim \u2014 running once");continue}s.push(e)}return s}function y(o){for(let s of w){let t=l.join(o,s);if(i.existsSync(t)&&i.statSync(t).isDirectory())return t}return null}function E(o){let s=i.statSync(o);if(s.isFile())return[o];if(!s.isDirectory())throw new Error(`not a file or directory: ${o}`);let t=i.readdirSync(o),e=[];for(let a of t){if(a.startsWith("."))continue;let r=l.join(o,a);i.statSync(r).isFile()&&(a.endsWith(".yaml")||a.endsWith(".yml"))&&e.push(r)}return e.sort(),e}async function k(o){let s=l.join(o,".maestro");i.mkdirSync(s,{recursive:!0});let t=l.join(s,"login.yaml");return i.existsSync(t)?(console.error(` error: ${t} already exists`),1):(i.writeFileSync(t,`# sootsim maestro starter flow \u2014 drop-in compatible with the maestro cli.
53
+ # run: bun sootsim maestro test .maestro/login.yaml
54
+ appId: com.example.app
55
+ ---
56
+ - launchApp
57
+ - tapOn:
58
+ id: "email"
59
+ - inputText: "user@example.com"
60
+ - tapOn:
61
+ id: "password"
62
+ - inputText: "secret123"
63
+ - tapOn: "Sign in"
64
+ - assertVisible: "Welcome"
65
+ `,"utf8"),console.log(` + wrote ${t}`),console.log(" next: bun sootsim maestro test .maestro/login.yaml"),0)}async function F(o,s={}){if(o.includes("--help")||o.includes("-h"))return v(),0;if(o.includes("--list-compat"))return x(),0;let t;try{t=S(o)}catch(n){return console.error(` error: ${n.message}`),1}t=$(t);let e=process.cwd(),a=t[0];if(a==="init")return k(e);let r=null,m;if(a==="test"){let n=t.slice(1).find(c=>!g(c));n?(r=l.resolve(e,n),m=t.slice(1).filter(c=>c!==n)):(r=y(e),m=t.slice(1))}else a&&!g(a)?(r=l.resolve(e,a),m=t.slice(1)):(r=y(e),m=t);if(!r)return console.error(`
66
+ error: no maestro flows found.
67
+ expected one of: ${w.map(n=>`./${n}/`).join(", ")}
68
+ or pass a flow explicitly: bun sootsim maestro test path/to/flow.yaml
69
+ or scaffold a starter flow: bun sootsim maestro init
70
+ `),1;if(!i.existsSync(r))return console.error(` error: ${r} not found`),1;let u;try{u=E(r)}catch(n){return console.error(` error: ${n.message}`),1}if(u.length===0)return console.error(` error: no *.yaml or *.yml files found in ${r}`),1;console.log(`
71
+ sootsim maestro \u2014 ${u.length} flow${u.length===1?"":"s"}
72
+ root: ${l.relative(e,r)||"."}
73
+ `);let d=0,f=[];for(let n of u){console.log(`
74
+ \u25B6 ${l.relative(e,n)}`);let c=[n,...m];s.port&&!m.includes("--url")&&c.push("--url",String(s.port));let p=0;try{p=await h(c)}catch(b){console.error(` x ${b.message}`),p=1}f.push({file:n,exit:p}),p!==0&&d===0&&(d=p)}if(u.length>1){console.log(`
75
+ maestro summary:`);for(let c of f){let p=c.exit===0?"pass":"fail";console.log(` ${p} ${l.relative(e,c.file)}`)}let n=f.filter(c=>c.exit===0).length;console.log(` ${n}/${f.length} passed`)}return d}export{F as runMaestro};
@@ -0,0 +1,17 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-E522F5JW.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
+ sootsim preview \u2014 production-like preview
4
+
5
+ usage:
6
+ sootsim preview [options]
7
+
8
+ options:
9
+ --export <path> export as self-contained HTML file
10
+ --port <number> server port (default: 4173)
11
+
12
+ examples:
13
+ sootsim preview
14
+ sootsim preview --export ./preview.html
15
+ `),process.exit(0));let i=o.find((v,l)=>o[l-1]==="--export"),e=r.port||4173;console.log(" building...");let{build:s,preview:n}=await import("vite");await s({root:t,configFile:c(t,"vite.config.ts")}),i&&(console.log(` exporting to: ${i}`),console.log(" (HTML export not yet implemented)"),process.exit(0)),console.log(` serving on port ${e}...`);let p=await n({root:t,preview:{port:e,strictPort:!0}});console.log(`
16
+ sootsim preview: http://localhost:${e}
17
+ `),process.on("SIGINT",()=>{p.close(),process.exit(0)})}export{g as runPreview};
@@ -0,0 +1,22 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as I,d as N,h as S}from"./chunk-MPSZ5EWF.js";import"./chunk-3C3ZH7PP.js";import"./chunk-X2U72K7X.js";import"./chunk-E522F5JW.js";import{createWriteStream as v,mkdirSync as k,writeFileSync as w}from"fs";import{dirname as T,resolve as x}from"path";import{pipeline as y}from"stream/promises";import{Readable as C}from"stream";import{createGzip as F}from"zlib";async function E(r,m){if(r.includes("--help")||r.includes("-h"))return console.log(`
3
+ sootsim profile \u2014 capture a sampled CPU trace from the tenant worker
4
+
5
+ usage:
6
+ sootsim profile [options]
7
+
8
+ options:
9
+ --duration <seconds> recording duration (default: 5)
10
+ --output <path> output file (default: /tmp/sootsim.cpuprofile)
11
+ if the path ends in .gz, the output is gzipped
12
+ --sample-interval <ms> requested sample interval in ms (default: 10 \u2014
13
+ chrome may clamp upward)
14
+ --max-buffer <n> max samples buffered (default: 100000)
15
+ --session <tab-id> target a specific bridge tab
16
+ --port <number> ws bridge port (default: 7668)
17
+
18
+ examples:
19
+ sootsim profile --duration 3
20
+ sootsim profile --duration 10 --output /tmp/after.cpuprofile.gz
21
+ sootsim profile --duration 3 -o /tmp/before.cpuprofile
22
+ `),0;let n=Number(b(r,"--duration")??"5");if(!Number.isFinite(n)||n<=0)return console.error(" --duration must be a positive number (seconds)"),1;let l=Number(b(r,"--sample-interval")??"10");if(!Number.isFinite(l)||l<=0)return console.error(" --sample-interval must be a positive number (milliseconds)"),1;let s=Number(b(r,"--max-buffer")??"100000");if(!Number.isFinite(s)||s<=0)return console.error(" --max-buffer must be a positive number"),1;let p=b(r,"--output")??b(r,"-o"),a=x(process.cwd(),p??"/tmp/sootsim.cpuprofile"),g=a.endsWith(".gz"),h=I(r,{port:m.port,stripValueFlags:["--duration","--output","-o","--sample-interval","--max-buffer"]}),c=N({...h,commandTimeoutMs:Math.max(3e4,(n+20)*1e3)});try{let u=await S(c,"SootSim.bridges.workerCpuProfileStart",{sampleInterval:l,maxBufferSize:s});if(!u?.started)return console.error(" could not start tenant-worker profiler."),console.error(" is sootsim running? (try `bun sootsim list`)"),1;m.verbose&&console.error(` started: sampleInterval=${u.sampleInterval}ms buffer=${u.maxBufferSize}`),console.log(` recording for ${n}s\u2026`),await new Promise(o=>setTimeout(o,n*1e3));let t=await S(c,"SootSim.bridges.workerCpuProfileStop");if(!t||t.error||!t.trace)return console.error(` profile capture failed: ${t?.error??"no trace returned"}`),t?.error?.includes("not available")&&(console.error(" your browser or page is missing the JS Self-Profiler API."),console.error(" requires chromium-based browser and Document-Policy: js-profiling.")),1;let P=z(t.trace),e=JSON.stringify(P);k(T(a),{recursive:!0}),g?await y(C.from([e]),F(),v(a)):w(a,e);let i=(Buffer.byteLength(e)/1024/1024).toFixed(2);return console.log(` samples: ${P.samples.length} (${i} MB uncompressed)`),console.log(` saved: ${a}`),console.log(" open in chrome devtools \u2192 Performance \u2192 Load profile to inspect."),0}catch(u){let t=u?.message??String(u);return console.error(` profile failed: ${t}`),/could not connect|ECONNREFUSED/i.test(t)&&console.error(" is sootsim running? (try `bun sootsim list`)"),1}finally{c.close()}}function z(r){let m=r.frames??[],n=r.resources??[],l=r.stacks??[],s=r.samples??[],p=1,a=[{id:p,callFrame:{functionName:"(root)",scriptId:"0",url:"",lineNumber:-1,columnNumber:-1},hitCount:0,children:[]}];for(let e=0;e<l.length;e++){let i=l[e],o=m[i.frameId]??{name:"(unknown)"},f=o.resource!==void 0?n[o.resource]??"":"";a.push({id:e+2,callFrame:{functionName:o.name||"(anonymous)",scriptId:o.resource!==void 0?String(o.resource):"0",url:f,lineNumber:typeof o.line=="number"?o.line-1:-1,columnNumber:typeof o.column=="number"?o.column-1:-1},hitCount:0,children:[]})}for(let e=0;e<l.length;e++){let i=l[e],o=e+2,f=i.parentId!==void 0?i.parentId+2:p,d=a[f-1];d&&!d.children.includes(o)&&d.children.push(o)}let g=[],h=[],c=s.length>0?s[0].timestamp:0,u=c;for(let e=0;e<s.length;e++){let i=s[e],o=i.stackId!==void 0?i.stackId+2:p;g.push(o);let f=a[o-1];f&&f.hitCount++;let d=e===0?0:i.timestamp-u;h.push(Math.max(0,Math.round(d*1e3))),u=i.timestamp}let t=Math.round(c*1e3),P=s.length>0?Math.round(s[s.length-1].timestamp*1e3):t;return{nodes:a,startTime:t,endTime:P,samples:g,timeDeltas:h}}function b(r,m){let n=r.indexOf(m);if(!(n<0||n===r.length-1))return r[n+1]}export{E as runProfile};
@@ -0,0 +1,37 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as W}from"./chunk-OROM7DZI.js";import{b as R,d as $}from"./chunk-MPSZ5EWF.js";import{c as N}from"./chunk-3C3ZH7PP.js";import"./chunk-X2U72K7X.js";import"./chunk-E522F5JW.js";import{existsSync as Y,mkdirSync as _,readFileSync as Z,rmSync as C,writeFileSync as U}from"fs";import{tmpdir as ee}from"os";import{dirname as z,extname as oe,join as re,resolve as O}from"path";var D=6e4;async function we(e,r){if((e.includes("--help")||e.includes("-h"))&&(console.log(`
3
+ sootsim record \u2014 capture the running session
4
+
5
+ usage:
6
+ sootsim record [options] one-shot capture (duration-bounded)
7
+ sootsim record start [options] begin stateful recording
8
+ sootsim record stop [--output <path>] finalize stateful recording
9
+
10
+ options:
11
+ --mode <kind> video | live | combined (default: video)
12
+ video \u2014 local webm/mp4 file
13
+ live \u2014 pointer events only, uploads /preview/<id>
14
+ combined \u2014 events + video, uploads /preview/<id>
15
+ --duration <sec> recording duration (default: 10, atomic mode only)
16
+ --fps <n> frame rate for video/gif (default: 30)
17
+ --format <fmt> webm | mp4 | gif | png (video mode; inferred from --output ext)
18
+ --output <path> output file (video/gif) or directory (png frames)
19
+ --frames <n> sample N png frames evenly across --duration
20
+ --max-width <px> downscale gif frames to this width
21
+ --no-shell exclude the simulated iOS chrome (status bar, keyboard,
22
+ toasts) \u2014 records the tenant surfaces only
23
+ --shell-only record only the shell chrome
24
+ --open open the preview URL in the browser after stop (live/combined)
25
+ --session <tab-id> target a specific bridge tab
26
+
27
+ examples:
28
+ sootsim record # webm, 10s, ./sootsim-<ts>.webm
29
+ sootsim record --format mp4 --duration 5
30
+ sootsim record --output demo.gif --duration 3
31
+ sootsim record --frames 10 --output ./frames/
32
+ sootsim record --mode combined --duration 8 --open
33
+ sootsim record start --format mp4 # start video; interact freely
34
+ sootsim record start --mode combined # start preview-share recording
35
+ sootsim record stop --output flow.mp4 # finalize video
36
+ sootsim record stop --open # finalize live/combined + open URL
37
+ `),process.exit(0)),e[0]==="start"){await ie(e.slice(1),r);return}if(e[0]==="stop"){await ce(e.slice(1),r);return}if(e[0]==="cancel"){await de(e.slice(1),r);return}if(e[0]==="status"){ae();return}let o=R(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width"]}),t=q(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(t==="live"||t==="combined"){let u=$({...o,commandTimeoutMs:6e4});try{await V(u),await j(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 K(u);let k=await G(u);H(k,w)}finally{u.close()}return}let M=d?Number(d):null,S=ne(i,s,M),p=$({...o,commandTimeoutMs:6e4});try{if(await L(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 Q=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()>=Q&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(E=>setTimeout(E,100))}A.forEach((m,E)=>{let X=`${f}/frame-${String(E+1).padStart(3,"0")}.png`;U(X,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`);_(z(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} (${T(g.size)})`);return}let u=O(process.cwd(),s??`./sootsim-${B()}.${S}`);_(z(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 J(p,u),console.log(` saved: ${u} (${T(y.size)})`)}finally{p.close()}}async function L(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 tab?")}async function J(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 te(e){if(!e)return;let r=oe(e).toLowerCase().replace(/^\./,"");if(r==="webm"||r==="mp4"||r==="gif")return r;if(r==="png")return"png"}function ne(e,r,o){return e||(o!=null?"png":te(r)??"webm")}function B(){return new Date().toISOString().replace(/[:T]/g,"-").replace(/\..+/,"")}function T(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(2)}MB`}function q(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 P(){return re(ee(),`sootsim-recording-${N()}.json`)}function F(){let e=P();if(!Y(e))return null;try{return{mode:"video",...JSON.parse(Z(e,"utf8"))}}catch{return C(e,{force:!0}),null}}function se(e){U(P(),JSON.stringify(e,null,2))}function x(){C(P(),{force:!0})}async function ie(e,r){let o=F();o&&(console.error(` recording already in progress (started ${o.startedAt}, tab ${o.browserId??"?"}). run \`sootsim record stop\` first, or \`sootsim record cancel\` to discard.`),process.exit(1));let t=R(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only"],stripValueFlags:["--mode","--fps","--format","--max-width"]}),n=q(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 V(d),await j(d,n)||(console.error(` start failed: recording store refused to start (${n})`),process.exit(1));else{await L(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))}se({browserId:t.browserId??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 ae(){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 tab ${e.browserId??"?"} since ${e.startedAt}`):console.log(` recording ${e.mode} on tab ${e.browserId??"?"} since ${e.startedAt}`)}async function de(e,r){let o=F();if(!o){console.log(" no recording in progress");return}let t=R(e,{port:r.port}),n=t.browserId??o.browserId??void 0,i=$({...t,browserId: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 ce(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.browserId??o.browserId??void 0,i=e.includes("--open"),s=$({...t,browserId:n,commandTimeoutMs:6e4});try{if(o.mode==="live"||o.mode==="combined"){await K(s);let w=await G(s);x(),H(w,i);return}let a=c(e,"--output"),l=O(process.cwd(),a??`./sootsim-${B()}.${o.format}`);_(z(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 J(s,l),x(),console.log(` saved: ${l} (${T(d.size)})`)}finally{s.close()}}async function V(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 tab?")}async function j(e,r){return await e.send({type:"evaluate",code:`window.SootSim.bridges.startRecording(${JSON.stringify(r)})`})===!0}async function K(e){await e.send({type:"evaluate",code:"void window.SootSim.bridges.stopRecording()"})}async function G(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 H(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{te as extToFormat,ne as resolveFormat,we as runRecord,c as valueOf};
@@ -0,0 +1,26 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as v}from"./chunk-G5MR66EB.js";import"./chunk-A2CZQIWO.js";import"./chunk-KSACMDXK.js";import"./chunk-KQWZZ56P.js";import{f as m}from"./chunk-YCETS3B3.js";import{a as h}from"./chunk-J2S3OCWA.js";import{b as g,c as w,d as y,g as x}from"./chunk-MPSZ5EWF.js";import"./chunk-3C3ZH7PP.js";import"./chunk-X2U72K7X.js";import"./chunk-E522F5JW.js";import{mkdirSync as R,writeFileSync as S}from"fs";import{dirname as _,resolve as B}from"path";async function V(e,t){(e.includes("--help")||e.includes("-h"))&&(console.log(`
3
+ sootsim screenshot \u2014 capture the canvas as a PNG
4
+
5
+ usage:
6
+ sootsim screenshot [options]
7
+
8
+ options:
9
+ --output <path> output file path (default: /tmp/sootsim-inspect.png)
10
+ --with-frame wrap the captured screen in a tight device frame
11
+ --no-frame capture the raw screen bitmap (default)
12
+ --no-shell exclude the simulated iOS chrome (status bar, keyboard,
13
+ toasts) \u2014 captures the tenant surfaces only
14
+ --shell-only capture only the shell chrome, no tenant content
15
+ --area x,y,w,h crop to a logical sootsim rect
16
+ --id <testID> crop to a node's bounding box
17
+ --text <text> crop to a node found by text content
18
+ --gallery crawl and capture multiple screens as HTML gallery
19
+ --themes capture light and dark variants
20
+
21
+ examples:
22
+ sootsim screenshot
23
+ sootsim screenshot --with-frame --output framed.png
24
+ sootsim screenshot --area 0,200,393,400 --output hero.png
25
+ sootsim screenshot --id loginButton --output button.png
26
+ `),process.exit(0));let o=D(e);if(o.length>0){for(let{flag:u,suggestion:d}of o)console.error(d?` unknown flag: ${u} (did you mean ${d}?)`:` unknown flag: ${u}`);console.error(" run `sootsim screenshot --help` for the list of supported flags"),process.exit(1)}let a=e.includes("--gallery"),i=e.includes("--themes"),r=M(e),l=P(e);if(a||i)return r&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),b(e,t);r&&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 n=g(e,{port:t.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only"],stripValueFlags:["--output","--area","--id","--text"]}),s=e.find((u,d)=>e[d-1]==="--output"),c=await A(e);if(await E(n.wsPort)){await O(n,s,c,r,l);return}r&&(console.error(" --with-frame requires a running sootsim bridge"),console.error(" open the app in a live sootsim session 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,t)}async function E(e){let t=w(e,{commandTimeoutMs:1e3});try{return await t.listBrowsers(),!0}catch{return!1}finally{t.close()}}async function A(e){let t=e.find((i,r)=>e[r-1]==="--area");if(t){let i=t.split(",").map(c=>Number(c.trim()));if(i.length!==4||i.some(c=>!Number.isFinite(c)))throw new Error(`--area expects x,y,w,h (got "${t}")`);let[r,l,n,s]=i;return{x:r,y:l,w:n,h:s}}let o=e.find((i,r)=>e[r-1]==="--id"),a=e.find((i,r)=>e[r-1]==="--text");return o||a?{__matcher:{id:o,text:a}}:null}async function O(e,t,o,a,i){let r=y({...e,commandTimeoutMs:1e4});try{let l=o,n=o?.__matcher;if(n){let p=await r.send({type:"evaluate",code:h(n)});if(!p)throw new Error(n.id?`no node with id "${n.id}"`:`no node matching text "${n.text}"`);l=p}let s=l?{x:l.x,y:l.y,w:l.w,h:l.h}:void 0,c={type:"screenshot"};i&&(c.layers=i),s&&(c.crop=s);let u=(await r.send(c)).replace(/^data:image\/png;base64,/,"");s&&console.log(` area: x=${s.x} y=${s.y} w=${s.w} h=${s.h}`),i&&console.log(` layers: ${i}`);let d=B(process.cwd(),t||"/tmp/sootsim-inspect.png");R(_(d),{recursive:!0});let f=Buffer.from(u,"base64");if(a){let p=await T(r);if(!p)throw new Error("could not read current device model from the target session");let $=await v(f,p);S(d,$),console.log(` frame: ${p}`)}else S(d,f);console.log(` saved: ${d}`)}finally{r.close()}}async function T(e){let t=await x(e,"SootSim.bridges.settings.get")??{deviceModel:null},o=typeof t.deviceModel=="string"?t.deviceModel:null;return!o||!(o in m)?null:o}function M(e){let t=!1;for(let o of e)o==="--with-frame"&&(t=!0),o==="--no-frame"&&(t=!1);return t}function P(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var k=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--gallery","--themes"]),L=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--session","--tab"]),N={"--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 D(e){let t=[];for(let o=0;o<e.length;o++){let a=e[o];if(a.startsWith("-")){if(L.has(a)){o++;continue}k.has(a)||t.push({flag:a,suggestion:N[a]})}}return t}async function b(e,t){let o=e.find((n,s)=>e[s-1]==="--output")||"sootsim-screenshot.png",a=e.includes("--gallery"),i=e.find((n,s)=>e[s-1]==="--url")||`http://localhost:${t.port||5173}`,{chromium:r}=await import("playwright"),l=await r.launch({headless:!0});try{if(a)console.log(" capturing gallery..."),console.log(" (gallery mode not yet implemented)");else{let n=await l.newPage({viewport:{width:500,height:900}});await n.goto(i,{waitUntil:"networkidle"}),await n.waitForTimeout(2e3);let s=B(process.cwd(),o);R(_(s),{recursive:!0}),await n.screenshot({path:s}),console.log(` saved: ${s}`),await n.close()}}catch(n){console.error(` screenshot failed: ${n.message}`),process.exit(1)}finally{await l.close()}}export{V as runScreenshot};
@@ -0,0 +1,17 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as c,d as i,g as d}from"./chunk-MPSZ5EWF.js";import"./chunk-3C3ZH7PP.js";import"./chunk-X2U72K7X.js";import"./chunk-E522F5JW.js";async function g(o,l){(o.includes("--help")||o.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));let r=c(o,{port:l.port}),e=r.commandArgs[0]?.toLowerCase()??"toggle";e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),process.exit(1));let s=i({...r,commandTimeoutMs:5e3});try{let t=!!(await d(s,"SootSim.bridges.settings.get"))?.screenshotMode,n=e==="on"?!0:e==="off"?!1:!t;if(t===n){console.log(` screenshot-mode: already ${n?"on":"off"}`);return}await s.send({type:"evaluate",code:"window.dispatchEvent(new CustomEvent('sootsim:shell-command', { detail: { type: 'fire-action', id: 'toggle-screenshot-mode' } }))"}),console.log(` screenshot-mode: ${t?"on":"off"} \u2192 ${n?"on":"off"}`)}finally{s.close()}}export{g as runScreenshotMode};
@@ -0,0 +1,70 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as Y}from"./chunk-CKZ376AY.js";import{b as j}from"./chunk-G5MR66EB.js";import"./chunk-A2CZQIWO.js";import"./chunk-KXYKAYYB.js";import"./chunk-PWXPA745.js";import"./chunk-KSACMDXK.js";import"./chunk-KQWZZ56P.js";import{a as w,b as D,c as k,d as z,e as x,f as T}from"./chunk-YCETS3B3.js";import{b as O}from"./chunk-JSF5LPNT.js";import"./chunk-HOIHCO7S.js";import"./chunk-KSB6MSZ4.js";import"./chunk-OROM7DZI.js";import"./chunk-MPSZ5EWF.js";import"./chunk-3C3ZH7PP.js";import"./chunk-E5UBZEYR.js";import"./chunk-X2U72K7X.js";import"./chunk-74XPLOV4.js";import"./chunk-MBFP2LVH.js";import"./chunk-E522F5JW.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("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}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 r=ee(e),i=Math.max(0,Math.min(1,t)),n=r.match(/^#([0-9a-f]{6})$/i);if(n){let s=n[1],o=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(${o}, ${a}, ${u}, ${i})`}return r.startsWith("rgb(")?r.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):r}function te(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,r=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${r})`}function oe(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(r=>r.trim()).filter(r=>r.length>0&&r!=="none");return t.length>0?t.join(" "):"none"}function E(e){let t=M(e.color,e.opacity),r=M(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${r}) 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 re(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:(o,a,u)=>{let p=Math.round(t.width*.68*(a.scale??o.scale)),l=Math.round(t.height*(.03+o.offsetY+(a.offsetY??0))),c=a.pose||o.pose||"tilted-right",m=R(o.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:(o,a,u)=>{let p=Math.round(t.width*.84*(a.scale??o.scale)),l=Math.round(t.height*(o.offsetY+(a.offsetY??0))),c=a.pose||o.pose,m=R(o.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 r=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:${r}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,o)=>{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,o);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:r,imageDataUrl:i}){let n=r.background??t.background,s=re(t.text.preset,e),o=t.text.preset!=="none"&&!!(r.eyebrow||r.headline||r.subheadline),a=s.deviceStyle(t.frame,r,n),u=r.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${v(r.headline)}</div>`:"",p=r.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(r.subheadline)}</div>`:"",l=r.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(r.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: ${oe(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
+ ${o?`<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,r){let i=[],n=r??await(async()=>{let{chromium:o}=await import("playwright");return o.launch({headless:!0})})();try{let o=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 o.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 o.close()}}finally{!r&&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(o=>o.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 r=e.type==="solid"||e.type==="gradient"?e.type:t.type;if(r==="solid")return{type:r,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),o=g(n.color);return!Number.isFinite(s)||!o?null:{offset:s,color:o}}).filter(n=>!!n):t.stops?.map(n=>({...n}))??[];return{type:r,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 r=(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(r.length===0)throw new Error("compose.canvases must include at least one preset");return r}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((r,i)=>{let n=$(r,`compose.slides[${i}]`),s=g(n.screenshot);if(!s)throw new Error(`compose.slides[${i}].screenshot is required`);let o=g(n.id),a=_(o||s);return{id:o||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),r=y.dirname(t),i=O.parse(se(t,"utf8")),n=$(i,"screenshots plan"),s=$(n.capture??{},"capture"),o=$(n.compose??{},"compose"),a=typeof n.app=="number"?String(n.app):g(n.app),u=q(n.device,null),p=b(r,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(o.background??"cyan",x("cyan")),J={show:K(o.frame&&d(o.frame)?o.frame.show:void 0,!0),style:q(o.frame&&d(o.frame)?o.frame.style:null,null)||u||D,pose:X(o.frame&&d(o.frame)?o.frame.pose:void 0)||"straight",scale:S(o.frame&&d(o.frame)?o.frame.scale:void 0,1),offsetY:S(o.frame&&d(o.frame)?o.frame.offsetY:void 0,0),shadow:{color:h(o.frame&&d(o.frame)&&d(o.frame.shadow)?o.frame.shadow.color:void 0,w.color),blur:S(o.frame&&d(o.frame)&&d(o.frame.shadow)?o.frame.shadow.blur:void 0,w.blur),spread:S(o.frame&&d(o.frame)&&d(o.frame.shadow)?o.frame.shadow.spread:void 0,w.spread),opacity:S(o.frame&&d(o.frame)&&d(o.frame.shadow)?o.frame.shadow.opacity:void 0,w.opacity)}};return{planPath:t,planDir:r,appTarget:a,deviceModel:u,capture:{flowPath:c?b(r,c):null,fromDir:l?b(r,l):null,outDir:p,rawDir:l?b(r,l):y.join(p,"raw"),framedDir:y.join(p,"framed"),mode:m,pathMode:f,sessionId:g(s.session),openInNewSession:K(s.new,!1)},compose:{outDir:b(r,h(o.out,y.join(".sootsim","screenshots","exports"))),locale:h(o.locale,"en"),canvases:ie(o.canvases),frame:J,background:P,text:{preset:ae(o.text&&d(o.text)?o.text.preset:void 0),color:h(o.text&&d(o.text)?o.text.color:void 0,"#ffffff"),subColor:h(o.text&&d(o.text)?o.text.subColor:void 0,"rgba(232,240,247,0.86)"),eyebrowColor:h(o.text&&d(o.text)?o.text.eyebrowColor:void 0,"rgba(229,242,255,0.72)")},slides:le(o.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 r=[e.capture.flowPath],i=ue(e);r.push("--screenshots",e.capture.rawDir),i==="flow"&&r.push("--screenshot-paths","flow");let n=t.appTarget??e.appTarget,s=t.deviceModel??e.deviceModel,o=t.sessionId??e.capture.sessionId;return n&&r.push("--url",n),s&&r.push("--device",s),o&&r.push("--session",o),e.capture.openInNewSession&&r.push("--new"),r}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 r=de(e,t),i=await Y(r);if(i!==0)throw new Error(`flow capture failed with exit code ${i}`)}async function fe(e,t){let r=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 o=N(e,s.screenshot),a=pe(o),u=await n.compose(a,e.compose.frame.style),p=C.join(e.capture.framedDir,`${s.assetKey}.png`);G(p,u),r.set(s.id,p)}}finally{await n.close()}}finally{!t&&typeof i.close=="function"&&await i.close()}return r}function ge(e,t,r){let i=[],n=[];B(e.capture.outDir,{recursive:!0});let s=me(e),o=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:r,mode:e.capture.mode,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,slides:o},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(r=>({slide:r,imagePath:e.compose.frame.show===!0?t.get(r.id)??N(e,r.screenshot):N(e,r.screenshot)}))}async function Z(e,t={}){let r=V(e),i=t.deviceModel??r.deviceModel;t.composeOnly||await he(r,t);let n=r.capture.mode!=="raw"||!t.captureOnly&&r.compose.frame.show===!0,o=n||!t.captureOnly?await(async()=>{let{chromium:a}=await import("playwright");return a.launch({headless:!0})})():null;try{let a=n?await fe(r,o??void 0):new Map,u=ge(r,a,i);if(t.captureOnly)return{plan:r,capture:u,compose:null};let p=we(r,a),l=await U(r.compose,p,o??void 0);return{plan:r,capture:u,compose:l}}finally{o&&typeof o.close=="function"&&await o.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
+ --session <id> reuse a live sootsim session 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 --session tab-9
69
+ sootsim screenshots --plan app-store.yaml --device iphone-14
70
+ `),0;let r=c=>e.find((m,f)=>e[f-1]===c),i=new Set(["--plan","--session","--app","--device"]),n=e.filter((c,m)=>{if(c.startsWith("-"))return!1;let f=e[m-1];return!f||!i.has(f)}),s=r("--plan")||n[0];if(!s)return console.error(" error: screenshots plan path is required (`--plan <path>`)."),1;let o=r("--session")?.trim()||null,a=r("--app")?.trim()||null,u=r("--device")?.trim()||null,p=e.includes("--capture-only"),l=e.includes("--compose-only");try{let c=await Z(s,{sessionId:o,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};
@@ -0,0 +1,21 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as m}from"./chunk-7LMDCMSI.js";import{c as u}from"./chunk-MPSZ5EWF.js";import"./chunk-3C3ZH7PP.js";import"./chunk-X2U72K7X.js";import"./chunk-E522F5JW.js";async function $(e,i={}){(e.includes("--help")||e.includes("-h"))&&(console.log(`
3
+ sootsim server \u2014 run the sootsim bridge daemon in the foreground
4
+
5
+ hosts the WS bridge that CLI commands talk to. once running, any sootsim
6
+ tab (browser, electron, headless playwright) that connects to port 7668
7
+ becomes drivable from 'sootsim describe', 'sootsim tap', etc.
8
+
9
+ usage:
10
+ sootsim server [options]
11
+
12
+ options:
13
+ --port <n> bridge port (defaults to ${7668})
14
+ --quiet suppress per-connection logging
15
+
16
+ examples:
17
+ sootsim server
18
+ sootsim server --port 7668 --quiet
19
+ `),process.exit(0));let s=e.indexOf("--port"),n=s>=0&&e[s+1]?Number(e[s+1]):i.port??7668;Number.isNaN(n)&&(console.error(` invalid --port value: ${e[s+1]}`),process.exit(1));let w=e.includes("--quiet")||e.includes("-q"),a=await S(n);a&&(console.error(` port ${n} is already hosting a sootsim bridge`),a.browsers>0&&console.error(` ${a.browsers} browser tab(s) connected`),console.error(" stop the other process first, or pass --port <other>"),process.exit(1));let l=new m({port:n});l.start();let f=Date.now(),t=r=>{w||process.stdout.write(`${r}
20
+ `)},c=new Set,h=setInterval(()=>{let r=l.listBrowsers(),p=new Set(r.map(o=>o.id));for(let o of r)if(!c.has(o.id)){let g=o.title||o.url||o.origin||"(unknown)";t(` + ${o.id} ${g}`)}for(let o of c)p.has(o)||t(` - ${o}`);c.clear();for(let o of p)c.add(o)},500);t(`sootsim bridge listening on ws://localhost:${n}`),t(" ready for browser tabs, electron, or headless playwright to connect"),t(" (ctrl-c to stop)");let d=async r=>{clearInterval(h),t(`
21
+ ${r} received \u2014 shutting down after ${Math.round((Date.now()-f)/1e3)}s`);try{await l.close()}catch{}process.exit(0)};process.on("SIGINT",()=>d("SIGINT")),process.on("SIGTERM",()=>d("SIGTERM")),await new Promise(()=>{})}async function S(e){let i=u(e,{commandTimeoutMs:1e3});try{return{browsers:(await i.listBrowsers()).length}}catch{return null}finally{i.close()}}export{$ as runServer};
@@ -0,0 +1,10 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-E522F5JW.js";import*as l from"fs";import*as i from"path";import{fileURLToPath as f}from"url";function g(){try{let s=f(import.meta.resolve("sootsim/package.json"));return i.join(i.dirname(s),"skills")}catch{let s=i.dirname(f(import.meta.url));return i.resolve(s,"../../skills")}}var m=g();function d(s){let n=s.match(/^---\n([\s\S]*?)\n---/);if(!n)return null;let e=n[1],o=e.match(/^name:\s*(.+)$/m),r=e.match(/^description:\s*(.+)$/m);return o?{name:o[1].trim(),description:r?.[1]?.trim()||""}:null}function p(){if(!l.existsSync(m))return[];let s=l.readdirSync(m).filter(e=>e.endsWith(".md")),n=[];for(let e of s){let o=l.readFileSync(i.join(m,e),"utf8"),r=d(o);r&&n.push({...r,filename:e})}return n}function u(s,n){let e=i.join(m,s.filename),o=i.join(n,s.filename);l.copyFileSync(e,o),console.log(` copied ${s.name} \u2192 ${o}`)}async function h(s){if(s.includes("--list")||s.includes("-l")||s.length===0){let t=p();if(t.length===0){console.log(" no skills found");return}console.log(`
3
+ available skills:
4
+ `);for(let c of t)console.log(` ${c.name}`),console.log(` ${c.description}
5
+ `);console.log(" usage: sootsim skills <target-dir> [skill-name...]"),console.log(" example: sootsim skills ./my-project"),console.log(` example: sootsim skills ./my-project debug perf
6
+ `);return}let n=s[0];(!n||n.startsWith("-"))&&(console.error(" usage: sootsim skills <target-dir> [skill-name...]"),process.exit(1));let e=i.resolve(n);l.existsSync(e)||(console.error(` target directory does not exist: ${e}`),process.exit(1)),l.statSync(e).isDirectory()||(console.error(` target is not a directory: ${e}`),process.exit(1));let o=p();o.length===0&&(console.error(" no skills found in sootsim package"),process.exit(1));let r=s.slice(1).filter(t=>!t.startsWith("-")),a;r.length===0?a=o:(a=o.filter(t=>r.some(c=>t.name.includes(c)||t.name.replace("sootsim-","").includes(c)||t.filename.includes(c))),a.length===0&&(console.error(` no skills matched: ${r.join(", ")}`),console.error(" available: "+o.map(t=>t.name).join(", ")),process.exit(1))),console.log(`
7
+ installing ${a.length} skill(s) to ${e}
8
+ `);for(let t of a)u(t,e);console.log(`
9
+ done. skills are now available to AI agents in that directory.
10
+ `)}export{h as runSkills};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a}from"./chunk-KQWZZ56P.js";import"./chunk-YCETS3B3.js";import"./chunk-E522F5JW.js";export{a as settingsStore};
@@ -0,0 +1,31 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-E522F5JW.js";import{spawn as m}from"child_process";import{existsSync as h,readdirSync as w}from"fs";import{resolve as u,dirname as x}from"path";import{fileURLToPath as y}from"url";var d=x(y(import.meta.resolve("sootsim-engine/package.json")));async function v(t,r){let l=t.includes("--flows"),f=t.includes("--detox"),c=t.includes("--parallel"),i=t.includes("--watch"),a=t.find((e,o)=>t[o-1]==="--reporter")||"console";if((t.includes("--help")||t.includes("-h"))&&(console.log(`
3
+ sootsim test \u2014 run tests against sootsim
4
+
5
+ usage:
6
+ sootsim test [options]
7
+
8
+ modes:
9
+ (default) run package-local playwright tests
10
+ --flows run YAML flows
11
+ --detox run shared Detox-style conformance suites
12
+
13
+ options:
14
+ --parallel run tests in parallel
15
+ --watch re-run on changes
16
+ --reporter output format (console|json|junit)
17
+ -t, --testNamePattern <pat>
18
+ filter tests by name
19
+
20
+ examples:
21
+ sootsim test
22
+ sootsim test --flows
23
+ sootsim test --detox --watch
24
+ sootsim test -t "login"
25
+
26
+ notes:
27
+ playwright is best for smoke and package-local debugging
28
+ --detox is the preferred parity lane for behavior that should match real RN
29
+ `),process.exit(0)),l)await b(t,r,c,a);else if(f){let{runDetox:e}=await import("./detox-JEGYNTYV.js");await e(t.filter(o=>o!=="--detox"),r)}else await g(t,r)}async function g(t,r){let l=["playwright","test"],f=t.find((e,o)=>t[o-1]==="-t")||t.find((e,o)=>t[o-1]==="--testNamePattern")||t.find((e,o)=>t[o-1]==="--grep");f&&l.push("-g",f),t.includes("--watch")&&l.push("--ui");let c=new Set(["--flows","--detox","--parallel","--watch","--reporter","-t","--testNamePattern","--grep"]);for(let e=0;e<t.length;e++){if(c.has(t[e])){(t[e]==="-t"||t[e]==="--testNamePattern"||t[e]==="--grep"||t[e]==="--reporter")&&e++;continue}l.push(t[e])}console.log(` running: npx ${l.join(" ")}`);let i=m("npx",l,{cwd:d,stdio:"inherit",env:{...process.env}}),a=await new Promise(e=>{i.on("exit",o=>e(o||0))});process.exit(a)}async function b(t,r,l,f){let c=["flows","test/flows","e2e/flows",".maestro","maestro"],i=[];for(let o of c){let s=u(d,o);if(h(s)){let p=w(s).filter(n=>n.endsWith(".yaml")||n.endsWith(".yml"));for(let n of p)i.push(u(s,n))}}for(let o of c){let s=u(process.cwd(),o);if(!s.startsWith(d)&&h(s)){let p=w(s).filter(n=>n.endsWith(".yaml")||n.endsWith(".yml"));for(let n of p)i.push(u(s,n))}}i.length===0&&(console.log(" no flow files found in flows/, test/flows/, or e2e/flows/"),process.exit(0)),console.log(` found ${i.length} flow(s)`);let a=0,e=0;for(let o of i)try{let{runFlowPlayback:s}=await import("./flow-VVOF6UNC.js"),p=r.port?`http://localhost:${r.port}`:"http://localhost:5173";if(await s([o,"--url",p,"--new"])!==0){e++;continue}a++}catch{e++}console.log(`
30
+ results: ${a} passed, ${e} failed (${i.length} total)
31
+ `),process.exit(e>0?1:0)}export{v as runTest};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.0.1 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c as a,d as b}from"./chunk-KXYKAYYB.js";import"./chunk-PWXPA745.js";import"./chunk-OROM7DZI.js";import"./chunk-MPSZ5EWF.js";import"./chunk-3C3ZH7PP.js";import"./chunk-X2U72K7X.js";import"./chunk-E522F5JW.js";export{a as resolveDefaultUploadOrigin,b as runUpload};