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", () => {
|
describe.skipIf(process.platform === "win32")("persisted config file permissions", () => {
|
||||||
test("initializes config.json with private permissions", () => {
|
test("initializes config.json with private permissions", () => {
|
||||||
const home = createTempHome();
|
const home = createTempHome();
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ function normalizeAgentProviders(value: unknown): unknown {
|
|||||||
|
|
||||||
export const PersistedConfigSchema = z
|
export const PersistedConfigSchema = z
|
||||||
.object({
|
.object({
|
||||||
|
$schema: z.string().optional(),
|
||||||
|
|
||||||
// v1 schema marker
|
// v1 schema marker
|
||||||
version: z.literal(1).optional(),
|
version: z.literal(1).optional(),
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
"PaseoConfigV1": {
|
"PaseoConfigV1": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"$schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"const": 1
|
"const": 1
|
||||||
|
|||||||
Reference in New Issue
Block a user