mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Allow $schema in config files
This commit is contained in:
@@ -561,6 +561,39 @@ describe("PersistedConfigSchema voice mode config", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("loadPersistedConfig", () => {
|
||||
test("accepts the documented config schema marker", () => {
|
||||
const home = createTempHome();
|
||||
const configPath = path.join(home, "config.json");
|
||||
try {
|
||||
writeFileSync(
|
||||
configPath,
|
||||
`${JSON.stringify(
|
||||
{
|
||||
$schema: "https://paseo.sh/schemas/paseo.config.v1.json",
|
||||
version: 1,
|
||||
daemon: {
|
||||
listen: "127.0.0.1:6767",
|
||||
hostnames: ["localhost", ".localhost"],
|
||||
mcp: { enabled: true },
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
)}\n`,
|
||||
);
|
||||
|
||||
const config = loadPersistedConfig(home);
|
||||
|
||||
expect(config.daemon?.listen).toBe("127.0.0.1:6767");
|
||||
expect(config.daemon?.hostnames).toEqual(["localhost", ".localhost"]);
|
||||
expect(config.daemon?.mcp?.enabled).toBe(true);
|
||||
} finally {
|
||||
rmSync(home, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe.skipIf(process.platform === "win32")("persisted config file permissions", () => {
|
||||
test("initializes config.json with private permissions", () => {
|
||||
const home = createTempHome();
|
||||
|
||||
@@ -203,6 +203,8 @@ function normalizeAgentProviders(value: unknown): unknown {
|
||||
|
||||
export const PersistedConfigSchema = z
|
||||
.object({
|
||||
$schema: z.string().optional(),
|
||||
|
||||
// v1 schema marker
|
||||
version: z.literal(1).optional(),
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
"PaseoConfigV1": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "number",
|
||||
"const": 1
|
||||
|
||||
Reference in New Issue
Block a user