middleware

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package middleware provides AIGitClient, a transparent wrapper around git.GitClient that intercepts operations with AI enhancements while delegating all other methods to the inner client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIGitClient

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

AIGitClient wraps a git.GitClient to transparently intercept operations with AI enhancements. Unintercepted methods delegate directly to the inner client.

func NewAIGitClient

func NewAIGitClient(
	inner git.GitClient,
	registry *ai.Registry,
	builder *ai.Builder,
	audit *ai.AuditLogger,
	cfg config.AIConfig,
) *AIGitClient

NewAIGitClient creates an AI-enhanced git client wrapper.

func (*AIGitClient) AnalyzeBisect

func (c *AIGitClient) AnalyzeBisect(ctx context.Context, good, bad string) (*ops.BisectAnalysis, error)

AnalyzeBisect provides AI-enhanced bisect analysis.

func (*AIGitClient) AnalyzeBranches

func (c *AIGitClient) AnalyzeBranches(ctx context.Context) ([]ops.BranchRecommendation, error)

AnalyzeBranches recommends branch cleanup actions.

func (*AIGitClient) BisectBad

func (c *AIGitClient) BisectBad(ctx context.Context) (string, error)

func (*AIGitClient) BisectGood

func (c *AIGitClient) BisectGood(ctx context.Context) (string, error)

func (*AIGitClient) BisectReset

func (c *AIGitClient) BisectReset(ctx context.Context) error

func (*AIGitClient) BisectStart

func (c *AIGitClient) BisectStart(ctx context.Context, bad, good string) error

func (*AIGitClient) Blame

func (c *AIGitClient) Blame(ctx context.Context, path string) ([]git.BlameLine, error)

func (*AIGitClient) BranchCreate

func (c *AIGitClient) BranchCreate(ctx context.Context, name string, base string) error

func (*AIGitClient) BranchDelete

func (c *AIGitClient) BranchDelete(ctx context.Context, name string, force bool) error

func (*AIGitClient) BranchList

func (c *AIGitClient) BranchList(ctx context.Context) ([]git.Branch, error)

func (*AIGitClient) BranchRename

func (c *AIGitClient) BranchRename(ctx context.Context, oldName, newName string) error

func (*AIGitClient) Checkout

func (c *AIGitClient) Checkout(ctx context.Context, ref string) error

func (*AIGitClient) CherryPick

func (c *AIGitClient) CherryPick(ctx context.Context, commitHash string) error

func (*AIGitClient) Commit

func (c *AIGitClient) Commit(ctx context.Context, msg string, opts git.CommitOpts) (string, error)

Commit intercepts the commit operation. When cfg.AutoCommitMsg is true and msg is empty, it generates an AI commit message before delegating to the inner client. AI failures never block the git operation.

func (*AIGitClient) Diff

func (c *AIGitClient) Diff(ctx context.Context, opts git.DiffOpts) ([]git.FileDiff, error)

func (*AIGitClient) DiffFileNames added in v0.0.2

func (c *AIGitClient) DiffFileNames(ctx context.Context, commitA, commitB string) ([]string, error)

func (*AIGitClient) DiffTreeFiles

func (c *AIGitClient) DiffTreeFiles(ctx context.Context, hash string) ([]string, error)

func (*AIGitClient) DiscardAllUnstaged

func (c *AIGitClient) DiscardAllUnstaged(ctx context.Context) error

func (*AIGitClient) DiscardFile

func (c *AIGitClient) DiscardFile(ctx context.Context, path string) error

func (*AIGitClient) Fetch

func (c *AIGitClient) Fetch(ctx context.Context, opts git.FetchOpts) error

func (*AIGitClient) GenerateChangelog

func (c *AIGitClient) GenerateChangelog(ctx context.Context, fromRef, toRef string) ([]ops.ChangelogEntry, error)

GenerateChangelog creates an AI-powered changelog.

func (*AIGitClient) GenerateCommitMessage

func (c *AIGitClient) GenerateCommitMessage(ctx context.Context) (*ops.CommitSuggestion, error)

GenerateCommitMessage generates an AI commit message without committing.

func (*AIGitClient) GeneratePRDescription

func (c *AIGitClient) GeneratePRDescription(ctx context.Context, targetBranch string) (*ops.PRDescription, error)

GeneratePRDescription generates an AI PR description.

func (*AIGitClient) IsRepo

func (c *AIGitClient) IsRepo(ctx context.Context) (bool, error)

func (*AIGitClient) Log

func (c *AIGitClient) Log(ctx context.Context, opts git.LogOpts) ([]git.Commit, error)

func (*AIGitClient) Merge

func (c *AIGitClient) Merge(ctx context.Context, branch string, opts git.MergeOpts) error

Merge delegates to the inner client and, on conflict, triggers AI conflict resolution. AI failures never block the git operation — the original merge error is returned so the caller can handle it.

func (*AIGitClient) MergeAbort

func (c *AIGitClient) MergeAbort(ctx context.Context) error

func (*AIGitClient) Pull

func (c *AIGitClient) Pull(ctx context.Context, opts git.PullOpts) error

func (*AIGitClient) Push

func (c *AIGitClient) Push(ctx context.Context, opts git.PushOpts) error

