fix(#1477): warn on marker-write failure; writer fault-injection test

Address re-review minors on #1487:
- bin/install.js: replace the silent .gsd-source marker catch with a
  console.warn so a failed write is diagnosable (walk-up also fails on the
  Claude-global layout, so a swallowed error still breaks /gsd-surface).
- tests/runtime-artifact-layout.test.cjs: add a writer fault-injection case
  (mock fs.writeFileSync to throw for the marker) proving the catch branch is
  reachable, install stays non-fatal, and the warning is emitted.
This commit is contained in:
Joe Slitzker
2026-06-26 16:43:31 -05:00
parent d9c8df04d7
commit bc2e4395ac
2 changed files with 52 additions and 2 deletions

View File

@@ -9912,7 +9912,12 @@ function install(isGlobal, runtime = 'claude', options = {}) {
if (fs.existsSync(gsdSourceCommands)) {
try {
fs.writeFileSync(path.join(targetDir, '.gsd-source'), gsdSourceCommands + '\n', 'utf8');
} catch (_) { /* non-fatal: surface degrades to walk-up resolution */ }
} catch (err) {
// Non-fatal: install proceeds. But on the Claude-global layout walk-up
// also fails (no commands/gsd source tree), so a silent write failure
// still leaves /gsd-surface broken at runtime — warn so it's diagnosable.
console.warn(` ${yellow}!${reset} Could not write .gsd-source marker (${err.message}); /gsd-surface list/status may fail`);
}
}
}