Skip to content

Chrome DevTools for coding agents

refactor(config): lock slim and pageIdRouting options when viaCli is set (#3257)

Nikolay Vitkov384d9aad349a
diff --git a/src/config/ServerConfig.ts b/src/config/ServerConfig.ts
index 7a47c167..3c9b2e62 100644
--- a/src/config/ServerConfig.ts
+++ b/src/config/ServerConfig.ts
@@ -202,6 +202,8 @@ export class ServerConfig implements ReadonlyServerConfig {
}
if (isViaCli) {
+ resolvedArgs.slim = false;
+ resolvedArgs.pageIdRouting = true;
if (
resolvedArgs.filesystemRoot === DEFAULT_FILESYSTEM_ROOT &&
explicitArgs.allowUnrestrictedPaths !== false
diff --git a/src/config/mcp-options.ts b/src/config/mcp-options.ts
index 3018f90e..f59d50a6 100644
--- a/src/config/mcp-options.ts
+++ b/src/config/mcp-options.ts
@@ -283,8 +283,9 @@ export function getCliOptions(): Partial<
// Missing CLI serialization.
delete options.viewport;
- // The CLI is generated for the full mode, not slim mode.
+ // The CLI is generated for the full mode with pageId routing, not slim mode.
delete options.slim;
+ delete options.pageIdRouting;
// Change the defaults for the CLI.
delete options.experimentalStructuredContent;
diff --git a/tests/config/ServerConfig.test.ts b/tests/config/ServerConfig.test.ts
index c34d8fd4..46c70cc8 100644
--- a/tests/config/ServerConfig.test.ts
+++ b/tests/config/ServerConfig.test.ts
@@ -155,6 +155,19 @@ describe('ServerConfig', () => {
assert.strictEqual(args.categoryExtensions, undefined);
});
+ it('locks slim=false and pageIdRouting=true for viaCli even when set in explicitArgs', () => {
+ const args = ServerConfig.applyDefaults(
+ {
+ viaCli: true,
+ slim: true,
+ pageIdRouting: false,
+ },
+ {env: {}},
+ );
+ assert.strictEqual(args.slim, false);
+ assert.strictEqual(args.pageIdRouting, true);
+ });
+
it('turns off usage statistics in CI', () => {
sinon.stub(console, 'error');
const args = ServerConfig.applyDefaults(