@staff0rd/assist 0.824.5 → 0.825.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/commands/sessions/web/bundle.js +415 -415
- package/dist/index.js +34 -19
- 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.825.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -35423,14 +35423,6 @@ function classifyTestCall(call) {
|
|
|
35423
35423
|
return void 0;
|
|
35424
35424
|
}
|
|
35425
35425
|
|
|
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
35426
|
// src/commands/review/highLevel/testName.ts
|
|
35435
35427
|
import { Node as Node3 } from "ts-morph";
|
|
35436
35428
|
function testName(call) {
|
|
@@ -35441,23 +35433,41 @@ function testName(call) {
|
|
|
35441
35433
|
return first?.getText() ?? "";
|
|
35442
35434
|
}
|
|
35443
35435
|
|
|
35444
|
-
// src/commands/review/highLevel/
|
|
35445
|
-
function
|
|
35446
|
-
|
|
35447
|
-
|
|
35448
|
-
|
|
35449
|
-
return
|
|
35436
|
+
// src/commands/review/highLevel/dedentedSource.ts
|
|
35437
|
+
function dedentedSource(call) {
|
|
35438
|
+
const text18 = call.getSourceFile().getFullText();
|
|
35439
|
+
const lineStart = text18.lastIndexOf("\n", call.getStart()) + 1;
|
|
35440
|
+
const indent3 = /^\s*/.exec(text18.slice(lineStart, call.getStart()))?.[0] ?? "";
|
|
35441
|
+
return call.getText().split("\n").map((line) => line.startsWith(indent3) ? line.slice(indent3.length) : line).join("\n");
|
|
35450
35442
|
}
|
|
35451
|
-
|
|
35443
|
+
|
|
35444
|
+
// src/commands/review/highLevel/visitCase.ts
|
|
35445
|
+
function visitCase(call, context) {
|
|
35446
|
+
if (!context.changed) return [toCase(call, context, void 0)];
|
|
35447
|
+
const count8 = changedLines(call, context.changed);
|
|
35448
|
+
if (count8 === 0) return [];
|
|
35449
|
+
const lines2 = call.getEndLineNumber() - call.getStartLineNumber() + 1;
|
|
35450
|
+
return [toCase(call, context, count8 === lines2 ? "added" : "modified")];
|
|
35451
|
+
}
|
|
35452
|
+
function toCase(call, context, change) {
|
|
35452
35453
|
const line = call.getStartLineNumber();
|
|
35453
35454
|
return {
|
|
35454
35455
|
kind: "it",
|
|
35455
35456
|
id: `${context.path}:${line}`,
|
|
35456
35457
|
name: testName(call),
|
|
35457
35458
|
line,
|
|
35459
|
+
...change ? { change } : {},
|
|
35458
35460
|
source: dedentedSource(call)
|
|
35459
35461
|
};
|
|
35460
35462
|
}
|
|
35463
|
+
function changedLines(call, changed) {
|
|
35464
|
+
let count8 = 0;
|
|
35465
|
+
for (let line = call.getStartLineNumber(); line <= call.getEndLineNumber(); line++)
|
|
35466
|
+
if (changed.has(line)) count8++;
|
|
35467
|
+
return count8;
|
|
35468
|
+
}
|
|
35469
|
+
|
|
35470
|
+
// src/commands/review/highLevel/extractTestHierarchy.ts
|
|
35461
35471
|
function collect7(node, context) {
|
|
35462
35472
|
const found = [];
|
|
35463
35473
|
node.forEachChild((child) => {
|
|
@@ -35468,8 +35478,7 @@ function collect7(node, context) {
|
|
|
35468
35478
|
function visit(node, context) {
|
|
35469
35479
|
if (!Node4.isCallExpression(node)) return collect7(node, context);
|
|
35470
35480
|
const kind = classifyTestCall(node);
|
|
35471
|
-
if (kind === "it")
|
|
35472
|
-
return touchesChange(node, context.changed) ? [toCase(node, context)] : [];
|
|
35481
|
+
if (kind === "it") return visitCase(node, context);
|
|
35473
35482
|
if (kind === void 0) return collect7(node, context);
|
|
35474
35483
|
const children = node.getArguments().slice(1).flatMap((argument) => visit(argument, context));
|
|
35475
35484
|
if (children.length === 0) return [];
|
|
@@ -36083,9 +36092,15 @@ function formatHighLevelStructure(structure) {
|
|
|
36083
36092
|
|
|
36084
36093
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
36085
36094
|
import chalk238 from "chalk";
|
|
36095
|
+
function changeMarker(change) {
|
|
36096
|
+
if (change === "added") return "A";
|
|
36097
|
+
if (change === "modified") return "M";
|
|
36098
|
+
return "\xB7";
|
|
36099
|
+
}
|
|
36086
36100
|
function formatNode2(node, depth) {
|
|
36087
36101
|
const indent3 = " ".repeat(depth + 2);
|
|
36088
|
-
if (node.kind === "it")
|
|
36102
|
+
if (node.kind === "it")
|
|
36103
|
+
return [`${indent3}${chalk238.dim(changeMarker(node.change))} ${node.name}`];
|
|
36089
36104
|
return [
|
|
36090
36105
|
`${indent3}${chalk238.bold(node.name)}`,
|
|
36091
36106
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|