Skip to content

Chrome DevTools for coding agents

chore(build): add root GN configuration and symlink DevTools DEPS (#3328)

Nikolay Vitkove54ee0465897
diff --git a/.gitignore b/.gitignore
index 6c2fa350..208e2f79 100644
--- a/.gitignore
+++ b/.gitignore
@@ -153,7 +153,14 @@ log.txt
mcp-heap-profiles/
# gclient and depot_tools
+/build
+/build_overrides
+/buildtools
third_party/.cipd/
third_party/.gclient*
third_party/.gcs_entries
+third_party/cpython3
third_party/depot_tools/
+third_party/ninja
+third_party/node
+third_party/typescript
diff --git a/.gn b/.gn
new file mode 100644
index 00000000..67f3b74a
--- /dev/null
+++ b/.gn
@@ -0,0 +1,14 @@
+# Copyright 2026 Google LLC
+# SPDX-License-Identifier: Apache-2.0
+
+buildconfig = "//build_overrides/BUILDCONFIG.gn"
+script_executable = "//third_party/cpython3/host/bin/python3"
+
+default_args = {
+ use_siso = false
+ devtools_bundle = false
+
+ devtools_location = "third_party/devtools-frontend/"
+ devtools_root_location = "third_party/devtools-frontend"
+ devtools_visibility = [ "*" ]
+}
diff --git a/.prettierignore b/.prettierignore
index 434ead6e..29b13c60 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,6 +1,10 @@
# Prettier-only ignores.
CHANGELOG.md
src/third_party/lighthouse-devtools-mcp-bundle.js
+build
+build_overrides
+buildtools
+out
third_party
# Release-please formatting breaks CI checks
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 00000000..fb8c9a68
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,15 @@
+# Copyright 2026 Google LLC
+# SPDX-License-Identifier: Apache-2.0
+
+group("devtools_deps") {
+ deps = [
+ "//third_party/devtools-frontend/front_end/entrypoints/formatter_worker:worker_entrypoint",
+ "//third_party/devtools-frontend/front_end/entrypoints/heap_snapshot_worker:worker_entrypoint",
+ "//third_party/devtools-frontend/front_end/models/issues_manager:descriptions",
+ "//third_party/devtools-frontend/mcp:mcp",
+ ]
+}
+
+group("default") {
+ deps = [ ":devtools_deps" ]
+}
diff --git a/eslint.config.js b/eslint.config.js
index 0d98e934..a6a432f6 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -30,6 +30,10 @@ export default defineConfig([
globalIgnores([
'**/node_modules',
'**/build/',
+ 'build/**',
+ 'build_overrides/**',
+ 'buildtools/**',
+ 'out/**',
'third_party/**',
'tests/tools/fixtures/',
'tests/fixtures/',
diff --git a/package.json b/package.json
index 4c89f3e5..13d9b62d 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"test:update-snapshots": "npm run build && node scripts/test.js --test-update-snapshots",
"prepare": "node scripts/prepare.ts",
"gclient-sync": "node scripts/gclient-sync.ts",
+ "gn:gen": "node scripts/gn-gen.ts",
"sync": "npm ci && git submodule update --init",
"verify-server-json-version": "node scripts/verify-server-json-version.ts",
"update-lighthouse": "node scripts/update-lighthouse.ts",
diff --git a/scripts/gn-gen.ts b/scripts/gn-gen.ts
new file mode 100644
index 00000000..304aa968
--- /dev/null
+++ b/scripts/gn-gen.ts
@@ -0,0 +1,39 @@
+/**
+ * @license
+ * Copyright 2026 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import {execFileSync} from 'node:child_process';
+import {rmSync} from 'node:fs';
+import {resolve} from 'node:path';
+
+import {linkDevToolsDeps} from './link-devtools-deps.ts';
+
+const projectRoot = process.cwd();
+
+function getGnBinaryPath(): string {
+ switch (process.platform) {
+ case 'win32':
+ return resolve(projectRoot, 'buildtools', 'win', 'gn.exe');
+ case 'darwin':
+ return resolve(projectRoot, 'buildtools', 'mac', 'gn');
+ default:
+ return resolve(projectRoot, 'buildtools', 'linux64', 'gn');
+ }
+}
+
+export function runGnGen(): void {
+ linkDevToolsDeps();
+ execFileSync(getGnBinaryPath(), ['gen', 'out/Default'], {
+ cwd: projectRoot,
+ stdio: 'inherit',
+ });
+
+ // Remove the generated .gitignore so npm pack / publish includes out/Default/gen.
+ rmSync(resolve(projectRoot, 'out', 'Default', '.gitignore'), {force: true});
+}
+
+if (import.meta.main) {
+ runGnGen();
+}
diff --git a/scripts/link-devtools-deps.ts b/scripts/link-devtools-deps.ts
new file mode 100644
index 00000000..4fac9e99
--- /dev/null
+++ b/scripts/link-devtools-deps.ts
@@ -0,0 +1,45 @@
+/**
+ * @license
+ * Copyright 2026 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import {lstatSync, rmSync, symlinkSync} from 'node:fs';
+import {resolve} from 'node:path';
+
+export function linkDevToolsDeps(): void {
+ const root = process.cwd();
+ const type = process.platform === 'win32' ? 'junction' : 'dir';
+ const links: Array<[string, string]> = [
+ ['build', 'third_party/devtools-frontend/build'],
+ ['build_overrides', 'third_party/devtools-frontend/build_overrides'],
+ ['buildtools', 'third_party/devtools-frontend/buildtools'],
+ ['third_party/ninja', 'devtools-frontend/third_party/ninja'],
+ ['third_party/node', 'devtools-frontend/third_party/node'],
+ ['third_party/typescript', 'devtools-frontend/third_party/typescript'],
+ ['third_party/cpython3', 'devtools-frontend/third_party/cpython3'],
+ ];
+
+ for (const [linkRel, targetRel] of links) {
+ const linkPath = resolve(root, linkRel);
+ const targetPath =
+ process.platform === 'win32'
+ ? resolve(linkPath, '..', targetRel)
+ : targetRel;
+ try {
+ const stat = lstatSync(linkPath);
+ if (stat.isSymbolicLink()) {
+ rmSync(linkPath, {force: true});
+ } else {
+ rmSync(linkPath, {recursive: true, force: true});
+ }
+ } catch {
+ // Path does not exist yet.
+ }
+ symlinkSync(targetPath, linkPath, type);
+ }
+}
+
+if (import.meta.main) {
+ linkDevToolsDeps();
+}