@staff0rd/assist 0.824.5 → 0.825.1

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.824.5",
9
+ version: "0.825.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -14591,11 +14591,10 @@ function isRequested(node, viewer) {
14591
14591
  (request) => sameLogin(request?.requestedReviewer?.login, viewer)
14592
14592
  );
14593
14593
  }
14594
- function isApproved(node, viewer) {
14595
- const mine = (node.latestReviews?.nodes ?? []).find(
14596
- (review2) => sameLogin(review2?.author?.login, viewer)
14594
+ function isApproved(node) {
14595
+ return (node.latestReviews?.nodes ?? []).some(
14596
+ (review2) => review2?.state === "APPROVED"
14597
14597
  );
14598
- return mine?.state === "APPROVED";
14599
14598
  }
14600
14599
  function selectPeerPrs(nodes, viewer, peers) {
14601
14600
  const selected = [];
@@ -14605,7 +14604,7 @@ function selectPeerPrs(nodes, viewer, peers) {
14605
14604
  continue;
14606
14605
  const requested = isRequested(node, viewer);
14607
14606
  const byPeer = peers.some((peer) => sameLogin(author, peer));
14608
- if (!requested && (!byPeer || isApproved(node, viewer))) continue;
14607
+ if (!requested && (!byPeer || isApproved(node))) continue;
14609
14608
  selected.push(toNextPr(node, author, requested, viewer));
14610
14609
  }
14611
14610
  return selected.sort((a, b) => a.requestedAt.localeCompare(b.requestedAt));
@@ -35423,14 +35422,6 @@ function classifyTestCall(call) {
35423
35422
  return void 0;
35424
35423
  }
35425
35424
 
35426
- // src/commands/review/highLevel/dedentedSource.ts
35427
- function dedentedSource(call) {
35428
- const text18 = call.getSourceFile().getFullText();
35429
- const lineStart = text18.lastIndexOf("\n", call.getStart()) + 1;
35430
- const indent3 = /^\s*/.exec(text18.slice(lineStart, call.getStart()))?.[0] ?? "";
35431
- return call.getText().split("\n").map((line) => line.startsWith(indent3) ? line.slice(indent3.length) : line).join("\n");
35432
- }
35433
-
35434
35425
  // src/commands/review/highLevel/testName.ts
35435
35426
  import { Node as Node3 } from "ts-morph";
35436
35427
  function testName(call) {
@@ -35441,23 +35432,41 @@ function testName(call) {
35441
35432
  return first?.getText() ?? "";
35442
35433
  }
35443
35434
 
35444
- // src/commands/review/highLevel/extractTestHierarchy.ts
35445
- function touchesChange(call, changed) {
35446
- if (!changed) return true;
35447
- for (let line = call.getStartLineNumber(); line <= call.getEndLineNumber(); line++)
35448
- if (changed.has(line)) return true;
35449
- return false;
35435
+ // src/commands/review/highLevel/dedentedSource.ts
35436
+ function dedentedSource(call) {
35437
+ const text18 = call.getSourceFile().getFullText();
35438
+ const lineStart = text18.lastIndexOf("\n", call.getStart()) + 1;
35439
+ const indent3 = /^\s*/.exec(text18.slice(lineStart, call.getStart()))?.[0] ?? "";
35440
+ return call.getText().split("\n").map((line) => line.startsWith(indent3) ? line.slice(indent3.length) : line).join("\n");
35450
35441
  }
35451
- function toCase(call, context) {
35442
+
35443
+ // src/commands/review/highLevel/visitCase.ts
35444
+ function visitCase(call, context) {
35445
+ if (!context.changed) return [toCase(call, context, void 0)];
35446
+ const count8 = changedLines(call, context.changed);
35447
+ if (count8 === 0) return [];
35448
+ const lines2 = call.getEndLineNumber() - call.getStartLineNumber() + 1;
35449
+ return [toCase(call, context, count8 === lines2 ? "added" : "modified")];
35450
+ }
35451
+ function toCase(call, context, change) {
35452
35452
  const line = call.getStartLineNumber();
35453
35453
  return {
35454
35454
  kind: "it",
35455
35455
  id: `${context.path}:${line}`,
35456
35456
  name: testName(call),
35457
35457
  line,
35458
+ ...change ? { change } : {},
35458
35459
  source: dedentedSource(call)
35459
35460
  };
35460
35461
  }
35462
+ function changedLines(call, changed) {
35463
+ let count8 = 0;
35464
+ for (let line = call.getStartLineNumber(); line <= call.getEndLineNumber(); line++)
35465
+ if (changed.has(line)) count8++;
35466
+ return count8;
35467
+ }
35468
+
35469
+ // src/commands/review/highLevel/extractTestHierarchy.ts
35461
35470
  function collect7(node, context) {
35462
35471
  const found = [];
35463
35472
  node.forEachChild((child) => {
@@ -35468,8 +35477,7 @@ function collect7(node, context) {
35468
35477
  function visit(node, context) {
35469
35478
  if (!Node4.isCallExpression(node)) return collect7(node, context);
35470
35479
  const kind = classifyTestCall(node);
35471
- if (kind === "it")
35472
- return touchesChange(node, context.changed) ? [toCase(node, context)] : [];
35480
+ if (kind === "it") return visitCase(node, context);
35473
35481
  if (kind === void 0) return collect7(node, context);
35474
35482
  const children = node.getArguments().slice(1).flatMap((argument) => visit(argument, context));
35475
35483
  if (children.length === 0) return [];
@@ -36083,9 +36091,15 @@ function formatHighLevelStructure(structure) {
36083
36091
 
36084
36092
  // src/commands/review/highLevel/formatHighLevelTests.ts
36085
36093
  import chalk238 from "chalk";
36094
+ function changeMarker(change) {
36095
+ if (change === "added") return "A";
36096
+ if (change === "modified") return "M";
36097
+ return "\xB7";
36098
+ }
36086
36099
  function formatNode2(node, depth) {
36087
36100
  const indent3 = " ".repeat(depth + 2);
36088
- if (node.kind === "it") return [`${indent3}${chalk238.dim("\xB7")} ${node.name}`];
36101
+ if (node.kind === "it")
36102
+ return [`${indent3}${chalk238.dim(changeMarker(node.change))} ${node.name}`];
36089
36103
  return [
36090
36104
  `${indent3}${chalk238.bold(node.name)}`,
36091
36105
  ...node.children.flatMap((child) => formatNode2(child, depth + 1))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.824.5",
3
+ "version": "0.825.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {