fix: use $HOME instead of ~ in installed shell command paths (#1284)
The installer pathPrefix for global installs replaced os.homedir() with ~, which does NOT expand inside double-quoted shell commands in POSIX shells. This caused MODULE_NOT_FOUND errors when executing commands like: node "~/.claude/get-shit-done/bin/gsd-tools.cjs" Changed pathPrefix to use $HOME instead of ~, which correctly expands inside double quotes. Also fixed a quoted-tilde instance in do.md. - bin/install.js: $HOME prefix instead of ~ for global installs - get-shit-done/workflows/do.md: node "$HOME/..." instead of "~/" - tests/path-replacement.test.cjs: updated + 3 new regression tests Closes #1284 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3668,12 +3668,14 @@ function install(isGlobal, runtime = 'claude') {
|
||||
|
||||
// Path prefix for file references in markdown content (e.g. gsd-tools.cjs).
|
||||
// Replaces $HOME/.claude/ or ~/.claude/ so the result is <pathPrefix>get-shit-done/bin/...
|
||||
// For global installs: use ~/ so paths work across environments (e.g. Docker
|
||||
// containers mounting ~/.claude from a Windows host where os.homedir() differs).
|
||||
// For global installs: use $HOME/ so paths expand correctly inside double-quoted
|
||||
// shell commands (~ does NOT expand inside double quotes, causing MODULE_NOT_FOUND).
|
||||
// For local installs: use resolved absolute path (may be outside $HOME).
|
||||
const pathPrefix = isGlobal
|
||||
? path.resolve(targetDir).replace(os.homedir(), '~').replace(/\\/g, '/') + '/'
|
||||
: `${path.resolve(targetDir).replace(/\\/g, '/')}/`;
|
||||
const resolvedTarget = path.resolve(targetDir).replace(/\\/g, '/');
|
||||
const homeDir = os.homedir().replace(/\\/g, '/');
|
||||
const pathPrefix = isGlobal && resolvedTarget.startsWith(homeDir)
|
||||
? '$HOME' + resolvedTarget.slice(homeDir.length) + '/'
|
||||
: `${resolvedTarget}/`;
|
||||
|
||||
let runtimeLabel = 'Claude Code';
|
||||
if (isOpencode) runtimeLabel = 'OpenCode';
|
||||
|
||||
Reference in New Issue
Block a user