spur-board 0.16.2 → 0.17.0
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/cli.mjs +3 -3
- package/dist/{client-CwKmG23X.mjs → client-Swp5TBku.mjs} +1 -1
- package/dist/client.mjs +1 -1
- package/dist/{config-CXDupHSC.mjs → config-C1ly8wCm.mjs} +2 -2
- package/dist/daemon.mjs +105 -28
- package/dist/mcp.mjs +3 -3
- package/dist/{src-ep5scuVt.mjs → src-vzl2nFf6.mjs} +13 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as SLACK_BOT_SCOPES, P as ERRORS, U as configSchema, W as requiredSecretKeys, l as roleCanUseOperation, r as SYSTEMD_SERVICE_SETTINGS, u as OPERATIONS } from "./src-
|
|
2
|
-
import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadEnrollmentConfig, i as fileVerdictCache, l as readConfiguredPort, n as cliPackageVersion, o as configFile, s as loadClientConfig, t as checkCatalog, u as resolveDaemonAddress } from "./config-
|
|
1
|
+
import { G as SLACK_BOT_SCOPES, P as ERRORS, U as configSchema, W as requiredSecretKeys, l as roleCanUseOperation, r as SYSTEMD_SERVICE_SETTINGS, u as OPERATIONS } from "./src-vzl2nFf6.mjs";
|
|
2
|
+
import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-Swp5TBku.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadEnrollmentConfig, i as fileVerdictCache, l as readConfiguredPort, n as cliPackageVersion, o as configFile, s as loadClientConfig, t as checkCatalog, u as resolveDaemonAddress } from "./config-C1ly8wCm.mjs";
|
|
4
4
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
5
5
|
import { chmodSync, closeSync, constants, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { homedir, hostname, userInfo } from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-
|
|
1
|
+
import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-vzl2nFf6.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-Swp5TBku.mjs";
|
|
2
2
|
export { fetchCatalogVersion, requestOperation, requestTokenEnrollment };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as DEFAULT_HTTP_PORT, U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-
|
|
2
|
-
import { i as CliError, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { R as DEFAULT_HTTP_PORT, U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-vzl2nFf6.mjs";
|
|
2
|
+
import { i as CliError, t as fetchCatalogVersion } from "./client-Swp5TBku.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";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as errorCodeOf, C as SESSION_STATUSES, D as ticketFactsSchema, E as sessionFactsSchema, G as SLACK_BOT_SCOPES, H as RESERVED_PROJECT, L as successEnvelopeSchema, M as parseRef$1, N as taskKeySchema, O as actorIdSchema, P as ERRORS, S as SESSION_HEALTH_STATES, T as prRefSchema, U as configSchema, V as DEFAULT_SLACK_COMMAND, W as requiredSecretKeys, _ as interactionRefSchema, a as batchSchema, b as EVENT_KINDS, c as buildCatalogSnapshot, d as renderHttpProblem, g as inboundEventSchema, h as conversationRefSchema, i as AdapterError, j as parseActorId, k as encodeActorId, l as roleCanUseOperation, m as SPACE_IDS, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, u as OPERATIONS, v as messageRefSchema, w as prFactsSchema, x as eventPayloadSchemas, y as userIdSchema, z as DEFAULT_LINK } from "./src-
|
|
1
|
+
import { A as errorCodeOf, C as SESSION_STATUSES, D as ticketFactsSchema, E as sessionFactsSchema, G as SLACK_BOT_SCOPES, H as RESERVED_PROJECT, L as successEnvelopeSchema, M as parseRef$1, N as taskKeySchema, O as actorIdSchema, P as ERRORS, S as SESSION_HEALTH_STATES, T as prRefSchema, U as configSchema, V as DEFAULT_SLACK_COMMAND, W as requiredSecretKeys, _ as interactionRefSchema, a as batchSchema, b as EVENT_KINDS, c as buildCatalogSnapshot, d as renderHttpProblem, g as inboundEventSchema, h as conversationRefSchema, i as AdapterError, j as parseActorId, k as encodeActorId, l as roleCanUseOperation, m as SPACE_IDS, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, u as OPERATIONS, v as messageRefSchema, w as prFactsSchema, x as eventPayloadSchemas, y as userIdSchema, z as DEFAULT_LINK } from "./src-vzl2nFf6.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, existsSync, fstatSync, ftruncateSync, mkdirSync, openSync, readFileSync, readdirSync, writeSync } from "node:fs";
|
|
@@ -13392,11 +13392,12 @@ function connectionWire(node) {
|
|
|
13392
13392
|
pageInfo: pageInfoWire
|
|
13393
13393
|
});
|
|
13394
13394
|
}
|
|
13395
|
-
function
|
|
13396
|
-
if (error.type !== "INSUFFICIENT_SCOPES" || !query.includes("... on Team {
|
|
13397
|
-
if (error.path !== void 0) return error.path.includes("reviewRequests") && error.path.includes("requestedReviewer") && error.path.at(-1) === "
|
|
13398
|
-
return /\
|
|
13395
|
+
function teamScopeDenied(error, query) {
|
|
13396
|
+
if (error.type !== "INSUFFICIENT_SCOPES" || !query.includes("... on Team { slug }")) return false;
|
|
13397
|
+
if (error.path !== void 0) return error.path.includes("reviewRequests") && error.path.includes("requestedReviewer") && error.path.at(-1) === "slug";
|
|
13398
|
+
return /\b(?:slug|name)\b/i.test(error.message) && /\bread:(?:org|discussion)\b/i.test(error.message);
|
|
13399
13399
|
}
|
|
13400
|
+
const REVIEWER_FIELDS = "requestedReviewer { __typename ... on Bot { login } ... on Mannequin { login } ... on User { login } ... on Team { slug } ... on EnterpriseTeam { slug } } asCodeOwner";
|
|
13400
13401
|
const CLOSING_FIELDS = "nodes { number repository { nameWithOwner } } pageInfo { hasNextPage endCursor }";
|
|
13401
13402
|
const prFields = (number, closing = false) => `id number url title updatedAt state isDraft mergeable mergeStateStatus
|
|
13402
13403
|
author { login } headRefName headRefOid
|
|
@@ -13406,7 +13407,7 @@ const prFields = (number, closing = false) => `id number url title updatedAt sta
|
|
|
13406
13407
|
} pageInfo { hasNextPage endCursor } } }
|
|
13407
13408
|
reviews(first: 100) { nodes { author { login } state commit { oid } submittedAt } pageInfo { hasNextPage endCursor } }
|
|
13408
13409
|
reviewThreads(first: 100) { nodes { isResolved } pageInfo { hasNextPage endCursor } }
|
|
13409
|
-
reviewRequests(first: 100) { nodes {
|
|
13410
|
+
reviewRequests(first: 100) { nodes { ${REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }${closing ? `\n closingIssuesReferences(first: 100) { ${CLOSING_FIELDS} }` : ""}`;
|
|
13410
13411
|
const DISCOVERY_FIELDS = `nodes { number updatedAt author { login } state } pageInfo { hasNextPage endCursor }`;
|
|
13411
13412
|
function aliases(numbers, closing = false) {
|
|
13412
13413
|
return numbers.map((number, i) => `pr${String(i)}: repository(owner: $owner, name: $repo) { pullRequest(number: ${String(number)}) { ${prFields(number, closing)} } }`).join("\n");
|
|
@@ -13419,7 +13420,7 @@ function detailQuery(numbers, closing = false) {
|
|
|
13419
13420
|
}
|
|
13420
13421
|
function pageQuery(connection, bootstrap = false) {
|
|
13421
13422
|
if (connection === "pullRequests") return `query DiscoveryPage($owner: String!, $repo: String!, $after: String!) { rateLimit { remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, after: $after, states: [${bootstrap ? "OPEN" : "OPEN, MERGED"}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} } } }`;
|
|
13422
|
-
return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? "author { login } state commit { oid } submittedAt" : connection === "reviewThreads" ? "isResolved" :
|
|
13423
|
+
return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? "author { login } state commit { oid } submittedAt" : connection === "reviewThreads" ? "isResolved" : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
|
|
13423
13424
|
}
|
|
13424
13425
|
var GithubClient = class {
|
|
13425
13426
|
token;
|
|
@@ -13465,7 +13466,7 @@ var GithubClient = class {
|
|
|
13465
13466
|
status: 429,
|
|
13466
13467
|
headers: response.headers
|
|
13467
13468
|
}, Date.now());
|
|
13468
|
-
if (errors.some((error) =>
|
|
13469
|
+
if (errors.some((error) => teamScopeDenied(error, query))) throw new AdapterError("auth", "GitHub token needs read:org for team review requests");
|
|
13469
13470
|
if (errors.some((error) => error.type === "INSUFFICIENT_SCOPES")) throw new AdapterError("auth", "GitHub token lacks a required GraphQL read scope");
|
|
13470
13471
|
const data = parseWire(dataWire, wire.data, MALFORMED$3, ["data"]);
|
|
13471
13472
|
return {
|
|
@@ -13554,6 +13555,21 @@ const reviewWire = z.object({
|
|
|
13554
13555
|
submittedAt: z.string().nullish()
|
|
13555
13556
|
}).refine((review) => review.commit !== null || !review.author?.login || review.submittedAt == null || !KEPT_REVIEWS.includes(review.state.toLowerCase()), { path: ["commit"] });
|
|
13556
13557
|
const nodes = (node) => z.object({ nodes: z.array(node) });
|
|
13558
|
+
const loginReviewer = (type) => z.object({
|
|
13559
|
+
__typename: z.literal(type),
|
|
13560
|
+
login: z.string()
|
|
13561
|
+
});
|
|
13562
|
+
const slugReviewer = (type) => z.object({
|
|
13563
|
+
__typename: z.literal(type),
|
|
13564
|
+
slug: z.string()
|
|
13565
|
+
});
|
|
13566
|
+
const reviewerWire = z.discriminatedUnion("__typename", [
|
|
13567
|
+
loginReviewer("User"),
|
|
13568
|
+
loginReviewer("Mannequin"),
|
|
13569
|
+
loginReviewer("Bot"),
|
|
13570
|
+
slugReviewer("Team"),
|
|
13571
|
+
slugReviewer("EnterpriseTeam")
|
|
13572
|
+
]).nullable();
|
|
13557
13573
|
const closingWire = z.object({ nodes: z.array(z.object({
|
|
13558
13574
|
number: z.int().positive(),
|
|
13559
13575
|
repository: z.object({ nameWithOwner: z.string() }).nullish()
|
|
@@ -13574,10 +13590,7 @@ const prWire = z.object({
|
|
|
13574
13590
|
reviews: nodes(reviewWire),
|
|
13575
13591
|
reviewThreads: nodes(z.object({ isResolved: z.boolean() })),
|
|
13576
13592
|
reviewRequests: nodes(z.object({
|
|
13577
|
-
requestedReviewer:
|
|
13578
|
-
login: z.string().nullish(),
|
|
13579
|
-
name: z.string().nullish()
|
|
13580
|
-
}),
|
|
13593
|
+
requestedReviewer: reviewerWire,
|
|
13581
13594
|
asCodeOwner: z.boolean()
|
|
13582
13595
|
})),
|
|
13583
13596
|
closingIssuesReferences: closingWire
|
|
@@ -13750,6 +13763,25 @@ function prKeys(rule, title, branch, refs) {
|
|
|
13750
13763
|
default: return assertNever(rule);
|
|
13751
13764
|
}
|
|
13752
13765
|
}
|
|
13766
|
+
function reviewer(wire) {
|
|
13767
|
+
switch (wire.__typename) {
|
|
13768
|
+
case "User":
|
|
13769
|
+
case "Mannequin": return {
|
|
13770
|
+
kind: "user",
|
|
13771
|
+
id: wire.login
|
|
13772
|
+
};
|
|
13773
|
+
case "Bot": return {
|
|
13774
|
+
kind: "bot",
|
|
13775
|
+
id: wire.login
|
|
13776
|
+
};
|
|
13777
|
+
case "Team":
|
|
13778
|
+
case "EnterpriseTeam": return {
|
|
13779
|
+
kind: "team",
|
|
13780
|
+
id: wire.slug
|
|
13781
|
+
};
|
|
13782
|
+
default: return assertNever(wire);
|
|
13783
|
+
}
|
|
13784
|
+
}
|
|
13753
13785
|
function normalizePr(repo, value, rule) {
|
|
13754
13786
|
const wire = parseWire(prWire, value, "Malformed GitHub PR response");
|
|
13755
13787
|
const checks = latestChecks(wire.statusCheckRollup?.contexts.nodes ?? []);
|
|
@@ -13782,10 +13814,10 @@ function normalizePr(repo, value, rule) {
|
|
|
13782
13814
|
...checks,
|
|
13783
13815
|
reviews: latestReviews(wire.reviews.nodes),
|
|
13784
13816
|
reviewThreads: wire.reviewThreads.nodes.map((node) => ({ resolved: node.isResolved })),
|
|
13785
|
-
reviewRequests: wire.reviewRequests.nodes.
|
|
13786
|
-
reviewer
|
|
13787
|
-
asCodeOwner
|
|
13788
|
-
})
|
|
13817
|
+
reviewRequests: wire.reviewRequests.nodes.flatMap(({ requestedReviewer, asCodeOwner }) => requestedReviewer === null ? [] : [{
|
|
13818
|
+
...reviewer(requestedReviewer),
|
|
13819
|
+
asCodeOwner
|
|
13820
|
+
}]),
|
|
13789
13821
|
ticketKeys: prKeys(rule, title, headBranch, closingRefs(wire.closingIssuesReferences)),
|
|
13790
13822
|
updatedAt: wire.updatedAt
|
|
13791
13823
|
};
|
|
@@ -13875,6 +13907,22 @@ function withConnection(pr, field, connection) {
|
|
|
13875
13907
|
[field]: connection
|
|
13876
13908
|
};
|
|
13877
13909
|
}
|
|
13910
|
+
function content(read) {
|
|
13911
|
+
try {
|
|
13912
|
+
return read();
|
|
13913
|
+
} catch (error) {
|
|
13914
|
+
if (error instanceof AdapterError) return error;
|
|
13915
|
+
throw error;
|
|
13916
|
+
}
|
|
13917
|
+
}
|
|
13918
|
+
const malformedPaging = () => ({
|
|
13919
|
+
status: "malformed",
|
|
13920
|
+
error: new AdapterError("transient", "Malformed GitHub pagination")
|
|
13921
|
+
});
|
|
13922
|
+
function pageCursor(connection) {
|
|
13923
|
+
const { hasNextPage, endCursor } = connection.pageInfo;
|
|
13924
|
+
return hasNextPage && !endCursor ? null : nextPage(connection);
|
|
13925
|
+
}
|
|
13878
13926
|
async function fullPr(client, first, owner, name, number, signal, budget) {
|
|
13879
13927
|
let pr = first;
|
|
13880
13928
|
for (const field of [
|
|
@@ -13886,10 +13934,11 @@ async function fullPr(client, first, owner, name, number, signal, budget) {
|
|
|
13886
13934
|
]) {
|
|
13887
13935
|
let target = connectionOf(pr, field);
|
|
13888
13936
|
if (target === void 0) continue;
|
|
13889
|
-
let cursor =
|
|
13937
|
+
let cursor = pageCursor(target);
|
|
13938
|
+
if (cursor === null) return malformedPaging();
|
|
13890
13939
|
const seen = /* @__PURE__ */ new Set();
|
|
13891
13940
|
while (cursor !== void 0) {
|
|
13892
|
-
if (seen.has(cursor))
|
|
13941
|
+
if (seen.has(cursor)) return malformedPaging();
|
|
13893
13942
|
seen.add(cursor);
|
|
13894
13943
|
const response = await client.query(pageQuery(field), {
|
|
13895
13944
|
owner,
|
|
@@ -13901,19 +13950,28 @@ async function fullPr(client, first, owner, name, number, signal, budget) {
|
|
|
13901
13950
|
rejectUnscoped(response.errors, ["repository"]);
|
|
13902
13951
|
requireCheckAccess(response.errors);
|
|
13903
13952
|
const denied = response.errors.some(deniedReference);
|
|
13904
|
-
if (withoutDeniedReferences(response.errors).length > 0) return
|
|
13905
|
-
const
|
|
13953
|
+
if (withoutDeniedReferences(response.errors).length > 0) return { status: "denied" };
|
|
13954
|
+
const root = content(() => parseWire(pageRootWire, response.data.repository, MALFORMED$2, ["data", "repository"]));
|
|
13955
|
+
if (root instanceof AdapterError) return {
|
|
13956
|
+
status: "malformed",
|
|
13957
|
+
error: root
|
|
13958
|
+
};
|
|
13959
|
+
const page = connectionOf(root.pullRequest, field);
|
|
13906
13960
|
if (page === void 0 && denied && field === "closingIssuesReferences") break;
|
|
13907
|
-
if (page === void 0)
|
|
13961
|
+
if (page === void 0) return malformedPaging();
|
|
13908
13962
|
target = {
|
|
13909
13963
|
nodes: [...target.nodes, ...page.nodes],
|
|
13910
13964
|
pageInfo: page.pageInfo
|
|
13911
13965
|
};
|
|
13912
13966
|
pr = withConnection(pr, field, target);
|
|
13913
|
-
cursor =
|
|
13967
|
+
cursor = pageCursor(page);
|
|
13968
|
+
if (cursor === null) return malformedPaging();
|
|
13914
13969
|
}
|
|
13915
13970
|
}
|
|
13916
|
-
return
|
|
13971
|
+
return {
|
|
13972
|
+
status: "ok",
|
|
13973
|
+
pr
|
|
13974
|
+
};
|
|
13917
13975
|
}
|
|
13918
13976
|
async function pollRepository({ id, repo, login, keys, client, ctx }) {
|
|
13919
13977
|
const observedAt = sourceCursorSchema.parse((/* @__PURE__ */ new Date()).toISOString());
|
|
@@ -13960,6 +14018,20 @@ async function pollRepository({ id, repo, login, keys, client, ctx }) {
|
|
|
13960
14018
|
if (!discoveryOk) complete = false;
|
|
13961
14019
|
const found = discover(nodes, ctx.cursor, login);
|
|
13962
14020
|
const bootstrapCursor = bootstrap && discoveryOk ? latestUpdatedAt(parseWire(baselineRootWire, response.data.repository, MALFORMED$2, ["data", "repository"]).mergedBaseline.nodes, found.cursor) ?? sourceCursorSchema.parse("1970-01-01T00:00:00.000Z") : void 0;
|
|
14021
|
+
let parseError;
|
|
14022
|
+
let parseFailedRefs = 0;
|
|
14023
|
+
const malformed = (error, ref) => {
|
|
14024
|
+
parseError ??= error;
|
|
14025
|
+
complete = false;
|
|
14026
|
+
if (ref) {
|
|
14027
|
+
entities.push({
|
|
14028
|
+
ref,
|
|
14029
|
+
status: "no_access"
|
|
14030
|
+
});
|
|
14031
|
+
parseFailedRefs += 1;
|
|
14032
|
+
}
|
|
14033
|
+
return false;
|
|
14034
|
+
};
|
|
13963
14035
|
const process = async (number, alias, data, scopedErrors, ref) => {
|
|
13964
14036
|
const errors = withoutDeniedReferences(scopedErrors);
|
|
13965
14037
|
requireCheckAccess(errors);
|
|
@@ -13973,7 +14045,9 @@ async function pollRepository({ id, repo, login, keys, client, ctx }) {
|
|
|
13973
14045
|
});
|
|
13974
14046
|
return false;
|
|
13975
14047
|
}
|
|
13976
|
-
const
|
|
14048
|
+
const root = content(() => parseWire(aliasWire, data[alias], MALFORMED$2, ["data", alias]));
|
|
14049
|
+
if (root instanceof AdapterError) return malformed(root, ref);
|
|
14050
|
+
const wire = root?.pullRequest;
|
|
13977
14051
|
if (wire === null || wire === void 0) {
|
|
13978
14052
|
if (ref) entities.push({
|
|
13979
14053
|
ref,
|
|
@@ -13985,7 +14059,7 @@ async function pollRepository({ id, repo, login, keys, client, ctx }) {
|
|
|
13985
14059
|
const full = await fullPr(client, wire, owner, name, number, ctx.signal, (next) => {
|
|
13986
14060
|
budget = next;
|
|
13987
14061
|
});
|
|
13988
|
-
if (full ===
|
|
14062
|
+
if (full.status === "denied") {
|
|
13989
14063
|
complete = false;
|
|
13990
14064
|
if (ref) entities.push({
|
|
13991
14065
|
ref,
|
|
@@ -13993,7 +14067,9 @@ async function pollRepository({ id, repo, login, keys, client, ctx }) {
|
|
|
13993
14067
|
});
|
|
13994
14068
|
return false;
|
|
13995
14069
|
}
|
|
13996
|
-
|
|
14070
|
+
if (full.status === "malformed") return malformed(full.error, ref);
|
|
14071
|
+
const facts = content(() => normalizePr(ref?.repo ?? repo, full.pr, keys));
|
|
14072
|
+
if (facts instanceof AdapterError) return malformed(facts, ref);
|
|
13997
14073
|
items.push({
|
|
13998
14074
|
kind: "pr",
|
|
13999
14075
|
facts
|
|
@@ -14025,6 +14101,7 @@ async function pollRepository({ id, repo, login, keys, client, ctx }) {
|
|
|
14025
14101
|
}
|
|
14026
14102
|
}
|
|
14027
14103
|
if (ctx.signal.aborted) throw new AdapterError("transient", "GitHub poll aborted");
|
|
14104
|
+
if (parseError !== void 0 && items.length === 0 && entities.length === parseFailedRefs) throw parseError;
|
|
14028
14105
|
const nextCursor = bootstrap ? bootstrapCursor : found.cursor;
|
|
14029
14106
|
return {
|
|
14030
14107
|
source: id,
|
|
@@ -16421,7 +16498,7 @@ const GITHUB_PROBE = `query DoctorGithubPermissions($owner: String!, $repo: Stri
|
|
|
16421
16498
|
pullRequests(first: 10, states: [OPEN], orderBy: {field: UPDATED_AT, direction: DESC}) {
|
|
16422
16499
|
nodes {
|
|
16423
16500
|
statusCheckRollup { contexts(first: 100) { nodes { ... on CheckRun { name } } } }
|
|
16424
|
-
reviewRequests(first: 100) { nodes { requestedReviewer { ... on Team {
|
|
16501
|
+
reviewRequests(first: 100) { nodes { requestedReviewer { ... on Team { slug } } } }
|
|
16425
16502
|
}
|
|
16426
16503
|
}
|
|
16427
16504
|
defaultBranchRef { target { ... on Commit {
|
|
@@ -16438,7 +16515,7 @@ function scopedGithubError(value) {
|
|
|
16438
16515
|
if (!Array.isArray(path)) return null;
|
|
16439
16516
|
const fields = path.filter((part) => typeof part === "string");
|
|
16440
16517
|
if (error?.["type"] === "FORBIDDEN" && fields.includes("statusCheckRollup") && fields.includes("contexts")) return GITHUB_CHECKS_FIX;
|
|
16441
|
-
if (error?.["type"] === "INSUFFICIENT_SCOPES" && fields.includes("reviewRequests") && fields.includes("requestedReviewer") && fields.includes("
|
|
16518
|
+
if (error?.["type"] === "INSUFFICIENT_SCOPES" && fields.includes("reviewRequests") && fields.includes("requestedReviewer") && fields.includes("slug")) return GITHUB_TEAMS_FIX;
|
|
16442
16519
|
return null;
|
|
16443
16520
|
}
|
|
16444
16521
|
async function deadlineCall(ctx, name, failure, call) {
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-
|
|
2
|
-
import { i as CliError, n as requestOperation } from "./client-
|
|
3
|
-
import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-
|
|
1
|
+
import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-vzl2nFf6.mjs";
|
|
2
|
+
import { i as CliError, n as requestOperation } from "./client-Swp5TBku.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-C1ly8wCm.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -841,6 +841,11 @@ const REVIEW_STATES = [
|
|
|
841
841
|
"commented",
|
|
842
842
|
"dismissed"
|
|
843
843
|
];
|
|
844
|
+
const REVIEWER_KINDS = [
|
|
845
|
+
"user",
|
|
846
|
+
"team",
|
|
847
|
+
"bot"
|
|
848
|
+
];
|
|
844
849
|
/** Spur session lifecycle values known today. */
|
|
845
850
|
const SESSION_STATUSES = [
|
|
846
851
|
"spawning",
|
|
@@ -899,8 +904,15 @@ const prFactsSchema = z.strictObject({
|
|
|
899
904
|
})).describe("The latest review of each reviewer, with the commit it was given on."),
|
|
900
905
|
reviewThreads: z.array(z.strictObject({ resolved: z.boolean().describe("Whether the review thread is resolved.") })).describe("Review threads on the pull request."),
|
|
901
906
|
reviewRequests: z.array(z.strictObject({
|
|
902
|
-
|
|
907
|
+
kind: z.enum(REVIEWER_KINDS).optional().describe("Kind of reviewer asked to review."),
|
|
908
|
+
id: z.string().min(1).optional().describe("Login of the user or bot, or the slug of the team."),
|
|
909
|
+
reviewer: z.string().min(1).optional().describe("Login or team name as stored by an earlier version; new facts use kind and id."),
|
|
903
910
|
asCodeOwner: z.boolean().describe("Whether the review was requested because the reviewer owns changed code.")
|
|
911
|
+
}).superRefine((request, ctx) => {
|
|
912
|
+
if (!(request.reviewer === void 0 ? request.kind !== void 0 && request.id !== void 0 : request.kind === void 0 && request.id === void 0)) ctx.addIssue({
|
|
913
|
+
code: "custom",
|
|
914
|
+
message: "Set kind and id, or reviewer alone"
|
|
915
|
+
});
|
|
904
916
|
})).describe("Pending review requests."),
|
|
905
917
|
ticketKeys: z.array(taskKeySchema).describe("Ticket keys found in the head branch name and the title."),
|
|
906
918
|
updatedAt: at$2.describe("When the pull request last changed.")
|