Skip to content

Commit 096651f

Browse files
committed
fix: Fix option descriptions after zod migration
1 parent 16fcd6b commit 096651f

File tree

2 files changed

+63
-60
lines changed

2 files changed

+63
-60
lines changed

src/commands/translate.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ export function createTranslateCommand(): Command {
5959
command
6060
.argument("<content>", "file path to content to translate")
6161
.description("Translates the given content")
62-
.option("--to <value>", `Target language (${Language.getLanguages()})`)
62+
.option(
63+
"--to <value>",
64+
`Target language (${Language.getLanguages().map((l) => l.code)})`,
65+
)
6366
.action(utils.withErrorHandling("Translate", executeAction));
6467

6568
utils.optionForConfigSchema(command, CONFIG_CHECK_TRANSLATION);

src/config/schema.ts

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ function withConfig<T extends z.ZodType>(
4747
export const CONFIG_CONTENT_DIR = withConfig(
4848
z
4949
.string()
50-
.describe("Directory relative to the cwd where content is hosted")
51-
.optional(),
50+
.optional()
51+
.describe("Directory relative to the cwd where content is hosted"),
5252
"contentDir",
5353
"TKMD_CONTENT_DIR",
5454
);
@@ -58,8 +58,8 @@ export const CONFIG_LANGUAGE = withConfig(
5858
.custom<string>((val) => Language.getLanguageMap().has(val as string), {
5959
message: "Unsupported default language",
6060
})
61-
.describe("Language to use as the source")
62-
.default("en"),
61+
.default("en")
62+
.describe("Language to use as the source"),
6363
"language",
6464
"TKMD_LANGUAGE",
6565
);
@@ -69,17 +69,17 @@ export const CONFIG_DEFAULT_LANGUAGE = withConfig(
6969
.custom<string>((val) => Language.getLanguageMap().has(val as string), {
7070
message: "Unsupported default language",
7171
})
72-
.describe("Language for files with no explicit language marker")
73-
.default("en"),
72+
.default("en")
73+
.describe("Language for files with no explicit language marker"),
7474
"defaultLanguage",
7575
"TKMD_DEFAULT_LANGUAGE",
7676
);
7777

7878
export const CONFIG_MODEL = withConfig(
7979
z
8080
.string()
81-
.describe("AWS Bedrock model ID")
82-
.default("global.anthropic.claude-sonnet-4-5-20250929-v1:0"),
81+
.default("global.anthropic.claude-sonnet-4-5-20250929-v1:0")
82+
.describe("AWS Bedrock model ID"),
8383
"model",
8484
"TKMD_AI_MODEL",
8585
);
@@ -90,17 +90,17 @@ export const CONFIG_MAX_TOKENS = withConfig(
9090
z.number().positive("Max tokens must be greater than 0"),
9191
z.string().transform((val) => parseInt(val, 10)),
9292
])
93-
.describe("Maximum tokens to be output by the model")
94-
.default(4096),
93+
.default(4096)
94+
.describe("Maximum tokens to be output by the model"),
9595
"maxTokens",
9696
"TKMD_AI_MAX_TOKENS",
9797
);
9898

9999
export const CONFIG_WRITE = withConfig(
100100
z
101101
.boolean()
102-
.describe("Write proposed changes to the source files")
103-
.default(false),
102+
.default(false)
103+
.describe("Write proposed changes to the source files"),
104104
"write",
105105
"TKMD_AI_WRITE",
106106
);
@@ -111,8 +111,8 @@ export const CONFIG_RATE_LIMIT_REQUESTS = withConfig(
111111
z.number().min(0, "Rate limit cannot be negative"),
112112
z.string().transform((val) => Math.max(0, Math.floor(Number(val)))),
113113
])
114-
.describe("Maximum requests per minute to send to the LLM")
115-
.default(0),
114+
.default(0)
115+
.describe("Maximum requests per minute to send to the LLM"),
116116
"requestRate",
117117
"TKMD_AI_REQUEST_RATE_LIMIT",
118118
);
@@ -123,29 +123,29 @@ export const CONFIG_RATE_LIMIT_TOKENS = withConfig(
123123
z.number().min(0, "Token rate limit cannot be negative"),
124124
z.string().transform((val) => Math.max(0, Math.floor(Number(val)))),
125125
])
126-
.describe("Maximum tokens per minute to send to the LLM")
127-
.default(0),
126+
.default(0)
127+
.describe("Maximum tokens per minute to send to the LLM"),
128128
"tokenRate",
129129
"TKMD_AI_TOKEN_RATE_LIMIT",
130130
);
131131

132132
export const CONFIG_REVIEW_SUMMARY_PATH = withConfig(
133-
z.string().describe("Write summary to this file").default(""),
133+
z.string().default("").describe("Write summary to this file"),
134134
"summaryPath",
135135
"TKMD_AI_REVIEW_SUMMARY_PATH",
136136
);
137137

