Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/goulinkh/code-review-harness/llms.txt

Use this file to discover all available pages before exploring further.

A provider is the source of merge proposal data in CRH — it fetches everything the AI agent needs to perform a code review. The Launchpad provider connects to the Launchpad API and retrieves merge proposal metadata, preview diffs, diff content, inline and general comments, and CI status. It also clones the source branch via isomorphic-git so the agent can inspect file history. Only git merge proposals are supported; Bazaar merge proposals are rejected at construction time.

Installation

The provider is available as a standalone package if you are using CRH programmatically:
npm install @code-review-harness/launchpad-provider
# or
pnpm add @code-review-harness/launchpad-provider

Configuration

The provider accepts a LaunchpadProviderOptions object:
FieldTypeRequiredDescription
urlstringYesLaunchpad API merge proposal URL (see below).
apiobjectNoPre-constructed LaunchpadApi instance. Overrides all OAuth options when provided.
gitdirstringNoPath for the local git clone. Defaults to a temporary directory created with mkdtempSync.
accessTokenstringNoOAuth access token. Falls back to the LP_ACCESS_TOKEN environment variable.
accessSecretstringNoOAuth access secret. Falls back to the LP_ACCESS_SECRET environment variable.
consumerKeystringNoOAuth consumer key. Falls back to LP_CONSUMER_KEY, then "crh".

The url field

The url must be a Launchpad API merge proposal URL, not the web UI URL. The two formats look like this:
FormatExample
API URL ✓https://api.launchpad.net/devel/~user/+git/repo/+merge/123
Web URL ✗https://code.launchpad.net/~user/+git/repo/+merge/123
The provider validates the URL on construction using the pattern /^https:\/\/api\.launchpad\.net\/devel\/.+\/\+git\/.+\/\+merge\/\d+\/?$/. Passing a web UI URL or a Bazaar MP URL throws an UnsupportedRepoTypeError.
You can convert a web UI URL to an API URL by replacing code.launchpad.net with api.launchpad.net/devel.

OAuth authentication

The provider uses OAuth 1.0a HMAC-SHA1 to authenticate against the Launchpad API. You can supply credentials in two ways:
1

Environment variables (recommended)

Export the following variables before running crh:
export LP_ACCESS_TOKEN=your-access-token
export LP_ACCESS_SECRET=your-access-secret
export LP_CONSUMER_KEY=crh
LP_CONSUMER_KEY defaults to "crh" when omitted.
2

Inline options

Pass credentials directly to createLaunchpadProvider. These override the environment variables:
const provider = createLaunchpadProvider({
  url: "https://api.launchpad.net/devel/~user/+git/repo/+merge/123",
  accessToken: "your-access-token",
  accessSecret: "your-access-secret",
  consumerKey: "crh",
});

What the provider fetches

When CRH runs a review session, the Launchpad provider retrieves:

Metadata

Title, description, commit message, author, source branch, and target branch from the merge proposal resource.

Preview diffs

The list of preview diff rounds for the MP, sorted by creation time.

Diff content

The raw unified diff for a given preview diff ID, with a fallback to the web URL when the API link is unavailable.

Comments

Both inline comments (keyed by numbered-diff line) and general MP-level comments for a given preview diff round.

CI status

Returned as an empty checks array in v1. CI integration is not yet implemented.

Git clone

Clones the source branch from git.launchpad.net via isomorphic-git into the configured (or temp) gitdir.

Usage

CLI

Pass --provider launchpad and the API URL to --pr:
crh review \
  --provider launchpad \
  --pr "https://api.launchpad.net/devel/~user/+git/repo/+merge/123" \
  --sink stdout

Programmatic

import { createLaunchpadProvider } from "@code-review-harness/launchpad-provider";
import { createReviewSession } from "@code-review-harness/core";
import { createStdoutSink } from "@code-review-harness/stdout-sink";

const provider = createLaunchpadProvider({
  url: "https://api.launchpad.net/devel/~user/+git/repo/+merge/123",
});

const sink = createStdoutSink();
const { session } = await createReviewSession({ provider, sink });

session.subscribe((event) => process.stderr.write(`${JSON.stringify(event)}\n`));
await session.prompt("Review merge proposal. Submit final review with submit_review.");
createLaunchpadProvider is impure — it may read environment variables for OAuth config and creates a temporary git directory when gitdir is not supplied.

Build docs developers (and LLMs) love