Documentation
¶
Index ¶
- Variables
- type AddRepoOptions
- type AddRepoResult
- type DoctorCheck
- type DoctorResult
- type Engine
- func (e *Engine) AddRepo(ctx context.Context, opts AddRepoOptions) (*AddRepoResult, error)
- func (e *Engine) Close() error
- func (e *Engine) Doctor(ctx context.Context, projectDir string) (*DoctorResult, error)
- func (e *Engine) GetAppConfig() *models.AppConfig
- func (e *Engine) GetDB() *gorm.DB
- func (e *Engine) GetLogger() *zap.Logger
- func (e *Engine) GetRepoIndexer() *repo.RepoIndexer
- func (e *Engine) Inject(ctx context.Context, projectDir string) (string, error)
- func (e *Engine) ListRepos(ctx context.Context, projectDir string) (*ListReposResult, error)
- func (e *Engine) RemoveRepo(ctx context.Context, opts RemoveRepoOptions) error
- func (e *Engine) SCC(repoPath string) (*SCCResult, error)
- func (e *Engine) SetPromptsFS(fs interface{ ... })
- func (e *Engine) UpdateRepos(ctx context.Context, opts UpdateReposOptions) error
- type ListReposResult
- type Options
- type ProxyOptions
- type RefType
- type RemoveRepoOptions
- type RepoInfo
- type RepoItem
- type SCCFileStat
- type SCCLangStat
- type SCCResult
- type UpdateReposOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEngineClosed Engine 已关闭 ErrEngineClosed = errors.New("engine is closed") // ErrPromptsFSNotSet 嵌入的提示词文件系统未设置 ErrPromptsFSNotSet = errors.New("prompts filesystem not set, call SetPromptsFS() first") // ErrInvalidOptions 无效的配置选项 ErrInvalidOptions = errors.New("invalid options") )
Functions ¶
This section is empty.
Types ¶
type AddRepoOptions ¶
type AddRepoOptions struct {
Target string // Git URL 或本地路径
Local bool // 是否为本地仓库
Name string // 自定义链接名称
Branch string // 指定分支或标签
Update bool // 强制更新已有缓存
ProjectDir string // 项目目录
}
AddRepoOptions 添加仓库选项
type AddRepoResult ¶
AddRepoResult 添加仓库结果
type DoctorCheck ¶
type DoctorCheck struct {
Group string `json:"group"`
Name string `json:"name"`
Status string `json:"status"`
Details string `json:"details"`
}
DoctorCheck 诊断检查项
type DoctorResult ¶
type DoctorResult struct {
Checks []DoctorCheck `json:"checks"`
Summary string `json:"summary"`
}
DoctorResult 诊断结果
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine reference 库的核心引擎
func (*Engine) AddRepo ¶
func (e *Engine) AddRepo(ctx context.Context, opts AddRepoOptions) (*AddRepoResult, error)
AddRepo 添加仓库引用
func (*Engine) GetRepoIndexer ¶
func (e *Engine) GetRepoIndexer() *repo.RepoIndexer
GetRepoIndexer 获取仓库索引器(高级用法)
func (*Engine) RemoveRepo ¶
func (e *Engine) RemoveRepo(ctx context.Context, opts RemoveRepoOptions) error
RemoveRepo 移除仓库引用
func (*Engine) SetPromptsFS ¶
SetPromptsFS 设置嵌入的提示词文件系统
func (*Engine) UpdateRepos ¶
func (e *Engine) UpdateRepos(ctx context.Context, opts UpdateReposOptions) error
UpdateRepos 更新远程仓库缓存
type ListReposResult ¶
type ListReposResult struct {
Repos []RepoItem `json:"repos"`
}
ListReposResult 列出仓库结果
type Options ¶
type Options struct {
// AppDir 应用数据目录,默认 ~/.cicbyte/apps/reference
AppDir string
// DB 数据库连接,可选。为 nil 时内部自动创建 SQLite 连接
DB *gorm.DB
// PromptsFS 嵌入的提示词文件系统,可选。
// 为 nil 时模板注入功能(Inject)不可用
PromptsFS fs.FS
// Logger 日志记录器,可选。为 nil 时使用 nop logger
Logger *zap.Logger
// ReposPath 覆盖默认的仓库缓存目录
// 默认: AppDir/repos
ReposPath string
// WikiPath 覆盖默认的知识库目录
// 默认: AppDir/wiki
WikiPath string
// LocalWikiPath 覆盖默认的本地知识库目录
// 默认: AppDir/localwiki
LocalWikiPath string
// Proxy 代理设置,可选
Proxy ProxyOptions
}
Options Engine 配置选项
type ProxyOptions ¶
type ProxyOptions struct {
// HTTP HTTP/HTTPS 代理地址
HTTP string
// Git Git 专用代理,为空则回退使用 HTTP
Git string
}
ProxyOptions 代理配置
type RemoveRepoOptions ¶
type RemoveRepoOptions struct {
Identifier string // 仓库标识符
Purge bool // 同时删除全局缓存
Clean bool // 同时清除 AI 配置和 .reference/ 目录
Yes bool // 跳过确认提示
All bool // 移除全部引用
ProjectDir string // 项目目录
}
RemoveRepoOptions 移除仓库选项
type RepoInfo ¶
type RepoInfo struct {
ID uint `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ProjectDir string `json:"project_dir"`
LinkName string `json:"link_name"`
RefType RefType `json:"ref_type"`
// 远程仓库字段
RemoteURL string `json:"remote_url,omitempty"`
Host string `json:"host,omitempty"`
Namespace string `json:"namespace,omitempty"`
RepoName string `json:"repo_name,omitempty"`
CachePath string `json:"cache_path,omitempty"`
// 本地仓库字段
LocalPath string `json:"local_path,omitempty"`
// Wiki 路径
WikiSubPath string `json:"wiki_sub_path,omitempty"`
// 引用链接名
RefName string `json:"ref_name,omitempty"`
// 元数据
Branch string `json:"branch,omitempty"`
Commit string `json:"commit,omitempty"`
CommitAt *time.Time `json:"commit_at,omitempty"`
}
RepoInfo 仓库信息
type RepoItem ¶
type RepoItem struct {
Type string `json:"type"`
Name string `json:"name"`
Source string `json:"source"`
CachePath string `json:"cache_path"`
CommitAt string `json:"commit_at"`
Branch string `json:"branch"`
}
RepoItem 仓库列表项
type SCCFileStat ¶
type SCCFileStat struct {
Type string `json:"type"`
File string `json:"file"`
Language string `json:"language"`
Code int `json:"code"`
Complex int `json:"complexity"`
}
SCCFileStat 文件统计
type SCCLangStat ¶
type SCCLangStat struct {
Type string `json:"type"`
Name string `json:"name"`
Count int `json:"count"`
Code int `json:"code"`
Complex int `json:"complexity"`
}
SCCLangStat 语言统计
type SCCResult ¶
type SCCResult struct {
Repo string `json:"repo"`
Path string `json:"path"`
Langs []SCCLangStat `json:"languages"`
TopFiles []SCCFileStat `json:"topFiles"`
}
SCCResult 代码统计结果
type UpdateReposOptions ¶
UpdateReposOptions 更新仓库选项
Click to show internal directories.
Click to hide internal directories.