138138
export const CONFIG_REVIEW_INSTRUCTIONS = withConfig(
139-
z.string().describe("Additional instructions for the model").optional(),
139+
z.string().optional().describe("Additional instructions for the model"),
140140
"instructions",
141141
"TKMD_REVIEW_INSTRUCTIONS",
142142
);
143143

144144
export const CONFIG_REVIEW_DIFF_FILE = withConfig(
145145
z
146146
.string()
147-
.describe("Path to unified diff file for filtering review suggestions")
148-
.optional(),
147+
.optional()
148+
.describe("Path to unified diff file for filtering review suggestions"),
149149
"diffFile",
150150
"TKMD_AI_REVIEW_DIFF_FILE",
151151
);
@@ -156,76 +156,76 @@ export const CONFIG_REVIEW_DIFF_CONTEXT = withConfig(
156156
z.number().nonnegative("Diff context must be non-negative"),
157157
z.string().transform((val) => parseInt(val, 10)),
158158
])
159+
.default(3)
159160
.describe(
160161
"Number of context lines around changed lines to include (symmetric)",
161-
)
162-
.default(3),
162+
),
163163
"diffContext",
164164
"TKMD_AI_REVIEW_DIFF_CONTEXT",
165165
);
166166

167167
export const CONFIG_REVIEW_CHECK = withConfig(
168168
z
169169
.boolean()
170+
.default(true)
170171
.describe(
171172
"Run content checks (lint, links, images) and include results in the review prompt",
172-
)
173-
.default(true),
173+
),
174174
"reviewCheck",
175175
"TKMD_AI_REVIEW_CHECK",
176176
);
177177

178178
export const CONFIG_FORCE_TRANSLATION = withConfig(
179179
z
180180
.boolean()
181-
.describe("Force translation even if the source file has not changed")
182-
.default(false),
181+
.default(false)
182+
.describe("Force translation even if the source file has not changed"),
183183
"force",
184184
"TKMD_AI_FORCE_TRANSLATION",
185185
);
186186

187187
export const CONFIG_CHECK_TRANSLATION = withConfig(
188188
z
189189
.boolean()
190-
.describe("Only check if any files require translation")
191-
.default(false),
190+
.default(false)
191+
.describe("Only check if any files require translation"),
192192
"check",
193193
"TKMD_AI_CHECK_TRANSLATION",
194194
);
195195

196196
export const CONFIG_TRANSLATION_DIR = withConfig(
197197
z
198198
.string()
199+
.optional()
199200
.describe(
200201
"Directory where translated content is stored, if not specified defaults to source directory",
201-
)
202-
.optional(),
202+
),
203203
"translationDir",
204204
"TKMD_AI_TRANSLATION_DIRECTORY",
205205
);
206206

207207
export const CONFIG_TRANSLATION_SKIP_SUFFIX = withConfig(
208208
z
209209
.boolean()
210+
.default(false)
210211
.describe(
211212
"Omit the language code suffix for translated files ('example.fr.md' becomes 'example.md')",
212-
)
213-
.default(false),
213+
),
214214
"skipFileSuffix",
215215
"TKMD_AI_TRANSLATION_SKIP_FILE_SUFFIX",
216216
);
217217

218218
export const CONFIG_CONTEXT_STRATEGY = withConfig(
219219
z
220220
.enum(["siblings", "nothing", "everything"])
221-
.describe("Strategy for including context")
222-
.default("nothing"),
221+
.default("nothing")
222+
.describe("Strategy for including context"),
223223
"contextStrategy",
224224
"TKMD_AI_CONTEXT_STRATEGY",
225225
);
226226

