pub struct Config {
pub watchers: Vec<String>,
pub auto_link: bool,
pub auto_link_threshold: f64,
pub commit_footer: bool,
pub machine_id: Option<String>,
pub machine_name: Option<String>,
}Expand description
Lore configuration settings.
Controls watcher behavior, auto-linking, and commit integration.
Loaded from ~/.lore/config.yaml when available.
Fields§
§watchers: Vec<String>List of enabled watcher names (e.g., “claude-code”, “cursor”).
auto_link: boolWhether to automatically link sessions to commits.
auto_link_threshold: f64Minimum confidence score (0.0-1.0) required for auto-linking.
Whether to append session references to commit messages.
machine_id: Option<String>Unique machine identifier (UUID) for cloud sync deduplication.
Auto-generated on first access via get_or_create_machine_id().
machine_name: Option<String>Human-readable machine name.
Defaults to hostname if not set. Can be customized by the user.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Loads configuration from the default config file.
Returns default configuration if the file does not exist.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Saves configuration to the default config file.
Creates the ~/.lore directory if it does not exist.
Sourcepub fn load_from_path(path: &Path) -> Result<Self>
pub fn load_from_path(path: &Path) -> Result<Self>
Loads configuration from a specific path.
Returns default configuration if the file does not exist.
Sourcepub fn save_to_path(&self, path: &Path) -> Result<()>
pub fn save_to_path(&self, path: &Path) -> Result<()>
Saves configuration to a specific path.
Creates parent directories if they do not exist.
Sourcepub fn get_or_create_machine_id(&mut self) -> Result<String>
pub fn get_or_create_machine_id(&mut self) -> Result<String>
Returns the machine UUID, generating and saving a new one if needed.
If no machine_id exists in config, generates a new UUIDv4 and saves it to the config file. This ensures a consistent machine identifier across sessions for cloud sync deduplication.
Sourcepub fn get_machine_name(&self) -> String
pub fn get_machine_name(&self) -> String
Returns the machine name.
If a custom machine_name is set, returns that. Otherwise returns the system hostname. Returns “unknown” if hostname cannot be determined.
Sourcepub fn set_machine_name(&mut self, name: &str) -> Result<()>
pub fn set_machine_name(&mut self, name: &str) -> Result<()>
Sets a custom machine name and saves the configuration.
The machine name is a human-readable identifier for this machine, displayed in session listings and useful for identifying which machine created a session.
Sourcepub fn get(&self, key: &str) -> Option<String>
pub fn get(&self, key: &str) -> Option<String>
Gets a configuration value by key.
Supported keys:
watchers- comma-separated list of enabled watchersauto_link- “true” or “false”auto_link_threshold- float between 0.0 and 1.0commit_footer- “true” or “false”machine_id- the machine UUID (read-only, auto-generated)machine_name- human-readable machine name
Returns None if the key is not recognized.
Sourcepub fn set(&mut self, key: &str, value: &str) -> Result<()>
pub fn set(&mut self, key: &str, value: &str) -> Result<()>
Sets a configuration value by key.
Supported keys:
watchers- comma-separated list of enabled watchersauto_link- “true” or “false”auto_link_threshold- float between 0.0 and 1.0 (inclusive)commit_footer- “true” or “false”machine_name- human-readable machine name
Note: machine_id cannot be set manually; it is auto-generated.
Returns an error if the key is not recognized or the value is invalid.
Sourcepub fn config_path() -> Result<PathBuf>
pub fn config_path() -> Result<PathBuf>
Returns the path to the configuration file.
The configuration file is located at ~/.lore/config.yaml.
Sourcepub fn valid_keys() -> &'static [&'static str]
pub fn valid_keys() -> &'static [&'static str]
Returns the list of valid configuration keys.