@staff0rd/assist 0.737.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/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.737.0",
9
+ version: "0.738.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -13960,6 +13960,13 @@ 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/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;
13968
+ }
13969
+
13963
13970
  // src/commands/sessions/web/next/ghErrorText.ts
13964
13971
  function ghErrorText(error) {
13965
13972
  const stderr = error.stderr;
@@ -14002,7 +14009,8 @@ var pickupsQuery = `query($owner: String!, $number: Int!, $after: String) {
14002
14009
  author { login }
14003
14010
  repository { nameWithOwner }
14004
14011
  assignees(first: 1) { totalCount }
14005
- issueType { name }
14012
+ issueType { name color }
14013
+ parent { url }
14006
14014
  labels(first: 20) { nodes { name } }
14007
14015
  }
14008
14016
  }
@@ -14073,6 +14081,24 @@ async function sectionAcross(repos2, load3, compare) {
14073
14081
  };
14074
14082
  }
14075
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
+
14076
14102
  // src/commands/sessions/web/next/isPickable.ts
14077
14103
  var lowered = (values) => new Set(values.map((value) => value.toLowerCase()));
14078
14104
  function isPickable(filter) {
@@ -14092,8 +14118,8 @@ function isPickable(filter) {
14092
14118
  };
14093
14119
  }
14094
14120
 
14095
- // src/commands/sessions/web/next/selectPickups.ts
14096
- function toPickup(node, board, position) {
14121
+ // src/commands/sessions/web/next/toPickup.ts
14122
+ function toPickup(node, board, order) {
14097
14123
  const issue = node.content;
14098
14124
  const repo = issue?.repository?.nameWithOwner;
14099
14125
  const status3 = node.status?.name;
@@ -14113,14 +14139,18 @@ function toPickup(node, board, position) {
14113
14139
  itemId: node.id,
14114
14140
  status: status3,
14115
14141
  priority: node.priority?.name ?? null,
14116
- position
14142
+ type: issue.issueType?.name ? { name: issue.issueType.name, color: issue.issueType.color ?? "GRAY" } : null,
14143
+ boardOrder: order
14117
14144
  };
14118
14145
  }
14146
+
14147
+ // src/commands/sessions/web/next/selectPickups.ts
14119
14148
  function selectPickups(nodes, filter, board) {
14120
14149
  const pickable = isPickable(filter);
14150
+ const orderOf = boardOrder(nodes);
14121
14151
  return nodes.flatMap(
14122
- (node, position) => pickable(node) ? toPickup(node, board, position) ?? [] : []
14123
- );
14152
+ (node, position) => pickable(node) ? toPickup(node, board, orderOf(position)) ?? [] : []
14153
+ ).sort((a, b) => compareBoardOrder(a.boardOrder, b.boardOrder));
14124
14154
  }
14125
14155
 
14126
14156
  // src/commands/sessions/web/next/fetchPickups.ts
@@ -14139,7 +14169,7 @@ async function fetchPickups(cwd, projects, filter) {
14139
14169
  throw new Error(projectErrorText(error));
14140
14170
  }
14141
14171
  },
14142
- (a, b) => projects.indexOf(a.project) - projects.indexOf(b.project) || a.position - b.position
14172
+ (a, b) => projects.indexOf(a.project) - projects.indexOf(b.project) || compareBoardOrder(a.boardOrder, b.boardOrder)
14143
14173
  );
14144
14174
  return {
14145
14175
  pickups,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.737.0",
3
+ "version": "0.738.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {