fix(cli): correct tab completion script path resolution#879
Merged
mikolalysenko merged 1 commit intomainfrom Nov 5, 2025
Merged
fix(cli): correct tab completion script path resolution#879mikolalysenko merged 1 commit intomainfrom
mikolalysenko merged 1 commit intomainfrom
Conversation
Fixes incorrect path to socket-completion.bash when running from built CLI. The rootPath calculation was not accounting for code running from the `build/` directory, causing it to resolve one level too high (`/packages/` instead of `/packages/cli/`). Now checks if __dirname ends with 'dist' or 'build' to correctly determine the root path in all execution contexts. Also fixes import extensions from .mjs to .mts for consistency.
mikolalysenko
approved these changes
Nov 5, 2025
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
Fixes incorrect path to
socket-completion.bashwhen running the CLI from built distribution.Before:
/Users/jdalton/projects/socket-cli/packages/data/socket-completion.bash❌After:
/Users/jdalton/projects/socket-cli/packages/cli/data/socket-completion.bash✓Problem
When running
socket install completion, the CLI failed with:The root cause was in
src/constants/paths.mts:46-48. TherootPathcalculation didn't account for code running from thebuild/directory (in addition todist/), causing path resolution to go one level too high (/packages/instead of/packages/cli/).Solution
Updated path resolution logic to check if
__dirnameends with either'dist'or'build', correctly determining the root path in all execution contexts:src/constants/→ root ispackages/cli/build/→ root ispackages/cli/dist/→ root ispackages/cli/Changes
rootPathcalculation insrc/constants/paths.mtsbuild/anddist/directories.mjsto.mtsfor consistencyTest Plan
socket install completionworks correctlysocket uninstall completionworks correctlypnpm build && node dist/index.js install completion socket🤖 Generated with Claude Code