Skip to content

feat: add claude-code agent for ask and talk commands#18

Open
rafeegnash wants to merge 1 commit intomasterfrom
feature/claude-code-agent
Open

feat: add claude-code agent for ask and talk commands#18
rafeegnash wants to merge 1 commit intomasterfrom
feature/claude-code-agent

Conversation

@rafeegnash
Copy link
Copy Markdown

Summary

  • Adds a new claude-code agent backend that uses the locally installed Claude Code CLI binary
  • Supports both single-shot ask mode and interactive talk mode
  • Streaming responses via --output-format stream-json
  • Binary availability check with install instructions on error
  • AWS infrastructure context injection for infrastructure-aware queries
  • Unit tests for protocol parsing and binary detection

Usage

clanker ask "describe my infrastructure" --agent claude-code
clanker talk --agent claude-code

Architecture

New internal/claudecode/ package following the same pattern as internal/hermes/:

  • protocol.go - Event types matching Claude Code stream-json format
  • runner.go - Process lifecycle, streaming, interactive sessions
  • runner_test.go - Unit tests

Test plan

  • go vet ./... passes
  • gofmt clean
  • Unit tests pass (go test ./internal/claudecode/ -v)
  • Manual test: clanker ask "say hello" --agent claude-code returns response
  • Manual test: invalid agent name shows clear error with available options
  • Hermes agent unchanged and still works
  • Build succeeds

Add a new agent backend that uses the locally installed Claude Code CLI
(claude binary) to handle queries. This works alongside the existing
hermes agent:

- internal/claudecode/ package with Runner, protocol types, and event parsing
- Streaming support via claude --output-format stream-json
- Interactive talk mode via stdin/stdout stream-json pipes
- Binary availability check with clear install instructions
- AWS infrastructure context injection (same pattern as hermes)
- Unit tests covering event parsing, JSON deserialization, and availability

Usage:
  clanker ask "your question" --agent claude-code
  clanker talk --agent claude-code
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