移除确保本地 bin 路径的功能
This commit is contained in:
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user