sootsim 0.0.4 → 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/LICENSE +21 -0
- package/README.md +24 -9
- package/dist-cli/bin.js +15 -20
- package/dist-cli/chunks/{agent-PJAOF4JS.js → agent-EQRQGSBL.js} +4 -4
- package/dist-cli/chunks/agent-wrapper-AWKZ67GN.js +15 -0
- package/dist-cli/chunks/{assert-P47NW4AF.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-4IO3D5XG.js +2 -0
- 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-WWDJCKMI.js → chunk-B3RAGRK6.js} +1 -1
- package/dist-cli/chunks/chunk-BGAPLYMS.js +61 -0
- package/dist-cli/chunks/chunk-CX3ZIPD3.js +3 -0
- package/dist-cli/chunks/{chunk-I6XGFZPA.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-LDWXH43L.js +4 -0
- 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-6SZMLFCR.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-S74RCIVB.js +2 -0
- package/dist-cli/chunks/chunk-SK4SOISL.js +1 -0
- package/dist-cli/chunks/{chunk-AFQBSK2J.js → chunk-T5L73GJB.js} +1 -1
- package/dist-cli/chunks/{chunk-432TMHBG.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-DQKQYPIG.js → chunk-WHLHA5R5.js} +4 -4
- package/dist-cli/chunks/chunk-WLIVBPPY.js +3 -0
- package/dist-cli/chunks/{chunk-UQ3N6FZF.js → chunk-X6BP5JFC.js} +4 -4
- package/dist-cli/chunks/chunk-YFXTO4QX.js +5 -0
- package/dist-cli/chunks/{chunk-4XBPZQLW.js → chunk-Z5SVSAZO.js} +2 -2
- package/dist-cli/chunks/{chunk-5TTQKPGH.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-ILLJ7VDL.js → compat-QQ3OJDBI.js} +2 -2
- package/dist-cli/chunks/{config-CDIAJIIT.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-6SMCTPMC.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-ZNWYKTWQ.js +23 -0
- package/dist-cli/chunks/{keys-OWQ7SOTM.js → keys-5ETF6DYO.js} +2 -2
- package/dist-cli/chunks/{launch-WUEDHSO5.js → launch-DHUCNFX6.js} +3 -3
- package/dist-cli/chunks/login-KDR34JIP.js +26 -0
- package/dist-cli/chunks/logout-R6WIJYCW.js +2 -0
- package/dist-cli/chunks/maestro-ZOOJ2YVH.js +80 -0
- package/dist-cli/chunks/{preview-4RVHA2PP.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-KEWLM5JR.js → record-IWLEYATN.js} +5 -5
- package/dist-cli/chunks/runtime-WKMNKYTN.js +25 -0
- 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-DJA6QEVR.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-IWUHNFXV.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 +6 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +42 -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 +7 -21
- package/dist-lib/home-paths.cjs +112 -30
- package/dist-lib/host/bridge-host.cjs +1817 -579
- package/dist-lib/host/fetch-proxy-handler.cjs +248 -0
- package/dist-lib/index.cjs +22 -22
- package/dist-lib/metro.cjs +22 -22
- package/dist-lib/profiles.cjs +246 -0
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/vite-base.cjs +3224 -764
- package/dist-lib/vite.cjs +1 -1
- package/package.json +11 -3
- package/dist-cli/chunks/agent-wrapper-STO7PLQD.js +0 -15
- package/dist-cli/chunks/auto-bootstrap-SC2LMI2H.js +0 -2
- package/dist-cli/chunks/chunk-47S5DXXX.js +0 -11
- package/dist-cli/chunks/chunk-4VXB2DBA.js +0 -119
- package/dist-cli/chunks/chunk-AUR2LTNX.js +0 -3
- package/dist-cli/chunks/chunk-BQRM4E66.js +0 -4
- package/dist-cli/chunks/chunk-C3QLIYCS.js +0 -16
- package/dist-cli/chunks/chunk-EHMSE3Q3.js +0 -2
- package/dist-cli/chunks/chunk-F4ARVCRR.js +0 -1
- package/dist-cli/chunks/chunk-HAKR72LJ.js +0 -2
- package/dist-cli/chunks/chunk-HGFIS26A.js +0 -2
- package/dist-cli/chunks/chunk-MQDPKSCK.js +0 -308
- package/dist-cli/chunks/chunk-MZPAJ5PQ.js +0 -1
- package/dist-cli/chunks/chunk-OAHMYSMD.js +0 -2
- package/dist-cli/chunks/chunk-QIP7LYQI.js +0 -5
- package/dist-cli/chunks/chunk-QQOBLF7O.js +0 -22
- package/dist-cli/chunks/chunk-SY74J6F4.js +0 -5
- package/dist-cli/chunks/chunk-UKYK63H6.js +0 -3
- package/dist-cli/chunks/chunk-UNFERMZ3.js +0 -27
- package/dist-cli/chunks/chunk-VGXARPIH.js +0 -3
- package/dist-cli/chunks/chunk-W3TYN64D.js +0 -62
- package/dist-cli/chunks/chunk-W7CYWXRZ.js +0 -4
- package/dist-cli/chunks/chunk-WRF43M33.js +0 -4
- package/dist-cli/chunks/chunk-WVBPATRA.js +0 -2
- package/dist-cli/chunks/chunk-XJF46GU2.js +0 -2
- package/dist-cli/chunks/chunk-ZF5FCFLD.js +0 -2
- package/dist-cli/chunks/chunk-ZKNI5MRD.js +0 -1
- package/dist-cli/chunks/control-7QGKUCAX.js +0 -2
- package/dist-cli/chunks/daemon-4BLYGM5N.js +0 -49
- package/dist-cli/chunks/demo-app-registry-HLI5UGGI.js +0 -2
- package/dist-cli/chunks/detox-R4G5INNB.js +0 -49
- package/dist-cli/chunks/device-YSLCWS4E.js +0 -16
- package/dist-cli/chunks/drivers-YIXRFFBQ.js +0 -2
- package/dist-cli/chunks/electron-JZOFO37G.js +0 -15
- package/dist-cli/chunks/flow-L7X5FGIN.js +0 -2
- package/dist-cli/chunks/hints-O4QR6UGI.js +0 -2
- package/dist-cli/chunks/home-paths-4YJJYGR6.js +0 -2
- package/dist-cli/chunks/inspect-DRFAUJUH.js +0 -1030
- package/dist-cli/chunks/install-BATRTWRI.js +0 -65
- package/dist-cli/chunks/install-desktop-6X474IQ3.js +0 -23
- package/dist-cli/chunks/install-dev-desktop-CAJHPRNP.js +0 -100
- package/dist-cli/chunks/login-54YJ2KH6.js +0 -26
- package/dist-cli/chunks/logout-XECXLEXW.js +0 -2
- package/dist-cli/chunks/maestro-PMHK6EHI.js +0 -75
- package/dist-cli/chunks/profile-3IVNHUS6.js +0 -22
- package/dist-cli/chunks/runtime-PJKHEB36.js +0 -25
- package/dist-cli/chunks/screenshot-BXRAQERZ.js +0 -26
- package/dist-cli/chunks/screenshot-mode-5IXEDIUS.js +0 -17
- package/dist-cli/chunks/screenshots-T4MQF3TB.js +0 -70
- package/dist-cli/chunks/server-CIP3LH45.js +0 -29
- package/dist-cli/chunks/store-SPC247DB.js +0 -2
- package/dist-cli/chunks/upload-UPD2RSYF.js +0 -2
- package/dist-cli/chunks/whoami-MCXFWKIH.js +0 -2
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as j,b as P}from"./chunk-6SZMLFCR.js";import{d as b}from"./chunk-HAKR72LJ.js";import"./chunk-C3QLIYCS.js";import"./chunk-W7CYWXRZ.js";import"./chunk-MZPAJ5PQ.js";import"./chunk-WRF43M33.js";import"./chunk-WWDJCKMI.js";import{execSync as V}from"child_process";import{existsSync as w,readFileSync as C,writeFileSync as x}from"fs";import{relative as A,resolve as u}from"path";import{existsSync as a,readFileSync as d,readdirSync as O,statSync as L}from"fs";import{basename as R,dirname as T,join as c}from"path";function S(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 s=c(n,"package.json");if(a(s))try{if(JSON.parse(d(s,"utf8")).workspaces)return n}catch{}let i=T(n);if(i===n)break;n=i}return e}function W(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 _(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(d(n,"utf8")).workspaces)return"npm-workspaces"}catch{}return"single"}function J(e){return e.one?"one":e.expo?"expo":e["react-native"]?"bare":"unknown"}function y(e){let n=c(e,"package.json");if(!a(n))return null;let s;try{s=JSON.parse(d(n,"utf8"))}catch{return null}let i={...s.dependencies,...s.devDependencies},r=J(i);return r==="unknown"?null:{dir:e,name:s.name||R(e),framework:r,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")),hasSootsimDependency:!!i.sootsim,devCommand:s.scripts?.dev||null}}function N(e){let n=[],s=c(e,"pnpm-workspace.yaml");if(a(s)){let o=d(s,"utf8").match(/packages:\s*\n((?:\s+-\s+.+\n?)+)/);if(o){let t=o[1].split(`
|
|
3
|
-
`).filter(Boolean);for(let g of t){let l=g.replace(/^\s*-\s*['"]?/,"").replace(/['"]?\s*$/,"");l&&n.push(...v(e,l))}}return n}let i=c(e,"package.json");if(a(i))try{let r=JSON.parse(d(i,"utf8")),o=Array.isArray(r.workspaces)?r.workspaces:r.workspaces?.packages||[];for(let t of o)n.push(...v(e,t))}catch{}return n}function v(e,n){let s=n.replace(/\/\*\*?$/,"").replace(/\*$/,""),i=c(e,s);if(!a(i))return[];try{return O(i).map(o=>c(i,o)).filter(o=>{try{return L(o).isDirectory()&&a(c(o,"package.json"))}catch{return!1}})}catch{return[]}}function D(e){let n=_(e),s=W(e);if(n==="single"){let t=y(e);return{root:e,type:n,packageManager:s,apps:t?[t]:[]}}let i=N(e),r=[],o=y(e);o&&r.push(o);for(let t of i){if(t===e)continue;let g=y(t);g&&r.push(g)}return{root:e,type:n,packageManager:s,apps:r}}function M(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"),s=e.includes("--dry-run"),i=process.cwd(),r=S(i),o=D(r);if(console.log(`
|
|
16
|
-
sootsim \u2014 project setup
|
|
17
|
-
`),!s)try{await b()}catch(p){console.error(` bootstrap failed: ${p instanceof Error?p.message:String(p)}`),console.error(" continuing with project setup; rerun later if needed.")}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 p=await P("which app?",o.apps.map(f=>`${(A(r,f.dir)||".").padEnd(30)} (${f.framework})`));t=o.apps[p]}else t=o.apps[0];let g=t.framework==="one"?"metro (via one)":t.framework==="expo"?"metro (via expo)":"metro";console.log(" detected:"),console.log(` framework: ${t.framework}`),console.log(` bundler: ${g}`),console.log(` package: ${t.name}`),console.log(` manager: ${o.packageManager}`),console.log();let l=[];if(!t.hasSootsimDependency){let p=M(o.packageManager);l.push({label:"add sootsim as devDependency",run:()=>{V(p,{cwd:t.dir,stdio:"pipe"})}})}t.framework==="one"&&t.hasViteConfig?l.push({label:"add sootsimPlugin() to vite.config.ts",run:()=>$(t.dir)}):(t.framework==="expo"||t.framework==="bare")&&t.hasMetroConfig?l.push({label:"add withSootsim() to metro.config.js",run:()=>B(t.dir)}):t.framework==="one"?l.push({label:"add sootsimPlugin() to vite.config.ts",run:()=>$(t.dir)}):l.push({label:"create metro.config.js with withSootsim()",run:()=>G(t.dir,t.framework)}),console.log(" will:"),l.forEach((p,f)=>console.log(` ${f+1}. ${p.label}`)),console.log(),s&&(console.log(` (dry run \u2014 no changes made)
|
|
20
|
-
`),process.exit(0)),n||(await j("continue?")||(console.log(`
|
|
21
|
-
cancelled.
|
|
22
|
-
`),process.exit(0)),console.log());for(let p=0;p<l.length;p++){let f=l[p];process.stdout.write(` [${p+1}/${l.length}] ${f.label}...`);try{f.run(),console.log(" done")}catch(h){console.log(` failed: ${h.message}`),(f.label.includes("vite.config")||f.label.includes("metro.config"))&&U(t)}}console.log(`
|
|
23
|
-
done! run your app normally and hit:
|
|
24
|
-
|
|
25
|
-
then open:
|
|
26
|
-
http://localhost:8081/__soot/
|
|
27
|
-
`)}function $(e){let n=u(e,"vite.config.ts")||u(e,"vite.config.js"),s=u(e,"vite.config.ts"),i=u(e,"vite.config.js"),r=w(s)?s:i;if(!w(r))throw new Error(`no vite config found at ${e}`);let o=C(r,"utf8");if(o.includes("sootsimPlugin")){console.log(" (already configured)");return}let t="import { sootsimPlugin } from 'sootsim/vite'",g=/^(import\s+.+)$/gm,l=0,p;for(;(p=g.exec(o))!==null;)l=p.index+p[0].length;l>0?o=o.slice(0,l)+`
|
|
28
|
-
`+t+o.slice(l):o=t+`
|
|
29
|
-
`+o;let f=o.match(/plugins\s*:\s*\[/);if(f&&f.index!==void 0){let h=f.index+f[0].length,k=1,m=h;for(;m<o.length&&k>0;)o[m]==="["&&k++,o[m]==="]"&&k--,k>0&&m++;let q=o.slice(0,m),E=o.slice(m),I=o.slice(h).match(/\n(\s+)\S/)?.[1]||" ",F=o.slice(o.lastIndexOf(`
|
|
30
|
-
`,m),m+1).match(/\n(\s*)/)?.[1]||" ";o=q.trimEnd()+`
|
|
31
|
-
`+I+`sootsimPlugin(),
|
|
32
|
-
`+F+E}else throw new Error("could not find plugins array in vite config");x(r,o)}function B(e){let n=u(e,"metro.config.js"),s=u(e,"metro.config.ts"),i=w(n)?n:s;if(!w(i))throw new Error(`no metro config found at ${e}`);let r=C(i,"utf8");if(r.includes("withSootsim")){console.log(" (already configured)");return}r="const { withSootsim } = require('sootsim/metro')"+`
|
|
33
|
-
`+r,r=r.replace(/(module\.exports\s*=\s*)([^;]+)/,(t,g,l)=>`${g}withSootsim(${l.trim()})`),x(i,r)}function G(e,n){let s=u(e,"metro.config.js"),i;n==="expo"?i=`const { getDefaultConfig } = require('expo/metro-config')
|
|
34
|
-
const { withSootsim } = require('sootsim/metro')
|
|
35
|
-
|
|
36
|
-
const config = getDefaultConfig(__dirname)
|
|
37
|
-
|
|
38
|
-
module.exports = withSootsim(config)
|
|
39
|
-
`:i=`const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config')
|
|
40
|
-
const { withSootsim } = require('sootsim/metro')
|
|
41
|
-
|
|
42
|
-
const config = {}
|
|
43
|
-
|
|
44
|
-
module.exports = withSootsim(mergeConfig(getDefaultConfig(__dirname), config))
|
|
45
|
-
`,x(s,i)}function U(e){e.framework==="one"?console.log(`
|
|
46
|
-
manual setup \u2014 add to your vite.config.ts:
|
|
47
|
-
|
|
48
|
-
import { sootsimPlugin } from 'sootsim/vite'
|
|
49
|
-
|
|
50
|
-
export default {
|
|
51
|
-
plugins: [
|
|
52
|
-
one({ /* ... */ }),
|
|
53
|
-
sootsimPlugin(),
|
|
54
|
-
],
|
|
55
|
-
}
|
|
56
|
-
`):console.log(`
|
|
57
|
-
manual setup \u2014 add to your metro.config.js:
|
|
58
|
-
|
|
59
|
-
const { withSootsim } = require('sootsim/metro')
|
|
60
|
-
module.exports = withSootsim(config)
|
|
61
|
-
`)}async function ie(){console.log(`
|
|
62
|
-
sootsim uninstall is no longer needed.
|
|
63
|
-
to remove sootsim, just remove the plugin from your config
|
|
64
|
-
and remove sootsim from your dependencies.
|
|
65
|
-
`)}export{re as runInstall,ie as runUninstall};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as x}from"./chunk-6SZMLFCR.js";import{a as $}from"./chunk-SY74J6F4.js";import"./chunk-WWDJCKMI.js";import{spawn as v,spawnSync as u}from"child_process";import{chmodSync as k,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),k(n,493),n}async function B(r){return await new Promise((o,n)=>{let s=v("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 optional desktop GUI
|
|
5
|
-
|
|
6
|
-
the CLI + daemon are the canonical sootsim surface; the GUI is optional.
|
|
7
|
-
if you just want to drive a running metro/expo dev server from the
|
|
8
|
-
terminal, you don't need this.
|
|
9
|
-
|
|
10
|
-
usage:
|
|
11
|
-
sootsim install-desktop [options]
|
|
12
|
-
|
|
13
|
-
options:
|
|
14
|
-
-y, --yes skip confirmation and install immediately
|
|
15
|
-
--force reinstall even if the companion is already present
|
|
16
|
-
|
|
17
|
-
examples:
|
|
18
|
-
sootsim install-desktop
|
|
19
|
-
sootsim install-desktop --yes
|
|
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=$();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}...
|
|
21
|
-
`);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(`
|
|
22
|
-
download failed: ${t instanceof Error?t.message:String(t)}`),process.exit(1)}process.stdout.isTTY&&process.stdout.write(`
|
|
23
|
-
`);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};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as b}from"./chunk-6SZMLFCR.js";import"./chunk-WWDJCKMI.js";import{spawnSync as m}from"child_process";import{chmodSync as $,existsSync as u,mkdirSync as y,rmSync as N,writeFileSync as g,cpSync as B}from"fs";import{dirname as p,join as s,resolve as k}from"path";import{fileURLToPath as S}from"url";var C=p(S(import.meta.resolve("sootsim-engine/package.json"))),I="sootsim-dev",E="dev.sootsim.simulator.dev";function w(e){let n={yes:e.includes("--yes")||e.includes("-y")||process.env.SOOTSIM_NO_PROMPT==="1"||process.env.CI==="1"||!process.stdin.isTTY,force:e.includes("--force"),appName:I,bundleId:E};for(let o=0;o<e.length;o++){let t=e[o];t==="--name"&&e[o+1]?n.appName=e[++o]:t==="--bundle-id"&&e[o+1]?n.bundleId=e[++o]:t==="--path"&&e[o+1]&&(n.installRoot=e[++o])}return n}function T(e){let r=process.platform==="darwin"?"electron/dist/Electron.app/Contents/MacOS/Electron":process.platform==="win32"?"electron/dist/electron.exe":"electron/dist/electron",c=e;for(let l=0;l<6;l++){let d=s(c,"node_modules",r);if(u(d))return d;let i=p(c);if(i===c)break;c=i}return null}function D(e){if(e)return k(e);let n="/Applications",o=k(process.env.HOME||"","Applications");try{let t=s(n,`.sootsim-dev-write-probe-${process.pid}`);if(m("touch",[t]).status===0&&u(t))return N(t,{force:!0}),n}catch{}return y(o,{recursive:!0}),o}function L(e){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
4
|
-
<plist version="1.0">
|
|
5
|
-
<dict>
|
|
6
|
-
<key>CFBundleDisplayName</key>
|
|
7
|
-
<string>${e.appName}</string>
|
|
8
|
-
<key>CFBundleName</key>
|
|
9
|
-
<string>${e.appName}</string>
|
|
10
|
-
<key>CFBundleExecutable</key>
|
|
11
|
-
<string>${e.appName}</string>
|
|
12
|
-
<key>CFBundleIconFile</key>
|
|
13
|
-
<string>icon.icns</string>
|
|
14
|
-
<key>CFBundleIdentifier</key>
|
|
15
|
-
<string>${e.bundleId}</string>
|
|
16
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
|
17
|
-
<string>6.0</string>
|
|
18
|
-
<key>CFBundlePackageType</key>
|
|
19
|
-
<string>APPL</string>
|
|
20
|
-
<key>CFBundleShortVersionString</key>
|
|
21
|
-
<string>${e.version}</string>
|
|
22
|
-
<key>CFBundleVersion</key>
|
|
23
|
-
<string>${e.version}</string>
|
|
24
|
-
<key>LSApplicationCategoryType</key>
|
|
25
|
-
<string>public.app-category.developer-tools</string>
|
|
26
|
-
<key>LSMinimumSystemVersion</key>
|
|
27
|
-
<string>12.0</string>
|
|
28
|
-
<key>NSHighResolutionCapable</key>
|
|
29
|
-
<true/>
|
|
30
|
-
<key>NSAppTransportSecurity</key>
|
|
31
|
-
<dict>
|
|
32
|
-
<key>NSAllowsArbitraryLoads</key>
|
|
33
|
-
<true/>
|
|
34
|
-
<key>NSAllowsLocalNetworking</key>
|
|
35
|
-
<true/>
|
|
36
|
-
</dict>
|
|
37
|
-
<key>CFBundleURLTypes</key>
|
|
38
|
-
<array>
|
|
39
|
-
<dict>
|
|
40
|
-
<key>CFBundleTypeRole</key>
|
|
41
|
-
<string>Viewer</string>
|
|
42
|
-
<key>CFBundleURLName</key>
|
|
43
|
-
<string>sootsim</string>
|
|
44
|
-
<key>CFBundleURLSchemes</key>
|
|
45
|
-
<array>
|
|
46
|
-
<string>sootsim</string>
|
|
47
|
-
</array>
|
|
48
|
-
</dict>
|
|
49
|
-
</array>
|
|
50
|
-
</dict>
|
|
51
|
-
</plist>
|
|
52
|
-
`}function F(e){return`#!/bin/bash
|
|
53
|
-
# auto-generated by: sootsim install-dev-desktop
|
|
54
|
-
# checkout: ${e.checkoutRoot}
|
|
55
|
-
# regenerate: cd ${e.checkoutRoot} && bun sootsim install-dev-desktop --force
|
|
56
|
-
set -e
|
|
57
|
-
ELECTRON_BIN=${JSON.stringify(e.electronBin)}
|
|
58
|
-
ENGINE_DIR=${JSON.stringify(e.engineDir)}
|
|
59
|
-
CHECKOUT_ROOT=${JSON.stringify(e.checkoutRoot)}
|
|
60
|
-
if [ ! -x "$ELECTRON_BIN" ]; then
|
|
61
|
-
/usr/bin/osascript -e "display alert \\"sootsim-dev\\" message \\"Electron not found at $ELECTRON_BIN. Run bun install in $CHECKOUT_ROOT, then re-run sootsim install-dev-desktop.\\""
|
|
62
|
-
exit 1
|
|
63
|
-
fi
|
|
64
|
-
if [ ! -f "$ENGINE_DIR/dist-electron/main.cjs" ]; then
|
|
65
|
-
/usr/bin/osascript -e "display alert \\"sootsim-dev\\" message \\"Engine not built at $ENGINE_DIR. Run bun dev (or bun run --cwd packages/sootsim-engine build:electron-main) in $CHECKOUT_ROOT.\\""
|
|
66
|
-
exit 1
|
|
67
|
-
fi
|
|
68
|
-
cd "$CHECKOUT_ROOT"
|
|
69
|
-
exec "$ELECTRON_BIN" "$ENGINE_DIR" "$@"
|
|
70
|
-
`}function _(e,n){let o=s(e,"Contents"),t=s(o,"MacOS"),r=s(o,"Resources");y(t,{recursive:!0}),y(r,{recursive:!0}),g(s(o,"Info.plist"),L({appName:n.appName,bundleId:n.bundleId,version:n.version})),g(s(o,"PkgInfo"),"APPL????");let c=s(t,n.appName);g(c,F({electronBin:n.electronBin,engineDir:n.engineDir,checkoutRoot:n.checkoutRoot})),$(c,493),n.iconSource&&u(n.iconSource)&&B(n.iconSource,s(r,"icon.icns"))}async function j(e){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
71
|
-
sootsim install-dev-desktop \u2014 create a Spotlight-launchable sootsim-dev.app
|
|
72
|
-
that wraps this checkout's unpacked electron.
|
|
73
|
-
|
|
74
|
-
the packaged /Applications/sootsim.app always loads the prod renderer
|
|
75
|
-
(sootbean.com). this command generates a separate .app bundle that shells
|
|
76
|
-
out to the local node_modules/.bin/electron against packages/sootsim-engine,
|
|
77
|
-
so launching it from Spotlight drops you into the live :5173 dev renderer
|
|
78
|
-
(or onboarding if no dev server is up).
|
|
79
|
-
|
|
80
|
-
usage:
|
|
81
|
-
sootsim install-dev-desktop [options]
|
|
82
|
-
|
|
83
|
-
options:
|
|
84
|
-
-y, --yes skip confirmation prompt
|
|
85
|
-
--force overwrite existing bundle
|
|
86
|
-
--name <name> .app bundle name (default: ${I})
|
|
87
|
-
--bundle-id <id> CFBundleIdentifier (default: ${E})
|
|
88
|
-
--path <dir> install root (default: /Applications, fallback ~/Applications)
|
|
89
|
-
|
|
90
|
-
examples:
|
|
91
|
-
bun sootsim install-dev-desktop
|
|
92
|
-
bun sootsim install-dev-desktop --force
|
|
93
|
-
bun sootsim install-dev-desktop --name sootsim-worktree --bundle-id dev.sootsim.simulator.wt
|
|
94
|
-
`),process.exit(0));let n=w(e),o=C,t=s(o,"dist-electron/main.cjs");u(t)||(console.error(` dist-electron/main.cjs missing in ${o}.
|
|
95
|
-
run:
|
|
96
|
-
bun run --cwd packages/sootsim-engine build:electron-main
|
|
97
|
-
(or keep it fresh with: bun run watch:sootsim:electron-main)
|
|
98
|
-
`),process.exit(1));let r=T(o);r||(console.error(` no node_modules/.bin/electron found near ${o}.
|
|
99
|
-
run \`bun install\` in the soot checkout first.
|
|
100
|
-
`),process.exit(1));let c=process.platform==="darwin"?6:2,l=p(r);for(let a=0;a<c;a++)l=p(l);l=k(l);let d=D(n.installRoot),i=s(d,`${n.appName}.app`),f=s(o,"release/.icon-icns/icon.icns"),O=u(f)?f:null;if(console.log(` engine: ${o}`),console.log(` electron: ${r}`),console.log(` checkout: ${l}`),console.log(` install to: ${i}`),console.log(` bundle id: ${n.bundleId}`),console.log(),u(i)&&!n.force){console.log(` ${i} already exists. pass --force to overwrite.`);return}if(!n.yes){if(!await b("create the sootsim-dev bundle here?",!0)){console.log(" cancelled.");return}console.log()}let h="0.0.0";try{let a=S(import.meta.resolve("sootsim-engine/package.json")),{readFileSync:R}=await import("fs"),v=JSON.parse(R(a,"utf8"));typeof v.version=="string"&&(h=v.version)}catch{}u(i)&&N(i,{recursive:!0,force:!0});try{_(i,{appName:n.appName,bundleId:n.bundleId,electronBin:r,engineDir:o,checkoutRoot:l,version:h,iconSource:O})}catch(a){console.error(` bundle write failed: ${a instanceof Error?a.message:String(a)}`),process.exit(1)}m("/usr/bin/touch",[i]),m("/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister",["-f",i],{stdio:"ignore"}),console.log(` created: ${i}`),console.log(),console.log(" launch it:"),console.log(` open -a ${n.appName}`),console.log(" (or type its name into Spotlight)"),console.log(),console.log(" it runs this checkout's electron against the live dev renderer."),console.log(" start the dev server first: bun dev")}export{j as runInstallDevDesktop};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{b as g,d as f}from"./chunk-UKYK63H6.js";import"./chunk-WWDJCKMI.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:#000;color:#fff;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:#ccc">${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"),y=l.searchParams.get("state"),k=l.searchParams.get("token"),b=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(y!==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:b,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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as e,c as t}from"./chunk-UKYK63H6.js";import"./chunk-WWDJCKMI.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};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{c as h}from"./chunk-MQDPKSCK.js";import"./chunk-QIP7LYQI.js";import"./chunk-UNFERMZ3.js";import"./chunk-DQKQYPIG.js";import"./chunk-ZKNI5MRD.js";import"./chunk-QQOBLF7O.js";import"./chunk-W3TYN64D.js";import"./chunk-AUR2LTNX.js";import"./chunk-UKYK63H6.js";import"./chunk-4XBPZQLW.js";import"./chunk-XJF46GU2.js";import"./chunk-EHMSE3Q3.js";import"./chunk-I6XGFZPA.js";import"./chunk-47S5DXXX.js";import"./chunk-OAHMYSMD.js";import"./chunk-5TTQKPGH.js";import"./chunk-WVBPATRA.js";import"./chunk-HGFIS26A.js";import"./chunk-C3QLIYCS.js";import"./chunk-W7CYWXRZ.js";import"./chunk-MZPAJ5PQ.js";import"./chunk-WRF43M33.js";import"./chunk-ZF5FCFLD.js";import"./chunk-SY74J6F4.js";import"./chunk-WWDJCKMI.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};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{c as I,e as N,i as S}from"./chunk-C3QLIYCS.js";import"./chunk-W7CYWXRZ.js";import"./chunk-MZPAJ5PQ.js";import"./chunk-WRF43M33.js";import"./chunk-WWDJCKMI.js";import{createWriteStream as v,mkdirSync as k,writeFileSync as w}from"fs";import{dirname as T,resolve as x}from"path";import{Readable as y}from"stream";import{pipeline as C}from"stream/promises";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 C(y.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};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as k}from"./chunk-C3QLIYCS.js";import"./chunk-W7CYWXRZ.js";import"./chunk-MZPAJ5PQ.js";import{h as v,l as S,o as p,p as d,q as R,r as w}from"./chunk-WRF43M33.js";import"./chunk-WWDJCKMI.js";import{spawn as T}from"child_process";import N from"crypto";import i from"fs";import g from"path";import{Readable as A}from"stream";import{pipeline as C}from"stream/promises";import{WebSocket as M}from"ws";var O="https://sootbean.com",P="SOOTSIM_CDN_ORIGIN";function y(){let e=process.env[P];return e&&e.length>0?e.replace(/\/+$/,""):O}function j(){let e=new URL(`${y()}/runtimes/manifest.json`);return e.searchParams.set("t",String(Date.now())),e.toString()}function _(e){return`${y()}/runtimes/sootsim-runtime-${e}.tar.gz`}async function se(e,n={}){let[s,...t]=e;if(!s||s==="--help"||s==="-h"){I();return}switch(s){case"install":return E(t,n);case"list":case"ls":return U(t);case"use":return L(t);case"remove":case"rm":return W(t);case"which":case"active":return V();default:console.error(` unknown runtime subcommand: ${s}`),I(),process.exit(1)}}function I(){console.log(`
|
|
3
|
-
sootsim runtime \u2014 manage engine runtimes under ~/.sootsim/runtimes/
|
|
4
|
-
|
|
5
|
-
usage:
|
|
6
|
-
sootsim runtime install [version] install a version (default: channel latest)
|
|
7
|
-
sootsim runtime list show installed + available versions
|
|
8
|
-
sootsim runtime use <version> switch active runtime
|
|
9
|
-
sootsim runtime remove <version> delete an installed runtime
|
|
10
|
-
sootsim runtime which print active runtime version
|
|
11
|
-
|
|
12
|
-
flags:
|
|
13
|
-
--channel <name> channel to resolve 'latest' from (default: stable)
|
|
14
|
-
--force reinstall even if the version is already on disk
|
|
15
|
-
--set-active=false do not switch active runtime after install
|
|
16
|
-
|
|
17
|
-
environment:
|
|
18
|
-
SOOTSIM_CDN_ORIGIN override the CDN base URL (default: ${O})
|
|
19
|
-
|
|
20
|
-
examples:
|
|
21
|
-
sootsim runtime install
|
|
22
|
-
sootsim runtime install 1.2.3
|
|
23
|
-
sootsim runtime install --channel beta
|
|
24
|
-
sootsim runtime use 1.2.3
|
|
25
|
-
`)}async function E(e,n){let{version:s,flags:t}=z(e),o=t.channel??n.channel??"stable",a=t.force===!0,f=t.setActive!==!1;p(),console.log("sootsim runtime install"),console.log(` cdn: ${y()}`);let l=await D(),m=s||l.channels[o]?.latest;m||(console.error(` no version specified and channel '${o}' has no latest entry in the manifest`),process.exit(1));let r=m,u=l.versions[r];u||(console.error(` version ${r} not found in manifest`),console.error(` available: ${Object.keys(l.versions).slice(-10).join(", ")||"(none)"}`),process.exit(1)),console.log(` version: ${r} (channel: ${o})`);let c=v(r);if(!a&&i.existsSync(g.join(c,"index.html"))){console.log(` already installed at ${c}`),f&&await $(r);return}let b=u.tarball||_(r),h=g.join(S(),`sootsim-runtime-${r}.tar.gz`);console.log(` fetch: ${b}`),await G(b,h),console.log(" verify: sha256");let x=await H(h);x!==u.sha256&&(i.rmSync(h,{force:!0}),console.error(" sha256 mismatch"),console.error(` expected: ${u.sha256}`),console.error(` actual: ${x}`),process.exit(1)),console.log(` extract: ${c}`),i.rmSync(c,{recursive:!0,force:!0}),i.mkdirSync(c,{recursive:!0}),await q(h,c),i.existsSync(g.join(c,"index.html"))||(console.error(" extracted tarball is missing index.html \u2014 corrupted runtime"),process.exit(1)),console.log(` installed ${r}`),f&&await $(r)}async function $(e){R(e),console.log(` active: ${e}`),await F(e)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${e})`)}async function F(e){let{isDaemonLockfileFresh:n,readDaemonLockfile:s}=await import("./home-paths-4YJJYGR6.js"),t=s();if(!n(t))return!1;let o=k();return new Promise(a=>{let f=!1,l=!1,m=c=>{f||(f=!0,a(c))},r=new M(`ws://127.0.0.1:${o}`,{handshakeTimeout:800}),u=setTimeout(()=>{try{r.close()}catch{}m(l)},1500);r.on("open",()=>{try{r.send(JSON.stringify({type:"runtime:use",version:e,id:0})),l=!0}catch{}setTimeout(()=>{try{r.close()}catch{}},100)}),r.on("close",()=>{clearTimeout(u),m(l)}),r.on("error",()=>{clearTimeout(u),m(!1)})})}async function U(e){p();let n=w(),s=d();if(console.log("installed:"),n.length===0)console.log(" (none)");else for(let t of n)console.log(` ${t===s?"*":" "} ${t}`);try{let t=await D();console.log("available (latest per channel):");for(let[o,a]of Object.entries(t.channels))console.log(` ${o.padEnd(8)} ${a.latest}`)}catch(t){console.log(`available: (could not fetch manifest: ${B(t)})`)}}async function L(e){let n=e[0];n||(console.error(" usage: sootsim runtime use <version>"),process.exit(1));let s=w();s.includes(n)||(console.error(` version ${n} is not installed`),console.error(` installed: ${s.join(", ")||"(none)"}`),console.error(` run \`sootsim runtime install ${n}\` first`),process.exit(1)),await $(n)}async function W(e){let n=e[0];n||(console.error(" usage: sootsim runtime remove <version>"),process.exit(1)),d()===n&&(console.error(` cannot remove active runtime ${n}`),console.error(" switch with `sootsim runtime use <other>` first, or install another version"),process.exit(1));let t=v(n);if(!i.existsSync(t)){console.error(` ${n} is not installed`);return}i.rmSync(t,{recursive:!0,force:!0}),console.log(` removed ${n}`)}async function V(){let e=d();if(!e){console.log(" no active runtime");return}console.log(e)}function z(e){let n={},s=[];for(let t=0;t<e.length;t++){let o=e[t];if(o==="--channel"&&t+1<e.length){n.channel=e[t+1],t++;continue}if(o.startsWith("--channel=")){n.channel=o.slice(10);continue}if(o==="--force"){n.force=!0;continue}if(o==="--set-active=false"||o==="--no-set-active"){n.setActive=!1;continue}s.push(o)}return{version:s[0]??null,flags:n}}async function D(){let e=j(),n=await fetch(e,{headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`manifest fetch failed: ${n.status} ${n.statusText} (${e})`);return await n.json()}async function G(e,n){let s=await fetch(e);if(!s.ok||!s.body)throw new Error(`download failed: ${s.status} ${s.statusText} (${e})`);i.mkdirSync(g.dirname(n),{recursive:!0});let t=`${n}.partial`;try{await C(A.fromWeb(s.body),i.createWriteStream(t)),i.renameSync(t,n)}catch(o){try{i.unlinkSync(t)}catch{}throw o}}function H(e){return new Promise((n,s)=>{let t=N.createHash("sha256"),o=i.createReadStream(e);o.on("data",a=>t.update(a)),o.on("error",s),o.on("end",()=>n(t.digest("hex")))})}function q(e,n){return new Promise((s,t)=>{let o=T("tar",["-xzf",e,"-C",n],{stdio:["ignore","inherit","inherit"]});o.on("error",t),o.on("exit",a=>{a===0?s():t(new Error(`tar exited with code ${a}`))})})}function B(e){return e instanceof Error?e.message:String(e)}export{se as runRuntime};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as v}from"./chunk-DQKQYPIG.js";import"./chunk-ZKNI5MRD.js";import"./chunk-4XBPZQLW.js";import"./chunk-XJF46GU2.js";import{f}from"./chunk-EHMSE3Q3.js";import{a as x}from"./chunk-AFQBSK2J.js";import{c as h,d as g,e as w,h as y}from"./chunk-C3QLIYCS.js";import"./chunk-W7CYWXRZ.js";import"./chunk-MZPAJ5PQ.js";import"./chunk-WRF43M33.js";import"./chunk-WWDJCKMI.js";import{mkdirSync as _,writeFileSync as S}from"fs";import{dirname as R,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=h(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=g(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=w({...e,commandTimeoutMs:1e4});try{let l=o,n=o?.__matcher;if(n){let p=await r.send({type:"evaluate",code:x(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 m=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(m,p);S(d,$),console.log(` frame: ${p}`)}else S(d,m);console.log(` saved: ${d}`)}finally{r.close()}}async function T(e){let t=await y(e,"SootSim.bridges.settings.get")??{deviceModel:null},o=typeof t.deviceModel=="string"?t.deviceModel:null;return!o||!(o in f)?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};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{c,e as i,h as d}from"./chunk-C3QLIYCS.js";import"./chunk-W7CYWXRZ.js";import"./chunk-MZPAJ5PQ.js";import"./chunk-WRF43M33.js";import"./chunk-WWDJCKMI.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.positional[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};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.0.4 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{c as Y}from"./chunk-MQDPKSCK.js";import"./chunk-QIP7LYQI.js";import"./chunk-UNFERMZ3.js";import{b as j}from"./chunk-DQKQYPIG.js";import"./chunk-ZKNI5MRD.js";import"./chunk-QQOBLF7O.js";import"./chunk-W3TYN64D.js";import"./chunk-AUR2LTNX.js";import"./chunk-UKYK63H6.js";import"./chunk-4XBPZQLW.js";import"./chunk-XJF46GU2.js";import{a as w,b as D,c as k,d as z,e as x,f as T}from"./chunk-EHMSE3Q3.js";import{b as O}from"./chunk-I6XGFZPA.js";import"./chunk-47S5DXXX.js";import"./chunk-OAHMYSMD.js";import"./chunk-5TTQKPGH.js";import"./chunk-WVBPATRA.js";import"./chunk-HGFIS26A.js";import"./chunk-C3QLIYCS.js";import"./chunk-W7CYWXRZ.js";import"./chunk-MZPAJ5PQ.js";import"./chunk-WRF43M33.js";import"./chunk-ZF5FCFLD.js";import"./chunk-SY74J6F4.js";import"./chunk-WWDJCKMI.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 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};
|