claudecode

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claudecode implements ai.Drafter with the local Claude Code CLI in headless mode (`claude -p`). We compute all context ourselves and pipe it on stdin; tools are disabled so the model cannot touch the repository.

Index

Constants

View Source
const NestedSessionEnv = "CLAUDECODE"

NestedSessionEnv is set by Claude Code inside a session.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter runs claude.

func New

func New(r exec.Runner, cfg Config, log *slog.Logger) *Adapter

New returns an Adapter. Zero config fields take defaults (claude, haiku, 60s).

func (*Adapter) DraftCommit

func (a *Adapter) DraftCommit(ctx context.Context, in ai.CommitInput) (ai.Commit, error)

DraftCommit implements ai.Drafter.

func (*Adapter) DraftPR

func (a *Adapter) DraftPR(ctx context.Context, in ai.PRInput) (ai.PullRequest, error)

DraftPR implements ai.Drafter.

type Config

type Config struct {
	// Command is the Claude Code binary (git config stack.ai.command).
	Command string
	// Model is passed to --model (git config stack.ai.model).
	Model string
	// ExtraPrompt is appended to every instruction.
	ExtraPrompt string
	// Timeout bounds one call.
	Timeout time.Duration
}

Config selects the binary, model and limits.

Jump to

Keyboard shortcuts

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