scripts: replace buildkite-failures.ts with bk-backed ci:* helpers (#28877)
## What does this PR do? Replaces `scripts/buildkite-failures.ts` (1078 lines of HTML scraping against buildkite.com) with a thin `scripts/find-build.ts` that shells to the [`bk`](https://github.com/buildkite/cli) BuildKite CLI. - **`.bk.yaml`** — sets `selected_org: bun` / `pipelines: [bun]` so raw `bk` commands work in this repo without `-p bun` - **`scripts/find-build.ts`** — resolves current-branch / `#pr` / PR URL / branch / build# / buildkite URL → build number, then either prints it (composable) or acts on it: - `--status` — one-screen summary: build state, job counts, failed jobs, failing test files so far (works on running builds) - `--errors` — renders annotation `body_html` back to colored terminal text, dedups near-identical per-platform output, tags each failure `[new]` vs `[also on main]` by diffing against the last 5 finished main builds - `--logs` — saves full ANSI-stripped logs for every failed job to `./tmp/ci-<build>/` - `--watch` — runs `bk build watch` on the resolved build - `--all` / `--no-compare` / `--no-dedup` modifiers - **`package.json`** — `ci:find`, `ci:status`, `ci:errors`, `ci:logs`, `ci:watch`. All accept the same target syntax. - Docs in `CLAUDE.md`, `CONTRIBUTING.md`, `docs/project/contributing.mdx` Setup: ```sh brew install buildkite/buildkite/bk export BUILDKITE_API_TOKEN=<read-scoped token> ``` Notes: - `bk build view -b <branch>` silently filters by `creator=<you>` and returns the wrong build, so resolution uses `bk build list --branch` instead. - `bk`'s pipeline auto-detect misses because the git remote is `git@…` while BuildKite stores `https://…`; `.bk.yaml` sidesteps that. - Dedup only normalizes timing, CI-worker path prefixes, and whitespace before comparing; error text, line numbers, and stack frames are compared exactly. `--no-dedup` prints everything. ## How did you verify your code works? Ran every mode against live builds: `ci:find main` / `-n 3`, `ci:find '#28870'` (PR → branch → build via `gh`), `ci:status` on running/passed/failed/canceled builds, `ci:errors` on build 43756 (renders annotations, dedups 19 platforms → 3 distinct bodies, `[new]`/`[also on main]` tags), `ci:logs` on 43758 (122KB clean log saved), `ci:watch` on a passed build (exits immediately with status). Verified `$(bun run ci:find main)` composes cleanly (no ANSI in stdout) with `bk build view`. oxlint and prettier pass.
D
Dylan Conway committed
6ecf46742afdcd69aff84173ee81a4c8a06fa22a
Parent: 58ebb16
Committed by GitHub <noreply@github.com>
on 4/5/2026, 12:41:26 AM