diff --git a/prompt.md b/prompt.md index 4ed59b8..b03df2c 100644 --- a/prompt.md +++ b/prompt.md @@ -13,15 +13,17 @@ response ends, so background monitors, scheduled wake-ups, and queued tasks never resume. Never promise future action and never claim to be waiting on a notification. -For a `pull_request` event, review the PR without changing code. Your final -response is posted as a pull request review from the bot account: it requests -changes when it mentions `@bot` and approves otherwise. So include `@bot` with -instructions to fix the findings exactly when changes are needed, and never -mention `@bot` when the PR is ready. For UI changes, check that the result is -aligned, clean, and pixel-perfect, and that included screenshots prove the -intended result was achieved. Also check the whole repository, not only the -diff, against the code rules at the end of this prompt, and request changes for -every violation you find even when the diff did not cause it. +For a `pull_request` event, review the PR without changing code, using the +`requesting-code-review` skill from superpowers: run its code reviewer template +against the PR's base and head, and make its complete output your final response +instead of the short comment style above. Check the whole repository against the +code rules at the end of this prompt, not only the diff; a violation is at least +Important even when the diff did not cause it. Your final response is posted as +a pull request review from the bot account: it requests changes when it mentions +`@bot` and approves otherwise, so the assessment instructs `@bot` to make the +fixes exactly when it is not `Yes`, and Minor issues alone never block. For UI +changes, check that the result is aligned, clean, and pixel-perfect, and that +included screenshots prove the intended result was achieved. For an `issue_comment` or `pull_request_review_comment` event, treat the `body` in the triggering comment payload below as the user's exact instruction. diff --git a/run.ts b/run.ts index 355aa01..8978dde 100644 --- a/run.ts +++ b/run.ts @@ -68,16 +68,32 @@ async function postResult(body: string): Promise { }); } +async function run(command: string, args: string[]): Promise { + const { success, code } = await new Deno.Command(command, { args }).output(); + if (!success) throw new Error(`${command} ${args[0]} exited with ${code}`); +} + // Commits belong to the same account as the pull request they end up in. async function configureGitAuthor(): Promise { const user: GiteaUser = await (await gitea(AUTHOR_TOKEN, "user")).json(); for (const [key, value] of [["name", user.login], ["email", user.email]]) { - await new Deno.Command("git", { - args: ["config", "--global", `user.${key}`, value], - }).output(); + await run("git", ["config", "--global", `user.${key}`, value]); } } +// The superpowers plugin gives the agent its skills, including the code review +// one that the prompt asks for. Both installs are idempotent on the persisted +// home. +async function installSuperpowers(bot: string): Promise { + const commands = bot === "claude" + ? [ + ["plugin", "marketplace", "add", "obra/superpowers-marketplace"], + ["plugin", "install", "-y", "superpowers@superpowers-marketplace"], + ] + : [["plugin", "add", "superpowers@openai-curated-remote"]]; + for (const args of commands) await run(bot, args); +} + async function renderPrompt(): Promise { const comments: GiteaComment[] = await (await gitea( REVIEWER_TOKEN, @@ -111,6 +127,7 @@ async function runClaude(prompt: string): Promise { ); Deno.exit(1); } + await installSuperpowers("claude"); const claude = new Deno.Command("claude", { args: [ "--print", @@ -174,6 +191,7 @@ async function runCodex(prompt: string): Promise { }) .output(); if (!loggedIn.success) await codexDeviceLogin(); + await installSuperpowers("codex"); const file = await Deno.makeTempFile(); const status = await new Deno.Command("codex", { args: [