Skip to content

fix(config): show the real per-OS user config path in docs and output / 修正各平台用户配置路径文档与输出#4157

Merged
esengine merged 1 commit into
main-v2from
fix/macos-config-path-docs
Jun 12, 2026
Merged

fix(config): show the real per-OS user config path in docs and output / 修正各平台用户配置路径文档与输出#4157
esengine merged 1 commit into
main-v2from
fix/macos-config-path-docs

Conversation

@esengine

Copy link
Copy Markdown
Owner

Summary

  • os.UserConfigDir() returns ~/Library/Application Support on macOS and %AppData% on Windows, but the rendered config.toml header 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.
  • Render the resolved user-config path (home-collapsed to ~/…) into the config.toml header via a new userConfigDisplayPath(), instead of a hardcoded Linux path. The file a macOS user opens now shows ~/Library/Application Support/reasonix/config.toml.
  • Document the three OS locations in README / README.zh-CN / GUIDE / GUIDE.zh-CN / MIGRATING / SPEC and the internal/config + internal/cli/model.go comments.

Keeping os.UserConfigDir() as the source of truth is deliberate — a ~/.config fallback would split state across two trees (the exact dual-directory mess from the report), and macOS's os.UserConfigDir() ignores XDG_CONFIG_HOME anyway. 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/ — adds TestUserConfigDisplayPathCollapsesHome (home-collapse + reasonix/config.toml suffix, no absolute home leak) and TestRenderTOMLHeaderShowsResolvedConfigPath (header uses the resolved path), both green on Linux/macOS/Windows env layouts.
  • go build ./..., go vet ./internal/config/.

Closes #4148

@esengine esengine requested a review from SivanCola as a code owner June 12, 2026 08:28
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development tui Terminal UI / CLI (internal/cli, internal/control) config Configuration & setup (internal/config) labels Jun 12, 2026
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.
@esengine esengine force-pushed the fix/macos-config-path-docs branch from 07d9a36 to bf67b45 Compare June 12, 2026 08:35
@esengine esengine merged commit ffaba9b into main-v2 Jun 12, 2026
13 checks passed
@esengine esengine deleted the fix/macos-config-path-docs branch June 12, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration & setup (internal/config) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: os.UserConfigDir() != ~/.config/ — config write path broken, sandbox prevents fixing it

1 participant