~kris/9p

llm9p

5165f547ed04e16fc070317eab44c82f773acace — pdfinn 7 months ago 054039e
refactor: Remove unnecessary --dangerously-skip-permissions flag

Testing confirmed that --dangerously-skip-permissions is NOT needed when:
1. --print mode is used (non-interactive)
2. Tools are disabled with --allowedTools ""

The CLI only prompts for permission when tools might take actions.
With tools disabled, it's purely text-in/text-out and no prompts occur.

Added explanatory comments documenting each CLI flag's purpose.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 files changed, 9 insertions(+), 4 deletions(-)

M internal/llm/cli_client.go
M internal/llm/cli_client.go => internal/llm/cli_client.go +9 -4
@@ 158,12 158,18 @@ func (c *CLIClient) Ask(ctx context.Context, prompt string) (string, error) {
	model := c.model
	c.mu.Unlock()

	// Build claude CLI command
	// Build claude CLI command.
	// --print: non-interactive mode, output to stdout
	// --output-format json: structured output we can parse
	// --allowedTools "": disable all tools (text-only, no Bash/Edit/etc.)
	//
	// Note: --dangerously-skip-permissions is NOT needed when tools are disabled
	// and --print mode is used. The CLI only prompts for permission when tools
	// might take actions. With tools disabled, it's purely text-in/text-out.
	args := []string{
		"--print",
		"--output-format", "json",
		"--model", model,
		"--dangerously-skip-permissions",
		"--allowedTools", "",
	}



@@ 268,12 274,11 @@ func (c *CLIClient) StartStream(ctx context.Context, prompt string) error {
			c.mu.Unlock()
		}()

		// Build command
		// Build command (same flags as Ask - see comments there)
		args := []string{
			"--print",
			"--output-format", "json",
			"--model", model,
			"--dangerously-skip-permissions",
			"--allowedTools", "",
		}