💬 Commit message: Update 2026-02-06 20:32:18, 7 files, 781 lines

📁 Files changed: 7
📝 Lines changed: 781

  • CLAUDE.md
  • biome.json
  • package-lock.json
  • package.json
  • browser.ts
  • cli.ts
  • server.ts
This commit is contained in:
Adam Ladachowski
2026-02-06 20:32:19 +01:00
parent eccc03ee7a
commit 3ece3bd3b8
7 changed files with 546 additions and 251 deletions
+7 -13
View File
@@ -1,11 +1,6 @@
import { webkit, Browser, BrowserContext, Page } from 'playwright';
import { resolve } from 'node:path';
import type {
BrowserOptions,
BrowserCommand,
CommandResponse,
ElementInfo,
} from './types.js';
import { type Browser, type BrowserContext, type Page, webkit } from 'playwright';
import type { BrowserCommand, BrowserOptions, CommandResponse, ElementInfo } from './types.js';
export class ClaudeBrowser {
private browser: Browser | null = null;
@@ -83,10 +78,7 @@ export class ClaudeBrowser {
);
}
async screenshot(
path?: string,
fullPage = false
): Promise<{ path: string; buffer?: Buffer }> {
async screenshot(path?: string, fullPage = false): Promise<{ path: string; buffer?: Buffer }> {
const page = this.ensurePage();
const resolvedPath = resolve(path || 'screenshot.png');
const buffer = await page.screenshot({ path: resolvedPath, fullPage });
@@ -198,8 +190,10 @@ export class ClaudeBrowser {
const result = await this.eval(cmd.script);
return { ok: true, result };
}
default:
return { ok: false, error: `Unknown command: ${(cmd as any).cmd}` };
default: {
const _exhaustive: never = cmd;
return { ok: false, error: `Unknown command: ${(_exhaustive as { cmd: string }).cmd}` };
}
}
} catch (err) {
return { ok: false, error: (err as Error).message };