Documentation
¶
Index ¶
- func CloneOrUpdate(opts CloneOptions) error
- func CreateLink(target, linkPath string) error
- func EnsureGitignore(projectDir string) error
- func EnsureRemote(repoPath, remoteURL string) error
- func FormatAddResult(result *AddResult, duration time.Duration) string
- func FormatSummaryForCLI(langStats []SCCLanguageStat) string
- func FormatSummaryForWiki(langStats []SCCLanguageStat) string
- func FormatTopFilesForCLI(files []SCCFileStat, topN int) string
- func FormatTopFilesForWiki(langStats []SCCLanguageStat, files []SCCFileStat, topN int) string
- func GetRemoteURL(repoPath string) (string, error)
- func GetRepoMeta(repoPath string) (branch, commit string, commitTime *time.Time, err error)
- func NormalizeGitURL(input string) string
- func PlatformShortName(host string) string
- func PurgeCache(path string) error
- func ReadLink(linkPath string) (string, error)
- func RefreshReferenceMap(projectDir, refDir string, indexer *RepoIndexer) error
- func RemoveLink(linkPath string) error
- func ResolveProxy(appConfig *models.AppConfig) string
- func RunSCC(repoPath string) ([]SCCLanguageStat, []SCCFileStat, error)
- func SetupGitProxy(proxyURL string) (func(), error)
- func ValidateLocalRepo(path string) error
- type AddConfig
- type AddProcessor
- type AddResult
- type CheckItem
- type CloneOptions
- type DoctorConfig
- type DoctorProcessor
- type DoctorResult
- type GitURLInfo
- type InjectConfig
- type InjectProcessor
- type ListConfig
- type ListProcessor
- type ListRepoItem
- type ListResult
- type RemoveConfig
- type RemoveProcessor
- type RepoIndexer
- func (idx *RepoIndexer) Add(repo *models.Repo) error
- func (idx *RepoIndexer) Count() (int64, error)
- func (idx *RepoIndexer) DeleteByProjectDir(projectDir string) (int64, error)
- func (idx *RepoIndexer) Get(projectDir, linkName string) (*models.Repo, error)
- func (idx *RepoIndexer) GetByRefName(projectDir, refName string) (*models.Repo, error)
- func (idx *RepoIndexer) List(projectDir string) ([]models.Repo, error)
- func (idx *RepoIndexer) ListAll() (map[string][]models.Repo, error)
- func (idx *RepoIndexer) ListAllCachePaths() ([]string, error)
- func (idx *RepoIndexer) ListAllProjectDirs() ([]string, error)
- func (idx *RepoIndexer) ListAllWikiSubPaths() ([]string, error)
- func (idx *RepoIndexer) ListByType(projectDir string, refType models.RefType) ([]models.Repo, error)
- func (idx *RepoIndexer) Remove(projectDir, linkName string) error
- type SCCFileStat
- type SCCLanguageStat
- type UpdateConfig
- type UpdateProcessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneOrUpdate ¶
func CloneOrUpdate(opts CloneOptions) error
func CreateLink ¶
func EnsureGitignore ¶
func EnsureRemote ¶
func FormatSummaryForCLI ¶
func FormatSummaryForCLI(langStats []SCCLanguageStat) string
FormatSummaryForCLI 生成终端输出的汇总表格
func FormatSummaryForWiki ¶
func FormatSummaryForWiki(langStats []SCCLanguageStat) string
FormatSummaryForWiki 生成 reference.md 中的代码概览
func FormatTopFilesForCLI ¶
func FormatTopFilesForCLI(files []SCCFileStat, topN int) string
FormatTopFilesForCLI 生成终端输出的 top 文件表格
func FormatTopFilesForWiki ¶
func FormatTopFilesForWiki(langStats []SCCLanguageStat, files []SCCFileStat, topN int) string
FormatTopFilesForWiki 生成 scc.md,包含语言汇总和 top 文件排名
func GetRemoteURL ¶
func GetRepoMeta ¶
func NormalizeGitURL ¶
func PlatformShortName ¶
func PurgeCache ¶
func RefreshReferenceMap ¶ added in v0.0.2
func RefreshReferenceMap(projectDir, refDir string, indexer *RepoIndexer) error
func RemoveLink ¶
func ResolveProxy ¶
ResolveProxy 解析最终使用的代理地址 优先级:git_proxy > proxy > 环境变量 HTTPS_PROXY/HTTP_PROXY > 空字符串
func RunSCC ¶
func RunSCC(repoPath string) ([]SCCLanguageStat, []SCCFileStat, error)
RunSCC 对指定路径运行代码统计,返回按语言的汇总和文件级统计
func SetupGitProxy ¶
SetupGitProxy 根据代理 URL 创建并注册 go-git transport 返回 cleanup 函数,调用后恢复默认 transport
func ValidateLocalRepo ¶
Types ¶
type AddProcessor ¶
type AddProcessor struct {
// contains filtered or unexported fields
}
func NewAddProcessor ¶
type CloneOptions ¶
type DoctorConfig ¶
type DoctorConfig struct {
ProjectDir string
}
type DoctorProcessor ¶
type DoctorProcessor struct {
// contains filtered or unexported fields
}
func NewDoctorProcessor ¶
func NewDoctorProcessor(config *DoctorConfig, db *gorm.DB) *DoctorProcessor
func (*DoctorProcessor) Execute ¶
func (p *DoctorProcessor) Execute(ctx context.Context) (*DoctorResult, error)
type DoctorResult ¶
type GitURLInfo ¶
type GitURLInfo struct {
OriginalURL string
Host string
Namespace string
RepoName string
IsKnown bool
CachePath string // host/namespace/repo 或 other/sanitized
LinkName string // host-namespace-repo
WikiSubPath string // platform/namespace/repo(用于 wiki 嵌套目录)
}
func ParseGitURL ¶
func ParseGitURL(rawURL string, reposBase string) (*GitURLInfo, error)
type InjectConfig ¶
type InjectConfig struct {
ProjectDir string
}
type InjectProcessor ¶
type InjectProcessor struct {
// contains filtered or unexported fields
}
func NewInjectProcessor ¶
func NewInjectProcessor(config *InjectConfig, db *gorm.DB) *InjectProcessor
type ListConfig ¶
type ListConfig struct {
ProjectDir string
}
type ListProcessor ¶
type ListProcessor struct {
// contains filtered or unexported fields
}
func NewListProcessor ¶
func NewListProcessor(config *ListConfig, db *gorm.DB) *ListProcessor
func (*ListProcessor) Execute ¶
func (p *ListProcessor) Execute(ctx context.Context) (*ListResult, error)
type ListRepoItem ¶
type ListResult ¶
type ListResult struct {
Repos []ListRepoItem `json:"repos"`
}
type RemoveConfig ¶
type RemoveProcessor ¶
type RemoveProcessor struct {
// contains filtered or unexported fields
}
func NewRemoveProcessor ¶
func NewRemoveProcessor(config *RemoveConfig, appConfig *models.AppConfig, db *gorm.DB) *RemoveProcessor
type RepoIndexer ¶
type RepoIndexer struct {
// contains filtered or unexported fields
}
func NewRepoIndexer ¶
func NewRepoIndexer(db *gorm.DB) *RepoIndexer
func (*RepoIndexer) Count ¶ added in v0.0.2
func (idx *RepoIndexer) Count() (int64, error)
func (*RepoIndexer) DeleteByProjectDir ¶ added in v0.0.2
func (idx *RepoIndexer) DeleteByProjectDir(projectDir string) (int64, error)
func (*RepoIndexer) Get ¶
func (idx *RepoIndexer) Get(projectDir, linkName string) (*models.Repo, error)
func (*RepoIndexer) GetByRefName ¶
func (idx *RepoIndexer) GetByRefName(projectDir, refName string) (*models.Repo, error)
func (*RepoIndexer) ListAll ¶ added in v0.0.2
func (idx *RepoIndexer) ListAll() (map[string][]models.Repo, error)
func (*RepoIndexer) ListAllCachePaths ¶ added in v0.0.2
func (idx *RepoIndexer) ListAllCachePaths() ([]string, error)
func (*RepoIndexer) ListAllProjectDirs ¶ added in v0.0.2
func (idx *RepoIndexer) ListAllProjectDirs() ([]string, error)
func (*RepoIndexer) ListAllWikiSubPaths ¶ added in v0.0.2
func (idx *RepoIndexer) ListAllWikiSubPaths() ([]string, error)
func (*RepoIndexer) ListByType ¶
func (*RepoIndexer) Remove ¶
func (idx *RepoIndexer) Remove(projectDir, linkName string) error
type SCCFileStat ¶
type SCCLanguageStat ¶
type UpdateConfig ¶
type UpdateProcessor ¶
type UpdateProcessor struct {
// contains filtered or unexported fields
}
func NewUpdateProcessor ¶
func NewUpdateProcessor(config *UpdateConfig, appConfig *models.AppConfig, db *gorm.DB) *UpdateProcessor
Click to show internal directories.
Click to hide internal directories.