Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions hooks/ponytail-activate.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ const mode = getDefaultMode();
// "off" mode — skip activation entirely, don't write flag or emit rules
if (mode === 'off') {
clearMode();
const hookOutput = (isCodex || isCopilot) ? '' : 'OK';
writeHookOutput('SessionStart', 'off', hookOutput);
process.exit(0);
}

Expand Down
37 changes: 37 additions & 0 deletions tests/hooks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,43 @@ const home = path.join(temp, 'home');
const pluginData = path.join(temp, 'plugin-data');
fs.mkdirSync(home, { recursive: true });

// Off-mode SessionStart must clear stale state without emitting model-visible
// output on any harness.
for (const { label, env, statePath } of [
{
label: 'Claude',
env: { HOME: home, USERPROFILE: home, PONYTAIL_DEFAULT_MODE: 'off' },
statePath: path.join(home, '.claude', '.ponytail-active'),
},
{
label: 'Codex',
env: {
HOME: home,
USERPROFILE: home,
PLUGIN_DATA: pluginData,
PONYTAIL_DEFAULT_MODE: 'off',
},
statePath: path.join(pluginData, '.ponytail-active'),
},
{
label: 'Copilot',
env: {
HOME: home,
USERPROFILE: home,
COPILOT_PLUGIN_DATA: path.join(temp, 'copilot-off-data'),
PONYTAIL_DEFAULT_MODE: 'off',
},
statePath: path.join(temp, 'copilot-off-data', '.ponytail-active'),
},
]) {
fs.mkdirSync(path.dirname(statePath), { recursive: true });
fs.writeFileSync(statePath, 'full');
const offResult = run('ponytail-activate.js', env);
assert.equal(offResult.status, 0, offResult.stderr);
assert.equal(offResult.stdout, '', `${label} SessionStart must stay silent when ponytail is off`);
assert.equal(fs.existsSync(statePath), false, `${label} stale mode state must be cleared`);
}

// USERPROFILE alongside HOME: os.homedir() reads USERPROFILE on Windows, HOME on POSIX.
const codexEnv = {
HOME: home,
Expand Down