@dispatch-triage/github
v0.1.0
Published
GitHub adapter: payload normalizer, Octokit executor, CODEOWNERS resolution.
Maintainers
Readme
@dispatch-triage/github
The GitHub adapter for Dispatch Triage — programmable triage for GitHub issues and pull requests.
This package is where Dispatch touches GitHub. Everything in it is an implementation of
a port defined by @dispatch-triage/core, which itself contains no GitHub client at all.
npm i @dispatch-triage/githubWhat it provides
| Export | Role |
| ----------------------------------------------- | ----------------------------------------------------------------- |
| normalizeIssue, normalizePull, buildState | Raw GitHub payloads → the engine's State. |
| targetFor, triggerFor | Payload → the Target and TriggerName the engine keys on. |
| GitHubReader | Fetches an issue or pull request, its files and its diff excerpt. |
| OctokitExecutor | The side-effect boundary. Every write to GitHub happens here. |
| compileCodeowners, resolveReviewers | CODEOWNERS parsing and reviewer resolution. |
| verifyWebhookSignature, signWebhook | HMAC verification for webhook delivery. |
Reading
import { GitHubReader } from '@dispatch-triage/github';
const reader = new GitHubReader({ octokit, maxDiffBytes: 20_000 });
const { target, state } = await reader.read('acme', 'widgets', 412);state is a plain value: title, body, author association, labels, changed paths, line
counts, commit messages, and a truncated diff excerpt. The engine takes it from there
and never learns where it came from.
Executing
import { OctokitExecutor, OCTOKIT_CAPABILITIES } from '@dispatch-triage/github';
const executor = new OctokitExecutor({ octokit, logger, itemAuthor: 'octocat' });OCTOKIT_CAPABILITIES declares which operations this executor can actually perform:
label comment close reopen lock minimize
assign request_review milestone project_field notifyconvert_to_discussion is deliberately absent — it needs a GraphQL mutation this
executor does not implement, so it reports the gap instead of failing at write time. An
action the executor cannot perform is suppressed by the gate ladder with
unsupported_by_executor, before anything is attempted.
Two constraints are enforced here rather than left to configuration:
minimizecan only ever target the comment that triggered the run.- A review is never requested from the item's own author.
project_field and notify drop out of the capability set unless you supply the
corresponding handler, so a config that asks for them gets an honest suppression rather
than a silent no-op.
What this package is not for
It does not decide anything. Ordering, gating, confidence thresholds and owned-label
tracking all live in @dispatch-triage/core. If you are reaching for this package to
work out whether to apply a label, you want the engine instead.
Documentation
Docs · Repository · Security policy
MIT
