npm package: @kitlangton/lgtm
Description: Auto-approve selected contributors' pull requests with whimsical AI reviews
Latest version: 0.3.0

# LGTM

Tiny Bun CLI process that discovers contributors in the current GitHub repo, lets you choose who to auto-approve, and then keeps polling for their open pull requests with overly literary review bodies.

## How it works

- You run `lgtm` inside a local git checkout.
- LGTM resolves the repo from `git remote origin`.
- It asks GitHub who the contributors are and lets you multi-select the people to auto-approve.
- It saves that per-repo config to `~/.config/lgtm/config.json`.
- It polls GitHub every 60 seconds on a fixed Effect schedule.
- For each matching open PR, it skips PRs you already approved, then runs `gh pr review --approve` with a generated review body.
- Draft PRs get `Looks <random G-word> To Me! (EVEN THOUGH IT'S STILL A DRAFT, GREAT JOB @author!)` plus a haiku.
- Ready PRs get `Looks <random G-word> To Me!` plus a sonnet.
- The poem is generated by `opencode run -m opencode/kimi-k2.5` from the PR title and description.
- On macOS, `lgtm background ...` manages a per-repo `launchd` agent for daemon-style watching.

## Architecture

- `src/services/lgtm.ts` is the main orchestration service.
- `src/services/background.ts` manages `launchd` agents for background mode on macOS.
- `src/services/github.ts`, `src/services/repo.ts`, `src/services/config-store.ts`, `src/services/prompt.ts`, and `src/services/logger.ts` are Effect services with layers.
- `src/models.ts` defines schema-backed runtime models used to decode config and GitHub JSON.
- `src/errors.ts` defines tagged Effect errors for shell, config, prompt, and decode failures.
- `src/services/lgtm.test.ts` covers the main orchestration paths with mocked layers.

## What it does

- Detects the current repo from your local git checkout
- Uses `gh` auth for the current GitHub user
- Lists contributors and prompts for who to auto-approve
- Polls GitHub for open PRs authored by those contributors
- Approves matching PRs with a generated haiku or sonnet review body
- Can install and manage a background watcher per repo on macOS
- Stores config in `~/.config/lgtm/config.json`

## Run

```bash
bun run start
```

Or after publishing to npm:

```bash
bunx @kitlangton/lgtm
```

Run it from inside the repository you want to watch.

## Options

```bash
bun run start --setup   # reconfigure current repo
bun run start --once    # poll once and exit
bun run start background start
bun run start background status
bun run start background logs
bun run start background list
bun run start --help
```

Published CLI equivalents:

```bash
lgtm background start
lgtm background stop
lgtm background restart
lgtm background status
lgtm background logs
lgtm background list
lgtm background uninstall
```

## Install

```bash
bun install -g @kitlangton/lgtm
lgtm
```

## Notes

- Requires `gh auth login`
- Requires `opencode` with access to `opencode/kimi-k2.5`
- Polls every 60 seconds
- `background` uses `launchd` under the hood on macOS, including `list`, `status`, and `logs`
- Approves drafts too
- Skips PRs you already approved
- Falls back to a templated poem if OpenCode generation fails
- Prints colored status updates as it polls
- `bun run check` runs typecheck + tests