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