fix(tools): align optional argument presentation and guidance

This commit is contained in:
turtle1999 committed 2026-09-21 15:44:26 +08:00
1 parent ca50c2a224
commit 4e4badb8f3
82 files changed
+540 -426

No files matched your search

+4 -2
View File
@@ -262,11 +262,13 @@ export function apply(ctx: Context, config: Config = {}): void {
sandbox_permissions: {
type: 'string' as const,
enum: [...escalationModes],
description: 'The wider sandbox mode this command needs. Only valid as a one-shot retry of a command the sandbox just denied; requires justification and user approval.',
description: 'Requested sandbox mode. Repeating the effective mode needs no approval; narrower modes are rejected. '
+ 'A wider mode is only valid for a one-shot retry after this exact command was denied and requires a non-empty justification and user approval.',
},
justification: {
type: 'string' as const,
description: 'Required with sandbox_permissions: one sentence for the user explaining why this exact command needs the wider access.',
description: 'Non-empty, one-sentence reason for a different sandbox mode. May be omitted or blank when sandbox_permissions '
+ 'is omitted or repeats the effective mode; a non-empty reason requires sandbox_permissions.',
},
} : {},
},
-2
View File
@@ -95,8 +95,6 @@ function validatePwshArgs(args: PwshToolArgs): void {
if (args.timeoutMs !== undefined && (!Number.isFinite(args.timeoutMs) || args.timeoutMs <= 0)) {
throw new Error(`invalid timeoutMs: expected a positive number, got ${JSON.stringify(args.timeoutMs)}`)
}
// The escalation pairing (sandbox_permissions ⇔ justification, non-empty) is
// the shared rule both enforcing families validate identically.
validateEscalationArgs(args.sandbox_permissions, args.justification)
}
/* jscpd:ignore-end */