feat: support XDG_CONFIG_HOME - #431
Open
sebdanielsson wants to merge 4 commits into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds XDG Base Directory support so Unix users with an absolute XDG_CONFIG_HOME store generated resources and rc.toml under $XDG_CONFIG_HOME/inshellisense, while preserving the legacy ~/.inshellisense behavior for Windows and non-absolute/unset XDG values.
Changes:
- Introduce XDG-aware resource/config path resolution (
resolveXdgConfigHome,resolveResourcesPath,resolveConfigFilePath) and wire it through constants/config loading. - Generate shell init “source” commands that safely quote absolute XDG paths (including spaces/quotes) while preserving legacy
~/.inshellisensecommands. - Update bash preexec helper resolution and standalone package native-module lookup to respect the same XDG resource root; add focused Jest coverage and docs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/shell.ts | Builds shell source commands with safe quoting; chooses legacy ~/.inshellisense vs XDG absolute paths. |
| src/utils/constants.ts | Centralizes XDG-aware resource + config path resolution and exports computed paths. |
| src/utils/config.ts | Switches XDG config fallback to the resolved XDG-aware xdgConfigPath. |
| src/ui/ui-uninstall.ts | Updates uninstall messaging to reflect “resources” rather than “.inshellisense cache folder”. |
| src/tests/utils/shell.test.ts | Adds unit tests for legacy command preservation and XDG path quoting across shells. |
| src/tests/utils/constants.test.ts | Adds unit tests for XDG path resolution and compatibility fallbacks. |
| shell/shellIntegration.bash | Resolves bash-preexec.sh relative to the integration script location. |
| scripts/pkg.ts | Makes packaged native module lookup prefer XDG resource root when applicable. |
| README.md | Documents XDG_CONFIG_HOME behavior for config and generated resources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
cpendery
reviewed
Jul 31, 2026
cpendery
left a comment
Member
There was a problem hiding this comment.
looks good overall, could we make the change to not break linux/macos users?
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
cpendery
reviewed
Aug 1, 2026
cpendery
left a comment
Member
There was a problem hiding this comment.
A few more notes
- Only the rc file should probably go under the
XDG_CONFIG_HOME, we probably want the native modules / other items to go underXDG_DATA_HOME reinitdoesn't delete the~/.inshellisensedirectory, so it doesn't actually migrate users over to the new configuration location- i think
is doctormight tell users that the config is missing if it's been migrated & the legacy config will still be there, it should get flagged as a legacy configuration, similar to old shell plugins
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Unix users who configure
XDG_CONFIG_HOMEcurrently still get generated resources and shell integrations under~/.inshellisense. This adds XDG-aware storage while preserving existing installations and Windows behavior.Approach
$XDG_CONFIG_HOME/inshellisensefor generated resources andrc.tomlwhenXDG_CONFIG_HOMEis an absolute Unix path.~/.inshellisensefor unset, empty, relative, or Windows values, while retaining the existing~/.config/inshellisense/rc.tomlconfig fallback.Users moving from the legacy resource path can regenerate resources with
is initoris reinit, then source the newly generated XDG plugin path.Validation
Closes #423