From 7d95f43a75b34747784692f79d2fcd0e77882544 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 4 Jan 2026 03:37:00 +0000 Subject: [PATCH] style: fix lint --- src/browser/chrome.ts | 12 +- src/browser/client-actions-observe.ts | 15 +-- src/cli/browser-cli-actions-input.ts | 164 ++++++++++++++++---------- src/cli/browser-cli-shared.ts | 6 +- 4 files changed, 118 insertions(+), 79 deletions(-) diff --git a/src/browser/chrome.ts b/src/browser/chrome.ts index 5da9f115c..96cc7c5b9 100644 --- a/src/browser/chrome.ts +++ b/src/browser/chrome.ts @@ -8,7 +8,10 @@ import { ensurePortAvailable } from "../infra/ports.js"; import { createSubsystemLogger } from "../logging.js"; import { CONFIG_DIR } from "../utils.js"; import { normalizeCdpWsUrl } from "./cdp.js"; -import type { ResolvedBrowserConfig, ResolvedBrowserProfile } from "./config.js"; +import type { + ResolvedBrowserConfig, + ResolvedBrowserProfile, +} from "./config.js"; import { DEFAULT_CLAWD_BROWSER_COLOR, DEFAULT_CLAWD_BROWSER_PROFILE_NAME, @@ -119,12 +122,7 @@ function resolveBrowserExecutable( export function resolveClawdUserDataDir( profileName = DEFAULT_CLAWD_BROWSER_PROFILE_NAME, ) { - return path.join( - CONFIG_DIR, - "browser", - profileName, - "user-data", - ); + return path.join(CONFIG_DIR, "browser", profileName, "user-data"); } function decoratedMarkerPath(userDataDir: string) { diff --git a/src/browser/client-actions-observe.ts b/src/browser/client-actions-observe.ts index 2a9b8b7f0..bd34e2b44 100644 --- a/src/browser/client-actions-observe.ts +++ b/src/browser/client-actions-observe.ts @@ -27,13 +27,10 @@ export async function browserPdfSave( opts: { targetId?: string; profile?: string } = {}, ): Promise { const q = buildProfileQuery(opts.profile); - return await fetchBrowserJson( - `${baseUrl}/pdf${q}`, - { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ targetId: opts.targetId }), - timeoutMs: 20000, - }, - ); + return await fetchBrowserJson(`${baseUrl}/pdf${q}`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ targetId: opts.targetId }), + timeoutMs: 20000, + }); } diff --git a/src/cli/browser-cli-actions-input.ts b/src/cli/browser-cli-actions-input.ts index b3ee66fcb..a2c412105 100644 --- a/src/cli/browser-cli-actions-input.ts +++ b/src/cli/browser-cli-actions-input.ts @@ -98,12 +98,16 @@ export function registerBrowserActionInputCommands( return; } try { - const result = await browserAct(baseUrl, { - kind: "resize", - width, - height, - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "resize", + width, + height, + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -140,14 +144,18 @@ export function registerBrowserActionInputCommands( .filter(Boolean) : undefined; try { - const result = await browserAct(baseUrl, { - kind: "click", - ref: refValue, - targetId: opts.targetId?.trim() || undefined, - doubleClick: Boolean(opts.double), - button: opts.button?.trim() || undefined, - modifiers, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "click", + ref: refValue, + targetId: opts.targetId?.trim() || undefined, + doubleClick: Boolean(opts.double), + button: opts.button?.trim() || undefined, + modifiers, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -179,14 +187,18 @@ export function registerBrowserActionInputCommands( return; } try { - const result = await browserAct(baseUrl, { - kind: "type", - ref: refValue, - text, - submit: Boolean(opts.submit), - slowly: Boolean(opts.slowly), - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "type", + ref: refValue, + text, + submit: Boolean(opts.submit), + slowly: Boolean(opts.slowly), + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -208,11 +220,15 @@ export function registerBrowserActionInputCommands( const baseUrl = resolveBrowserControlUrl(parent?.url); const profile = parent?.profile; try { - const result = await browserAct(baseUrl, { - kind: "press", - key, - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "press", + key, + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -234,11 +250,15 @@ export function registerBrowserActionInputCommands( const baseUrl = resolveBrowserControlUrl(parent?.url); const profile = parent?.profile; try { - const result = await browserAct(baseUrl, { - kind: "hover", - ref, - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "hover", + ref, + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -261,12 +281,16 @@ export function registerBrowserActionInputCommands( const baseUrl = resolveBrowserControlUrl(parent?.url); const profile = parent?.profile; try { - const result = await browserAct(baseUrl, { - kind: "drag", - startRef, - endRef, - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "drag", + startRef, + endRef, + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -289,12 +313,16 @@ export function registerBrowserActionInputCommands( const baseUrl = resolveBrowserControlUrl(parent?.url); const profile = parent?.profile; try { - const result = await browserAct(baseUrl, { - kind: "select", - ref, - values, - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "select", + ref, + values, + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -361,11 +389,15 @@ export function registerBrowserActionInputCommands( fields: opts.fields, fieldsFile: opts.fieldsFile, }); - const result = await browserAct(baseUrl, { - kind: "fill", - fields, - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "fill", + fields, + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -432,13 +464,17 @@ export function registerBrowserActionInputCommands( const baseUrl = resolveBrowserControlUrl(parent?.url); const profile = parent?.profile; try { - const result = await browserAct(baseUrl, { - kind: "wait", - timeMs: Number.isFinite(opts.time) ? opts.time : undefined, - text: opts.text?.trim() || undefined, - textGone: opts.textGone?.trim() || undefined, - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "wait", + timeMs: Number.isFinite(opts.time) ? opts.time : undefined, + text: opts.text?.trim() || undefined, + textGone: opts.textGone?.trim() || undefined, + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; @@ -466,12 +502,16 @@ export function registerBrowserActionInputCommands( return; } try { - const result = await browserAct(baseUrl, { - kind: "evaluate", - fn: opts.fn, - ref: opts.ref?.trim() || undefined, - targetId: opts.targetId?.trim() || undefined, - }, { profile }); + const result = await browserAct( + baseUrl, + { + kind: "evaluate", + fn: opts.fn, + ref: opts.ref?.trim() || undefined, + targetId: opts.targetId?.trim() || undefined, + }, + { profile }, + ); if (parent?.json) { defaultRuntime.log(JSON.stringify(result, null, 2)); return; diff --git a/src/cli/browser-cli-shared.ts b/src/cli/browser-cli-shared.ts index f38225d4a..b280052a2 100644 --- a/src/cli/browser-cli-shared.ts +++ b/src/cli/browser-cli-shared.ts @@ -1 +1,5 @@ -export type BrowserParentOpts = { url?: string; json?: boolean; profile?: string }; +export type BrowserParentOpts = { + url?: string; + json?: boolean; + profile?: string; +};