💬 Commit message: Update 2026-02-07 14:20:25, 8 files, 1060 lines

📁 Files changed: 8
📝 Lines changed: 1060

  • package-lock.json
  • package.json
  • browser.ts
  • cli.ts
  • image.ts
  • index.ts
  • mcp.ts
  • types.ts
This commit is contained in:
Adam Ladachowski
2026-02-07 14:20:25 +01:00
parent 4f0bec5f81
commit 67b6dc3a79
8 changed files with 1056 additions and 4 deletions
+67
View File
@@ -1,5 +1,6 @@
import { resolve } from 'node:path';
import { type Browser, type BrowserContext, type Page, webkit } from 'playwright';
import * as image from './image.js';
import type { BrowserCommand, BrowserOptions, CommandResponse, ElementInfo } from './types.js';
export class ClaudeBrowser {
@@ -190,6 +191,72 @@ export class ClaudeBrowser {
const result = await this.eval(cmd.script);
return { ok: true, result };
}
case 'favicon': {
const result = await image.createFavicon(cmd.input, cmd.outputDir);
return { ok: true, files: result.files, outputDir: result.outputDir };
}
case 'convert': {
const result = await image.convert(cmd.input, cmd.output, cmd.format);
return {
ok: true,
path: result.path,
width: result.width,
height: result.height,
format: result.format,
size: result.size,
};
}
case 'resize': {
const result = await image.resize(cmd.input, cmd.output, cmd.width, cmd.height, cmd.fit);
return {
ok: true,
path: result.path,
width: result.width,
height: result.height,
format: result.format,
size: result.size,
};
}
case 'crop': {
const result = await image.crop(
cmd.input,
cmd.output,
cmd.left,
cmd.top,
cmd.width,
cmd.height
);
return {
ok: true,
path: result.path,
width: result.width,
height: result.height,
format: result.format,
size: result.size,
};
}
case 'compress': {
const result = await image.compress(cmd.input, cmd.output, cmd.quality);
return {
ok: true,
path: result.path,
width: result.width,
height: result.height,
format: result.format,
size: result.size,
};
}
case 'thumbnail': {
const result = await image.thumbnail(cmd.input, cmd.output, cmd.size);
return {
ok: true,
path: result.path,
width: result.width,
height: result.height,
format: result.format,
size: result.size,
};
}
default: {
const _exhaustive: never = cmd;
return { ok: false, error: `Unknown command: ${(_exhaustive as { cmd: string }).cmd}` };