diff options
| author | amankumarsingh77 <amankumarsingh7702@gmail.com> | 2026-07-28 20:34:49 +0530 |
|---|---|---|
| committer | Aman Kumar <145339995+amankumarsingh77@users.noreply.github.com> | 2026-08-02 19:12:46 +0530 |
| commit | a9bdbd8590801cd9c2fa0cda6203948ac19a779c (patch) | |
| tree | 060ced4709815f9415fc1172842ed25d97de545f /src/profile | |
| parent | 34e5cfdcbe29bbb5f2f46ba54eb67903abd9274d (diff) | |
refactor: tidy the whitespace the comment removal left behind
Drops leading blank lines where a file header was removed, collapses
double blank lines, and closes the empty catch/handler blocks whose only
content had been a comment. Whitespace only.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/profile')
| -rw-r--r-- | src/profile/bind.ts | 1 | ||||
| -rw-r--r-- | src/profile/browser-process.ts | 22 | ||||
| -rw-r--r-- | src/profile/command.ts | 1 | ||||
| -rw-r--r-- | src/profile/list.ts | 1 | ||||
| -rw-r--r-- | src/profile/paths.ts | 2 |
5 files changed, 6 insertions, 21 deletions
diff --git a/src/profile/bind.ts b/src/profile/bind.ts index 0909d09..ca745ca 100644 --- a/src/profile/bind.ts +++ b/src/profile/bind.ts @@ -1,4 +1,3 @@ - import type { BrowserClient } from "../client"; import { attachTo } from "../cdp/attach"; import type { ResultOf } from "../cdp/commands"; diff --git a/src/profile/browser-process.ts b/src/profile/browser-process.ts index cbf4d70..3d7bb05 100644 --- a/src/profile/browser-process.ts +++ b/src/profile/browser-process.ts @@ -106,7 +106,6 @@ export const parseUserDataDirFlag = (commandLine: string): string | undefined => return value && value.length > 0 ? value : undefined; }; - const collectLinux = async (): Promise<ReadonlyArray<BrowserCandidate>> => { let pids: string[]; try { @@ -135,8 +134,7 @@ const collectLinux = async (): Promise<ReadonlyArray<BrowserCandidate>> => { let link: string | undefined; try { link = await readlink(`/proc/${pid}/exe`); - } catch { - } + } catch {} // Chrome rewrites its argv to the bare executable path, so argv[0] is the live install location when /proc/<pid>/exe is unreadable or stale. const exePath = (link ? await spawnableExePath(link) : undefined) ?? @@ -150,7 +148,6 @@ const collectLinux = async (): Promise<ReadonlyArray<BrowserCandidate>> => { return candidates; }; - const collectDarwin = async (): Promise<ReadonlyArray<BrowserCandidate>> => { let lines: string[]; try { @@ -175,8 +172,7 @@ const collectDarwin = async (): Promise<ReadonlyArray<BrowserCandidate>> => { try { const { stdout } = await run("ps", ["-ww", "-o", "args=", "-p", pid], { timeout: EXEC_TIMEOUT_MS }); args = stdout.trim(); - } catch { - } + } catch {} if (args && hasChildProcessType(args)) continue; const explicit = args ? parseUserDataDirFlag(args) : undefined; candidates.push({ @@ -187,7 +183,6 @@ const collectDarwin = async (): Promise<ReadonlyArray<BrowserCandidate>> => { return candidates; }; - const POWERSHELL_QUERY = [ "$ErrorActionPreference='SilentlyContinue';", "Get-CimInstance Win32_Process", @@ -232,15 +227,13 @@ const collectWin32 = async (): Promise<ReadonlyArray<BrowserCandidate>> => { if (candidates.length > 0) return candidates; } } - } catch { - } + } catch {} try { const { stdout } = await run("tasklist.exe", [], { timeout: EXEC_TIMEOUT_MS, windowsHide: true }); const lower = stdout.toLowerCase(); if (WIN_IMAGE_NAMES.some((n) => lower.includes(n))) return [{}]; - } catch { - } + } catch {} return []; }; @@ -273,14 +266,12 @@ const winRegistryExecutable = async (): Promise<string | undefined> => { const match = /REG_[A-Z_]+\s+(.+)$/m.exec(stdout.trim()); const path = match?.[1]?.trim(); if (path) return path; - } catch { - } + } catch {} } } return undefined; }; - export const detectRunningBrowser = async (preferUserDataDir?: string): Promise<RunningBrowser> => { const candidates = process.platform === "darwin" @@ -323,8 +314,7 @@ export const resolveBrowserExecutable = async (running?: RunningBrowser): Promis try { await access(candidate); return candidate; - } catch { - } + } catch {} } return undefined; }; diff --git a/src/profile/command.ts b/src/profile/command.ts index d0c36d6..7475924 100644 --- a/src/profile/command.ts +++ b/src/profile/command.ts @@ -1,4 +1,3 @@ - import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent"; import type { BrowserClient } from "../client"; import { discoverEndpoint } from "../cdp/discovery"; diff --git a/src/profile/list.ts b/src/profile/list.ts index 6429b91..aa3d3e2 100644 --- a/src/profile/list.ts +++ b/src/profile/list.ts @@ -1,4 +1,3 @@ - import { readdir, readFile } from "node:fs/promises"; import { join } from "node:path"; import { Type } from "typebox"; diff --git a/src/profile/paths.ts b/src/profile/paths.ts index 35cbc1f..0a7c74e 100644 --- a/src/profile/paths.ts +++ b/src/profile/paths.ts @@ -3,7 +3,6 @@ import { homedir } from "node:os"; import { join } from "node:path"; - const ENV_AGENT_DIR = "PI_CODING_AGENT_DIR"; // Deliberately mirrors pi's expandTildePath (never `~\…`) rather than improving on it, or the pin lands somewhere pi does not look. @@ -27,7 +26,6 @@ export const agentDir = (): string => { export const pinFilePath = (): string => join(agentDir(), "browser-harness.json"); - const localAppData = (): string => process.env["LOCALAPPDATA"] ?? join(homedir(), "AppData", "Local"); export const userDataDirCandidates = (): ReadonlyArray<string> => { |
