spur-board 0.103.1 → 0.104.1
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/{chunk-JXDenEem.mjs → chunk-4C7tYXYO.mjs} +2 -2
- package/dist/{chunk-CDl7SYVt.mjs → chunk-C34hsfqb.mjs} +53 -23
- package/dist/{chunk-DVUopqja.mjs → chunk-Dz9IMhY5.mjs} +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +245 -67
- package/dist/mcp.mjs +3 -3
- package/dist/migrations/0025_source_default_branch.sql +3 -0
- package/dist/web/assets/index-B35CcJ4n.js +64 -0
- package/dist/web/assets/index-_99qT44s.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/skills/spur-board/references/how-board-works-blocks.md +1 -0
- package/skills/spur-board/references/web-ui-board.md +3 -0
- package/skills/spur-board/references/web-ui-task-blocks.md +3 -2
- package/skills/spur-board/references/web-ui-task-view.md +15 -12
- package/dist/web/assets/index-B6sF9A4o.css +0 -1
- package/dist/web/assets/index-BKJstk6p.js +0 -64
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as buildCatalogSnapshot,
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { d as buildCatalogSnapshot, gt as plainHttpAllowed, mt as configSchema, p as OPERATIONS } from "./chunk-C34hsfqb.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-Dz9IMhY5.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -1562,6 +1562,7 @@ const SESSION_HEALTH_STATES = [
|
|
|
1562
1562
|
];
|
|
1563
1563
|
/** UTC ISO 8601 timestamp. */
|
|
1564
1564
|
const at$2 = z.iso.datetime();
|
|
1565
|
+
/** An http or https web URL. */
|
|
1565
1566
|
const webUrl = z.url({ protocol: /^https?$/ });
|
|
1566
1567
|
const login = z.string().min(1);
|
|
1567
1568
|
/** A full lowercase commit SHA (SHA-1 or SHA-256). */
|
|
@@ -1813,6 +1814,23 @@ function itemAnswersRef(item, ref) {
|
|
|
1813
1814
|
if (ref.kind === "ticket" && item.kind === "ticket") return item.facts.trackerId === ref.trackerId && (ref.id === void 0 ? item.facts.key === ref.key : item.facts.id === ref.id);
|
|
1814
1815
|
return itemIdentity(item) === refIdentity(ref);
|
|
1815
1816
|
}
|
|
1817
|
+
const defaultBranchHead = {
|
|
1818
|
+
branch: z.string().min(1).describe("Name of the default branch."),
|
|
1819
|
+
sha: commitShaSchema.describe("Commit at the head of the default branch.")
|
|
1820
|
+
};
|
|
1821
|
+
/**
|
|
1822
|
+
* The colour of a repository's default-branch head. Only push-triggered workflow check runs and
|
|
1823
|
+
* commit statuses count; scheduled and other runs, and check runs outside workflows, never do.
|
|
1824
|
+
*/
|
|
1825
|
+
const defaultBranchFactSchema = z.discriminatedUnion("state", [z.strictObject({
|
|
1826
|
+
state: z.literal("green").describe("Every counted check finished successfully."),
|
|
1827
|
+
...defaultBranchHead
|
|
1828
|
+
}), z.strictObject({
|
|
1829
|
+
state: z.literal("red").describe("At least one counted check finished without success (failed, cancelled, timed out)."),
|
|
1830
|
+
...defaultBranchHead,
|
|
1831
|
+
check: z.string().min(1).nullable().describe("Name of the first failing check, if known."),
|
|
1832
|
+
url: webUrl.nullable().describe("Web URL of the failing run, or null when unknown.")
|
|
1833
|
+
})]).describe("Colour of the default-branch head.");
|
|
1816
1834
|
const batchSchema = z.strictObject({
|
|
1817
1835
|
source: z.string().min(1).describe("Id of the adapter that produced the batch."),
|
|
1818
1836
|
observedAt: z.iso.datetime().describe("When the poll started (A2)."),
|
|
@@ -1838,7 +1856,8 @@ const batchSchema = z.strictObject({
|
|
|
1838
1856
|
remaining: z.int().min(0).describe("Requests or points the source still allows."),
|
|
1839
1857
|
limit: z.int().positive().optional().describe("Full budget the source restores at reset; omitted when it reports none."),
|
|
1840
1858
|
resetAt: z.iso.datetime().describe("When the source restores the full budget.")
|
|
1841
|
-
}).optional().describe("Request budget the source reported on this poll; omitted when it reports none.")
|
|
1859
|
+
}).optional().describe("Request budget the source reported on this poll; omitted when it reports none."),
|
|
1860
|
+
defaultBranch: defaultBranchFactSchema.optional().describe("Colour of the default-branch head read by this poll; omitted when the poll did not read a settled colour.")
|
|
1842
1861
|
}).superRefine((batch, ctx) => {
|
|
1843
1862
|
const positions = /* @__PURE__ */ new Set();
|
|
1844
1863
|
batch.sessionTransitions?.forEach((edge, index) => {
|
|
@@ -2827,6 +2846,38 @@ const schemaGetOutputSchema = z.strictObject({
|
|
|
2827
2846
|
outputSchema: jsonSchemaPayload("output")
|
|
2828
2847
|
}).describe("One operation.")).describe("Operations the caller may use.")
|
|
2829
2848
|
}).describe("The operation catalog.");
|
|
2849
|
+
// ../contracts/src/ops/source-view-schema.ts
|
|
2850
|
+
/** The stored colour of a repository's default-branch head, as status.get shows it. */
|
|
2851
|
+
const defaultBranchViewSchema = z.strictObject({
|
|
2852
|
+
branch: z.string().min(1).describe("Name of the default branch."),
|
|
2853
|
+
state: z.enum(["red", "green"]).describe("Colour of the default-branch head."),
|
|
2854
|
+
sha: commitShaSchema.describe("Head commit when this colour was first read; while red, the first red commit."),
|
|
2855
|
+
since: z.iso.datetime().describe("When the board first read this colour."),
|
|
2856
|
+
confirmedAt: z.iso.datetime().describe("When a poll last read this colour; a poll that reads no colour keeps it."),
|
|
2857
|
+
check: z.string().min(1).nullable().describe("Name of the first failing check, or null."),
|
|
2858
|
+
url: webUrl.nullable().describe("Web URL of the failing run, or null.")
|
|
2859
|
+
}).describe("Colour of the default-branch head. It is red when the latest check run of a push-triggered workflow finished without success (failed, cancelled, timed out) or a commit status failed; scheduled, manual and other runs and check runs outside workflows are ignored, and branch protection is not read.");
|
|
2860
|
+
const sourceViewSchema = z.strictObject({
|
|
2861
|
+
pointsLastHour: z.int().nonnegative().optional().describe("Reported source points consumed during the preceding hour."),
|
|
2862
|
+
source: z.string().min(1).describe("Adapter source identifier."),
|
|
2863
|
+
observedAt: z.iso.datetime().nullable().describe("Time of the latest observation, if any."),
|
|
2864
|
+
lastCompleteAt: z.iso.datetime().nullable().describe("Time of the latest complete observation."),
|
|
2865
|
+
blindReason: z.enum([
|
|
2866
|
+
"auth",
|
|
2867
|
+
"config",
|
|
2868
|
+
"stale"
|
|
2869
|
+
]).nullable().describe("Why this source is blind, or null when it is usable."),
|
|
2870
|
+
message: z.string().nullable().describe("Short explanation of the source state."),
|
|
2871
|
+
budget: z.strictObject({
|
|
2872
|
+
remaining: z.int().nonnegative().describe("Requests or points the source still allowed."),
|
|
2873
|
+
limit: z.int().positive().nullable().describe("Full budget the source restores at reset, or null when it reported none."),
|
|
2874
|
+
resetAt: z.iso.datetime().describe("When the source said it restores the full budget.")
|
|
2875
|
+
}).nullable().describe("Request budget from the last poll of this source that reported one, or null when none did."),
|
|
2876
|
+
stale: z.boolean().describe("Whether facts from this source exceed their freshness threshold."),
|
|
2877
|
+
healthySince: z.iso.datetime().nullable().describe("When this source became usable (not blind) in this daemon run: its first non-blind observation since daemon start or since it was last blind. Stale, warming-up or budget-wait spells that did not make it blind do not move it. Null while blind or before that observation. Resets when the daemon restarts; compare with daemon.startedAt."),
|
|
2878
|
+
warmingUp: z.boolean().describe("Whether this source needs a complete poll in this daemon run."),
|
|
2879
|
+
defaultBranch: defaultBranchViewSchema.nullable().optional().describe("GitHub pull request sources only: the default-branch colour, red when the latest check run of a push-triggered workflow finished without success (failed, cancelled, timed out) or a commit status failed (scheduled and other runs ignored, branch protection not read); null until a poll reads it.")
|
|
2880
|
+
}).describe("Freshness and availability of one source.");
|
|
2830
2881
|
// ../contracts/src/ops/config-view-schema.ts
|
|
2831
2882
|
const configViewSchema = z.strictObject({
|
|
2832
2883
|
projects: z.array(z.strictObject({
|
|
@@ -2877,27 +2928,6 @@ const inboxEntrySchema = z.strictObject({
|
|
|
2877
2928
|
}).describe("One entry of the operator inbox.");
|
|
2878
2929
|
/** An operator inbox entry cleared, answered or closed in the last 24 hours. */
|
|
2879
2930
|
const inboxHandledSchema = inboxEntrySchema.extend({ handledAt: z.iso.datetime().describe("When it was cleared, answered or closed, ISO 8601 UTC.") }).describe("An operator inbox entry handled in the last 24 hours.");
|
|
2880
|
-
// ../contracts/src/ops/source-view-schema.ts
|
|
2881
|
-
const sourceViewSchema = z.strictObject({
|
|
2882
|
-
pointsLastHour: z.int().nonnegative().optional().describe("Reported source points consumed during the preceding hour."),
|
|
2883
|
-
source: z.string().min(1).describe("Adapter source identifier."),
|
|
2884
|
-
observedAt: z.iso.datetime().nullable().describe("Time of the latest observation, if any."),
|
|
2885
|
-
lastCompleteAt: z.iso.datetime().nullable().describe("Time of the latest complete observation."),
|
|
2886
|
-
blindReason: z.enum([
|
|
2887
|
-
"auth",
|
|
2888
|
-
"config",
|
|
2889
|
-
"stale"
|
|
2890
|
-
]).nullable().describe("Why this source is blind, or null when it is usable."),
|
|
2891
|
-
message: z.string().nullable().describe("Short explanation of the source state."),
|
|
2892
|
-
budget: z.strictObject({
|
|
2893
|
-
remaining: z.int().nonnegative().describe("Requests or points the source still allowed."),
|
|
2894
|
-
limit: z.int().positive().nullable().describe("Full budget the source restores at reset, or null when it reported none."),
|
|
2895
|
-
resetAt: z.iso.datetime().describe("When the source said it restores the full budget.")
|
|
2896
|
-
}).nullable().describe("Request budget from the last poll of this source that reported one, or null when none did."),
|
|
2897
|
-
stale: z.boolean().describe("Whether facts from this source exceed their freshness threshold."),
|
|
2898
|
-
healthySince: z.iso.datetime().nullable().describe("When this source became usable (not blind) in this daemon run: its first non-blind observation since daemon start or since it was last blind. Stale, warming-up or budget-wait spells that did not make it blind do not move it. Null while blind or before that observation. Resets when the daemon restarts; compare with daemon.startedAt."),
|
|
2899
|
-
warmingUp: z.boolean().describe("Whether this source needs a complete poll in this daemon run.")
|
|
2900
|
-
}).describe("Freshness and availability of one source.");
|
|
2901
2931
|
errorDetailSchema.extend({
|
|
2902
2932
|
type: z.url(),
|
|
2903
2933
|
title: z.string(),
|
|
@@ -4974,4 +5004,4 @@ const remoteDoctorReportSchema = z.object({
|
|
|
4974
5004
|
function assertNever(value) {
|
|
4975
5005
|
throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
|
|
4976
5006
|
}
|
|
4977
|
-
export {
|
|
5007
|
+
export { parseRef as $, defaultBranchFactSchema as A, isExternalAuthor as B, messageRefSchema as C, TASK_HOLDS as Ct, eventPayloadSchemas as D, GATE_REASONS as E, trackerSourceId as F, sessionFactsSchema as G, prFactsSchema as H, PR_STATES as I, REF_NUMBER as J, ticketFactsSchema as K, REVIEW_STATES as L, prSourceId as M, sessionTransitionSchema as N, AdapterError as O, sourceCursorSchema as P, parseActorId as Q, SESSION_HEALTH_STATES as R, interactionRefSchema as S, SLACK_BOT_SCOPES as St, EVENT_KINDS as T, prRefSchema as U, parseRingMarker as V, ringMarker as W, encodeActorId as X, actorIdSchema as Y, errorCodeOf as Z, renderJsonError as _, requiredSecretKeys as _t, requestHashOf as a, successEnvelopeSchema as at, conversationRefSchema as b, DISPATCHER_MODES as bt, tokenRequestStatusSchema as c, DEFAULT_SLACK_APP_NAME as ct, buildCatalogSnapshot as d, RESERVED_PROJECT as dt, ERRORS as et, roleCanUseOperation as f, boardWideSpurProject as ft, renderHttpProblem as g, plainHttpAllowed as gt, turnHandedSchema as h, defaultAddressee as ht, TOKEN_REQUEST_LIMITS as i, ok as it, entityRefSchema as j, batchSchema as k, BOARD_TICK_MS as l, DEFAULT_SLACK_COMMAND as lt, defaultBranchViewSchema as m, configSchema as mt, doctorReportSchema as n, errorContextSchema as nt, tokenRequestResultSchema as o, DEFAULT_HTTP_PORT as ot, OPERATIONS as p, configBindings as pt, JIRA_PROJECT_KEY as q, remoteDoctorReportSchema as r, errorEnvelopeSchema as rt, tokenRequestSchema as s, DEFAULT_LINK as st, assertNever as t, err as tt, SYSTEMD_SERVICE_SETTINGS as u, DEFAULT_STAND_PORT_RANGE as ut, renderMcpError as v, resolveWebOrigin as vt, userIdSchema as w, VIAS as wt, inboundEventSchema as x, ITEM_KINDS as xt, SPACE_IDS as y, COLUMN_IDS as yt, SESSION_STATUSES as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as renderJsonError, at as successEnvelopeSchema, c as tokenRequestStatusSchema, et as ERRORS, nt as errorContextSchema, o as tokenRequestResultSchema, rt as errorEnvelopeSchema } from "./chunk-C34hsfqb.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { St as SLACK_BOT_SCOPES, Y as actorIdSchema, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, et as ERRORS, f as roleCanUseOperation, mt as configSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as DEFAULT_STAND_PORT_RANGE, vt as resolveWebOrigin } from "./chunk-C34hsfqb.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
|
|
3
|
-
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-
|
|
4
|
-
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-
|
|
3
|
+
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-Dz9IMhY5.mjs";
|
|
4
|
+
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-4C7tYXYO.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, userInfo } from "node:os";
|
package/dist/client.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-
|
|
1
|
+
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-Dz9IMhY5.mjs";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as parseRef$1, A as defaultBranchFactSchema, B as isExternalAuthor, C as messageRefSchema, Ct as TASK_HOLDS, D as eventPayloadSchemas, E as GATE_REASONS, F as trackerSourceId, G as sessionFactsSchema, H as prFactsSchema, I as PR_STATES, J as REF_NUMBER, K as ticketFactsSchema, L as REVIEW_STATES, M as prSourceId, N as sessionTransitionSchema, O as AdapterError, P as sourceCursorSchema, Q as parseActorId, R as SESSION_HEALTH_STATES, S as interactionRefSchema, St as SLACK_BOT_SCOPES, T as EVENT_KINDS, U as prRefSchema, V as parseRingMarker, W as ringMarker, X as encodeActorId, Y as actorIdSchema, Z as errorCodeOf, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, b as conversationRefSchema, bt as DISPATCHER_MODES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as RESERVED_PROJECT, et as ERRORS, f as roleCanUseOperation, ft as boardWideSpurProject, g as renderHttpProblem, gt as plainHttpAllowed, h as turnHandedSchema, ht as defaultAddressee, i as TOKEN_REQUEST_LIMITS, it as ok, j as entityRefSchema, k as batchSchema, l as BOARD_TICK_MS, lt as DEFAULT_SLACK_COMMAND, m as defaultBranchViewSchema, mt as configSchema, n as doctorReportSchema, o as tokenRequestResultSchema, p as OPERATIONS, pt as configBindings, q as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as DEFAULT_LINK, t as assertNever, tt as err, vt as resolveWebOrigin, w as userIdSchema, wt as VIAS, x as inboundEventSchema, xt as ITEM_KINDS, y as SPACE_IDS, yt as COLUMN_IDS, z as SESSION_STATUSES } from "./chunk-C34hsfqb.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -8064,6 +8064,15 @@ function parsePr(detail) {
|
|
|
8064
8064
|
return null;
|
|
8065
8065
|
}
|
|
8066
8066
|
}
|
|
8067
|
+
/** A source's stored default-branch colour, or null when none is stored or it is unreadable. */
|
|
8068
|
+
function parseDefaultBranch(text) {
|
|
8069
|
+
if (text == null) return null;
|
|
8070
|
+
try {
|
|
8071
|
+
return defaultBranchViewSchema.safeParse(JSON.parse(text)).data ?? null;
|
|
8072
|
+
} catch {
|
|
8073
|
+
return null;
|
|
8074
|
+
}
|
|
8075
|
+
}
|
|
8067
8076
|
/** The project whose tracker or repo source wrote an observation. */
|
|
8068
8077
|
function projectForSource(config, source) {
|
|
8069
8078
|
return config.projects.find((project) => source === trackerSourceId(project) || project.repos.some((repo) => source === prSourceId(project.id, repo)));
|
|
@@ -8710,12 +8719,16 @@ const ITEM_POLICY = {
|
|
|
8710
8719
|
severity: "attention"
|
|
8711
8720
|
}
|
|
8712
8721
|
};
|
|
8713
|
-
/**
|
|
8722
|
+
/**
|
|
8723
|
+
* The `inbox.operator` severity of an item; a blind source's item and a red default branch's
|
|
8724
|
+
* item are failures.
|
|
8725
|
+
*/
|
|
8714
8726
|
function itemSeverity(kind, key) {
|
|
8715
|
-
return key.startsWith("source:") ? "failure" : ITEM_POLICY[kind].severity;
|
|
8727
|
+
return key.startsWith("source:") || key.startsWith("default-branch:") ? "failure" : ITEM_POLICY[kind].severity;
|
|
8716
8728
|
}
|
|
8717
|
-
/** Key prefixes of the items `reconcileItems` raises about a source or a block. */
|
|
8729
|
+
/** Key prefixes of the items `reconcileItems` raises about a source, its default branch or a block. */
|
|
8718
8730
|
const SOURCE_KEY = "source:";
|
|
8731
|
+
const DEFAULT_BRANCH_KEY = "default-branch:";
|
|
8719
8732
|
const OPERATOR_BLOCK_KEY = "operator-block:";
|
|
8720
8733
|
const BLOCK_KEY = "block:";
|
|
8721
8734
|
const CONVERSATION_KEY = "conversation:";
|
|
@@ -14037,6 +14050,7 @@ function observationAction(item) {
|
|
|
14037
14050
|
const key = item.item_key;
|
|
14038
14051
|
if (key.startsWith("pr-outcome:")) return "check the pull request, then close the item or archive the task";
|
|
14039
14052
|
if (key.startsWith("lookup:")) return "check the ticket in the tracker, then close the item or archive the task";
|
|
14053
|
+
if (key.startsWith("default-branch:")) return "open the failing run; fix or revert";
|
|
14040
14054
|
if (key.startsWith("operator-block:")) return `answer ${blockName(item)}`;
|
|
14041
14055
|
if (key.startsWith("block:")) return `answer ${blockName(item)} if it is a question, or close it with a reason`;
|
|
14042
14056
|
if (key.startsWith("filter:")) return "return the ticket to the tracker filter, or finish or unlink the linked work";
|
|
@@ -14717,7 +14731,10 @@ async function getStatus(deps, options = {}) {
|
|
|
14717
14731
|
const blindReason = row?.blind_reason === "auth" || row?.blind_reason === "config" || row?.blind_reason === "stale" ? row.blind_reason : null;
|
|
14718
14732
|
return {
|
|
14719
14733
|
source,
|
|
14720
|
-
...source.startsWith("github:")
|
|
14734
|
+
...source.startsWith("github:") && {
|
|
14735
|
+
pointsLastHour: points.get(source) ?? 0,
|
|
14736
|
+
defaultBranch: parseDefaultBranch(row?.default_branch)
|
|
14737
|
+
},
|
|
14721
14738
|
observedAt: row?.observed_at ?? null,
|
|
14722
14739
|
lastCompleteAt: last,
|
|
14723
14740
|
blindReason,
|
|
@@ -15585,6 +15602,24 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
15585
15602
|
priority: source.blind_reason === "auth" || source.blind_reason === "config" ? 2 : 4
|
|
15586
15603
|
});
|
|
15587
15604
|
}
|
|
15605
|
+
for (const project of config.projects) for (const repo of project.repos) {
|
|
15606
|
+
const source = prSourceId(project.id, repo);
|
|
15607
|
+
const branch = parseDefaultBranch(sourceById.get(source)?.default_branch);
|
|
15608
|
+
if (branch?.state !== "red") continue;
|
|
15609
|
+
const check = branch.check === null ? "a failing check" : branch.check;
|
|
15610
|
+
const run = branch.url === null ? "" : ` (run ${branch.url})`;
|
|
15611
|
+
candidates.push({
|
|
15612
|
+
key: `${DEFAULT_BRANCH_KEY}${source}`,
|
|
15613
|
+
kind: "board_observation",
|
|
15614
|
+
taskId: null,
|
|
15615
|
+
summary: `${repo}: ${branch.branch} is red since ${branch.sha.slice(0, 7)} (${check}): fix ${branch.branch} before merging more${run}`,
|
|
15616
|
+
factAt: branch.confirmedAt,
|
|
15617
|
+
source,
|
|
15618
|
+
priority: 2,
|
|
15619
|
+
revision: branch.since,
|
|
15620
|
+
...branch.url === null ? {} : { url: branch.url }
|
|
15621
|
+
});
|
|
15622
|
+
}
|
|
15588
15623
|
const tasks = await trx.selectFrom("task").selectAll().where("membership", "!=", "archived").execute();
|
|
15589
15624
|
const taskById = new Map(tasks.map((task) => [task.id, task]));
|
|
15590
15625
|
const misses = await trx.selectFrom("source_miss").selectAll().execute();
|
|
@@ -16018,7 +16053,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
16018
16053
|
itemKey: candidate.key,
|
|
16019
16054
|
kind: candidate.kind,
|
|
16020
16055
|
text: candidate.summary,
|
|
16021
|
-
url: task === null || task === void 0 ?
|
|
16056
|
+
url: candidate.url ?? (task === null || task === void 0 ? "https://github.com" : taskUrl(task, config)),
|
|
16022
16057
|
at: new Date(now),
|
|
16023
16058
|
fingerprint: hash,
|
|
16024
16059
|
factAt: candidate.factAt,
|
|
@@ -17956,7 +17991,30 @@ async function updateTerminal(trx, config, taskId, at, completeSince, blind) {
|
|
|
17956
17991
|
async function blindReason(trx, source) {
|
|
17957
17992
|
return (await trx.selectFrom("source_state").select("blind_reason").where("source", "=", source).executeTakeFirst())?.blind_reason ?? null;
|
|
17958
17993
|
}
|
|
17959
|
-
|
|
17994
|
+
/**
|
|
17995
|
+
* The default-branch colour to store, or undefined to keep the stored one: a batch without a fact
|
|
17996
|
+
* says nothing, and the same colour on the same branch keeps the first commit, check and run and
|
|
17997
|
+
* only moves `confirmedAt`.
|
|
17998
|
+
*/
|
|
17999
|
+
async function nextDefaultBranch(trx, source, fact, at) {
|
|
18000
|
+
if (fact === void 0 || at === void 0) return void 0;
|
|
18001
|
+
const stored = parseDefaultBranch((await trx.selectFrom("source_state").select("default_branch").where("source", "=", source).executeTakeFirst())?.default_branch);
|
|
18002
|
+
if (stored?.state === fact.state && stored.branch === fact.branch) return toJson(defaultBranchViewSchema, {
|
|
18003
|
+
...stored,
|
|
18004
|
+
confirmedAt: at
|
|
18005
|
+
});
|
|
18006
|
+
return toJson(defaultBranchViewSchema, {
|
|
18007
|
+
branch: fact.branch,
|
|
18008
|
+
state: fact.state,
|
|
18009
|
+
sha: fact.sha,
|
|
18010
|
+
since: at,
|
|
18011
|
+
confirmedAt: at,
|
|
18012
|
+
check: fact.state === "red" ? fact.check : null,
|
|
18013
|
+
url: fact.state === "red" ? fact.url : null
|
|
18014
|
+
});
|
|
18015
|
+
}
|
|
18016
|
+
async function sourceState(trx, source, state, observedAt, cursor, budget, defaultBranch) {
|
|
18017
|
+
const branch = await nextDefaultBranch(trx, source, defaultBranch, observedAt);
|
|
17960
18018
|
await trx.insertInto("source_state").values({
|
|
17961
18019
|
source,
|
|
17962
18020
|
initialized: observedAt === void 0 ? 0 : 1,
|
|
@@ -17968,7 +18026,8 @@ async function sourceState(trx, source, state, observedAt, cursor, budget) {
|
|
|
17968
18026
|
gone: toJson(z.array(entityRefSchema), [...state.gone]),
|
|
17969
18027
|
budget_remaining: budget?.remaining ?? null,
|
|
17970
18028
|
budget_limit: budget?.limit ?? null,
|
|
17971
|
-
budget_reset_at: budget?.resetAt ?? null
|
|
18029
|
+
budget_reset_at: budget?.resetAt ?? null,
|
|
18030
|
+
default_branch: branch ?? null
|
|
17972
18031
|
}).onConflict((oc) => oc.column("source").doUpdateSet((eb) => ({
|
|
17973
18032
|
initialized: observedAt === void 0 ? eb.ref("source_state.initialized") : 1,
|
|
17974
18033
|
last_complete_at: state.lastCompleteAt ?? null,
|
|
@@ -17979,7 +18038,8 @@ async function sourceState(trx, source, state, observedAt, cursor, budget) {
|
|
|
17979
18038
|
gone: toJson(z.array(entityRefSchema), [...state.gone]),
|
|
17980
18039
|
budget_remaining: budget === void 0 ? eb.ref("source_state.budget_remaining") : budget.remaining,
|
|
17981
18040
|
budget_limit: budget === void 0 ? eb.ref("source_state.budget_limit") : budget.limit ?? null,
|
|
17982
|
-
budget_reset_at: budget === void 0 ? eb.ref("source_state.budget_reset_at") : budget.resetAt
|
|
18041
|
+
budget_reset_at: budget === void 0 ? eb.ref("source_state.budget_reset_at") : budget.resetAt,
|
|
18042
|
+
default_branch: branch ?? eb.ref("source_state.default_branch")
|
|
17983
18043
|
}))).execute();
|
|
17984
18044
|
}
|
|
17985
18045
|
/**
|
|
@@ -18618,7 +18678,7 @@ function createObservationCore(deps) {
|
|
|
18618
18678
|
const wasBlind = await blindReason(trx, source);
|
|
18619
18679
|
const previousSpur = source === "spur" ? await trx.selectFrom("source_state").select("last_complete_at").where("source", "=", source).executeTakeFirst() : void 0;
|
|
18620
18680
|
const spurGap = previousSpur?.last_complete_at != null && Date.parse(batch.observedAt) > Date.parse(previousSpur.last_complete_at) + config.adapters.spur.intervalMs * config.thresholds.staleMultiplier;
|
|
18621
|
-
await sourceState(trx, source, observation.state, batch.observedAt, batch.cursor, batch.budget);
|
|
18681
|
+
await sourceState(trx, source, observation.state, batch.observedAt, batch.cursor, batch.budget, batch.defaultBranch);
|
|
18622
18682
|
await recordUsage(trx, source, batch.usage, now);
|
|
18623
18683
|
for (const probe of batch.prProbes ?? []) {
|
|
18624
18684
|
if (probe.status !== "closed") continue;
|
|
@@ -20755,8 +20815,9 @@ function aliases(numbers, fields) {
|
|
|
20755
20815
|
return numbers.map((number, i) => `pr${String(i)}: repository(owner: $owner, name: $repo) { pullRequest(number: ${String(number)}) { ${fields(number)} } }`).join("\n");
|
|
20756
20816
|
}
|
|
20757
20817
|
const discoveryStates = (bootstrap) => bootstrap ? "OPEN" : "OPEN, MERGED, CLOSED";
|
|
20818
|
+
const DEFAULT_BRANCH_FIELDS = "defaultBranchRef { name target { __typename ... on Commit { oid statusCheckRollup { contexts(first: 100) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt detailsUrl checkSuite { createdAt workflowRun { event workflow { id } } } } ... on StatusContext { __typename context state createdAt targetUrl } } pageInfo { hasNextPage } } } } } }";
|
|
20758
20819
|
function discoveryQuery(bootstrap = false) {
|
|
20759
|
-
return `query PrBatch($owner: String!, $repo: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} }${bootstrap ? " mergedBaseline: pullRequests(first: 1, states: [MERGED, CLOSED], orderBy: {field: UPDATED_AT, direction: DESC}) { nodes { updatedAt } }" : ""} } }`;
|
|
20820
|
+
return `query PrBatch($owner: String!, $repo: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} }${bootstrap ? " mergedBaseline: pullRequests(first: 1, states: [MERGED, CLOSED], orderBy: {field: UPDATED_AT, direction: DESC}) { nodes { updatedAt } }" : ""} ${DEFAULT_BRANCH_FIELDS} } }`;
|
|
20760
20821
|
}
|
|
20761
20822
|
function stateQuery(numbers) {
|
|
20762
20823
|
return `query PrStates($owner: String!, $repo: String!) { rateLimit { cost limit remaining resetAt } ${aliases(numbers, () => "number state")} }`;
|
|
@@ -20859,55 +20920,6 @@ var GithubClient = class {
|
|
|
20859
20920
|
};
|
|
20860
20921
|
}
|
|
20861
20922
|
};
|
|
20862
|
-
// ../adapters/src/github/discovery.ts
|
|
20863
|
-
const timestamp$1 = z.string().min(1).refine((value) => !Number.isNaN(Date.parse(value)));
|
|
20864
|
-
const discoveryNodeWire = z.object({
|
|
20865
|
-
number: z.int().positive(),
|
|
20866
|
-
state: z.string().optional(),
|
|
20867
|
-
updatedAt: timestamp$1,
|
|
20868
|
-
author: z.object({ login: z.string() }).nullable()
|
|
20869
|
-
});
|
|
20870
|
-
const baselineNodeWire = z.object({ updatedAt: timestamp$1 });
|
|
20871
|
-
function latestUpdatedAt(nodes, previous) {
|
|
20872
|
-
let high = previous;
|
|
20873
|
-
for (const node of nodes) {
|
|
20874
|
-
const updated = sourceCursorSchema.parse(node.updatedAt);
|
|
20875
|
-
if (high === void 0 || Date.parse(updated) > Date.parse(high)) high = updated;
|
|
20876
|
-
}
|
|
20877
|
-
return high;
|
|
20878
|
-
}
|
|
20879
|
-
/** The high-water cursor is an ISO timestamp. Equal timestamps are revisited. */
|
|
20880
|
-
function discover(nodes, previous, login) {
|
|
20881
|
-
let high = previous;
|
|
20882
|
-
const numbers = /* @__PURE__ */ new Set();
|
|
20883
|
-
const states = /* @__PURE__ */ new Map();
|
|
20884
|
-
for (const node of nodes) {
|
|
20885
|
-
const updated = sourceCursorSchema.parse(node.updatedAt);
|
|
20886
|
-
const updatedMs = Date.parse(updated);
|
|
20887
|
-
if (high === void 0 || updatedMs > Date.parse(high)) high = updated;
|
|
20888
|
-
if (previous !== void 0 && updatedMs < Date.parse(previous)) continue;
|
|
20889
|
-
states.set(node.number, node.state);
|
|
20890
|
-
if (node.author?.login.toLowerCase() !== login.toLowerCase()) continue;
|
|
20891
|
-
numbers.add(node.number);
|
|
20892
|
-
}
|
|
20893
|
-
return {
|
|
20894
|
-
numbers: [...numbers],
|
|
20895
|
-
states,
|
|
20896
|
-
...high === void 0 ? {} : { cursor: high }
|
|
20897
|
-
};
|
|
20898
|
-
}
|
|
20899
|
-
/** Pages are sorted newest first; older nodes end the scan, while ties must be revisited. */
|
|
20900
|
-
function pastCursor(nodes, previous) {
|
|
20901
|
-
const oldest = nodes.at(-1);
|
|
20902
|
-
if (previous === void 0 || oldest === void 0) return false;
|
|
20903
|
-
return Date.parse(oldest.updatedAt) < Date.parse(previous);
|
|
20904
|
-
}
|
|
20905
|
-
function nextPage(connection) {
|
|
20906
|
-
const { hasNextPage, endCursor } = connection.pageInfo;
|
|
20907
|
-
if (!hasNextPage) return void 0;
|
|
20908
|
-
if (!endCursor) throw new Error("Malformed GitHub pagination");
|
|
20909
|
-
return endCursor;
|
|
20910
|
-
}
|
|
20911
20923
|
// ../adapters/src/github/feedbackLinks.ts
|
|
20912
20924
|
const threadCommentWire = z.object({
|
|
20913
20925
|
id: z.string().min(1),
|
|
@@ -21085,6 +21097,7 @@ function closingRefs(wire) {
|
|
|
21085
21097
|
number: node.number
|
|
21086
21098
|
}] : []);
|
|
21087
21099
|
}
|
|
21100
|
+
/** The contracts check state of a check run or commit status. */
|
|
21088
21101
|
function checkState(node) {
|
|
21089
21102
|
if (node.__typename === "StatusContext") {
|
|
21090
21103
|
const state = node.state.toLowerCase();
|
|
@@ -21103,13 +21116,17 @@ function checkState(node) {
|
|
|
21103
21116
|
"stale"
|
|
21104
21117
|
].find((state) => state === value) ?? "error";
|
|
21105
21118
|
}
|
|
21119
|
+
/** When a context ran, to keep the latest per name; an empty string sorts first. */
|
|
21120
|
+
function contextAt(node) {
|
|
21121
|
+
return node.__typename === "StatusContext" ? node.createdAt : node.startedAt ?? node.checkSuite?.createdAt ?? node.completedAt ?? "";
|
|
21122
|
+
}
|
|
21106
21123
|
function latestChecks(nodes) {
|
|
21107
21124
|
const latest = /* @__PURE__ */ new Map();
|
|
21108
21125
|
for (const node of nodes) {
|
|
21109
21126
|
const status = node.__typename === "StatusContext";
|
|
21110
21127
|
const name = status ? node.context : node.name;
|
|
21111
21128
|
const completedAt = status ? null : node.completedAt;
|
|
21112
|
-
const at =
|
|
21129
|
+
const at = contextAt(node);
|
|
21113
21130
|
const old = latest.get(name);
|
|
21114
21131
|
if (old !== void 0 && old.at > at) continue;
|
|
21115
21132
|
latest.set(name, {
|
|
@@ -21335,6 +21352,158 @@ function normalizePr(repo, value, rule, feedbackComplete, held = []) {
|
|
|
21335
21352
|
if (!parsed.success) throw new AdapterError("transient", "Malformed GitHub PR facts", { cause: parsed.error });
|
|
21336
21353
|
return parsed.data;
|
|
21337
21354
|
}
|
|
21355
|
+
// ../adapters/src/github/discovery.ts
|
|
21356
|
+
const timestamp$1 = z.string().min(1).refine((value) => !Number.isNaN(Date.parse(value)));
|
|
21357
|
+
const discoveryNodeWire = z.object({
|
|
21358
|
+
number: z.int().positive(),
|
|
21359
|
+
state: z.string().optional(),
|
|
21360
|
+
updatedAt: timestamp$1,
|
|
21361
|
+
author: z.object({ login: z.string() }).nullable()
|
|
21362
|
+
});
|
|
21363
|
+
const baselineNodeWire = z.object({ updatedAt: timestamp$1 });
|
|
21364
|
+
function latestUpdatedAt(nodes, previous) {
|
|
21365
|
+
let high = previous;
|
|
21366
|
+
for (const node of nodes) {
|
|
21367
|
+
const updated = sourceCursorSchema.parse(node.updatedAt);
|
|
21368
|
+
if (high === void 0 || Date.parse(updated) > Date.parse(high)) high = updated;
|
|
21369
|
+
}
|
|
21370
|
+
return high;
|
|
21371
|
+
}
|
|
21372
|
+
/** The high-water cursor is an ISO timestamp. Equal timestamps are revisited. */
|
|
21373
|
+
function discover(nodes, previous, login) {
|
|
21374
|
+
let high = previous;
|
|
21375
|
+
const numbers = /* @__PURE__ */ new Set();
|
|
21376
|
+
const states = /* @__PURE__ */ new Map();
|
|
21377
|
+
for (const node of nodes) {
|
|
21378
|
+
const updated = sourceCursorSchema.parse(node.updatedAt);
|
|
21379
|
+
const updatedMs = Date.parse(updated);
|
|
21380
|
+
if (high === void 0 || updatedMs > Date.parse(high)) high = updated;
|
|
21381
|
+
if (previous !== void 0 && updatedMs < Date.parse(previous)) continue;
|
|
21382
|
+
states.set(node.number, node.state);
|
|
21383
|
+
if (node.author?.login.toLowerCase() !== login.toLowerCase()) continue;
|
|
21384
|
+
numbers.add(node.number);
|
|
21385
|
+
}
|
|
21386
|
+
return {
|
|
21387
|
+
numbers: [...numbers],
|
|
21388
|
+
states,
|
|
21389
|
+
...high === void 0 ? {} : { cursor: high }
|
|
21390
|
+
};
|
|
21391
|
+
}
|
|
21392
|
+
/** Pages are sorted newest first; older nodes end the scan, while ties must be revisited. */
|
|
21393
|
+
function pastCursor(nodes, previous) {
|
|
21394
|
+
const oldest = nodes.at(-1);
|
|
21395
|
+
if (previous === void 0 || oldest === void 0) return false;
|
|
21396
|
+
return Date.parse(oldest.updatedAt) < Date.parse(previous);
|
|
21397
|
+
}
|
|
21398
|
+
function nextPage(connection) {
|
|
21399
|
+
const { hasNextPage, endCursor } = connection.pageInfo;
|
|
21400
|
+
if (!hasNextPage) return void 0;
|
|
21401
|
+
if (!endCursor) throw new Error("Malformed GitHub pagination");
|
|
21402
|
+
return endCursor;
|
|
21403
|
+
}
|
|
21404
|
+
const branchCheckRunWire = z.object({
|
|
21405
|
+
__typename: z.literal("CheckRun"),
|
|
21406
|
+
name: z.string(),
|
|
21407
|
+
status: z.string(),
|
|
21408
|
+
conclusion: z.string().nullable(),
|
|
21409
|
+
startedAt: z.string().nullish(),
|
|
21410
|
+
completedAt: z.string().nullable(),
|
|
21411
|
+
detailsUrl: z.string().nullish(),
|
|
21412
|
+
checkSuite: z.object({
|
|
21413
|
+
createdAt: z.string(),
|
|
21414
|
+
workflowRun: z.object({
|
|
21415
|
+
event: z.string(),
|
|
21416
|
+
workflow: z.object({ id: z.string().min(1) })
|
|
21417
|
+
}).nullish()
|
|
21418
|
+
}).nullish()
|
|
21419
|
+
});
|
|
21420
|
+
const branchStatusWire = z.object({
|
|
21421
|
+
__typename: z.literal("StatusContext"),
|
|
21422
|
+
context: z.string(),
|
|
21423
|
+
state: z.string(),
|
|
21424
|
+
createdAt: z.string(),
|
|
21425
|
+
targetUrl: z.string().nullish()
|
|
21426
|
+
});
|
|
21427
|
+
const branchContextWire = z.discriminatedUnion("__typename", [branchCheckRunWire, branchStatusWire]);
|
|
21428
|
+
const defaultBranchWire = z.object({ defaultBranchRef: z.object({
|
|
21429
|
+
name: z.string(),
|
|
21430
|
+
target: z.object({
|
|
21431
|
+
__typename: z.literal("Commit"),
|
|
21432
|
+
oid: z.string(),
|
|
21433
|
+
statusCheckRollup: z.object({ contexts: z.object({
|
|
21434
|
+
nodes: z.array(branchContextWire),
|
|
21435
|
+
pageInfo: z.object({ hasNextPage: z.boolean() })
|
|
21436
|
+
}) })
|
|
21437
|
+
})
|
|
21438
|
+
}) });
|
|
21439
|
+
/**
|
|
21440
|
+
* Only reruns of one check replace each other: a commit status by its context, a check run by
|
|
21441
|
+
* its workflow and job name. A check run outside a push-triggered workflow has no key.
|
|
21442
|
+
*/
|
|
21443
|
+
function checkKey(node) {
|
|
21444
|
+
if (node.__typename === "StatusContext") return `status:${node.context}`;
|
|
21445
|
+
const run = node.checkSuite?.workflowRun;
|
|
21446
|
+
if (run?.event !== "push") return void 0;
|
|
21447
|
+
return `check:${run.workflow.id}:${node.name}`;
|
|
21448
|
+
}
|
|
21449
|
+
const PASSED = /* @__PURE__ */ new Set([
|
|
21450
|
+
"success",
|
|
21451
|
+
"neutral",
|
|
21452
|
+
"skipped"
|
|
21453
|
+
]);
|
|
21454
|
+
const RUNNING = /* @__PURE__ */ new Set(["pending", "expected"]);
|
|
21455
|
+
/**
|
|
21456
|
+
* The colour of the default-branch head in a discovery response's `repository`, or undefined
|
|
21457
|
+
* when it is unknown: an unexpected shape, a running head, no counted check, or a truncated page
|
|
21458
|
+
* with no failure in it. Only check runs of push-triggered workflows and commit statuses count;
|
|
21459
|
+
* the latest run of each check decides (see `checkKey`). A run URL that is not http(s) becomes null.
|
|
21460
|
+
*/
|
|
21461
|
+
function defaultBranchFact(repository) {
|
|
21462
|
+
const parsed = defaultBranchWire.safeParse(repository);
|
|
21463
|
+
if (!parsed.success) return void 0;
|
|
21464
|
+
const { name: branch, target } = parsed.data.defaultBranchRef;
|
|
21465
|
+
const { nodes, pageInfo } = target.statusCheckRollup.contexts;
|
|
21466
|
+
const latest = /* @__PURE__ */ new Map();
|
|
21467
|
+
for (const node of nodes) {
|
|
21468
|
+
const key = checkKey(node);
|
|
21469
|
+
if (key === void 0) continue;
|
|
21470
|
+
const old = latest.get(key);
|
|
21471
|
+
if (old !== void 0 && contextAt(old.node) > contextAt(node)) continue;
|
|
21472
|
+
latest.set(key, {
|
|
21473
|
+
check: node.__typename === "StatusContext" ? node.context : node.name,
|
|
21474
|
+
node
|
|
21475
|
+
});
|
|
21476
|
+
}
|
|
21477
|
+
const kept = [...latest.entries()].sort(([a, x], [b, y]) => x.check.localeCompare(y.check) || a.localeCompare(b)).map(([, { check, node }]) => ({
|
|
21478
|
+
check,
|
|
21479
|
+
node,
|
|
21480
|
+
state: checkState(node)
|
|
21481
|
+
}));
|
|
21482
|
+
const failing = kept.find(({ state }) => !PASSED.has(state) && !RUNNING.has(state));
|
|
21483
|
+
if (failing !== void 0) {
|
|
21484
|
+
const { check, node } = failing;
|
|
21485
|
+
const url = (node.__typename === "StatusContext" ? node.targetUrl : node.detailsUrl) ?? null;
|
|
21486
|
+
const red = {
|
|
21487
|
+
state: "red",
|
|
21488
|
+
branch,
|
|
21489
|
+
sha: target.oid,
|
|
21490
|
+
check,
|
|
21491
|
+
url
|
|
21492
|
+
};
|
|
21493
|
+
const fact = defaultBranchFactSchema.safeParse(red);
|
|
21494
|
+
if (fact.success) return fact.data;
|
|
21495
|
+
return url === null ? void 0 : defaultBranchFactSchema.safeParse({
|
|
21496
|
+
...red,
|
|
21497
|
+
url: null
|
|
21498
|
+
}).data;
|
|
21499
|
+
}
|
|
21500
|
+
if (kept.length === 0 || pageInfo.hasNextPage || kept.some(({ state }) => !PASSED.has(state))) return void 0;
|
|
21501
|
+
return defaultBranchFactSchema.safeParse({
|
|
21502
|
+
state: "green",
|
|
21503
|
+
branch,
|
|
21504
|
+
sha: target.oid
|
|
21505
|
+
}).data;
|
|
21506
|
+
}
|
|
21338
21507
|
const counted = (node) => z.object({
|
|
21339
21508
|
totalCount: z.int().nonnegative(),
|
|
21340
21509
|
nodes: z.array(node)
|
|
@@ -21834,18 +22003,25 @@ function chunks(numbers, size) {
|
|
|
21834
22003
|
return out;
|
|
21835
22004
|
}
|
|
21836
22005
|
const aliasesOf = (numbers) => numbers.map((_, i) => `pr${String(i)}`);
|
|
21837
|
-
|
|
22006
|
+
const branchScoped = (error) => error.path?.[1] === "defaultBranchRef";
|
|
22007
|
+
/**
|
|
22008
|
+
* Lists the repository's PRs since the cursor; a transient failure leaves `ok` false. The first
|
|
22009
|
+
* response also gives the default-branch colour, whatever the PR listing's outcome.
|
|
22010
|
+
*/
|
|
21838
22011
|
async function readDiscovery(scope, acc, ctx, login) {
|
|
21839
22012
|
const bootstrap = ctx.cursor === void 0;
|
|
21840
22013
|
const response = await attempt(scope, discoveryQuery(bootstrap));
|
|
21841
22014
|
if (response === void 0) return {
|
|
21842
22015
|
ok: false,
|
|
21843
22016
|
found: discover([], ctx.cursor, login),
|
|
21844
|
-
bootstrapCursor: void 0
|
|
22017
|
+
bootstrapCursor: void 0,
|
|
22018
|
+
defaultBranch: void 0
|
|
21845
22019
|
};
|
|
21846
22020
|
acc.budget = response.budget;
|
|
21847
|
-
|
|
21848
|
-
|
|
22021
|
+
const errors = response.errors.filter((error) => !branchScoped(error));
|
|
22022
|
+
const defaultBranch = errors.length === response.errors.length ? defaultBranchFact(response.data.repository) : void 0;
|
|
22023
|
+
rejectUnscoped(errors, ["repository"]);
|
|
22024
|
+
let ok = scoped(errors, "repository").length === 0;
|
|
21849
22025
|
const first = ok ? parseWire(discoveryRootWire, response.data.repository, MALFORMED$2, ["data", "repository"]).pullRequests : void 0;
|
|
21850
22026
|
const nodes = first === void 0 ? [] : [...first.nodes];
|
|
21851
22027
|
let cursor = first === void 0 || pastCursor(nodes, ctx.cursor) ? void 0 : nextPage(first);
|
|
@@ -21873,7 +22049,8 @@ async function readDiscovery(scope, acc, ctx, login) {
|
|
|
21873
22049
|
return {
|
|
21874
22050
|
ok,
|
|
21875
22051
|
found,
|
|
21876
|
-
bootstrapCursor
|
|
22052
|
+
bootstrapCursor,
|
|
22053
|
+
defaultBranch
|
|
21877
22054
|
};
|
|
21878
22055
|
}
|
|
21879
22056
|
/** Reads the light index of `numbers`; a PR left out of the map is read in full. */
|
|
@@ -22054,7 +22231,8 @@ async function pollRepository({ id, repo, login, keys, client, now, ctx, reserve
|
|
|
22054
22231
|
entities: acc.entities,
|
|
22055
22232
|
...prProbes.length === 0 ? {} : { prProbes },
|
|
22056
22233
|
...discovery.ok && discoveredOk ? nextCursor === void 0 ? {} : { cursor: nextCursor } : ctx.cursor === void 0 ? {} : { cursor: ctx.cursor },
|
|
22057
|
-
...acc.budget === void 0 ? {} : { budget: acc.budget }
|
|
22234
|
+
...acc.budget === void 0 ? {} : { budget: acc.budget },
|
|
22235
|
+
...discovery.defaultBranch === void 0 ? {} : { defaultBranch: discovery.defaultBranch }
|
|
22058
22236
|
};
|
|
22059
22237
|
}
|
|
22060
22238
|
async function pollOnePr({ id, repo, keys, client, now, ref, ctx, cache }) {
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as CliError, r as requestOperation } from "./chunk-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-
|
|
1
|
+
import { et as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-C34hsfqb.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-Dz9IMhY5.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-4C7tYXYO.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|