diff --git a/hooks/ponytail-runtime.js b/hooks/ponytail-runtime.js index 2aa61a31..89c4d1f6 100644 --- a/hooks/ponytail-runtime.js +++ b/hooks/ponytail-runtime.js @@ -13,8 +13,12 @@ if (isCopilot) stateDir = process.env.COPILOT_PLUGIN_DATA; const statePath = path.join(stateDir, STATE_FILE); function setMode(mode) { - fs.mkdirSync(path.dirname(statePath), { recursive: true }); - fs.writeFileSync(statePath, mode); + try { + fs.mkdirSync(path.dirname(statePath), { recursive: true }); + fs.writeFileSync(statePath, mode); + } catch (e) { + // Fail silently rather than crash the hook + } } function clearMode() { diff --git a/tests/copilot-plugin.test.js b/tests/copilot-plugin.test.js index dbb45d18..c1246692 100644 --- a/tests/copilot-plugin.test.js +++ b/tests/copilot-plugin.test.js @@ -13,6 +13,8 @@ const REQUIRED_COMMAND_FILES = [ 'ponytail-review.toml', 'ponytail-audit.toml', 'ponytail-debt.toml', + 'ponytail-gain.toml', + 'ponytail-help.toml', ]; function readJSON(relPath) {