spur-board 0.171.3 → 0.171.4
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-d9D_ohWO.mjs → chunk-BuHn-rfD.mjs} +2 -2
- package/dist/{chunk-BYzkU1Kt.mjs → chunk-Bx3YMBLb.mjs} +1 -1
- package/dist/{chunk-DD_jEQTA.mjs → chunk-DQnJirZ1.mjs} +16 -15
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +61 -24
- package/dist/mcp.mjs +3 -3
- package/dist/web/assets/{index-CqfuJHHS.js → index-DlU7jT5n.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/skills/spur-board/references/how-board-works-inbox.md +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { At as configSchema, Lt as slackConfigured, Nt as plainHttpAllowed, g as OPERATIONS, m as buildCatalogSnapshot } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { At as configSchema, Lt as slackConfigured, Nt as plainHttpAllowed, g as OPERATIONS, m as buildCatalogSnapshot } from "./chunk-DQnJirZ1.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-Bx3YMBLb.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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _t as errorEnvelopeSchema, d as tokenRequestStatusSchema, gt as errorContextSchema, l as tokenRequestResultSchema, mt as ERRORS, x as renderJsonError, yt as successEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { _t as errorEnvelopeSchema, d as tokenRequestStatusSchema, gt as errorContextSchema, l as tokenRequestResultSchema, mt as ERRORS, x as renderJsonError, yt as successEnvelopeSchema } from "./chunk-DQnJirZ1.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
@@ -2182,23 +2182,24 @@ function itemAnswersRef(item, ref) {
|
|
|
2182
2182
|
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);
|
|
2183
2183
|
return itemIdentity(item) === refIdentity(ref);
|
|
2184
2184
|
}
|
|
2185
|
-
const
|
|
2185
|
+
const defaultBranchCommit = {
|
|
2186
2186
|
branch: z.string().min(1).describe("Name of the default branch."),
|
|
2187
|
-
sha: commitShaSchema.describe("
|
|
2187
|
+
sha: commitShaSchema.describe("Newest commit with counted checks in the default-branch read.")
|
|
2188
2188
|
};
|
|
2189
2189
|
/**
|
|
2190
|
-
* The colour of
|
|
2190
|
+
* The colour of the newest checked commit in the default-branch read. Push workflow checks and
|
|
2191
2191
|
* commit statuses count; scheduled and other runs, and check runs outside workflows, never do.
|
|
2192
|
+
* A push workflow suite with no check runs holds the read on that commit without a verdict.
|
|
2192
2193
|
*/
|
|
2193
2194
|
const defaultBranchFactSchema = z.discriminatedUnion("state", [z.strictObject({
|
|
2194
|
-
state: z.literal("green").describe("Every counted check finished
|
|
2195
|
-
...
|
|
2195
|
+
state: z.literal("green").describe("Every counted check finished as success, neutral or skipped."),
|
|
2196
|
+
...defaultBranchCommit
|
|
2196
2197
|
}), z.strictObject({
|
|
2197
|
-
state: z.literal("red").describe("At least one counted check
|
|
2198
|
-
...
|
|
2198
|
+
state: z.literal("red").describe("At least one counted check has a completed result other than success, neutral or skipped."),
|
|
2199
|
+
...defaultBranchCommit,
|
|
2199
2200
|
check: z.string().min(1).nullable().describe("Name of the first failing check, if known."),
|
|
2200
2201
|
url: webUrl.nullable().describe("Web URL of the failing run, or null when unknown.")
|
|
2201
|
-
})]).describe("Colour of the default-branch
|
|
2202
|
+
})]).describe("Colour of the newest checked commit in the default-branch read.");
|
|
2202
2203
|
const batchSchema = z.strictObject({
|
|
2203
2204
|
source: z.string().min(1).describe("Id of the adapter that produced the batch."),
|
|
2204
2205
|
observedAt: z.iso.datetime().describe("When the poll started (A2)."),
|
|
@@ -2225,7 +2226,7 @@ const batchSchema = z.strictObject({
|
|
|
2225
2226
|
limit: z.int().positive().optional().describe("Full budget the source restores at reset; omitted when it reports none."),
|
|
2226
2227
|
resetAt: z.iso.datetime().describe("When the source restores the full budget.")
|
|
2227
2228
|
}).optional().describe("Request budget the source reported on this poll; omitted when it reports none."),
|
|
2228
|
-
defaultBranch: defaultBranchFactSchema.optional().describe("Colour of the default-branch
|
|
2229
|
+
defaultBranch: defaultBranchFactSchema.optional().describe("Colour of the newest checked commit in the default-branch read. Omitted when the poll found no settled colour."),
|
|
2229
2230
|
mirror: z.strictObject({
|
|
2230
2231
|
title: z.string().min(1).describe("Title of the GitHub Project read."),
|
|
2231
2232
|
readiness: z.array(z.strictObject({
|
|
@@ -3450,16 +3451,16 @@ const inboxEntrySchema = z.strictObject({
|
|
|
3450
3451
|
/** An operator inbox entry cleared, answered or closed in the last 24 hours. */
|
|
3451
3452
|
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.");
|
|
3452
3453
|
// ../contracts/src/ops/source-view-schema.ts
|
|
3453
|
-
/** The stored colour of a repository's default
|
|
3454
|
+
/** The stored colour of a repository's default branch, as status.get shows it. */
|
|
3454
3455
|
const defaultBranchViewSchema = z.strictObject({
|
|
3455
3456
|
branch: z.string().min(1).describe("Name of the default branch."),
|
|
3456
|
-
state: z.enum(["red", "green"]).describe("
|
|
3457
|
-
sha: commitShaSchema.describe("
|
|
3457
|
+
state: z.enum(["red", "green"]).describe("Last settled colour read for the default branch."),
|
|
3458
|
+
sha: commitShaSchema.describe("Checked commit when this colour was first read. While red, the first red commit."),
|
|
3458
3459
|
since: z.iso.datetime().describe("When the board first read this colour."),
|
|
3459
|
-
confirmedAt: z.iso.datetime().describe("When a poll last read this colour
|
|
3460
|
+
confirmedAt: z.iso.datetime().describe("When a poll last read this colour, including via a checked parent of an unchecked head. A poll without a settled result keeps this time."),
|
|
3460
3461
|
check: z.string().min(1).nullable().describe("Name of the first failing check, or null."),
|
|
3461
3462
|
url: webUrl.nullable().describe("Web URL of the failing run, or null.")
|
|
3462
|
-
}).describe("Colour of the default-branch head.
|
|
3463
|
+
}).describe("Colour of the newest commit with a commit status or push-triggered workflow among the default-branch head and its seven nearest first parents. A push suite counts before its check runs appear. Red means a failed commit status or a latest push-workflow check with a completed result other than success, neutral or skipped. Scheduled, manual and non-workflow checks are ignored, and branch protection is not read. A poll without a settled result keeps the stored colour and operator item.");
|
|
3463
3464
|
const sourceViewSchema = z.strictObject({
|
|
3464
3465
|
pointsLastHour: z.int().nonnegative().optional().describe("Reported source points consumed during the preceding hour."),
|
|
3465
3466
|
source: z.string().min(1).describe("Adapter source identifier."),
|
|
@@ -3485,7 +3486,7 @@ const sourceViewSchema = z.strictObject({
|
|
|
3485
3486
|
waitsForBudget: z.boolean().describe("Whether the daemon's adapter runner has put off this source's next regular poll for a rate limit: the last regular poll in this daemon run either reported a budget under github.reserveRemaining (GitHub sources, complete or not) or failed as throttled, with or without a retry time (any source), or failed in any other way while the last budget a poll of this run reported, an on-demand refresh included, is under github.reserveRemaining with a future reset (this case also ends at that reset), and the paused poll has not started yet. Held in memory, so false after a restart until a poll pauses again; a stored budget or an on-demand refresh never sets it."),
|
|
3486
3487
|
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."),
|
|
3487
3488
|
warmingUp: z.boolean().describe("Whether this source needs a complete poll in this daemon run."),
|
|
3488
|
-
defaultBranch: defaultBranchViewSchema.nullable().optional().describe("GitHub pull request sources only
|
|
3489
|
+
defaultBranch: defaultBranchViewSchema.nullable().optional().describe("GitHub pull request sources only. The stored default-branch colour from the newest checked commit in the poll window, or null until a poll reads a settled result.")
|
|
3489
3490
|
}).describe("Freshness and availability of one source.");
|
|
3490
3491
|
// ../contracts/src/ops/move-schemas.ts
|
|
3491
3492
|
const taskMoveInputSchema = z.discriminatedUnion("mode", [z.strictObject({
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { At as configSchema, Ft as requiredSecretKeys, It as resolveWebOrigin, Lt as slackConfigured, Wt as SLACK_BOT_SCOPES, c as requestHashOf, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, lt as actorIdSchema, mt as ERRORS, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, r as SLACK_PARTLY_FIX, wt as DEFAULT_STAND_PORT_RANGE, yt as successEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { At as configSchema, Ft as requiredSecretKeys, It as resolveWebOrigin, Lt as slackConfigured, Wt as SLACK_BOT_SCOPES, c as requestHashOf, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, lt as actorIdSchema, mt as ERRORS, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, r as SLACK_PARTLY_FIX, wt as DEFAULT_STAND_PORT_RANGE, yt as successEnvelopeSchema } from "./chunk-DQnJirZ1.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 dataDirectory, d as readConfiguredPort, f as resolveDaemonAddress, i as fileVerdictCache, l as loadClientConfig, n as cliPackageVersion, o as boardSlackState, p as tokenInFolder, s as configFile, t as checkCatalog, u as loadEnrollmentConfig } 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-Bx3YMBLb.mjs";
|
|
4
|
+
import { a as memoryVerdictCache, c as dataDirectory, d as readConfiguredPort, f as resolveDaemonAddress, i as fileVerdictCache, l as loadClientConfig, n as cliPackageVersion, o as boardSlackState, p as tokenInFolder, s as configFile, t as checkCatalog, u as loadEnrollmentConfig } from "./chunk-BuHn-rfD.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, tmpdir, 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-Bx3YMBLb.mjs";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as parseRingMarker, A as skillReloadFilesSchema, At as configSchema, B as defaultBranchFactSchema, Bt as COLUMN_GROUPS, C as SPACE_IDS, Ct as DEFAULT_SLACK_COMMAND, D as messageRefSchema, Dt as boardWideSpurProject, E as interactionRefSchema, Et as approvalRuleOf, F as AdapterError, Ft as requiredSecretKeys, G as sourceCursorSchema, Gt as TASK_HOLDS, H as mirrorSourceId, Ht as DISPATCHER_MODES, I as MIRROR_FAILURES, It as resolveWebOrigin, J as REVIEW_DECISIONS, Jt as isTodoGroupColumn, K as trackerSourceId, Kt as TODO_GROUP_COLUMN_IDS, L as MIRROR_FAILURE_CODES, Lt as slackConfigured, M as EVENT_KINDS, Mt as externalQuietAfterMs, N as GATE_REASONS, Nt as plainHttpAllowed, O as userIdSchema, Ot as columnTurnTimings, P as eventPayloadSchemas, Pt as readyMirrorOf, Q as isExternalAuthor, R as SPUR_REQUEST_TIMEOUT, Rt as BLOCK_TYPES, T as inboundEventSchema, Tt as RESERVED_PROJECT, U as prSourceId, Ut as ITEM_KINDS, V as entityRefSchema, Vt as COLUMN_IDS, W as sessionTransitionSchema, Wt as SLACK_BOT_SCOPES, X as SESSION_HEALTH_STATES, Y as REVIEW_STATES, Z as SESSION_STATUSES, _ as defaultBranchViewSchema, a as doctorReportSchema, at as sessionFactsSchema, b as renderHttpProblem, c as requestHashOf, ct as REF_NUMBER, d as tokenRequestStatusSchema, dt as errorCodeOf, et as prApprovalPairSchema, f as BOARD_TICK_MS, ft as parseActorId, g as OPERATIONS, h as roleCanUseOperation, ht as err, i as SPUR_MIN_VERSION, it as ringMarker, j as sortSkillFiles, jt as defaultAddressee, kt as configBindings, l as tokenRequestResultSchema, lt as actorIdSchema, m as buildCatalogSnapshot, mt as ERRORS, n as SLACK_OFF_FIX, nt as prRefSchema, ot as ticketFactsSchema, pt as parseRef$1, q as PR_STATES, qt as VIAS, r as SLACK_PARTLY_FIX, rt as prReviewRuleSchema, s as TOKEN_REQUEST_LIMITS, st as JIRA_PROJECT_KEY, t as assertNever, tt as prFactsSchema, u as tokenRequestSchema, ut as encodeActorId, v as inboxNoSessionSchema, vt as ok, w as conversationRefSchema, xt as DEFAULT_LINK, y as turnHandedSchema, yt as successEnvelopeSchema, z as batchSchema, zt as COLUMNS } from "./chunk-
|
|
1
|
+
import { $ as parseRingMarker, A as skillReloadFilesSchema, At as configSchema, B as defaultBranchFactSchema, Bt as COLUMN_GROUPS, C as SPACE_IDS, Ct as DEFAULT_SLACK_COMMAND, D as messageRefSchema, Dt as boardWideSpurProject, E as interactionRefSchema, Et as approvalRuleOf, F as AdapterError, Ft as requiredSecretKeys, G as sourceCursorSchema, Gt as TASK_HOLDS, H as mirrorSourceId, Ht as DISPATCHER_MODES, I as MIRROR_FAILURES, It as resolveWebOrigin, J as REVIEW_DECISIONS, Jt as isTodoGroupColumn, K as trackerSourceId, Kt as TODO_GROUP_COLUMN_IDS, L as MIRROR_FAILURE_CODES, Lt as slackConfigured, M as EVENT_KINDS, Mt as externalQuietAfterMs, N as GATE_REASONS, Nt as plainHttpAllowed, O as userIdSchema, Ot as columnTurnTimings, P as eventPayloadSchemas, Pt as readyMirrorOf, Q as isExternalAuthor, R as SPUR_REQUEST_TIMEOUT, Rt as BLOCK_TYPES, T as inboundEventSchema, Tt as RESERVED_PROJECT, U as prSourceId, Ut as ITEM_KINDS, V as entityRefSchema, Vt as COLUMN_IDS, W as sessionTransitionSchema, Wt as SLACK_BOT_SCOPES, X as SESSION_HEALTH_STATES, Y as REVIEW_STATES, Z as SESSION_STATUSES, _ as defaultBranchViewSchema, a as doctorReportSchema, at as sessionFactsSchema, b as renderHttpProblem, c as requestHashOf, ct as REF_NUMBER, d as tokenRequestStatusSchema, dt as errorCodeOf, et as prApprovalPairSchema, f as BOARD_TICK_MS, ft as parseActorId, g as OPERATIONS, h as roleCanUseOperation, ht as err, i as SPUR_MIN_VERSION, it as ringMarker, j as sortSkillFiles, jt as defaultAddressee, kt as configBindings, l as tokenRequestResultSchema, lt as actorIdSchema, m as buildCatalogSnapshot, mt as ERRORS, n as SLACK_OFF_FIX, nt as prRefSchema, ot as ticketFactsSchema, pt as parseRef$1, q as PR_STATES, qt as VIAS, r as SLACK_PARTLY_FIX, rt as prReviewRuleSchema, s as TOKEN_REQUEST_LIMITS, st as JIRA_PROJECT_KEY, t as assertNever, tt as prFactsSchema, u as tokenRequestSchema, ut as encodeActorId, v as inboxNoSessionSchema, vt as ok, w as conversationRefSchema, xt as DEFAULT_LINK, y as turnHandedSchema, yt as successEnvelopeSchema, z as batchSchema, zt as COLUMNS } from "./chunk-DQnJirZ1.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";
|
|
@@ -28433,7 +28433,12 @@ function aliases(numbers, fields) {
|
|
|
28433
28433
|
return numbers.map((number, i) => `pr${String(i)}: repository(owner: $owner, name: $repo) { pullRequest(number: ${String(number)}) { ${fields(number)} } }`).join("\n");
|
|
28434
28434
|
}
|
|
28435
28435
|
const discoveryStates = (bootstrap) => bootstrap ? "OPEN" : "OPEN, MERGED, CLOSED";
|
|
28436
|
-
const
|
|
28436
|
+
const BRANCH_COMMIT_FIELDS = "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 } } } checkSuites(first: 100) { nodes { workflowRun { event } } pageInfo { hasNextPage } }";
|
|
28437
|
+
const DEFAULT_BRANCH_READS = ["defaultBranchRef", ...Array.from({ length: 7 }, (_, index) => `defaultBranchParent${String(index + 1)}`)];
|
|
28438
|
+
const DEFAULT_BRANCH_FIELDS = DEFAULT_BRANCH_READS.map((alias, depth) => {
|
|
28439
|
+
if (depth === 0) return `${alias} { name target { __typename ... on Commit { ${BRANCH_COMMIT_FIELDS} } } }`;
|
|
28440
|
+
return `${alias}: defaultBranchRef { target { ... on Commit { ${`oid ${"parents(first: 1) { nodes { ".repeat(depth)}${BRANCH_COMMIT_FIELDS}${" } }".repeat(depth)}`} } } }`;
|
|
28441
|
+
}).join(" ");
|
|
28437
28442
|
function discoveryQuery(bootstrap = false) {
|
|
28438
28443
|
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} } }`;
|
|
28439
28444
|
}
|
|
@@ -28783,16 +28788,23 @@ const branchStatusWire = z.object({
|
|
|
28783
28788
|
targetUrl: z.string().nullish()
|
|
28784
28789
|
});
|
|
28785
28790
|
const branchContextWire = z.discriminatedUnion("__typename", [branchCheckRunWire, branchStatusWire]);
|
|
28786
|
-
const
|
|
28791
|
+
const branchCommitWire = z.object({
|
|
28792
|
+
oid: z.string(),
|
|
28793
|
+
checkSuites: z.unknown().optional(),
|
|
28794
|
+
statusCheckRollup: z.object({ contexts: z.object({
|
|
28795
|
+
nodes: z.array(branchContextWire),
|
|
28796
|
+
pageInfo: z.object({ hasNextPage: z.boolean() })
|
|
28797
|
+
}) }).nullable()
|
|
28798
|
+
});
|
|
28799
|
+
const branchSuitesWire = z.object({
|
|
28800
|
+
nodes: z.array(z.object({ workflowRun: z.object({ event: z.string() }).nullable() })),
|
|
28801
|
+
pageInfo: z.object({ hasNextPage: z.boolean() })
|
|
28802
|
+
});
|
|
28803
|
+
const branchParentsWire = z.object({ parents: z.object({ nodes: z.tuple([z.unknown()]) }) });
|
|
28804
|
+
const parentRefWire = z.object({ target: z.looseObject({ oid: z.string() }) });
|
|
28805
|
+
const defaultBranchWire$1 = z.looseObject({ defaultBranchRef: z.object({
|
|
28787
28806
|
name: z.string(),
|
|
28788
|
-
target: z.
|
|
28789
|
-
__typename: z.literal("Commit"),
|
|
28790
|
-
oid: z.string(),
|
|
28791
|
-
statusCheckRollup: z.object({ contexts: z.object({
|
|
28792
|
-
nodes: z.array(branchContextWire),
|
|
28793
|
-
pageInfo: z.object({ hasNextPage: z.boolean() })
|
|
28794
|
-
}) })
|
|
28795
|
-
})
|
|
28807
|
+
target: branchCommitWire.extend({ __typename: z.literal("Commit") })
|
|
28796
28808
|
}) });
|
|
28797
28809
|
function counted$1(node) {
|
|
28798
28810
|
return node.__typename === "StatusContext" || node.checkSuite?.workflowRun?.event === "push";
|
|
@@ -28803,19 +28815,45 @@ const PASSED = /* @__PURE__ */ new Set([
|
|
|
28803
28815
|
"skipped"
|
|
28804
28816
|
]);
|
|
28805
28817
|
const RUNNING = /* @__PURE__ */ new Set(["pending", "expected"]);
|
|
28818
|
+
function branchScoped(error) {
|
|
28819
|
+
return error.path?.[0] === "repository" && DEFAULT_BRANCH_READS.some((alias) => error.path?.[1] === alias);
|
|
28820
|
+
}
|
|
28821
|
+
function readBranchParent(reference, tip, depth) {
|
|
28822
|
+
const parsed = parentRefWire.safeParse(reference);
|
|
28823
|
+
if (!parsed.success || parsed.data.target.oid !== tip) return void 0;
|
|
28824
|
+
let commit = parsed.data.target;
|
|
28825
|
+
for (let hop = 0; hop < depth; hop += 1) commit = branchParentsWire.safeParse(commit).data?.parents.nodes[0];
|
|
28826
|
+
return commit;
|
|
28827
|
+
}
|
|
28828
|
+
function hasNoPushSuite(wire) {
|
|
28829
|
+
const suites = branchSuitesWire.safeParse(wire).data;
|
|
28830
|
+
return suites !== void 0 && !suites.pageInfo.hasNextPage && suites.nodes.every((suite) => suite.workflowRun?.event !== "push");
|
|
28831
|
+
}
|
|
28806
28832
|
/**
|
|
28807
|
-
* The colour of the
|
|
28808
|
-
*
|
|
28809
|
-
*
|
|
28810
|
-
* the latest run of each check decides (see `latestContexts`). A run URL that is not http(s)
|
|
28811
|
-
* becomes null.
|
|
28833
|
+
* The colour of the newest checked commit in the default branch's first-parent window. Walk
|
|
28834
|
+
* past a commit only when it has no counted checks or push suites. A push suite can precede
|
|
28835
|
+
* its first check run. Without a visible failure, an unsettled commit leaves the colour unknown.
|
|
28812
28836
|
*/
|
|
28813
|
-
function defaultBranchFact(repository) {
|
|
28837
|
+
function defaultBranchFact(repository, errors) {
|
|
28814
28838
|
const parsed = defaultBranchWire$1.safeParse(repository);
|
|
28815
28839
|
if (!parsed.success) return void 0;
|
|
28816
28840
|
const { name: branch, target } = parsed.data.defaultBranchRef;
|
|
28817
|
-
const
|
|
28818
|
-
|
|
28841
|
+
for (const [depth, alias] of DEFAULT_BRANCH_READS.entries()) {
|
|
28842
|
+
const readErrors = errors.filter((error) => error.path?.[1] === alias);
|
|
28843
|
+
if (readErrors.some((error) => !error.path?.includes("checkSuites"))) return void 0;
|
|
28844
|
+
const commit = depth === 0 ? target : readBranchParent(parsed.data[alias], target.oid, depth);
|
|
28845
|
+
const result = branchCommitWire.safeParse(commit);
|
|
28846
|
+
if (!result.success) return void 0;
|
|
28847
|
+
const { oid, statusCheckRollup, checkSuites } = result.data;
|
|
28848
|
+
const contexts = statusCheckRollup?.contexts;
|
|
28849
|
+
const kept = contexts?.nodes.filter(counted$1) ?? [];
|
|
28850
|
+
const truncated = contexts?.pageInfo.hasNextPage ?? false;
|
|
28851
|
+
if (kept.length > 0 || truncated) return branchColour(branch, oid, kept, truncated);
|
|
28852
|
+
if (readErrors.length > 0 || !hasNoPushSuite(checkSuites)) return void 0;
|
|
28853
|
+
}
|
|
28854
|
+
}
|
|
28855
|
+
function branchColour(branch, sha, nodes, truncated) {
|
|
28856
|
+
const kept = latestContexts(nodes).map((node) => ({
|
|
28819
28857
|
check: contextName(node),
|
|
28820
28858
|
node,
|
|
28821
28859
|
state: checkState(node)
|
|
@@ -28827,7 +28865,7 @@ function defaultBranchFact(repository) {
|
|
|
28827
28865
|
const red = {
|
|
28828
28866
|
state: "red",
|
|
28829
28867
|
branch,
|
|
28830
|
-
sha
|
|
28868
|
+
sha,
|
|
28831
28869
|
check,
|
|
28832
28870
|
url
|
|
28833
28871
|
};
|
|
@@ -28838,11 +28876,11 @@ function defaultBranchFact(repository) {
|
|
|
28838
28876
|
url: null
|
|
28839
28877
|
}).data;
|
|
28840
28878
|
}
|
|
28841
|
-
if (
|
|
28879
|
+
if (truncated || kept.some(({ state }) => !PASSED.has(state))) return void 0;
|
|
28842
28880
|
return defaultBranchFactSchema.safeParse({
|
|
28843
28881
|
state: "green",
|
|
28844
28882
|
branch,
|
|
28845
|
-
sha
|
|
28883
|
+
sha
|
|
28846
28884
|
}).data;
|
|
28847
28885
|
}
|
|
28848
28886
|
// ../adapters/src/github/branchRule.ts
|
|
@@ -29852,7 +29890,6 @@ function chunks(numbers, size) {
|
|
|
29852
29890
|
return out;
|
|
29853
29891
|
}
|
|
29854
29892
|
const aliasesOf = (numbers) => numbers.map((_, i) => `pr${String(i)}`);
|
|
29855
|
-
const branchScoped = (error) => error.path?.[1] === "defaultBranchRef";
|
|
29856
29893
|
/**
|
|
29857
29894
|
* Lists the repository's PRs since the cursor; a transient failure leaves `ok` false. The first
|
|
29858
29895
|
* response also gives the default-branch colour, whatever the PR listing's outcome.
|
|
@@ -29868,7 +29905,7 @@ async function readDiscovery(scope, acc, ctx, login) {
|
|
|
29868
29905
|
};
|
|
29869
29906
|
acc.budget = response.budget;
|
|
29870
29907
|
const errors = response.errors.filter((error) => !branchScoped(error));
|
|
29871
|
-
const defaultBranch =
|
|
29908
|
+
const defaultBranch = defaultBranchFact(response.data.repository, response.errors.filter(branchScoped));
|
|
29872
29909
|
rejectUnscoped(errors, ["repository"]);
|
|
29873
29910
|
let ok = scoped(errors, "repository").length === 0;
|
|
29874
29911
|
const first = ok ? parseWire(discoveryRootWire, response.data.repository, MALFORMED$3, ["data", "repository"]).pullRequests : void 0;
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as renderMcpError, g as OPERATIONS, mt as ERRORS } from "./chunk-
|
|
2
|
-
import { o as CliError, r as requestOperation } from "./chunk-
|
|
3
|
-
import { a as memoryVerdictCache, l as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-
|
|
1
|
+
import { S as renderMcpError, g as OPERATIONS, mt as ERRORS } from "./chunk-DQnJirZ1.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-Bx3YMBLb.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, l as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-BuHn-rfD.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|