89e6479661
- Migrated all environment variable access from Node.js `process.env` to Bun runtime `Bun.env` API across the entire codebase. - Updated 71 files including source code, tests, documentation, and configuration to use Bun's native environment variable API. - Added comprehensive environment variables documentation in `packages/coding-agent/docs/environment-variables.md` covering 100+ environment variables organized by category. - Updated CHANGELOG entries to reflect migration from `process.env` to `Bun.env` and environment variable prefix changes (PI_* vs OMP_*). - Maintained identical behavior and logic across all changes - only the environment variable access method was updated.
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
|
|
import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools";
|
|
|
|
function createSession(overrides: Partial<ToolSession> = {}): ToolSession {
|
|
return {
|
|
cwd: "/tmp/test",
|
|
hasUI: false,
|
|
getSessionFile: () => null,
|
|
getSessionSpawns: () => "*",
|
|
settings: Settings.isolated({
|
|
"lsp.formatOnWrite": true,
|
|
"bashInterceptor.enabled": true,
|
|
"python.toolMode": "bash-only",
|
|
}),
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
describe("createTools python fallback", () => {
|
|
it("falls back to bash when python is requested but disabled", async () => {
|
|
const previous = Bun.env.PI_PYTHON_SKIP_CHECK;
|
|
Bun.env.PI_PYTHON_SKIP_CHECK = "1";
|
|
const session = createSession();
|
|
const tools = await createTools(session, ["python"]);
|
|
const names = tools.map(tool => tool.name).sort();
|
|
|
|
expect(names).toEqual(["bash", "exit_plan_mode"]);
|
|
|
|
if (previous === undefined) {
|
|
delete Bun.env.PI_PYTHON_SKIP_CHECK;
|
|
} else {
|
|
Bun.env.PI_PYTHON_SKIP_CHECK = previous;
|
|
}
|
|
});
|
|
});
|