refactor: server-side user prompt construction with @pullfrog tag check (#123)

- Move prompt construction logic from action-side to server-side (webhook handler and trigger page)
- Include issue/comment body in USER PROMPT only if @pullfrog was tagged (checked server-side using containsTriggerPhrase)
- Add repoInstructions as separate REPO-LEVEL INSTRUCTIONS section in FULL prompt
- Macro-expand repoInstructions server-side before sending to action
- Trigger page never includes body (manual triggers)
- Remove redundant customInstructions field (now combined into prompt server-side)

files changed:
- action/external.ts: add repoInstructions to WriteablePayload, remove customInstructions
- action/utils/payload.ts: add repoInstructions to JsonPayload schema, remove customInstructions
- action/utils/repoSettings.ts: add repoInstructions to RepoSettings interface
- action/utils/instructions.ts: use payload.prompt directly, add repo section to full prompt, add repo field to ResolvedInstructions
- utils/webhooks/handleWebhook.ts: check @pullfrog tag and include body if tagged, macro-expand repoInstructions
- app/trigger/[owner]/[repo]/[number]/page.tsx: macro-expand repoInstructions (never include body)
This commit is contained in:
Colin McDonnell
2026-01-19 17:16:20 +00:00
committed by pullfrog[bot]
parent 26ced25a8f
commit 995b39a122
5 changed files with 38 additions and 3 deletions
+2
View File
@@ -21,6 +21,7 @@ const JsonPayload = type({
"~pullfrog": "true",
"agent?": AgentName.or("null"),
"prompt?": "string",
"repoInstructions?": "string",
"event?": "object",
"effort?": Effort,
});
@@ -123,6 +124,7 @@ export function resolvePayload(repoSettings: RepoSettings) {
// inverted: jsonPayload.prompt extracts the text from the JSON payload,
// whereas inputs.prompt IS the raw JSON string when internally dispatched
prompt: jsonPayload?.prompt ?? inputs.prompt,
repoInstructions: jsonPayload?.repoInstructions,
event,
effort: inputs.effort ?? jsonPayload?.effort ?? "auto",
cwd: resolveCwd(inputs.cwd),