git

package
v0.8.10 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(url, dir string) error

Clone 克隆远程仓库到本地目录

func ConvertSSHToHTTPS

func ConvertSSHToHTTPS(sshURL string) string

ConvertSSHToHTTPS 将SSH URL转换为HTTPS URL

func GetCurrentCommit

func GetCurrentCommit(dir string) (string, error)

GetCurrentCommit 获取当前提交哈希

func Init

func Init(dir string) error

Init 初始化新的Git仓库

func IsGitRepo

func IsGitRepo(dir string) bool

IsGitRepo 检查目录是否为Git仓库

func Pull

func Pull(dir string) error

Pull 拉取远程仓库更新

func SuggestedCommitMessage added in v0.8.3

func SuggestedCommitMessage(changedFiles []string) string

func SuggestedCommitMessageFromStatus added in v0.8.3

func SuggestedCommitMessageFromStatus(status string) string

Types

type RemoteUpdateStatus added in v0.6.0

type RemoteUpdateStatus struct {
	Status       string `json:"status"`
	Message      string `json:"message,omitempty"`
	RemoteURL    string `json:"remote_url,omitempty"`
	LocalCommit  string `json:"local_commit,omitempty"`
	RemoteCommit string `json:"remote_commit,omitempty"`
	HasUpdates   bool   `json:"has_updates"`
	Ahead        int    `json:"ahead"`
	Behind       int    `json:"behind"`
}

type Repository

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

Repository 表示一个Git仓库

func NewRepository

func NewRepository(repoPath string) (*Repository, error)

NewRepository 创建或打开一个Git仓库

func NewSkillsRepository

func NewSkillsRepository() (*Repository, error)

NewSkillsRepository 创建技能仓库实例

func (*Repository) CheckRemoteUpdates added in v0.6.0

func (r *Repository) CheckRemoteUpdates() (*RemoteUpdateStatus, error)

func (*Repository) CheckoutBranch

func (r *Repository) CheckoutBranch(branchName string) error

CheckoutBranch 切换到指定分支

func (*Repository) Clone

func (r *Repository) Clone(url string) error

Clone 克隆远程仓库

func (*Repository) Commit

func (r *Repository) Commit(message string) error

Commit 提交更改

func (*Repository) CreateBranch

func (r *Repository) CreateBranch(branchName string) error

CreateBranch 创建新分支

func (*Repository) GetLatestCommit

func (r *Repository) GetLatestCommit() (string, error)

GetLatestCommit 获取最新提交信息

func (*Repository) GetPath

func (r *Repository) GetPath() string

GetPath 获取仓库路径

func (*Repository) GetRemote

func (r *Repository) GetRemote() ([]string, error)

func (*Repository) GetStatus

func (r *Repository) GetStatus() (string, error)

GetStatus 获取仓库状态

func (*Repository) IsInitialized

func (r *Repository) IsInitialized() bool

IsInitialized 检查仓库是否已初始化

func (*Repository) ListBranches

func (r *Repository) ListBranches() ([]string, error)

ListBranches 列出所有分支

func (*Repository) MergeBranch

func (r *Repository) MergeBranch(sourceBranch string) error

MergeBranch 合并分支

func (*Repository) Pull

func (r *Repository) Pull() error

Pull 拉取最新更改

func (*Repository) Push

func (r *Repository) Push() error

Push 推送本地更改

func (*Repository) SetRemote

func (r *Repository) SetRemote(url string) error

SetRemote 设置远程仓库URL

type SkillRepository

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

SkillRepository 管理技能Git仓库

func NewSkillRepository

func NewSkillRepository() (*SkillRepository, error)

NewSkillRepository 创建技能仓库管理器

func (*SkillRepository) CheckUpdates added in v0.6.0

func (sr *SkillRepository) CheckUpdates() (*RemoteUpdateStatus, error)

func (*SkillRepository) CloneRemote

func (sr *SkillRepository) CloneRemote(url string) error

CloneRemote 克隆远程技能仓库

func (*SkillRepository) CreateSkill

func (sr *SkillRepository) CreateSkill(skill *spec.Skill, promptContent string) error

CreateSkill 创建新技能并推送到远程

func (*SkillRepository) GetStatus

func (sr *SkillRepository) GetStatus() (string, error)

GetStatus 获取技能仓库状态

func (*SkillRepository) ImportSkill

func (sr *SkillRepository) ImportSkill(skillID string) error

ImportSkill 从远程仓库导入单个技能

func (*SkillRepository) ListLocalSkills added in v0.4.0

func (sr *SkillRepository) ListLocalSkills() ([]*spec.Skill, error)

ListLocalSkills 从本地仓库列出技能

func (*SkillRepository) ListSkillsFromRemote

func (sr *SkillRepository) ListSkillsFromRemote() ([]*spec.Skill, error)

ListSkillsFromRemote 从远程仓库列出技能

func (*SkillRepository) PushChanges

func (sr *SkillRepository) PushChanges(message string) error

PushChanges 推送本地更改到远程仓库

func (*SkillRepository) Sync

func (sr *SkillRepository) Sync() error

Sync 同步技能仓库(拉取最新更改)

func (*SkillRepository) SyncWithOptions added in v0.8.3

func (sr *SkillRepository) SyncWithOptions(opts SyncOptions) error

SyncWithOptions 同步技能仓库(拉取最新更改)

func (*SkillRepository) UpdateRegistry

func (sr *SkillRepository) UpdateRegistry() error

UpdateRegistry 更新技能注册表

type SyncOptions added in v0.8.3

type SyncOptions struct {
	Force bool
}

Jump to

Keyboard shortcuts

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