ef415e863b
- Replaced SettingsManager class with new Settings singleton providing synchronous get/set API and background persistence.
- Introduced settings-schema.ts as single source of truth for all configuration definitions with 100+ settings organized into logical groups.
- Migrated from method-based settings access (getTheme(), setTheme()) to path-based access using dot notation (settings.get('theme'), settings.set('theme', value)).
- Removed 2035-line settings-manager.ts file and replaced with modular settings.ts (693 lines) and settings-schema.ts (836 lines) for improved maintainability.
- Unified settings schema into single source of truth eliminating duplicate definitions across settings-defs.ts and settings-manager.ts.
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 = process.env.OMP_PYTHON_SKIP_CHECK;
|
|
process.env.OMP_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 process.env.OMP_PYTHON_SKIP_CHECK;
|
|
} else {
|
|
process.env.OMP_PYTHON_SKIP_CHECK = previous;
|
|
}
|
|
});
|
|
});
|