func (*AIGitClient) Rebase

func (c *AIGitClient) Rebase(ctx context.Context, onto string, opts git.RebaseOpts) error

Rebase delegates to the inner client and, on conflict, triggers AI conflict resolution. AI failures never block the git operation.

func (*AIGitClient) RebaseAbort

func (c *AIGitClient) RebaseAbort(ctx context.Context) error

func (*AIGitClient) RebaseContinue

func (c *AIGitClient) RebaseContinue(ctx context.Context) error

func (*AIGitClient) Reflog

func (c *AIGitClient) Reflog(ctx context.Context, ref string, limit int) ([]git.ReflogEntry, error)

func (*AIGitClient) RemoteAdd

func (c *AIGitClient) RemoteAdd(ctx context.Context, name, url string) error

func (*AIGitClient) RemoteList

func (c *AIGitClient) RemoteList(ctx context.Context) ([]git.Remote, error)

func (*AIGitClient) RemoteRemove

func (c *AIGitClient) RemoteRemove(ctx context.Context, name string) error

func (*AIGitClient) RepoRoot

func (c *AIGitClient) RepoRoot(ctx context.Context) (string, error)

func (*AIGitClient) Reset

func (c *AIGitClient) Reset(ctx context.Context, ref string, mode git.ResetMode) error

func (*AIGitClient) Revert

func (c *AIGitClient) Revert(ctx context.Context, hash string) error

func (*AIGitClient) RevertAbort

func (c *AIGitClient) RevertAbort(ctx context.Context) error

func (*AIGitClient) RevertContinue

func (c *AIGitClient) RevertContinue(ctx context.Context) error

func (*AIGitClient) ReviewDiff

func (c *AIGitClient) ReviewDiff(ctx context.Context, opts git.DiffOpts) ([]ops.ReviewFinding, error)

ReviewDiff performs an AI code review on the given diff.

func (*AIGitClient) Stage

func (c *AIGitClient) Stage(ctx context.Context, paths []string) error

func (*AIGitClient) StageHunk

func (c *AIGitClient) StageHunk(ctx context.Context, path string, hunk git.Hunk) error

func (*AIGitClient) StageLine

func (c *AIGitClient) StageLine(ctx context.Context, path string, hunk git.Hunk, lineIdx int) error

func (*AIGitClient) StashApply

func (c *AIGitClient) StashApply(ctx context.Context, index int) error

func (*AIGitClient) StashDrop

func (c *AIGitClient) StashDrop(ctx context.Context, index int) error

func (*AIGitClient) StashList

func (c *AIGitClient) StashList(ctx context.Context) ([]git.StashEntry, error)

func (*AIGitClient) StashPop

func (c *AIGitClient) StashPop(ctx context.Context, index int) error

func (*AIGitClient) StashPush

func (c *AIGitClient) StashPush(ctx context.Context, opts git.StashOpts) error

func (*AIGitClient) StashShow

func (c *AIGitClient) StashShow(ctx context.Context, index int) (string, error)

func (*AIGitClient) Status

func (c *AIGitClient) Status(ctx context.Context) ([]git.FileStatus, error)

func (*AIGitClient) SuggestRebase

func (c *AIGitClient) SuggestRebase(ctx context.Context, onto string) (*ops.RebaseSuggestion, error)

SuggestRebase provides AI-powered rebase suggestions.

func (*AIGitClient) SuggestSplit

func (c *AIGitClient) SuggestSplit(ctx context.Context, commitHash string) (*ops.SplitPlan, error)

SuggestSplit suggests how to split a large commit.

func (*AIGitClient) TagCreate

func (c *AIGitClient) TagCreate(ctx context.Context, name, ref, message string) error

func (*AIGitClient) TagDelete

func (c *AIGitClient) TagDelete(ctx context.Context, name string) error

func (*AIGitClient) TagList

func (c *AIGitClient) TagList(ctx context.Context) ([]git.Tag, error)

func (*AIGitClient) TagListRemote

func (c *AIGitClient) TagListRemote(ctx context.Context, remote string) ([]git.Tag, error)

func (*AIGitClient) TagPush

func (c *AIGitClient) TagPush(ctx context.Context, remote, name string) error

func (*AIGitClient) TagPushAll

func (c *AIGitClient) TagPushAll(ctx context.Context, remote string) error

func (*AIGitClient) Unstage

func (c *AIGitClient) Unstage(ctx context.Context, paths []string) error

func (*AIGitClient) UnstageHunk

func (c *AIGitClient) UnstageHunk(ctx context.Context, path string, hunk git.Hunk) error

func (*AIGitClient) UnstageLine

func (c *AIGitClient) UnstageLine(ctx context.Context, path string, hunk git.Hunk, lineIdx int) error

func (*AIGitClient) WorktreeAdd

func (c *AIGitClient) WorktreeAdd(ctx context.Context, path, branch string) error

func (*AIGitClient) WorktreeList

func (c *AIGitClient) WorktreeList(ctx context.Context) ([]git.Worktree, error)

func (*AIGitClient) WorktreeRemove

func (c *AIGitClient) WorktreeRemove(ctx context.Context, path string, force bool) error

Jump to

Keyboard shortcuts

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