← Catalog

@pikibun/pi-pr-flow

A Pi extension that has the agent carry each change through a pull request: a draft at the first change, ready for review once done, a review window for reviews and re-reviews whose valid points it fixes, then the merge.

Extension

Install

Install with PiG

pig install npm:@pikibun/pi-pr-flow

Install with Pi

pi install npm:@pikibun/pi-pr-flow
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.5.0 (README.md). PiG does not review it.

Pull request flow, a Pi extension

Has the agent carry each change to a repository through a pull request (a merge request on GitLab), from the first edit to the merge:

  1. A draft at the first change. As soon as the session starts changing files in a clone, it commits, pushes to the session's branch and opens a draft pull request.
  2. Ready for review once done. When the change is complete and its tests pass, it marks the draft ready for review.
  3. A review window. It waits up to review-minutes for reviews. It fixes the review points it judges valid, pushes, and answers each point (with why, for one it judges invalid). Each pushed fix starts the window again, for a re-review. It merges once the pull request is approved with nothing left to address, or once the window ends with nothing new to address; never over a reviewer's request for changes it didn't make, which it leaves to the people.
  4. review-minutes of 0 merges at once (or, with auto-merge off, hands it over), as soon as the pull request is ready, without waiting for reviews.
  5. auto-merge off leaves the merge to people. The agent still works the review window, but where it would merge it tells the person the pull request is ready for them to merge, and leaves it open.
  6. wait-for-review off skips the review window, whatever review-minutes says; draft-first off opens the pull request ready for review once the change is done, with no draft before; require-approval on merges only an approved pull request and hands over one whose window ends without an approval.

It registers no tool: the agent does each step with its own tools, and the only call it refuses is a push before the workspace's pre-push-check passed, each approved as it always is (in Pikibun: git, git_push with pull_request.draft, github_read with wait, github_comment, github_merge; elsewhere the forge's CLI). It adds the flow to the system prompt of each message (before_agent_start), and a note to a tool's result where a step is due (tool_result): the first change in a clone without a pull request, a draft opened, a pull request made ready (with the time its review window ends), a push after that, a merge.

The whole procedure is also a skill, pull-request-flow, filled in from the settings and offered through resources_discover (written to a folder of its own under the temporary directory, removed at session_shutdown). Where the skill is listed (before_agent_start's systemPromptOptions.skills names it: Pi lists it at startup, Pikibun copies it into the worktree's .pikibun/skills before each message that may act), the system prompt keeps only a short rule: when the flow applies, its steps in one sentence, and to read the skill before the first change in a clone. Where it isn't, the prompt gets the whole procedure.

Settings

SettingDefaultWhat it does
review-minutes30How long to wait for reviews once the pull request is ready, and again after each pushed fix, in minutes (up to a week). 0 merges it as soon as it is ready (with auto-merge off, hands it over)
merge-methodsquashsquash, merge or rebase; unused with auto-merge off
wait-for-checksonLet the pull request's checks finish, and fix failing ones, before merging. Turn it off with a review-minutes of 0 to merge the moment it is ready
pre-push-checkemptyWords of a check's command, such as tests/no-comments.test.ts or pnpm check:fast. Once the session changed files in a clone, a push of it (one pushing only tags or deletions, or a dry run, excepted) is refused (a tool_call block) until a program tool's call in that clone whose program and arguments hold those words passed. Empty refuses nothing
auto-mergeonMerge once approved, or once the review window ends with nothing left to address. Off, the agent never merges (nor queues an automatic merge) unless the person asks: it tells them the pull request is ready for them to merge
wait-for-reviewonWait review-minutes for reviews. Off skips the review window, as a review-minutes of 0 does, without losing the minutes set: it merges (with auto-merge off, hands it over) as soon as the pull request is ready
draft-firstonOpen a draft at the first change in a clone. Off, the agent commits and pushes to the session branch as it works and opens the pull request, ready for review, only once the change is done
require-approvaloffMerge only an approved pull request: one whose review window ends without an approval (with no window, one not already approved) is handed over to people instead. Unused with auto-merge off

In Pikibun

Every connector has it built in as piki:pr-flow, at the connector's version. A workspace's owners and admins add it under Settings → Workspaces → the workspace → Extensions → Add extension → Workflows, then set its settings with Edit. See the design.

In Pi

pi install npm:@pikibun/pi-pr-flow   # from npm
pi install ./extensions/pr-flow      # from a clone of this repository
pi -e ./extensions/pr-flow           # or for one run only

Its settings are Pi flags (--review-minutes 60). Pi's own tools don't include Pikibun's git_push, so there the agent opens, readies and merges with the forge's CLI (gh pr create --draft, gh pr ready, gh pr merge).