sootsim 0.1.202 → 0.1.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cli/bin.js +4 -4
- package/dist-cli/chunks/{agent-SP6EE5XV.js → agent-PWM4XT5H.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-PWZVJ3OK.js → agent-wrapper-V2BSTANB.js} +2 -2
- package/dist-cli/chunks/{app-fonts-EMJB6QLM.js → app-fonts-7M4PTF6W.js} +2 -2
- package/dist-cli/chunks/{assert-H2B6TDXT.js → assert-SEW5OJL3.js} +2 -2
- package/dist-cli/chunks/{auth-SOHXBYLQ.js → auth-3YY55NBL.js} +2 -2
- package/dist-cli/chunks/beta-Y4ZJUKAM.js +2 -0
- package/dist-cli/chunks/{camera-ULLCBM5H.js → camera-CYXCASB3.js} +2 -2
- package/dist-cli/chunks/{chunk-4NM6JBYH.js → chunk-4NHPXU3X.js} +1 -1
- package/dist-cli/chunks/{chunk-2V43M57C.js → chunk-62AKBZTO.js} +1 -1
- package/dist-cli/chunks/{chunk-WILIVPUU.js → chunk-6DN4BD7O.js} +24 -24
- package/dist-cli/chunks/{chunk-RWXCSRNE.js → chunk-6M56UHEY.js} +2 -2
- package/dist-cli/chunks/{chunk-F2LLN4U7.js → chunk-A3FIOG7U.js} +2 -2
- package/dist-cli/chunks/{chunk-Z5VMWFCY.js → chunk-B7VBDZ3U.js} +1 -1
- package/dist-cli/chunks/{chunk-WVDWIXPH.js → chunk-BBOFH45Q.js} +2 -2
- package/dist-cli/chunks/{chunk-RS7QLHEH.js → chunk-BJJXNQHO.js} +2 -2
- package/dist-cli/chunks/{chunk-HZYHSLNH.js → chunk-BL67OSVN.js} +2 -2
- package/dist-cli/chunks/{chunk-CB7LDZKJ.js → chunk-EBH65V62.js} +3 -3
- package/dist-cli/chunks/{chunk-OG6TFGYF.js → chunk-FF3C57T5.js} +2 -2
- package/dist-cli/chunks/{chunk-JP7J325R.js → chunk-FUC7C5HS.js} +2 -2
- package/dist-cli/chunks/{chunk-AAQVPSIV.js → chunk-G5GRLVYA.js} +2 -2
- package/dist-cli/chunks/chunk-G5VOIXM7.js +1 -0
- package/dist-cli/chunks/{chunk-CGJ2U6ST.js → chunk-GMVAXDHH.js} +1 -1
- package/dist-cli/chunks/{chunk-RJVIUQK4.js → chunk-GTBF3M2H.js} +1 -1
- package/dist-cli/chunks/{chunk-LNDRRZP3.js → chunk-GYTATFQA.js} +2 -2
- package/dist-cli/chunks/{chunk-PL4GXELT.js → chunk-JLOAWSX6.js} +1 -1
- package/dist-cli/chunks/{chunk-B6JB4THC.js → chunk-K3CRSIGS.js} +2 -2
- package/dist-cli/chunks/{chunk-SQBX2HS7.js → chunk-LKJ5LA6K.js} +2 -2
- package/dist-cli/chunks/{chunk-6QFVYLX6.js → chunk-LTRNOX6N.js} +2 -2
- package/dist-cli/chunks/{chunk-K3UBHPVP.js → chunk-MQHSWXDS.js} +1 -1
- package/dist-cli/chunks/{chunk-3ZENZOIX.js → chunk-NHSO4473.js} +2 -2
- package/dist-cli/chunks/chunk-ODW7RHSD.js +97 -0
- package/dist-cli/chunks/{chunk-TANTCV45.js → chunk-OK7QEDHD.js} +2 -2
- package/dist-cli/chunks/{chunk-RZQO4Q7E.js → chunk-OXQOPTTB.js} +1 -1
- package/dist-cli/chunks/{chunk-EMOZJ773.js → chunk-P4GJL7OH.js} +2 -2
- package/dist-cli/chunks/{chunk-6FZ6SNVP.js → chunk-PELEQURX.js} +2 -2
- package/dist-cli/chunks/chunk-QKDII5UB.js +1 -0
- package/dist-cli/chunks/{chunk-DKBKU55D.js → chunk-R7GIVBTY.js} +2 -2
- package/dist-cli/chunks/{chunk-4KVSVFRF.js → chunk-RVOF6RIE.js} +1 -1
- package/dist-cli/chunks/{chunk-W4Y3JJX6.js → chunk-RZU5TDPJ.js} +3 -3
- package/dist-cli/chunks/{chunk-KRGHRSKY.js → chunk-U6OCMLMU.js} +2 -2
- package/dist-cli/chunks/{chunk-5SKKMM7E.js → chunk-UJ64GJSZ.js} +1 -1
- package/dist-cli/chunks/{chunk-DRJ4YWUG.js → chunk-UZGLGCLM.js} +1 -1
- package/dist-cli/chunks/{chunk-KYGUR727.js → chunk-WSOZGPIX.js} +2 -2
- package/dist-cli/chunks/{chunk-ENXHZGSL.js → chunk-WVF2EDZF.js} +1 -1
- package/dist-cli/chunks/{chunk-ROYBEBG2.js → chunk-XYMOH3HP.js} +1 -1
- package/dist-cli/chunks/{chunk-2CID4LNK.js → chunk-YJNJ5GVC.js} +3 -3
- package/dist-cli/chunks/{chunk-GUYKLSTX.js → chunk-YP3NIRTK.js} +1 -1
- package/dist-cli/chunks/{chunk-GZKT53SA.js → chunk-ZGM7N2AV.js} +1 -1
- package/dist-cli/chunks/{chunk-4KT2BGQE.js → chunk-ZRWVLKFL.js} +1 -1
- package/dist-cli/chunks/cli-version-N2RKZ2CU.js +2 -0
- package/dist-cli/chunks/{compat-YW3OJ7RX.js → compat-FK5MP535.js} +3 -3
- package/dist-cli/chunks/{config-ZGOXFEX4.js → config-T3W2HI67.js} +2 -2
- package/dist-cli/chunks/{control-75JRFOYV.js → control-ONFLGDEC.js} +2 -2
- package/dist-cli/chunks/daemon-FDI5YYZN.js +2 -0
- package/dist-cli/chunks/{debug-4APEP64L.js → debug-Z6NG4KY2.js} +3 -3
- package/dist-cli/chunks/{desktop-CS7S4CXK.js → desktop-BIWB2UYC.js} +3 -3
- package/dist-cli/chunks/{detox-7R7DOKQM.js → detox-6K7WFLQO.js} +2 -2
- package/dist-cli/chunks/{device-EIDKLBEK.js → device-TPD5WAP2.js} +2 -2
- package/dist-cli/chunks/{diagnose-J2F7MJAJ.js → diagnose-NACPOTYX.js} +2 -2
- package/dist-cli/chunks/drivers-G2YZR6G6.js +2 -0
- package/dist-cli/chunks/flow-OAW2MZCD.js +2 -0
- package/dist-cli/chunks/help-MY2CBECX.js +2 -0
- package/dist-cli/chunks/{home-paths-WVCREWI7.js → home-paths-WWFDX6YU.js} +2 -2
- package/dist-cli/chunks/inspect-ZPVPUSAK.js +2 -0
- package/dist-cli/chunks/install-desktop-QZWSSGJV.js +2 -0
- package/dist-cli/chunks/{login-EOBJ7CZ4.js → login-WGCO2V4S.js} +4 -4
- package/dist-cli/chunks/{logout-RL7D66VQ.js → logout-VWSSNYF5.js} +2 -2
- package/dist-cli/chunks/{maestro-F66ZIJKA.js → maestro-YED424Y6.js} +2 -2
- package/dist-cli/chunks/{mode-R2VIW66U.js → mode-QCOM4UM4.js} +2 -2
- package/dist-cli/chunks/optional-demo-registry-3KZFUZZD.js +2 -0
- package/dist-cli/chunks/{perf-PGYO5BBR.js → perf-FZHCFAID.js} +2 -2
- package/dist-cli/chunks/{record-IGDVHC67.js → record-NF3PKBSW.js} +3 -3
- package/dist-cli/chunks/runtime-ETELTKFT.js +2 -0
- package/dist-cli/chunks/screenshot-command-KLPOA5TW.js +151 -0
- package/dist-cli/chunks/screenshots-capture-MCTZSXLE.js +41 -0
- package/dist-cli/chunks/{serve-3TFVHYLY.js → serve-XBWYWHMC.js} +2 -2
- package/dist-cli/chunks/{setup-JSPPRVET.js → setup-W7EROACZ.js} +3 -3
- package/dist-cli/chunks/{skills-LK3B76W7.js → skills-RBGNF7GS.js} +2 -2
- package/dist-cli/chunks/{storage-NC5RNBUA.js → storage-3SFE2DUE.js} +2 -2
- package/dist-cli/chunks/store-Z3CHVRR3.js +2 -0
- package/dist-cli/chunks/telemetry-SWFOAVWP.js +2 -0
- package/dist-cli/chunks/{test-2CXPLH5N.js → test-UP6VTFKE.js} +5 -5
- package/dist-cli/chunks/{timeline-WDTEVELN.js → timeline-A54JB74A.js} +2 -2
- package/dist-cli/chunks/{upgrade-TT2IJSNJ.js → upgrade-H7XE3N76.js} +2 -2
- package/dist-cli/chunks/upload-X2BRKPBJ.js +2 -0
- package/dist-cli/chunks/{version-JUNH4FOR.js → version-4JV7HX23.js} +2 -2
- package/dist-cli/chunks/{web-BWCW26ZA.js → web-5OLZXKVF.js} +2 -2
- package/dist-cli/chunks/{what-happened-L6EEB6MB.js → what-happened-Q4L6SI4I.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -1
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/beta-CCNQQ73A.js +0 -2
- package/dist-cli/chunks/chunk-5J63S2NM.js +0 -1
- package/dist-cli/chunks/chunk-BZ7AW7ZB.js +0 -92
- package/dist-cli/chunks/chunk-I6O7NBPZ.js +0 -1
- package/dist-cli/chunks/cli-version-Z4NGLJLH.js +0 -2
- package/dist-cli/chunks/daemon-SHFBQRHD.js +0 -2
- package/dist-cli/chunks/drivers-55L7BHDF.js +0 -2
- package/dist-cli/chunks/flow-AHWVTHJP.js +0 -2
- package/dist-cli/chunks/help-C4BTMPEE.js +0 -2
- package/dist-cli/chunks/inspect-M4Z4SSSB.js +0 -2
- package/dist-cli/chunks/install-desktop-PVRUAEMA.js +0 -2
- package/dist-cli/chunks/optional-demo-registry-ILX5YV34.js +0 -2
- package/dist-cli/chunks/runtime-43RJGUGS.js +0 -2
- package/dist-cli/chunks/screenshot-command-HX4GVUJM.js +0 -190
- package/dist-cli/chunks/store-3XMEKA6H.js +0 -2
- package/dist-cli/chunks/telemetry-CVJ5YZNS.js +0 -2
- package/dist-cli/chunks/upload-4HMNB4HA.js +0 -2
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.202 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as me,b as fe,f as ge}from"./chunk-WILIVPUU.js";import{b as de}from"./chunk-2CID4LNK.js";import{a as pe}from"./chunk-AAQVPSIV.js";import"./chunk-6QFVYLX6.js";import"./chunk-BZ7AW7ZB.js";import{a as j,b as he}from"./chunk-TANTCV45.js";import"./chunk-B6JB4THC.js";import"./chunk-WVDWIXPH.js";import"./chunk-I6O7NBPZ.js";import"./chunk-CGJ2U6ST.js";import"./chunk-RJVIUQK4.js";import"./chunk-4NM6JBYH.js";import"./chunk-EMOZJ773.js";import{r as ae}from"./chunk-ROYBEBG2.js";import{g as _,h as ce,i as U,j as le,k as ue,l as F,m as M}from"./chunk-KRGHRSKY.js";import"./chunk-HZYHSLNH.js";import"./chunk-ENXHZGSL.js";import"./chunk-DRJ4YWUG.js";import"./chunk-4KVSVFRF.js";import"./chunk-OG6TFGYF.js";import"./chunk-KYGUR727.js";import"./chunk-RWXCSRNE.js";import"./chunk-SQBX2HS7.js";import"./chunk-F2LLN4U7.js";import"./chunk-PL4GXELT.js";import"./chunk-RZQO4Q7E.js";import"./chunk-GZKT53SA.js";import{a as v,b as V,c as K,d as X,e as J,f as z,g as I}from"./chunk-2V43M57C.js";import"./chunk-4KT2BGQE.js";import{mkdirSync as be,writeFileSync as we}from"fs";import{dirname as Se,resolve as xe}from"path";async function ke(e,t){let o=st(e);(o.includes("--help")||o.includes("-h"))&&(console.log(`
|
|
3
|
-
sootsim screenshot \u2014 capture the canvas as a PNG
|
|
4
|
-
|
|
5
|
-
usage:
|
|
6
|
-
sootsim screenshot [output] [options]
|
|
7
|
-
sootsim screenshot [options] --output <path>
|
|
8
|
-
|
|
9
|
-
options:
|
|
10
|
-
--output <path> output file path (default: /tmp/sootsim-inspect.png)
|
|
11
|
-
first positional arg works too: \`screenshot /tmp/x.png\`
|
|
12
|
-
--with-frame wrap the captured screen in a tight device frame
|
|
13
|
-
--no-frame capture the raw screen bitmap (default)
|
|
14
|
-
--no-shell tenant-only capture (no status bar, keyboard, toasts,
|
|
15
|
-
notification center, or other shell overlays). use for
|
|
16
|
-
clean app screenshots when a shell surface is in the way.
|
|
17
|
-
--shell-only capture only the shell chrome, no tenant content
|
|
18
|
-
--area x,y,w,h crop to a logical sootsim rect
|
|
19
|
-
--id <testID> crop to a node's bounding box
|
|
20
|
-
--text <text> crop to a node found by text content
|
|
21
|
-
--gallery crawl and capture multiple screens as HTML gallery
|
|
22
|
-
--themes capture light and dark variants
|
|
23
|
-
|
|
24
|
-
examples:
|
|
25
|
-
sootsim screenshot
|
|
26
|
-
sootsim screenshot --no-shell --output app.png
|
|
27
|
-
sootsim screenshot --with-frame --output framed.png
|
|
28
|
-
sootsim screenshot --area 0,200,393,400 --output hero.png
|
|
29
|
-
sootsim screenshot --id loginButton --output button.png
|
|
30
|
-
`),process.exit(0));let s=it(o);if(s.length>0){for(let{flag:p,suggestion:y}of s)console.error(y?` unknown flag: ${p} (did you mean ${y}?)`:` unknown flag: ${p}`);console.error(" run `sootsim screenshot --help` for the list of supported flags"),process.exit(1)}let r=o.includes("--gallery"),i=o.includes("--themes"),n=tt(o),a=ot(o);if(r||i)return n&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),ye(o,t);n&&o.some(p=>p==="--area"||p==="--id"||p==="--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 c=_(o,{port:t.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only"],stripValueFlags:["--output","--area","--id","--text"]}),l=$e(o),u=await Ze(o);if(await Je(c.wsPort)){try{await Qe(c,l,u,n,a)}catch(p){console.error(` screenshot failed: ${p instanceof Error?p.message:String(p)}`),process.exit(1)}return}n&&(console.error(" --with-frame requires a running sootsim bridge"),console.error(" open the app in a live sim first, then rerun the command"),process.exit(1)),u&&(console.error(" --area / --id / --text require a running sootsim bridge"),console.error(" start one with `sootsim serve`, `sootsim desktop`, or your project dev server"),process.exit(1)),await ye(o,t)}async function Je(e){let t=ce(e,{commandTimeoutMs:1e3});try{return await t.listSims(),!0}catch{return!1}finally{t.close()}}async function Ze(e){let t=e.find((r,i)=>e[i-1]==="--area");if(t){let r=t.split(",").map(l=>Number(l.trim()));if(r.length!==4||r.some(l=>!Number.isFinite(l)))throw new Error(`--area expects x,y,w,h (got "${t}")`);let[i,n,a,c]=r;return{x:i,y:n,w:a,h:c}}let o=e.find((r,i)=>e[i-1]==="--id"),s=e.find((r,i)=>e[i-1]==="--text");return o||s?{__matcher:{id:o,text:s}}:null}async function Qe(e,t,o,s,r){let i=U({...e,commandTimeoutMs:45e3});try{(await le(i)).hidden&&process.stderr.write(` \u26A0 screenshot will capture the LAST PAINTED canvas \u2014 likely stale.
|
|
31
|
-
navigation/\`shell\` commands sent before this screenshot may not
|
|
32
|
-
have repainted yet. focus the tab manually or \`sootsim --sim <id>\`
|
|
33
|
-
to target a visible sim before capturing.
|
|
34
|
-
|
|
35
|
-
`);let a=Number(process.env.SOOT_SCREENSHOT_READY_MAX_MS)||9e4,c=await ae(i,a);if(!c.ready)throw new Error(`app not ready to capture after ${Math.round(c.elapsedMs/1e3)}s`+(c.loadingText?` (still showing "${c.loadingText}")`:"")+"; refusing to capture the boot/loading card. retry once the app paints.");let l=o,u=o?.__matcher;if(u){let m=await i.send({type:"evaluate",code:de(u)});if(!m)throw new Error(u.id?`no node with id "${u.id}"`:`no node matching text "${u.text}"`);l=m}let d=l?{x:l.x,y:l.y,w:l.w,h:l.h}:void 0,p={type:"screenshot"};r&&(p.layers=r),d&&(p.crop=d);let h=(await i.send(p)).replace(/^data:image\/png;base64,/,"");d&&console.log(` area: x=${d.x} y=${d.y} w=${d.w} h=${d.h}`),r&&console.log(` layers: ${r}`);let f=xe(process.cwd(),t||"/tmp/sootsim-inspect.png");be(Se(f),{recursive:!0});let S=Buffer.from(h,"base64");if(s){let m=await et(i);if(!m)throw new Error("could not read current device model from the target sim");let x=await me(S,m);we(f,x),console.log(` frame: ${m}`)}else we(f,S);console.log(` saved: ${f}`)}finally{i.close()}}async function et(e){let t=await F(e,"SootSim.bridges.settings.get")??{deviceModel:null},o=typeof t.deviceModel=="string"?t.deviceModel:null;return!o||!(o in I)?null:o}function tt(e){let t=!1;for(let o of e)o==="--with-frame"&&(t=!0),o==="--no-frame"&&(t=!1);return t}function ot(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var rt=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--gallery","--themes"]),Pe=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),nt={"--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 st(e){let t=[],o={"-o":"--output","--out":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id","--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area"};for(let s of e){let r=o[s];t.push(r??s)}return t}function it(e){let t=[];for(let o=0;o<e.length;o++){let s=e[o];if(s.startsWith("-")){if(Pe.has(s)){o++;continue}rt.has(s)||t.push({flag:s,suggestion:nt[s]})}}return t}function $e(e){let t=e.find((o,s)=>e[s-1]==="--output");if(t)return t;for(let o=0;o<e.length;o++){let s=e[o];if(s.startsWith("-")){Pe.has(s)&&o++;continue}return s}}async function ye(e,t){let o=$e(e)||"sootsim-screenshot.png",s=e.includes("--gallery"),r=e.find((a,c)=>e[c-1]==="--url")||`http://localhost:${t.port||5173}`,{chromium:i}=await import("playwright"),n=await i.launch({channel:"chrome",headless:!0});try{if(s)console.log(" capturing gallery..."),console.log(" (gallery mode not yet implemented)");else{let a=await n.newPage({viewport:{width:500,height:900}});await a.goto(r,{waitUntil:"networkidle"}),await a.waitForTimeout(2e3);let c=xe(process.cwd(),o);be(Se(c),{recursive:!0}),await a.screenshot({path:c}),console.log(` saved: ${c}`),await a.close()}}catch(a){console.error(` screenshot failed: ${a.message}`),process.exitCode=1}finally{await n.close()}}import{mkdirSync as re,readFileSync as yt,writeFileSync as ze}from"fs";import{tmpdir as Lo}from"os";import H from"path";import{mkdirSync as Ce,readFileSync as at,writeFileSync as Me}from"fs";import Z from"path";function ve(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 Q(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function ct(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 L(e,t){let o=ct(e),s=Math.max(0,Math.min(1,t)),r=o.match(/^#([0-9a-f]{6})$/i);if(r){let i=r[1],n=Number.parseInt(i.slice(0,2),16),a=Number.parseInt(i.slice(2,4),16),c=Number.parseInt(i.slice(4,6),16);return`rgba(${n}, ${a}, ${c}, ${s})`}return o.startsWith("rgb(")?o.replace(/^rgb\((.+)\)$/i,`rgba($1, ${s})`):o}function lt(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,o=e.stops?.map(s=>`${s.color} ${s.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${o})`}function ut(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${L(t,.46)} 0%, ${L(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function ee(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)";case"straight":default:return"none"}}function Re(...e){let t=e.map(o=>o.trim()).filter(o=>o.length>0&&o!=="none");return t.length>0?t.join(" "):"none"}function te(e){let t=L(e.color,e.opacity),o=L(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${o}) drop-shadow(0 0 ${e.blur}px ${t})`}function oe(e,t){return!t.glow||e.color&&e.color!==v.color?e:{...e,color:t.glow}}function dt(e,t){if(e==="editorial-left"){let r=Math.round(t.height*.056),i=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:${r}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(n,a,c)=>{let l=Math.round(t.width*.68*(a.scale??n.scale)),u=Math.round(t.height*(.03+n.offsetY+(a.offsetY??0))),d=a.pose||n.pose||"tilted-right",p=oe(n.shadow,c);return["position:absolute",`top:${Math.round(t.height*.18)+u}px`,`left:${Math.round(t.width*.56)}px`,`width:${l}px`,"transform-origin:center center",`transform:${ee(d)}`,`filter:${te(p)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let r=Math.round(t.height*.041),i=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:${r}px;line-height:0.96;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,a,c)=>{let l=Math.round(t.width*.84*(a.scale??n.scale)),u=Math.round(t.height*(n.offsetY+(a.offsetY??0))),d=a.pose||n.pose,p=oe(n.shadow,c);return["position:absolute",`top:${Math.round(t.height*.075)+u}px`,"left:50%",`width:${l}px`,"transform-origin:center center",`transform:${Re("translateX(-50%)",ee(d))}`,`filter:${te(p)}`,"z-index:2"].join(";")}}}let o=Math.round(t.height*.04),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(r,i,n)=>{let a=Math.round(t.width*.64*(i.scale??r.scale)),c=Math.round(t.height*(r.offsetY+(i.offsetY??0))),l=i.pose||r.pose,u=oe(r.shadow,n);return["position:absolute",`top:${Math.round(t.height*.28)+c}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${Re("translateX(-50%)",ee(l))}`,`filter:${te(u)}`,"z-index:2"].join(";")}}}function pt({canvas:e,compose:t,slide:o,imageDataUrl:s}){let r=o.background??t.background,i=dt(t.text.preset,e),n=t.text.preset!=="none"&&!!(o.eyebrow||o.headline||o.subheadline),a=i.deviceStyle(t.frame,o,r),c=o.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${i.titleStyle}">${Q(o.headline)}</div>`:"",l=o.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${i.subStyle}">${Q(o.subheadline)}</div>`:"",u=o.eyebrow?`<div style="display:flex;${i.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};">${Q(o.eyebrow)}</div></div>`:"";return`<!doctype html>
|
|
36
|
-
<html>
|
|
37
|
-
<head>
|
|
38
|
-
<meta charset="utf-8" />
|
|
39
|
-
<style>
|
|
40
|
-
html, body {
|
|
41
|
-
margin: 0;
|
|
42
|
-
width: ${e.width}px;
|
|
43
|
-
height: ${e.height}px;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
background: transparent;
|
|
46
|
-
}
|
|
47
|
-
body {
|
|
48
|
-
font-family: "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
|
|
49
|
-
}
|
|
50
|
-
#canvas {
|
|
51
|
-
position: relative;
|
|
52
|
-
width: ${e.width}px;
|
|
53
|
-
height: ${e.height}px;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
background: ${lt(r)};
|
|
56
|
-
color: ${t.text.color};
|
|
57
|
-
isolation: isolate;
|
|
58
|
-
}
|
|
59
|
-
#glow {
|
|
60
|
-
position: absolute;
|
|
61
|
-
inset: 0;
|
|
62
|
-
background: ${ut(r)};
|
|
63
|
-
pointer-events: none;
|
|
64
|
-
}
|
|
65
|
-
#copy {
|
|
66
|
-
${i.copyStyle};
|
|
67
|
-
}
|
|
68
|
-
#device {
|
|
69
|
-
${a};
|
|
70
|
-
}
|
|
71
|
-
#device img {
|
|
72
|
-
display: block;
|
|
73
|
-
width: 100%;
|
|
74
|
-
height: auto;
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
77
|
-
</head>
|
|
78
|
-
<body>
|
|
79
|
-
<div id="canvas">
|
|
80
|
-
<div id="glow"></div>
|
|
81
|
-
${n?`<div id="copy">${u}${c}${l}</div>`:""}
|
|
82
|
-
<div id="device"><img src="${s}" alt="" /></div>
|
|
83
|
-
</div>
|
|
84
|
-
</body>
|
|
85
|
-
</html>`}async function Fe(e,t,o){let s=[],r=o??await(async()=>{let{chromium:n}=await import("playwright");return n.launch({headless:!0})})();try{let n=await r.newContext({viewport:{width:1280,height:720}});try{for(let a of t){let l=`data:image/png;base64,${at(a.imagePath).toString("base64")}`;for(let u of e.canvases){let d=await n.newPage();try{await d.setViewportSize({width:u.width,height:u.height}),await d.setContent(pt({canvas:u,compose:e,slide:a.slide,imageDataUrl:l}),{waitUntil:"load"}),await d.waitForTimeout(20);let p=Z.join(e.outDir,u.name,e.locale);Ce(p,{recursive:!0});let y=Z.join(p,`${a.slide.assetKey}.png`),h=await d.screenshot({type:"png",clip:{x:0,y:0,width:u.width,height:u.height}});Me(y,h),s.push({slideId:a.slide.id,canvas:u.name,locale:e.locale,outputPath:y,sourcePath:a.imagePath})}finally{await d.close()}}}}finally{await n.close()}}finally{!o&&typeof r.close=="function"&&await r.close()}Ce(e.outDir,{recursive:!0});let i=Z.join(e.outDir,"manifest.json");return Me(i,JSON.stringify({generatedAt:new Date().toISOString(),locale:e.locale,outputs:s},null,2)),{manifestPath:i,outputs:s.map(n=>n.outputPath),entries:s}}function A(e){return typeof e=="string"&&e.length>0?e:void 0}async function Ne(e){let o=`${e.origin.replace(/\/$/,"")}/api/sootsim/screenshot-decks?org=${encodeURIComponent(e.org)}&repo=${encodeURIComponent(e.repo)}`,s=await fetch(o,{headers:{Authorization:e.authHeader}});if(!s.ok){let a=await s.text().catch(()=>"");throw new Error(`org deck fetch failed (${s.status} ${s.statusText}) for ${e.org}/${e.repo}${a?` \u2014 ${a.slice(0,200)}`:""}`)}let i=(await s.json()).decks?.[0];if(!i||!i.config||typeof i.config!="object")return null;let n=i.config.frames;return Array.isArray(n)?n.map(a=>{let c=a??{};return{title:A(c.title),subtitle:A(c.subtitle),bgTop:A(c.bgTop),bgBottom:A(c.bgBottom),titleColor:A(c.titleColor)}}):null}function De(e,t){e.compose.slides.forEach((o,s)=>{let r=t[s];if(r&&(r.title!=null&&(o.headline=r.title),r.subtitle!=null&&(o.subheadline=r.subtitle),r.bgTop&&r.bgBottom)){let i={type:"gradient",direction:180,stops:[{offset:0,color:K(r.bgTop)},{offset:1,color:K(r.bgBottom)}]};o.background=i}})}import{readFileSync as mt}from"fs";import C from"path";function w(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function G(e,t){if(!w(e))throw new Error(`${t} must be an object`);return e}function k(e,t=""){return typeof e=="string"?e:t}function P(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function Ae(e,t){return typeof e=="boolean"?e:t}function R(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Te(e,t){return typeof e!="string"||e.trim().length===0?t:Object.prototype.hasOwnProperty.call(I,e)?e:null}function Ee(e,t){if(typeof e=="string"){let r=z(e);if(!r)throw new Error(`unknown background preset: ${e}`);return r}if(!w(e))return J(t);let o=e.type==="solid"||e.type==="gradient"?e.type:t.type;if(o==="solid")return{type:o,color:k(e.color,t.color??"#000000"),glow:P(e.glow)??t.glow};let s=Array.isArray(e.stops)?e.stops.map(r=>{if(!w(r))return null;let i=R(r.offset,Number.NaN),n=P(r.color);return!Number.isFinite(i)||!n?null:{offset:i,color:n}}).filter(r=>!!r):t.stops?.map(r=>({...r}))??[];return{type:o,direction:R(e.direction,t.direction??180),glow:P(e.glow)??t.glow,stops:s.length>0?s:t.stops?.map(r=>({...r}))??[]}}function ft(e){let o=(Array.isArray(e)?e:["iphone-6-9"]).map(s=>{if(typeof s!="string")throw new Error("compose.canvases entries must be strings");let r=X(s);if(!r)throw new Error(`unknown canvas preset: ${s}`);return r});if(o.length===0)throw new Error("compose.canvases must include at least one preset");return o}function ht(e){switch(e){case"editorial-left":case"minimal-bottom":case"none":case"bold-top":return e;default:return"bold-top"}}function gt(e){switch(e){case"plan":case"flow":case"auto":return e;default:return"auto"}}function Be(e){switch(e){case"straight":case"tilted-left":case"tilted-right":case"cut-bottom":case"cut-top":return e;default:return}}function T(e,t){return C.isAbsolute(t)?t:C.resolve(e,t)}function wt(e,t){if(!Array.isArray(e)||e.length===0)throw new Error("compose.slides must be a non-empty array");return e.map((o,s)=>{let r=G(o,`compose.slides[${s}]`),i=P(r.screenshot);if(!i)throw new Error(`compose.slides[${s}].screenshot is required`);let n=P(r.id),a=ve(n||i);return{id:n||a,assetKey:a,screenshot:i,headline:k(r.headline),subheadline:k(r.subheadline),eyebrow:k(r.eyebrow),pose:Be(r.pose),scale:typeof r.scale=="number"&&Number.isFinite(r.scale)?r.scale:void 0,offsetY:typeof r.offsetY=="number"&&Number.isFinite(r.offsetY)?r.offsetY:void 0,background:r.theme||r.background?Ee(r.theme??r.background,t):void 0}})}function Oe(e){let t=C.resolve(e),o=C.dirname(t),s=pe.parse(mt(t,"utf8")),r=G(s,"screenshots plan"),i=G(r.capture??{},"capture"),n=G(r.compose??{},"compose"),a=typeof r.app=="number"?String(r.app):P(r.app),c=Te(r.device,null),l=T(o,k(i.out,C.join(".sootsim","screenshots","capture"))),u=P(i.from),d=P(i.flow);if(!u&&!d)throw new Error("capture.flow or capture.from is required");let p=i.mode==="raw"||i.mode==="framed"||i.mode==="raw+framed"?i.mode:"raw+framed",y=gt(i.pathMode),h=Ee(n.background??"cyan",z("cyan")),f={show:Ae(n.frame&&w(n.frame)?n.frame.show:void 0,!0),style:Te(n.frame&&w(n.frame)?n.frame.style:null,null)||c||V,pose:Be(n.frame&&w(n.frame)?n.frame.pose:void 0)||"straight",scale:R(n.frame&&w(n.frame)?n.frame.scale:void 0,1),offsetY:R(n.frame&&w(n.frame)?n.frame.offsetY:void 0,0),shadow:{color:k(n.frame&&w(n.frame)&&w(n.frame.shadow)?n.frame.shadow.color:void 0,v.color),blur:R(n.frame&&w(n.frame)&&w(n.frame.shadow)?n.frame.shadow.blur:void 0,v.blur),spread:R(n.frame&&w(n.frame)&&w(n.frame.shadow)?n.frame.shadow.spread:void 0,v.spread),opacity:R(n.frame&&w(n.frame)&&w(n.frame.shadow)?n.frame.shadow.opacity:void 0,v.opacity)}};return{planPath:t,planDir:o,appTarget:a,deviceModel:c,capture:{flowPath:d?T(o,d):null,fromDir:u?T(o,u):null,outDir:l,rawDir:u?T(o,u):C.join(l,"raw"),framedDir:C.join(l,"framed"),mode:p,pathMode:y,simId:P(i.sim),openInNewSim:Ae(i.new,!1)},compose:{outDir:T(o,k(n.out,C.join(".sootsim","screenshots","exports"))),locale:k(n.locale,"en"),canvases:ft(n.canvases),frame:f,background:h,text:{preset:ht(n.text&&w(n.text)?n.text.preset:void 0),color:k(n.text&&w(n.text)?n.text.color:void 0,"#ffffff"),subColor:k(n.text&&w(n.text)?n.text.subColor:void 0,"rgba(232,240,247,0.86)"),eyebrowColor:k(n.text&&w(n.text)?n.text.eyebrowColor:void 0,"rgba(229,242,255,0.72)")},slides:wt(n.slides,h)}}}function bt(e){return e.capture.pathMode==="plan"||e.capture.pathMode==="flow"?e.capture.pathMode:e.capture.fromDir?"flow":"plan"}function St(e,t){if(!e.capture.flowPath)throw new Error("capture flow path is required to build flow args");let o=[e.capture.flowPath],s=bt(e);o.push("--screenshots",e.capture.rawDir),s==="flow"&&o.push("--screenshot-paths","flow");let r=t.appTarget??e.appTarget,i=t.deviceModel??e.deviceModel,n=t.simId??e.capture.simId;return r&&o.push("--url",r),i&&o.push("--device",i),n&&o.push("--sim",n),e.capture.openInNewSim&&o.push("--new"),o}function Y(e,t){return H.isAbsolute(t)?t:H.join(e.capture.rawDir,t)}function xt(e){return H.join(e.capture.outDir,"manifest.json")}async function kt(e,t){if(!e.capture.flowPath)return;re(e.capture.rawDir,{recursive:!0});let o=St(e,t),s=await ge(o);if(s!==0)throw new Error(`flow capture failed with exit code ${s}`)}async function Pt(e,t){let o=new Map;re(e.capture.framedDir,{recursive:!0});let s=t??await(async()=>{let{chromium:r}=await import("playwright");return r.launch({headless:!0})})();try{let r=await fe(s);try{for(let i of e.compose.slides){let n=Y(e,i.screenshot),a=yt(n),c=await r.compose(a,e.compose.frame.style),l=H.join(e.capture.framedDir,`${i.assetKey}.png`);ze(l,c),o.set(i.id,l)}}finally{await r.close()}}finally{!t&&typeof s.close=="function"&&await s.close()}return o}function $t(e,t,o){let s=[],r=[];re(e.capture.outDir,{recursive:!0});let i=xt(e),n=e.compose.slides.map(a=>{let c=Y(e,a.screenshot),l=t.get(a.id)??null;return s.push(c),l&&r.push(l),{id:a.id,screenshot:a.screenshot,rawPath:c,framedPath:l}});return ze(i,JSON.stringify({generatedAt:new Date().toISOString(),deviceModel:o,mode:e.capture.mode,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,slides:n},null,2)),{manifestPath:i,rawDir:e.capture.rawDir,framedDir:e.capture.framedDir,rawFiles:s,framedFiles:r}}function vt(e,t){return e.compose.slides.map(o=>({slide:o,imagePath:e.compose.frame.show===!0?t.get(o.id)??Y(e,o.screenshot):Y(e,o.screenshot)}))}async function Ie(e,t={}){let o=Oe(e);t.orgDeckFrames&&t.orgDeckFrames.length>0&&De(o,t.orgDeckFrames);let s=t.deviceModel??o.deviceModel;t.composeOnly||await kt(o,t);let r=o.capture.mode!=="raw"||!t.captureOnly&&o.compose.frame.show===!0,n=r||!t.captureOnly?await(async()=>{let{chromium:a}=await import("playwright");return a.launch({headless:!0})})():null;try{let a=r?await Pt(o,n??void 0):new Map,c=$t(o,a,s);if(t.captureOnly)return{plan:o,capture:c,compose:null};let l=vt(o,a),u=await Fe(o.compose,l,n??void 0);return{plan:o,capture:c,compose:u}}finally{n&&typeof n.close=="function"&&await n.close()}}async function _e(e,t={}){if(e.includes("--help")||e.includes("-h"))return console.log(`
|
|
86
|
-
sootsim screenshot appstore \u2014 capture and compose app-store screenshot sets
|
|
87
|
-
|
|
88
|
-
usage:
|
|
89
|
-
sootsim screenshot appstore --plan <plan.yaml> [options]
|
|
90
|
-
|
|
91
|
-
options:
|
|
92
|
-
--plan <path> screenshot plan yaml
|
|
93
|
-
--sim <id> reuse a live sim for capture
|
|
94
|
-
--app <target> override plan app target (port, url, or shell url)
|
|
95
|
-
--device <model> override plan capture device for this run
|
|
96
|
-
--org <slug> overlay copy/colors from a team's org screenshot deck
|
|
97
|
-
--repo <name> repo for --org (both required to pull the org deck)
|
|
98
|
-
--api-origin <url> sootbean origin to fetch the deck from (default: the
|
|
99
|
-
signed-in session origin, else https://sootbean.com)
|
|
100
|
-
--capture-only stop after raw/framed intermediates
|
|
101
|
-
--compose-only skip flow capture, reuse existing raw screenshots
|
|
102
|
-
|
|
103
|
-
examples:
|
|
104
|
-
sootsim screenshot appstore --plan app-store.yaml
|
|
105
|
-
sootsim screenshot appstore --plan app-store.yaml --sim a9
|
|
106
|
-
sootsim screenshot appstore --plan app-store.yaml --org acme --repo mobile
|
|
107
|
-
`),0;let o=f=>e.find((S,m)=>e[m-1]===f),s=new Set(["--plan","--sim","--app","--device","--org","--repo","--api-origin"]),r=e.filter((f,S)=>{if(f.startsWith("-"))return!1;let m=e[S-1];return!m||!s.has(m)}),i=o("--plan")||r[0];if(!i)return console.error(" error: screenshots plan path is required (`--plan <path>`)."),1;let n=o("--sim")?.trim()||null,a=o("--app")?.trim()||null,c=o("--device")?.trim()||null,l=o("--org")?.trim()||null,u=o("--repo")?.trim()||null,d=o("--api-origin")?.trim()||null,p=e.includes("--capture-only"),y=e.includes("--compose-only"),h=null;if(l||u){if(!l||!u)return console.error(" error: --org and --repo must be passed together."),1;let f=j();if(!f)return console.error(" error: --org/--repo needs auth \u2014 run `sootsim login` or set SOOTSIM_API_KEY."),1;let S=d||(f.kind==="session"?f.origin:"https://sootbean.com");try{h=await Ne({org:l,repo:u,origin:S,authHeader:he(f)})}catch(m){return console.error(` ${m.message}`),1}!h||h.length===0?console.log(` note: no org deck for ${l}/${u} \u2014 composing with the plan's copy/colors.`):console.log(` org deck: ${h.length} slide(s) from ${l}/${u}`)}try{let f=await Ie(i,{simId:n,appTarget:a,deviceModel:c,captureOnly:p,composeOnly:y,orgDeckFrames:h});return console.log(` capture manifest: ${f.capture.manifestPath}`),f.compose?(console.log(` compose manifest: ${f.compose.manifestPath}`),console.log(` exports: ${f.compose.outputs.length}`)):console.log(" compose skipped"),0}catch(f){return console.error(` screenshots failed: ${f.message}`),1}}import{execSync as Ye}from"node:child_process";import{mkdirSync as Rt,mkdtempSync as Ft,rmSync as Nt,writeFileSync as Dt}from"node:fs";import{tmpdir as At}from"node:os";import{dirname as Tt,isAbsolute as Et,join as Ge,resolve as Bt}from"node:path";import{chromium as Ot}from"playwright-core";import{execSync as Ct}from"node:child_process";function je(e){let t=e;if(t&&typeof t.process=="function")try{let o=t.process();if(o&&typeof o.pid=="number"&&o.pid>0)return o.pid}catch{}if(t&&typeof t.browser=="function")try{let o=t.browser();if(o)return je(o)}catch{}return null}function ne(e){let t=[];try{t=Ct(`pgrep -P ${e} || true`).toString().split(`
|
|
108
|
-
`).filter(Boolean)}catch{}for(let o of t)ne(Number(o));try{process.kill(e,"SIGKILL")}catch{}}var W=new Set,Ue=!1;function Mt(){if(Ue)return;Ue=!0;let e=()=>{for(let t of W)ne(t)};process.on("SIGTERM",()=>{e(),process.exit(0)}),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("exit",e)}async function Le(e){let t=await e(),o=je(t),s=new Set;o!=null&&(s.add(o),W.add(o),Mt());let r=t;return typeof r.on=="function"&&r.on("disconnected",()=>{for(let n of s)W.delete(n)}),{browser:t,reapNow:()=>{for(let n of s)ne(n),W.delete(n);s.clear()}}}var zt=`
|
|
109
|
-
sootsim screenshot appstore capture \u2014 headlessly capture + upload App Store slides
|
|
110
|
-
|
|
111
|
-
usage:
|
|
112
|
-
sootsim screenshot appstore capture --org <org> --repo <repo> [options]
|
|
113
|
-
|
|
114
|
-
what it does:
|
|
115
|
-
boots the org-mode build shell in headless GPU Chrome (authed via your
|
|
116
|
-
\`sootsim login\` session), captures each slide through the live screenshot
|
|
117
|
-
composer so every slide gets editable layers (captureRef + cleanRef +
|
|
118
|
-
screenRef), and lets the shell auto-upload them to your org deck.
|
|
119
|
-
|
|
120
|
-
options:
|
|
121
|
-
--org <org> github org slug (required)
|
|
122
|
-
--repo <repo> repo name (required)
|
|
123
|
-
--branch <branch> build branch to boot (default: main)
|
|
124
|
-
--platform <p> ios | android (default: ios)
|
|
125
|
-
--slides <list> 1-based indices to capture, e.g. 1,3,5 (default: all)
|
|
126
|
-
--dry-run capture + report refs, do NOT upload (PUTs aborted)
|
|
127
|
-
--force allow overwriting a NON-EMPTY existing deck
|
|
128
|
-
--out <dir> also write composed App-Store PNGs locally
|
|
129
|
-
--shell-origin <url> origin serving /build (default: your session origin)
|
|
130
|
-
--api-origin <url> origin for deck/capture APIs (default: session origin)
|
|
131
|
-
--timeout <ms> per-step bridge timeout (default: 45000)
|
|
132
|
-
--json machine-readable summary
|
|
133
|
-
|
|
134
|
-
examples:
|
|
135
|
-
sootsim screenshot appstore capture --org acme --repo my-app --dry-run
|
|
136
|
-
sootsim screenshot appstore capture --org acme --repo my-app --branch main --force
|
|
137
|
-
`;function It(e){let t=i=>{let n=e.indexOf(i);return n>=0?e[n+1]:void 0},o=i=>e.includes(i),s=t("--slides"),r=s?s.split(",").map(i=>Number(i.trim())).filter(i=>Number.isInteger(i)&&i>0):null;return{org:t("--org")??"",repo:t("--repo")??"",branch:t("--branch")??"main",platform:t("--platform")??"ios",slides:r&&r.length?r:null,dryRun:o("--dry-run"),force:o("--force"),out:t("--out")??null,shellOrigin:t("--shell-origin")??null,apiOrigin:t("--api-origin")??null,timeoutMs:Number(t("--timeout")??"45000")||45e3,json:o("--json")}}function _t(){let e=j();if(e&&e.kind==="session")return{token:e.token,origin:e.origin};process.stderr.write(`
|
|
138
|
-
sootsim screenshot appstore capture needs a logged-in session.
|
|
139
|
-
run \`sootsim login\` first (the captured slides upload to that account).
|
|
140
|
-
|
|
141
|
-
`),process.exit(1)}function Ut(e){let t=e.replace(/^\[|\]$/g,"").toLowerCase();return t==="localhost"||t.endsWith(".localhost")||t==="::1"||/^127(?:\.\d{1,3}){3}$/.test(t)}function jt(e){let t=new URL(e);if(Ut(t.hostname)){let s=(Number(t.port)||3e3)-3e3;if(s>=0&&s<=1e3)return t.port=String(5173+s),t.origin}return t.hostname==="sootbean.com"||t.hostname.endsWith(".sootbean.com")?"https://sootsim.com":e}function Lt(){try{return Number(Ye("sysctl -n vm.loadavg").toString().trim().split(/\s+/)[1])||0}catch{return 0}}async function Gt(e,t,o,s){let r=await fetch(`${e}/api/sootsim/screenshot-decks?org=${encodeURIComponent(o)}&repo=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${t}`}});if(!r.ok)return[];let i=await r.json().catch(()=>null),n=[];for(let a of i?.decks??[])Array.isArray(a.config?.frames)&&n.push(...a.config.frames);return n}async function Ht(e,t,o,s){let r=await fetch(`${e}/api/sootsim/screenshot-capture?ref=${encodeURIComponent(s)}&org=${encodeURIComponent(o)}`,{headers:{authorization:`Bearer ${t}`}});return r.ok?`data:image/png;base64,${Buffer.from(await r.arrayBuffer()).toString("base64")}`:null}async function Yt(e,t){let o=Date.now()+t;for(;Date.now()<o;){for(let s of e.frames())if(await s.evaluate(()=>!!globalThis.SootSim?.bridges?.screenshotControl).catch(()=>!1))return s;await e.waitForTimeout(250)}throw new Error("screenshot bridge never appeared \u2014 the build shell did not boot screenshot mode (check --branch/--platform has a ready build, and you are logged in)")}async function He(e){return e.evaluate(async()=>{let o=globalThis.SootSim?.bridges?.screenshotControl;if(!o)throw new Error("screenshotControl missing");return o.getState()})}async function Wt(e){await e.evaluate(async()=>{let t=globalThis.SootSim?.bridges?.settings,o=Date.now()+3e3;for(;Date.now()<o;){if(t?.get?.()?.screenshotMode)return;await new Promise(s=>setTimeout(s,50))}t&&!t.get().screenshotMode&&(t.set("screenshotMode",!0),t.get().showFrame||t.set("showFrame",!0))})}async function qt(e,t,o,s){await e.evaluate(async([r,i,n])=>{let a=globalThis.SootSim,c=a?.bridges?.screenshotControl;if(!c)throw new Error("screenshotControl missing");let l=u=>new Promise(d=>setTimeout(d,u));if(i){c.focusSlide(r);let u=Date.now()+3e4,d=a?.bridges?.threeMode;for(;Date.now()<u&&(d=a?.bridges?.threeMode,!(d?.setScreenImage&&d?.captureStage&&d?.getState?.()?.ready));)await l(150);await l(1e3);let p=i;d?.configure?.({colorway:p.colorway,background:p.background,...p.customGradient?{customGradient:p.customGradient}:{},room:!!p.room,focus:p.focus,environment:p.environmentActive?{pins:p.environmentPins??{},effects:p.environmentEffects??{}}:!1,pose:{phonePosition:p.phonePosition,phoneRotation:p.phoneRotation,cameraPosition:p.cameraPosition,target:p.target}}),await l(900),n&&d?.setScreenImage&&(d.setScreenImage(n),await l(1200))}await c.capture(r)},[t,o,s])}async function We(e){if(e.includes("--help")||e.includes("-h"))return console.log(zt),0;let t=It(e);if(!t.org||!t.repo)return process.stderr.write(` --org and --repo are required (see --help)
|
|
142
|
-
`),1;let{token:o,origin:s}=_t(),r=(t.apiOrigin??s).replace(/\/$/,""),i=(t.shellOrigin??jt(r)).replace(/\/$/,""),n=await Gt(r,o,t.org,t.repo);if(!t.dryRun&&!t.force&&n.length>0)return process.stderr.write(` refusing to overwrite the existing ${t.org}/${t.repo} deck (${n.length} slide(s)). re-run with --force to replace it, or --dry-run to preview.
|
|
143
|
-
`),1;let a=Lt(),c=Number(Ye("sysctl -n hw.ncpu").toString().trim())||8;if(a>c)return process.stderr.write(` load average ${a.toFixed(1)} exceeds ${c} cores \u2014 tear down other work first.
|
|
144
|
-
`),1;let l=`${i}/build/${encodeURIComponent(t.org)}/${encodeURIComponent(t.repo)}/${encodeURIComponent(t.branch)}?platform=${encodeURIComponent(t.platform)}&ssMode=1`,u=Ft(Ge(At(),"sootsim-capture-")),{browser:d,reapNow:p}=await Le(()=>Ot.launchPersistentContext(u,{headless:!0,channel:"chrome",viewport:{width:393,height:852},deviceScaleFactor:3,args:["--enable-unsafe-webgpu","--enable-features=Vulkan,WebGPU","--hide-scrollbars"]}));await d.addInitScript(m=>{try{localStorage.setItem("sootsim.session.token",m)}catch{}},o);let y=[],h=d.pages()[0]??await d.newPage();t.dryRun?await h.route(/\/api\/sootsim\/screenshot-(decks|capture)/,m=>m.request().method()==="PUT"?m.abort():m.continue()):h.on("response",m=>{let x=m.url();m.request().method()==="PUT"&&(x.includes("/api/sootsim/screenshot-decks")?y.push({kind:"deck",status:m.status()}):x.includes("/api/sootsim/screenshot-capture")&&y.push({kind:"capture",status:m.status()}))});let f=[];h.on("pageerror",m=>f.push(m.message));let S=h.waitForResponse(m=>m.url().includes("/api/sootsim/screenshot-decks")&&m.request().method()==="GET",{timeout:t.timeoutMs}).catch(()=>null);try{await h.goto(l,{waitUntil:"domcontentloaded",timeout:t.timeoutMs});let m=await Yt(h,t.timeoutMs);await Wt(m),await S,await h.waitForTimeout(800);let x=await He(m);if(x.slides.length===0)return process.stderr.write(` the deck has no slides to capture \u2014 add slides in the composer first.
|
|
145
|
-
`),1;let E=t.slides?x.slides.filter(g=>t.slides.includes(g.index)):x.slides;console.log(` ${x.projectName} on ${x.deviceModel} \u2014 capturing ${E.length}/${x.slides.length} slide(s)${t.dryRun?" (dry-run, no upload)":""}`);for(let g of E)try{let b=n[g.index-1],$=b?.threeScene??null,O=$&&b?.screenRef?await Ht(r,o,t.org,b.screenRef):null;await qt(m,g.index,$,O),console.log(` \u2713 slide ${g.index} "${g.title.slice(0,40)}"`)}catch(b){console.log(` \u2717 slide ${g.index} "${g.title.slice(0,40)}" \u2014 ${b.message}`)}t.dryRun||await h.waitForTimeout(2500);let N=(await He(m)).slides.filter(g=>E.some(b=>b.id===g.id)),B=[];if(t.out){let g=Et(t.out)?t.out:Bt(process.cwd(),t.out);for(let b of N){if(!b.captureRef)continue;let $=await m.evaluate(async D=>{let ie=globalThis.SootSim?.bridges?.screenshotControl;if(!ie)throw new Error("screenshotControl missing");return ie.exportSlide(D)},b.index),O=$.dataUrl.match(/^data:[^;]+;base64,(.+)$/);if(O){let D=Ge(g,$.name);Rt(Tt(D),{recursive:!0}),Dt(D,Buffer.from(O[1],"base64")),B.push(D)}}}let se=N.filter(g=>g.captureRef&&g.cleanRef),Xe={org:t.org,repo:t.repo,branch:t.branch,dryRun:t.dryRun,slides:N.map(g=>({index:g.index,title:g.title,captureRef:!!g.captureRef,cleanRef:!!g.cleanRef,screenRef:!!g.screenRef,captureMode:g.captureMode})),editableCount:se.length,uploads:t.dryRun?"skipped (dry-run)":y,written:B,pageErrors:f.slice(0,5)};if(t.json)console.log(JSON.stringify(Xe,null,2));else{console.log(`
|
|
146
|
-
${se.length}/${N.length} slide(s) now have editable layers (captureRef + cleanRef)`);let g=N.filter(b=>b.captureRef&&!b.cleanRef);if(g.length&&console.log(` \u26A0 ${g.length} slide(s) baked a flat capture only (no cleanRef) \u2014 typically 3d slides whose scene didn't restore for a re-bake.`),!t.dryRun){let b=y.filter($=>$.status>=200&&$.status<300).length;console.log(` uploads: ${b}/${y.length} PUT(s) succeeded`)}B.length&&console.log(` wrote ${B.length} local PNG(s) to ${t.out}`),f.length&&console.log(` \u26A0 ${f.length} page error(s) during capture`)}return 0}finally{await d.close().catch(()=>{}),p(),Nt(u,{recursive:!0,force:!0})}}import{mkdirSync as Vt,writeFileSync as Kt}from"node:fs";import{dirname as Xt,isAbsolute as Jt,join as qe,resolve as Zt}from"node:path";var Qt=`
|
|
147
|
-
sootsim screenshot slides \u2014 compose App Store screenshots in the live sim
|
|
148
|
-
|
|
149
|
-
usage:
|
|
150
|
-
sootsim screenshot slides list slides (alias: slides list)
|
|
151
|
-
sootsim screenshot slides set <n> [fields] patch a slide's copy/colors
|
|
152
|
-
sootsim screenshot slides add append a blank slide (focuses it)
|
|
153
|
-
sootsim screenshot slides remove <n> delete a slide
|
|
154
|
-
sootsim screenshot slides focus <n> open a slide (device flips into it)
|
|
155
|
-
sootsim screenshot slides overview back to the gallery
|
|
156
|
-
sootsim screenshot slides capture [<n>] capture the live frame into a slide
|
|
157
|
-
sootsim screenshot slides export [<n>] [--out <dir>]
|
|
158
|
-
write composed App-Store PNG(s)
|
|
159
|
-
|
|
160
|
-
set fields:
|
|
161
|
-
--title <text> headline
|
|
162
|
-
--subtitle <text> subheadline
|
|
163
|
-
--bg-top <color> gradient top (white gray slate black cyan blue
|
|
164
|
-
--bg-bottom <color> gradient bottom teal green lime gold orange coral
|
|
165
|
-
--title-color <color> copy color override, or "auto" red berry magenta
|
|
166
|
-
--title-size <s> sm | md | lg | none gray-light
|
|
167
|
-
--underlay <s> black | white | none gray-dark \u2026)
|
|
168
|
-
--shadow <s> light | medium | strong | none
|
|
169
|
-
|
|
170
|
-
notes:
|
|
171
|
-
slides are addressed by 1-based index. screenshot mode is auto-enabled.
|
|
172
|
-
capture shoots whatever the sim currently shows \u2014 navigate the app first
|
|
173
|
-
(sootsim do tap-id \u2026), then capture.
|
|
174
|
-
|
|
175
|
-
examples:
|
|
176
|
-
sootsim screenshot slides set 1 --title "The ultimate MMA community." --bg-top cyan --bg-bottom black
|
|
177
|
-
sootsim screenshot slides capture 1
|
|
178
|
-
sootsim screenshot slides export --out ./exports
|
|
179
|
-
`,eo={"--title":"title","--subtitle":"subtitle","--bg-top":"bgTop","--bg-bottom":"bgBottom","--title-color":"titleColor","--title-size":"titleSize","--underlay":"titleUnderlay","--shadow":"titleShadow","--out":"out"};function to(e){let t=[],o={},s=!1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i==="--json"){s=!0;continue}let n=i.indexOf("="),a=n>0?i.slice(0,n):i,c=eo[a];if(c){n>0?o[c]=i.slice(n+1):(o[c]=e[r+1]??"",r+=1);continue}t.push(i)}return{rest:t,values:o,json:s}}function oo(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:e}async function ro(e){if(!await ue(e,`(async () => {
|
|
180
|
-
if (window.SootSim?.bridges?.settings?.get?.()?.screenshotMode) return true
|
|
181
|
-
window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
182
|
-
detail: { type: 'fire-action', id: 'toggle-screenshot-mode' },
|
|
183
|
-
}))
|
|
184
|
-
const deadline = Date.now() + 2000
|
|
185
|
-
while (Date.now() < deadline) {
|
|
186
|
-
if (window.SootSim?.bridges?.settings?.get?.()?.screenshotMode) return true
|
|
187
|
-
await new Promise((r) => setTimeout(r, 40))
|
|
188
|
-
}
|
|
189
|
-
return false
|
|
190
|
-
})()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function no(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let o=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),s=t.title?`"${t.title}"`:"(no title)",r=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${s} \u2014 ${r} [${o}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function so(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function Ve(e,t){if(e.includes("--help")||e.includes("-h")){console.log(Qt);return}let{rest:o,values:s,json:r}=to(e),i=_(o,{port:t.port,commandTimeoutMs:45e3}),n=i.positional[0]??"list",a=oo(i.positional[1]),c=U(i),l=u=>{r?console.log(JSON.stringify(u,null,2)):no(u)};try{switch(await ro(c),n){case"list":{l(await F(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: sootsim screenshot slides set <n> --title \u2026 (see --help)");let u={};for(let d of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])s[d]!=null&&(u[d]=s[d]);if(Object.keys(u).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");l(await M(c,"SootSim.bridges.screenshotControl.setSlide",a,u));break}case"add":{l(await M(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: sootsim screenshot slides remove <n>");l(await M(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"focus":{if(a==null)throw new Error("usage: sootsim screenshot slides focus <n>");l(await M(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{l(await M(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let u=await M(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);l(u);break}case"export":{let u=s.out?Jt(s.out)?s.out:Zt(process.cwd(),s.out):qe(process.cwd(),"screenshots"),d=await F(c,"SootSim.bridges.screenshotControl.getState"),p=a!=null?d.slides.filter(h=>h.index===a||h.id===a):d.slides.filter(h=>h.captured);if(p.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let y=[];for(let h of p){let f=await F(c,"SootSim.bridges.screenshotControl.exportSlide",h.index),S=qe(u,f.name);Vt(Xt(S),{recursive:!0}),Kt(S,so(f.dataUrl)),y.push(S),console.log(` saved: ${S} (${f.width}\xD7${f.height})`)}r&&console.log(JSON.stringify({written:y},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see sootsim screenshot slides --help`)}}finally{c.close()}}var io=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout"]),ao=new Set(["capture","slides","appstore"]);function Ke(e){for(let t=0;t<e.length;t++){let o=e[t];if(o.startsWith("-")){io.has(o)&&t++;continue}return ao.has(o)?{name:o,index:t}:null}return null}function q(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function co(e){let t=[];for(let o=0;o<e.length;o++){if(e[o]==="--sim"){o++;continue}t.push(e[o])}return t}async function yr(e,t){let o=Ke(e);if(!o||o.name==="capture"){await ke(o?q(e,o.index):e,t);return}if(o.name==="slides"){await Ve(q(e,o.index),t);return}let s=q(e,o.index),r=Ke(s);return r?.name==="capture"?We(co(q(s,r.index))):_e(s,t)}export{yr as runScreenshotCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.202 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a,b,c}from"./chunk-BZ7AW7ZB.js";import"./chunk-TANTCV45.js";import"./chunk-CGJ2U6ST.js";import"./chunk-RJVIUQK4.js";import"./chunk-KRGHRSKY.js";import"./chunk-DRJ4YWUG.js";import"./chunk-KYGUR727.js";import"./chunk-RWXCSRNE.js";import"./chunk-PL4GXELT.js";import"./chunk-RZQO4Q7E.js";import"./chunk-GZKT53SA.js";import"./chunk-4KT2BGQE.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};
|