移除确保本地 bin 路径的功能

This commit is contained in:
2026-04-30 18:09:04 +08:00
parent 9fa24b39f3
commit 65fb368f40
3 changed files with 0 additions and 21 deletions
-19
View File
@@ -99,8 +99,6 @@ export class OpencodeRuntimeAdapter {
}
private async bootstrapClient(): Promise<OpencodeClient> {
ensureLocalBinPath();
if (config.OPENCODE_BASE_URL) {
logger.info(
{ baseUrl: config.OPENCODE_BASE_URL },
@@ -147,23 +145,6 @@ export class OpencodeRuntimeAdapter {
export const opencodeRuntime = new OpencodeRuntimeAdapter();
function ensureLocalBinPath(): void {
const cwd = process.cwd();
const delimiter = process.platform === "win32" ? ";" : ":";
const candidates = [
`${cwd}/node_modules/.bin`,
`${cwd}/.opencode/node_modules/.bin`,
];
const currentPath = process.env.PATH ?? "";
const segments = currentPath.split(delimiter).filter(Boolean);
const next = [
...candidates.filter((candidate) => !segments.includes(candidate)),
...segments,
];
process.env.PATH = next.join(delimiter);
}
function requireData<T>(data: T | undefined, operation: string): T {
if (data === undefined) {
throw new Error(`${operation} returned no data`);