refactor: migrate installation to XDG Base Directory Specification#1569
Merged
harehare merged 1 commit intoharehare:mainfrom Apr 10, 2026
Merged
refactor: migrate installation to XDG Base Directory Specification#1569harehare merged 1 commit intoharehare:mainfrom
harehare merged 1 commit intoharehare:mainfrom
Conversation
This change aligns mq's installation strategy with industry standards and the
Filesystem Hierarchy Standard (FHS), improving standards compliance,
performance, and organization.
## What Changed
- Binary installation path: ~/.mq/bin/ -> ~/.local/bin/
- Plugin directory: ~/.mq/bin/ -> ~/.local/share/mq/plugins/
- New config directory support: ~/.config/mq/ (for future use)
## Key Features
1. **XDG Base Directory Compliance**
- Respects XDG_DATA_HOME, XDG_CONFIG_HOME environment variables
- Uses standard ~/.local/bin for user binaries
- Uses ~/.local/share/mq/plugins/ for user plugins
2. **Environment Variable Support**
- MQ_HOME: Custom base directory for plugins
- XDG_DATA_HOME: Custom data directory
- XDG_CONFIG_HOME: Custom config directory
3. **Full Backward Compatibility**
- Plugin discovery searches in priority order:
1. $MQ_HOME/plugins
2. $XDG_DATA_HOME/mq/plugins
3. ~/.local/bin/
4. ~/.mq/bin/ (legacy fallback)
5. $PATH directories
- Existing ~/.mq/bin installations continue to work
## Standards Alignment
- FHS: ~/.local/bin is the standard for user-installed binaries
- XDG Base Directory Spec: Proper separation of binaries, data, and config
- Industry practice: Aligns with pipx, cargo, jq, gh, and other tools
## Benefits
- Reduced PATH clutter: ~/.local/bin already typically in PATH
- Faster shell startup: Fewer PATH entries to traverse
- Better organization: Separation of binaries, data, and config
- Standards compliance: Follows FHS and XDG specifications
## Migration
Existing users can:
- Re-run the installer to update paths
- Or manually migrate (see MIGRATION_GUIDE.md)
- Legacy ~/.mq/bin path still works as fallback
Fixes: Standards compliance issues (FHS, XDG)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
08a9a8e to
4693eee
Compare
Author
|
Hi @harehare, love your tool. I have a small refactor that can improve it. |
Owner
|
Thank you for the contribution! Agreed, ~/.local/bin/ is a much better default. |
harehare
approved these changes
Apr 10, 2026
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.
Problem
The current mq installer uses
~/.mq/bin/for binary installation, which doesn't follow the standard~/.local/bin/path used by most tools.Solution
Migrate to
~/.local/bin/following FHS (Filesystem Hierarchy Standard):~/.mq/bin/→~/.local/bin/MQ_HOME,XDG_DATA_HOMEChanges
MQ_BIN_DIRto use~/.local/bin/~/.mq/binto~/.local/binBenefits