@staff0rd/assist 0.735.0 → 0.737.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/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.735.0",
9
+ version: "0.737.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -13960,11 +13960,6 @@ 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/comparePickups.ts
13964
- function comparePickups(a, b) {
13965
- return a.priorityRank - b.priorityRank || a.createdAt.localeCompare(b.createdAt);
13966
- }
13967
-
13968
13963
  // src/commands/sessions/web/next/ghErrorText.ts
13969
13964
  function ghErrorText(error) {
13970
13965
  const stderr = error.stderr;
@@ -13986,9 +13981,7 @@ var pickupsQuery = `query($owner: String!, $number: Int!, $after: String) {
13986
13981
  ... on ProjectV2Owner {
13987
13982
  projectV2(number: $number) {
13988
13983
  title
13989
- priorityField: field(name: "Priority") {
13990
- ... on ProjectV2SingleSelectField { options { name } }
13991
- }
13984
+ url
13992
13985
  items(first: 100, after: $after) {
13993
13986
  pageInfo { hasNextPage endCursor }
13994
13987
  nodes {
@@ -14040,7 +14033,7 @@ var MAX_PAGES = 10;
14040
14033
  async function readProjectItems(cwd, project) {
14041
14034
  const [owner, number] = project.split("/");
14042
14035
  const nodes = [];
14043
- const board = { project, title: project, priorityOrder: [] };
14036
+ const board = { project, title: project, url: "" };
14044
14037
  let after = null;
14045
14038
  for (let page = 0; page < MAX_PAGES; page++) {
14046
14039
  const response = await readProjectPage(cwd, owner, number, after);
@@ -14050,9 +14043,7 @@ async function readProjectItems(cwd, project) {
14050
14043
  throw new Error(reason4 ?? `No project ${number} owned by ${owner}`);
14051
14044
  }
14052
14045
  board.title = projectV2.title ?? project;
14053
- board.priorityOrder = (projectV2.priorityField?.options ?? []).map(
14054
- (option) => option.name
14055
- );
14046
+ board.url = projectV2.url ?? "";
14056
14047
  for (const node of projectV2.items.nodes ?? []) if (node) nodes.push(node);
14057
14048
  const { hasNextPage: hasNextPage2, endCursor } = projectV2.items.pageInfo ?? {};
14058
14049
  if (!hasNextPage2 || !endCursor) break;
@@ -14102,16 +14093,11 @@ function isPickable(filter) {
14102
14093
  }
14103
14094
 
14104
14095
  // src/commands/sessions/web/next/selectPickups.ts
14105
- function priorityRank(priority, order) {
14106
- const index3 = priority ? order.indexOf(priority) : -1;
14107
- return index3 === -1 ? order.length : index3;
14108
- }
14109
- function toPickup(node, board) {
14096
+ function toPickup(node, board, position) {
14110
14097
  const issue = node.content;
14111
14098
  const repo = issue?.repository?.nameWithOwner;
14112
14099
  const status3 = node.status?.name;
14113
14100
  if (!issue?.number || !issue.url || !repo || !status3) return null;
14114
- const priority = node.priority?.name ?? null;
14115
14101
  return {
14116
14102
  repo,
14117
14103
  number: issue.number,
@@ -14126,30 +14112,39 @@ function toPickup(node, board) {
14126
14112
  projectTitle: board.title,
14127
14113
  itemId: node.id,
14128
14114
  status: status3,
14129
- priority,
14130
- priorityRank: priorityRank(priority, board.priorityOrder)
14115
+ priority: node.priority?.name ?? null,
14116
+ position
14131
14117
  };
14132
14118
  }
14133
14119
  function selectPickups(nodes, filter, board) {
14134
- return nodes.filter(isPickable(filter)).flatMap((node) => toPickup(node, board) ?? []).sort(comparePickups);
14120
+ const pickable = isPickable(filter);
14121
+ return nodes.flatMap(
14122
+ (node, position) => pickable(node) ? toPickup(node, board, position) ?? [] : []
14123
+ );
14135
14124
  }
14136
14125
 
14137
14126
  // src/commands/sessions/web/next/fetchPickups.ts
14138
- async function loadPickups(cwd, project, filter) {
14139
- try {
14140
- const { nodes, board } = await readProjectItems(cwd, project);
14141
- return selectPickups(nodes, filter, board);
14142
- } catch (error) {
14143
- throw new Error(projectErrorText(error));
14144
- }
14145
- }
14146
14127
  async function fetchPickups(cwd, projects, filter) {
14147
- if (projects.length === 0) return { items: [], error: null };
14148
- return sectionAcross(
14128
+ if (projects.length === 0)
14129
+ return { pickups: { items: [], error: null }, boards: [] };
14130
+ const boards = /* @__PURE__ */ new Map();
14131
+ const pickups = await sectionAcross(
14149
14132
  projects,
14150
- (project) => loadPickups(cwd, project, filter),
14151
- comparePickups
14133
+ async (project) => {
14134
+ try {
14135
+ const { nodes, board } = await readProjectItems(cwd, project);
14136
+ boards.set(project, board);
14137
+ return selectPickups(nodes, filter, board);
14138
+ } catch (error) {
14139
+ throw new Error(projectErrorText(error));
14140
+ }
14141
+ },
14142
+ (a, b) => projects.indexOf(a.project) - projects.indexOf(b.project) || a.position - b.position
14152
14143
  );
14144
+ return {
14145
+ pickups,
14146
+ boards: projects.flatMap((project) => boards.get(project) ?? [])
14147
+ };
14153
14148
  }
14154
14149
 
14155
14150
  // src/commands/sessions/web/next/nextScope.ts
@@ -14184,7 +14179,7 @@ async function nextItems(req, res) {
14184
14179
  if (!cwd) return;
14185
14180
  const scope = nextScope(cwd);
14186
14181
  const repos2 = scopeRepos(scope.repos, scope.selfRepo);
14187
- const [peerPrs, assignedIssues, pickups] = await Promise.all([
14182
+ const [peerPrs, assignedIssues, { pickups, boards }] = await Promise.all([
14188
14183
  sectionAcross(
14189
14184
  repos2,
14190
14185
  (repo) => fetchPeerPrs(cwd, repo, scope.peers),
@@ -14197,7 +14192,13 @@ async function nextItems(req, res) {
14197
14192
  ),
14198
14193
  fetchPickups(cwd, scope.projects, scope)
14199
14194
  ]);
14200
- const body = { scope, peerPrs, assignedIssues, pickups };
14195
+ const body = {
14196
+ scope,
14197
+ peerPrs,
14198
+ assignedIssues,
14199
+ pickups,
14200
+ boards
14201
+ };
14201
14202
  respondJson(res, 200, body);
14202
14203
  }
14203
14204
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.735.0",
3
+ "version": "0.737.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {