@staff0rd/assist 0.734.0 → 0.736.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 +3 -1
- package/dist/commands/sessions/web/bundle.js +384 -384
- package/dist/index.js +75 -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.736.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -867,7 +867,9 @@ var assistConfigShape = {
|
|
|
867
867
|
"Use <owner>/<project number>, e.g. my-org/3"
|
|
868
868
|
)
|
|
869
869
|
).optional(),
|
|
870
|
-
pickStatuses: z3.array(z3.string()).optional()
|
|
870
|
+
pickStatuses: z3.array(z3.string()).optional(),
|
|
871
|
+
excludeLabels: z3.array(z3.string()).optional(),
|
|
872
|
+
excludeTypes: z3.array(z3.string()).optional()
|
|
871
873
|
}).optional(),
|
|
872
874
|
deny: z3.array(
|
|
873
875
|
z3.strictObject({
|
|
@@ -12593,6 +12595,16 @@ var nextConfigHelp = [
|
|
|
12593
12595
|
key: "next.pickStatuses",
|
|
12594
12596
|
setter: "assist config set next.pickStatuses Ready,Todo -g --repo",
|
|
12595
12597
|
note: "Project Status values whose unassigned items the web /next view offers to pick up (default: Ready, Todo)"
|
|
12598
|
+
},
|
|
12599
|
+
{
|
|
12600
|
+
key: "next.excludeLabels",
|
|
12601
|
+
setter: "assist config set next.excludeLabels blocked,spike -g --repo",
|
|
12602
|
+
note: "Labels whose project items the web /next view never offers to pick up (case-insensitive)"
|
|
12603
|
+
},
|
|
12604
|
+
{
|
|
12605
|
+
key: "next.excludeTypes",
|
|
12606
|
+
setter: "assist config set next.excludeTypes Epic -g --repo",
|
|
12607
|
+
note: "GitHub issue types whose project items the web /next view never offers to pick up (case-insensitive)"
|
|
12596
12608
|
}
|
|
12597
12609
|
];
|
|
12598
12610
|
|
|
@@ -13974,6 +13986,7 @@ var pickupsQuery = `query($owner: String!, $number: Int!, $after: String) {
|
|
|
13974
13986
|
... on ProjectV2Owner {
|
|
13975
13987
|
projectV2(number: $number) {
|
|
13976
13988
|
title
|
|
13989
|
+
url
|
|
13977
13990
|
priorityField: field(name: "Priority") {
|
|
13978
13991
|
... on ProjectV2SingleSelectField { options { name } }
|
|
13979
13992
|
}
|
|
@@ -13997,6 +14010,7 @@ var pickupsQuery = `query($owner: String!, $number: Int!, $after: String) {
|
|
|
13997
14010
|
author { login }
|
|
13998
14011
|
repository { nameWithOwner }
|
|
13999
14012
|
assignees(first: 1) { totalCount }
|
|
14013
|
+
issueType { name }
|
|
14000
14014
|
labels(first: 20) { nodes { name } }
|
|
14001
14015
|
}
|
|
14002
14016
|
}
|
|
@@ -14027,7 +14041,12 @@ var MAX_PAGES = 10;
|
|
|
14027
14041
|
async function readProjectItems(cwd, project) {
|
|
14028
14042
|
const [owner, number] = project.split("/");
|
|
14029
14043
|
const nodes = [];
|
|
14030
|
-
const board = {
|
|
14044
|
+
const board = {
|
|
14045
|
+
project,
|
|
14046
|
+
title: project,
|
|
14047
|
+
url: "",
|
|
14048
|
+
priorityOrder: []
|
|
14049
|
+
};
|
|
14031
14050
|
let after = null;
|
|
14032
14051
|
for (let page = 0; page < MAX_PAGES; page++) {
|
|
14033
14052
|
const response = await readProjectPage(cwd, owner, number, after);
|
|
@@ -14037,6 +14056,7 @@ async function readProjectItems(cwd, project) {
|
|
|
14037
14056
|
throw new Error(reason4 ?? `No project ${number} owned by ${owner}`);
|
|
14038
14057
|
}
|
|
14039
14058
|
board.title = projectV2.title ?? project;
|
|
14059
|
+
board.url = projectV2.url ?? "";
|
|
14040
14060
|
board.priorityOrder = (projectV2.priorityField?.options ?? []).map(
|
|
14041
14061
|
(option) => option.name
|
|
14042
14062
|
);
|
|
@@ -14069,6 +14089,25 @@ async function sectionAcross(repos2, load3, compare) {
|
|
|
14069
14089
|
};
|
|
14070
14090
|
}
|
|
14071
14091
|
|
|
14092
|
+
// src/commands/sessions/web/next/isPickable.ts
|
|
14093
|
+
var lowered = (values) => new Set(values.map((value) => value.toLowerCase()));
|
|
14094
|
+
function isPickable(filter) {
|
|
14095
|
+
const statuses = lowered(filter.pickStatuses);
|
|
14096
|
+
const excludedLabels = lowered(filter.excludeLabels);
|
|
14097
|
+
const excludedTypes = lowered(filter.excludeTypes);
|
|
14098
|
+
return (node) => {
|
|
14099
|
+
const issue = node.content;
|
|
14100
|
+
if (issue?.state !== "OPEN" || issue.assignees?.totalCount !== 0)
|
|
14101
|
+
return false;
|
|
14102
|
+
if (!statuses.has(node.status?.name?.toLowerCase() ?? "")) return false;
|
|
14103
|
+
const type = issue.issueType?.name?.toLowerCase();
|
|
14104
|
+
if (type && excludedTypes.has(type)) return false;
|
|
14105
|
+
return !(issue.labels?.nodes ?? []).some(
|
|
14106
|
+
(label2) => label2?.name && excludedLabels.has(label2.name.toLowerCase())
|
|
14107
|
+
);
|
|
14108
|
+
};
|
|
14109
|
+
}
|
|
14110
|
+
|
|
14072
14111
|
// src/commands/sessions/web/next/selectPickups.ts
|
|
14073
14112
|
function priorityRank(priority, order) {
|
|
14074
14113
|
const index3 = priority ? order.indexOf(priority) : -1;
|
|
@@ -14098,29 +14137,33 @@ function toPickup(node, board) {
|
|
|
14098
14137
|
priorityRank: priorityRank(priority, board.priorityOrder)
|
|
14099
14138
|
};
|
|
14100
14139
|
}
|
|
14101
|
-
function selectPickups(nodes,
|
|
14102
|
-
|
|
14103
|
-
return nodes.filter(
|
|
14104
|
-
(node) => node.content?.state === "OPEN" && node.content.assignees?.totalCount === 0
|
|
14105
|
-
).flatMap((node) => toPickup(node, board) ?? []).filter((pickup) => statuses.has(pickup.status.toLowerCase())).sort(comparePickups);
|
|
14140
|
+
function selectPickups(nodes, filter, board) {
|
|
14141
|
+
return nodes.filter(isPickable(filter)).flatMap((node) => toPickup(node, board) ?? []).sort(comparePickups);
|
|
14106
14142
|
}
|
|
14107
14143
|
|
|
14108
14144
|
// src/commands/sessions/web/next/fetchPickups.ts
|
|
14109
|
-
async function
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
throw new Error(projectErrorText(error));
|
|
14115
|
-
}
|
|
14116
|
-
}
|
|
14117
|
-
async function fetchPickups(cwd, projects, pickStatuses) {
|
|
14118
|
-
if (projects.length === 0) return { items: [], error: null };
|
|
14119
|
-
return sectionAcross(
|
|
14145
|
+
async function fetchPickups(cwd, projects, filter) {
|
|
14146
|
+
if (projects.length === 0)
|
|
14147
|
+
return { pickups: { items: [], error: null }, boards: [] };
|
|
14148
|
+
const boards = /* @__PURE__ */ new Map();
|
|
14149
|
+
const pickups = await sectionAcross(
|
|
14120
14150
|
projects,
|
|
14121
|
-
(project) =>
|
|
14151
|
+
async (project) => {
|
|
14152
|
+
try {
|
|
14153
|
+
const { nodes, board } = await readProjectItems(cwd, project);
|
|
14154
|
+
const { priorityOrder: _, ...link3 } = board;
|
|
14155
|
+
boards.set(project, link3);
|
|
14156
|
+
return selectPickups(nodes, filter, board);
|
|
14157
|
+
} catch (error) {
|
|
14158
|
+
throw new Error(projectErrorText(error));
|
|
14159
|
+
}
|
|
14160
|
+
},
|
|
14122
14161
|
comparePickups
|
|
14123
14162
|
);
|
|
14163
|
+
return {
|
|
14164
|
+
pickups,
|
|
14165
|
+
boards: projects.flatMap((project) => boards.get(project) ?? [])
|
|
14166
|
+
};
|
|
14124
14167
|
}
|
|
14125
14168
|
|
|
14126
14169
|
// src/commands/sessions/web/next/nextScope.ts
|
|
@@ -14137,7 +14180,9 @@ function nextScope(cwd) {
|
|
|
14137
14180
|
peers: next3?.peers ?? [],
|
|
14138
14181
|
repos: next3?.repos ?? null,
|
|
14139
14182
|
projects: next3?.projects ?? [],
|
|
14140
|
-
pickStatuses: next3?.pickStatuses ?? DEFAULT_PICK_STATUSES
|
|
14183
|
+
pickStatuses: next3?.pickStatuses ?? DEFAULT_PICK_STATUSES,
|
|
14184
|
+
excludeLabels: next3?.excludeLabels ?? [],
|
|
14185
|
+
excludeTypes: next3?.excludeTypes ?? []
|
|
14141
14186
|
};
|
|
14142
14187
|
}
|
|
14143
14188
|
|
|
@@ -14153,7 +14198,7 @@ async function nextItems(req, res) {
|
|
|
14153
14198
|
if (!cwd) return;
|
|
14154
14199
|
const scope = nextScope(cwd);
|
|
14155
14200
|
const repos2 = scopeRepos(scope.repos, scope.selfRepo);
|
|
14156
|
-
const [peerPrs, assignedIssues, pickups] = await Promise.all([
|
|
14201
|
+
const [peerPrs, assignedIssues, { pickups, boards }] = await Promise.all([
|
|
14157
14202
|
sectionAcross(
|
|
14158
14203
|
repos2,
|
|
14159
14204
|
(repo) => fetchPeerPrs(cwd, repo, scope.peers),
|
|
@@ -14164,9 +14209,15 @@ async function nextItems(req, res) {
|
|
|
14164
14209
|
(repo) => fetchAssignedIssues(cwd, repo),
|
|
14165
14210
|
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
|
14166
14211
|
),
|
|
14167
|
-
fetchPickups(cwd, scope.projects, scope
|
|
14212
|
+
fetchPickups(cwd, scope.projects, scope)
|
|
14168
14213
|
]);
|
|
14169
|
-
const body = {
|
|
14214
|
+
const body = {
|
|
14215
|
+
scope,
|
|
14216
|
+
peerPrs,
|
|
14217
|
+
assignedIssues,
|
|
14218
|
+
pickups,
|
|
14219
|
+
boards
|
|
14220
|
+
};
|
|
14170
14221
|
respondJson(res, 200, body);
|
|
14171
14222
|
}
|
|
14172
14223
|
|