feat(coding-agent): refactored settings system with new singleton API and unified schema
- 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.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test";
|
||||
import { SettingsManager } from "@oh-my-pi/pi-coding-agent";
|
||||
import { _resetSettingsForTest, Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
|
||||
import { PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel";
|
||||
import { PYTHON_PRELUDE } from "@oh-my-pi/pi-coding-agent/ipy/prelude";
|
||||
import * as shellSnapshot from "@oh-my-pi/pi-coding-agent/utils/shell-snapshot";
|
||||
@@ -37,6 +37,7 @@ describe("PythonKernel.start (local gateway)", () => {
|
||||
const originalWebSocket = globalThis.WebSocket;
|
||||
|
||||
beforeEach(() => {
|
||||
_resetSettingsForTest();
|
||||
process.env.BUN_ENV = "test";
|
||||
delete process.env.OMP_PYTHON_GATEWAY_URL;
|
||||
delete process.env.OMP_PYTHON_GATEWAY_TOKEN;
|
||||
@@ -70,7 +71,7 @@ describe("PythonKernel.start (local gateway)", () => {
|
||||
});
|
||||
globalThis.fetch = fetchSpy as unknown as typeof fetch;
|
||||
|
||||
const shellSpy = vi.spyOn(SettingsManager, "getGlobalShellConfig").mockResolvedValue({
|
||||
vi.spyOn(Settings.prototype, "getShellConfig").mockReturnValue({
|
||||
shell: "/bin/bash",
|
||||
args: ["-lc"],
|
||||
env: {
|
||||
@@ -131,7 +132,7 @@ describe("PythonKernel.start (local gateway)", () => {
|
||||
|
||||
await kernel.shutdown();
|
||||
|
||||
shellSpy.mockRestore();
|
||||
vi.restoreAllMocks();
|
||||
snapshotSpy.mockRestore();
|
||||
whichSpy.mockRestore();
|
||||
spawnSpy.mockRestore();
|
||||
|
||||
Reference in New Issue
Block a user