TypeScript
refactor(shared): remove retired PATH capture parser (#9991)
Julius Marmingeda1bebbb1170
diff --git a/packages/shared/src/shell.test.ts b/packages/shared/src/shell.test.tsindex c98c1c452d4..621fe49b308 100644--- a/packages/shared/src/shell.test.ts+++ b/packages/shared/src/shell.test.ts@@ -8,7 +8,6 @@ import * as TestClock from "effect/testing/TestClock";import { describe, expect, it, vi } from "vite-plus/test";import {- extractPathFromShellOutput,CommandAvailability,CommandResolutionCache,type CommandAvailabilityChecker,@@ -39,28 +38,6 @@ const withWindowsEnvironmentMocks = <A, E, R>(Effect.provideService(CommandAvailability, commandAvailable),);-describe("extractPathFromShellOutput", () => {- it("extracts the path between capture markers", () => {- expect(- extractPathFromShellOutput(- "__T3CODE_PATH_START__\n/opt/homebrew/bin:/usr/bin\n__T3CODE_PATH_END__\n",- ),- ).toBe("/opt/homebrew/bin:/usr/bin");- });-- it("ignores shell startup noise around the capture markers", () => {- expect(- extractPathFromShellOutput(- "Welcome to fish\n__T3CODE_PATH_START__\n/opt/homebrew/bin:/usr/bin\n__T3CODE_PATH_END__\nBye\n",- ),- ).toBe("/opt/homebrew/bin:/usr/bin");- });-- it("returns null when the markers are missing", () => {- expect(extractPathFromShellOutput("/opt/homebrew/bin /usr/bin")).toBeNull();- });-});-describe("readPathFromLoginShell", () => {it("uses a shell-agnostic printenv PATH probe", () => {const execFile = vi.fn<diff --git a/packages/shared/src/shell.ts b/packages/shared/src/shell.tsindex 7d7a7d7b4f4..07ac73f8c6a 100644--- a/packages/shared/src/shell.ts+++ b/packages/shared/src/shell.ts@@ -12,8 +12,6 @@ import * as Path from "effect/Path";import { HostProcessEnvironment, HostProcessPlatform } from "./hostProcess.ts";import * as Context from "effect/Context";-const PATH_CAPTURE_START = "__T3CODE_PATH_START__";-const PATH_CAPTURE_END = "__T3CODE_PATH_END__";const SHELL_ENV_NAME_PATTERN = /^[A-Z0-9_]+$/;const WINDOWS_PATH_DELIMITER = ";";const POSIX_PATH_DELIMITER = ":";@@ -179,18 +177,6 @@ export function listLoginShellCandidates(return candidates;}-export function extractPathFromShellOutput(output: string): string | null {- const startIndex = output.indexOf(PATH_CAPTURE_START);- if (startIndex === -1) return null;-- const valueStartIndex = startIndex + PATH_CAPTURE_START.length;- const endIndex = output.indexOf(PATH_CAPTURE_END, valueStartIndex);- if (endIndex === -1) return null;-- const pathValue = output.slice(valueStartIndex, endIndex).trim();- return pathValue.length > 0 ? pathValue : null;-}-export function readPathFromLoginShell(shell: string,execFile: ExecFileSyncLike = NodeChildProcess.execFileSync,