git

package
v0.2.49 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: GPL-2.0, GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package git provides HTTP handlers and utilities for git operations and AI-assisted workflows.

Index

Constants

This section is empty.

Variables

View Source
var ErrPathNotInRef = errors.New("path not found at ref")

ErrPathNotInRef indicates the requested path does not exist at the given ref (new file, deleted file, or invalid object name). Callers should surface this as empty content rather than a hard error.

Functions

This section is empty.

Types

type AIHandler

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

AIHandler registers the AI-backed git endpoints (commit-message, pr-description). Separated from Handler because these have a fundamentally different dependency profile: they need an AI bridge but no git subprocess execution beyond basic diff/log.

func NewAIHandler

func NewAIHandler(workDir string, prompter api.UtilityPrompter) *AIHandler

NewAIHandler returns an AIHandler. The prompter must be non-nil.

func (*AIHandler) RegisterRoutes

func (a *AIHandler) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers the AI-backed git endpoints.

type ErrorKind

type ErrorKind string

ErrorKind is a machine-readable discriminator for git handler errors. Clients switch on the "error" field; the "detail" field carries variable context (e.g. branch name).

const (
	KindNoStaged         ErrorKind = "no_staged_changes"
	KindNoChanges        ErrorKind = "no_changes"
	KindGenerationFailed ErrorKind = "generation_failed"
	KindShowFailed       ErrorKind = "show_failed"
)

KindNoStaged and the following constants define the ErrorKind values for git handler errors.

type Handler

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

Handler implements git HTTP endpoints (non-AI operations).

func NewHandler

func NewHandler(workDir string, opts ...Option) *Handler

NewHandler returns a Handler scoped to workDir.

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes installs the /api/git/* mux entries.

type Option

type Option func(*Handler)

Option configures a Handler at construction time.

Jump to

Keyboard shortcuts

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