Documentation
¶
Index ¶
- Constants
- func AutoInitWorktree(worktreeRoot, mainWorktree string) error
- func Exists(projectRoot string) bool
- func FindProjectRoot() (string, error)
- func FindProjectRootWithGit() (string, *git.DetectInfo, error)
- func GetConfigDir(projectRoot string) string
- func GetConfigPath(projectRoot string) string
- func GetGlobalConfigDir() (string, error)
- func GetIndexPath(projectRoot string) string
- func GetRPGIndexPath(projectRoot string) string
- func GetSymbolIndexPath(projectRoot string) string
- func GetWorkspaceConfigPath() (string, error)
- func SaveWorkspaceConfig(cfg *WorkspaceConfig) error
- func ValidateRPGConfig(cfg RPGConfig) error
- func ValidateWatchConfig(cfg WatchConfig) error
- func ValidateWorkspaceBackend(ws *Workspace) error
- type BoostConfig
- type BoostRule
- type ChunkingConfig
- type Config
- type EmbedderConfig
- type HybridConfig
- type PostgresConfig
- type ProjectEntry
- type QdrantConfig
- type RPGConfig
- type SearchConfig
- type StoreConfig
- type TraceConfig
- type UpdateConfig
- type WatchConfig
- type Workspace
- type WorkspaceConfig
- func (c *WorkspaceConfig) AddProject(workspaceName string, project ProjectEntry) error
- func (c *WorkspaceConfig) AddWorkspace(ws Workspace) error
- func (c *WorkspaceConfig) GetWorkspace(name string) (*Workspace, error)
- func (c *WorkspaceConfig) ListWorkspaces() []string
- func (c *WorkspaceConfig) RemoveProject(workspaceName, projectName string) error
- func (c *WorkspaceConfig) RemoveWorkspace(name string) error
Constants ¶
const ( ConfigDir = ".grepai" ConfigFileName = "config.yaml" IndexFileName = "index.gob" SymbolIndexFileName = "symbols.gob" RPGIndexFileName = "rpg.gob" DefaultEmbedderProvider = "ollama" DefaultOllamaEmbeddingModel = "nomic-embed-text" DefaultLMStudioEmbeddingModel = "text-embedding-nomic-embed-text-v1.5" DefaultOpenAIEmbeddingModel = "text-embedding-3-small" DefaultSyntheticEmbeddingModel = "hf:nomic-ai/nomic-embed-text-v1.5" DefaultOpenRouterEmbeddingModel = "openai/text-embedding-3-small" OpenAIEmbeddingModelLarge = "text-embedding-3-large" OpenRouterEmbeddingModelLarge = "openai/text-embedding-3-large" OpenRouterEmbeddingModelQwen8B = "qwen/qwen3-embedding-8b" DefaultOllamaEndpoint = "http://localhost:11434" DefaultLMStudioEndpoint = "http://127.0.0.1:1234" DefaultOpenAIEndpoint = "https://api.openai.com/v1" DefaultSyntheticEndpoint = "https://api.synthetic.new/openai/v1" DefaultOpenRouterEndpoint = "https://openrouter.ai/api/v1" DefaultLocalEmbeddingDimensions = 768 DefaultOpenAIDimensions = 1536 DefaultOpenAILargeDimensions = 3072 DefaultQwen8BDimensions = 4096 DefaultOpenAIParallelism = 4 DefaultPostgresDSN = "postgres://localhost:5432/grepai" DefaultQdrantEndpoint = "localhost" DefaultQdrantPort = 6334 // RPG default configuration values. DefaultRPGDriftThreshold = 0.35 DefaultRPGMaxTraversalDepth = 3 DefaultRPGLLMTimeoutMs = 8000 DefaultRPGFeatureMode = "local" DefaultRPGFeatureGroupStrategy = "sample" // Watch defaults for RPG realtime updates. DefaultWatchRPGPersistIntervalMs = 1000 DefaultWatchRPGDerivedDebounceMs = 300 DefaultWatchRPGFullReconcileIntervalS = 300 DefaultWatchRPGMaxDirtyFilesPerBatch = 128 )
const (
WorkspaceConfigFileName = "workspace.yaml"
)
Variables ¶
This section is empty.
Functions ¶
func AutoInitWorktree ¶ added in v0.29.0
AutoInitWorktree creates a local .grepai/ in worktreeRoot by copying config and index files from mainWorktree. This is used by watch to auto-init linked worktrees.
func FindProjectRoot ¶
func FindProjectRootWithGit ¶ added in v0.29.0
func FindProjectRootWithGit() (string, *git.DetectInfo, error)
FindProjectRootWithGit extends FindProjectRoot with git worktree awareness. It first tries the standard .grepai/ directory walk. If found, it also returns git worktree info if available. If .grepai/ is not found locally but we're in a git worktree, it checks the main worktree for .grepai/config.yaml.
Returns:
- projectRoot: the directory containing .grepai/
- gitInfo: git worktree detection info (nil if not in a git repo)
- err: error if neither local nor main worktree has .grepai/
func GetConfigDir ¶
func GetConfigPath ¶
func GetGlobalConfigDir ¶ added in v0.22.0
GetGlobalConfigDir returns the global grepai config directory path. ~/.grepai on Unix-like systems
func GetIndexPath ¶
func GetRPGIndexPath ¶ added in v0.31.0
func GetSymbolIndexPath ¶ added in v0.5.0
func GetWorkspaceConfigPath ¶ added in v0.22.0
GetWorkspaceConfigPath returns the path to the workspace config file.
func SaveWorkspaceConfig ¶ added in v0.22.0
func SaveWorkspaceConfig(cfg *WorkspaceConfig) error
SaveWorkspaceConfig saves the workspace configuration to ~/.grepai/workspace.yaml.
func ValidateRPGConfig ¶ added in v0.31.0
ValidateRPGConfig checks RPG configuration values for validity.
func ValidateWatchConfig ¶ added in v0.31.0
func ValidateWatchConfig(cfg WatchConfig) error
ValidateWatchConfig checks watch configuration values for validity.
func ValidateWorkspaceBackend ¶ added in v0.22.0
ValidateWorkspaceBackend validates that the workspace uses a supported backend. GOB backend is not supported for workspaces (file-based, can't be shared).
Types ¶
type BoostConfig ¶ added in v0.3.0
type ChunkingConfig ¶
type Config ¶
type Config struct {
Version int `yaml:"version"`
Embedder EmbedderConfig `yaml:"embedder"`
Store StoreConfig `yaml:"store"`
Chunking ChunkingConfig `yaml:"chunking"`
Watch WatchConfig `yaml:"watch"`
Search SearchConfig `yaml:"search"`
Trace TraceConfig `yaml:"trace"`
RPG RPGConfig `yaml:"rpg"`
Update UpdateConfig `yaml:"update"`
Ignore []string `yaml:"ignore"`
ExternalGitignore string `yaml:"external_gitignore,omitempty"`
}
func DefaultConfig ¶
func DefaultConfig() *Config
type EmbedderConfig ¶
type EmbedderConfig struct {
Provider string `yaml:"provider"` // ollama | lmstudio | openai | synthetic | openrouter
Model string `yaml:"model"`
Endpoint string `yaml:"endpoint,omitempty"`
APIKey string `yaml:"api_key,omitempty"`
Dimensions *int `yaml:"dimensions,omitempty"`
Parallelism int `yaml:"parallelism"` // Number of parallel workers for batch embedding (default: 4)
}
func DefaultEmbedderForProvider ¶ added in v0.34.0
func DefaultEmbedderForProvider(provider string) EmbedderConfig
func (*EmbedderConfig) GetDimensions ¶ added in v0.25.1
func (e *EmbedderConfig) GetDimensions() int
GetDimensions returns the configured dimensions or a default value. For OpenAI/OpenRouter, defaults to 1536 (text-embedding-3-small). For Ollama/LMStudio/Synthetic, defaults to 768 (nomic-embed-text-v1.5).
type HybridConfig ¶ added in v0.3.0
type PostgresConfig ¶
type PostgresConfig struct {
DSN string `yaml:"dsn"`
}
type ProjectEntry ¶ added in v0.22.0
ProjectEntry represents a single project within a workspace.
type QdrantConfig ¶ added in v0.18.0
type QdrantConfig struct {
Endpoint string `yaml:"endpoint"` // e.g., "http://localhost" or "localhost"
Port int `yaml:"port,omitempty"` // e.g., 6333
Collection string `yaml:"collection,omitempty"` // Optional, defaults from project path
APIKey string `yaml:"api_key,omitempty"` // Optional, for Qdrant Cloud
UseTLS bool `yaml:"use_tls,omitempty"` // Enable TLS (for Qdrant Cloud)
}
type RPGConfig ¶ added in v0.31.0
type RPGConfig struct {
Enabled bool `yaml:"enabled"`
StorePath string `yaml:"store_path,omitempty"`
FeatureMode string `yaml:"feature_mode"` // local | hybrid | llm
DriftThreshold float64 `yaml:"drift_threshold"`
MaxTraversalDepth int `yaml:"max_traversal_depth"`
LLMProvider string `yaml:"llm_provider,omitempty"`
LLMModel string `yaml:"llm_model,omitempty"`
LLMEndpoint string `yaml:"llm_endpoint,omitempty"`
LLMAPIKey string `yaml:"llm_api_key,omitempty"`
LLMTimeoutMs int `yaml:"llm_timeout_ms,omitempty"`
FeatureGroupStrategy string `yaml:"feature_group_strategy,omitempty"`
}
type SearchConfig ¶ added in v0.3.0
type SearchConfig struct {
Boost BoostConfig `yaml:"boost"`
Hybrid HybridConfig `yaml:"hybrid"`
}
type StoreConfig ¶
type StoreConfig struct {
Backend string `yaml:"backend"` // gob | postgres | qdrant
Postgres PostgresConfig `yaml:"postgres,omitempty"`
Qdrant QdrantConfig `yaml:"qdrant,omitempty"`
}
func DefaultStoreForBackend ¶ added in v0.34.0
func DefaultStoreForBackend(backend string) StoreConfig
type TraceConfig ¶ added in v0.5.0
type UpdateConfig ¶ added in v0.13.0
type UpdateConfig struct {
CheckOnStartup bool `yaml:"check_on_startup"` // Check for updates when running commands
}
UpdateConfig holds auto-update settings
type WatchConfig ¶
type WatchConfig struct {
DebounceMs int `yaml:"debounce_ms"`
LastIndexTime time.Time `yaml:"last_index_time,omitempty"`
RPGPersistIntervalMs int `yaml:"rpg_persist_interval_ms,omitempty"`
RPGDerivedDebounceMs int `yaml:"rpg_derived_debounce_ms,omitempty"`
RPGFullReconcileIntervalSec int `yaml:"rpg_full_reconcile_interval_sec,omitempty"`
RPGMaxDirtyFilesPerBatch int `yaml:"rpg_max_dirty_files_per_batch,omitempty"`
}
type Workspace ¶ added in v0.22.0
type Workspace struct {
Name string `yaml:"name"`
Store StoreConfig `yaml:"store"`
Embedder EmbedderConfig `yaml:"embedder"`
Projects []ProjectEntry `yaml:"projects"`
}
Workspace represents a multi-project workspace configuration.
type WorkspaceConfig ¶ added in v0.22.0
type WorkspaceConfig struct {
Version int `yaml:"version"`
Workspaces map[string]Workspace `yaml:"workspaces"`
}
WorkspaceConfig holds global workspace configuration. Stored at ~/.grepai/workspace.yaml
func DefaultWorkspaceConfig ¶ added in v0.22.0
func DefaultWorkspaceConfig() *WorkspaceConfig
DefaultWorkspaceConfig returns an empty workspace configuration.
func LoadWorkspaceConfig ¶ added in v0.22.0
func LoadWorkspaceConfig() (*WorkspaceConfig, error)
LoadWorkspaceConfig loads the workspace configuration from ~/.grepai/workspace.yaml. Returns nil, nil if the file doesn't exist.
func (*WorkspaceConfig) AddProject ¶ added in v0.22.0
func (c *WorkspaceConfig) AddProject(workspaceName string, project ProjectEntry) error
AddProject adds a project to a workspace.
func (*WorkspaceConfig) AddWorkspace ¶ added in v0.22.0
func (c *WorkspaceConfig) AddWorkspace(ws Workspace) error
AddWorkspace adds a new workspace to the configuration.
func (*WorkspaceConfig) GetWorkspace ¶ added in v0.22.0
func (c *WorkspaceConfig) GetWorkspace(name string) (*Workspace, error)
GetWorkspace returns a workspace by name.
func (*WorkspaceConfig) ListWorkspaces ¶ added in v0.22.0
func (c *WorkspaceConfig) ListWorkspaces() []string
ListWorkspaces returns a list of all workspace names.
func (*WorkspaceConfig) RemoveProject ¶ added in v0.22.0
func (c *WorkspaceConfig) RemoveProject(workspaceName, projectName string) error
RemoveProject removes a project from a workspace.
func (*WorkspaceConfig) RemoveWorkspace ¶ added in v0.22.0
func (c *WorkspaceConfig) RemoveWorkspace(name string) error
RemoveWorkspace removes a workspace from the configuration.