* fix(#2775): verify gsd-sdk on PATH before reporting SDK ready `npx get-shit-done-cc@latest` printed `✓ GSD SDK ready` even though `gsd-sdk` was not callable. Root cause: npx only links the package's primary bin (`get-shit-done-cc`); secondary bins like `gsd-sdk` are not materialized into a PATH directory. The installer asserted the weaker invariant "sdk/dist/cli.js exists on disk" and treated it as proof of the stronger invariant "command -v gsd-sdk resolves" — they aren't the same. Fix tightens the gate in installSdkIfNeeded: 1. After confirming the dist is present, walk PATH for an executable `gsd-sdk` shim (isGsdSdkOnPath, no spawn). 2. If absent, attempt to materialize the shim via symlink at `~/.local/bin/gsd-sdk` (or the first HOME-rooted PATH dir we can write to), falling back to a copy on filesystems that reject symlinks (trySelfLinkGsdSdk). 3. Re-probe PATH after linking. Only print `✓ GSD SDK ready` when the probe succeeds; otherwise emit a clear ⚠ + remediation. Also strips the misleading "or `npx get-shit-done-cc`" clause from the shim header (it never linked the secondary bin). Closes #2775 * test(#2775): use centralized helpers from helpers.cjs per CONTRIBUTING * fix(#2775): wrapper script in symlink fallback to preserve __dirname resolution CodeRabbit follow-up on PR #2777. The previous symlink-fallback in trySelfLinkGsdSdk used fs.copyFileSync(shimSrc, target), but bin/gsd-sdk.js resolves the CLI via path.resolve(__dirname, '..', 'sdk', 'dist', 'cli.js'). After a copy, __dirname becomes the link directory (e.g. ~/.local/bin), so the resolved CLI path was broken (~/.local/sdk/dist/cli.js) — and isGsdSdkOnPath() only checked file existence + execute bit, so the success line still printed over a broken install. Replace the copy with a tiny wrapper script that require()s the real shim by absolute path. This preserves __dirname inside bin/gsd-sdk.js because the require runs against shimSrc's own location. Also fixes the PATH restoration nit in the regression test (was coercing undefined to the string "undefined" if PATH was unset). Adds a behavioral fallback test that mocks fs.symlinkSync to throw, exercises the fallback path, and asserts the resulting target is a require()-wrapper (not a verbatim copy) and is executable. * fix(#2775): PATH-backed dir ordering + tighten captureConsole + drop tautological assertion (CodeRabbit follow-up)
1.5 KiB
Executable File
1.5 KiB
Executable File