✨ feat: P-04 onboard a client repository
Roadmap P-04, onboard a client.
process-rules onboard <owner> <agent> is run by the owner inside the client repo, on a Mac machine has set up for the agent. Every change waits for a yes.
- Writes three files for the owner to commit:
.github/process-rules.json, with the owner and agent logins as GitHub spells them;- a SessionStart hook in
.claude/settings.jsonthat runsprocess-rules session-start, keeping the client's other hooks; .github/workflows/process-rules.yml, which calls the shared checks.
- Checks the agent can push, as the agent:
- When the agent has no access, it offers to grant write access through the owner's
gh, then to accept the invitation as the agent. - It names an org that requires SAML authorisation (with the authorisation link) or blocks classic tokens.
- It reports read-only access.
- When the agent has no access, it offers to grant write access through the owner's
- Makes a signed test commit as the agent on a throwaway branch, checks GitHub shows it Verified by the agent, and deletes the branch on every path.
- Refuses to run inside an agent session.
Shared checks: the new .github/workflows/checks.yml is what clients call. For now it has one job, Settings, which validates the settings file. Later slices add their jobs to it.
actionlint in CI: clients now run this repo's workflows, so the required CI job lints every workflow. actionlint is pinned by version and sha256.
Proven in the sandbox repo: onboard wrote the three files, found the agent can push, and GitHub showed the test commit "verified: true (valid)" with the agent as committer. Running it there also turned up a bug, now fixed: onboard didn't create .github/ in a repo that had none. The sandbox's workflow runs once this merges, since it follows main.
pnpm check: 188 tests pass; coverage 98% lines and branches. The roadmap marks P-03 and P-04 shipped.
🤖 Generated with Claude Code
Summary by cubic
Adds process-rules onboard <owner> <agent>, which sets up a client repository so agent sessions run under the agent identity. Run by the owner on a Mac set up for the agent, it writes .github/process-rules.json, adds a SessionStart hook running process-rules session-start to .claude/settings.json while keeping existing hooks, and writes a workflow that calls the new shared checks. It checks the agent can push — offering to grant write access through the owner's gh and accept the invitation as the agent — names SAML or classic-token blocks, refuses to run inside an agent session, and refuses a repository with no commits, since a first push would make the throwaway branch the default one. Last, it pushes one signed test commit as the agent and requires GitHub to show it Verified, deleting the branch on every path.
Shared checks and CI
- Clients call the new
.github/workflows/checks.yml, which for now validates the settings file; later slices add jobs to it. - CI now lints every workflow with actionlint, pinned by version and sha256.
- The hook counts only when a SessionStart entry runs the exact command, and account spellings come from GitHub, not the terminal.
- Proven in the sandbox repo, where the test commit showed Verified by the agent; marks P-03 and P-04 shipped.