import { join } from "node:path"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; import { getGlobalConfigPath, getGlobalLogsDir, getHardGuardConfigPath, } from "#src/config-paths"; // Bundle-level `config/` is the single source of truth — two levels up from // both this test file and src/config-paths.ts. const BUNDLE_CONFIG_DIR = fileURLToPath(new URL("../../config", import.meta.url)); describe("config-paths", () => { const agentDir = "/home/user/.pi/agent"; it("reads the global policy from the bundle-level config directory", () => { expect(getGlobalConfigPath()).toBe( join(BUNDLE_CONFIG_DIR, "pi-permission-policy.jsonc"), ); }); it("reads hard guards from the bundle-level config directory", () => { expect(getHardGuardConfigPath()).toBe( join(BUNDLE_CONFIG_DIR, "pi-permission-hard-guards.jsonc"), ); }); it("keeps logs under the disposable agent-dir my-pi tree", () => { expect(getGlobalLogsDir(agentDir)).toBe( join(agentDir, "my-pi", "permission-system", "logs"), ); }); });