Documentation
¶
Index ¶
- func FindProjectRoot(startDir string) string
- func GenerateID() string
- func GetConfigDir() string
- func GetConfigPath() string
- func GetProjectDbPath(projectRoot string) string
- func SaveProjectConfig(cfg *ProjectConfig) error
- func StripPrivate(s string) string
- type EmbedConfig
- type ProjectConfig
- type ProjectEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindProjectRoot ¶
FindProjectRoot walks up from startDir looking for .memtrace/ then .git/. Returns the absolute path of the project root, or "" if not found.
func GetConfigDir ¶
func GetConfigDir() string
GetConfigDir returns the OS-appropriate config directory for memtrace.
- macOS: $HOME/Library/Application Support/memtrace
- Linux: $XDG_CONFIG_HOME/memtrace (fallback: $HOME/.config/memtrace)
- Windows: %AppData%\memtrace
func GetConfigPath ¶
func GetConfigPath() string
GetConfigPath returns the full path to config.json.
func GetProjectDbPath ¶
GetProjectDbPath returns the path to the SQLite database for a project root.
func SaveProjectConfig ¶
func SaveProjectConfig(cfg *ProjectConfig) error
SaveProjectConfig writes the config to disk, creating the directory if needed.
func StripPrivate ¶ added in v1.5.2
StripPrivate removes all <private>...</private> blocks from s and normalises the resulting whitespace. It is case-insensitive.
This is applied to memory content before persistence so that agents can include sensitive details in a save request without those details ever reaching the database.
Types ¶
type EmbedConfig ¶
type EmbedConfig struct {
Key string `json:"key,omitempty"`
URL string `json:"url,omitempty"`
Model string `json:"model,omitempty"`
Provider string `json:"provider,omitempty"` // "" or "auto" = auto-detect; "disabled" = off
}
EmbedConfig holds optional embedding API settings persisted in the global config. Environment variables always take precedence over these values.
type ProjectConfig ¶
type ProjectConfig struct {
Projects map[string]ProjectEntry `json:"projects"`
Embed EmbedConfig `json:"embed,omitempty"`
}
ProjectConfig represents the contents of the global config.json.
func GetProjectConfig ¶
func GetProjectConfig() *ProjectConfig
GetProjectConfig reads and returns the global config. Returns an empty config (not an error) if the file doesn't exist yet. If a legacy config exists at ~/.config/memtrace/config.json and contains projects not present in the primary config, they are merged in and the merged result is saved to the primary location.
type ProjectEntry ¶
type ProjectEntry struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt string `json:"created_at"`
}
ProjectEntry represents a single project in the config file.