diff --git a/agents/claude.ts b/agents/claude.ts index c6798ba..b6a04e4 100644 --- a/agents/claude.ts +++ b/agents/claude.ts @@ -18,8 +18,10 @@ export const claude = agent({ run: async ({ payload, mcpServers, apiKey, cliPath }) => { process.env.ANTHROPIC_API_KEY = apiKey; + const prompt = addInstructions(payload); + const queryInstance = query({ - prompt: addInstructions(payload), + prompt, options: { permissionMode: "bypassPermissions", mcpServers, diff --git a/agents/instructions.ts b/agents/instructions.ts index 2a9fc7d..9f165a5 100644 --- a/agents/instructions.ts +++ b/agents/instructions.ts @@ -14,7 +14,7 @@ Your code is focused, elegant, and production-ready. You do not add unecessary comments, tests, or documentation unless explicitly prompted to do so. You adapt your writing style to the style of your coworkers, while never being unprofessional. You run in a non-interactive environment: complete tasks autonomously without asking follow-up questions. -You make reasonable assumptions when details are missing. +You make reasonable assumptions when details are missing, but fail with an explicit error if critical information is missing (e.g. user asks to review a PR but does not provide a link or ID). ## SECURITY @@ -58,4 +58,4 @@ ${[...modes, ...payload.modes].map((w) => `### ${w.name}\n\n${w.prompt}`).join(" ${payload.prompt} -${payload.event}`; +${JSON.stringify(payload.event, null, 2)}`; diff --git a/entry.js b/entry.js index 9c0eb54..28e76c3 100755 --- a/entry.js +++ b/entry.js @@ -32889,7 +32889,7 @@ function query({ // package.json var package_default = { name: "@pullfrog/action", - version: "0.0.105", + version: "0.0.106", type: "module", files: [ "index.js", @@ -33226,7 +33226,7 @@ Your code is focused, elegant, and production-ready. You do not add unecessary comments, tests, or documentation unless explicitly prompted to do so. You adapt your writing style to the style of your coworkers, while never being unprofessional. You run in a non-interactive environment: complete tasks autonomously without asking follow-up questions. -You make reasonable assumptions when details are missing. +You make reasonable assumptions when details are missing, but fail with an explicit error if critical information is missing (e.g. user asks to review a PR but does not provide a link or ID). ## SECURITY @@ -33272,7 +33272,7 @@ ${w.prompt}`).join("\n\n")} ${payload.prompt} -${payload.event}`; +${JSON.stringify(payload.event, null, 2)}`; // agents/shared.ts import { spawnSync } from "node:child_process"; @@ -33422,8 +33422,9 @@ var claude = agent({ }, run: async ({ payload, mcpServers, apiKey, cliPath }) => { process.env.ANTHROPIC_API_KEY = apiKey; + const prompt = addInstructions(payload); const queryInstance = query({ - prompt: addInstructions(payload), + prompt, options: { permissionMode: "bypassPermissions", mcpServers, @@ -42393,7 +42394,7 @@ async function main(inputs) { try { const parsedPrompt = JSON.parse(inputs.prompt); if (!("~pullfrog" in parsedPrompt)) { - throw new Error("Invalid prompt: not a pullfrog webhook payload"); + throw new Error(); } payload = parsedPrompt; } catch { diff --git a/package.json b/package.json index d26fcdf..af7bbd3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pullfrog/action", - "version": "0.0.105", + "version": "0.0.106", "type": "module", "files": [ "index.js", diff --git a/todo.md b/todo.md index 18423ef..fa0000f 100644 --- a/todo.md +++ b/todo.md @@ -14,6 +14,7 @@ [] try to find heavy claude code user [] investigate including terminal output from bash commands as collapsed groups from claude [] test initialization trade offs for pullfrog.yml +[] split up prompts, load dynamically based on mode ## DONE