@staff0rd/assist 0.793.3 → 0.794.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/commands/sessions/web/bundle.js +341 -341
- package/dist/index.js +60 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.794.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -14138,8 +14138,8 @@ var peerPrFields = `number
|
|
|
14138
14138
|
}
|
|
14139
14139
|
}`;
|
|
14140
14140
|
|
|
14141
|
-
// src/commands/sessions/web/next/
|
|
14142
|
-
var
|
|
14141
|
+
// src/commands/sessions/web/next/ownerOpenPrsQuery.ts
|
|
14142
|
+
var ownerOpenPrsQuery = `query($requested: String!, $authored: String!, $mine: String!, $hasPeers: Boolean!) {
|
|
14143
14143
|
viewer { login }
|
|
14144
14144
|
requested: search(query: $requested, type: ISSUE, first: 100) {
|
|
14145
14145
|
nodes { ... on PullRequest { repository { nameWithOwner } ${peerPrFields} } }
|
|
@@ -14147,14 +14147,11 @@ var ownerPeerPrsQuery = `query($requested: String!, $authored: String!, $hasPeer
|
|
|
14147
14147
|
authored: search(query: $authored, type: ISSUE, first: 100) @include(if: $hasPeers) {
|
|
14148
14148
|
nodes { ... on PullRequest { repository { nameWithOwner } ${peerPrFields} } }
|
|
14149
14149
|
}
|
|
14150
|
+
mine: search(query: $mine, type: ISSUE, first: 100) {
|
|
14151
|
+
nodes { ... on PullRequest { repository { nameWithOwner } ${peerPrFields} } }
|
|
14152
|
+
}
|
|
14150
14153
|
}`;
|
|
14151
14154
|
|
|
14152
|
-
// src/commands/prs/status/isDoNotMerge.ts
|
|
14153
|
-
var DO_NOT_MERGE = /^\s*[[(]\s*(do[\s_-]*not\b[^\])]*|dnm)\s*[\])]/i;
|
|
14154
|
-
function isDoNotMerge(title) {
|
|
14155
|
-
return DO_NOT_MERGE.test(title);
|
|
14156
|
-
}
|
|
14157
|
-
|
|
14158
14155
|
// src/commands/sessions/web/next/sameLogin.ts
|
|
14159
14156
|
var sameLogin = (a, b) => a?.toLowerCase() === b.toLowerCase();
|
|
14160
14157
|
|
|
@@ -14192,6 +14189,17 @@ function toNextPr(node, author, requested, viewer) {
|
|
|
14192
14189
|
};
|
|
14193
14190
|
}
|
|
14194
14191
|
|
|
14192
|
+
// src/commands/sessions/web/next/selectMyPrs.ts
|
|
14193
|
+
function selectMyPrs(nodes, viewer) {
|
|
14194
|
+
return nodes.filter((node) => sameLogin(node.author?.login, viewer)).map((node) => toNextPr(node, node.author?.login ?? viewer, false, viewer)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
14195
|
+
}
|
|
14196
|
+
|
|
14197
|
+
// src/commands/prs/status/isDoNotMerge.ts
|
|
14198
|
+
var DO_NOT_MERGE = /^\s*[[(]\s*(do[\s_-]*not\b[^\])]*|dnm)\s*[\])]/i;
|
|
14199
|
+
function isDoNotMerge(title) {
|
|
14200
|
+
return DO_NOT_MERGE.test(title);
|
|
14201
|
+
}
|
|
14202
|
+
|
|
14195
14203
|
// src/commands/sessions/web/next/selectPeerPrs.ts
|
|
14196
14204
|
function isRequested(node, viewer) {
|
|
14197
14205
|
return (node.reviewRequests?.nodes ?? []).some(
|
|
@@ -14218,39 +14226,53 @@ function selectPeerPrs(nodes, viewer, peers) {
|
|
|
14218
14226
|
return selected.sort((a, b) => a.requestedAt.localeCompare(b.requestedAt));
|
|
14219
14227
|
}
|
|
14220
14228
|
|
|
14221
|
-
// src/commands/sessions/web/next/
|
|
14229
|
+
// src/commands/sessions/web/next/splitOpenPrs.ts
|
|
14230
|
+
function splitOpenPrs(nodes, viewer, peers, repoOf2) {
|
|
14231
|
+
const withRepo = (prs2) => prs2.map((pr) => ({ ...pr, repo: repoOf2(pr) }));
|
|
14232
|
+
return {
|
|
14233
|
+
peerPrs: withRepo(selectPeerPrs(nodes, viewer, peers)),
|
|
14234
|
+
myPrs: withRepo(selectMyPrs(nodes, viewer))
|
|
14235
|
+
};
|
|
14236
|
+
}
|
|
14237
|
+
|
|
14238
|
+
// src/commands/sessions/web/next/fetchOwnerOpenPrs.ts
|
|
14222
14239
|
function uniqueNodes(...results) {
|
|
14223
14240
|
const byUrl = /* @__PURE__ */ new Map();
|
|
14224
14241
|
for (const node of results.flatMap((result) => result?.nodes ?? []))
|
|
14225
14242
|
if (node?.url) byUrl.set(node.url, node);
|
|
14226
14243
|
return [...byUrl.values()];
|
|
14227
14244
|
}
|
|
14228
|
-
async function
|
|
14245
|
+
async function fetchOwnerOpenPrs(cwd, owner, peers) {
|
|
14229
14246
|
const base = `user:${owner} is:pr is:open archived:false`;
|
|
14230
14247
|
const authors = peers.map((peer) => `author:${peer}`).join(" ");
|
|
14231
14248
|
const response = await ghJson(cwd, [
|
|
14232
14249
|
"api",
|
|
14233
14250
|
"graphql",
|
|
14234
14251
|
"-f",
|
|
14235
|
-
`query=${
|
|
14252
|
+
`query=${ownerOpenPrsQuery}`,
|
|
14236
14253
|
"-f",
|
|
14237
14254
|
`requested=${base} review-requested:@me`,
|
|
14238
14255
|
"-f",
|
|
14239
14256
|
`authored=${base} ${authors}`,
|
|
14257
|
+
"-f",
|
|
14258
|
+
`mine=${base} author:@me`,
|
|
14240
14259
|
"-F",
|
|
14241
14260
|
`hasPeers=${peers.length > 0}`
|
|
14242
14261
|
]);
|
|
14243
14262
|
const viewer = response.data?.viewer?.login;
|
|
14244
14263
|
if (!viewer || !response.data?.requested)
|
|
14245
14264
|
throw new Error("Owner not searchable");
|
|
14246
|
-
const
|
|
14265
|
+
const { requested, authored, mine } = response.data;
|
|
14266
|
+
const nodes = uniqueNodes(requested, authored, mine);
|
|
14247
14267
|
const repoOf2 = new Map(
|
|
14248
14268
|
nodes.map((node) => [node.url, node.repository?.nameWithOwner ?? owner])
|
|
14249
14269
|
);
|
|
14250
|
-
return
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14270
|
+
return splitOpenPrs(
|
|
14271
|
+
nodes,
|
|
14272
|
+
viewer,
|
|
14273
|
+
peers,
|
|
14274
|
+
(pr) => repoOf2.get(pr.url) ?? owner
|
|
14275
|
+
);
|
|
14254
14276
|
}
|
|
14255
14277
|
|
|
14256
14278
|
// src/commands/sessions/web/next/peerPrsQuery.ts
|
|
@@ -14265,9 +14287,9 @@ var peerPrsQuery = `query($owner: String!, $name: String!) {
|
|
|
14265
14287
|
}
|
|
14266
14288
|
}`;
|
|
14267
14289
|
|
|
14268
|
-
// src/commands/sessions/web/next/
|
|
14269
|
-
async function
|
|
14270
|
-
if (isOwnerEntry(repo)) return
|
|
14290
|
+
// src/commands/sessions/web/next/fetchOpenPrs.ts
|
|
14291
|
+
async function fetchOpenPrs(cwd, repo, peers) {
|
|
14292
|
+
if (isOwnerEntry(repo)) return fetchOwnerOpenPrs(cwd, repo, peers);
|
|
14271
14293
|
const [owner, name] = repo.split("/");
|
|
14272
14294
|
const response = await ghJson(cwd, [
|
|
14273
14295
|
"api",
|
|
@@ -14285,7 +14307,7 @@ async function fetchPeerPrs(cwd, repo, peers) {
|
|
|
14285
14307
|
const nodes = (repository.pullRequests?.nodes ?? []).filter(
|
|
14286
14308
|
(node) => !!node
|
|
14287
14309
|
);
|
|
14288
|
-
return
|
|
14310
|
+
return splitOpenPrs(nodes, viewer, peers, () => repo);
|
|
14289
14311
|
}
|
|
14290
14312
|
|
|
14291
14313
|
// src/commands/sessions/web/next/compareBoardOrder.ts
|
|
@@ -14532,16 +14554,29 @@ function scopeRepos(configured, selfRepo) {
|
|
|
14532
14554
|
}
|
|
14533
14555
|
|
|
14534
14556
|
// src/commands/sessions/web/next/nextItems.ts
|
|
14557
|
+
var byRequestedAt = (a, b) => a.requestedAt.localeCompare(b.requestedAt);
|
|
14535
14558
|
async function nextItems(req, res) {
|
|
14536
14559
|
const cwd = getCwdParam(req, res);
|
|
14537
14560
|
if (!cwd) return;
|
|
14538
14561
|
const scope = nextScope(cwd);
|
|
14539
14562
|
const repos2 = scopeRepos(scope.repos, scope.selfRepo);
|
|
14540
|
-
const
|
|
14563
|
+
const openPrs = new Map(
|
|
14564
|
+
repos2.map((repo) => [
|
|
14565
|
+
repo,
|
|
14566
|
+
fetchOpenPrs(cwd, repo, scope.peers)
|
|
14567
|
+
])
|
|
14568
|
+
);
|
|
14569
|
+
const openPrsOf = (repo) => openPrs.get(repo);
|
|
14570
|
+
const [peerPrs, myPrs, assignedIssues, { pickups, boards }] = await Promise.all([
|
|
14571
|
+
sectionAcross(
|
|
14572
|
+
repos2,
|
|
14573
|
+
(repo) => openPrsOf(repo).then((prs2) => prs2.peerPrs),
|
|
14574
|
+
byRequestedAt
|
|
14575
|
+
),
|
|
14541
14576
|
sectionAcross(
|
|
14542
14577
|
repos2,
|
|
14543
|
-
(repo) =>
|
|
14544
|
-
|
|
14578
|
+
(repo) => openPrsOf(repo).then((prs2) => prs2.myPrs),
|
|
14579
|
+
byRequestedAt
|
|
14545
14580
|
),
|
|
14546
14581
|
sectionAcross(
|
|
14547
14582
|
repos2,
|
|
@@ -14553,6 +14588,7 @@ async function nextItems(req, res) {
|
|
|
14553
14588
|
const body = {
|
|
14554
14589
|
scope,
|
|
14555
14590
|
peerPrs,
|
|
14591
|
+
myPrs,
|
|
14556
14592
|
assignedIssues,
|
|
14557
14593
|
pickups,
|
|
14558
14594
|
boards
|