fix(cli): reject leaked config replacement flags

This commit is contained in:
Turtle
2026-07-29 21:15:48 +08:00
parent ea9315841f
commit 030b044350
2 files changed
+9 -3

No files matched your search

+3 -3
View File
@@ -226,9 +226,9 @@ Examples:
// the subcommand into `program.opts()`. `meta` accepts only `--resume`, so
// a leaked `--config`/`-p` is a mistyped invocation that must fail loud
// rather than silently be dropped.
const parent = program.opts<{ config?: string; prompt?: string; resume?: string }>()
if (parent.config !== undefined || parent.prompt !== undefined) {
program.error('error: meta takes neither --config nor -p/--prompt')
const parent = program.opts<{ config?: string; configReplace?: string; prompt?: string; resume?: string }>()
if (parent.config !== undefined || parent.configReplace !== undefined || parent.prompt !== undefined) {
program.error('error: meta takes none of --config, --config-replace, or -p/--prompt')
}
// Same reason as the default surface: an empty id would start a fresh
// session downstream instead of failing the mistyped resume.