From aa393099a3a2bf9ce21339e3472e1724b25083a1 Mon Sep 17 00:00:00 2001 From: roboomp Date: Tue, 23 Jun 2026 15:56:52 +0000 Subject: [PATCH 1/5] fix(coding-agent): handled `/` in __computeBunfsPackageRoot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bun 1.3.14 reports `import.meta.dir` as `/` for the compiled entry on some hosts — e.g. the Homebrew darwin-arm64 build sees `//root/omp-darwin-arm64` instead of the bunfs root alone. The pre-fix path joined `metaDir` with `"packages"` and baked the binary basename into every bunfs path, so the typebox / legacy-pi shim overrides failed `existsSync` validation, `resolveCanonicalPiSpecifier` fell through to a bunfs `Bun.resolveSync` that also could not find the module, and every third-party `@oh-my-pi/pi-*` extension was silently dropped. `__computeBunfsPackageRoot` now detects the trailing binary-basename segment (`path.basename(path.dirname(metaDir)) === "root"`) and strips it off the original `metaDir` via string slicing rather than `path.join`, so Bun's bunfs-native `//root` and `B:\~BUN\root` prefixes survive verbatim (`path.posix.join` would collapse `//root` to `/root`). The single-segment `` and deep `/packages/coding-agent/src/extensibility/plugins` paths keep their existing branches. Regression test added in `legacy-pi-bunfs-root.test.ts` for the POSIX `//root/`, POSIX `/$bunfs/root/`, and Win32 `:\~BUN\root\.exe` shapes. Fixes #3329 --- packages/coding-agent/CHANGELOG.md | 3 +++ .../extensibility/plugins/legacy-pi-compat.ts | 26 ++++++++++++++----- .../legacy-pi-bunfs-root.test.ts | 14 ++++++++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 1bff46648..46bd7c042 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +### Fixed + +- Fixed all extension loading silently failing on the Homebrew darwin-arm64 compiled binary because `__computeBunfsPackageRoot` mis-handled `import.meta.dir = "//root/omp-darwin-arm64"`. Bun 1.3.14 reports `/` for the compiled entry's `import.meta.dir`, but the pre-fix function joined `metaDir + "packages"` and produced `/root/omp-darwin-arm64/packages` — the binary basename was baked into every bunfs path, so the TypeBox/legacy-pi shims and every `@oh-my-pi/pi-*` package-root override failed `existsSync` validation and `resolveCanonicalPiSpecifier` fell through to a bunfs `Bun.resolveSync` that also could not find the module. The function now detects the bunfs-root + binary-basename shape (`path.basename(path.dirname(metaDir)) === "root"`) and strips the trailing binary segment by slicing the original `metaDir`, preserving Bun's bunfs-native `//root` / `B:\~BUN\root` prefix that `path.join` would otherwise collapse. ([#3329](https://github.com/can1357/oh-my-pi/issues/3329)) ## [16.1.16] - 2026-06-23 ### Breaking Changes diff --git a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts index dd024c390..30e099fe7 100644 --- a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts +++ b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts @@ -93,14 +93,22 @@ const TYPEBOX_SPECIFIER_FILTER = /^(?:@sinclair\/typebox|typebox)$/; // so they keep working when on-disk layout differs from the monorepo tree. /** * Compute the bunfs package root from the compiled binary's `import.meta.dir` - * (or any stand-in supplied by tests). Bun 1.3 reports the bunfs mount root - * (`/$bunfs/root` or `:\~BUN\root`) for imported modules as well as the - * entrypoint, so the normal path is `/packages`. + * (or any stand-in supplied by tests). Bun compiled binaries report one of: * - * The suffix branch preserves correctness if a future Bun release switches to - * module-specific `import.meta.dir` values inside compiled binaries, matching - * the source layout: - * `/packages/coding-agent/src/extensibility/plugins`. + * - the bunfs mount root itself — `/$bunfs/root` or `:\~BUN\root` (Bun + * 1.2.x and early 1.3.x). Append `packages` for the canonical layout. + * - the bunfs mount root followed by the binary's basename — `//root/` + * on POSIX or `:\~BUN\root\.exe` on Windows (observed on Bun + * 1.3.14, e.g. the Homebrew `omp-darwin-arm64` build — issue #3329). The + * trailing segment is stripped so the result still lands on `/packages`. + * - the module's own source directory if a future Bun release switches to + * module-specific `import.meta.dir` values: + * `/packages/coding-agent/src/extensibility/plugins`. + * + * The bunfs-root-with-binary branch slices the original `metaDir` (rather + * than re-joining the normalized parent) so the bunfs-native prefix is + * preserved verbatim — `path.posix.join` collapses `//root` to `/root` and + * Bun's bunfs lookup is keyed on the exact `//root` form. * * Exported for tests; production callers use `BUNFS_PACKAGE_ROOT` below. */ @@ -110,6 +118,10 @@ export function __computeBunfsPackageRoot(metaDir: string, pathImpl: typeof path if (normalizedMetaDir.endsWith(pluginsDirSuffix)) { return pathImpl.resolve(metaDir, "..", "..", "..", ".."); } + const parent = pathImpl.dirname(metaDir); + if (pathImpl.basename(pathImpl.normalize(parent)) === "root") { + return parent + pathImpl.sep + "packages"; + } return pathImpl.join(metaDir, "packages"); } diff --git a/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts b/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts index a2e7ebf26..603960da9 100644 --- a/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts +++ b/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts @@ -35,6 +35,20 @@ describe("legacy pi compat bunfs root computation (issue #1514)", () => { expect(__computeBunfsPackageRoot(posixMetaDir, path.posix)).toBe("/$bunfs/root/packages"); }); + it("strips the trailing binary-name segment when Bun reports `/` (issue #3329)", () => { + // Bun 1.3.14 on the Homebrew darwin-arm64 compiled binary reports + // `import.meta.dir` as `//root/omp-darwin-arm64`. The leading `//` + // is part of Bun's bunfs identifier — `path.posix.join("//root", ...)` + // would collapse it to `/root`, so the strip path must preserve the + // original prefix verbatim. + expect(__computeBunfsPackageRoot("//root/omp-darwin-arm64", path.posix)).toBe("//root/packages"); + // `$bunfs`-prefixed variant is also handled. + expect(__computeBunfsPackageRoot("/$bunfs/root/omp", path.posix)).toBe("/$bunfs/root/packages"); + // Windows variant: bunfs mount at `:\~BUN\root` with the binary + // basename appended. + expect(__computeBunfsPackageRoot("B:\\~BUN\\root\\omp.exe", path.win32)).toBe("B:\\~BUN\\root\\packages"); + }); + it("uses the current host path implementation for production calls", () => { const metaDir = path.join("/", "anywhere", "root"); expect(__computeBunfsPackageRoot(metaDir)).toBe(path.join("/", "anywhere", "root", "packages")); From 5766952c20f044e3c03c425dc3af0145123cf443 Mon Sep 17 00:00:00 2001 From: roboomp Date: Tue, 23 Jun 2026 15:57:01 +0000 Subject: [PATCH 2/5] style: bun run fix --- .../coding-agent/src/extensibility/plugins/legacy-pi-compat.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts index 30e099fe7..13f261e80 100644 --- a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts +++ b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts @@ -120,7 +120,7 @@ export function __computeBunfsPackageRoot(metaDir: string, pathImpl: typeof path } const parent = pathImpl.dirname(metaDir); if (pathImpl.basename(pathImpl.normalize(parent)) === "root") { - return parent + pathImpl.sep + "packages"; + return `${parent + pathImpl.sep}packages`; } return pathImpl.join(metaDir, "packages"); } From f278ea6a9ceaa6905ec41ab06bd9c1bc5f7a5302 Mon Sep 17 00:00:00 2001 From: roboomp Date: Tue, 23 Jun 2026 16:00:15 +0000 Subject: [PATCH 3/5] =?UTF-8?q?docs(coding-agent):=20corrected=20#3329=20w?= =?UTF-8?q?ording=20=E2=80=94=20release=20asset,=20not=20Homebrew?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reporter clarified that the failing binary is the pre-built `omp-darwin-arm64` release asset from GitHub Releases; Homebrew is only a local-tap wrapper that downloads that asset. The fix already covers every cross-compiled `/` shape, but the source/test docstrings and changelog blurb framed it as a Homebrew-build-specific bug. Updated those three call sites to name the release asset and note the Homebrew tap as a downstream consumer of the same binary; no code change. --- packages/coding-agent/CHANGELOG.md | 2 +- .../src/extensibility/plugins/legacy-pi-compat.ts | 5 +++-- .../test/extensibility/legacy-pi-bunfs-root.test.ts | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 46bd7c042..d6721348d 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixed -- Fixed all extension loading silently failing on the Homebrew darwin-arm64 compiled binary because `__computeBunfsPackageRoot` mis-handled `import.meta.dir = "//root/omp-darwin-arm64"`. Bun 1.3.14 reports `/` for the compiled entry's `import.meta.dir`, but the pre-fix function joined `metaDir + "packages"` and produced `/root/omp-darwin-arm64/packages` — the binary basename was baked into every bunfs path, so the TypeBox/legacy-pi shims and every `@oh-my-pi/pi-*` package-root override failed `existsSync` validation and `resolveCanonicalPiSpecifier` fell through to a bunfs `Bun.resolveSync` that also could not find the module. The function now detects the bunfs-root + binary-basename shape (`path.basename(path.dirname(metaDir)) === "root"`) and strips the trailing binary segment by slicing the original `metaDir`, preserving Bun's bunfs-native `//root` / `B:\~BUN\root` prefix that `path.join` would otherwise collapse. ([#3329](https://github.com/can1357/oh-my-pi/issues/3329)) +- Fixed all extension loading silently failing on the cross-compiled `omp-darwin-arm64` release binary (downloaded directly or via a Homebrew tap wrapper) because `__computeBunfsPackageRoot` mis-handled `import.meta.dir = "//root/omp-darwin-arm64"`. Bun 1.3.14 reports `/` for the compiled entry's `import.meta.dir`, but the pre-fix function joined `metaDir + "packages"` and produced `/root/omp-darwin-arm64/packages` — the binary basename was baked into every bunfs path, so the TypeBox/legacy-pi shims and every `@oh-my-pi/pi-*` package-root override failed `existsSync` validation and `resolveCanonicalPiSpecifier` fell through to a bunfs `Bun.resolveSync` that also could not find the module. The function now detects the bunfs-root + binary-basename shape (`path.basename(path.dirname(metaDir)) === "root"`) and strips the trailing binary segment by slicing the original `metaDir`, preserving Bun's bunfs-native `//root` / `B:\~BUN\root` prefix that `path.join` would otherwise collapse. ([#3329](https://github.com/can1357/oh-my-pi/issues/3329)) ## [16.1.16] - 2026-06-23 ### Breaking Changes diff --git a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts index 13f261e80..757f573d6 100644 --- a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts +++ b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts @@ -99,8 +99,9 @@ const TYPEBOX_SPECIFIER_FILTER = /^(?:@sinclair\/typebox|typebox)$/; * 1.2.x and early 1.3.x). Append `packages` for the canonical layout. * - the bunfs mount root followed by the binary's basename — `//root/` * on POSIX or `:\~BUN\root\.exe` on Windows (observed on Bun - * 1.3.14, e.g. the Homebrew `omp-darwin-arm64` build — issue #3329). The - * trailing segment is stripped so the result still lands on `/packages`. + * 1.3.14 with the cross-compiled `omp-darwin-arm64` release asset — issue + * #3329). The trailing segment is stripped so the result still lands on + * `/packages`. * - the module's own source directory if a future Bun release switches to * module-specific `import.meta.dir` values: * `/packages/coding-agent/src/extensibility/plugins`. diff --git a/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts b/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts index 603960da9..dd818b108 100644 --- a/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts +++ b/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts @@ -36,11 +36,11 @@ describe("legacy pi compat bunfs root computation (issue #1514)", () => { }); it("strips the trailing binary-name segment when Bun reports `/` (issue #3329)", () => { - // Bun 1.3.14 on the Homebrew darwin-arm64 compiled binary reports - // `import.meta.dir` as `//root/omp-darwin-arm64`. The leading `//` - // is part of Bun's bunfs identifier — `path.posix.join("//root", ...)` - // would collapse it to `/root`, so the strip path must preserve the - // original prefix verbatim. + // Bun 1.3.14 on the cross-compiled `omp-darwin-arm64` release asset + // reports `import.meta.dir` as `//root/omp-darwin-arm64`. The leading + // `//` is part of Bun's bunfs identifier — `path.posix.join("//root", + // ...)` would collapse it to `/root`, so the strip path must preserve + // the original prefix verbatim. expect(__computeBunfsPackageRoot("//root/omp-darwin-arm64", path.posix)).toBe("//root/packages"); // `$bunfs`-prefixed variant is also handled. expect(__computeBunfsPackageRoot("/$bunfs/root/omp", path.posix)).toBe("/$bunfs/root/packages"); From 03dae3814f09ec5896d6f3b5999b9acf712fee1a Mon Sep 17 00:00:00 2001 From: roboomp Date: Tue, 23 Jun 2026 16:04:43 +0000 Subject: [PATCH 4/5] fix(coding-agent): preserved bunfs double-slash in shim paths `__computeBunfsPackageRoot` now returns `//root/packages` for the Bun 1.3.14 `//root/` import.meta.dir shape, but production immediately joined that root with shim and package segments through `path.join`, which collapses the POSIX double-slash bunfs mount back to `/root`. That still made override validation miss the embedded shim files. Added a bunfs join helper that preserves the `//root` mount prefix after joining production descendants, wired `bunfsPath` through it, and extended the #3329 regression test to assert the full typebox shim path stays under `//root/packages/...`. Fixes #3329 --- packages/coding-agent/CHANGELOG.md | 2 +- .../extensibility/plugins/legacy-pi-compat.ts | 27 ++++++++++++++----- .../legacy-pi-bunfs-root.test.ts | 15 +++++++---- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index d6721348d..93f794f7f 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixed -- Fixed all extension loading silently failing on the cross-compiled `omp-darwin-arm64` release binary (downloaded directly or via a Homebrew tap wrapper) because `__computeBunfsPackageRoot` mis-handled `import.meta.dir = "//root/omp-darwin-arm64"`. Bun 1.3.14 reports `/` for the compiled entry's `import.meta.dir`, but the pre-fix function joined `metaDir + "packages"` and produced `/root/omp-darwin-arm64/packages` — the binary basename was baked into every bunfs path, so the TypeBox/legacy-pi shims and every `@oh-my-pi/pi-*` package-root override failed `existsSync` validation and `resolveCanonicalPiSpecifier` fell through to a bunfs `Bun.resolveSync` that also could not find the module. The function now detects the bunfs-root + binary-basename shape (`path.basename(path.dirname(metaDir)) === "root"`) and strips the trailing binary segment by slicing the original `metaDir`, preserving Bun's bunfs-native `//root` / `B:\~BUN\root` prefix that `path.join` would otherwise collapse. ([#3329](https://github.com/can1357/oh-my-pi/issues/3329)) +- Fixed all extension loading silently failing on the cross-compiled `omp-darwin-arm64` release binary (downloaded directly or via a Homebrew tap wrapper) because `__computeBunfsPackageRoot` mis-handled `import.meta.dir = "//root/omp-darwin-arm64"`. Bun 1.3.14 reports `/` for the compiled entry's `import.meta.dir`, but the pre-fix function joined `metaDir + "packages"` and produced `/root/omp-darwin-arm64/packages` — the binary basename was baked into every bunfs path, so the TypeBox/legacy-pi shims and every `@oh-my-pi/pi-*` package-root override failed `existsSync` validation and `resolveCanonicalPiSpecifier` fell through to a bunfs `Bun.resolveSync` that also could not find the module. The function now detects the bunfs-root + binary-basename shape (`path.basename(path.dirname(metaDir)) === "root"`) and strips the trailing binary segment by slicing the original `metaDir`; the production bunfs shim join path also preserves Bun's bunfs-native `//root` / `B:\~BUN\root` prefix that `path.join` would otherwise collapse. ([#3329](https://github.com/can1357/oh-my-pi/issues/3329)) ## [16.1.16] - 2026-06-23 ### Breaking Changes diff --git a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts index 757f573d6..029afbe97 100644 --- a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts +++ b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts @@ -105,11 +105,10 @@ const TYPEBOX_SPECIFIER_FILTER = /^(?:@sinclair\/typebox|typebox)$/; * - the module's own source directory if a future Bun release switches to * module-specific `import.meta.dir` values: * `/packages/coding-agent/src/extensibility/plugins`. - * - * The bunfs-root-with-binary branch slices the original `metaDir` (rather - * than re-joining the normalized parent) so the bunfs-native prefix is - * preserved verbatim — `path.posix.join` collapses `//root` to `/root` and - * Bun's bunfs lookup is keyed on the exact `//root` form. + * The bunfs-root-with-binary branch slices the original `metaDir`, and + * `bunfsPath` uses a matching double-slash-preserving join, so the bunfs-native + * prefix is preserved verbatim — `path.posix.join` collapses `//root` to + * `/root`, but Bun's bunfs lookup is keyed on the exact `//root` form. * * Exported for tests; production callers use `BUNFS_PACKAGE_ROOT` below. */ @@ -150,11 +149,27 @@ export function __computeBundledSelfPackageRoot(metaDir: string, pathImpl: typeo const BUNFS_PACKAGE_ROOT = IS_COMPILED_BINARY ? __computeBunfsPackageRoot(import.meta.dir) : null; +/** + * Join a computed bunfs package root with descendants without collapsing + * Bun's POSIX `//root` mount prefix. + * + * Exported for tests; production callers use `bunfsPath` below. + */ +export function __joinBunfsPath(root: string, segments: readonly string[], pathImpl: typeof path = path): string { + const joined = pathImpl.join(root, ...segments); + const doubleRootPrefix = pathImpl.sep + pathImpl.sep; + const tripleRootPrefix = doubleRootPrefix + pathImpl.sep; + if (root.startsWith(doubleRootPrefix) && !root.startsWith(tripleRootPrefix) && !joined.startsWith(doubleRootPrefix)) { + return pathImpl.sep + joined; + } + return joined; +} + function bunfsPath(...segments: string[]): string { if (!BUNFS_PACKAGE_ROOT) { throw new Error("bunfsPath is only valid in compiled-binary mode"); } - return path.join(BUNFS_PACKAGE_ROOT, ...segments); + return __joinBunfsPath(BUNFS_PACKAGE_ROOT, segments); } function resolveBundledSelfPackageRoot(): string | undefined { diff --git a/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts b/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts index dd818b108..b9a4af64d 100644 --- a/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts +++ b/packages/coding-agent/test/extensibility/legacy-pi-bunfs-root.test.ts @@ -3,6 +3,7 @@ import * as path from "node:path"; import { __computeBundledSelfPackageRoot, __computeBunfsPackageRoot, + __joinBunfsPath, } from "@oh-my-pi/pi-coding-agent/extensibility/plugins/legacy-pi-compat"; // Regression for issue #1514: legacy pi compat shim paths were built from a @@ -35,13 +36,17 @@ describe("legacy pi compat bunfs root computation (issue #1514)", () => { expect(__computeBunfsPackageRoot(posixMetaDir, path.posix)).toBe("/$bunfs/root/packages"); }); - it("strips the trailing binary-name segment when Bun reports `/` (issue #3329)", () => { + it("preserves the double-slash bunfs prefix through production shim path joins (issue #3329)", () => { // Bun 1.3.14 on the cross-compiled `omp-darwin-arm64` release asset // reports `import.meta.dir` as `//root/omp-darwin-arm64`. The leading - // `//` is part of Bun's bunfs identifier — `path.posix.join("//root", - // ...)` would collapse it to `/root`, so the strip path must preserve - // the original prefix verbatim. - expect(__computeBunfsPackageRoot("//root/omp-darwin-arm64", path.posix)).toBe("//root/packages"); + // `//` is part of Bun's bunfs identifier, so both the root computation + // and the production shim-path join must preserve it. + const root = __computeBunfsPackageRoot("//root/omp-darwin-arm64", path.posix); + expect(root).toBe("//root/packages"); + expect(__joinBunfsPath(root, ["coding-agent", "src", "extensibility", "typebox.js"], path.posix)).toBe( + "//root/packages/coding-agent/src/extensibility/typebox.js", + ); + // `$bunfs`-prefixed variant is also handled. expect(__computeBunfsPackageRoot("/$bunfs/root/omp", path.posix)).toBe("/$bunfs/root/packages"); // Windows variant: bunfs mount at `:\~BUN\root` with the binary From 57b4ee1eaf94357dbe8cf9d64561636decc4c1f4 Mon Sep 17 00:00:00 2001 From: roboomp Date: Tue, 23 Jun 2026 16:04:50 +0000 Subject: [PATCH 5/5] style: bun run fix --- .../src/extensibility/plugins/legacy-pi-compat.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts index 029afbe97..bc69f2b43 100644 --- a/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts +++ b/packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts @@ -159,7 +159,11 @@ export function __joinBunfsPath(root: string, segments: readonly string[], pathI const joined = pathImpl.join(root, ...segments); const doubleRootPrefix = pathImpl.sep + pathImpl.sep; const tripleRootPrefix = doubleRootPrefix + pathImpl.sep; - if (root.startsWith(doubleRootPrefix) && !root.startsWith(tripleRootPrefix) && !joined.startsWith(doubleRootPrefix)) { + if ( + root.startsWith(doubleRootPrefix) && + !root.startsWith(tripleRootPrefix) && + !joined.startsWith(doubleRootPrefix) + ) { return pathImpl.sep + joined; } return joined;