Skip to main content

Module xdg

Module xdg 

Source
Expand description

XDG Base Directory paths and config file (no .env at runtime). XDG Base Directory layout for browser-automation-cli (no .env at runtime).

Canonical product paths use the directories crate:

  • config: $XDG_CONFIG_HOME/browser-automation-cli (Linux)
  • data: $XDG_DATA_HOME/browser-automation-cli
  • cache: $XDG_CACHE_HOME/browser-automation-cli
  • state: $XDG_STATE_HOME/browser-automation-cli (when available) or data/state

Flags on the CLI override file config. Environment variables are not used for product settings; system paths (PATH, locale) remain OS concerns.

Structs§

ProductConfig
On-disk product configuration (TOML). Flags override these at parse time.

Functions§

browsers_dir
Default browsers cache under XDG cache.
cache_dir
Cache directory (lighthouse reports, HTTP scrape cache, browsers cache).
chrome_path_from_config
Chrome/Chromium binary from XDG config only.
config_dir
Config directory (…/browser-automation-cli).
config_file
Path to the TOML config file.
config_get
Get one config key (or full dump when key is empty).
config_list_keys
List supported XDG config keys (GAP-018).
config_set
Set one string key in config and persist.
data_dir
Data directory (sessions, journals, durable artifacts).
encryption_key
Load optional encryption key from XDG config only (never product env vars).
ensure_dir
Ensure a directory exists with restrictive permissions when possible.
init_layout
Create all standard XDG product directories.
lighthouse_path_from_config
Lighthouse binary path from XDG config only.
llm_base_url
Optional LLM base URL from XDG config only.
llm_model
Optional LLM model id from XDG config only.
load_config
Load config from XDG path; missing file yields defaults.
mitm_ca_dir
Default MITM CA directory.
mitm_capture_dir
Default MITM capture directory for the invocation artifacts.
openrouter_api_key
Optional LLM API key from XDG config only (never product env vars).
paths_snapshot
JSON snapshot of all resolved paths (for config path / doctor).
project_dirs
Resolve platform project directories or a deterministic fallback under the system temp dir.
sessions_dir
Default sessions directory under XDG state.
state_dir
State directory (runtime state, workflow journal default).
workflow_dir
Default workflow journal directory.
write_config
Write config atomically (temp + rename).