diff --git a/README.md b/README.md index 74b9b21..fa25895 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Kompass keeps AI coding agents on course with token-efficient, composable workfl ## Bundled Surface -- Commands cover direct work (`/ask`, `/commit`, `/merge`, `/skill/create`, `/skill/optimize`), orchestration (`/dev`, `/ship`, `/todo`), ticket planning/sync, and PR review/shipping flows. +- Commands cover direct work (`/ask`, `/commit`, `/merge`, `/skill/create`, `/skill/optimize`), orchestration (`/dev`, `/ship`, `/todo`, `/loop/pr/fix`), ticket planning/sync, and PR review/shipping flows. - Agents are intentionally narrow: `worker` is generic, `planner` is no-edit planning, `navigator` owns multi-step orchestration, and `reviewer` is a no-edit review specialist. - Structured tools keep workflows grounded in repo and GitHub state: `changes_load`, `command_expansion` (resolve a slash command and return the expanded prompt for immediate delegation), `pr_load`, `pr_sync`, `ticket_load`, `ticket_sync`. - Reusable command-template components live in `packages/core/components/` and are documented in the components reference. diff --git a/kompass.jsonc b/kompass.jsonc index 664c0df..ad61bfa 100644 --- a/kompass.jsonc +++ b/kompass.jsonc @@ -17,6 +17,7 @@ "commit-and-push": { "enabled": true }, "dev": { "enabled": true }, "learn": { "enabled": true }, + "loop/pr/fix": { "enabled": true }, "merge": { "enabled": true }, "pr/create": { "enabled": true }, "pr/fix": { "enabled": true }, diff --git a/kompass.schema.json b/kompass.schema.json index f44e721..2faf9b6 100644 --- a/kompass.schema.json +++ b/kompass.schema.json @@ -50,6 +50,9 @@ "learn": { "$ref": "#/$defs/commandConfig" }, + "loop/pr/fix": { + "$ref": "#/$defs/commandConfig" + }, "merge": { "$ref": "#/$defs/commandConfig" }, @@ -106,6 +109,7 @@ "commit-and-push", "dev", "learn", + "loop/pr/fix", "merge", "pr/create", "pr/fix", @@ -136,6 +140,7 @@ "commit-and-push", "dev", "learn", + "loop/pr/fix", "merge", "pr/create", "pr/fix", diff --git a/packages/core/commands/index.ts b/packages/core/commands/index.ts index 8e139e0..8b01c89 100644 --- a/packages/core/commands/index.ts +++ b/packages/core/commands/index.ts @@ -51,6 +51,11 @@ export const commandDefinitions: Record = { templatePath: "commands/learn.md", subtask: false, }, + "loop/pr/fix": { + description: "Watch PR CI and comments, repeatedly fixing both without approval prompts", + agent: "navigator", + templatePath: "commands/loop/pr/fix.md", + }, merge: { description: "Merge a branch and auto-resolve conflicts best-effort", agent: "worker", @@ -62,7 +67,7 @@ export const commandDefinitions: Record = { templatePath: "commands/pr/create.md", }, "pr/fix": { - description: "Fix PR feedback, push updates, and reply", + description: "Fix PR feedback or CI failures, push updates, and reply", agent: "worker", templatePath: "commands/pr/fix.md", subtask: false, diff --git a/packages/core/commands/loop/pr/fix.md b/packages/core/commands/loop/pr/fix.md new file mode 100644 index 0000000..21550c6 --- /dev/null +++ b/packages/core/commands/loop/pr/fix.md @@ -0,0 +1,93 @@ +## Goal + +Continuously watch a pull request, fix CI failures and PR feedback, commit, push, reply, and repeat until the PR is clean. + +## Additional Context + +Use `` to constrain which feedback should be handled, how aggressive the fix pass should be, or which CI checks matter when the PR has optional checks. +- This command is intentionally non-interactive: do not ask for approval before delegated fix work, commits, pushes, or PR replies. +- CI failures are part of the loop: capture them as actionable work, fix them, push, then watch CI again. + +## Workflow + +### Arguments + + +$ARGUMENTS + + +### Interpret Arguments + +- If `` looks like a PR number or URL, store it as `` +- If `` includes extra fix guidance, CI guidance, or scope constraints, store it as `` +- If empty, leave `` undefined and let `<%= it.config.tools.pr_load.name %>` resolve the default PR context +- Initialize `` as `0` + +### Load PR Context + +<%~ include("@load-pr", { config: it.config, ref: "", result: "" }) %> + +- Store `` as `` +- Store `` as `` +- STOP if `` or `` is unavailable + +### Watch CI And Comments + +- Run `gh pr checks --watch` to wait for the latest PR checks to finish +- If the command exits successfully, store `` as `green` +- If there are no checks configured for the PR, store `` as `no checks` +- If the command reports failing, cancelled, timed out, missing, or inconclusive checks, store `` with that state and capture the failing check names, URLs, and failure output as `` +- Do not STOP only because CI failed; failed checks are actionable feedback for this loop + +### Reload PR Feedback + +Call `<%= it.config.tools.pr_load.name %>` with `` and store the refreshed result as ``. + +- Review ``, ``, and `` +- Identify open, unresolved, actionable reviewer feedback that has not already been answered by the author or superseded by later commits +- Combine actionable reviewer feedback and `` into `` +- Store the number of actionable reviewer items as `` +- Store the number of actionable CI failures as `` +- If `` and `` are both `0`, continue to `### Output` + +### Delegate Fix Pass + +"> +auto + +Fix all actionable PR review feedback and CI failures from the latest loop pass. +CI status: +CI failures: +Actionable work: +Additional context: + + +- Store the delegated result as `` +- If `` is blocked, incomplete, reports failing validation, or reports that push or PR replies failed, STOP and report the fix blocker +- If `` reports that no changes were made for actionable work, STOP and report that manual follow-up is needed to avoid looping on unchanged CI or feedback +- Otherwise, increment `` by `1` and return to `### Load PR Context` + +### Output + +If stopped by a delegated fix blocker, display: +``` +PR loop blocked for # + +- CI status: +- Fix passes completed: +- Blocker: + +No additional steps are required. +``` + +When complete, display: +``` +PR loop complete for # + +- CI status: +- CI failures remaining: 0 +- Actionable feedback remaining: 0 +- Fix passes completed: + +No additional steps are required. +``` diff --git a/packages/core/commands/pr/fix.md b/packages/core/commands/pr/fix.md index 33f2efc..20584da 100644 --- a/packages/core/commands/pr/fix.md +++ b/packages/core/commands/pr/fix.md @@ -1,10 +1,10 @@ ## Goal -Address feedback on a pull request by making fixes and responding to review threads. +Address feedback or CI failures on a pull request by making fixes and responding to review threads. ## Additional Context -Use `` when prioritizing which review feedback to address first and when deciding how much scope to take on in this pass. +Use `` when prioritizing which review feedback or CI failure to address first and when deciding how much scope to take on in this pass. - Default `/pr/fix` behavior is review-first: show the proposed fix, gather feedback, and loop until the user approves before committing, pushing, or replying on the PR. - Treat `/pr/fix auto` as the explicit opt-in to skip the approval loop and proceed directly from passing validation to commit, push, and PR replies. @@ -45,9 +45,10 @@ Call `<%= it.config.tools.changes_load.name %>` with `base: ` for open, unresolved conversations 2. Check `` for state changes (CHANGES_REQUESTED, etc.) -3. Use `` to understand the current PR diff before deciding what to adjust -4. Prioritize critical issues (bugs, security, broken contracts) -5. Identify which files need changes +3. Include any CI failures, logs, failing check names, or reproduction details provided in `` as actionable feedback +4. Use `` to understand the current PR diff before deciding what to adjust +5. Prioritize critical issues (bugs, security, broken contracts, failing required checks) +6. Identify which files need changes Do not blindly follow every suggestion—some may lead you off course. @@ -85,7 +86,7 @@ Run the most relevant available validation for the fixes: - Keep custom answers enabled so the user can provide concrete feedback - If `` is `0`, ask exactly one `question` with: - header `Need Feedback` - - question `I did not make any changes for this PR feedback. What should I revise or investigate next?` + - question `I did not make any changes for this PR feedback or CI failure. What should I revise or investigate next?` - options: - `Revise` - provide feedback for another pass - `Stop Here` - stop without committing, pushing, or replying on the PR diff --git a/packages/core/kompass.jsonc b/packages/core/kompass.jsonc index 664c0df..ad61bfa 100644 --- a/packages/core/kompass.jsonc +++ b/packages/core/kompass.jsonc @@ -17,6 +17,7 @@ "commit-and-push": { "enabled": true }, "dev": { "enabled": true }, "learn": { "enabled": true }, + "loop/pr/fix": { "enabled": true }, "merge": { "enabled": true }, "pr/create": { "enabled": true }, "pr/fix": { "enabled": true }, diff --git a/packages/core/lib/config.ts b/packages/core/lib/config.ts index 3990717..c5d94a5 100644 --- a/packages/core/lib/config.ts +++ b/packages/core/lib/config.ts @@ -29,6 +29,7 @@ export const DEFAULT_COMMAND_NAMES = [ "commit-and-push", "dev", "learn", + "loop/pr/fix", "merge", "pr/create", "pr/fix", @@ -97,6 +98,7 @@ export interface KompassConfig { "commit-and-push"?: CommandConfig; dev?: CommandConfig; learn?: CommandConfig; + "loop/pr/fix"?: CommandConfig; merge?: CommandConfig; "pr/create"?: CommandConfig; "pr/fix"?: CommandConfig; diff --git a/packages/core/test/commands.test.ts b/packages/core/test/commands.test.ts index c8a87d1..65cd704 100644 --- a/packages/core/test/commands.test.ts +++ b/packages/core/test/commands.test.ts @@ -32,4 +32,14 @@ describe("resolveCommands", () => { assert.match(template, /Do not inspect or modify local code for this PR until `` equals ``/); assert.doesNotMatch(template, /`` differs from `` or `` differs from ``/); }); + + test("orchestrates loop pr fix through ci and delegated auto fixes", async () => { + const commands = await resolveCommands(process.cwd()); + const template = commands["loop/pr/fix"]?.template ?? ""; + + assert.match(template, /gh pr checks --watch/); + assert.match(template, /command="pr\/fix"/); + assert.match(template, /auto /); + assert.doesNotMatch(template, /question/); + }); }); diff --git a/packages/opencode/.opencode/commands/loop/pr/fix.md b/packages/opencode/.opencode/commands/loop/pr/fix.md new file mode 100644 index 0000000..907c8d0 --- /dev/null +++ b/packages/opencode/.opencode/commands/loop/pr/fix.md @@ -0,0 +1,108 @@ +--- +description: Watch PR CI and comments, repeatedly fixing both without approval prompts +agent: navigator +--- + +## Goal + +Continuously watch a pull request, fix CI failures and PR feedback, commit, push, reply, and repeat until the PR is clean. + +## Additional Context + +Use `` to constrain which feedback should be handled, how aggressive the fix pass should be, or which CI checks matter when the PR has optional checks. +- This command is intentionally non-interactive: do not ask for approval before delegated fix work, commits, pushes, or PR replies. +- CI failures are part of the loop: capture them as actionable work, fix them, push, then watch CI again. + +## Workflow + +### Arguments + + +$ARGUMENTS + + +### Interpret Arguments + +- If `` looks like a PR number or URL, store it as `` +- If `` includes extra fix guidance, CI guidance, or scope constraints, store it as `` +- If empty, leave `` undefined and let `kompass_pr_load` resolve the default PR context +- Initialize `` as `0` + +### Load PR Context + +- Use `kompass_pr_load` as the source of truth for PR selection +- If `` is defined, call `kompass_pr_load` with `pr: ` +- Otherwise, call `kompass_pr_load` with no arguments +- Do not run separate git or GitHub commands just to discover the PR before calling `kompass_pr_load` +- Store the result as `` +- Store the PR head branch as `` from `.pr.headRefName` when it is available +- Run `git branch --show-current` and store the trimmed result as `` when it is available +- Run `git rev-parse HEAD` and store the trimmed result as `` when it is available +- Treat the loaded PR body, discussion, review history, and any attachments or linked artifacts returned by the loader as part of the source context +- Review attached images, screenshots, videos, PDFs, and other linked files whenever they can affect the requested fix, review outcome, reproduction steps, or acceptance criteria +- If any relevant attachment cannot be accessed, note that gap and continue only when the remaining PR context is still sufficient to proceed reliably + +- Store `` as `` +- Store `` as `` +- STOP if `` or `` is unavailable + +### Watch CI And Comments + +- Run `gh pr checks --watch` to wait for the latest PR checks to finish +- If the command exits successfully, store `` as `green` +- If there are no checks configured for the PR, store `` as `no checks` +- If the command reports failing, cancelled, timed out, missing, or inconclusive checks, store `` with that state and capture the failing check names, URLs, and failure output as `` +- Do not STOP only because CI failed; failed checks are actionable feedback for this loop + +### Reload PR Feedback + +Call `kompass_pr_load` with `` and store the refreshed result as ``. + +- Review ``, ``, and `` +- Identify open, unresolved, actionable reviewer feedback that has not already been answered by the author or superseded by later commits +- Combine actionable reviewer feedback and `` into `` +- Store the number of actionable reviewer items as `` +- Store the number of actionable CI failures as `` +- If `` and `` are both `0`, continue to `### Output` + +### Delegate Fix Pass + + +auto + +Fix all actionable PR review feedback and CI failures from the latest loop pass. +CI status: +CI failures: +Actionable work: +Additional context: + + +- Store the delegated result as `` +- If `` is blocked, incomplete, reports failing validation, or reports that push or PR replies failed, STOP and report the fix blocker +- If `` reports that no changes were made for actionable work, STOP and report that manual follow-up is needed to avoid looping on unchanged CI or feedback +- Otherwise, increment `` by `1` and return to `### Load PR Context` + +### Output + +If stopped by a delegated fix blocker, display: +``` +PR loop blocked for # + +- CI status: +- Fix passes completed: +- Blocker: + +No additional steps are required. +``` + +When complete, display: +``` +PR loop complete for # + +- CI status: +- CI failures remaining: 0 +- Actionable feedback remaining: 0 +- Fix passes completed: + +No additional steps are required. +``` diff --git a/packages/opencode/.opencode/commands/pr/fix.md b/packages/opencode/.opencode/commands/pr/fix.md index 42945b0..3b281b6 100644 --- a/packages/opencode/.opencode/commands/pr/fix.md +++ b/packages/opencode/.opencode/commands/pr/fix.md @@ -1,15 +1,15 @@ --- -description: Fix PR feedback, push updates, and reply +description: Fix PR feedback or CI failures, push updates, and reply agent: worker --- ## Goal -Address feedback on a pull request by making fixes and responding to review threads. +Address feedback or CI failures on a pull request by making fixes and responding to review threads. ## Additional Context -Use `` when prioritizing which review feedback to address first and when deciding how much scope to take on in this pass. +Use `` when prioritizing which review feedback or CI failure to address first and when deciding how much scope to take on in this pass. - Default `/pr/fix` behavior is review-first: show the proposed fix, gather feedback, and loop until the user approves before committing, pushing, or replying on the PR. - Treat `/pr/fix auto` as the explicit opt-in to skip the approval loop and proceed directly from passing validation to commit, push, and PR replies. @@ -60,9 +60,10 @@ Call `kompass_changes_load` with `base: `, `head: ` for open, unresolved conversations 2. Check `` for state changes (CHANGES_REQUESTED, etc.) -3. Use `` to understand the current PR diff before deciding what to adjust -4. Prioritize critical issues (bugs, security, broken contracts) -5. Identify which files need changes +3. Include any CI failures, logs, failing check names, or reproduction details provided in `` as actionable feedback +4. Use `` to understand the current PR diff before deciding what to adjust +5. Prioritize critical issues (bugs, security, broken contracts, failing required checks) +6. Identify which files need changes Do not blindly follow every suggestion—some may lead you off course. @@ -99,7 +100,7 @@ Run the most relevant available validation for the fixes: - Keep custom answers enabled so the user can provide concrete feedback - If `` is `0`, ask exactly one `question` with: - header `Need Feedback` - - question `I did not make any changes for this PR feedback. What should I revise or investigate next?` + - question `I did not make any changes for this PR feedback or CI failure. What should I revise or investigate next?` - options: - `Revise` - provide feedback for another pass - `Stop Here` - stop without committing, pushing, or replying on the PR diff --git a/packages/opencode/.opencode/kompass.jsonc b/packages/opencode/.opencode/kompass.jsonc index 624904a..d3b5250 100644 --- a/packages/opencode/.opencode/kompass.jsonc +++ b/packages/opencode/.opencode/kompass.jsonc @@ -25,6 +25,9 @@ "learn": { "enabled": true }, + "loop/pr/fix": { + "enabled": true + }, "merge": { "enabled": true }, diff --git a/packages/opencode/README.md b/packages/opencode/README.md index 74b9b21..fa25895 100644 --- a/packages/opencode/README.md +++ b/packages/opencode/README.md @@ -18,7 +18,7 @@ Kompass keeps AI coding agents on course with token-efficient, composable workfl ## Bundled Surface -- Commands cover direct work (`/ask`, `/commit`, `/merge`, `/skill/create`, `/skill/optimize`), orchestration (`/dev`, `/ship`, `/todo`), ticket planning/sync, and PR review/shipping flows. +- Commands cover direct work (`/ask`, `/commit`, `/merge`, `/skill/create`, `/skill/optimize`), orchestration (`/dev`, `/ship`, `/todo`, `/loop/pr/fix`), ticket planning/sync, and PR review/shipping flows. - Agents are intentionally narrow: `worker` is generic, `planner` is no-edit planning, `navigator` owns multi-step orchestration, and `reviewer` is a no-edit review specialist. - Structured tools keep workflows grounded in repo and GitHub state: `changes_load`, `command_expansion` (resolve a slash command and return the expanded prompt for immediate delegation), `pr_load`, `pr_sync`, `ticket_load`, `ticket_sync`. - Reusable command-template components live in `packages/core/components/` and are documented in the components reference. diff --git a/packages/opencode/kompass.jsonc b/packages/opencode/kompass.jsonc index 664c0df..ad61bfa 100644 --- a/packages/opencode/kompass.jsonc +++ b/packages/opencode/kompass.jsonc @@ -17,6 +17,7 @@ "commit-and-push": { "enabled": true }, "dev": { "enabled": true }, "learn": { "enabled": true }, + "loop/pr/fix": { "enabled": true }, "merge": { "enabled": true }, "pr/create": { "enabled": true }, "pr/fix": { "enabled": true }, diff --git a/packages/opencode/test/commands-config.test.ts b/packages/opencode/test/commands-config.test.ts index dea389d..66fe753 100644 --- a/packages/opencode/test/commands-config.test.ts +++ b/packages/opencode/test/commands-config.test.ts @@ -34,6 +34,7 @@ describe("applyCommandsConfig", () => { const expectedCommands = [ "ask", "branch", + "loop/pr/fix", "merge", "pr/create", "pr/review", @@ -73,11 +74,13 @@ describe("applyCommandsConfig", () => { assert.equal(cfg.command!["ask"]?.agent, "worker"); assert.equal(cfg.command!["ticket/ask"]?.agent, "worker"); assert.equal(cfg.command!["dev"]?.agent, "navigator"); + assert.equal(cfg.command!["loop/pr/fix"]?.agent, "navigator"); assert.equal(cfg.command!["ship"]?.agent, "navigator"); assert.equal(cfg.command!["todo"]?.agent, "navigator"); assert.equal(cfg.command!["ticket/dev"]?.agent, "navigator"); assert.ok(cfg.command!["pr/review"]?.description); assert.ok(cfg.command!["dev"]?.template); + assert.ok(cfg.command!["loop/pr/fix"]?.template); assert.ok(cfg.command!["branch"]?.template); }); }); @@ -377,6 +380,7 @@ describe("applyCommandsConfig", () => { assert.equal(cfg.command!["pr/fix"]?.subtask, false); assert.equal(cfg.command!["pr/review"]?.subtask, true); assert.equal(cfg.command!["dev"]?.subtask, true); + assert.equal(cfg.command!["loop/pr/fix"]?.subtask, true); assert.equal(cfg.command!["ship"]?.subtask, true); assert.equal(cfg.command!["todo"]?.subtask, true); }); @@ -391,6 +395,7 @@ describe("applyCommandsConfig", () => { assert.equal(cfg.command!["pr/fix"]?.subtask, false); assert.equal(cfg.command!["pr/review"]?.subtask, false); assert.equal(cfg.command!["dev"]?.subtask, false); + assert.equal(cfg.command!["loop/pr/fix"]?.subtask, false); assert.equal(cfg.command!["ship"]?.subtask, false); assert.equal(cfg.command!["todo"]?.subtask, false); }); @@ -456,6 +461,7 @@ describe("applyCommandsConfig", () => { assert.ok(cfg.command!["pr/fix"]?.template); assert.ok(cfg.command!["skill/create"]?.template); assert.ok(cfg.command!["skill/optimize"]?.template); + assert.ok(cfg.command!["loop/pr/fix"]?.template); assert.ok(cfg.command!["ship"]?.template); assert.ok(cfg.command!["ticket/dev"]?.template); assert.ok(cfg.command!["review"]?.template); diff --git a/packages/web/src/components/CommandShowcase.astro b/packages/web/src/components/CommandShowcase.astro index d940a9e..d6e9e84 100644 --- a/packages/web/src/components/CommandShowcase.astro +++ b/packages/web/src/components/CommandShowcase.astro @@ -436,6 +436,29 @@ const scenarios: CommandScenario[] = [ ] } ] }, + { + id: 'loop-pr-fix', + label: '/loop/pr/fix', + command: '/loop/pr/fix 51', + agentName: 'Navigator', + task: 'Watch PR CI and comments, then fix both hands-off', + group: 'orchestration', + steps: [ + { id: 'thinking', phase: 'thinking', content: 'Load the PR, wait for checks to finish, reload comments, delegate a non-interactive fix pass for CI and feedback, then repeat until clean.' }, + { id: 'tools', phase: 'tool_calls', toolCalls: [ + { tool: 'pr_load', args: 'PR #51', status: 'complete' }, + { tool: 'bash', args: 'gh pr checks 51 --watch', status: 'complete' }, + { tool: 'pr_load', args: 'refresh PR feedback', status: 'complete' }, + { tool: 'command_expansion', args: 'worker · pr/fix auto', status: 'complete' } + ] }, + { id: 'output', phase: 'output', output: [ + 'PR loop complete for #51', + 'CI failures remaining: 0', + 'Actionable feedback remaining: 0', + 'Fix passes completed: 1' + ] } + ] + }, { id: 'todo', label: '/todo', diff --git a/packages/web/src/content/docs/docs/reference/agents/index.mdx b/packages/web/src/content/docs/docs/reference/agents/index.mdx index b5e009d..dd1cd73 100644 --- a/packages/web/src/content/docs/docs/reference/agents/index.mdx +++ b/packages/web/src/content/docs/docs/reference/agents/index.mdx @@ -15,7 +15,7 @@ Generic worker role with minimal built-in behavior. It is the default execution ### `navigator` -Owns structured multi-step workflows locally, preserves state and stop conditions, and forwards literal `` blocks through the `command_expansion` tool when commands such as `/ship`, `/todo`, and `/ticket/dev` require delegated step execution. +Owns structured multi-step workflows locally, preserves state and stop conditions, and forwards literal `` blocks through the `command_expansion` tool when commands such as `/ship`, `/todo`, `/ticket/dev`, and `/loop/pr/fix` require delegated step execution. ### `planner` diff --git a/packages/web/src/content/docs/docs/reference/agents/navigator.mdx b/packages/web/src/content/docs/docs/reference/agents/navigator.mdx index 8b405e0..c011ced 100644 --- a/packages/web/src/content/docs/docs/reference/agents/navigator.mdx +++ b/packages/web/src/content/docs/docs/reference/agents/navigator.mdx @@ -10,7 +10,7 @@ description: Orchestrator agent for structured multi-step workflows. ## Best for - pause-and-resume workflows -- stepwise orchestration such as `/ship`, `/todo`, and `/ticket/dev` +- stepwise orchestration such as `/ship`, `/todo`, `/ticket/dev`, and `/loop/pr/fix` - commands that mix local state handling with delegated leaf steps ## Key behavior diff --git a/packages/web/src/content/docs/docs/reference/commands/index.mdx b/packages/web/src/content/docs/docs/reference/commands/index.mdx index 396c2a2..f52e1e8 100644 --- a/packages/web/src/content/docs/docs/reference/commands/index.mdx +++ b/packages/web/src/content/docs/docs/reference/commands/index.mdx @@ -11,7 +11,7 @@ Kompass ships workflow-oriented commands authored as explicit templates in `pack - Guidelines: `/learn`, `/skill/create`, `/skill/optimize` - Ticket: `/ticket/ask`, `/ticket/create`, `/ticket/dev`, `/ticket/plan`, `/ticket/plan-and-sync` - PR: `/pr/create`, `/pr/fix`, `/pr/review`, `/review` -- Orchestration: `/dev`, `/ship`, `/todo` +- Orchestration: `/dev`, `/ship`, `/todo`, `/loop/pr/fix` ## What makes them different @@ -150,12 +150,20 @@ Creates a pull request for the current branch, including mandatory ticket resolu ### `/pr/fix` -Addresses PR feedback by making fixes and responding to review threads. +Addresses PR feedback or CI failures by making fixes and responding to review threads. - usage: `/pr/fix [pr-or-auto-or-context]` - arguments: optional PR ref, `auto`, or additional fix guidance - expected tools: `pr_load`, file-edit tools, validation commands, `question` unless `auto`, `git push`, `pr_sync` +### `/loop/pr/fix` + +Watches PR CI and comments, then repeatedly delegates non-interactive CI and feedback fixes through `/pr/fix auto` until no actionable work remains. + +- usage: `/loop/pr/fix [pr-or-context]` +- arguments: optional PR ref, CI guidance, or fix scope constraints +- expected tools: `pr_load`, `gh pr checks --watch`, `command_expansion(pr/fix)` + ### `/pr/review` Reviews a GitHub pull request and publishes findings as a formal review. diff --git a/packages/web/src/content/docs/docs/reference/commands/loop-pr-fix.mdx b/packages/web/src/content/docs/docs/reference/commands/loop-pr-fix.mdx new file mode 100644 index 0000000..a92a51c --- /dev/null +++ b/packages/web/src/content/docs/docs/reference/commands/loop-pr-fix.mdx @@ -0,0 +1,24 @@ +--- +title: /loop/pr/fix +description: Watch PR CI and comments, repeatedly fixing both without approval prompts. +--- + +Use `/loop/pr/fix` when a PR should be advanced hands-off until both CI and review feedback are clean. + +```text +/loop/pr/fix [pr-or-context] +``` + +## Behavior + +- loads the PR and stores the PR URL and number +- watches `gh pr checks --watch` until the latest checks finish +- reloads the PR after checks finish +- delegates actionable CI failures and PR feedback to `/pr/fix auto` +- repeats after each push until no actionable CI failures or PR feedback remain +- stops on failing validation, failed push, failed PR replies, or no-change feedback loops + +## Related + +- `/pr/fix` +- `/pr/review` diff --git a/packages/web/src/content/docs/docs/reference/commands/pr-fix.mdx b/packages/web/src/content/docs/docs/reference/commands/pr-fix.mdx index 53c120f..d9dcca0 100644 --- a/packages/web/src/content/docs/docs/reference/commands/pr-fix.mdx +++ b/packages/web/src/content/docs/docs/reference/commands/pr-fix.mdx @@ -1,11 +1,11 @@ --- title: /pr/fix -description: Fix PR feedback with a review-first approval loop by default, then push and reply. +description: Fix PR feedback or CI failures with a review-first approval loop by default, then push and reply. --- ## Purpose -Use `/pr/fix` when a PR already exists and review feedback needs another implementation pass. +Use `/pr/fix` when a PR already exists and review feedback or CI failures need another implementation pass. ## Usage @@ -16,7 +16,7 @@ Use `/pr/fix` when a PR already exists and review feedback needs another impleme ## Typical flow - load the PR and existing review state -- implement the requested fixes on the current branch +- implement the requested review or CI fixes on the current branch - run relevant validation - in default mode, show the fix summary and wait for user approval before commit, push, or replies - skip that approval loop only with `/pr/fix auto` diff --git a/packages/web/src/content/docs/docs/reference/tools/pr-load.mdx b/packages/web/src/content/docs/docs/reference/tools/pr-load.mdx index feab04b..c3c6649 100644 --- a/packages/web/src/content/docs/docs/reference/tools/pr-load.mdx +++ b/packages/web/src/content/docs/docs/reference/tools/pr-load.mdx @@ -24,3 +24,4 @@ Use `pr_load` when a workflow needs one grounded PR context payload instead of s - `/pr/review` - `/pr/fix` +- `/loop/pr/fix`