移除确保本地 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
-1
View File
@@ -22,7 +22,6 @@ WORKDIR /app
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=8787
ENV PATH=/app/node_modules/.bin:/app/.opencode/node_modules/.bin:$PATH
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/.opencode/node_modules ./.opencode/node_modules
-1
View File
@@ -19,7 +19,6 @@
"cors": "^2.8.5",
"dotenv": "^17.2.3",
"express": "^4.21.2",
"opencode-ai": "^1.14.30",
"pino": "^9.7.0",
"pino-pretty": "^13.1.2",
"zod": "^3.25.76"
-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`);