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
14 changes: 9 additions & 5 deletions hooks/ponytail-mode-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ function finish() {
}

if (isReportOnly) {
writeHookOutput(
'UserPromptSubmit',
mode,
'PONYTAIL MODE ACTIVE — level: ' + mode,
);
// On Qoder the ruleset block below already reports; a second write
// here would put two JSON objects on stdout.
if (!isQoder) {
writeHookOutput(
'UserPromptSubmit',
mode,
'PONYTAIL MODE ACTIVE — level: ' + mode,
);
}
} else if (mode && mode !== 'off') {
setMode(mode);
modeSwitched = true;
Expand Down
17 changes: 17 additions & 0 deletions tests/hooks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,23 @@ assert.match(
/PONYTAIL MODE ACTIVE — level: full/,
);

// Bare `/ponytail` on Qoder is report-only: there's no SessionStart, so the
// double-duty block below emits the full ruleset as the report. A second
// confirmation here would push two JSON objects to stdout. The point is that
// the user still gets the ruleset back as one object.
result = run(
'ponytail-mode-tracker.js',
qoderEnv,
JSON.stringify({ prompt: '/ponytail' }),
);
assert.equal(result.status, 0, result.stderr);
output = JSON.parse(result.stdout);
assert.equal(output.hookSpecificOutput.hookEventName, 'UserPromptSubmit');
assert.match(
output.hookSpecificOutput.additionalContext,
/PONYTAIL MODE ACTIVE — level: full/,
);

// /ponytail ultra: mode tracker updates flag and injects ultra ruleset.
result = run(
'ponytail-mode-tracker.js',
Expand Down