✨ feat: P-36 onboard opens its changes as the agent's pull request

Merged
AT
1mo ago
+470-99

Slice: #82

onboard wrote .github/process-rules.json, .claude/settings.json, the
workflow and CODEOWNERS into the owner's checkout and left them
uncommitted, which blocked the owner's next git pull. Now the owner's
checkout is never modified.

  • src/onboard-pull.ts (new): openPull makes a temporary repository
    holding the default branch's tip, fetched as the agent with
    --depth=1 --filter=blob:none (trees only, so a large repository costs
    little), puts each changed file in its index (hash-object -w,
    update-index), write-tree --missing-ok, commits once with
    commit-tree -S as the agent, force-pushes to process-rules/onboard
    and opens the agent's pull request (on a 422, finds the open one and
    updates its description). The temporary repository is removed in a
    finally. A file whose blob on the default branch differs from the
    checkout's is refused, so nothing merged since is undone.
  • Why a temporary repository, not git worktree add: a worktree of the
    owner's checkout needs the default branch's tip fetched into the owner's
    repository first, with the owner's credentials (the owner is signed out),
    and it would write refs and worktree metadata there. The temporary
    repository is fetched and pushed as the agent and touches nothing of the
    owner's.
  • onboard: every tracked-file write is held in memory (and read back
    from there) until all steps have run; a run that stops, or changes no
    file, opens no pull request. The PR description lists each file and what
    changed. Non-file steps (agent access, the board) still act at once with
    the one-run owner token; the pre-push hook is written in place.
  • pr-work-rules: passes an agent pull request from
    process-rules/onboard in the repository itself that changes only the
    files onboard writes (renames counted), so a re-run's pull request (an
    upgrade moving the pins) does not fail for naming no slice.
  • Tests through the Sys fake: every onboard test now asserts the
    checkout is unchanged; the agent opens the PR with its token; each git
    step's failure removes the temporary repository and opens nothing; a
    stale checkout is refused; an open PR is updated.
  • README onboarding steps, decisions record, roadmap rows for P-36 and
    P-37. No version bump: the batch release PR bumps it.

Live proof

After the batch release is tagged and installed, in a process-rules-sandbox clone on its default branch:

process-rules onboard

Then git status --short prints nothing, and onboard printed AthyaBot's pull request link.

🤖 Generated with Claude Code