Documentation
¶
Index ¶
- Variables
- 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 GetAgentDisplayName(id string) string
- func GetRemoteURL(repoPath string) (string, error)
- func GetRepoMeta(repoPath string) (branch, commit string, commitTime *time.Time, err error)
- func IsAgentRegistered(id string) bool
- func ListAgentIDs() []string
- 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 ValidateAgentIDs(ids []string) []string
- func ValidateLocalRepo(path string) error
- type AddConfig
- type AddProcessor
- type AddResult
- type AgentConfig
- type AgentFile
- 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 ¶
View Source
var AgentRegistry = map[string]AgentConfig{ "claude": { ID: "claude", DisplayName: "Claude Code", BaseDir: ".claude", Files: []AgentFile{ {EmbedPath: "prompts/agents/reference-explorer.md", DestPath: filepath.Join("agents", "reference-explorer.md")}, {EmbedPath: "prompts/agents/reference-analyzer.md", DestPath: filepath.Join("agents", "reference-analyzer.md")}, {EmbedPath: "prompts/skills/reference/SKILL.md", DestPath: filepath.Join("skills", "reference", "SKILL.md")}, }, }, "zcode": { ID: "zcode", DisplayName: "ZCode", BaseDir: ".zcode", Files: []AgentFile{ {EmbedPath: "prompts/agents/reference-explorer.md", DestPath: filepath.Join("cli", "agents", "reference-explorer.md")}, {EmbedPath: "prompts/agents/reference-analyzer.md", DestPath: filepath.Join("cli", "agents", "reference-analyzer.md")}, {EmbedPath: "prompts/skills/reference/SKILL.md", DestPath: filepath.Join("skills", "reference", "SKILL.md")}, }, }, "mimocode": { ID: "mimocode", DisplayName: "MiMo Code", BaseDir: ".mimocode", Files: []AgentFile{ {EmbedPath: "prompts/agents/reference-explorer.md", DestPath: filepath.Join("agents", "reference-explorer.md")}, {EmbedPath: "prompts/agents/reference-analyzer.md", DestPath: filepath.Join("agents", "reference-analyzer.md")}, {EmbedPath: "prompts/skills/reference/SKILL.md", DestPath: filepath.Join("skills", "reference", "SKILL.md")}, }, }, "opencode": { ID: "opencode", DisplayName: "OpenCode", BaseDir: ".opencode", Files: []AgentFile{ {EmbedPath: "prompts/agents/reference-explorer.md", DestPath: filepath.Join("agents", "reference-explorer.md")}, {EmbedPath: "prompts/agents/reference-analyzer.md", DestPath: filepath.Join("agents", "reference-analyzer.md")}, {EmbedPath: "prompts/skills/reference/SKILL.md", DestPath: filepath.Join("skills", "reference", "SKILL.md")}, }, }, "codex": { ID: "codex", DisplayName: "Codex", BaseDir: ".codex", Files: []AgentFile{ {EmbedPath: "prompts/agents/reference-explorer.md", DestPath: filepath.Join("agents", "reference-explorer.md")}, {EmbedPath: "prompts/agents/reference-analyzer.md", DestPath: filepath.Join("agents", "reference-analyzer.md")}, {EmbedPath: "prompts/skills/reference/SKILL.md", DestPath: filepath.Join("skills", "reference", "SKILL.md")}, }, }, }
AgentRegistry 所有已注册的 Agent 配置
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 GetAgentDisplayName ¶ added in v0.0.8
GetAgentDisplayName 获取 agent 显示名称,未注册则返回原始 ID
func GetRemoteURL ¶
func GetRepoMeta ¶
func IsAgentRegistered ¶ added in v0.0.8
IsAgentRegistered 检查 agent 是否已注册
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 ValidateAgentIDs ¶ added in v0.0.8
ValidateAgentIDs 验证 agent ID 列表,返回无效的 ID
func ValidateLocalRepo ¶
Types ¶
type AddProcessor ¶
type AddProcessor struct {
// contains filtered or unexported fields
}
func NewAddProcessor ¶
type AgentConfig ¶ added in v0.0.8
type AgentConfig struct {
ID string // 唯一标识,如 "claude"
DisplayName string // 显示名称,如 "Claude Code"
BaseDir string // 相对于项目根目录的配置目录,如 ".claude"
Files []AgentFile // 需要注入的文件列表
}
AgentConfig 描述一个 AI Agent 的注入配置
func GetAgentConfig ¶ added in v0.0.8
func GetAgentConfig(id string) (AgentConfig, bool)
GetAgentConfig 根据 ID 获取 agent 配置
type AgentFile ¶ added in v0.0.8
type AgentFile struct {
EmbedPath string // 嵌入资源路径,如 "prompts/agents/reference-explorer.md"
DestPath string // 相对于 BaseDir 的目标路径,如 "agents/reference-explorer.md"
}
AgentFile 描述一个需要注入的 agent 文件
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.