fix: use ~/ instead of resolved absolute paths in global install

On Windows, install.js resolves $HOME to the absolute path
(e.g. C:/Users/matte/.claude/) in all workflow .md files.
This breaks when ~/.claude is mounted into a Docker container
where the path doesn't exist — Node interprets the Windows path
as relative to CWD, producing paths like:
/workspace/project/C:/Users/matte/.claude/get-shit-done/bin/gsd-tools.cjs

For global installs, replace os.homedir() with ~ in pathPrefix
so that paths like ~/.claude/get-shit-done/bin/gsd-tools.cjs
work correctly across all environments.

Local installs keep using resolved absolute paths since they
may be outside $HOME.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matteo Michele Bianchini
2026-03-18 09:57:33 +00:00
parent 4915d28f98
commit 8c1b224474
2 changed files with 106 additions and 3 deletions

View File

@@ -2411,9 +2411,12 @@ 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/...
// Always use absolute path so: (1) local installs work when GSD is outside $HOME,
// (2) spawned subagents with empty $HOME still resolve the path (fixes #820).
const pathPrefix = `${path.resolve(targetDir).replace(/\\/g, '/')}/`;
// For global installs: use ~/ so paths work across environments (e.g. Docker
// containers mounting ~/.claude from a Windows host where os.homedir() differs).
// 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, '/')}/`;
let runtimeLabel = 'Claude Code';
if (isOpencode) runtimeLabel = 'OpenCode';