Skip to content

fix(claude-code): prevent agentic mode and pass system prompt properly#31

Merged
artback merged 1 commit into
mainfrom
fix/claude-code-cli-provider
Mar 11, 2026
Merged

fix(claude-code): prevent agentic mode and pass system prompt properly#31
artback merged 1 commit into
mainfrom
fix/claude-code-cli-provider

Conversation

@artback
Copy link
Copy Markdown
Owner

@artback artback commented Mar 10, 2026

Summary

  • Add --allowedTools [] and --max-turns 1 to the claude -p invocation so Claude Code generates a single text response instead of entering agentic mode (reading files, running commands, etc.)
  • Pass the system prompt via --system-prompt flag instead of embedding it as plain text in the user prompt
  • Increase default timeout from 60s to 120s since Claude Code can be slower than direct API calls

Test plan

  • Run gitai suggest --provider claude-code with staged changes and verify a commit message is generated
  • Verify the command completes within a reasonable time (~10-30s)
  • Verify error is shown if claude CLI is not installed

🤖 Generated with Claude Code

The Claude Code CLI provider was non-functional because it invoked
`claude -p` without disabling tool use, causing Claude Code to enter
agentic mode instead of generating a simple text response. This adds
`--allowedTools []` and `--max-turns 1` to constrain it to a single
text-only response. Also passes the system prompt via `--system-prompt`
instead of embedding it in the user prompt, and increases the timeout
from 60s to 120s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

@artback artback merged commit f38b158 into main Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant