Documentation
¶
Index ¶
- Variables
- func Add(files ...string) error
- func BranchExists(branch string) (bool, error)
- func Commit(message string) error
- func CommitAmend(message string) error
- func Context() context.Context
- func CreateWorktree(issueNumberOrBranch, baseBranch string) (string, error)
- func CreateWorktreeFromBranch(worktreePath, sourceBranch, targetBranch string) error
- func DeleteBranch(branch string) error
- func DetermineWorktreeNames(input string) (branchName, dirSuffix string)
- func Edit(editPath string)
- func ExcludeFromDiff(path string) string
- func GeneratePrompt(locale string, maxLength int, commitType CommitType) string
- func GetAllGitTags(ctx context.Context) []*semver.Version
- func GetAllRemoteTags(ctx context.Context) []*semver.Version
- func GetCommitCount(branch string) (r result.Result[int])
- func GetCurMaxVer(ctx context.Context) *semver.Version
- func GetCurrentBranch() result.Result[string]
- func GetCurrentBranchV1() (string, error)
- func GetDetectedMessage(files []string) string
- func GetEditor() (r result.Result[string])
- func GetNextGitMaxTag(tags []*semver.Version) *semver.Version
- func GetNextReleaseTag(tags []*semver.Version) *semver.Version
- func GetNextTag(pre string, tags []*semver.Version) *semver.Version
- func GetRepositoryName() (string, error)
- func GetStagedDiff(ctx context.Context, excludeFiles ...string) (r result.Result[*GetStagedDiffRsp])
- func GitBranchSetUpstream(ctx context.Context, branch string) (r result.Error)
- func GitFetchAll(ctx context.Context)
- func GitPull(ctx context.Context, args ...string) (r result.Error)
- func GitPush(ctx context.Context, args ...string) string
- func GitPushTag(ctx context.Context, ver string) string
- func HasUncommittedChanges() (bool, error)
- func HasUnpushedCommits() (bool, error)
- func IsAheadOfRemote() (bool, error)
- func IsDirty() (r result.Result[bool])
- func IsErrExit1(err error) bool
- func IsErrSignalInterrupt(err error) bool
- func IsGitRepository() bool
- func IsHelp() bool
- func IsMergedToOrigin(targetBranch string) (bool, error)
- func IsOsExit(err error) bool
- func IsRemotePushCommitFailed(err string) bool
- func IsRemoteTagExist(err string) bool
- func IsStatusNeedPush(msg string) bool
- func LastCommitAuthor() (name, email string, err error)
- func ListAllBranches() ([]string, error)
- func Log() (string, error)
- func LogConfigAndBranch()
- func PreGitPush(ctx context.Context) string
- func PushTag(tag string) result.Error
- func RemoveWorktree(issueNumberOrBranch string) error
- func RemoveWorktreeByPath(worktreePath string) error
- func Run(executors ...func() error) result.Error
- func RunCommand(command string) error
- func SanitizeBranchNameForDirectory(branchName string) string
- func ShellExec(ctx context.Context, args ...string) (err error)
- func ShellExecOutput(ctx context.Context, args ...string) (r result.Result[string])
- func Spin[T any](name string, do func() result.Result[T]) (r result.Result[T])
- func Status() (string, error)
- func UsageDesc(format string, args ...interface{}) string
- type CommitType
- type FileChange
- type GetStagedDiffRsp
- type KnownError
- type OpenaiClient
- type OpenaiConfig
- type WorktreeInfo
Constants ¶
This section is empty.
Variables ¶
var GetBranchName = sync.OnceValue(func() string { return GetCurrentBranch().Unwrap() })
Functions ¶
func BranchExists ¶
func CommitAmend ¶
CommitAmend amends the last commit with a new message.
func CreateWorktree ¶
CreateWorktree creates a new git worktree
func CreateWorktreeFromBranch ¶
CreateWorktreeFromBranch creates a new git worktree from an existing branch
func DeleteBranch ¶
func DetermineWorktreeNames ¶
DetermineWorktreeNames determines the branch name and directory suffix based on input If input contains a slash, it's treated as a full branch name Otherwise, "/impl" is appended to create the branch name
func GeneratePrompt ¶
func GeneratePrompt(locale string, maxLength int, commitType CommitType) string
func GetCurrentBranch ¶
func GetCurrentBranchV1 ¶
func GetDetectedMessage ¶
GetDetectedMessage 生成检测到的文件数量的消息
func GetRepositoryName ¶
func GetStagedDiff ¶
func GetStagedDiff(ctx context.Context, excludeFiles ...string) (r result.Result[*GetStagedDiffRsp])
GetStagedDiff 获取暂存区的差异
func GitBranchSetUpstream ¶
func GitFetchAll ¶
func HasUncommittedChanges ¶
HasUncommittedChanges checks if there are uncommitted changes in the current worktree
func HasUnpushedCommits ¶
HasUnpushedCommits checks if there are unpushed commits in the current branch
func IsAheadOfRemote ¶
IsAheadOfRemote checks if the current branch is ahead of remote.
func IsErrExit1 ¶
func IsErrSignalInterrupt ¶
func IsGitRepository ¶
func IsGitRepository() bool
IsGitRepository checks if the current directory is inside a git repository
func IsMergedToOrigin ¶
IsMergedToOrigin checks if the current branch is merged to origin
func IsRemoteTagExist ¶
func IsStatusNeedPush ¶
func LastCommitAuthor ¶
LastCommitAuthor returns the author name and email of the last commit.
func ListAllBranches ¶
func Log ¶
Log returns recent commit messages (last 10). Returns empty string if no commits exist yet.
func LogConfigAndBranch ¶
func LogConfigAndBranch()
func PreGitPush ¶
func RemoveWorktree ¶
RemoveWorktree removes a git worktree by issue number or branch name
func RemoveWorktreeByPath ¶
RemoveWorktreeByPath removes a git worktree by its path
func RunCommand ¶
RunCommand executes a command in the current directory
func ShellExecOutput ¶
Types ¶
type CommitType ¶
type CommitType string
const ( EmptyCommitType CommitType = "" ConventionalCommitType CommitType = "conventional" )
type FileChange ¶
func DiffStat ¶
func DiffStat() ([]FileChange, error)
DiffStat returns statistics for all changed files (staged and unstaged).
type GetStagedDiffRsp ¶
type KnownError ¶
type KnownError struct {
Message string
}
KnownError 是一个自定义错误类型
func (*KnownError) Error ¶
func (e *KnownError) Error() string
type OpenaiClient ¶
type OpenaiClient struct {
Client *openai.Client
Cfg *OpenaiConfig
}
func NewOpenaiClient ¶
func NewOpenaiClient(cfg *OpenaiConfig) *OpenaiClient
type OpenaiConfig ¶
type WorktreeInfo ¶
WorktreeInfo represents information about a git worktree
func GetWorktreeForIssue ¶
func GetWorktreeForIssue(issueNumberOrBranch string) (*WorktreeInfo, error)
GetWorktreeForIssue finds a worktree for a specific issue number or branch name
func ListWorktrees ¶
func ListWorktrees() ([]WorktreeInfo, error)
ListWorktrees returns a list of all worktrees