Documentation
¶
Index ¶
- Constants
- func ContractPath(absPath string) string
- func Exists(projectRoot string) bool
- func ExpandPath(path string) string
- func FindProjectRoot() (string, error)
- func GenerateProjectID() string
- func GetConfigDir(projectRoot string) string
- func GetConfigPath(projectRoot string) string
- func GetGlobalConfigDir() (string, error)
- func GetHomeDir() string
- func GetIndexPath(projectRoot string) string
- func GetMachineConfigPath() string
- func GetProjectsConfigPath() string
- func GetSymbolIndexPath(projectRoot string) string
- func GetVenvDir() string
- func GetWorkspaceConfigPath() (string, error)
- func MachineConfigExists() bool
- func MaskDSN(dsn string) string
- func SaveMachineConfig(cfg *MachineConfig) error
- func SaveProjectsConfig(cfg *ProjectsConfig) error
- func SaveWorkspaceConfig(cfg *WorkspaceConfig) error
- func ValidateWorkspaceBackend(ws *Workspace) error
- type BoostConfig
- type BoostRule
- type ChunkingConfig
- type Config
- type DatabaseConfig
- type EmbedderConfig
- type HybridConfig
- type MachineConfig
- type MachineEmbedder
- type PathsConfig
- type PostgresConfig
- type PreferencesConfig
- type ProjectEntry
- type ProjectStatus
- type ProjectsConfig
- func (c *ProjectsConfig) AddProject(name, absPath string) error
- func (c *ProjectsConfig) FindProjectByPath(path string) (string, *RegisteredProject, error)
- func (c *ProjectsConfig) GetProject(name string) (*RegisteredProject, error)
- func (c *ProjectsConfig) ListProjects() []string
- func (c *ProjectsConfig) RemoveProject(name string) error
- func (c *ProjectsConfig) UpdateProjectFramework(name string, framework string) error
- func (c *ProjectsConfig) UpdateProjectLanguages(name string, languages []string) error
- type QdrantConfig
- type RegisteredProject
- 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" )
const (
MachineConfigFileName = "machine.yaml"
)
const (
ProjectsConfigFileName = "projects.yaml"
)
const (
WorkspaceConfigFileName = "workspace.yaml"
)
Variables ¶
This section is empty.
Functions ¶
func ContractPath ¶
ContractPath replaces home directory with ~ for portability.
func ExpandPath ¶
ExpandPath expands ~ to the actual home directory.
func FindProjectRoot ¶
func GenerateProjectID ¶
func GenerateProjectID() string
GenerateProjectID generates a new UUID v4 for project identification
func GetConfigDir ¶
func GetConfigPath ¶
func GetGlobalConfigDir ¶
GetGlobalConfigDir returns the global grepai config directory path. ~/.grepai on Unix-like systems
func GetIndexPath ¶
func GetMachineConfigPath ¶
func GetMachineConfigPath() string
GetMachineConfigPath returns the path to the machine configuration file
func GetProjectsConfigPath ¶
func GetProjectsConfigPath() string
GetProjectsConfigPath returns the path to the projects config file. ~/.grepai/projects.yaml
func GetSymbolIndexPath ¶
func GetVenvDir ¶
func GetVenvDir() string
GetVenvDir retourne le chemin global du venv Python : ~/.grepai/venv
func GetWorkspaceConfigPath ¶
GetWorkspaceConfigPath returns the path to the workspace config file.
func MachineConfigExists ¶
func MachineConfigExists() bool
MachineConfigExists returns true if the machine configuration file exists
func MaskDSN ¶
MaskDSN masks the password in a PostgreSQL DSN for display Example: postgres://user:secret@localhost:5432/db -> postgres://user:****@localhost:5432/db
func SaveMachineConfig ¶
func SaveMachineConfig(cfg *MachineConfig) error
SaveMachineConfig saves the machine configuration to ~/.grepai/machine.yaml
func SaveProjectsConfig ¶
func SaveProjectsConfig(cfg *ProjectsConfig) error
SaveProjectsConfig saves the projects configuration to ~/.grepai/projects.yaml.
func SaveWorkspaceConfig ¶
func SaveWorkspaceConfig(cfg *WorkspaceConfig) error
SaveWorkspaceConfig saves the workspace configuration to ~/.grepai/workspace.yaml.
func ValidateWorkspaceBackend ¶
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 ¶
type ChunkingConfig ¶
type Config ¶
type Config struct {
Version int `yaml:"version"`
ProjectID string `yaml:"project_id,omitempty"`
ProjectName string `yaml:"project_name,omitempty"`
Embedder EmbedderConfig `yaml:"embedder"`
Store StoreConfig `yaml:"store"`
Chunking ChunkingConfig `yaml:"chunking"`
Watch WatchConfig `yaml:"watch"`
Search SearchConfig `yaml:"search"`
Trace TraceConfig `yaml:"trace"`
Update UpdateConfig `yaml:"update"`
Ignore []string `yaml:"ignore"`
ExternalGitignore string `yaml:"external_gitignore,omitempty"`
}
func DefaultConfig ¶
func DefaultConfig() *Config
type DatabaseConfig ¶
type DatabaseConfig struct {
DSN string `yaml:"dsn"` // PostgreSQL connection string
}
DatabaseConfig holds database connection settings
type EmbedderConfig ¶
type HybridConfig ¶
type MachineConfig ¶
type MachineConfig struct {
Version int `yaml:"version"`
Database DatabaseConfig `yaml:"database"`
Embedder MachineEmbedder `yaml:"embedder"`
Preferences PreferencesConfig `yaml:"preferences"`
Paths PathsConfig `yaml:"paths"`
}
MachineConfig holds machine-level configuration that applies to all projects. This configuration is stored in ~/.grepai/machine.yaml
func DefaultMachineConfig ¶
func DefaultMachineConfig() *MachineConfig
DefaultMachineConfig returns a MachineConfig with sensible defaults
func LoadMachineConfig ¶
func LoadMachineConfig() (*MachineConfig, error)
LoadMachineConfig loads the machine configuration from ~/.grepai/machine.yaml
type MachineEmbedder ¶
type MachineEmbedder struct {
ModelPath string `yaml:"model_path"` // Path to E5 model directory
}
MachineEmbedder holds machine-level embedder settings
type PathsConfig ¶
type PathsConfig struct {
Venv string `yaml:"venv"` // Path to Python venv
Cache string `yaml:"cache"` // Path to cache directory
}
PathsConfig holds system paths
type PostgresConfig ¶
type PostgresConfig struct {
DSN string `yaml:"dsn"`
}
type PreferencesConfig ¶
type PreferencesConfig struct {
DefaultLimit int `yaml:"default_limit"` // Default number of search results
JSONOutput bool `yaml:"json_output"` // Default output format
}
PreferencesConfig holds user preferences
type ProjectEntry ¶
ProjectEntry represents a single project within a workspace.
type ProjectStatus ¶
type ProjectStatus string
ProjectStatus represents the indexing status of a project.
const ( ProjectStatusIndexed ProjectStatus = "indexed" ProjectStatusWatching ProjectStatus = "watching" ProjectStatusNotIndexed ProjectStatus = "not indexed" )
func GetProjectStatus ¶
func GetProjectStatus(absPath string) ProjectStatus
GetProjectStatus returns the status of a project based on its .grepai directory.
type ProjectsConfig ¶
type ProjectsConfig struct {
Version int `yaml:"version"`
Projects map[string]RegisteredProject `yaml:"projects"`
Groups map[string][]string `yaml:"groups,omitempty"`
}
ProjectsConfig holds global projects registry. Stored at ~/.grepai/projects.yaml
func DefaultProjectsConfig ¶
func DefaultProjectsConfig() *ProjectsConfig
DefaultProjectsConfig returns an empty projects configuration.
func LoadProjectsConfig ¶
func LoadProjectsConfig() (*ProjectsConfig, error)
LoadProjectsConfig loads the projects configuration from ~/.grepai/projects.yaml. Returns an empty config (not nil) if the file doesn't exist.
func (*ProjectsConfig) AddProject ¶
func (c *ProjectsConfig) AddProject(name, absPath string) error
AddProject adds a new project to the registry. The path is stored in portable format (with ~).
func (*ProjectsConfig) FindProjectByPath ¶
func (c *ProjectsConfig) FindProjectByPath(path string) (string, *RegisteredProject, error)
FindProjectByPath finds a project by its path (accepts both portable and absolute).
func (*ProjectsConfig) GetProject ¶
func (c *ProjectsConfig) GetProject(name string) (*RegisteredProject, error)
GetProject returns a project by name.
func (*ProjectsConfig) ListProjects ¶
func (c *ProjectsConfig) ListProjects() []string
ListProjects returns a sorted list of all project names.
func (*ProjectsConfig) RemoveProject ¶
func (c *ProjectsConfig) RemoveProject(name string) error
RemoveProject removes a project from the registry.
func (*ProjectsConfig) UpdateProjectFramework ¶
func (c *ProjectsConfig) UpdateProjectFramework(name string, framework string) error
UpdateProjectFramework updates the detected framework for a project.
func (*ProjectsConfig) UpdateProjectLanguages ¶
func (c *ProjectsConfig) UpdateProjectLanguages(name string, languages []string) error
UpdateProjectLanguages updates the detected languages for a project.
type QdrantConfig ¶
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 RegisteredProject ¶
type RegisteredProject struct {
Path string `yaml:"path"` // Uses ~ for portability
Languages []string `yaml:"languages,omitempty"` // Detected languages (e.g., go, python, typescript)
Framework string `yaml:"framework,omitempty"` // Detected framework (e.g., react, django, gin)
AddedAt string `yaml:"added_at,omitempty"` // RFC3339 timestamp
}
RegisteredProject represents a registered project in the global registry.
type SearchConfig ¶
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"`
}
type TraceConfig ¶
type UpdateConfig ¶
type UpdateConfig struct {
CheckOnStartup bool `yaml:"check_on_startup"` // Check for updates when running commands
}
UpdateConfig holds auto-update settings
type WatchConfig ¶
type Workspace ¶
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 ¶
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 ¶
func DefaultWorkspaceConfig() *WorkspaceConfig
DefaultWorkspaceConfig returns an empty workspace configuration.
func LoadWorkspaceConfig ¶
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 ¶
func (c *WorkspaceConfig) AddProject(workspaceName string, project ProjectEntry) error
AddProject adds a project to a workspace.
func (*WorkspaceConfig) AddWorkspace ¶
func (c *WorkspaceConfig) AddWorkspace(ws Workspace) error
AddWorkspace adds a new workspace to the configuration.
func (*WorkspaceConfig) GetWorkspace ¶
func (c *WorkspaceConfig) GetWorkspace(name string) (*Workspace, error)
GetWorkspace returns a workspace by name.
func (*WorkspaceConfig) ListWorkspaces ¶
func (c *WorkspaceConfig) ListWorkspaces() []string
ListWorkspaces returns a list of all workspace names.
func (*WorkspaceConfig) RemoveProject ¶
func (c *WorkspaceConfig) RemoveProject(workspaceName, projectName string) error
RemoveProject removes a project from a workspace.
func (*WorkspaceConfig) RemoveWorkspace ¶
func (c *WorkspaceConfig) RemoveWorkspace(name string) error
RemoveWorkspace removes a workspace from the configuration.