Skip to content

Commit 40f1b9d

Browse files
committed
fix: normalize legacy low/high status format values
1 parent 9b5c611 commit 40f1b9d

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

packages/config/local/ode-schema.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@ import { DEFAULT_STATUS_MESSAGE_FREQUENCY_MS } from "../status-message-frequency
44

55
const DEFAULT_UPDATE_INTERVAL_MS = 60 * 60 * 1000;
66

7+
const normalizeStatusFormat = (value: unknown) =>
8+
value === "low"
9+
? "minimum"
10+
: value === "high"
11+
? "aggressive"
12+
: value;
13+
714
const userSchema = z.object({
815
name: z.string().optional().default(""),
916
email: z.string().optional().default(""),
1017
initials: z.string().optional().default(""),
1118
avatar: z.string().optional().default(""),
1219
gitStrategy: z.enum(["default", "worktree"]).optional().default("worktree"),
13-
defaultStatusMessageFormat: z.enum([
14-
"minimum",
15-
"medium",
16-
"aggressive",
17-
"low",
18-
"high",
19-
]).optional().default("medium"),
20-
defaultMessageFrequency: z.enum([
21-
"minimum",
22-
"medium",
23-
"aggressive",
24-
"low",
25-
"high",
26-
]).optional(),
20+
defaultStatusMessageFormat: z.preprocess(
21+
normalizeStatusFormat,
22+
z.enum(["minimum", "medium", "aggressive"])
23+
).optional().default("medium"),
24+
defaultMessageFrequency: z.preprocess(
25+
normalizeStatusFormat,
26+
z.enum(["minimum", "medium", "aggressive"])
27+
).optional(),
2728
messageUpdateIntervalMs: z.number().optional(),
2829
IM_MESSAGE_UPDATE_INTERVAL_MS: z.number().optional().default(DEFAULT_STATUS_MESSAGE_FREQUENCY_MS),
2930
});

0 commit comments

Comments
 (0)