pm-github 2026.10.13 → 2026.10.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +174 -3
- package/dist/closeout.d.ts +83 -0
- package/dist/closeout.d.ts.map +1 -0
- package/dist/closeout.js +422 -0
- package/dist/closeout.js.map +1 -0
- package/dist/index.d.ts +399 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +887 -13
- package/dist/index.js.map +1 -1
- package/manifest.json +2 -2
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.10.15 - 2026-10-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Close pm items delivered by merged pull requests with verifiable GitHub evidence ([pm-github-t4i2](https://github.com/unbraind/pm-github/blob/main/.agents/pm/features/pm-github-t4i2.toon))
|
|
8
|
+
- Regenerate caller changelogs and dispatch required CI for gated sync PRs ([pm-github-wrmt](https://github.com/unbraind/pm-github/blob/main/.agents/pm/features/pm-github-wrmt.toon))
|
|
9
|
+
|
|
10
|
+
## 2026.10.14 - 2026-10-14
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Select GitHub issue imports and cap list volume ([pm-github-6srd](https://github.com/unbraind/pm-github/blob/main/.agents/pm/features/pm-github-6srd.toon))
|
|
15
|
+
- Revalidate blocked items against the live state of their GitHub blockers ([pm-github-fmrf](https://github.com/unbraind/pm-github/blob/main/.agents/pm/features/pm-github-fmrf.toon))
|
|
16
|
+
|
|
3
17
|
## 2026.10.8 - 2026-10-08
|
|
4
18
|
|
|
5
19
|
### Added
|
package/README.md
CHANGED
|
@@ -17,13 +17,156 @@ pm install npm:pm-github --global
|
|
|
17
17
|
> `github.com/unbraind/pm-github` source cannot work either — pm copies a GitHub
|
|
18
18
|
> source as-is without building it, and this repository does not commit `dist/`.
|
|
19
19
|
|
|
20
|
+
## Close items delivered by merged pull requests
|
|
21
|
+
|
|
22
|
+
Agents can use `pm github closeout` to replace manual post-merge tracker cleanup.
|
|
23
|
+
It resolves `--repo` or `PM_GITHUB_REPO` through the existing
|
|
24
|
+
repository resolver, and uses the normal `GITHUB_TOKEN` / `GH_TOKEN` / `gh auth`
|
|
25
|
+
token resolution. Use repeatable `--pr` numbers **or** `--since` with an ISO date
|
|
26
|
+
or timestamp including a timezone. `--since` selects merge times inclusively,
|
|
27
|
+
drains the closed-PR listing, and verifies each selected PR individually.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
# Agent: inspect the plan first. No tracker writes happen by default.
|
|
31
|
+
pm github closeout --repo owner/repo --pr 42 --pr 43 --skip pm-deferred --json
|
|
32
|
+
# Apply the reviewed selection; repeatable --skip always excludes those ids.
|
|
33
|
+
pm github closeout --repo owner/repo --pr 42 --pr 43 --skip pm-deferred --apply
|
|
34
|
+
# Incremental sweep, including merges exactly at the cutoff.
|
|
35
|
+
PM_GITHUB_REPO=owner/repo pm github closeout --since 2026-10-01T00:00:00Z --json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Only `https://github.com/owner/repo/blob/main/.agents/pm/<folder>/<id>.toon`
|
|
39
|
+
links in PR bodies are recognized. Percent-encoded names and nested SDK tracker
|
|
40
|
+
folders are supported; malformed encodings and traversal segments are ignored. Repository comparisons ignore case. Links to
|
|
41
|
+
other repositories, unknown ids, closed/canceled items and `--skip` ids produce
|
|
42
|
+
explicit skip rows. Bare ids and `pm:` trailers are not supported. If several
|
|
43
|
+
selected PRs reference one item, the lowest PR number supplies its evidence and
|
|
44
|
+
later references are skipped.
|
|
45
|
+
|
|
46
|
+
**A mention is not delivery.** PR bodies routinely link follow-ups, epics and
|
|
47
|
+
related work for context, so a link alone never closes an item. An item is
|
|
48
|
+
closed only when:
|
|
49
|
+
|
|
50
|
+
- it is `in_progress` (claimed work), **or** its link is preceded on the same
|
|
51
|
+
line by a GitHub-style closing keyword: `Closes`, `Fixes`, `Resolves` or
|
|
52
|
+
`Delivers` (and their tense forms), for example `- Closes [pm-x](…/pm-x.toon)`;
|
|
53
|
+
- it is not an `Epic`; epics close when their children are done;
|
|
54
|
+
- it has no non-terminal child items.
|
|
55
|
+
|
|
56
|
+
Each refused item gets a skip row naming the rule, so the plan shows why
|
|
57
|
+
deferred follow-ups stay open. `--skip` still excludes any id unconditionally. Items are read through a certified complete SDK
|
|
58
|
+
corpus, including terminal items.
|
|
59
|
+
|
|
60
|
+
A PR must be merged and have complete merge facts. Required head checks from
|
|
61
|
+
classic branch protection and active branch rulesets must conclude **success**;
|
|
62
|
+
missing, pending, neutral, skipped, failed or app-mismatched required checks
|
|
63
|
+
prevent closure. Required legacy commit-status contexts must succeed too, using their
|
|
64
|
+
latest status. Check-run, status and ruleset pages are fully read. Rulesets are
|
|
65
|
+
read through GitHub's [effective branch rules API](https://docs.github.com/en/rest/repos/rules#get-rules-for-a-branch).
|
|
66
|
+
The check policy reflects the rules readable at invocation time.
|
|
67
|
+
|
|
68
|
+
When a protection source is unreadable (HTTP 403/404), or no required contexts
|
|
69
|
+
are configured, the report labels the **fallback** rule. Every readable required
|
|
70
|
+
context still must conclude success, including its app binding. The fallback
|
|
71
|
+
additionally requires at least one head check run, every run completed with
|
|
72
|
+
`success`, `neutral` or `skipped`, and successful latest legacy head statuses.
|
|
73
|
+
It never discards a known requirement because another source is unreadable.
|
|
74
|
+
Missing, malformed or incomplete head evidence, malformed metadata and other
|
|
75
|
+
metadata errors fail closed. The plan reports which rule was used.
|
|
76
|
+
|
|
77
|
+
TOON is the compact default; global `--json` returns the stable shape
|
|
78
|
+
`{command, repo, dry_run, plan, checks, closed, failed}`. Each plan row is exactly
|
|
79
|
+
`{item, pr, action: "close" | "skip", reason}`. `checks` reports each PR's rule,
|
|
80
|
+
verdict, explanation and successful check names. Dry-run rows describe intended
|
|
81
|
+
closes; `closed` counts writes only with `--apply`. `--dry-run` overrides
|
|
82
|
+
`--apply`. All API planning finishes before the first SDK close. Individual SDK
|
|
83
|
+
refusals become skip rows containing a diagnostic code (or a generic failure
|
|
84
|
+
class), without raw error prose, paths or lock-owner identities. Remaining
|
|
85
|
+
closes continue; `failed` counts refused writes and `closed` counts successful
|
|
86
|
+
writes. After processing everything, any failed close produces a `CommandError`
|
|
87
|
+
with exit code 1 and the complete JSON report in its message. Eligibility skips
|
|
88
|
+
alone do not fail the command. Inspect the report before retrying.
|
|
89
|
+
|
|
90
|
+
The SDK close reason is a JSON string containing **only** verified facts:
|
|
91
|
+
`{pr, url, merge_commit_sha, head_sha, merged_at, checks}`. `checks` contains the
|
|
92
|
+
sorted unique names that actually succeeded at that head; neutral/skipped runs
|
|
93
|
+
are not described as passed. PR body, title and comments are never persisted.
|
|
94
|
+
For both default and strict close validation, the SDK always receives the three
|
|
95
|
+
structured close fields it supports, without overriding tracker policy:
|
|
96
|
+
|
|
97
|
+
- `resolution`: `Delivered by <PR URL> (merge <sha12>, head <sha12>)`.
|
|
98
|
+
- `expected_result`: the item's own acceptance criteria verbatim when present;
|
|
99
|
+
otherwise `Delivered by the linked pull request, merged after its head check gate passed.`
|
|
100
|
+
- `actual_result`: `Merged at <time>; required checks satisfied; successful head checks:
|
|
101
|
+
<names>` when branch protection or rulesets name required checks (the list holds every
|
|
102
|
+
successful head check, optional ones included). Under the fallback rule (no readable
|
|
103
|
+
required contexts) it reads `Merged at <time>; no readable required checks, so every
|
|
104
|
+
completed head check run had to succeed, be neutral or be skipped; successful checks:
|
|
105
|
+
<names>`, or `…; no check reported success` when only neutral or skipped runs exist.
|
|
106
|
+
Only the verified merge time, the applied check policy and sorted successful check
|
|
107
|
+
names are used; no platform, coverage or test-execution claims are made.
|
|
108
|
+
|
|
109
|
+
Item titles never supply any of these fields. Existing tracker acceptance
|
|
110
|
+
criteria remain the only prose source; PR body and comments supply no field text.
|
|
111
|
+
Completion time is the GitHub merge time. Repeating a completed selection skips
|
|
112
|
+
terminal items and performs zero additional tracker writes. The command edits
|
|
113
|
+
only the tracker; commit it with its history and regenerate the caller's
|
|
114
|
+
changelog in a closeout PR. Reusable bot-branch automation is tracked separately
|
|
115
|
+
in [pm-github-0x3y](https://github.com/unbraind/pm-github/blob/main/.agents/pm/tasks/pm-github-0x3y.toon).
|
|
116
|
+
|
|
117
|
+
## Revalidate GitHub blockers
|
|
118
|
+
|
|
119
|
+
**Compatibility:** pm-github now requires PM CLI 2026.10.5 or newer for complete
|
|
120
|
+
SDK reads and structured command exit statuses. Older hosts refuse installation
|
|
121
|
+
or activation through the matching peer dependency and manifest floor.
|
|
122
|
+
|
|
123
|
+
`pm github blockers` reads a certified complete tracker and checks every blocked
|
|
124
|
+
item, plus non-terminal items with an external GitHub `blocked_by` dependency.
|
|
125
|
+
It scans dependency targets, `blocked_reason`, description, and stored comments
|
|
126
|
+
(including the latest) for `owner/repo#N`, issue/PR URLs, `#N`, and `GH-N`.
|
|
127
|
+
Bare references use the item's `gh:owner/repo#N` provenance repo, then `--repo`.
|
|
128
|
+
The extra short form `repo#N` resolves only against a matching repo hint.
|
|
129
|
+
References are deduplicated across items and queried in GraphQL batches of 25,
|
|
130
|
+
using the existing token resolution and rate-limit handling.
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
pm github blockers --repo unbraind/pm-cli
|
|
134
|
+
pm github blockers --repo unbraind/pm-cli --json
|
|
135
|
+
pm --pm-path fleet/pm-rl/.agents/pm github blockers --repo unbraind/pm-cli --json
|
|
136
|
+
pm github blockers --ids pm-123,pm-456 --repo unbraind/pm-cli
|
|
137
|
+
# Preview/write annotations only on a scratch tracker:
|
|
138
|
+
pm --pm-path scratch/.agents/pm github blockers --repo unbraind/pm-cli --comment --dry-run
|
|
139
|
+
pm --pm-path scratch/.agents/pm github blockers --repo unbraind/pm-cli --comment
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Reports use the host renderer (TOON by default; global `--json`) and include item
|
|
143
|
+
id/status, each reference's state, close reason and closed/merged timestamp.
|
|
144
|
+
Verdicts are `cleared` (all references closed or merged), `partially_cleared`
|
|
145
|
+
(some cleared), `still_blocked` (open blockers, none cleared), and `unresolvable`
|
|
146
|
+
(no references or only unknown states). GitHub hides nonexistent and inaccessible
|
|
147
|
+
private references alike: both can appear as `not_found`. Explicit permission
|
|
148
|
+
errors remain `error` and cannot clear a blocker.
|
|
149
|
+
|
|
150
|
+
Exit **0** means nothing cleared, **4** means at least one item has a cleared or
|
|
151
|
+
partially cleared blocker, **1** means a query/comment failure (takes precedence
|
|
152
|
+
over 4), **2** means invalid options or missing authentication, and **3** means
|
|
153
|
+
an unknown `--ids` item. Structured reports remain available for query failures.
|
|
154
|
+
No run auto-unblocks. `--comment` adds one comment per fully cleared item,
|
|
155
|
+
listing newly cleared references as “Blocker X closed on D; revalidate.” Each
|
|
156
|
+
reference/state/timestamp carries an idempotency marker; repeats add nothing,
|
|
157
|
+
and a subsequent close with a different timestamp gets a fresh annotation.
|
|
158
|
+
`--dry-run` previews the annotation counts without appending comments.
|
|
159
|
+
The reusable scheduled sync runs this command report-only and emits an Actions
|
|
160
|
+
warning for code 4; it stops on other non-zero codes. Callers must pin a release
|
|
161
|
+
containing this command before adopting the updated workflow.
|
|
162
|
+
|
|
20
163
|
## Capabilities
|
|
21
164
|
|
|
22
165
|
| SDK capability | What it provides |
|
|
23
166
|
|---|---|
|
|
24
167
|
| `importers` | `pm github import <owner/repo>` — idempotent native import pipeline |
|
|
25
168
|
| `importers` (exporter) | `pm github export` — pm items → GitHub issues (dry-run by default; upsert) |
|
|
26
|
-
| `commands` | `pm gh-issues import` (legacy import alias), `pm github sync` (push status), `pm github gate` (fail-closed pre-push privacy gate), `pm github validate` (diagnostics), `pm github project list\|fields\|import\|sync` (Projects v2) |
|
|
169
|
+
| `commands` | `pm gh-issues import` (legacy import alias), `pm github sync` (push status), `pm github gate` (fail-closed pre-push privacy gate), `pm github validate` (diagnostics), `pm github closeout` (verified merged-PR delivery), `pm github project list\|fields\|import\|sync` (Projects v2) |
|
|
27
170
|
| `schema` | declares `github_url`, `github_number`, `github_state`, `github_author`, `github_created_at`, `github_updated_at` item fields |
|
|
28
171
|
| `hooks` | `afterCommand` — opt-in sync reminder (`PM_GITHUB_SYNC`) for linked items |
|
|
29
172
|
| `preflight` | early warning when a mutating github command lacks a token |
|
|
@@ -64,6 +207,9 @@ checks.
|
|
|
64
207
|
|
|
65
208
|
```bash
|
|
66
209
|
pm github import unbraind/pm-cli
|
|
210
|
+
pm github import owner/repo --issue 189
|
|
211
|
+
pm github import owner/repo --issue '189,#190,owner/repo#191'
|
|
212
|
+
pm github import owner/repo --limit 10
|
|
67
213
|
pm github import owner/repo --state all
|
|
68
214
|
pm github import owner/repo --labels bug,enhancement
|
|
69
215
|
pm github import owner/repo --since 2026-01-01T00:00:00Z # incremental sync
|
|
@@ -79,6 +225,8 @@ pm github import owner/repo --dry-run
|
|
|
79
225
|
|
|
80
226
|
| Flag | Type | Description |
|
|
81
227
|
|---|---|---|
|
|
228
|
+
| `--issue <N[,N...]>` | string | Fetch only selected issue endpoints; accepts numbers, `#N`, and same-repo `owner/repo#N` references. Conflicts with `--state`, `--all`, `--labels`, `--since`, `--assignee`, `--milestone`, and `--limit`. |
|
|
229
|
+
| `--limit <n>` | positive integer | Cap list-mode imports, newest-updated first. Returns `limit` and `truncated` (true when more matching issues exist). Invalid with `--issue`. |
|
|
82
230
|
| `--all` | boolean | Include closed issues (shorthand for `--state all`) |
|
|
83
231
|
| `--state <state>` | string | `open` \| `closed` \| `all` (default: open) |
|
|
84
232
|
| `--labels <labels>` | string | Comma-separated label filter |
|
|
@@ -97,6 +245,10 @@ pm github import owner/repo --dry-run
|
|
|
97
245
|
|
|
98
246
|
Each imported item records GitHub provenance: the `gh:owner/repo#N` idempotency tag, a `github_author:<login>` tag, and an enriched description (`author @<login> · state reason <reason> · created <iso> · updated <iso>`). GitHub issues closed as `not_planned` import as pm `canceled` instead of `closed`, preserving the difference between completed work and deliberately dropped work. The integration declares the `github_url`, `github_number`, `github_state`, `github_author`, `github_created_at`, and `github_updated_at` schema fields.
|
|
99
247
|
|
|
248
|
+
`--issue` deduplicates references and fetches each selected issue directly, including closed issues, without listing the repository. Every selected number is fetched and checked before any tracker write. A missing number fails the whole import; `--dry-run` instead reports `missingIssues` and previews the available selection. Pull request numbers require `--include-prs`. Selection combines with comment modes, dependency linking, atomic imports, gates, dry runs, and custom item types, preserving provenance-based re-import idempotency.
|
|
249
|
+
|
|
250
|
+
`--limit` bounds the matching list after PR, draft, and milestone filters. Pagination stops once one extra matching issue establishes truncation, so at most `n + 1` eligible issues are retained; GitHub pages may also contain excluded entries. Without a limit, existing list ordering is unchanged.
|
|
251
|
+
|
|
100
252
|
`--atomic` derives its durable transaction identity from the repository, complete rendered issue state, and exact ordered mutation plan (including target item ids), and derives each create id from the stable `owner/repo#number` external key rather than fetch position. Retrying the same response in a different order therefore resumes without duplicates; changed content, workspace prefixes, or resolved targets create a fresh compatible transaction. Native comment annotations run only after the item transaction commits and retain their cross-process deduplication lock.
|
|
101
253
|
|
|
102
254
|
### Native comment sync (`--comments-mode`)
|
|
@@ -294,7 +446,23 @@ The `gate` receipt reports the verdict, scanned file count, findings, and allowl
|
|
|
294
446
|
|
|
295
447
|
## Automated sync workflow
|
|
296
448
|
|
|
297
|
-
Fleet repos sync their issues into pm through ONE audited implementation: the reusable `workflow_call` workflow at [`.github/workflows/pm-github-sync.yml`](.github/workflows/pm-github-sync.yml)
|
|
449
|
+
Fleet repos sync their issues into pm through ONE audited implementation: the reusable `workflow_call` workflow at [`.github/workflows/pm-github-sync.yml`](.github/workflows/pm-github-sync.yml). Its safety order is validate → dry-run plan → **gated import** → verify the repeat import is a no-op → caller post-import script → **full changed-path scope check and privacy gate** → strict health → repeat scope check and scan immediately before commit/push/review PR → caller CI dispatch. The default `post-import-script` is `changelog:full`, invoked with `npm run --if-present`: it runs the caller's own generator when present, so imported closed issues and their changelog entries land in the same commit. Actions are pinned by commit SHA. The job requests `contents: write`, `pull-requests: write`, `issues: read`, and `actions: write` for dispatch.
|
|
450
|
+
|
|
451
|
+
When the tracker has no changes, regenerated `CHANGELOG.md` drift is discarded and the run emits a notice that the caller's own `changelog:check` owns that drift. The sync closes any owned open review PR and exits successfully without pushing or dispatching CI. Changelog changes are published only together with tracker changes.
|
|
452
|
+
|
|
453
|
+
The explicit allowed scope for changed paths is:
|
|
454
|
+
|
|
455
|
+
- Files beneath the SDK-resolved repository-local pm tracker, excluding its `extensions/`, `locks/`, and `checkpoints/` runtime directories. The extension setup files `settings.json` and `history/_workspace.jsonl` are permitted during setup, then restored before publication and excluded from both the scan and commit.
|
|
456
|
+
- The repository-root `CHANGELOG.md`.
|
|
457
|
+
|
|
458
|
+
After the caller script and again immediately before committing, `git status --porcelain=v1 -z --untracked-files=all` enumerates staged, unstaged, and untracked changes, including both sides of renames. Every path outside this list produces an error and prevents publication. Allowed changes are staged and the privacy gate scans the exact NUL-delimited path list passed to `git commit --only --pathspec-from-file` with literal pathspecs. The final scan is regenerated from current content; any finding, unreadable input, or script failure prevents publication. The restricted commit also excludes unrelated staged content if a scope check is bypassed.
|
|
459
|
+
|
|
460
|
+
Optional inputs:
|
|
461
|
+
|
|
462
|
+
| Input | Default | Behavior |
|
|
463
|
+
| --- | --- | --- |
|
|
464
|
+
| `post-import-script` | `changelog:full` | Caller npm script name invoked with `npm run --if-present` after import and before the final scan. Override for a different package script, or set `""` to disable. Missing scripts are skipped. Raw shell commands are not accepted. Generated `CHANGELOG.md` is staged with the tracker. Changing any file outside the documented scope fails the run, whether staged, unstaged, or untracked. |
|
|
465
|
+
| `ci-workflows` | `ci.yml` | Whitespace-separated filenames in the caller's `.github/workflows`, for example `ci.yml codeql.yml`. Missing files emit a notice and are skipped; set `""` to disable dispatch. Existing workflows must enable `workflow_dispatch`; dispatch errors fail the sync job. |
|
|
298
466
|
|
|
299
467
|
A fleet repo owns the schedule and calls it with the pinned versions (see [`docs/sync-workflow-caller.yml`](docs/sync-workflow-caller.yml)):
|
|
300
468
|
|
|
@@ -309,6 +477,7 @@ permissions:
|
|
|
309
477
|
contents: write
|
|
310
478
|
pull-requests: write
|
|
311
479
|
issues: read
|
|
480
|
+
actions: write
|
|
312
481
|
|
|
313
482
|
jobs:
|
|
314
483
|
gated-sync:
|
|
@@ -317,7 +486,9 @@ jobs:
|
|
|
317
486
|
pm-github-version: "RELEASE_VERSION" # required: exact published version
|
|
318
487
|
```
|
|
319
488
|
|
|
320
|
-
Replace the two release placeholders
|
|
489
|
+
Replace the two release placeholders with the release commit and package version containing this change; existing callers must repin both. The calling repo needs `@unbrained/pm-cli` as a devDependency (the workflow's `npm ci` provides the CLI) and its pm tracker at `.agents/pm` committed on `main`. Under **Settings → Actions → General → Workflow permissions** it must allow read and write token permissions and enable **Allow GitHub Actions to create and approve pull requests** (an organization can disable this), or the run pushes the sync branch and then fails to open the review PR. The caller must grant `actions: write`; a reusable workflow cannot elevate its caller's permissions.
|
|
490
|
+
|
|
491
|
+
Bot-created review PRs may have missing required checks or `pull_request` runs parked in `action_required`. After a successful push and PR creation/update, the reusable workflow uses the job's `GITHUB_TOKEN` to run `gh workflow run <file> --ref "$SYNC_BRANCH"` for each configured caller CI workflow. Explicit `workflow_dispatch` creates runs on the sync head, so callers must enable that trigger and ensure those runs produce their required check names (and do not restrict the required jobs to the `pull_request` event). It also lists `action_required` runs for the exact pushed SHA and prints their URLs as notices without failing because approval is needed. Missing workflows, disabled dispatch, or approval notices do not establish that required CI passed; inspect the dispatched checks. A no-change sync closes its stale own review PR and dispatches nothing. See GitHub's [GITHUB_TOKEN event rules](https://docs.github.com/en/actions/concepts/security/github_token) and [dispatch trigger and permission requirements](https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event).
|
|
321
492
|
|
|
322
493
|
### Installed CLI timeout acceptance
|
|
323
494
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Existing GitHub REST transport, supplied by the extension entry point. */
|
|
2
|
+
export interface CloseoutApi {
|
|
3
|
+
base: string;
|
|
4
|
+
get(url: string): Promise<{
|
|
5
|
+
body: string;
|
|
6
|
+
linkHeader?: string;
|
|
7
|
+
}>;
|
|
8
|
+
next(link?: string): string | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** Stable machine-readable decision; reasons never quote pull-request prose. */
|
|
11
|
+
export interface CloseoutRow {
|
|
12
|
+
item: string;
|
|
13
|
+
pr: number;
|
|
14
|
+
action: "close" | "skip";
|
|
15
|
+
reason: string;
|
|
16
|
+
}
|
|
17
|
+
/** Which head-check policy was evaluated for one selected pull request. */
|
|
18
|
+
interface CheckGate {
|
|
19
|
+
pr: number;
|
|
20
|
+
rule: "required" | "fallback" | "unavailable";
|
|
21
|
+
reason: string;
|
|
22
|
+
passed: string[];
|
|
23
|
+
ok: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Fields retained from a pull request; its body is used only for extraction. */
|
|
26
|
+
interface PullRequest {
|
|
27
|
+
number: number;
|
|
28
|
+
body: string | null;
|
|
29
|
+
merged: boolean;
|
|
30
|
+
merged_at: string | null;
|
|
31
|
+
merge_commit_sha: string | null;
|
|
32
|
+
html_url: string;
|
|
33
|
+
head: {
|
|
34
|
+
sha: string;
|
|
35
|
+
};
|
|
36
|
+
base: {
|
|
37
|
+
ref: string;
|
|
38
|
+
repo: {
|
|
39
|
+
full_name: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Verify required checks or the explicitly reported conservative fallback at the PR head. */
|
|
44
|
+
export declare function checkCloseoutHead(api: CloseoutApi, repo: string, pr: PullRequest): Promise<CheckGate>;
|
|
45
|
+
/**
|
|
46
|
+
* Whether a closing keyword directly precedes a link, given the line text before the link.
|
|
47
|
+
*
|
|
48
|
+
* Only earlier links (markdown or bare), commas and "and" may sit between the keyword and the link, so
|
|
49
|
+
* `Delivers [a](…) and [b](…)` declares both while `Not fixed here; see <link>` declares nothing.
|
|
50
|
+
* Scans backwards with plain string operations; no backtracking pattern touches PR text.
|
|
51
|
+
*/
|
|
52
|
+
export declare function declaresDelivery(prefix: string): boolean;
|
|
53
|
+
/** Extract only canonical tracker links, retaining foreign references solely for skip rows. */
|
|
54
|
+
export declare function extractCloseoutItems(body: string): {
|
|
55
|
+
item: string;
|
|
56
|
+
repo: string;
|
|
57
|
+
declared: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
/** Report SDK refusal codes without exposing paths, identities or arbitrary error prose. */
|
|
60
|
+
export declare function closeoutFailureReason(error: unknown): string;
|
|
61
|
+
/** Invalid selectors or repository input: the caller must change the command, so the host maps it to a usage exit. */
|
|
62
|
+
export declare class CloseoutUsageError extends Error {
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Describe the verified check evidence for a passed gate without overstating it.
|
|
66
|
+
*
|
|
67
|
+
* The required rule states that the required checks were satisfied and lists every successful head check (optional
|
|
68
|
+
* ones included). The fallback rule (no readable required contexts)
|
|
69
|
+
* may pass on neutral or skipped runs alone, so it states that policy and lists successful checks only when any exist.
|
|
70
|
+
*/
|
|
71
|
+
export declare function checkEvidence(gate: CheckGate): string;
|
|
72
|
+
/** Plan all selected PRs before closing eligible items through the real SDK. */
|
|
73
|
+
export declare function runCloseout(pmRoot: string, repo: string | undefined, options: Record<string, unknown>, api: CloseoutApi): Promise<{
|
|
74
|
+
command: string;
|
|
75
|
+
repo: string;
|
|
76
|
+
dry_run: boolean;
|
|
77
|
+
plan: CloseoutRow[];
|
|
78
|
+
checks: CheckGate[];
|
|
79
|
+
closed: number;
|
|
80
|
+
failed: number;
|
|
81
|
+
}>;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=closeout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closeout.d.ts","sourceRoot":"","sources":["../closeout.ts"],"names":[],"mappings":"AAGA,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,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