@browserless.io/cli 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.0](https://github.com/browserless/browserless-cli/compare/v0.7.0...v0.8.0) (2026-12-02)
4
+
5
+
6
+ ### Features
7
+
8
+ * ask which browser profile to capture ([#5](https://github.com/browserless/browserless-cli/issues/5)) ([c1dc68b](https://github.com/browserless/browserless-cli/commit/c1dc68b84e437795cae1d3f389abfb6eb88590a2))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **capture:** normalize hostnames for filtering ([#10](https://github.com/browserless/browserless-cli/issues/10)) ([fa50080](https://github.com/browserless/browserless-cli/commit/fa5008012379b85b716cd6ea6be126dd391e8029))
14
+
3
15
  ## 0.7.0 (2026-11-20)
4
16
 
5
17
 
package/README.md CHANGED
@@ -177,6 +177,14 @@ browserless profile delete my-chrome-v2
177
177
 
178
178
  ### `--browser` and `--profile`
179
179
 
180
+ In a terminal, `profile upload` and `profile inspect` can omit either flag. The CLI lists matching local profiles and asks you to pick a number, or uses the only match and prints which one it chose. The picker needs a terminal on both stdin and stderr. In scripts and CI, supply both flags; if either is missing, the error lists the flags for the matching profiles. If refresh has no saved source, it can ask in a terminal too.
181
+
182
+ The CLI saves the selectors you typed (or the picked browser key and folder for omitted flags) and separately records the exact directory it captured. Refresh uses that directory when `--profile` is omitted and fails if it is gone, even if another profile has the same display name. If you switch browsers, choose a profile from the new browser or pass `--profile` explicitly. Saved settings without an exact directory still match by display name or directory.
183
+
184
+ If an older server explicitly rejects the exact directory field, the CLI retries once without it and warns that refresh will use the legacy matcher.
185
+
186
+ Custom browser keys with leading or trailing whitespace can be picked in a terminal, but cannot be saved for refresh or matched by `--browser`. To use one in a script, register it under a name without surrounding whitespace. When the CLI cannot save a source, it also cannot save its `--password-store` override; pass the override again on refresh if needed.
187
+
180
188
  `--browser` accepts either the short key or the display name in quotes:
181
189
 
182
190
  | Key | Display name |
@@ -1 +1 @@
1
- var a=Object.defineProperty;var e=(r,t)=>a(r,"name",{value:t,configurable:!0});import{apiFetch as i}from"./client.js";import{buildProfileBody as p,rethrowCaptureSettingsSkew as f}from"./upload.js";const s=e(async(r,t)=>{try{return await i(r,{method:"POST",path:"/profile/refresh",rawBody:p(t),attemptId:t.attemptId})}catch(o){return f(o,r.server)}},"refreshProfile");export{s as refreshProfile};
1
+ var f=Object.defineProperty;var o=(r,e)=>f(r,"name",{value:e,configurable:!0});import{writeProfile as i}from"./upload.js";const p=o((r,e)=>i(r,e,"/profile/refresh"),"refreshProfile");export{p as refreshProfile};
@@ -1 +1,2 @@
1
- var o=Object.defineProperty;var i=(t,e)=>o(t,"name",{value:e,configurable:!0});import{apiFetch as n}from"./client.js";import{ApiError as s}from"../errors.js";import{version as a}from"../version.js";const d=i(t=>{const e=t.serialized??JSON.stringify(t.state),r=t.captureSettings===void 0?"":`,"captureSettings":${JSON.stringify(t.captureSettings)}`;return`{"name":${JSON.stringify(t.name)},"state":${e}${r}}`},"buildProfileBody"),p=i((t,e)=>{throw!(t instanceof s)||t.status!==400||!/additional propert/i.test(`${t.body??""} ${t.message}`)?t:new s(`The server at ${e} rejected the profile capture settings this CLI (v${a}) sends \u2014 it predates either the field itself or one of its members. Deploy the server to every region before using this CLI against it. Server said: ${t.message}`,400,t.body,"capture-settings-rejected")},"rethrowCaptureSettingsSkew"),h=i(async(t,e)=>{try{return await n(t,{method:"POST",path:"/profile/upload",rawBody:d(e),attemptId:e.attemptId})}catch(r){return p(r,t.server)}},"uploadProfile");export{d as buildProfileBody,p as rethrowCaptureSettingsSkew,h as uploadProfile};
1
+ var p=Object.defineProperty;var i=(e,t)=>p(e,"name",{value:t,configurable:!0});import{apiFetch as f}from"./client.js";import{ApiError as n}from"../errors.js";import{version as u}from"../version.js";const g=i(e=>{const t=e.serialized??JSON.stringify(e.state),s=e.captureSettings===void 0?"":`,"captureSettings":${JSON.stringify(e.captureSettings)}`;return`{"name":${JSON.stringify(e.name)},"state":${t}${s}}`},"buildProfileBody"),d=i((e,t)=>{throw!(e instanceof n)||e.status!==400||!/additional propert/i.test(`${e.body??""} ${e.message}`)?e:new n(`The server at ${t} rejected the profile capture settings this CLI (v${u}) sends \u2014 it predates either the field itself or one of its members. Deploy the server to every region before using this CLI against it. Server said: ${e.message}`,400,e.body,"capture-settings-rejected")},"rethrowCaptureSettingsSkew"),l=i(async(e,t,s)=>{const a=i(r=>f(e,{method:"POST",path:s,rawBody:g(r),attemptId:r.attemptId}),"post");try{return await a(t)}catch(r){if(!(r instanceof n)||r.status!==400||t.captureSettings?.profileDir===void 0||!/\bprofileDir\b/.test(`${r.message} ${r.body??""}`))return d(r,e.server);const c={...t.captureSettings};delete c.profileDir;try{const o=await a({...t,captureSettings:c});return process.stderr.write(` \u2192 The server did not accept the exact profile directory. Later refreshes will use the legacy display-name matching.
2
+ `),o}catch(o){return d(o,e.server)}}},"writeProfile"),w=i((e,t)=>l(e,t,"/profile/upload"),"uploadProfile");export{w as uploadProfile,l as writeProfile};
@@ -1,5 +1,5 @@
1
- var g=Object.defineProperty;var n=(e,r)=>g(e,"name",{value:r,configurable:!0});import y from"node:fs/promises";import f from"node:path";import{spawn as N}from"node:child_process";import{BUILT_IN_BROWSERS as P}from"./registry.js";import{readCustomBrowsers as d}from"./custom.js";import{PreconditionError as C,UsageError as p}from"../errors.js";import{pathExists as m}from"../utils/fs.js";import{terminalSafe as c}from"../utils/terminal.js";const k=n(e=>new Promise(r=>{const t=N("which",[e],{stdio:["ignore","pipe","ignore"]});let i="";t.stdout?.on("data",o=>{i+=o.toString()}),t.on("error",()=>r(null)),t.on("exit",o=>r(o===0&&i.trim()?i.trim():null))}),"whichOnPath"),$=n(async e=>{for(const r of e)if(await m(r))return r;return null},"firstExistingPath"),B=n(async e=>{const r=await $(e);if(r)return r;if(process.platform==="linux")for(const t of e){const i=f.basename(t);if(!i)continue;const o=await k(i);if(o)return o}return null},"firstExistingBinary"),L=n(async e=>{const r=f.join(e,"Local State");try{const t=await y.readFile(r,"utf-8"),o=JSON.parse(t)?.profile?.info_cache??{};return Object.fromEntries(Object.entries(o).map(([s,l])=>[s,l?.name??s]))}catch{return{}}},"readProfileDisplayNames"),x=n(async e=>await m(f.join(e,"Preferences"))||await m(f.join(e,"Cookies"))||await m(f.join(e,"Network","Cookies")),"looksLikeProfile"),D=n(async(e,r,t,i)=>{const o=await L(e);let s;try{s=await y.readdir(e,{withFileTypes:!0})}catch{return[]}const l=s.filter(a=>a.isDirectory()).filter(a=>a.name==="Default"||/^Profile \d+$/.test(a.name));return(await Promise.all(l.map(async a=>{const u=f.join(e,a.name);return await x(u)?{browserKey:t,browserDisplayName:i,profileDirName:a.name,profileDisplayName:o[a.name]??a.name,userDataDir:e,profilePath:u,binaryPath:r}:null}))).filter(a=>a!==null)},"profilesUnder"),j=n(async e=>{const r=e.userDataDirByPlatform[process.platform],t=e.binaryPathByPlatform[process.platform]??[];if(!r||t.length===0)return[];const i=Array.isArray(r)?r:[r],o=await B(t);if(!o)return[];for(const s of i){if(!await m(s))continue;const l=await D(s,o,e.key,e.displayName);if(l.length>0)return l}return[]},"discoverBuiltIn"),v=n(async e=>{if(!f.isAbsolute(e.binaryPath)||!f.isAbsolute(e.userDataDir))throw new C(`Custom browser "${e.name}" has relative paths. Remove it with \`profile sources rm <name>\` and re-register it with \`profile sources add\` from its original directory.`,"invalid-custom-browsers-file");return await m(e.userDataDir)?await m(e.binaryPath)?D(e.userDataDir,e.binaryPath,e.name,e.name):[]:[]},"discoverCustom"),E=n(async()=>{const[e,r]=await Promise.all([Promise.all(P.map(j)),d().then(t=>Promise.all(t.map(v)))]);return[...e.flat(),...r.flat()]},"discoverProfiles"),q=n(async()=>{const e=await d();return(await Promise.all(e.map(async t=>{const[i,o]=await Promise.all([m(t.binaryPath),m(t.userDataDir)]);return i&&o?null:{name:t.name,binaryPath:t.binaryPath,userDataDir:t.userDataDir,missingBinary:!i,missingUserDataDir:!o}}))).filter(t=>t!==null)},"findBrokenCustomSources"),b=n((e,r)=>{const t=e.trim().toLowerCase();return r.browserKey.toLowerCase()===t||r.browserDisplayName.toLowerCase()===t},"matchesBrowser"),S=n((e,r)=>{const t=e.trim().toLowerCase();return r.profileDirName.toLowerCase()===t||r.profileDisplayName.toLowerCase()===t},"matchesProfile"),O=n((e,r,t,i)=>{const o=e.trim().toLowerCase();if(!t.some(a=>a.key.toLowerCase()===o||a.displayName.toLowerCase()===o))throw new p(`Unknown browser "${c(e)}". Run \`browserless profile sources list\` to see detected browsers, or register a custom one with \`profile sources add\`.`,"unknown-browser");const l=i.filter(a=>b(e,a)&&S(r,a));if(l.length===1)return l[0];if(l.length===0){const a=i.filter(w=>b(e,w));if(a.length===0)throw new p(`Browser "${c(e)}" is registered but has no detected profiles on this machine.`,"browser-has-no-profiles");const u=a.map(w=>` - ${c(w.profileDisplayName)} (${c(w.profileDirName)})`).join(`
2
- `);throw new p(`No profile named "${c(r)}" under ${c(e)}. Available profiles:
3
- ${u}`,"local-profile-not-found")}const h=l.map(a=>` - ${c(a.profileDisplayName)} (dir: ${c(a.profileDirName)}) under ${c(a.browserDisplayName)}`).join(`
4
- `);throw new p(`Profile "${c(r)}" matches multiple entries \u2014 disambiguate by passing the directory name to --profile:
5
- ${h}`,"local-profile-ambiguous")},"resolveProfileFromCandidates"),z=n(async(e,r)=>{const t=await d(),i=[...P.map(s=>({key:s.key,displayName:s.displayName})),...t.map(s=>({key:s.name,displayName:s.name}))],o=await E();return O(e,r,i,o)},"resolveProfile");export{E as discoverProfiles,q as findBrokenCustomSources,z as resolveProfile,O as resolveProfileFromCandidates,k as whichOnPath};
1
+ var g=Object.defineProperty;var s=(e,r)=>g(e,"name",{value:r,configurable:!0});import h from"node:fs/promises";import d from"node:path";import{spawn as C}from"node:child_process";import{BUILT_IN_BROWSERS as y}from"./registry.js";import{readCustomBrowsers as p}from"./custom.js";import{PreconditionError as k,UsageError as w}from"../errors.js";import{pathExists as u}from"../utils/fs.js";import{terminalSafe as c}from"../utils/terminal.js";const $=s(e=>new Promise(r=>{const a=C("which",[e],{stdio:["ignore","pipe","ignore"]});let o="";a.stdout?.on("data",t=>{o+=t.toString()}),a.on("error",()=>r(null)),a.on("exit",t=>r(t===0&&o.trim()?o.trim():null))}),"whichOnPath"),B=s(async e=>{for(const r of e)if(await u(r))return r;return null},"firstExistingPath"),x=s(async e=>{const r=await B(e);if(r)return r;if(process.platform==="linux")for(const a of e){const o=d.basename(a);if(!o)continue;const t=await $(o);if(t)return t}return null},"firstExistingBinary"),L=s(async e=>{const r=d.join(e,"Local State");try{const a=await h.readFile(r,"utf-8"),t=JSON.parse(a)?.profile?.info_cache??{};return Object.fromEntries(Object.entries(t).map(([i,m])=>[i,m?.name??i]))}catch{return{}}},"readProfileDisplayNames"),S=s(async e=>await u(d.join(e,"Preferences"))||await u(d.join(e,"Cookies"))||await u(d.join(e,"Network","Cookies")),"looksLikeProfile"),P=s(async(e,r,a,o)=>{const t=await L(e);let i;try{i=await h.readdir(e,{withFileTypes:!0})}catch{return[]}const m=i.filter(n=>n.isDirectory()).filter(n=>n.name==="Default"||/^Profile \d+$/.test(n.name));return(await Promise.all(m.map(async n=>{const f=d.join(e,n.name);return await S(f)?{browserKey:a,browserDisplayName:o,profileDirName:n.name,profileDisplayName:t[n.name]??n.name,userDataDir:e,profilePath:f,binaryPath:r}:null}))).filter(n=>n!==null)},"profilesUnder"),j=s(async e=>{const r=e.userDataDirByPlatform[process.platform],a=e.binaryPathByPlatform[process.platform]??[];if(!r||a.length===0)return[];const o=Array.isArray(r)?r:[r],t=await x(a);if(!t)return[];for(const i of o){if(!await u(i))continue;const m=await P(i,t,e.key,e.displayName);if(m.length>0)return m}return[]},"discoverBuiltIn"),v=s(async e=>{if(!d.isAbsolute(e.binaryPath)||!d.isAbsolute(e.userDataDir))throw new k(`Custom browser "${e.name}" has relative paths. Remove it with \`profile sources rm <name>\` and re-register it with \`profile sources add\` from its original directory.`,"invalid-custom-browsers-file");return await u(e.userDataDir)?await u(e.binaryPath)?P(e.userDataDir,e.binaryPath,e.name,e.name):[]:[]},"discoverCustom"),D=s(async()=>{const[e,r]=await Promise.all([Promise.all(y.map(j)),p().then(a=>Promise.all(a.map(v)))]);return[...e.flat(),...r.flat()]},"discoverProfiles"),z=s(async()=>{const e=await p();return(await Promise.all(e.map(async a=>{const[o,t]=await Promise.all([u(a.binaryPath),u(a.userDataDir)]);return o&&t?null:{name:a.name,binaryPath:a.binaryPath,userDataDir:a.userDataDir,missingBinary:!o,missingUserDataDir:!t}}))).filter(a=>a!==null)},"findBrokenCustomSources"),E=s((e,r)=>{const a=e.trim().toLowerCase();return r.browserKey.toLowerCase()===a||r.browserDisplayName.toLowerCase()===a},"matchesBrowser"),O=s((e,r)=>{const a=e.trim().toLowerCase();return r.profileDirName.toLowerCase()===a||r.profileDisplayName.toLowerCase()===a},"matchesProfile"),b=s((e,r,a,o,t=!1)=>{let i=o;if(e!==void 0){const l=e.trim().toLowerCase();if(!a.some(f=>f.key.toLowerCase()===l||f.displayName.toLowerCase()===l))throw new w(`Unknown browser "${c(e)}". Run \`browserless profile sources list\` to see detected browsers, or register a custom one with \`profile sources add\`.`,"unknown-browser");if(i=o.filter(f=>E(e,f)),i.length===0&&!(t&&r!==void 0))throw new w(`Browser "${c(e)}" is registered but has no detected profiles on this machine.`,"browser-has-no-profiles")}if(r===void 0)return i;const m=i.filter(l=>t?l.profileDirName===r:O(r,l));if(m.length===0){if(t)throw new w(`Saved profile directory "${c(r)}" was not found. Use \`browserless profile inspect\` to pick a source, then rerun with explicit --browser and --profile.`,"local-profile-not-found");const l=i.map(f=>` - ${e===void 0?`${c(f.browserDisplayName)} / `:""}${c(f.profileDisplayName)} (${c(f.profileDirName)})`).join(`
2
+ `),n=e===void 0?"":` under ${c(e)}`;throw new w(`No profile named "${c(r)}"${n}. Available profiles:
3
+ ${l}`,"local-profile-not-found")}return m},"findSourceCandidates"),U=s((e,r,a,o,t)=>{const i=b(e,r,a,o,t);if(i.length===1)return i[0];const m=i.map(l=>` - ${c(l.profileDisplayName)} (dir: ${c(l.profileDirName)}) under ${c(l.browserDisplayName)}`).join(`
4
+ `);throw new w(`Profile "${c(r)}" matches multiple entries \u2014 disambiguate by passing the directory name to --profile:
5
+ ${m}`,"local-profile-ambiguous")},"resolveProfileFromCandidates"),N=s(async()=>{const e=await p();return[...y.map(r=>({key:r.key,displayName:r.displayName})),...e.map(r=>({key:r.name,displayName:r.name}))]},"registeredBrowserKeys"),G=s(async(e,r,a)=>b(e,r,await N(),await D(),a),"loadSourceCandidates"),H=s(async(e,r,a)=>U(e,r,await N(),await D(),a),"resolveProfile");export{D as discoverProfiles,z as findBrokenCustomSources,b as findSourceCandidates,G as loadSourceCandidates,E as matchesBrowser,H as resolveProfile,U as resolveProfileFromCandidates,$ as whichOnPath};
@@ -1,4 +1,4 @@
1
- var I=Object.defineProperty;var u=(e,t)=>I(e,"name",{value:t,configurable:!0});import x from"node:fs/promises";import E from"node:path";import{CaptureError as w}from"../errors.js";import{errMessage as T}from"../utils/errors.js";import{applyExclusions as A,originAllowedBy as P,originMatchesAny as R}from"./exclusion.js";const v=50,D=5,$=1e3,O=3,M=15e3,N=u((e,t,n)=>{let s;return Promise.race([e.finally(()=>{s&&clearTimeout(s)}),new Promise((c,r)=>{s=setTimeout(()=>r(new Error(`${n} timed out after ${t}ms`)),t)})])},"withTimeout"),j=u(e=>/CDP pipe closed|ECONNREFUSED|EPIPE|socket hang up/i.test(e),"isTransportDeadError"),b=u(e=>{const t=e.startsWith(".")?e.slice(1):e;return!!(t==="localhost"||t.endsWith(".localhost")||t.endsWith(".local")||t.endsWith(".internal")||/^\d+\.\d+\.\d+\.\d+$/.test(t)||t===""||t.includes(":"))},"isPrivateCookieDomain"),_=u(e=>{try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?!0:b(t.hostname)}catch{return!0}},"isPrivateOrigin"),C=new Set(["ntp.msn.com"]),B=u(e=>{try{return C.has(new URL(e).hostname)}catch{return!1}},"isVendorNtpOrigin"),q=u(async e=>{const t=E.join(e,"Local Storage","leveldb");let n;try{n=await x.readdir(t)}catch{return[]}const s=new Set;let c=0;const r=10*1024*1024,i=/https?:\/\/[a-zA-Z0-9.-]+(?::\d+)?/g;for(const a of n)if(!(!a.endsWith(".log")&&!a.endsWith(".ldb"))){if(c>=r)break;try{const d=await x.readFile(E.join(t,a));c+=d.byteLength;const p=d.toString("latin1");for(const f of p.matchAll(i))try{const l=new URL(f[0]);(l.protocol==="https:"||l.protocol==="http:")&&!b(l.hostname)&&!C.has(l.hostname)&&s.add(l.origin)}catch{}}catch{}}return[...s]},"enumerateLocalStorageOrigins"),F=u(e=>({name:e.name,value:e.value,domain:e.domain,path:e.path,expires:typeof e.expires=="number"?e.expires:-1,size:e.size,httpOnly:!!e.httpOnly,secure:!!e.secure,session:!!e.session,...e.sameSite?{sameSite:e.sameSite}:{},...e.sourceScheme?{sourceScheme:e.sourceScheme}:{},...e.sourcePort?{sourcePort:e.sourcePort}:{}}),"cookieFromCdp"),L=3e4,U=u(async e=>{const{cookies:t}=await N(e.send("Storage.getCookies"),L,"Storage.getCookies").catch(n=>{throw new w(`Reading cookies from the headless browser failed: ${T(n)}`,"cdp-timeout")});return t.filter(n=>!b(n.domain)).map(F)},"captureCookies"),H=Buffer.from("<html></html>").toString("base64"),X=u(async e=>{const{cdp:t}=e,{targetId:n}=await t.send("Target.createTarget",{url:"about:blank"});if(!n)return null;let s,c=u(()=>{},"stopIntercepting");try{({sessionId:s}=await t.send("Target.attachToTarget",{targetId:n,flatten:!0}));const r=t.session(s);await r.send("Page.enable"),await r.send("Network.enable"),await r.send("Fetch.enable",{patterns:[{urlPattern:"*"}]});const i=new Set([`${e.origin}/`]);c=r.on("Fetch.requestPaused",S=>{const{requestId:y,request:o}=S;i.has(o.url)?(i.delete(o.url),r.send("Fetch.fulfillRequest",{requestId:y,responseCode:200,responseHeaders:[{name:"Content-Type",value:"text/html"}],body:H}).catch(()=>{})):r.send("Fetch.failRequest",{requestId:y,errorReason:"BlockedByClient"}).catch(()=>{})});const a=r.once("Page.loadEventFired").catch(()=>{});await r.send("Page.navigate",{url:`${e.origin}/`}),await a;const d=await r.send("Runtime.evaluate",{expression:`
1
+ var I=Object.defineProperty;var u=(e,t)=>I(e,"name",{value:t,configurable:!0});import x from"node:fs/promises";import E from"node:path";import{CaptureError as w}from"../errors.js";import{errMessage as T}from"../utils/errors.js";import{applyExclusions as A,originAllowedBy as P,originMatchesAny as R}from"./exclusion.js";const v=50,D=5,$=1e3,O=3,M=15e3,N=u((e,t,n)=>{let s;return Promise.race([e.finally(()=>{s&&clearTimeout(s)}),new Promise((c,r)=>{s=setTimeout(()=>r(new Error(`${n} timed out after ${t}ms`)),t)})])},"withTimeout"),j=u(e=>/CDP pipe closed|ECONNREFUSED|EPIPE|socket hang up/i.test(e),"isTransportDeadError"),b=u(e=>{const t=e.toLowerCase().replace(/^\.+|\.+$/g,"");return!!(t==="localhost"||t.endsWith(".localhost")||t.endsWith(".local")||t.endsWith(".internal")||/^\d+\.\d+\.\d+\.\d+$/.test(t)||t===""||t.includes(":"))},"isPrivateCookieDomain"),_=u(e=>{try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?!0:b(t.hostname)}catch{return!0}},"isPrivateOrigin"),C=new Set(["ntp.msn.com"]),B=u(e=>{try{return C.has(new URL(e).hostname)}catch{return!1}},"isVendorNtpOrigin"),q=u(async e=>{const t=E.join(e,"Local Storage","leveldb");let n;try{n=await x.readdir(t)}catch{return[]}const s=new Set;let c=0;const r=10*1024*1024,i=/https?:\/\/[a-zA-Z0-9.-]+(?::\d+)?/g;for(const a of n)if(!(!a.endsWith(".log")&&!a.endsWith(".ldb"))){if(c>=r)break;try{const d=await x.readFile(E.join(t,a));c+=d.byteLength;const p=d.toString("latin1");for(const f of p.matchAll(i))try{const l=new URL(f[0]);(l.protocol==="https:"||l.protocol==="http:")&&!b(l.hostname)&&!C.has(l.hostname)&&s.add(l.origin)}catch{}}catch{}}return[...s]},"enumerateLocalStorageOrigins"),L=u(e=>({name:e.name,value:e.value,domain:e.domain,path:e.path,expires:typeof e.expires=="number"?e.expires:-1,size:e.size,httpOnly:!!e.httpOnly,secure:!!e.secure,session:!!e.session,...e.sameSite?{sameSite:e.sameSite}:{},...e.sourceScheme?{sourceScheme:e.sourceScheme}:{},...e.sourcePort?{sourcePort:e.sourcePort}:{}}),"cookieFromCdp"),F=3e4,U=u(async e=>{const{cookies:t}=await N(e.send("Storage.getCookies"),F,"Storage.getCookies").catch(n=>{throw new w(`Reading cookies from the headless browser failed: ${T(n)}`,"cdp-timeout")});return t.filter(n=>!b(n.domain)).map(L)},"captureCookies"),H=Buffer.from("<html></html>").toString("base64"),X=u(async e=>{const{cdp:t}=e,{targetId:n}=await t.send("Target.createTarget",{url:"about:blank"});if(!n)return null;let s,c=u(()=>{},"stopIntercepting");try{({sessionId:s}=await t.send("Target.attachToTarget",{targetId:n,flatten:!0}));const r=t.session(s);await r.send("Page.enable"),await r.send("Network.enable"),await r.send("Fetch.enable",{patterns:[{urlPattern:"*"}]});const i=new Set([`${e.origin}/`]);c=r.on("Fetch.requestPaused",S=>{const{requestId:y,request:o}=S;i.has(o.url)?(i.delete(o.url),r.send("Fetch.fulfillRequest",{requestId:y,responseCode:200,responseHeaders:[{name:"Content-Type",value:"text/html"}],body:H}).catch(()=>{})):r.send("Fetch.failRequest",{requestId:y,errorReason:"BlockedByClient"}).catch(()=>{})});const a=r.once("Page.loadEventFired").catch(()=>{});await r.send("Page.navigate",{url:`${e.origin}/`}),await a;const d=await r.send("Runtime.evaluate",{expression:`
2
2
  (() => {
3
3
  const out = {};
4
4
  for (let i = 0; i < localStorage.length; i++) {
@@ -59,4 +59,4 @@ var I=Object.defineProperty;var u=(e,t)=>I(e,"name",{value:t,configurable:!0});i
59
59
  }
60
60
  return JSON.stringify(out);
61
61
  })(${D}, ${$})
62
- `,returnByValue:!0,awaitPromise:!0}),l=f?.result?.value?JSON.parse(f.result.value):[];return Object.keys(p).length===0&&l.length===0?null:{origin:e.origin,localStorage:p,...l.length>0?{indexedDBs:l}:{}}}finally{if(c(),s){const r=t.session(s);await r.send("Fetch.disable").catch(()=>{}),await r.send("Network.disable").catch(()=>{}),await t.send("Target.detachFromTarget",{sessionId:s}).catch(()=>{})}await t.send("Target.closeTarget",{targetId:n}).catch(()=>{})}},"captureOrigin"),W=u(async(e,t,n,s,c=[])=>{const r=[],i=[];let a=!1,d=0,p=0,f=0,l=0;const S=e.filter(o=>!_(o)).filter(o=>!B(o)).filter(o=>!R(o,t)).filter(o=>c.length===0||P(o,c)).length,y=Math.min(S,v);for(const o of e){if(l>=v){a=!0;break}if(!_(o)&&!B(o)){if(R(o,t)){d++;continue}if(c.length>0&&!P(o,c)){p++;continue}l++,s?.({attempted:l,total:y,origin:o});try{const g=await n(o);g&&r.push(g),f=0}catch(g){const h=T(g);if(j(h)){if(f++,f>=O)throw new w(`Headless browser appears to have crashed mid-capture \u2014 ${O} consecutive transport errors on the CDP connection. Last failure on "${o}": ${h}. Retry the capture; if it persists, try a smaller profile or a different --password-store value.`,"browser-crashed-during-capture")}else f=0;let k="unknown";const m=h.toLowerCase();m.includes("timeout")||m.includes("timed out")?k="navigation-timeout":(m.includes("websocket")||m.includes("not connected")||m.includes("connection closed")||m.includes("pipe closed"))&&(k="cdp-disconnected"),i.push({origin:o,error:h,kind:k})}}}if(r.length===0&&i.length>0){const o=i.slice(0,3).map(h=>`${h.origin}: ${h.error}`).join("; "),g=i.length>3?` (+${i.length-3} more)`:"";throw new w(`All ${i.length} attempted origin(s) failed to capture; nothing usable was produced. Sample: ${o}${g}`,"all-origins-failed")}return{origins:r,failedOrigins:i,capHit:a,originCountSkippedByExclusion:d,originCountSkippedByOnlyDomain:p}},"runOriginCaptureLoop"),Q=u(async(e,t,n=[],s,c=[])=>{const r=await U(t),i=await q(e.profilePath),a=await W(i,n,p=>N(X({cdp:t,origin:p}),M,`per-origin capture of ${p}`),s,c),d=A({cookies:r,origins:a.origins},n);return{state:d.state,capHit:a.capHit,cookieCountTotal:r.length,cookieCountExcluded:r.length-d.state.cookies.length,originCountSkippedByExclusion:a.originCountSkippedByExclusion,originCountSkippedByOnlyDomain:a.originCountSkippedByOnlyDomain,failedOrigins:a.failedOrigins}},"captureViaCdp");export{L as COOKIE_READ_TIMEOUT_MS,w as CaptureError,Q as captureViaCdp,F as cookieFromCdp,q as enumerateLocalStorageOrigins,b as isPrivateCookieDomain,_ as isPrivateOrigin,j as isTransportDeadError,B as isVendorNtpOrigin,W as runOriginCaptureLoop,N as withTimeout};
62
+ `,returnByValue:!0,awaitPromise:!0}),l=f?.result?.value?JSON.parse(f.result.value):[];return Object.keys(p).length===0&&l.length===0?null:{origin:e.origin,localStorage:p,...l.length>0?{indexedDBs:l}:{}}}finally{if(c(),s){const r=t.session(s);await r.send("Fetch.disable").catch(()=>{}),await r.send("Network.disable").catch(()=>{}),await t.send("Target.detachFromTarget",{sessionId:s}).catch(()=>{})}await t.send("Target.closeTarget",{targetId:n}).catch(()=>{})}},"captureOrigin"),V=u(async(e,t,n,s,c=[])=>{const r=[],i=[];let a=!1,d=0,p=0,f=0,l=0;const S=e.filter(o=>!_(o)).filter(o=>!B(o)).filter(o=>!R(o,t)).filter(o=>c.length===0||P(o,c)).length,y=Math.min(S,v);for(const o of e){if(l>=v){a=!0;break}if(!_(o)&&!B(o)){if(R(o,t)){d++;continue}if(c.length>0&&!P(o,c)){p++;continue}l++,s?.({attempted:l,total:y,origin:o});try{const m=await n(o);m&&r.push(m),f=0}catch(m){const h=T(m);if(j(h)){if(f++,f>=O)throw new w(`Headless browser appears to have crashed mid-capture \u2014 ${O} consecutive transport errors on the CDP connection. Last failure on "${o}": ${h}. Retry the capture; if it persists, try a smaller profile or a different --password-store value.`,"browser-crashed-during-capture")}else f=0;let k="unknown";const g=h.toLowerCase();g.includes("timeout")||g.includes("timed out")?k="navigation-timeout":(g.includes("websocket")||g.includes("not connected")||g.includes("connection closed")||g.includes("pipe closed"))&&(k="cdp-disconnected"),i.push({origin:o,error:h,kind:k})}}}if(r.length===0&&i.length>0){const o=i.slice(0,3).map(h=>`${h.origin}: ${h.error}`).join("; "),m=i.length>3?` (+${i.length-3} more)`:"";throw new w(`All ${i.length} attempted origin(s) failed to capture; nothing usable was produced. Sample: ${o}${m}`,"all-origins-failed")}return{origins:r,failedOrigins:i,capHit:a,originCountSkippedByExclusion:d,originCountSkippedByOnlyDomain:p}},"runOriginCaptureLoop"),Q=u(async(e,t,n=[],s,c=[])=>{const r=await U(t),i=await q(e.profilePath),a=await V(i,n,p=>N(X({cdp:t,origin:p}),M,`per-origin capture of ${p}`),s,c),d=A({cookies:r,origins:a.origins},n);return{state:d.state,capHit:a.capHit,cookieCountTotal:r.length,cookieCountExcluded:r.length-d.state.cookies.length,originCountSkippedByExclusion:a.originCountSkippedByExclusion,originCountSkippedByOnlyDomain:a.originCountSkippedByOnlyDomain,failedOrigins:a.failedOrigins}},"captureViaCdp");export{F as COOKIE_READ_TIMEOUT_MS,w as CaptureError,Q as captureViaCdp,L as cookieFromCdp,q as enumerateLocalStorageOrigins,b as isPrivateCookieDomain,_ as isPrivateOrigin,j as isTransportDeadError,B as isVendorNtpOrigin,V as runOriginCaptureLoop,N as withTimeout};
@@ -1,8 +1,12 @@
1
- var v=Object.defineProperty;var l=(t,e)=>v(t,"name",{value:e,configurable:!0});import{resolveProfile as F}from"../browsers/discover.js";import{captureFromProfile as R}from"../capture/index.js";import{applyOnlyFilter as A,mergeExclusionPatterns as B,normalizeExclusion as x}from"../capture/exclusion.js";import{readConfig as I}from"../config/store.js";import{ensureTermsAccepted as P,isCi as L}from"../auth/disclaimer.js";import{formatProfileLockedMessage as z}from"../capture/profile-lock.js";import{CDP_SILENCE_RESTART_MS as M}from"../capture/launch.js";import{UsageError as N}from"../errors.js";import{version as G}from"../version.js";import{terminalSafe as E}from"../utils/terminal.js";import{collectRepeated as k,parseNonNegativeInt as j}from"./client.js";import{formatBytes as m,measureOriginSizes as H,SERVER_ARTIFACT_CAP_BYTES as D,trimStateToFit as U}from"./trim-state.js";const Y=l((t,e)=>t===!0&&!e,"captureIsInteractive"),K=l((t,e)=>{const o={copying:"copying profile data\u2026",launching:"launching headless browser\u2026","waiting-for-debugger":"waiting for browser to be ready\u2026","restarting-browser":`browser did not respond in ${M/1e3}s; restarting it\u2026`};let r="",d=0;return i=>{if(i.phase!=="done"){if(i.phase==="waiting-for-unlock"){z(t,i,"wait").split(`
2
- `).forEach(e);return}if(i.phase==="capturing-origins"){if(i.attempted===0){r!=="capturing-origins"&&(r="capturing-origins",e("capturing per-origin storage\u2026"));return}if(!(i.attempted===i.total)&&i.attempted-d<5)return;d=i.attempted;const u=i.origin.length>50?i.origin.slice(0,47)+"\u2026":i.origin;e(` ${i.attempted}/${i.total} ${u}`);return}i.phase!==r&&(r=i.phase,e(o[i.phase]??i.phase))}}},"createProgressRenderer"),fe=l((t,e={})=>{const a=e.sourceOptional?t.option.bind(t):t.requiredOption.bind(t),o=e.sourceOptional?". Optional here \u2014 read from the profile's stored settings when omitted":"";return a("--browser <key>",`Source browser key (chrome / brave / edge / ...) or display name${o}`),a("--profile <name>",`Source profile display name or directory (e.g. "Personal", "Default")${o}`),t.option("--exclude-domain <domain>","Append a domain to the exclusion list for this run (repeatable)",k).option("--no-default-excludes","Skip the persistent exclusion list for this run").option("--accept-terms","Pre-accept the liability disclaimer").option("--terms-ttl-days <n>","Override the disclaimer re-prompt TTL for this run").option("--password-store <store>","Linux only: --password-store value to pass through to the headless launch (basic / gnome-libsecret / kwallet5 / ...)").option("--auto-fit","If the captured artifact exceeds the 2 MB server cap, drop the heaviest origins (largest serialized contribution first) until it fits").option("--keep-domain <domain>","Domain that --auto-fit must never drop (suffix-match, same syntax as --exclude-domain; repeatable)",k).option("--only-domain <domain>","Capture only cookies / origins matching this domain \u2014 discard everything else (suffix-match; repeatable; applies after --exclude-domain)",k)},"addCaptureFlags"),X=l(t=>{if(t.length>0&&!t.some(e=>x(e)!==null))throw new N(`--only-domain: no valid domain pattern in ${JSON.stringify(t)}. Use a hostname like "example.com" or "*.example.com".`,"invalid-only-domain")},"validateOnlyDomain"),$=100,q=253,_=255,C=8*1024,J=/[$`\\!\u0000-\u001f\u007f]/,V=/^[A-Za-z0-9*._-]+$/,S=l((t,e)=>{process.stderr.write(` \u2192 Not storing ${t} for refresh (${e}); a later flagless \`profile refresh\` of this profile will not replay it
3
- `)},"warnDropped"),Z=l(t=>{const e=`they serialize past the server's ${C}-byte limit`;process.stderr.write(t==="upload"?` \u2192 Not storing any capture settings (${e}); a later flagless \`profile refresh\` of this profile will have nothing to replay
4
- `:` \u2192 Not updating the stored capture settings (${e}); whatever this profile already had is left as it was, so it no longer matches this run and a later flagless \`profile refresh\` will not reflect these filters. Shorten the domain lists to update them
5
- `)},"warnOverCap"),T=l((t,e)=>{const a=e?.trim();if(a){if(J.test(a)){S(`--${t}`,"it contains characters a shell would interpret");return}if(a.length>_){S(`--${t}`,`it exceeds ${_} characters`);return}return a}},"safeScalar"),O=l((t,e,a=!1)=>{const o=[...new Set((e??[]).map(d=>x(d)).filter(d=>d!==null))],r=o.filter(d=>d.length<=q&&V.test(d));return r.length<o.length&&S(`${o.length-r.length} of ${o.length} --${t} patterns`,"the server only stores plain hostname patterns"),r.length?(r.length>$&&S(`${r.length-$} of ${r.length} --${t} patterns`,`the server stores at most ${$}`),r.slice(0,$)):a&&!(e??[]).length?[]:void 0},"safeDomains"),g=l((t,e)=>e===void 0?{}:{[t]:e},"withKey"),ue={browser:"browser",profile:"profile",excludeDomains:"excludeDomain",onlyDomains:"onlyDomain",keepDomains:"keepDomain",autoFit:"autoFit",passwordStore:"passwordStore"},me=l((t,e,a)=>{const o={...g("browser",T("browser",t.browser)),...g("profile",T("profile",t.profile)),...g("excludeDomains",O("exclude-domain",e.excludedDomains,t.defaultExcludes===!1)),...g("onlyDomains",O("only-domain",t.onlyDomain)),...g("keepDomains",O("keep-domain",t.keepDomain)),...t.autoFit?{autoFit:!0}:{},...g("passwordStore",T("password-store",t.passwordStore)),cliVersion:G};if(Buffer.byteLength(JSON.stringify(o),"utf8")>C){Z(a);return}return o},"buildCaptureSettings"),Q=l(t=>{(t??[]).filter(e=>x(e)===null).forEach(e=>{process.stderr.write(` ! --exclude-domain "${E(e)}" is not a usable domain pattern \u2014 nothing was excluded for it
6
- `)})},"warnUnusableExcludes"),he=l((t,e)=>{if(!e)return t;const a=t.defaultExcludes===!1,o=(t.excludeDomain??[]).some(d=>x(d)!==null),r=!o&&e.excludeDomains!==void 0;return{...t,browser:t.browser??e.browser,profile:t.profile??e.profile,passwordStore:t.passwordStore??e.passwordStore,excludeDomain:o?t.excludeDomain:a?[]:e.excludeDomains,onlyDomain:t.onlyDomain??e.onlyDomains,keepDomain:t.keepDomain??e.keepDomains,autoFit:t.autoFit??e.autoFit,defaultExcludes:r?!1:t.defaultExcludes}},"mergeStoredSettings"),ge=l((t,e,a={})=>{if(!e)return;const o=l(u=>process.stderr.write(`${E(u)}
7
- `),"w"),r=a.userOptedOut===!0;o("> Refreshing with these effective settings:"),t.browser&&o(` --browser ${t.browser}`),t.profile&&o(` --profile ${t.profile}`);const d=(t.excludeDomain??[]).filter(u=>x(u)!==null);d.length&&o(` --exclude-domain ${d.join(", ")}`),t.onlyDomain?.length&&(o(` --only-domain ${t.onlyDomain.join(", ")}`),o(" ! only these domains are captured \u2014 everything else in the saved"),o(" profile is replaced, not kept")),t.keepDomain?.length&&o(` --keep-domain ${t.keepDomain.join(", ")}`),t.autoFit&&o(" --auto-fit (only acts if the capture exceeds the 2 MB cap)"),t.passwordStore&&o(` --password-store ${t.passwordStore}`),r&&o(" --no-default-excludes");const i=r&&!d.length,f=e.excludeDomains?.length;i&&f&&(o(` ! --no-default-excludes drops the ${f} stored exclusion pattern(s) for this run,`),o(" and re-pass --exclude-domain if you want to keep them.")),i?(o(" ! Unless the settings exceed the 8 KB cap (reported after the capture), the"),o(" refreshed profile is stored with NO exclusion list, so later flagless refreshes"),o(" replay 'exclude nothing' and stop applying this machine's config.")):r?(o(" ! --no-default-excludes is in force: ONLY the --exclude-domain patterns above"),o(" are excluded, and this machine's own config is not applied.")):f===void 0&&(o(" (no stored exclusion list \u2014 this machine's own config applies)"),o(" This run stores the effective list on the profile, so later flagless refreshes"),o(" replay that snapshot instead of re-reading this config.")),o(" Pass --browser, --profile, --password-store or a domain flag to override."),r||(o(f===void 0?" --exclude-domain adds to this machine's config for this run; there is no stored list to replace.":" --exclude-domain replaces the stored list and re-applies this machine's config."),f&&o(" --no-default-excludes drops the stored list for good."))},"printEffectiveSettings"),ye=l(async t=>{const{flags:e,requiresDisclaimer:a}=t;if(!e.browser||!e.profile){const n=[e.browser?null:"--browser",e.profile?null:"--profile"].filter(Boolean);throw new N(`${n.join(" and ")} ${n.length>1?"are":"is"} required: this profile has no stored capture settings to read them from (it was not created by the CLI, or this server does not return them yet)`,"missing-capture-settings")}const o=await F(e.browser,e.profile);a&&await P({acceptViaFlag:!!e.acceptTerms,ttlDaysOverride:e.termsTtlDays!==void 0?j("--terms-ttl-days",e.termsTtlDays):void 0});const r=await I(),d=B(r.excluded_domains,e.excludeDomain,e.defaultExcludes===!1);X(e.onlyDomain??[]),Q(e.excludeDomain);const i=l(n=>process.stderr.write(`${E(n)}
8
- `),"w");i(`> Capturing ${o.browserDisplayName} / ${o.profileDisplayName}`);const f=l(n=>{i(` ${n}`)},"writeLine"),u={profile:o,excludedDomains:d,onlyDomains:e.onlyDomain??[],passwordStoreOverride:e.passwordStore,interactive:Y(process.stdin.isTTY,L()),onProgress:K(o,f)},p=await R(u);if(e.onlyDomain&&e.onlyDomain.length>0){const n=A(p.state,e.onlyDomain),h=p.state.cookies.length-n.state.cookies.length,s=p.diagnostics.originCountSkippedByOnlyDomain+n.originsDropped;(h>0||s>0)&&(p.state=n.state,p.serialized=JSON.stringify(n.state),i(` \u2192 --only-domain kept ${p.state.cookies.length} cookies / ${p.state.origins.length} origins; dropped ${h} cookies / ${s} origins not matching: ${e.onlyDomain.join(", ")}`))}const c=p.diagnostics,b=Buffer.byteLength(p.serialized,"utf-8");if(i(`> Captured ${c.cookieCountBeforeExclusion} cookies, ${c.originCountBeforeExclusion} origins in ${c.durationMs}ms (artifact: ${m(b)})`),c.cookieCountExcluded>0||c.originCountExcluded>0){const n=c.excludedDomains.length?c.excludedDomains.join(", "):"(none)";i(` \u2192 Excluded ${c.cookieCountExcluded} cookies / ${c.originCountExcluded} origins matching: ${n}`)}if(p.capHit&&i(" ! Hit the per-capture origin cap \u2014 some origins may be missing"),c.failedOrigins.length>0){i(` ! ${c.failedOrigins.length} origin(s) failed to capture \u2014 their localStorage / IndexedDB is missing from the upload:`);for(const n of c.failedOrigins)i(` - ${n.origin}: ${n.error}`)}if(p.passwordStoreDefaulted&&i(' ! Linux password-store could not be detected \u2014 defaulted to "basic". If decryption failed, re-run with --password-store=<your store>'),b>D){const n=H(p.state),y=10;i(` ! artifact size ${m(b)} exceeds the ${m(D)} server cap \u2014 heaviest origins:`);for(const{origin:h,bytes:s}of n.slice(0,y))i(` ${m(s).padStart(10)} ${h}`);if(n.length>y&&i(` \u2026 and ${n.length-y} more origins below ${m(n[y].bytes)}`),e.autoFit){const h=e.keepDomain??[],s=U(p.state,D,h);if(s.dropped.length===0&&s.finalBytes<=D)i(" ! --auto-fit had nothing to drop \u2014 artifact unchanged");else{if(p.state=s.state,p.serialized=s.serialized,c.failedOrigins=[...c.failedOrigins,...s.dropped.map(w=>({origin:w,error:"dropped by --auto-fit to fit under the server cap",kind:"unknown"}))],s.dropped.length>0){i(` --auto-fit: dropped ${s.dropped.length} origin(s), now ${m(s.finalBytes)}:`);for(const w of s.dropped)i(` - ${w}`)}if(s.protectedFromDrop.length>0){i(` --auto-fit: ${s.protectedFromDrop.length} heavy origin(s) protected by --keep-domain:`);for(const w of s.protectedFromDrop)i(` - ${w}`)}s.finalBytes>D&&(s.protectedFromDrop.length>0?i(` ! Still ${m(s.finalBytes)} after the trim \u2014 the --keep-domain origins alone exceed the cap. Remove one or more --keep-domain entries, or accept the upload will be rejected.`):i(" ! Even after dropping every droppable origin the artifact is still over cap. The cookies alone may be too heavy."))}}else i(" Re-run with --auto-fit to drop the heaviest origins automatically (combine with --keep-domain <domain> to protect specific sites; or --only-domain <domain> to capture just those), or pass --exclude-domain <host> for each you want removed.")}return p},"runCapture");export{ue as SETTINGS_REPLAY_SOURCE,fe as addCaptureFlags,me as buildCaptureSettings,Y as captureIsInteractive,K as createProgressRenderer,he as mergeStoredSettings,ge as printEffectiveSettings,ye as runCapture,X as validateOnlyDomain,Q as warnUnusableExcludes};
1
+ var B=Object.defineProperty;var l=(e,t)=>B(e,"name",{value:t,configurable:!0});import{loadSourceCandidates as L,resolveProfile as P}from"../browsers/discover.js";import{pickSourceProfile as z}from"./source-picker.js";import{captureFromProfile as M}from"../capture/index.js";import{applyOnlyFilter as G,mergeExclusionPatterns as j,normalizeExclusion as b}from"../capture/exclusion.js";import{readConfig as J}from"../config/store.js";import{ensureTermsAccepted as Y,isCi as I}from"../auth/disclaimer.js";import{formatProfileLockedMessage as H}from"../capture/profile-lock.js";import{CDP_SILENCE_RESTART_MS as K}from"../capture/launch.js";import{UsageError as O}from"../errors.js";import{version as U}from"../version.js";import{terminalSafe as g}from"../utils/terminal.js";import{collectRepeated as v,parseNonNegativeInt as q}from"./client.js";import{formatBytes as w,measureOriginSizes as X,SERVER_ARTIFACT_CAP_BYTES as S,trimStateToFit as V}from"./trim-state.js";const R=l((e,t)=>e===!0&&!t,"captureIsInteractive"),Z=l((e,t)=>{const o={copying:"copying profile data\u2026",launching:"launching headless browser\u2026","waiting-for-debugger":"waiting for browser to be ready\u2026","restarting-browser":`browser did not respond in ${K/1e3}s; restarting it\u2026`};let i="",r=0;return n=>{if(n.phase!=="done"){if(n.phase==="waiting-for-unlock"){H(e,n,"wait").split(`
2
+ `).forEach(t);return}if(n.phase==="capturing-origins"){if(n.attempted===0){i!=="capturing-origins"&&(i="capturing-origins",t("capturing per-origin storage\u2026"));return}if(!(n.attempted===n.total)&&n.attempted-r<5)return;r=n.attempted;const s=n.origin.length>50?n.origin.slice(0,47)+"\u2026":n.origin;t(` ${n.attempted}/${n.total} ${s}`);return}n.phase!==i&&(i=n.phase,t(o[n.phase]??n.phase))}}},"createProgressRenderer"),ye=l((e,t={})=>{const a=l(o=>t.sourceOptional?". Optional here \u2014 read from the profile's stored settings when omitted (asks in a terminal when nothing is stored)":`. Optional in a terminal: leave it out to choose from the ${o} found on this machine`,"suffix");return e.option("--browser <key>",`Source browser key (chrome / brave / edge / ...) or display name${a("browsers")}`),e.option("--profile <name>",`Source profile display name or directory (e.g. "Personal", "Default")${a("profiles")}`),e.option("--exclude-domain <domain>","Append a domain to the exclusion list for this run (repeatable)",v).option("--no-default-excludes","Skip the persistent exclusion list for this run").option("--accept-terms","Pre-accept the liability disclaimer").option("--terms-ttl-days <n>","Override the disclaimer re-prompt TTL for this run").option("--password-store <store>","Linux only: --password-store value to pass through to the headless launch (basic / gnome-libsecret / kwallet5 / ...)").option("--auto-fit","If the captured artifact exceeds the 2 MB server cap, drop the heaviest origins (largest serialized contribution first) until it fits").option("--keep-domain <domain>","Domain that --auto-fit must never drop (suffix-match, same syntax as --exclude-domain; repeatable)",v).option("--only-domain <domain>","Capture only cookies / origins matching this domain \u2014 discard everything else (suffix-match; repeatable; applies after --exclude-domain)",v)},"addCaptureFlags"),Q=l(e=>{if(e.length>0&&!e.some(t=>b(t)!==null))throw new O(`--only-domain: no valid domain pattern in ${JSON.stringify(e)}. Use a hostname like "example.com" or "*.example.com".`,"invalid-only-domain")},"validateOnlyDomain"),k=100,W=253,C=255,F=8*1024,A=/[$`\\!\u0000-\u001f\u007f]/,ee=/^[A-Za-z0-9*._-]+$/,E=l((e,t)=>{process.stderr.write(` \u2192 Not storing ${e} for refresh (${t}); a later flagless \`profile refresh\` of this profile will not replay it
3
+ `)},"warnDropped"),te=l(e=>{const t=`they serialize past the server's ${F}-byte limit`;process.stderr.write(e==="upload"?` \u2192 Not storing any capture settings (${t}); a later flagless \`profile refresh\` of this profile will have nothing to replay
4
+ `:` \u2192 Not updating the stored capture settings (${t}); whatever this profile already had is left as it was, so it no longer matches this run and a later flagless \`profile refresh\` will not reflect these filters. Shorten the domain lists to update them
5
+ `)},"warnOverCap"),T=l((e,t)=>{if(!t?.trim())return;const a=e==="profileDir"?t:t.trim();if(A.test(a)){E(`--${e}`,"it contains characters a shell would interpret");return}if(a.length>C){E(`--${e}`,`it exceeds ${C} characters`);return}return a},"safeScalar"),_=l((e,t,a=!1)=>{const o=[...new Set((t??[]).map(r=>b(r)).filter(r=>r!==null))],i=o.filter(r=>r.length<=W&&ee.test(r));return i.length<o.length&&E(`${o.length-i.length} of ${o.length} --${e} patterns`,"the server only stores plain hostname patterns"),i.length?(i.length>k&&E(`${i.length-k} of ${i.length} --${e} patterns`,`the server stores at most ${k}`),i.slice(0,k)):a&&!(t??[]).length?[]:void 0},"safeDomains"),y=l((e,t)=>t===void 0?{}:{[e]:t},"withKey"),xe={browser:"browser",profile:"profile",excludeDomains:"excludeDomain",onlyDomains:"onlyDomain",keepDomains:"keepDomain",autoFit:"autoFit",passwordStore:"passwordStore"},$e=l((e,t,a,o)=>{const i=o?.browser,r=e.browser===void 0&&i!==void 0&&(!i||i.trim()!==i||i.length>C||A.test(i));r&&(process.stderr.write(` \u2192 Not saving the source: the browser key cannot be replayed. Choose the source again on refresh.
6
+ `),e.passwordStore!==void 0&&process.stderr.write(` \u2192 Not saving the --password-store override. Pass --password-store again on refresh to use the same store.
7
+ `));const n={...y("browser",r?void 0:T("browser",e.browser??i)),...y("profile",r?void 0:T("profile",e.profile??o?.profile)),...y("profileDir",r?void 0:T("profileDir",o?.profile)),...y("excludeDomains",_("exclude-domain",t.excludedDomains,e.defaultExcludes===!1)),...y("onlyDomains",_("only-domain",e.onlyDomain)),...y("keepDomains",_("keep-domain",e.keepDomain)),...e.autoFit?{autoFit:!0}:{},...y("passwordStore",r?void 0:T("password-store",e.passwordStore)),cliVersion:U};if(Buffer.byteLength(JSON.stringify(n),"utf8")>F){te(a);return}return n},"buildCaptureSettings"),oe=l(e=>{(e??[]).filter(t=>b(t)===null).forEach(t=>{process.stderr.write(` ! --exclude-domain "${g(t)}" is not a usable domain pattern \u2014 nothing was excluded for it
8
+ `)})},"warnUnusableExcludes"),De=l((e,t)=>{if(!t)return e;const a=e.defaultExcludes===!1,o=(e.excludeDomain??[]).some(r=>b(r)!==null),i=!o&&t.excludeDomains!==void 0;return{...e,browser:e.browser??t.browser,profile:e.profile??t.profile,passwordStore:e.passwordStore??t.passwordStore,excludeDomain:o?e.excludeDomain:a?[]:t.excludeDomains,onlyDomain:e.onlyDomain??t.onlyDomains,keepDomain:e.keepDomain??t.keepDomains,autoFit:e.autoFit??t.autoFit,defaultExcludes:i?!1:e.defaultExcludes}},"mergeStoredSettings"),be=l((e,t,a={})=>{if(!t)return;const o=l(s=>process.stderr.write(`${g(s)}
9
+ `),"w"),i=a.userOptedOut===!0;o("> Refreshing with these effective settings:"),e.browser&&o(` --browser ${e.browser}`),a.profileDir!==void 0?o(` Saved profile directory: ${JSON.stringify(a.profileDir)}`):e.profile&&o(` --profile ${e.profile}`);const r=(e.excludeDomain??[]).filter(s=>b(s)!==null);r.length&&o(` --exclude-domain ${r.join(", ")}`),e.onlyDomain?.length&&(o(` --only-domain ${e.onlyDomain.join(", ")}`),o(" ! only these domains are captured \u2014 everything else in the saved"),o(" profile is replaced, not kept")),e.keepDomain?.length&&o(` --keep-domain ${e.keepDomain.join(", ")}`),e.autoFit&&o(" --auto-fit (only acts if the capture exceeds the 2 MB cap)"),e.passwordStore&&o(` --password-store ${e.passwordStore}`),i&&o(" --no-default-excludes");const n=i&&!r.length,u=t.excludeDomains?.length;n&&u&&(o(` ! --no-default-excludes drops the ${u} stored exclusion pattern(s) for this run,`),o(" and re-pass --exclude-domain if you want to keep them.")),n?(o(" ! Unless the settings exceed the 8 KB cap (reported after the capture), the"),o(" refreshed profile is stored with NO exclusion list, so later flagless refreshes"),o(" replay 'exclude nothing' and stop applying this machine's config.")):i?(o(" ! --no-default-excludes is in force: ONLY the --exclude-domain patterns above"),o(" are excluded, and this machine's own config is not applied.")):u===void 0&&(o(" (no stored exclusion list \u2014 this machine's own config applies)"),o(" This run stores the effective list on the profile, so later flagless refreshes"),o(" replay that snapshot instead of re-reading this config.")),o(" Pass --browser, --profile, --password-store or a domain flag to override."),i||(o(u===void 0?" --exclude-domain adds to this machine's config for this run; there is no stored list to replace.":" --exclude-domain replaces the stored list and re-applies this machine's config."),u&&o(" --no-default-excludes drops the stored list for good."))},"printEffectiveSettings"),ie=l(async({browser:e,profile:t},a,o,i)=>{if(e!==void 0&&t!==void 0)return P(e,t,i);const r=o?.isInteractive??(R(process.stdin.isTTY,I())&&process.stderr.isTTY===!0),n=e===void 0?t===void 0?"--browser and --profile are":"--browser is":"--profile is",u=await(o?.loadCandidates??L)(e,t,i);if(r){const[h,...m]=u;if(!h)throw new O("No browser profiles were found on this machine. Register a custom browser with `browserless profile sources add`, then run this again.","no-local-profiles");return z([h,...m],o)}const s=u.length?[`
10
+ Browser profiles found on this machine:`,...u.map(h=>{const m=g(h.browserKey),p=JSON.stringify(g(h.profileDirName)),f=`${g(h.browserDisplayName)} / ${g(h.profileDisplayName)}`;return/^[\p{L}\p{N}_.][\p{L}\p{N}_ .-]*$/u.test(m)?` --browser ${m.includes(" ")?JSON.stringify(m):m} --profile ${p} (${f})`:` ${f} (${p}): pass the browser key ${JSON.stringify(m)} with quoting for your shell`})].join(`
11
+ `):" No browser profiles were found on this machine; register one with `browserless profile sources add`.";throw new O(a==="stored-settings"?`${n} required: this profile has no stored capture settings to read them from (it was not created by the CLI, or this server does not return them yet).${s}`:`${n} required when the CLI cannot ask (stdin or stderr is not a terminal, or CI is set).${s}`,a==="stored-settings"?"missing-capture-settings":"missing-required-flag")},"resolveCaptureSource"),Se=l(async({flags:e,requiresDisclaimer:t,missingSource:a,sourceSeams:o,exactSource:i})=>{const r=await ie(e,a,o,i);t&&await Y({acceptViaFlag:!!e.acceptTerms,ttlDaysOverride:e.termsTtlDays!==void 0?q("--terms-ttl-days",e.termsTtlDays):void 0});const n=await J(),u=j(n.excluded_domains,e.excludeDomain,e.defaultExcludes===!1);Q(e.onlyDomain??[]),oe(e.excludeDomain);const s=l(c=>process.stderr.write(`${g(c)}
12
+ `),"w");s(`> Capturing ${r.browserDisplayName} / ${r.profileDisplayName}`);const h=l(c=>{s(` ${c}`)},"writeLine"),m={profile:r,excludedDomains:u,onlyDomains:e.onlyDomain??[],passwordStoreOverride:e.passwordStore,interactive:R(process.stdin.isTTY,I()),onProgress:Z(r,h)},p=await M(m);if(e.onlyDomain&&e.onlyDomain.length>0){const c=G(p.state,e.onlyDomain),x=p.state.cookies.length-c.state.cookies.length,d=p.diagnostics.originCountSkippedByOnlyDomain+c.originsDropped;(x>0||d>0)&&(p.state=c.state,p.serialized=JSON.stringify(c.state),s(` \u2192 --only-domain kept ${p.state.cookies.length} cookies / ${p.state.origins.length} origins; dropped ${x} cookies / ${d} origins not matching: ${e.onlyDomain.join(", ")}`))}const f=p.diagnostics,N=Buffer.byteLength(p.serialized,"utf-8");if(s(`> Captured ${f.cookieCountBeforeExclusion} cookies, ${f.originCountBeforeExclusion} origins in ${f.durationMs}ms (artifact: ${w(N)})`),f.cookieCountExcluded>0||f.originCountExcluded>0){const c=f.excludedDomains.length?f.excludedDomains.join(", "):"(none)";s(` \u2192 Excluded ${f.cookieCountExcluded} cookies / ${f.originCountExcluded} origins matching: ${c}`)}if(p.capHit&&s(" ! Hit the per-capture origin cap \u2014 some origins may be missing"),f.failedOrigins.length>0){s(` ! ${f.failedOrigins.length} origin(s) failed to capture \u2014 their localStorage / IndexedDB is missing from the upload:`);for(const c of f.failedOrigins)s(` - ${c.origin}: ${c.error}`)}if(p.passwordStoreDefaulted&&s(' ! Linux password-store could not be detected \u2014 defaulted to "basic". If decryption failed, re-run with --password-store=<your store>'),N>S){const c=X(p.state),$=10;s(` ! artifact size ${w(N)} exceeds the ${w(S)} server cap \u2014 heaviest origins:`);for(const{origin:x,bytes:d}of c.slice(0,$))s(` ${w(d).padStart(10)} ${x}`);if(c.length>$&&s(` \u2026 and ${c.length-$} more origins below ${w(c[$].bytes)}`),e.autoFit){const x=e.keepDomain??[],d=V(p.state,S,x);if(d.dropped.length===0&&d.finalBytes<=S)s(" ! --auto-fit had nothing to drop \u2014 artifact unchanged");else{if(p.state=d.state,p.serialized=d.serialized,f.failedOrigins=[...f.failedOrigins,...d.dropped.map(D=>({origin:D,error:"dropped by --auto-fit to fit under the server cap",kind:"unknown"}))],d.dropped.length>0){s(` --auto-fit: dropped ${d.dropped.length} origin(s), now ${w(d.finalBytes)}:`);for(const D of d.dropped)s(` - ${D}`)}if(d.protectedFromDrop.length>0){s(` --auto-fit: ${d.protectedFromDrop.length} heavy origin(s) protected by --keep-domain:`);for(const D of d.protectedFromDrop)s(` - ${D}`)}d.finalBytes>S&&(d.protectedFromDrop.length>0?s(` ! Still ${w(d.finalBytes)} after the trim \u2014 the --keep-domain origins alone exceed the cap. Remove one or more --keep-domain entries, or accept the upload will be rejected.`):s(" ! Even after dropping every droppable origin the artifact is still over cap. The cookies alone may be too heavy."))}}else s(" Re-run with --auto-fit to drop the heaviest origins automatically (combine with --keep-domain <domain> to protect specific sites; or --only-domain <domain> to capture just those), or pass --exclude-domain <host> for each you want removed.")}return{...p,source:{browser:r.browserKey,profile:r.profileDirName}}},"runCapture");export{xe as SETTINGS_REPLAY_SOURCE,ye as addCaptureFlags,$e as buildCaptureSettings,R as captureIsInteractive,Z as createProgressRenderer,De as mergeStoredSettings,be as printEffectiveSettings,Se as runCapture,Q as validateOnlyDomain,oe as warnUnusableExcludes};
@@ -0,0 +1,2 @@
1
+ var m=Object.defineProperty;var a=(r,e)=>m(r,"name",{value:e,configurable:!0});import{createInterface as f}from"node:readline/promises";import{stdin as u,stderr as c}from"node:process";import{UsageError as p}from"../errors.js";import{terminalSafe as s}from"../utils/terminal.js";const b=a(async r=>{const e=f({input:u,output:c}),t=new AbortController;e.once("close",()=>t.abort());try{return await e.question(r,{signal:t.signal})}finally{e.close()}},"defaultPrompt"),N=a(async(r,{prompt:e=b,write:t=a(l=>c.write(`${l}
2
+ `),"write")}={})=>{const l=a(o=>`${s(o.browserDisplayName)} / ${s(o.profileDisplayName)} (${s(o.profileDirName)})`,"label"),i=r.length;if(i===1)return t(`> Using ${l(r[0])}`),r[0];t("Which browser profile should be captured?"),r.forEach((o,n)=>t(` ${n+1}) ${l(o)}`));for(let o=0;o<3;o++){let n;try{n=(await e(`Enter a number [1-${i}]: `)).trim()}catch{break}if(/^[1-9][0-9]*$/.test(n)&&Number(n)<=i)return r[Number(n)-1];o<2&&t(`Enter a number from 1 to ${i}.`)}throw new p("No browser profile chosen. Run the command again, or pass --browser and --profile.","invalid-source-choice")},"pickSourceProfile");export{N as pickSourceProfile};
@@ -1,4 +1,4 @@
1
- var c=Object.defineProperty;var i=(s,o)=>c(s,"name",{value:o,configurable:!0});import{printJson as l}from"../../cli-utils/client.js";import{addCaptureFlags as g,runCapture as d}from"../../cli-utils/capture-runner.js";const m=i(async s=>{const o=await d({flags:s,requiresDisclaimer:!1});if(s.json){l(o.state);return}const e=new Map;for(const t of o.state.cookies)e.set(t.domain,(e.get(t.domain)??0)+1);const a=[...e.entries()].sort((t,n)=>n[1]-t[1]).slice(0,20);console.log(`
1
+ var c=Object.defineProperty;var i=(s,o)=>c(s,"name",{value:o,configurable:!0});import{printJson as l}from"../../cli-utils/client.js";import{addCaptureFlags as g,runCapture as d}from"../../cli-utils/capture-runner.js";const m=i(async s=>{const o=await d({flags:s,requiresDisclaimer:!1,missingSource:"flags"});if(s.json){l(o.state);return}const e=new Map;for(const t of o.state.cookies)e.set(t.domain,(e.get(t.domain)??0)+1);const a=[...e.entries()].sort((t,n)=>n[1]-t[1]).slice(0,20);console.log(`
2
2
  Summary:`),console.log(` cookies: ${o.state.cookies.length}`),console.log(` origins: ${o.state.origins.length}`),console.log(` duration: ${o.diagnostics.durationMs} ms`),console.log(`
3
3
  Top cookie domains:`);for(const[t,n]of a)console.log(` ${n.toString().padStart(4)} ${t}`);if(o.state.origins.length>0){console.log(`
4
4
  Origins with stored data:`);for(const t of o.state.origins){const n=Object.keys(t.localStorage).length,r=t.indexedDBs?.length??0;console.log(` - ${t.origin} (${n} ls keys, ${r} idb dbs)`)}}},"action"),h=i(s=>{const o=s.command("inspect").description("Capture a local profile and print a summary without uploading").option("--json","Emit the captured state as JSON");g(o).action(m)},"registerInspect");export{h as registerInspect};
@@ -1,2 +1,2 @@
1
- var d=Object.defineProperty;var s=(e,t)=>d(e,"name",{value:t,configurable:!0});import{addClientFlags as m,buildClient as f,printJson as p}from"../../cli-utils/client.js";import{addCaptureFlags as u,buildCaptureSettings as g,mergeStoredSettings as h,printEffectiveSettings as S,runCapture as C}from"../../cli-utils/capture-runner.js";import{getProfile as w}from"../../api/profiles.js";import{refreshProfile as $}from"../../api/refresh.js";import{withProfileSetup as x}from"../../telemetry/profile-setup.js";import{terminalSafe as i}from"../../utils/terminal.js";const I=s(e=>x(e.attemptId,"refresh",async t=>{const o=await f(e),l=await w(o,e.name),c=e.defaultExcludes===!1,n=h(e,l.captureSettings);S(n,l.captureSettings,{userOptedOut:c});const a=await C({flags:n,requiresDisclaimer:!0});t.ready(),process.stderr.write(`> Refreshing profile "${e.name}" on ${o.server}
2
- `),t.submit();const r=await $(o,{attemptId:t.attemptId,name:e.name,state:a.state,serialized:a.serialized,captureSettings:g(n,a.diagnostics,"refresh")});if(e.json){p(r);return}console.log(`\u2713 Profile "${i(r.name)}" refreshed`),console.log(` id: ${i(r.id)}`),console.log(` cookies: ${i(r.cookieCount)}`),console.log(` origins: ${i(r.originCount)}`),console.log(` updated: ${i(r.updatedAt)}`)}),"action"),y=s(e=>{const t=e.command("refresh").description("Capture a local browser profile and replace an existing cloud profile in place").requiredOption("--name <name>","Name of the existing cloud profile to refresh").option("--attempt-id <UUID>","Optional setup correlation ID");u(m(t),{sourceOptional:!0}).action(I)},"registerRefresh");export{y as registerRefresh};
1
+ var p=Object.defineProperty;var f=(e,r)=>p(e,"name",{value:r,configurable:!0});import{loadSourceCandidates as g,matchesBrowser as w}from"../../browsers/discover.js";import{addClientFlags as S,buildClient as h,printJson as C}from"../../cli-utils/client.js";import{addCaptureFlags as b,buildCaptureSettings as $,mergeStoredSettings as x,printEffectiveSettings as D,runCapture as I}from"../../cli-utils/capture-runner.js";import{getProfile as O}from"../../api/profiles.js";import{refreshProfile as P}from"../../api/refresh.js";import{withProfileSetup as k}from"../../telemetry/profile-setup.js";import{terminalSafe as o}from"../../utils/terminal.js";const q=f(e=>k(e.attemptId,"refresh",async r=>{const l=await h(e),c=await O(l,e.name),u=e.defaultExcludes===!1,i=x(e,c.captureSettings),n=c.captureSettings;let s=!1;n?.profileDir!==void 0&&e.browser!==void 0&&(s=(await g(e.browser,e.profile)).some(m=>!w(n.browser??"",m))),s&&(e.profile===void 0&&delete i.profile,e.passwordStore===void 0&&delete i.passwordStore);const a=!s&&e.profile===void 0&&i.browser!==void 0?n?.profileDir:void 0;D(i,n,{userOptedOut:u,profileDir:a});const d=await I({flags:a===void 0?i:{...i,profile:a},requiresDisclaimer:!0,missingSource:s?"flags":"stored-settings",exactSource:a!==void 0});r.ready(),process.stderr.write(`> Refreshing profile "${e.name}" on ${l.server}
2
+ `),r.submit();const t=await P(l,{attemptId:r.attemptId,name:e.name,state:d.state,serialized:d.serialized,captureSettings:$(i,d.diagnostics,"refresh",d.source)});if(e.json){C(t);return}console.log(`\u2713 Profile "${o(t.name)}" refreshed`),console.log(` id: ${o(t.id)}`),console.log(` cookies: ${o(t.cookieCount)}`),console.log(` origins: ${o(t.originCount)}`),console.log(` updated: ${o(t.updatedAt)}`)}),"action"),A=f(e=>{const r=e.command("refresh").description("Capture a local browser profile and replace an existing cloud profile in place").requiredOption("--name <name>","Name of the existing cloud profile to refresh").option("--attempt-id <UUID>","Optional setup correlation ID");b(S(r),{sourceOptional:!0}).action(q)},"registerRefresh");export{A as registerRefresh};
@@ -1,2 +1,2 @@
1
- var s=Object.defineProperty;var l=(e,t)=>s(e,"name",{value:t,configurable:!0});import{addClientFlags as d,buildClient as c,printJson as p}from"../../cli-utils/client.js";import{addCaptureFlags as m,buildCaptureSettings as u,runCapture as f}from"../../cli-utils/capture-runner.js";import{uploadProfile as g}from"../../api/upload.js";import{withProfileSetup as C}from"../../telemetry/profile-setup.js";import{terminalSafe as a}from"../../utils/terminal.js";const w={runCapture:f},$=l((e,t)=>C(e.attemptId,"create",async r=>{const i=await c(e),n=await t.runCapture({flags:e,requiresDisclaimer:!0});r.ready(),process.stderr.write(`> Uploading to ${i.server}
2
- `),r.submit();const o=await g(i,{attemptId:r.attemptId,name:e.name,state:n.state,serialized:n.serialized,captureSettings:u(e,n.diagnostics,"upload")});if(e.json){p(o);return}console.log(`\u2713 Profile "${a(o.name)}" uploaded`),console.log(` id: ${a(o.id)}`),console.log(` cookies: ${a(o.cookieCount)}`),console.log(` origins: ${a(o.originCount)}`),console.log(` created: ${a(o.createdAt)}`)}),"action"),h=l((e,t=w)=>{const r=e.command("upload").description("Capture a local browser profile and upload it as a new cloud profile").requiredOption("--name <name>","Name for the new cloud profile").option("--attempt-id <UUID>","Optional setup correlation ID");m(d(r)).action(i=>$(i,t))},"registerUpload");export{h as registerUpload};
1
+ var s=Object.defineProperty;var l=(e,t)=>s(e,"name",{value:t,configurable:!0});import{addClientFlags as d,buildClient as c,printJson as p}from"../../cli-utils/client.js";import{addCaptureFlags as u,buildCaptureSettings as m,runCapture as f}from"../../cli-utils/capture-runner.js";import{uploadProfile as g}from"../../api/upload.js";import{withProfileSetup as C}from"../../telemetry/profile-setup.js";import{terminalSafe as a}from"../../utils/terminal.js";const w={runCapture:f},$=l((e,t)=>C(e.attemptId,"create",async r=>{const i=await c(e),n=await t.runCapture({flags:e,requiresDisclaimer:!0,missingSource:"flags"});r.ready(),process.stderr.write(`> Uploading to ${i.server}
2
+ `),r.submit();const o=await g(i,{attemptId:r.attemptId,name:e.name,state:n.state,serialized:n.serialized,captureSettings:m(e,n.diagnostics,"upload",n.source)});if(e.json){p(o);return}console.log(`\u2713 Profile "${a(o.name)}" uploaded`),console.log(` id: ${a(o.id)}`),console.log(` cookies: ${a(o.cookieCount)}`),console.log(` origins: ${a(o.originCount)}`),console.log(` created: ${a(o.createdAt)}`)}),"action"),h=l((e,t=w)=>{const r=e.command("upload").description("Capture a local browser profile and upload it as a new cloud profile").requiredOption("--name <name>","Name for the new cloud profile").option("--attempt-id <UUID>","Optional setup correlation ID");u(d(r)).action(i=>$(i,t))},"registerUpload");export{h as registerUpload};
package/build/version.js CHANGED
@@ -1 +1 @@
1
- const o="0.7.0";export{o as version};
1
+ const o="0.8.0";export{o as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserless.io/cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Browserless CLI — manage authentication profiles, sessions, and other Browserless features from your terminal.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "commander": "^15.1.0",
49
49
  "string-width": "^9.0.0",
50
- "ws": "^8.23.0"
50
+ "ws": "^8.23.1"
51
51
  },
52
52
  "optionalDependencies": {
53
53
  "@napi-rs/keyring": "^2.1.2"
@@ -57,21 +57,21 @@
57
57
  "@types/chai": "^5.2.3",
58
58
  "@types/chrome-remote-interface": "^0.34.1",
59
59
  "@types/mocha": "^10.0.10",
60
- "@types/node": "^26.6.6",
60
+ "@types/node": "^26.6.11",
61
61
  "@types/sinon": "^22.0.2",
62
62
  "@types/ws": "^8.18.2",
63
63
  "chai": "^6.3.0",
64
64
  "chrome-remote-interface": "^0.34.0",
65
65
  "esbuild": "^0.28.2",
66
- "eslint": "^10.15.0",
66
+ "eslint": "^10.16.0",
67
67
  "globals": "^17.14.0",
68
68
  "husky": "^9.1.7",
69
- "lint-staged": "^17.6.1",
69
+ "lint-staged": "^17.6.3",
70
70
  "mocha": "^12.0.3",
71
71
  "prettier": "3.10.1",
72
72
  "sinon": "^22.1.0",
73
73
  "typescript": "^6.0.3",
74
- "typescript-eslint": "^8.73.0"
74
+ "typescript-eslint": "^8.74.0"
75
75
  },
76
76
  "overrides": {
77
77
  "mocha": {