fix(mcp): resolve MCP service config dir through $XDG_CONFIG_HOME #99
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/YT-41-mcp-installer-xdg-config-home"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
yt mcp serviceinstaller hardcodedhome.join(".config").join("youtrack-cli")for themcp.envpath (install + uninstall) and baked a fixedEnvironmentFile=%h/.config/youtrack-cli/mcp.envinto the unit, diverging from the CLI, which resolves its config root throughyoutrack-configand honors$XDG_CONFIG_HOME. Under a custom$XDG_CONFIG_HOMEthe CLI readconfig.ymlfrom<xdg>/youtrack-cli/while the MCP env file landed in~/.config/youtrack-cli/, so the two no longer matched.Expose
Instances::root()onyoutrack-config(the already-stored<xdg>/youtrack-cliroot, resolved via the crate-privatexdg_config_home()) and consume it from the installer'sinstallanduninstallsomcp.envalways sits alongsideconfig.yml.render_unitnow takes the resolved absolutemcp.envpath and bakes it intoEnvironmentFile=, since systemd has no$XDG_CONFIG_HOMEspecifier; under the default XDG location this equals the previous~/.config/youtrack-cli/mcp.envin effect. The systemd user-unit directory (~/.config/systemd/user/) stays anchored on$HOMEbecause it is owned by systemd's own lookup, not by the app. Doc comments updated; render test now covers the default-XDG path and a custom-$XDG_CONFIG_HOMEpath.#YT-41
The `yt mcp service` installer hardcoded `home.join(".config").join("youtrack-cli")` for the `mcp.env` path (install + uninstall) and baked a fixed `EnvironmentFile=%h/.config/youtrack-cli/mcp.env` into the unit, diverging from the CLI, which resolves its config root through `youtrack-config` and honors `$XDG_CONFIG_HOME`. Under a custom `$XDG_CONFIG_HOME` the CLI read `config.yml` from `<xdg>/youtrack-cli/` while the MCP env file landed in `~/.config/youtrack-cli/`, so the two no longer matched. Expose `Instances::root()` on `youtrack-config` (the already-stored `<xdg>/youtrack-cli` root, resolved via the crate-private `xdg_config_home()`) and consume it from the installer's `install` and `uninstall` so `mcp.env` always sits alongside `config.yml`. `render_unit` now takes the resolved absolute `mcp.env` path and bakes it into `EnvironmentFile=`, since systemd has no `$XDG_CONFIG_HOME` specifier; under the default XDG location this equals the previous `~/.config/youtrack-cli/mcp.env` in effect. The systemd user-unit directory (`~/.config/systemd/user/`) stays anchored on `$HOME` because it is owned by systemd's own lookup, not by the app. Doc comments updated; render test now covers the default-XDG path and a custom-`$XDG_CONFIG_HOME` path. #YT-41