移除确保本地 bin 路径的功能
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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