fix: only deactivate on a standalone "stop ponytail" / "normal mode" (#162)

The deactivation check matched the phrase anywhere in the prompt, so an
ordinary request like "add a normal mode toggle" silently turned ponytail
off for the rest of the session. Match the whole message instead (trimmed,
case-insensitive, trailing punctuation ignored) through a shared helper used
by both the Claude/Codex hook and the pi extension.

Fixes #161
This commit is contained in:
Lakshya77089
2026-06-18 22:50:03 +02:00
committed by GitHub
parent 955fff537c
commit 53fd1e850e
5 changed files with 43 additions and 3 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
// ponytail — UserPromptSubmit hook to track which ponytail mode is active
// Inspects user input for /ponytail commands and writes mode to flag file
const { getDefaultMode } = require('./ponytail-config');
const { getDefaultMode, isDeactivationCommand } = require('./ponytail-config');
const { clearMode, setMode, writeHookOutput } = require('./ponytail-runtime');
let input = '';
@@ -45,7 +45,7 @@ process.stdin.on('end', () => {
}
// Detect deactivation
if (/\b(stop ponytail|normal mode)\b/i.test(prompt)) {
if (isDeactivationCommand(prompt)) {
clearMode();
writeHookOutput('UserPromptSubmit', 'off', 'PONYTAIL MODE OFF');
}