227227
export const CONFIG_EXEMPLARS = withConfig(
228-
z.array(z.string()).describe("Paths to example content").default([]),
228+
z.array(z.string()).default([]).describe("Paths to example content"),
229229
"exemplar",
230230
undefined,
231231
"TKMD_AI_EXEMPLAR",
@@ -234,8 +234,8 @@ export const CONFIG_EXEMPLARS = withConfig(
234234
export const CONFIG_STYLE_GUIDES = withConfig(
235235
z
236236
.array(z.string())
237-
.describe("Paths to documents containing style guides")
238-
.default([]),
237+
.default([])
238+
.describe("Paths to documents containing style guides"),
239239
"styleGuide",
240240
undefined,
241241
"TKMD_AI_STYLE_GUIDE",
@@ -244,8 +244,8 @@ export const CONFIG_STYLE_GUIDES = withConfig(
244244
export const CONFIG_INCLUDE_IMAGES = withConfig(
245245
z
246246
.boolean()
247-
.describe("Include images from markdown files in AI review")
248-
.default(false),
247+
.default(false)
248+
.describe("Include images from markdown files in AI review"),
249249
"includeImages",
250250
"TKMD_AI_INCLUDE_IMAGES",
251251
);
@@ -256,8 +256,8 @@ export const CONFIG_MAX_IMAGES = withConfig(
256256
z.number().positive("Max images must be greater than 0"),
257257
z.string().transform((val) => parseInt(val, 10)),
258258
])
259-
.describe("Maximum number of images to include per file")
260-
.default(5),
259+
.default(5)
260+
.describe("Maximum number of images to include per file"),
261261
"maxImages",
262262
"TKMD_AI_MAX_IMAGES",
263263
);
@@ -268,8 +268,8 @@ export const CONFIG_MAX_IMAGE_SIZE = withConfig(
268268
z.number().positive("Max image size must be greater than 0"),
269269
z.string().transform((val) => parseInt(val, 10)),
270270
])
271-
.describe("Maximum image file size in bytes")
272-
.default(3145728),
271+
.default(3145728)
272+
.describe("Maximum image file size in bytes"),
273273
"maxImageSize",
274274
"TKMD_AI_MAX_IMAGE_SIZE",
275275
);
@@ -282,25 +282,25 @@ export const CONFIG_CHECK_LINK_TIMEOUT = withConfig(
282282
z.number().positive("Link timeout must be greater than 0"),
283283
z.string().transform((val) => Number.parseInt(val, 10)),
284284
])
285-
.describe("Timeout in milliseconds for HTTP link checks")
286-
.default(5000),
285+
.default(5000)
286+
.describe("Timeout in milliseconds for HTTP link checks"),
287287
"linkTimeout",
288288
"TKMD_CHECK_LINK_TIMEOUT",
289289
);
290290

291291
export const CONFIG_CHECK_SKIP_EXTERNAL_LINKS = withConfig(
292292
z
293293
.boolean()
294-
.describe("Skip validation of external HTTP/HTTPS links")
295-
.default(false),
294+
.default(false)
295+
.describe("Skip validation of external HTTP/HTTPS links"),
296296
"skipExternalLinks",
297297
"TKMD_CHECK_SKIP_EXTERNAL_LINKS",
298298
);
299299
export const CONFIG_CHECK_LINK_IGNORE_PATTERNS = withConfig(
300300
z
301301
.array(z.string())
302-
.describe("Regex patterns for URLs to ignore during link checking")
303-
.default([]),
302+
.default([])
303+
.describe("Regex patterns for URLs to ignore during link checking"),
304304
"ignoreLinkPattern",
305305
undefined,
306306
"TKMD_CHECK_LINK_IGNORE_PATTERN",
@@ -309,10 +309,10 @@ export const CONFIG_CHECK_LINK_IGNORE_PATTERNS = withConfig(
309309
export const CONFIG_CHECK_LINT_IGNORE_RULES = withConfig(
310310
z
311311
.array(z.string())
312+
.default([])
312313
.describe(
313314
"remark-lint rule names to ignore (without the remark-lint- prefix)",
314-
)
315-
.default([]),
315+
),
316316
"ignoreRule",
317317
undefined,
318318
"TKMD_CHECK_LINT_IGNORE_RULE",
@@ -321,17 +321,17 @@ export const CONFIG_CHECK_LINT_IGNORE_RULES = withConfig(
321321
export const CONFIG_CHECK_MIN_SEVERITY = withConfig(
322322
z
323323
.enum(["error", "warning"])
324-
.describe("Minimum severity level to report")
325-
.default("warning"),
324+
.default("warning")
325+
.describe("Minimum severity level to report"),
326326
"minSeverity",
327327
"TKMD_CHECK_MIN_SEVERITY",
328328
);
329329

330330
export const CONFIG_CHECK_CATEGORIES = withConfig(
331331
z
332332
.array(z.enum(["lint", "link", "image"]))
333-
.describe("Check categories to run")
334-
.default(["lint", "link", "image"]),
333+
.default(["lint", "link", "image"])
334+
.describe("Check categories to run"),
335335
"category",
336336
undefined,
337337
"TKMD_CHECK_CATEGORY",
@@ -340,21 +340,21 @@ export const CONFIG_CHECK_CATEGORIES = withConfig(
340340
export const CONFIG_STATIC_PREFIX = withConfig(
341341
z
342342
.string()
343+
.optional()
343344
.describe(
344345
"URL prefix that indicates a link points to a file in the static directory",
345-
)
346-
.optional(),
346+
),
347347
"staticPrefix",
348348
"TKMD_STATIC_PREFIX",
349349
);
350350

351351
export const CONFIG_STATIC_DIR = withConfig(
352352
z
353353
.string()
354+
.optional()
354355
.describe(
355356
"Directory relative to the cwd where static assets are stored, used with staticPrefix",
356-
)
357-
.optional(),
357+
),
358358
"staticDir",
359359
"TKMD_STATIC_DIR",
360360
);

0 commit comments

Comments
 (0)