pullfrog 0.1.33 → 0.1.35
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/dist/agents/opencodeShared.d.ts +1 -1
- package/dist/cli.mjs +541 -244
- package/dist/index.js +142 -97
- package/dist/internal/index.d.ts +0 -1
- package/dist/internal.js +82 -73
- package/dist/models.d.ts +7 -2
- package/dist/utils/autoMerge.d.ts +16 -25
- package/dist/utils/proxy.d.ts +1 -0
- package/package.json +1 -1
- package/dist/utils/checksGate.d.ts +0 -45
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
import type { ToolContext } from "../mcp/server.ts";
|
|
2
2
|
/**
|
|
3
|
-
* Run-end lifecycle action:
|
|
4
|
-
*
|
|
5
|
-
* contributor PRs included
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* no merge surface to reach for. Every clause is fail-closed and re-verified
|
|
9
|
-
* against GitHub's own state at merge time; any failure logs why and returns
|
|
10
|
-
* without merging. Best-effort — the caller wraps this in a `.catch`, and a
|
|
11
|
-
* merge/comment failure can never flip the run's outcome.
|
|
3
|
+
* Run-end lifecycle action: hand any PR this run mechanically approved on its
|
|
4
|
+
* current head to GitHub's NATIVE auto-merge — Pullfrog acting as a full repo
|
|
5
|
+
* maintainer, contributor PRs included. There is deliberately NO agent-callable
|
|
6
|
+
* merge tool — the merge is a deterministic consequence of the recorded approval
|
|
7
|
+
* verdict, so a prompt-injected agent has no merge surface to reach for.
|
|
12
8
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* maintainer's controls.
|
|
9
|
+
* Native auto-merge waits for all REQUIRED checks + reviews (un-fakeable by a
|
|
10
|
+
* fork), respects the human veto via branch protection, and requires branch
|
|
11
|
+
* protection to exist. We keep only the Pullfrog-specific pre-gates GitHub can't
|
|
12
|
+
* express: armed toggles, approved-THIS-head, zero outstanding Pullfrog threads,
|
|
13
|
+
* no human CHANGES_REQUESTED. Best-effort — the caller wraps this in `.catch`,
|
|
14
|
+
* and a merge/comment failure can never flip the run's outcome.
|
|
20
15
|
*
|
|
21
16
|
* The invariant (all must hold):
|
|
22
17
|
* 1. `ctx.autoMergeEnabled` — the per-repo toggle ANDed with the global
|
|
23
18
|
* `isAutonomousMaintenanceEnabled()` kill switch, server-side (run-context).
|
|
24
19
|
* 2. `ctx.prApproveEnabled` — cannot auto-merge what it may not approve.
|
|
25
|
-
* 3. this run recorded an APPROVE verdict (`toolState.approval.wouldApprove`)
|
|
26
|
-
* Pullfrog's review is the merge decision.
|
|
20
|
+
* 3. this run recorded an APPROVE verdict (`toolState.approval.wouldApprove`).
|
|
27
21
|
* 4. the PR is open and not a draft.
|
|
28
|
-
* 5. `toolState.approval.sha === <current head sha>` — approved THIS head
|
|
29
|
-
* commit pushed after the review can't ride the approval in (409-safe below).
|
|
22
|
+
* 5. `toolState.approval.sha === <current head sha>` — approved THIS head.
|
|
30
23
|
* 6. `countOutstandingPullfrogThreads === 0` — re-queried at merge time.
|
|
31
|
-
* 7. no un-dismissed human CHANGES_REQUESTED
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* non-failing (`checkRunsGate`) — red or in-flight CI never auto-merges,
|
|
35
|
-
* even on a repo without branch protection.
|
|
24
|
+
* 7. no un-dismissed human CHANGES_REQUESTED at handoff.
|
|
25
|
+
* The remaining wait-for-required-checks + wait-for-required-reviews semantics
|
|
26
|
+
* are GitHub's, via native auto-merge and branch protection.
|
|
36
27
|
*/
|
|
37
28
|
export declare function autoMergeAfterApprove(ctx: ToolContext): Promise<void>;
|
package/dist/utils/proxy.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* - 402 → `BillingError` (card declined, balance empty, 3DS, etc.)
|
|
18
18
|
* - 503 → `TransientError` (transient sync issue — retry next dispatch)
|
|
19
|
+
* - 404 → `TransientError` (stale repo↔account link — re-homes on next webhook)
|
|
19
20
|
*/
|
|
20
21
|
import type { ToolState } from "../toolState.ts";
|
|
21
22
|
import { type OidcCredentials } from "./github.ts";
|
package/package.json
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared, dependency-free CI green/red predicate — the single source of truth for
|
|
3
|
-
* "given these check-runs, is this PR head safe to merge?". Consumed by the
|
|
4
|
-
* auto-merge path: `autoMerge.ts` gates the PR head at merge time, and the
|
|
5
|
-
* `pr-merge-completion` webhook re-checks it before dispatching a slow-CI re-wake.
|
|
6
|
-
* A red or in-flight sha never merges, and a sha with no confirmable green
|
|
7
|
-
* check-run is treated as unverified (refused, not merged blind).
|
|
8
|
-
*
|
|
9
|
-
* Gates on the Checks API only. The Pullfrog App deliberately holds no `statuses`
|
|
10
|
-
* permission (requesting it would force re-approval on every install — see
|
|
11
|
-
* wiki/app-permissions.md), so the legacy Commit Statuses API is unreadable
|
|
12
|
-
* (`listCommitStatusesForRef` 403s). Modern CI (GitHub Actions, etc.) reports via
|
|
13
|
-
* check-runs; a repo relying on the legacy Statuses API is covered by branch
|
|
14
|
-
* protection instead — a failing required status makes `mergeable_state` `blocked`,
|
|
15
|
-
* which the merge invariant already refuses (`NON_MERGEABLE_STATES`).
|
|
16
|
-
*/
|
|
17
|
-
export type CheckRun = {
|
|
18
|
-
name: string;
|
|
19
|
-
status: string;
|
|
20
|
-
conclusion: string | null;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Refuse if any external check-run is incomplete (queued/in_progress) or concluded
|
|
24
|
-
* anything other than success/neutral/skipped. Fail-closed on unknown/absent
|
|
25
|
-
* conclusions. Pure so the pass/fail logic is inspectable directly.
|
|
26
|
-
*/
|
|
27
|
-
export declare function checkRunsGate(params: {
|
|
28
|
-
checkRuns: CheckRun[];
|
|
29
|
-
}): {
|
|
30
|
-
ok: boolean;
|
|
31
|
-
reason: string;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* true when the head has ≥1 CONCLUDED non-failing EXTERNAL check-run — CI
|
|
35
|
-
* positively ran, not merely "no red was seen". paired with `checkRunsGate.ok`
|
|
36
|
-
* (any completed check is non-failing), this == "≥1 concluded non-failing check".
|
|
37
|
-
* the merge requires it: a head with ZERO check-runs passes
|
|
38
|
-
* `checkRunsGate` (nothing red) but has no verification, and since the app can't
|
|
39
|
-
* read legacy commit statuses, "zero check-runs" is indistinguishable from "green
|
|
40
|
-
* Actions but a red CircleCI status" — so we only act on a head we can positively
|
|
41
|
-
* confirm is green. Pullfrog's own verdict checks don't count as external CI.
|
|
42
|
-
*/
|
|
43
|
-
export declare function hasVerifiedCheck(params: {
|
|
44
|
-
checkRuns: CheckRun[];
|
|
45
|
-
}): boolean;
|