@staff0rd/assist 0.736.0 → 0.738.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/README.md +6 -2
- package/dist/commands/sessions/web/bundle.js +295 -295
- package/dist/index.js +41 -30
- 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.738.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -13960,9 +13960,11 @@ async function fetchPeerPrs(cwd, repo, peers) {
|
|
|
13960
13960
|
return selectPeerPrs(nodes, viewer, peers).map((pr) => ({ ...pr, repo }));
|
|
13961
13961
|
}
|
|
13962
13962
|
|
|
13963
|
-
// src/commands/sessions/web/next/
|
|
13964
|
-
function
|
|
13965
|
-
|
|
13963
|
+
// src/commands/sessions/web/next/compareBoardOrder.ts
|
|
13964
|
+
function compareBoardOrder(a, b) {
|
|
13965
|
+
for (let index3 = 0; index3 < Math.min(a.length, b.length); index3++)
|
|
13966
|
+
if (a[index3] !== b[index3]) return a[index3] - b[index3];
|
|
13967
|
+
return a.length - b.length;
|
|
13966
13968
|
}
|
|
13967
13969
|
|
|
13968
13970
|
// src/commands/sessions/web/next/ghErrorText.ts
|
|
@@ -13987,9 +13989,6 @@ var pickupsQuery = `query($owner: String!, $number: Int!, $after: String) {
|
|
|
13987
13989
|
projectV2(number: $number) {
|
|
13988
13990
|
title
|
|
13989
13991
|
url
|
|
13990
|
-
priorityField: field(name: "Priority") {
|
|
13991
|
-
... on ProjectV2SingleSelectField { options { name } }
|
|
13992
|
-
}
|
|
13993
13992
|
items(first: 100, after: $after) {
|
|
13994
13993
|
pageInfo { hasNextPage endCursor }
|
|
13995
13994
|
nodes {
|
|
@@ -14010,7 +14009,8 @@ var pickupsQuery = `query($owner: String!, $number: Int!, $after: String) {
|
|
|
14010
14009
|
author { login }
|
|
14011
14010
|
repository { nameWithOwner }
|
|
14012
14011
|
assignees(first: 1) { totalCount }
|
|
14013
|
-
issueType { name }
|
|
14012
|
+
issueType { name color }
|
|
14013
|
+
parent { url }
|
|
14014
14014
|
labels(first: 20) { nodes { name } }
|
|
14015
14015
|
}
|
|
14016
14016
|
}
|
|
@@ -14041,12 +14041,7 @@ var MAX_PAGES = 10;
|
|
|
14041
14041
|
async function readProjectItems(cwd, project) {
|
|
14042
14042
|
const [owner, number] = project.split("/");
|
|
14043
14043
|
const nodes = [];
|
|
14044
|
-
const board = {
|
|
14045
|
-
project,
|
|
14046
|
-
title: project,
|
|
14047
|
-
url: "",
|
|
14048
|
-
priorityOrder: []
|
|
14049
|
-
};
|
|
14044
|
+
const board = { project, title: project, url: "" };
|
|
14050
14045
|
let after = null;
|
|
14051
14046
|
for (let page = 0; page < MAX_PAGES; page++) {
|
|
14052
14047
|
const response = await readProjectPage(cwd, owner, number, after);
|
|
@@ -14057,9 +14052,6 @@ async function readProjectItems(cwd, project) {
|
|
|
14057
14052
|
}
|
|
14058
14053
|
board.title = projectV2.title ?? project;
|
|
14059
14054
|
board.url = projectV2.url ?? "";
|
|
14060
|
-
board.priorityOrder = (projectV2.priorityField?.options ?? []).map(
|
|
14061
|
-
(option) => option.name
|
|
14062
|
-
);
|
|
14063
14055
|
for (const node of projectV2.items.nodes ?? []) if (node) nodes.push(node);
|
|
14064
14056
|
const { hasNextPage: hasNextPage2, endCursor } = projectV2.items.pageInfo ?? {};
|
|
14065
14057
|
if (!hasNextPage2 || !endCursor) break;
|
|
@@ -14089,6 +14081,24 @@ async function sectionAcross(repos2, load3, compare) {
|
|
|
14089
14081
|
};
|
|
14090
14082
|
}
|
|
14091
14083
|
|
|
14084
|
+
// src/commands/sessions/web/next/boardOrder.ts
|
|
14085
|
+
function boardOrder(nodes) {
|
|
14086
|
+
const positionOf = /* @__PURE__ */ new Map();
|
|
14087
|
+
nodes.forEach((node, position) => {
|
|
14088
|
+
if (node.content?.url) positionOf.set(node.content.url, position);
|
|
14089
|
+
});
|
|
14090
|
+
const parentOf2 = (position) => {
|
|
14091
|
+
const url = nodes[position]?.content?.parent?.url;
|
|
14092
|
+
return url === void 0 ? void 0 : positionOf.get(url);
|
|
14093
|
+
};
|
|
14094
|
+
return (position) => {
|
|
14095
|
+
const ancestry = [position];
|
|
14096
|
+
for (let parent = parentOf2(position); parent !== void 0 && !ancestry.includes(parent); parent = parentOf2(parent))
|
|
14097
|
+
ancestry.unshift(parent);
|
|
14098
|
+
return ancestry;
|
|
14099
|
+
};
|
|
14100
|
+
}
|
|
14101
|
+
|
|
14092
14102
|
// src/commands/sessions/web/next/isPickable.ts
|
|
14093
14103
|
var lowered = (values) => new Set(values.map((value) => value.toLowerCase()));
|
|
14094
14104
|
function isPickable(filter) {
|
|
@@ -14108,17 +14118,12 @@ function isPickable(filter) {
|
|
|
14108
14118
|
};
|
|
14109
14119
|
}
|
|
14110
14120
|
|
|
14111
|
-
// src/commands/sessions/web/next/
|
|
14112
|
-
function
|
|
14113
|
-
const index3 = priority ? order.indexOf(priority) : -1;
|
|
14114
|
-
return index3 === -1 ? order.length : index3;
|
|
14115
|
-
}
|
|
14116
|
-
function toPickup(node, board) {
|
|
14121
|
+
// src/commands/sessions/web/next/toPickup.ts
|
|
14122
|
+
function toPickup(node, board, order) {
|
|
14117
14123
|
const issue = node.content;
|
|
14118
14124
|
const repo = issue?.repository?.nameWithOwner;
|
|
14119
14125
|
const status3 = node.status?.name;
|
|
14120
14126
|
if (!issue?.number || !issue.url || !repo || !status3) return null;
|
|
14121
|
-
const priority = node.priority?.name ?? null;
|
|
14122
14127
|
return {
|
|
14123
14128
|
repo,
|
|
14124
14129
|
number: issue.number,
|
|
@@ -14133,12 +14138,19 @@ function toPickup(node, board) {
|
|
|
14133
14138
|
projectTitle: board.title,
|
|
14134
14139
|
itemId: node.id,
|
|
14135
14140
|
status: status3,
|
|
14136
|
-
priority,
|
|
14137
|
-
|
|
14141
|
+
priority: node.priority?.name ?? null,
|
|
14142
|
+
type: issue.issueType?.name ? { name: issue.issueType.name, color: issue.issueType.color ?? "GRAY" } : null,
|
|
14143
|
+
boardOrder: order
|
|
14138
14144
|
};
|
|
14139
14145
|
}
|
|
14146
|
+
|
|
14147
|
+
// src/commands/sessions/web/next/selectPickups.ts
|
|
14140
14148
|
function selectPickups(nodes, filter, board) {
|
|
14141
|
-
|
|
14149
|
+
const pickable = isPickable(filter);
|
|
14150
|
+
const orderOf = boardOrder(nodes);
|
|
14151
|
+
return nodes.flatMap(
|
|
14152
|
+
(node, position) => pickable(node) ? toPickup(node, board, orderOf(position)) ?? [] : []
|
|
14153
|
+
).sort((a, b) => compareBoardOrder(a.boardOrder, b.boardOrder));
|
|
14142
14154
|
}
|
|
14143
14155
|
|
|
14144
14156
|
// src/commands/sessions/web/next/fetchPickups.ts
|
|
@@ -14151,14 +14163,13 @@ async function fetchPickups(cwd, projects, filter) {
|
|
|
14151
14163
|
async (project) => {
|
|
14152
14164
|
try {
|
|
14153
14165
|
const { nodes, board } = await readProjectItems(cwd, project);
|
|
14154
|
-
|
|
14155
|
-
boards.set(project, link3);
|
|
14166
|
+
boards.set(project, board);
|
|
14156
14167
|
return selectPickups(nodes, filter, board);
|
|
14157
14168
|
} catch (error) {
|
|
14158
14169
|
throw new Error(projectErrorText(error));
|
|
14159
14170
|
}
|
|
14160
14171
|
},
|
|
14161
|
-
|
|
14172
|
+
(a, b) => projects.indexOf(a.project) - projects.indexOf(b.project) || compareBoardOrder(a.boardOrder, b.boardOrder)
|
|
14162
14173
|
);
|
|
14163
14174
|
return {
|
|
14164
14175
|
pickups,
|