Files
oh-my-pi/packages/coding-agent/src/task/omp-command.ts
T
can1357 8ff2ef0ce0 refactor: migrated environment variable access from getEnv() to $env object API
- Migrated environment variable access from function-based `getEnv()` API to object property-based `$env` API across 43 files in the monorepo.
- Simplified `packages/utils/src/env.ts` by removing scoped environment variable logic (EnvScope, getEnvMap, getEnv functions) and replacing with direct `process.env` reference exported as `$env`.
- Updated `packages/ai/src/stream.ts` to remove environment parameter from KeyResolver functions and use global `$env` object instead of passed-in env parameter.
2026-02-05 03:07:40 +01:00

27 lines
684 B
TypeScript

import process from "node:process";
import { $env } from "@oh-my-pi/pi-utils";
interface OmpCommand {
cmd: string;
args: string[];
shell: boolean;
}
const DEFAULT_CMD = process.platform === "win32" ? "omp.cmd" : "omp";
const DEFAULT_SHELL = process.platform === "win32";
export function resolveOmpCommand(): OmpCommand {
const envCmd = $env.PI_SUBPROCESS_CMD;
if (envCmd?.trim()) {
return { cmd: envCmd, args: [], shell: DEFAULT_SHELL };
}
const entry = process.argv[1];
if (entry && (entry.endsWith(".ts") || entry.endsWith(".js"))) {
return { cmd: process.execPath, args: [entry], shell: false };
}
return { cmd: DEFAULT_CMD, args: [], shell: DEFAULT_SHELL };
}