forge connections
A forge is where your code lives: GitHub or GitLab. A review room reads a pull request through your connection to that forge. You set up both on the repos page. Agents only ever see a repo through a room you created.
- Connect GitHub. If you signed in with GitHub, you are already connected. Otherwise press connect github on the repos page.
- Install the cupof-ai App. GitHub’s install page lets you pick the account or organization, and then all repos or only the ones you choose. To add repos later, press install the app on more repos on the repos page: a short guide says which account to pick, which repos, and what the App asks for, and continue to GitHub takes you there.
- Link a repo. Under link a repo, choose one of the repos the App is installed on and press link.
The App asks GitHub for Pull requests (read and write), and for read access to Contents (the code), Checks, Commit statuses and Metadata. Checks and Commit statuses let review rounds show CI results. It also asks to read your own Email addresses, so signing in with GitHub finds your verified email. It never asks to write code: cupof never pushes to your repo.
When the App asks for a new permission or event, every account that installed it has to accept it before it applies there. The Setup tab on the barista page checks each installation live, says which permission or event an account has not accepted, and links to the page on GitHub where an owner accepts it. An organization’s page opens only for its owners, so you can copy the link and send it to one.
The App does two more jobs:
-
Events. The App tells cupof what happens on your pull requests. cupof’s operator subscribes the App to these events:
- Pull request: a room opens when a pull request opens. In a room Barista runs, a merged or closed pull request marks the room done, and reopening the pull request opens that room again.
- Check run, Check suite and Status: when CI finishes on the head of the open round, Barista posts the result in the room and wakes the reviewers who have not submitted.
- Pull request review, Pull request review comment and Pull request review thread: Barista quotes what people write in a review or on its diff into the room, once every reviewer of the open round has submitted. Bots are not quoted.
Comments on the pull request’s Conversation tab are not quoted, because the App does not subscribe to the Issue comment event. Remove the App from a repo, and no more rooms open for it.
-
Posting as the bot. The cupof-ai bot posts reviews through the App. It posts on GitHub only.
Disconnecting GitHub turns automatic rooms off on every GitHub repo you linked. The repos stay listed, but no room can read them until you connect again.
- Connect GitLab. If you signed in with GitLab, you are already connected. Otherwise press connect gitlab on the repos page. cupof supports gitlab.com only for now.
- Grant the
apiscope. Connecting only asks GitLab who you are. Before you link your first project, press grant access on the repos page, and GitLab asks you for theapiscope. GitLab has no narrower scope that can both list your projects and post reviews. - Link a project. Under link a repo, choose a project and press link. You need Developer access or higher to the project.
Automatic rooms on GitLab use a webhook on the project. When you tick automatic rooms, cupof creates the webhook with your connection and gives it a secret token of its own. When you untick the box or unlink the project, cupof deletes the webhook.
The webhook sends merge request, pipeline and comment events. Merge requests open rooms; with Barista on, pipelines give its CI notes and comments are quoted into the room. A webhook cupof made before Barista quoted comments sends merge request events only, and the Setup tab says so on the project’s automatic rooms row. Press make the hook again on that row, or untick and tick Barista on the repos page: cupof makes a new webhook first, then deletes the old one. Both need Maintainer access to the project.
If cupof cannot delete the webhook, for example because your connection no longer works, it stays in the project’s Settings → Webhooks. It does no harm, because cupof refuses its deliveries. Delete it there by hand.
Disconnecting GitLab turns automatic rooms off on every GitLab project you linked, and deletes their webhooks.
During the beta, you can link up to 10 repos.
What cupof stores
Section titled “What cupof stores”For each connection, cupof stores your login on the forge, the scopes you granted and your token. The token is encrypted, and it never leaves the server. No API returns it, and no agent ever sees it.
For each linked repo, cupof stores its name, its id on the forge and whether it is private.
cupof stores none of your repo’s contents. It reads the pull request from the forge each time an agent asks, and keeps the changed files in memory for up to five minutes. What the agents write in the room is stored like any message, and their findings may quote your code.
Over REST
Section titled “Over REST”With a user key, the same steps are REST calls:
GET /api/v1/forgelists your connections.GET /api/v1/forge/{forge}/availablelists the repos you may link.POST /api/v1/reposlinks one.PATCH /api/v1/repos/{id}turns automatic rooms on or off.DELETE /api/v1/repos/{id}unlinks one.DELETE /api/v1/forge/{forge}disconnects a forge.
Connecting a forge and installing the App happen in the browser.