@staff0rd/assist 0.734.0 → 0.735.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 +59 -59
- package/dist/index.js +44 -13
- 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.735.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
|
|
|
@@ -13997,6 +14009,7 @@ var pickupsQuery = `query($owner: String!, $number: Int!, $after: String) {
|
|
|
13997
14009
|
author { login }
|
|
13998
14010
|
repository { nameWithOwner }
|
|
13999
14011
|
assignees(first: 1) { totalCount }
|
|
14012
|
+
issueType { name }
|
|
14000
14013
|
labels(first: 20) { nodes { name } }
|
|
14001
14014
|
}
|
|
14002
14015
|
}
|
|
@@ -14069,6 +14082,25 @@ async function sectionAcross(repos2, load3, compare) {
|
|
|
14069
14082
|
};
|
|
14070
14083
|
}
|
|
14071
14084
|
|
|
14085
|
+
// src/commands/sessions/web/next/isPickable.ts
|
|
14086
|
+
var lowered = (values) => new Set(values.map((value) => value.toLowerCase()));
|
|
14087
|
+
function isPickable(filter) {
|
|
14088
|
+
const statuses = lowered(filter.pickStatuses);
|
|
14089
|
+
const excludedLabels = lowered(filter.excludeLabels);
|
|
14090
|
+
const excludedTypes = lowered(filter.excludeTypes);
|
|
14091
|
+
return (node) => {
|
|
14092
|
+
const issue = node.content;
|
|
14093
|
+
if (issue?.state !== "OPEN" || issue.assignees?.totalCount !== 0)
|
|
14094
|
+
return false;
|
|
14095
|
+
if (!statuses.has(node.status?.name?.toLowerCase() ?? "")) return false;
|
|
14096
|
+
const type = issue.issueType?.name?.toLowerCase();
|
|
14097
|
+
if (type && excludedTypes.has(type)) return false;
|
|
14098
|
+
return !(issue.labels?.nodes ?? []).some(
|
|
14099
|
+
(label2) => label2?.name && excludedLabels.has(label2.name.toLowerCase())
|
|
14100
|
+
);
|
|
14101
|
+
};
|
|
14102
|
+
}
|
|
14103
|
+
|
|
14072
14104
|
// src/commands/sessions/web/next/selectPickups.ts
|
|
14073
14105
|
function priorityRank(priority, order) {
|
|
14074
14106
|
const index3 = priority ? order.indexOf(priority) : -1;
|
|
@@ -14098,27 +14130,24 @@ function toPickup(node, board) {
|
|
|
14098
14130
|
priorityRank: priorityRank(priority, board.priorityOrder)
|
|
14099
14131
|
};
|
|
14100
14132
|
}
|
|
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);
|
|
14133
|
+
function selectPickups(nodes, filter, board) {
|
|
14134
|
+
return nodes.filter(isPickable(filter)).flatMap((node) => toPickup(node, board) ?? []).sort(comparePickups);
|
|
14106
14135
|
}
|
|
14107
14136
|
|
|
14108
14137
|
// src/commands/sessions/web/next/fetchPickups.ts
|
|
14109
|
-
async function loadPickups(cwd, project,
|
|
14138
|
+
async function loadPickups(cwd, project, filter) {
|
|
14110
14139
|
try {
|
|
14111
14140
|
const { nodes, board } = await readProjectItems(cwd, project);
|
|
14112
|
-
return selectPickups(nodes,
|
|
14141
|
+
return selectPickups(nodes, filter, board);
|
|
14113
14142
|
} catch (error) {
|
|
14114
14143
|
throw new Error(projectErrorText(error));
|
|
14115
14144
|
}
|
|
14116
14145
|
}
|
|
14117
|
-
async function fetchPickups(cwd, projects,
|
|
14146
|
+
async function fetchPickups(cwd, projects, filter) {
|
|
14118
14147
|
if (projects.length === 0) return { items: [], error: null };
|
|
14119
14148
|
return sectionAcross(
|
|
14120
14149
|
projects,
|
|
14121
|
-
(project) => loadPickups(cwd, project,
|
|
14150
|
+
(project) => loadPickups(cwd, project, filter),
|
|
14122
14151
|
comparePickups
|
|
14123
14152
|
);
|
|
14124
14153
|
}
|
|
@@ -14137,7 +14166,9 @@ function nextScope(cwd) {
|
|
|
14137
14166
|
peers: next3?.peers ?? [],
|
|
14138
14167
|
repos: next3?.repos ?? null,
|
|
14139
14168
|
projects: next3?.projects ?? [],
|
|
14140
|
-
pickStatuses: next3?.pickStatuses ?? DEFAULT_PICK_STATUSES
|
|
14169
|
+
pickStatuses: next3?.pickStatuses ?? DEFAULT_PICK_STATUSES,
|
|
14170
|
+
excludeLabels: next3?.excludeLabels ?? [],
|
|
14171
|
+
excludeTypes: next3?.excludeTypes ?? []
|
|
14141
14172
|
};
|
|
14142
14173
|
}
|
|
14143
14174
|
|
|
@@ -14164,7 +14195,7 @@ async function nextItems(req, res) {
|
|
|
14164
14195
|
(repo) => fetchAssignedIssues(cwd, repo),
|
|
14165
14196
|
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
|
14166
14197
|
),
|
|
14167
|
-
fetchPickups(cwd, scope.projects, scope
|
|
14198
|
+
fetchPickups(cwd, scope.projects, scope)
|
|
14168
14199
|
]);
|
|
14169
14200
|
const body = { scope, peerPrs, assignedIssues, pickups };
|
|
14170
14201
|
respondJson(res, 200, body);
|