From 29ef6f86372a2881c07ed33ac231bd3f1822881a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 19 Jul 2026 06:47:32 -0700 Subject: [PATCH] fix(scripts): resolve remaining repo tools through the worktree-aware helper (#111417) Follow-up to #111393: run-tsgo, check-tsgo-core-boundary, profile-tsgo, and the format-docs oxfmt shim still resolved node_modules/.bin from the current checkout only, so dependency-less linked worktrees died with ENOENT before oxlint's boundary prep could run. All four now use resolveRepoToolBinPath, completing local lint/typecheck tooling for linked worktrees. --- scripts/check-tsgo-core-boundary.mjs | 3 ++- scripts/format-docs.mjs | 3 ++- scripts/profile-tsgo.mjs | 3 ++- scripts/run-tsgo.mjs | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/check-tsgo-core-boundary.mjs b/scripts/check-tsgo-core-boundary.mjs index 50aa0a4f76aa..bb834e4d0dbe 100644 --- a/scripts/check-tsgo-core-boundary.mjs +++ b/scripts/check-tsgo-core-boundary.mjs @@ -3,10 +3,11 @@ // Enforces core tsgo project boundaries and sparse-checkout safety. import { spawnSync } from "node:child_process"; import path from "node:path"; +import { resolveRepoToolBinPath } from "./lib/local-heavy-check-runtime.mjs"; import { createManagedCommandInvocation } from "./lib/managed-child-process.mjs"; const repoRoot = path.resolve(import.meta.dirname, ".."); -const tsgoPath = path.join(repoRoot, "node_modules", ".bin", "tsgo"); +const tsgoPath = resolveRepoToolBinPath("tsgo", { cwd: repoRoot }); const coreGraphs = [ { name: "core", config: "tsconfig.core.json" }, diff --git a/scripts/format-docs.mjs b/scripts/format-docs.mjs index 8c3badf38b13..77cdae671400 100644 --- a/scripts/format-docs.mjs +++ b/scripts/format-docs.mjs @@ -6,6 +6,7 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; import { pathToFileURL } from "node:url"; +import { resolveRepoToolBinPath } from "./lib/local-heavy-check-runtime.mjs"; import { repairMintlifyAccordionIndentation } from "./lib/mintlify-accordion.mjs"; import { buildCmdExeCommandLine, resolveWindowsCmdExePath } from "./windows-cmd-helpers.mjs"; @@ -124,7 +125,7 @@ export function resolveOxfmtInvocation(args, params = {}) { const platform = params.platform ?? process.platform; const existsSync = params.existsSync ?? fs.existsSync; const shimName = platform === "win32" ? "oxfmt.cmd" : "oxfmt"; - const shimPath = path.join(repoRoot, "node_modules", ".bin", shimName); + const shimPath = resolveRepoToolBinPath(shimName, { cwd: repoRoot, fileExists: existsSync }); if (existsSync(shimPath)) { if (platform === "win32") { diff --git a/scripts/profile-tsgo.mjs b/scripts/profile-tsgo.mjs index f27503caa7ce..1ccb5fbd1702 100644 --- a/scripts/profile-tsgo.mjs +++ b/scripts/profile-tsgo.mjs @@ -8,13 +8,14 @@ import path from "node:path"; import { acquireLocalHeavyCheckLockSync, applyLocalTsgoPolicy, + resolveRepoToolBinPath, shouldAcquireLocalHeavyCheckLockForTsgo, } from "./lib/local-heavy-check-runtime.mjs"; import { createManagedCommandInvocation } from "./lib/managed-child-process.mjs"; const repoRoot = path.resolve(import.meta.dirname, ".."); const artifactRoot = path.resolve(repoRoot, ".artifacts/tsgo-profile"); -const tsgoPath = path.resolve(repoRoot, "node_modules", ".bin", "tsgo"); +const tsgoPath = resolveRepoToolBinPath("tsgo", { cwd: repoRoot }); const GRAPH_DEFINITIONS = { core: { diff --git a/scripts/run-tsgo.mjs b/scripts/run-tsgo.mjs index b5fabf49f562..4423bcb87e64 100644 --- a/scripts/run-tsgo.mjs +++ b/scripts/run-tsgo.mjs @@ -7,6 +7,7 @@ import { acquireLocalHeavyCheckLockSync, applyLocalTsgoPolicy, resolveLocalHeavyCheckEnv, + resolveRepoToolBinPath, shouldAcquireLocalHeavyCheckLockForTsgo, } from "./lib/local-heavy-check-runtime.mjs"; import { createManagedCommandInvocation } from "./lib/managed-child-process.mjs"; @@ -20,7 +21,7 @@ const { args: finalArgs, env } = applyLocalTsgoPolicy( resolveLocalHeavyCheckEnv(process.env), ); -const tsgoPath = path.resolve("node_modules", ".bin", "tsgo"); +const tsgoPath = resolveRepoToolBinPath("tsgo"); const tsBuildInfoFile = readFlagValue(finalArgs, "--tsBuildInfoFile"); if (tsBuildInfoFile) { fs.mkdirSync(path.dirname(path.resolve(tsBuildInfoFile)), { recursive: true });