docs(cli): document that --prompt runs in auto permission mode#2191
docs(cli): document that --prompt runs in auto permission mode#2191Nas01010101 wants to merge 2 commits into
Conversation
Non-interactive runs force auto permission mode on both engines (forcePromptPermission in run-prompt.ts for v1, forceAuto in run-v2-print.ts for v2), so every tool call is approved without prompting regardless of default_permission_mode. Neither the -p help text nor the permission docs said so, and -y/--auto read as the explicit opt-ins. Also add --auto to the documented --prompt mutual-exclusion list; the CLI already rejects that combination in options.ts but the docs listed only --yolo and --plan. Closes MoonshotAI#2099
🦋 Changeset detectedLatest commit: 5e9b84f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4da9b2a534
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| new Option( | ||
| '-p, --prompt <prompt>', | ||
| 'Run one prompt non-interactively and print the response.', | ||
| 'Run one prompt non-interactively and print the response. Runs in auto permission mode: tool calls are approved without prompting.', |
There was a problem hiding this comment.
Preserve deny-rule exceptions in the auto-mode wording
When config.toml contains a matching permission.rules deny rule, -p does not approve that tool call: both policy chains evaluate configured denies before auto approval (packages/agent-core/src/agent/permission/policies/index.ts:38-41 and packages/agent-core-v2/src/agent/permissionPolicy/permissionPolicyService.ts:48-50). The new help text—and the matching documentation—therefore incorrectly promises that tool calls are approved; qualify this as automatic approval only for calls not blocked by deny rules.
AGENTS.md reference: AGENTS.md:L9-L10
Useful? React with 👍 / 👎.
Both permission chains order UserConfiguredDeny ahead of AutoModeApprove (packages/agent-core/src/agent/permission/policies/index.ts, packages/agent-core-v2/src/agent/permissionPolicy/permissionPolicyService.ts), so a deny rule still blocks a tool call under -p. Saying approvals happen unconditionally overstated it.
Related Issue
Resolve #2099
Problem
See linked issue.
Non-interactive runs force auto permission mode, so every tool call is approved without prompting regardless of
default_permission_mode. This is deliberate — a non-interactive run has nobody to answer an approval prompt — but it was never written down, and-y/--yoloand--autoread as the explicit opt-ins, so-plooks like it should inherit the documentedmanualdefault.Both engines do it:
forcePromptPermissioninapps/kimi-code/src/cli/run-prompt.tsforceAutoinapps/kimi-code/src/cli/v2/run-v2-print.tsWhile writing this up I also found that the documented mutual-exclusion list is incomplete:
apps/kimi-code/src/cli/options.tsrejects--promptcombined with--yolo,--autoand--plan, but the docs list only--yoloand--plan.What changed
Documentation only — no behaviour change.
-p, --prompthelp text now states that it runs in auto permission mode and that tool calls are approved without prompting.docs/{en,zh}/configuration/overrides.md: the-p, --promptrow says the same, and--autois added to the mutual-exclusion list so it matches whatoptions.tsactually enforces.docs/{en,zh}/configuration/config-files.md: thedefault_permission_moderow notes that non-interactive runs always useautoregardless of the setting.The issue offered two possible resolutions — respect
default_permission_mode, or document the auto-approval. This PR takes the documentation route, since the current behaviour looks intentional and changing it would break unattended-pusers. Happy to follow up with the behavioural change instead if you'd prefer that direction.Testing
No behaviour change, so there is nothing new to test.
pnpm lintandpnpm typecheckare clean, and no test or snapshot asserts on the-phelp string.Checklist
gen-changesetsskill, or this PR needs no changeset. — patch changeset added for@moonshot-ai/kimi-code, since the CLI help text is user-visible.gen-docsskill, or this PR needs no doc update. — this PR is the doc update; bothenandzhare covered.