cli

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cli handles detection, invocation, and version extraction for LLM CLI tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeInvoker

type ClaudeInvoker struct {
	// contains filtered or unexported fields
}

ClaudeInvoker runs the Anthropic Claude CLI. Uses stdin pipe similar to Gemini.

func (*ClaudeInvoker) Review

func (c *ClaudeInvoker) Review(ctx context.Context, diff string) (string, error)

func (*ClaudeInvoker) RunPrompt

func (c *ClaudeInvoker) RunPrompt(ctx context.Context, prompt string) (string, error)

type CodexInvoker

type CodexInvoker struct {
	// contains filtered or unexported fields
}

CodexInvoker runs the OpenAI Codex CLI. Note: Actual CLI invocation pattern needs verification - current implementation may not work correctly. Disabled by default pending confirmation.

func (*CodexInvoker) Review

func (c *CodexInvoker) Review(ctx context.Context, diff string) (string, error)

func (*CodexInvoker) RunPrompt

func (c *CodexInvoker) RunPrompt(ctx context.Context, prompt string) (string, error)

type GeminiInvoker

type GeminiInvoker struct {
	// contains filtered or unexported fields
}

GeminiInvoker runs the Google Gemini CLI. Uses: git diff | gemini -p "Review these changes for bugs and security issues"

func (*GeminiInvoker) Review

func (g *GeminiInvoker) Review(ctx context.Context, diff string) (string, error)

func (*GeminiInvoker) RunPrompt

func (g *GeminiInvoker) RunPrompt(ctx context.Context, prompt string) (string, error)

type Invoker

type Invoker interface {
	Review(ctx context.Context, diff string) (string, error)
	// RunPrompt sends a raw prompt to the LLM without wrapping it in a code-review context
	RunPrompt(ctx context.Context, prompt string) (string, error)
}

Invoker runs an LLM CLI with a diff and returns the review output.

func NewInvoker

func NewInvoker(llm LLM) Invoker

NewInvoker creates an invoker for the given LLM. Returns nil if the LLM name is unknown.

type LLM

type LLM struct {
	Name       string // "claude", "gemini", "codex"
	Path       string // full path to the binary (e.g., "/usr/local/bin/claude")
	Version    string // version string (e.g., "2.1.0")
	Available  bool   // true if CLI is found in PATH
	TimeoutSec int    // timeout in seconds for this LLM (from config)
}

LLM represents a detected CLI tool with its metadata.

func Detect

func Detect(name string) LLM

Detect checks if a specific LLM CLI is installed and returns its metadata. If the CLI is not found, Available will be false.

func DetectAll

func DetectAll() []LLM

DetectAll checks for all supported LLM CLIs and returns their status. Returns a slice of LLM structs, one per supported CLI (even if not found). Runs detections concurrently to avoid sequential timeouts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL