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:
@@ -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`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user