fix(config): show the real per-OS user config path in docs and output / 修正各平台用户配置路径文档与输出#4157
Merged
Merged
Conversation
os.UserConfigDir() resolves to ~/Library/Application Support on macOS and %AppData% on Windows, but the rendered config.toml header and every doc hardcoded ~/.config/reasonix/config.toml — correct only on Linux, so macOS/Windows users put config where it is never read. Render the resolved path (home-collapsed) in the config.toml header and document all three OS locations across README/GUIDE/MIGRATING/SPEC and the package comments.
07d9a36 to
bf67b45
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
os.UserConfigDir()returns~/Library/Application Supporton macOS and%AppData%on Windows, but the renderedconfig.tomlheader and the docs hardcoded~/.config/reasonix/config.toml— correct only on Linux. macOS/Windows users following the docs put their config where the tool never reads it.~/…) into theconfig.tomlheader via a newuserConfigDisplayPath(), instead of a hardcoded Linux path. The file a macOS user opens now shows~/Library/Application Support/reasonix/config.toml.internal/config+internal/cli/model.gocomments.Keeping
os.UserConfigDir()as the source of truth is deliberate — a~/.configfallback would split state across two trees (the exact dual-directory mess from the report), and macOS'sos.UserConfigDir()ignoresXDG_CONFIG_HOMEanyway. This is the documentation/output-alignment fix; the separate "sandboxed agent can't self-edit global config" point is decoupled (mostly by design —reasonix config/reasonix setup/ direct edits run outside the agent sandbox).Test
go test ./internal/config/— addsTestUserConfigDisplayPathCollapsesHome(home-collapse +reasonix/config.tomlsuffix, no absolute home leak) andTestRenderTOMLHeaderShowsResolvedConfigPath(header uses the resolved path), both green on Linux/macOS/Windows env layouts.go build ./...,go vet ./internal/config/.Closes #4148