Chrome DevTools for coding agents
chore: enable isolatedDeclarations (#3293)
Nikolay Vitkov2c0931b51a1b
diff --git a/package.json b/package.jsonindex 805e4399..c07a4852 100644--- a/package.json+++ b/package.json@@ -43,7 +43,8 @@"LICENSE","skills","!*.tsbuildinfo",- "!*.js.map"+ "!*.js.map",+ "!**/*.d.ts"],"repository": "ChromeDevTools/chrome-devtools-mcp","author": "Google LLC",diff --git a/scripts/generate-docs.ts b/scripts/generate-docs.tsindex cf3d8682..a0eed330 100644--- a/scripts/generate-docs.ts+++ b/scripts/generate-docs.ts@@ -8,12 +8,14 @@ import fs from 'node:fs';import type {Options as YargsOptions} from 'yargs';-import {mcpOptions} from '../build/src/config/mcp-options.js';+import {+ mcpOptions,+ type ParsedArguments,+} from '../build/src/config/mcp-options.js';import {isCategoryOffByDefault,categoryToFlagName,} from '../build/src/config/category-options.js';-import type {ParsedArguments} from '../build/src/config/ConfigParser.js';import {zod} from '../build/src/third_party/index.js';import {ToolCategory, labels} from '../build/src/tools/categories.js';import {isSlimTool} from '../build/src/tools/ToolDefinition.js';diff --git a/src/McpContext.ts b/src/McpContext.tsindex 2dedc8a7..83d3664e 100644--- a/src/McpContext.ts+++ b/src/McpContext.ts@@ -42,7 +42,7 @@ import {type Root,type DevTools,} from './third_party/index.js';-import type {ParsedArguments} from './config/ConfigParser.js';+import type {ParsedArguments} from './config/mcp-options.js';import type {ReadonlyServerConfig} from './config/ServerConfig.js';import {ToolCategory} from './tools/categories.js';import {diff --git a/src/ToolHandler.ts b/src/ToolHandler.tsindex 9ee15110..3ee6322a 100644--- a/src/ToolHandler.ts+++ b/src/ToolHandler.ts@@ -4,7 +4,7 @@* SPDX-License-Identifier: Apache-2.0*/-import type {ParsedArguments} from './config/ConfigParser.js';+import type {ParsedArguments} from './config/mcp-options.js';import type {ReadonlyServerConfig} from './config/ServerConfig.js';import type {McpContext} from './McpContext.js';import type {McpPage} from './McpPage.js';diff --git a/src/config/ConfigParser.ts b/src/config/ConfigParser.tsindex 2579077c..28c47616 100644--- a/src/config/ConfigParser.ts+++ b/src/config/ConfigParser.ts@@ -18,12 +18,10 @@ import {CLI_EXAMPLES,stripYargsPositionalArgs,withoutDefaults,+ type ParsedArguments,} from './mcp-options.js';-import type {ParsedArguments} from './ServerConfig.js';import {ServerConfig} from './ServerConfig.js';-export type {ParsedArguments} from './ServerConfig.js';-function isPlainObject(value: unknown): value is Record<string, unknown> {return typeof value === 'object' && value !== null && !Array.isArray(value);}diff --git a/src/config/ServerConfig.ts b/src/config/ServerConfig.tsindex e1b85aed..832d27d1 100644--- a/src/config/ServerConfig.ts+++ b/src/config/ServerConfig.ts@@ -6,7 +6,6 @@import {isDeepStrictEqual} from 'node:util';-import type {InferredOptionTypes} from '../third_party/cli.js';import {yargs} from '../third_party/cli.js';import {@@ -17,18 +16,10 @@ import {mcpOptions,mcpOptionsForViaCli,stripYargsPositionalArgs,+ type McpOptions,+ type ParsedArguments,} from './mcp-options.js';-type InferredMcpArguments = InferredOptionTypes<typeof mcpOptions>;--export type ParsedArguments = Omit<- InferredMcpArguments,- 'channel' | 'filesystemRoot'-> & {- channel?: InferredMcpArguments['channel'];- filesystemRoot?: InferredMcpArguments['filesystemRoot'];-};-function isMcpOptionKey(key: string): key is keyof ParsedArguments {return key in mcpOptions;}@@ -47,7 +38,7 @@ function copyOption<K extends keyof ParsedArguments>(function filterExplicitArgs(args: Partial<ParsedArguments>,- baseOptions: typeof mcpOptions | typeof mcpOptionsForViaCli,+ baseOptions: McpOptions,): Partial<ParsedArguments> {const filtered: Partial<ParsedArguments> = {};for (const key of Object.keys(args)) {@@ -75,9 +66,7 @@ function mergeLayer(return merged;}-function parseDefaultArgs(- options: typeof mcpOptions | typeof mcpOptionsForViaCli,-): ParsedArguments {+function parseDefaultArgs(options: McpOptions): ParsedArguments {const parsed = yargs([]).parserConfiguration({'strip-aliased': true,diff --git a/src/config/browser-options.ts b/src/config/browser-options.tsindex 6822fb80..5ad8d244 100644--- a/src/config/browser-options.ts+++ b/src/config/browser-options.ts@@ -4,9 +4,26 @@* SPDX-License-Identifier: Apache-2.0*/-import type {YargsOptions} from '../third_party/index.js';+import type {McpOptionsFor} from './category-options.js';-export const browserOptions = {+export interface BrowserArguments {+ autoConnect: boolean;+ browserUrl?: string;+ wsEndpoint?: string;+ wsHeaders?: Record<string, string>;+ headless: boolean;+ executablePath?: string;+ isolated: boolean;+ userDataDir?: string;+ channel?: 'canary' | 'dev' | 'beta' | 'stable';+ proxyServer?: string;+ chromeArg?: string[];+ ignoreDefaultChromeArg?: string[];+}++export type BrowserOptions = McpOptionsFor<BrowserArguments>;++export const browserOptions: BrowserOptions = {autoConnect: {type: 'boolean',description:@@ -112,8 +129,8 @@ export const browserOptions = {type: 'string',description:'Specify a different Chrome channel that should be used. The default is the stable channel version.',- choices: ['canary', 'dev', 'beta', 'stable'] as const,- default: 'stable' as const,+ choices: ['canary', 'dev', 'beta', 'stable'],+ default: 'stable',},proxyServer: {type: 'string',@@ -131,8 +148,8 @@ export const browserOptions = {describe:'Explicitly disable default arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.',},-} satisfies Record<string, YargsOptions>;+};-export function getBrowserOptions(): typeof browserOptions {+export function getBrowserOptions(): BrowserOptions {return browserOptions;}diff --git a/src/config/category-options.ts b/src/config/category-options.tsindex c393a0dd..d227a59f 100644--- a/src/config/category-options.ts+++ b/src/config/category-options.ts@@ -4,8 +4,66 @@* SPDX-License-Identifier: Apache-2.0*/+import type {YargsOptions} from '../third_party/cli.js';import {ToolCategory} from '../tools/categories.js';+export interface McpOption extends YargsOptions {+ /**+ * Whether changes to this option in a config file can be applied to a running+ * server without restarting it.+ */+ reloadable?: boolean;+}++type McpOptionBase<TBase extends YargsOptions> = Omit<+ TBase,+ 'type' | 'default' | 'choices' | 'coerce'+>;++type WithDefault<T, HasDefault extends boolean> = HasDefault extends true+ ? {default: T}+ : {default?: T};++export type McpOptionFor<+ T,+ TBase extends YargsOptions = YargsOptions,+ HasDefault extends boolean = true,+> = [NonNullable<T>] extends [boolean]+ ? McpOptionBase<TBase> & {type: 'boolean'} & WithDefault<boolean, HasDefault>+ : [NonNullable<T>] extends [number]+ ? McpOptionBase<TBase> & {+ type: 'number';+ coerce?: (arg: number | undefined) => number | undefined;+ } & WithDefault<number, HasDefault>+ : [NonNullable<T>] extends [string]+ ? string extends NonNullable<T>+ ? McpOptionBase<TBase> & {+ type: 'string';+ coerce?: (arg: string | undefined) => string | undefined;+ } & WithDefault<string, HasDefault>+ : McpOptionBase<TBase> & {+ type: 'string';+ choices: ReadonlyArray<NonNullable<T>>;+ } & WithDefault<NonNullable<T>, HasDefault>+ : [NonNullable<T>] extends [string[]]+ ? McpOptionBase<TBase> & {+ type: 'array';+ string: true;+ coerce?: (arg: string[] | undefined) => string[] | undefined;+ } & WithDefault<string[], HasDefault>+ : McpOptionBase<TBase> & {+ type: 'string';+ coerce: (arg: string | undefined) => T;+ };++export type McpOptionsFor<TArgs, TBase extends YargsOptions = YargsOptions> = {+ [K in keyof TArgs]-?: McpOptionFor<+ TArgs[K],+ TBase,+ Record<never, never> extends Pick<TArgs, K> ? false : true+ >;+};+export interface CategoryOption {type: 'boolean';describe: string;@@ -22,6 +80,10 @@ export type CategoryFlags = {[K in ToolCategory as CategoryFlagName<K>]: CategoryOption;};+export type CategoryArguments = {+ [K in ToolCategory as CategoryFlagName<K>]?: boolean;+};+const categoryOverrides: Record<ToolCategory,{diff --git a/src/config/mcp-options.ts b/src/config/mcp-options.tsindex ed6fbfbe..16ccb8ef 100644--- a/src/config/mcp-options.ts+++ b/src/config/mcp-options.ts@@ -9,25 +9,69 @@ import type {YargsOptions} from '../third_party/index.js';import os from 'node:os';import path from 'node:path';-import {getCategoryOptions} from './category-options.js';-import {getBrowserOptions} from './browser-options.js';-import {puppeteerOptions} from './puppeteer-options.js';-import {toolOptions} from './tool-options.js';+import {+ getCategoryOptions,+ type CategoryArguments,+ type McpOption,+ type McpOptionsFor,+} from './category-options.js';+import {getBrowserOptions, type BrowserArguments} from './browser-options.js';+import {+ puppeteerOptions,+ type PuppeteerArguments,+} from './puppeteer-options.js';+import {toolOptions, type ToolArguments} from './tool-options.js';-export interface McpOption extends YargsOptions {- /**- * Whether changes to this option in a config file can be applied to a running- * server without restarting it.- */- reloadable?: boolean;+export interface McpArguments+ extends+ CategoryArguments,+ BrowserArguments,+ PuppeteerArguments,+ ToolArguments {+ logFile?: string;+ pageIdRouting: boolean;+ devtoolsComments: boolean;+ experimentalDevtools: boolean;+ experimentalVision: boolean;+ memoryDebugging: boolean;+ experimentalStructuredContent: boolean;+ experimentalToonFormat: boolean;+ experimentalDataFormat?: 'default' | 'toon' | 'gcf';+ experimentalIncludeAllPages: boolean;+ experimentalInteropTools: boolean;+ experimentalScreencast: boolean;+ experimentalFfmpegPath?: string;+ screencastFps?: number;+ performanceCrux: boolean;+ usageStatistics: boolean;+ javascriptEvaluation: boolean;+ fileNavigations: boolean;+ sourceMaps: boolean;+ maxNavigationSaved: number;+ clearcutEndpoint?: string;+ clearcutForceFlushIntervalMs?: number;+ clearcutIncludePidHeader: boolean;+ slim: boolean;+ viaCli: boolean;+ redactNetworkHeaders: boolean;+ allowUnrestrictedPaths: boolean;+ filesystemRoot?: string[];+ config?: string;+ watchConfig: boolean;}-export const DEFAULT_FILESYSTEM_ROOT = [os.tmpdir()];+export type ParsedArguments = {+ [K in keyof McpArguments]: McpArguments[K];+};++export type McpOptions = McpOptionsFor<ParsedArguments, McpOption>;++export const DEFAULT_FILESYSTEM_ROOT: string[] = [os.tmpdir()];// Each retained navigation can hold up to 1,000 network requests and 10,000// console messages, so the history is capped to avoid running out of memory.export const MAX_NAVIGATION_SAVED_LIMIT = 25;-export const mcpOptions = {+export const mcpOptions: McpOptions = {...getCategoryOptions(),...getBrowserOptions(),...puppeteerOptions,@@ -91,7 +135,7 @@ export const mcpOptions = {defaultDescription: 'default',describe:'Override format for structured data in text responses. Default uses built-in formatters. "toon" (requires @toon-format/toon) or "gcf" (requires @blackwell-systems/gcf) replace structured content with the specified encoding.',- choices: ['default', 'toon', 'gcf'] as const,+ choices: ['default', 'toon', 'gcf'],hidden: true,reloadable: true,},@@ -268,9 +312,9 @@ export const mcpOptions = {describe:'Watch the config file for changes and apply them without restarting. Tools (except --categoryExtensions) are enabled, disabled and updated on the fly; options used to launch or connect to the browser still require a restart.',},-} satisfies Record<string, McpOption>;+};-export const mcpOptionsForViaCli = {+export const mcpOptionsForViaCli: McpOptions = {...mcpOptions,headless: {...mcpOptions.headless,@@ -296,12 +340,12 @@ export const mcpOptionsForViaCli = {defaultDescription:'true unless userDataDir, autoConnect, browserUrl or wsEndpoint is set',},-} satisfies Record<keyof typeof mcpOptions, YargsOptions>;+};export function getCliOptions(): Partial<- Record<keyof typeof mcpOptions, YargsOptions>+ Record<keyof McpOptions, YargsOptions>> {- const options: Partial<Record<keyof typeof mcpOptions, YargsOptions>> =+ const options: Partial<Record<keyof McpOptions, YargsOptions>> =withoutDefaults(mcpOptionsForViaCli);// Missing CLI serialization.@@ -380,7 +424,7 @@ export const CLI_EXAMPLES: Array<[string, string]> = [],];-export const CONFLICTING_ARGS: Array<Array<keyof typeof mcpOptions>> = [+export const CONFLICTING_ARGS: Array<Array<keyof McpOptions>> = [['channel', 'executablePath', 'browserUrl', 'wsEndpoint'],['userDataDir', 'browserUrl', 'wsEndpoint'],['userDataDir', 'isolated'],@@ -392,9 +436,7 @@ export const CONFLICTING_ARGS: Array<Array<keyof typeof mcpOptions>> = [['categoryPwa', 'browserUrl', 'wsEndpoint'],];-export const IMPLICATIONS: Array<- [keyof typeof mcpOptions, keyof typeof mcpOptions]-> = [+export const IMPLICATIONS: Array<[keyof McpOptions, keyof McpOptions]> = [['wsHeaders', 'wsEndpoint'],['experimentalFfmpegPath', 'experimentalScreencast'],];@@ -427,7 +469,7 @@ export function stripYargsPositionalArgs<T extends {_?: unknown; $0?: unknown}>(return copy;}-export function isReloadableOption(name: keyof typeof mcpOptions): boolean {+export function isReloadableOption(name: keyof McpOptions): boolean {const option: McpOption = mcpOptions[name];return option.reloadable === true;}diff --git a/src/config/puppeteer-options.ts b/src/config/puppeteer-options.tsindex 9e94ed4c..767fef5f 100644--- a/src/config/puppeteer-options.ts+++ b/src/config/puppeteer-options.ts@@ -7,20 +7,36 @@import type {YargsOptions} from '../third_party/index.js';import {validateUrlPatterns} from '../utils/url.js';+import type {McpOptionsFor} from './category-options.js';+interface PuppeteerOption extends YargsOptions {reloadable?: boolean;}+export interface PuppeteerArguments {+ viewport?: {width: number; height: number};+ acceptInsecureCerts: boolean;+ blockedUrlPattern?: string[];+ allowedUrlPattern?: string[];+}++export type PuppeteerOptions = McpOptionsFor<+ PuppeteerArguments,+ PuppeteerOption+>;+/*** Options that are applied through Puppeteer when launching or connecting to* the browser.*/-export const puppeteerOptions = {+export const puppeteerOptions: PuppeteerOptions = {viewport: {type: 'string',describe:'Initial viewport size for the Chrome instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.',- coerce: (arg: string | undefined) => {+ coerce: (+ arg: string | undefined,+ ): {width: number; height: number} | undefined => {if (arg === undefined) {return;}@@ -52,7 +68,7 @@ export const puppeteerOptions = {reloadable: true,describe:"Restricts browser's network access by blocking specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Silently detaches from targets with blocked URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns. A pattern that uses a regexp group, a named group (`:name`), or a partial IPv4 wildcard (for example `(127\\.\\d+\\.\\d+\\.\\d+)`, `*://127.0.0.1::port/*`, or `*://127.0.0.*/*`) is rejected, because it is not enforced on redirects or subresources; use an exact value or a `*` wildcard instead. Patterns follow URL Pattern defaults: an omitted port matches only the scheme's default port (for example, `https://internal.corp/*` does not match `https://internal.corp:8443/`; use `https://internal.corp:*/*` to match any port), and the hostname must match exactly (a trailing-dot host such as `internal.corp.` is a different hostname).",- coerce: (arg: string[] | undefined) => {+ coerce: (arg: string[] | undefined): string[] | undefined => {if (arg === undefined || arg.length === 0) {return undefined;}@@ -66,7 +82,7 @@ export const puppeteerOptions = {reloadable: true,describe:"Restricts browser's network access by allowing only specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Requires Chrome 149+. Silently detaches from targets with unallowed URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns. A pattern that uses a regexp group, a named group (`:name`), or a partial IPv4 wildcard (for example `(127\\.\\d+\\.\\d+\\.\\d+)`, `*://127.0.0.1::port/*`, or `*://127.0.0.*/*`) is rejected, because it is not enforced on redirects or subresources; use an exact value or a `*` wildcard instead. Patterns follow URL Pattern defaults: an omitted port matches only the scheme's default port (for example, `https://internal.corp/*` does not match `https://internal.corp:8443/`; use `https://internal.corp:*/*` to match any port), and the hostname must match exactly (a trailing-dot host such as `internal.corp.` is a different hostname).",- coerce: (arg: string[] | undefined) => {+ coerce: (arg: string[] | undefined): string[] | undefined => {if (arg === undefined) {return undefined;}@@ -79,4 +95,4 @@ export const puppeteerOptions = {return arg;},},-} satisfies Record<string, PuppeteerOption>;+};diff --git a/src/config/tool-options.ts b/src/config/tool-options.tsindex 8ddc907b..70cb2e81 100644--- a/src/config/tool-options.ts+++ b/src/config/tool-options.ts@@ -6,20 +6,31 @@import type {YargsOptions} from '../third_party/index.js';+import type {McpOptionsFor} from './category-options.js';+interface ToolOption extends YargsOptions {reloadable: true;}+export interface ToolArguments {+ screenshotFormat: 'jpeg' | 'png' | 'webp';+ screenshotQuality?: number;+ screenshotMaxWidth?: number;+ screenshotMaxHeight?: number;+}++export type ToolOptions = McpOptionsFor<ToolArguments, ToolOption>;+/*** Options that change the default behavior of tools.*/-export const toolOptions = {+export const toolOptions: ToolOptions = {screenshotFormat: {type: 'string',- default: 'png' as const,+ default: 'png',description:'Override the default output format used by take_screenshot when the caller does not specify one. JPEG and WebP are ~3-5x smaller than PNG, which reduces transfer and storage size. To reduce context size use --screenshotMaxWidth / --screenshotMaxHeight, since image tokens scale with dimensions rather than encoded bytes. Unset preserves the existing default ("png").',- choices: ['jpeg', 'png', 'webp'] as const,+ choices: ['jpeg', 'png', 'webp'],reloadable: true,},screenshotQuality: {@@ -73,4 +84,4 @@ export const toolOptions = {return value;},},-} satisfies Record<string, ToolOption>;+};diff --git a/src/index.ts b/src/index.tsindex 4468f2ae..f8a96c75 100644--- a/src/index.ts+++ b/src/index.ts@@ -9,9 +9,12 @@ import path from 'node:path';import {pathToFileURL} from 'node:url';import {BrowserManager} from './BrowserManager.js';-import {ConfigParser, type ParsedArguments} from './config/ConfigParser.js';+import {ConfigParser} from './config/ConfigParser.js';import {ConfigWatcher} from './config/ConfigWatcher.js';-import {DEFAULT_FILESYSTEM_ROOT} from './config/mcp-options.js';+import {+ DEFAULT_FILESYSTEM_ROOT,+ type ParsedArguments,+} from './config/mcp-options.js';import {ServerConfig} from './config/ServerConfig.js';import {loadIssueDescriptions} from './devtools/issueDescriptions.js';import {McpContext} from './McpContext.js';diff --git a/src/tools/ToolDefinition.ts b/src/tools/ToolDefinition.tsindex a3f7f508..74d162e9 100644--- a/src/tools/ToolDefinition.ts+++ b/src/tools/ToolDefinition.ts@@ -5,7 +5,7 @@*/import {categoryToFlagName} from '../config/category-options.js';-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';import type {HeapSnapshotAggregateData,HeapSnapshotDiff,diff --git a/src/tools/console.ts b/src/tools/console.tsindex aa7708d4..1c29bafe 100644--- a/src/tools/console.ts+++ b/src/tools/console.ts@@ -4,7 +4,7 @@* SPDX-License-Identifier: Apache-2.0*/-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';import {zod} from '../third_party/index.js';import type {ConsoleMessageType} from '../third_party/index.js';diff --git a/src/tools/lighthouse.ts b/src/tools/lighthouse.tsindex 52d9193b..523fcd23 100644--- a/src/tools/lighthouse.ts+++ b/src/tools/lighthouse.ts@@ -6,7 +6,7 @@import path from 'node:path';-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';import {generateReport,diff --git a/src/tools/network.ts b/src/tools/network.tsindex e4f74d8e..2e8770ed 100644--- a/src/tools/network.ts+++ b/src/tools/network.ts@@ -4,7 +4,7 @@* SPDX-License-Identifier: Apache-2.0*/-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';import {zod} from '../third_party/index.js';import type {ResourceType} from '../third_party/index.js';diff --git a/src/tools/pages.ts b/src/tools/pages.tsindex 91976bd5..3fdae2fe 100644--- a/src/tools/pages.ts+++ b/src/tools/pages.ts@@ -4,7 +4,7 @@* SPDX-License-Identifier: Apache-2.0*/-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';import type {CdpPage} from '../third_party/index.js';import {zod} from '../third_party/index.js';import {logger} from '../utils/logger.js';diff --git a/src/tools/screencast.ts b/src/tools/screencast.tsindex 6b28bf71..34ad2ee3 100644--- a/src/tools/screencast.ts+++ b/src/tools/screencast.ts@@ -8,7 +8,7 @@ import fs from 'node:fs/promises';import os from 'node:os';import path from 'node:path';-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';import {zod} from '../third_party/index.js';import type {Page,diff --git a/src/tools/screenshot.ts b/src/tools/screenshot.tsindex 2f17bfcf..d8d310ea 100644--- a/src/tools/screenshot.ts+++ b/src/tools/screenshot.ts@@ -4,7 +4,7 @@* SPDX-License-Identifier: Apache-2.0*/-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';import {zod} from '../third_party/index.js';import type {BoundingBox,diff --git a/src/tools/script.ts b/src/tools/script.tsindex c540d579..ea81171f 100644--- a/src/tools/script.ts+++ b/src/tools/script.ts@@ -6,7 +6,7 @@import {pathToFileURL} from 'node:url';-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';import {zod} from '../third_party/index.js';import type {Frame, JSHandle, Page, WebWorker} from '../third_party/index.js';diff --git a/src/tools/slim/tools.ts b/src/tools/slim/tools.tsindex 5eaac214..746cee6f 100644--- a/src/tools/slim/tools.ts+++ b/src/tools/slim/tools.ts@@ -4,7 +4,7 @@* SPDX-License-Identifier: Apache-2.0*/-import type {ParsedArguments} from '../../config/ConfigParser.js';+import type {ParsedArguments} from '../../config/mcp-options.js';import type {Dialog} from '../../third_party/index.js';import {zod} from '../../third_party/index.js';import {ToolCategory} from '../categories.js';diff --git a/src/tools/tools.ts b/src/tools/tools.tsindex 01404ca6..1fa14267 100644--- a/src/tools/tools.ts+++ b/src/tools/tools.ts@@ -4,8 +4,7 @@* SPDX-License-Identifier: Apache-2.0*/-import type {ParsedArguments} from '../config/ConfigParser.js';-import {mcpOptions} from '../config/mcp-options.js';+import {mcpOptions, type ParsedArguments} from '../config/mcp-options.js';import type {YargsOptions} from '../third_party/index.js';import * as commentsTools from './comments.js';diff --git a/src/utils/disclaimers.ts b/src/utils/disclaimers.tsindex 0f6dd360..97b698f6 100644--- a/src/utils/disclaimers.ts+++ b/src/utils/disclaimers.ts@@ -4,7 +4,7 @@* SPDX-License-Identifier: Apache-2.0*/-import type {ParsedArguments} from '../config/ConfigParser.js';+import type {ParsedArguments} from '../config/mcp-options.js';export function logCruxDisclaimer(args: ParsedArguments): void {if (!args.slim && args.performanceCrux) {diff --git a/tests/McpResponse.test.ts b/tests/McpResponse.test.tsindex 8fbe8365..8e80ed95 100644--- a/tests/McpResponse.test.ts+++ b/tests/McpResponse.test.ts@@ -11,7 +11,7 @@ import {after, describe, it} from 'node:test';import sinon from 'sinon';-import type {ParsedArguments} from '../src/config/ConfigParser.js';+import type {ParsedArguments} from '../src/config/mcp-options.js';import type {McpContext} from '../src/McpContext.js';import {McpResponse} from '../src/McpResponse.js';import {TextSnapshot} from '../src/TextSnapshot.js';diff --git a/tests/cli.test.ts b/tests/cli.test.tsindex 9c13b74e..95183994 100644--- a/tests/cli.test.ts+++ b/tests/cli.test.ts@@ -726,6 +726,7 @@ describe('cli args parsing', () => {it('rejects invalid maxNavigationSaved values', async () => {const coerce = mcpOptions.maxNavigationSaved.coerce;+ assert.ok(coerce);assert.strictEqual(coerce(undefined), undefined);assert.strictEqual(coerce(1), 1);diff --git a/tests/daemon/utils.test.ts b/tests/daemon/utils.test.tsindex d8d6b07b..c4b9e5f7 100644--- a/tests/daemon/utils.test.ts+++ b/tests/daemon/utils.test.ts@@ -15,7 +15,7 @@ import {afterEach, beforeEach, describe, it} from 'node:test';import sinon from 'sinon';-import type {ParsedArguments} from '../../src/config/ConfigParser.js';+import type {ParsedArguments} from '../../src/config/mcp-options.js';import {DAEMON_SCRIPT_PATH,serializeArgs,diff --git a/tests/mocks.ts b/tests/mocks.tsindex 74f10b38..aabca3df 100644--- a/tests/mocks.ts+++ b/tests/mocks.ts@@ -27,10 +27,8 @@ import './setupDevTools.js';import type {Frame, Mouse, SerializedAXNode} from 'puppeteer-core';import sinon from 'sinon';-import {- type ParsedArguments,- ServerConfig,-} from '../src/config/ServerConfig.js';+import type {ParsedArguments} from '../src/config/mcp-options.js';+import {ServerConfig} from '../src/config/ServerConfig.js';import {McpContext} from '../src/McpContext.js';import {McpPage} from '../src/McpPage.js';import {McpResponse} from '../src/McpResponse.js';diff --git a/tests/network_blocking.test.ts b/tests/network_blocking.test.tsindex cc8d39e4..ff996d24 100644--- a/tests/network_blocking.test.ts+++ b/tests/network_blocking.test.ts@@ -14,7 +14,7 @@ import {emulate} from '../src/tools/emulation.js';import {lighthouseAudit} from '../src/tools/lighthouse.js';import {navigatePage} from '../src/tools/pages.js';import {evaluateScript} from '../src/tools/script.js';-import type {ParsedArguments} from '../src/config/ConfigParser.js';+import type {ParsedArguments} from '../src/config/mcp-options.js';import {serverHooks, type TestServer} from './server.js';import {withMcpContext} from './utils.js';diff --git a/tests/tools/console.test.ts b/tests/tools/console.test.tsindex dd56641b..85e149ac 100644--- a/tests/tools/console.test.ts+++ b/tests/tools/console.test.ts@@ -10,7 +10,7 @@ import {before, describe, it} from 'node:test';import type {Dialog} from 'puppeteer-core';-import type {ParsedArguments} from '../../src/config/ConfigParser.js';+import type {ParsedArguments} from '../../src/config/mcp-options.js';import {loadIssueDescriptions} from '../../src/devtools/issueDescriptions.js';import {McpResponse} from '../../src/McpResponse.js';import {TextSnapshot} from '../../src/TextSnapshot.js';diff --git a/tests/tools/screenshot.test.ts b/tests/tools/screenshot.test.tsindex cc1bec5a..6d48254a 100644--- a/tests/tools/screenshot.test.ts+++ b/tests/tools/screenshot.test.ts@@ -11,7 +11,7 @@ import {describe, it} from 'node:test';import sinon from 'sinon';-import type {ParsedArguments} from '../../src/config/ConfigParser.js';+import type {ParsedArguments} from '../../src/config/mcp-options.js';import {TextSnapshot} from '../../src/TextSnapshot.js';import {zod} from '../../src/third_party/index.js';import {screenshot} from '../../src/tools/screenshot.js';diff --git a/tests/tools/thirdPartyDeveloper.test.ts b/tests/tools/thirdPartyDeveloper.test.tsindex f8fabb26..41a5c224 100644--- a/tests/tools/thirdPartyDeveloper.test.ts+++ b/tests/tools/thirdPartyDeveloper.test.ts@@ -9,7 +9,7 @@ import {describe, it} from 'node:test';import sinon from 'sinon';-import type {ParsedArguments} from '../../src/config/ConfigParser.js';+import type {ParsedArguments} from '../../src/config/mcp-options.js';import type {McpContext} from '../../src/McpContext.js';import type {McpResponse} from '../../src/McpResponse.js';import {TextSnapshot} from '../../src/TextSnapshot.js';diff --git a/tests/utils.ts b/tests/utils.tsindex 46131076..4bdf3351 100644--- a/tests/utils.ts+++ b/tests/utils.ts@@ -28,7 +28,7 @@ import type {} from 'puppeteer-core';import sinon from 'sinon';-import type {ParsedArguments} from '../src/config/ConfigParser.js';+import type {ParsedArguments} from '../src/config/mcp-options.js';import {stopDaemon} from '../src/daemon/client.js';import {isDaemonRunning} from '../src/daemon/utils.js';import {McpContext, type McpContextOptions} from '../src/McpContext.js';diff --git a/tsconfig.json b/tsconfig.jsonindex 63afe36c..9b7e1d36 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -24,7 +24,9 @@"incremental": true,"sourceMap": true,"preserveConstEnums": true,- "useUnknownInCatchVariables": false+ "useUnknownInCatchVariables": false,+ "declaration": true,+ "isolatedDeclarations": true},"include": ["src/**/*.ts",