feat: add basic prompt submit hook (#694)

This commit is contained in:
jnjpng
2026-01-26 17:41:51 -08:00
committed by GitHub
parent 5776c55728
commit 2edf2bd4b1
3 changed files with 32 additions and 1 deletions

View File

@@ -275,6 +275,19 @@ export async function executeHooks(
const result = await executeHookCommand(hook, input, workingDirectory);
results.push(result);
// Collect feedback from stdout when hook succeeds (exit 0)
// Only for UserPromptSubmit and SessionStart hooks
if (result.exitCode === HookExitCode.ALLOW) {
if (
result.stdout?.trim() &&
(input.event_type === "UserPromptSubmit" ||
input.event_type === "SessionStart")
) {
feedback.push(result.stdout.trim());
}
continue;
}
// Collect feedback from stderr when hook blocks
// Format: [command]: {stderr} per spec
if (result.exitCode === HookExitCode.BLOCK) {