Files
oh-my-pi/packages/coding-agent/scripts/omp.ts
T
can1357 abba626704 refactor(coding-agent/scripts): renamed dev-launch scripts and preload shim to omp paths
- Renamed `packages/coding-agent/scripts/dev-launch` to `packages/coding-agent/scripts/omp` and updated the preload script reference in that launcher.
- Renamed `packages/coding-agent/scripts/dev-launch-preload.ts` to `packages/coding-agent/scripts/omp.ts` and adjusted its header comment.
- Updated the `install:dev` script in `package.json` to symlink the global `omp` command from the renamed launcher path.
2026-06-10 06:28:22 +02:00

20 lines
849 B
TypeScript

/**
* Bun `--preload` shim for the omp dev launcher (`scripts/omp`).
*
* The launcher starts Bun from an empty, bunfig-free directory so a foreign
* project's `bunfig.toml` `preload` cannot run inside the omp CLI: Bun reads
* `bunfig.toml` from the *current working directory* on startup and evaluates
* its `preload` entries before the entrypoint, so a bun-shebang bin inherits
* whatever `preload` the directory you launched from declares (and crashes if
* that preload can't resolve). This shim is loaded before the entrypoint's
* imports run, so it restores the user's real working directory in time for
* import-time snapshots (e.g. `getProjectDir()` in `@oh-my-pi/pi-utils/dirs`).
*/
const launchCwd = process.env.OMP_LAUNCH_CWD;
if (launchCwd) {
delete process.env.OMP_LAUNCH_CWD;
try {
process.chdir(launchCwd);
} catch {}
}