fix(keyword-detector): stop hyperplan firing on '.hpp' C++ header paths (fixes #4215)
The hyperplan trigger \b(hyperplan|hpp)\b/i matched 'hpp' inside common C++ header references like 'check interface.hpp' or 'open buffer.hpp'. The leading '.' is a non-word character, so \b is already satisfied and the false positive fires the hyperplan-mode prompt on routine code questions.
Split the alternation so 'hpp' additionally requires that the preceding character is neither a word character nor a '.'. This preserves every existing trigger ('hpp do this', '/hpp ...', mid-sentence usage, mixed case) while rejecting filename uses of the .hpp extension. The longer 'hyperplan' keyword keeps the original \b boundary semantics.
Reproduction (added regression tests):
- 'please help to check interface.hpp' must NOT fire
- 'open src/include/audio/buffer.hpp and fix the leak' must NOT fire
All 14 cases in hyperplan.test.ts pass (12 existing + 2 new), broader keyword-detector suite stays green (92 pass), typecheck clean.
This commit is contained in:
@@ -8,9 +8,14 @@
|
||||
*
|
||||
* The detector injects a thin wrapper that loads the `hyperplan` skill, which
|
||||
* carries the full orchestration instructions for the 5-member adversarial team.
|
||||
*
|
||||
* The `hpp` shorthand uses an extra negative-lookbehind so that the very common
|
||||
* C++ header-file extension `.hpp` (e.g. `interface.hpp`, `src/buffer.hpp`)
|
||||
* does NOT falsely trigger hyperplan mode. A leading `.` would otherwise
|
||||
* satisfy `\b` because the dot is a non-word character. See issue #4215.
|
||||
*/
|
||||
|
||||
export const HYPERPLAN_PATTERN = /\b(hyperplan|hpp)\b/i
|
||||
export const HYPERPLAN_PATTERN = /\bhyperplan\b|(?<![\w.])hpp\b/i
|
||||
|
||||
export const HYPERPLAN_MESSAGE = `<hyperplan-mode>
|
||||
**MANDATORY**: Say "HYPERPLAN MODE ENABLED!" as your first response, exactly once.
|
||||
|
||||
Reference in New Issue
Block a user