Makelore 2.0 initial clean snapshot
This commit is contained in:
33
electron/opencode/playwright-mcp.ts
Normal file
33
electron/opencode/playwright-mcp.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { dirname, join } from 'node:path';
|
||||
import { createRequire } from 'node:module';
|
||||
import type { OpencodeMcpServerEntry } from './provider-config';
|
||||
|
||||
const moduleRequire = createRequire(import.meta.url);
|
||||
|
||||
export const PLAYWRIGHT_MCP_SERVER_ID = 'playwright';
|
||||
export const PLAYWRIGHT_MCP_PACKAGE = '@playwright/mcp';
|
||||
export const PLAYWRIGHT_MCP_VERSION = '0.0.78';
|
||||
|
||||
function fallbackPlaywrightMcpServer(): OpencodeMcpServerEntry {
|
||||
return {
|
||||
type: 'local',
|
||||
command: ['npx', '-y', `${PLAYWRIGHT_MCP_PACKAGE}@${PLAYWRIGHT_MCP_VERSION}`],
|
||||
enabled: true,
|
||||
};
|
||||
}
|
||||
|
||||
export function resolvePlaywrightMcpServer(): OpencodeMcpServerEntry {
|
||||
try {
|
||||
const packageJsonPath = moduleRequire.resolve(`${PLAYWRIGHT_MCP_PACKAGE}/package.json`);
|
||||
return {
|
||||
type: 'local',
|
||||
command: [process.execPath, join(dirname(packageJsonPath), 'cli.js')],
|
||||
enabled: true,
|
||||
env: {
|
||||
ELECTRON_RUN_AS_NODE: '1',
|
||||
},
|
||||
};
|
||||
} catch {
|
||||
return fallbackPlaywrightMcpServer();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user