Skip to main content

Module config

Module config 

Source

Structs§

SynapsConfig
Parsed configuration from the config file.

Functions§

add_favorite_model
Add a favorite model id (provider/model) to config, preserving sort/dedup.
base_dir
get_active_config_dir
Gets the absolute directory for the current profile (or root if default).
get_profile
Returns the active profile name, if any. Reads from SYNAPS_PROFILE environment variable if not already set programmatically.
get_provider_keys
Provider API keys parsed from provider.<name> = ... lines in config. Empty if load_config() hasn’t been called. The registry falls back to env vars, so e.g. GROQ_API_KEY works even with an empty map.
is_favorite_model
Return whether a model id is marked as favorite.
load_config
Parse the config file at ~/.synaps-cli/config (or profile variant). Returns default config if file doesn’t exist or can’t be read.
read_config_value
Read a single config value by exact key from the active config file.
remove_favorite_model
Remove a favorite model id (provider/model) from config.
resolve_read_path
Resolves a path for reading. Checks the profile folder first, then falls back to the default folder.
resolve_read_path_extended
Resolves a path for reading with an extended arbitrary path tree.
resolve_system_prompt
Resolve the system prompt from CLI flag, config file, or default. Priority: explicit value > ~/.synaps-cli/system.md > built-in default.
resolve_write_path
Resolves a path for writing. Unconditionally writes to the profile folder if a profile is active.
set_profile
Sets the active profile name. Must be called before any get_profile() call (i.e., before config resolution begins). Uses OnceLock — first write wins, subsequent calls are no-ops. No env var mutation (unsafe under tokio).
write_config_value
Write a single key = value pair to ~/.synaps-cli/config (or profile config). Replaces the first existing line that matches the key, or appends if absent. Preserves comments and unknown keys. Writes atomically via temp file + rename.