Fix for #168: Don't write output on SessionStart for Copilot (#181)

* Added isCopilot flag from runtime and check that in the hooks

* When going into off mode, check if codex or copilot
This commit is contained in:
Max Felker II
2026-06-19 10:50:55 +02:00
committed by GitHub
parent ff5d0936be
commit 0403c4dd50
+4 -2
View File
@@ -13,6 +13,7 @@ const { getPonytailInstructions } = require('./ponytail-instructions');
const { const {
clearMode, clearMode,
isCodex, isCodex,
isCopilot,
setMode, setMode,
writeHookOutput, writeHookOutput,
} = require('./ponytail-runtime'); } = require('./ponytail-runtime');
@@ -25,7 +26,8 @@ const mode = getDefaultMode();
// "off" mode — skip activation entirely, don't write flag or emit rules // "off" mode — skip activation entirely, don't write flag or emit rules
if (mode === 'off') { if (mode === 'off') {
clearMode(); clearMode();
writeHookOutput('SessionStart', 'off', isCodex ? '' : 'OK'); const hookOutput = (isCodex || isCopilot) ? '' : 'OK';
writeHookOutput('SessionStart', 'off', hookOutput);
process.exit(0); process.exit(0);
} }
@@ -40,7 +42,7 @@ try {
let output = getPonytailInstructions(mode); let output = getPonytailInstructions(mode);
// 3. Detect missing statusline config — nudge Claude to help set it up // 3. Detect missing statusline config — nudge Claude to help set it up
if (!isCodex) try { if (!isCodex && !isCopilot) try {
let hasStatusline = false; let hasStatusline = false;
if (fs.existsSync(settingsPath)) { if (fs.existsSync(settingsPath)) {
// Strip UTF-8 BOM some editors prepend on Windows (breaks JSON.parse) // Strip UTF-8 BOM some editors prepend on Windows (breaks JSON.parse)