aboutsummaryrefslogtreecommitdiff
path: root/src/integration/env.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/integration/env.rs')
-rw-r--r--src/integration/env.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/integration/env.rs b/src/integration/env.rs
index 3cd1b604..2d0feeb0 100644
--- a/src/integration/env.rs
+++ b/src/integration/env.rs
@@ -17,6 +17,10 @@ pub(crate) const KIMI_CODE_HOME_ENV_VAR: &str = "KIMI_CODE_HOME";
pub(crate) const COPILOT_HOME_ENV_VAR: &str = "COPILOT_HOME";
pub(crate) const QODERCLI_CONFIG_DIR_ENV_VAR: &str = "QODER_CONFIG_DIR";
pub(crate) const CURSOR_CONFIG_DIR_ENV_VAR: &str = "CURSOR_CONFIG_DIR";
+pub(crate) const GROK_CONFIG_DIR_ENV_VAR: &str = "GROK_CONFIG_DIR";
+/// The grok CLI's own config-home override (documented alongside
+/// `$GROK_HOME/config.toml` and `$GROK_HOME/auth.json`).
+pub(crate) const GROK_HOME_ENV_VAR: &str = "GROK_HOME";
pub(crate) fn apply_pane_base_env(cmd: &mut CommandBuilder) {
cmd.env(crate::api::SOCKET_PATH_ENV_VAR, crate::api::socket_path());
@@ -138,6 +142,18 @@ pub(crate) fn mastracode_dir() -> io::Result<PathBuf> {
Ok(home_dir()?.join(".mastracode"))
}
+pub(crate) fn grok_dir() -> io::Result<PathBuf> {
+ // GROK_CONFIG_DIR is a herdr-level override only (primarily a test
+ // seam); the grok CLI does not honor it, so it stays first and explicit.
+ if let Some(value) = std::env::var_os(GROK_CONFIG_DIR_ENV_VAR).filter(|value| !value.is_empty())
+ {
+ return expand_tilde_path(PathBuf::from(value));
+ }
+ // The grok CLI honors GROK_HOME as its config home (config.toml,
+ // auth.json, hooks/); mirror it so hook installs land where grok looks.
+ config_dir_from_env_or_home(GROK_HOME_ENV_VAR, &[".grok"])
+}
+
pub(crate) fn home_dir() -> io::Result<PathBuf> {
if let Some(home) = std::env::var_os("HOME").filter(|value| !value.is_empty()) {
return Ok(PathBuf::from(home));