Skip to content

Conversation

@jy-tan
Copy link
Contributor

@jy-tan jy-tan commented Feb 2, 2026

Summary

Migrate default config path from ~/.fence.json to OS-preferred locations (~/.config/fence/fence.json on Linux, ~/Library/Application Support/fence/fence.json on macOS) while maintaining backward compatibility with the legacy path.

Resolves #25.

Changes

  • Config path resolution: DefaultConfigPath() now follows XDG conventions (Linux) and uses ~/Library/Application Support (macOS), with automatic fallback to ~/.fence.json if only the legacy file exists
  • Import command UX:
    • Add --save flag to write directly to the default config path
    • Add overwrite confirmation prompt when target file exists
    • Make --save and -o mutually exclusive
    • Preview mode (no flags) prints JSON to stdout without modifying files
  • Documentation: Update all docs and help text to reflect the new config paths

Migration Path

Existing users with ~/.fence.json will continue to work automatically. New users will get the XDG-compliant path. Users can explicitly migrate by moving their config to the new location.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 8 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="docs/library.md">

<violation number="1" location="docs/library.md:86">
P2: The example hard-codes a Linux path with `~`, but `LoadConfig` doesn’t expand `~` and macOS uses a different default. This makes the sample misleading and non-portable. Use `fence.DefaultConfigPath()` (or expand `os.UserHomeDir`) in the example instead.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@jy-tan jy-tan merged commit c8621e8 into main Feb 2, 2026
5 checks passed
@jy-tan jy-tan deleted the os-preferred-config-path branch February 2, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change config path to be XDG Base Directory/macOS compliant

2 participants