@quikit/quikpilot-runner 9.3.0-rc.55 → 9.3.0-rc.57

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
@@ -28812,6 +28812,15 @@ var TEST_NAME_RULES = [
28812
28812
  /_(?:spec|test)\.rb$/,
28813
28813
  // PHP (PHPUnit): `FooTest.php`.
28814
28814
  /Test\.php$/,
28815
+ // QUIKTR-1701: JVM tooling's other defaults (Surefire `Test*.java` and `*TestCase.java`, Failsafe `*IT.java`), Kotest and ScalaTest `FooSpec`, Spock.
28816
+ // `Testing.java` (a lower-case letter after `Test`) and `Exit.java` (no capital before `IT`) are not tests.
28817
+ /(^|\/)Test[A-Z][^/]*\.(?:java|kt|kts|scala)$/,
28818
+ /TestCase\.(?:java|kt|kts|scala)$/,
28819
+ /[a-z0-9]IT\.(?:java|kt|kts|scala)$/,
28820
+ /[a-z0-9]Spec\.(?:kt|kts|scala|groovy)$/,
28821
+ // Django's `tests.py`, and every C# file of a test project (`Acme.Tests/`, `Acme.Test/`).
28822
+ /(^|\/)tests\.py$/,
28823
+ /(^|\/)[^/]+\.Tests?\/.+\.cs$/,
28815
28824
  // Rust and Dart: `foo_test.rs`, `foo_test.dart`.
28816
28825
  /_test\.(?:rs|dart)$/
28817
28826
  ];
@@ -30833,21 +30842,21 @@ pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper
30833
30842
  }
30834
30843
  return this.finishNode(method, "MethodDefinition");
30835
30844
  };
30836
- pp$8.parseClassField = function(field) {
30837
- if (checkKeyName(field, "constructor")) {
30838
- this.raise(field.key.start, "Classes can't have a field named 'constructor'");
30839
- } else if (field.static && checkKeyName(field, "prototype")) {
30840
- this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
30845
+ pp$8.parseClassField = function(field2) {
30846
+ if (checkKeyName(field2, "constructor")) {
30847
+ this.raise(field2.key.start, "Classes can't have a field named 'constructor'");
30848
+ } else if (field2.static && checkKeyName(field2, "prototype")) {
30849
+ this.raise(field2.key.start, "Classes can't have a static field named 'prototype'");
30841
30850
  }
30842
30851
  if (this.eat(types$1.eq)) {
30843
30852
  this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);
30844
- field.value = this.parseMaybeAssign();
30853
+ field2.value = this.parseMaybeAssign();
30845
30854
  this.exitScope();
30846
30855
  } else {
30847
- field.value = null;
30856
+ field2.value = null;
30848
30857
  }
30849
30858
  this.semicolon();
30850
- return this.finishNode(field, "PropertyDefinition");
30859
+ return this.finishNode(field2, "PropertyDefinition");
30851
30860
  };
30852
30861
  pp$8.parseClassStaticBlock = function(node) {
30853
30862
  node.body = [];
@@ -35152,6 +35161,29 @@ function contains(node, test) {
35152
35161
  if (test(node)) return true;
35153
35162
  return node.children.some((c) => contains(c, test));
35154
35163
  }
35164
+ function isOtherCheck(lang, n) {
35165
+ if (lang === "go") {
35166
+ if (n.type !== "call_expression") return false;
35167
+ const fn = n.childForFieldName("function");
35168
+ return fn?.type === "selector_expression" && /^(Error|Errorf|Fatal|Fatalf|Fail|FailNow)$/.test(fn.childForFieldName("field")?.text ?? "");
35169
+ }
35170
+ if (lang === "python") return n.type === "with_item" && /\b(raises|warns|assertRaises|assertWarns)\b/.test(n.text.slice(0, 200));
35171
+ if (lang === "java") return n.type === "method_invocation" && n.childForFieldName("object") === null && /^(fail|assert\w*)$/.test(n.childForFieldName("name")?.text ?? "") && n.parent?.type === "expression_statement";
35172
+ return false;
35173
+ }
35174
+ function countChecks(lang, spec, node) {
35175
+ let count3 = 0;
35176
+ const walk2 = (n) => {
35177
+ if (spec.assertion(n)) {
35178
+ count3 += 1;
35179
+ return;
35180
+ }
35181
+ if (isOtherCheck(lang, n)) count3 += 1;
35182
+ for (const c of n.children) walk2(c);
35183
+ };
35184
+ walk2(node);
35185
+ return count3;
35186
+ }
35155
35187
  var SPECS = {
35156
35188
  python: {
35157
35189
  literal: (n) => n.type === "string" ? !n.children.some((c) => c.type === "interpolation") : ["integer", "float", "true", "false", "none"].includes(n.type),
@@ -35249,7 +35281,7 @@ function shapeOf(spec, root, titleStart) {
35249
35281
  walk2(root);
35250
35282
  return out2.join(SEP);
35251
35283
  }
35252
- function locatePython(root, add) {
35284
+ function locatePython(root, add2) {
35253
35285
  const visit = (body2, describes) => {
35254
35286
  for (const child of body2.namedChildren) {
35255
35287
  const decorated = child.type === "decorated_definition";
@@ -35262,30 +35294,30 @@ function locatePython(root, add) {
35262
35294
  const name2 = def.childForFieldName("name");
35263
35295
  if (!name2 || !/^test/.test(name2.text)) continue;
35264
35296
  const decorators = decorated ? child.namedChildren.filter((c) => c.type === "decorator").map((c) => c.text).join("\n") : "";
35265
- add({ span: child, name: name2, title: name2.text, describes, skipped: /\bskip/i.test(decorators), table: /parametri[sz]e|\bddt\b/i.test(decorators) });
35297
+ add2({ span: child, name: name2, title: name2.text, describes, skipped: /\bskip/i.test(decorators), table: /parametri[sz]e|\bddt\b/i.test(decorators) });
35266
35298
  }
35267
35299
  }
35268
35300
  };
35269
35301
  visit(root, []);
35270
35302
  }
35271
- function locateGo(root, add) {
35303
+ function locateGo(root, add2) {
35272
35304
  for (const fn of root.namedChildren) {
35273
35305
  if (fn.type !== "function_declaration") continue;
35274
35306
  const name2 = fn.childForFieldName("name");
35275
35307
  if (!name2 || !/^Test(?![a-z])/.test(name2.text) || name2.text === "TestMain") continue;
35276
35308
  if (!(fn.childForFieldName("parameters")?.text ?? "").includes("testing.")) continue;
35277
- const callsOn = (field) => (n) => {
35309
+ const callsOn = (field2) => (n) => {
35278
35310
  if (n.type !== "call_expression") return false;
35279
35311
  const callee = n.childForFieldName("function");
35280
- return callee?.type === "selector_expression" && field.test(callee.childForFieldName("field")?.text ?? "");
35312
+ return callee?.type === "selector_expression" && field2.test(callee.childForFieldName("field")?.text ?? "");
35281
35313
  };
35282
- add({ span: fn, name: name2, title: name2.text, describes: [], skipped: contains(fn, callsOn(/^Skip/)), table: contains(fn, callsOn(/^Run$/)) });
35314
+ add2({ span: fn, name: name2, title: name2.text, describes: [], skipped: contains(fn, callsOn(/^Skip/)), table: contains(fn, callsOn(/^Run$/)) });
35283
35315
  }
35284
35316
  }
35285
35317
  var JAVA_TESTS = /* @__PURE__ */ new Set(["Test", "ParameterizedTest", "RepeatedTest", "TestFactory", "TestTemplate"]);
35286
35318
  var JAVA_TABLES = /* @__PURE__ */ new Set(["ParameterizedTest", "RepeatedTest", "TestFactory", "TestTemplate"]);
35287
35319
  var JAVA_TYPES = /* @__PURE__ */ new Set(["class_declaration", "interface_declaration", "enum_declaration", "record_declaration"]);
35288
- function locateJava(root, add) {
35320
+ function locateJava(root, add2) {
35289
35321
  const visit = (node) => {
35290
35322
  for (const child of node.namedChildren) {
35291
35323
  if (JAVA_TYPES.has(child.type)) {
@@ -35301,7 +35333,7 @@ function locateJava(root, add) {
35301
35333
  if (!kind || !name2) continue;
35302
35334
  const shown = names.get("DisplayName")?.childForFieldName("arguments")?.namedChildren.find((c) => c.type === "string_literal")?.text;
35303
35335
  const display = shown && shown.length >= 2 ? shown.slice(1, -1) : null;
35304
- add({ span: child, name: name2, title: display && display.length > 0 ? display : name2.text, describes: [], skipped: names.has("Disabled") || names.has("Ignore"), table: [...names.keys()].some((n) => JAVA_TABLES.has(n)) });
35336
+ add2({ span: child, name: name2, title: display && display.length > 0 ? display : name2.text, describes: [], skipped: names.has("Disabled") || names.has("Ignore"), table: [...names.keys()].some((n) => JAVA_TABLES.has(n)) });
35305
35337
  }
35306
35338
  };
35307
35339
  visit(root);
@@ -35314,7 +35346,7 @@ function locateOtherLanguage(path, text3) {
35314
35346
  return parseWith(lang, text3, (root) => {
35315
35347
  const tests = [];
35316
35348
  const generated = [];
35317
- const add = (f) => {
35349
+ const add2 = (f) => {
35318
35350
  const test = {
35319
35351
  title: f.title,
35320
35352
  describes: f.describes,
@@ -35325,13 +35357,14 @@ function locateOtherLanguage(path, text3) {
35325
35357
  titleStart: f.name.startIndex,
35326
35358
  titleEnd: f.name.endIndex,
35327
35359
  skipped: f.skipped,
35328
- shape: shapeOf(spec, f.span, f.name.startIndex)
35360
+ shape: shapeOf(spec, f.span, f.name.startIndex),
35361
+ checks: countChecks(lang, spec, f.span)
35329
35362
  };
35330
35363
  (f.table ? generated : tests).push(test);
35331
35364
  };
35332
- if (lang === "python") locatePython(root, add);
35333
- else if (lang === "go") locateGo(root, add);
35334
- else locateJava(root, add);
35365
+ if (lang === "python") locatePython(root, add2);
35366
+ else if (lang === "go") locateGo(root, add2);
35367
+ else locateJava(root, add2);
35335
35368
  return { code: text3, tests, generated };
35336
35369
  });
35337
35370
  }
@@ -35632,6 +35665,173 @@ function isGeneratedText(lf) {
35632
35665
  }
35633
35666
  var GENERATED_FILE_MESSAGE = "This file is generated (its first lines say so), so a change here would be overwritten. Change the file it is generated from instead.";
35634
35667
 
35668
+ // src/definitions.ts
35669
+ var MAX_NAME_CHARS = 80;
35670
+ var MAX_DEFINITIONS = 2e3;
35671
+ var clip = (s) => s.length > MAX_NAME_CHARS ? s.slice(0, MAX_NAME_CHARS) : s;
35672
+ var field = (n, f) => n.childForFieldName(f)?.text ?? "";
35673
+ function add(ctx, span, kind, name2, depth) {
35674
+ if (name2 === "" || ctx.out.length >= MAX_DEFINITIONS) {
35675
+ if (ctx.out.length >= MAX_DEFINITIONS) ctx.full = true;
35676
+ return;
35677
+ }
35678
+ ctx.out.push({ kind, name: clip(name2), startLine: span.startPosition.row + 1, endLine: span.endPosition.row + 1, depth });
35679
+ }
35680
+ var childOfType = (n, type) => n.namedChildren.find((c) => c.type === type) ?? null;
35681
+ function python(ctx) {
35682
+ const visit = (nodes, depth, inside3) => {
35683
+ for (const n of nodes) {
35684
+ const decorated = n.type === "decorated_definition";
35685
+ const def = decorated ? n.childForFieldName("definition") : n;
35686
+ if (!def) continue;
35687
+ if (def.type === "function_definition") add(ctx, n, inside3 ? "method" : "function", field(def, "name"), depth);
35688
+ else if (def.type === "class_definition") {
35689
+ add(ctx, n, "class", field(def, "name"), depth);
35690
+ const body2 = def.childForFieldName("body");
35691
+ if (body2) visit(body2.namedChildren, depth + 1, true);
35692
+ }
35693
+ }
35694
+ };
35695
+ return visit;
35696
+ }
35697
+ function go(ctx) {
35698
+ return (nodes, depth) => {
35699
+ for (const n of nodes) {
35700
+ if (n.type === "function_declaration") add(ctx, n, "function", field(n, "name"), depth);
35701
+ else if (n.type === "method_declaration") add(ctx, n, "method", field(n, "name"), depth);
35702
+ else if (n.type === "type_declaration") {
35703
+ for (const spec of n.namedChildren) {
35704
+ if (spec.type !== "type_spec" && spec.type !== "type_alias") continue;
35705
+ const t = spec.childForFieldName("type")?.type;
35706
+ add(ctx, spec, t === "struct_type" ? "struct" : t === "interface_type" ? "interface" : "type", field(spec, "name"), depth);
35707
+ }
35708
+ }
35709
+ }
35710
+ };
35711
+ }
35712
+ function java(ctx) {
35713
+ const visit = (nodes, depth) => {
35714
+ for (const n of nodes) {
35715
+ const body2 = n.childForFieldName("body");
35716
+ if (n.type === "class_declaration" || n.type === "record_declaration") add(ctx, n, "class", field(n, "name"), depth);
35717
+ else if (n.type === "interface_declaration") add(ctx, n, "interface", field(n, "name"), depth);
35718
+ else if (n.type === "enum_declaration") add(ctx, n, "enum", field(n, "name"), depth);
35719
+ else if (n.type === "method_declaration" || n.type === "constructor_declaration") {
35720
+ add(ctx, n, "method", field(n, "name"), depth);
35721
+ continue;
35722
+ } else continue;
35723
+ if (body2) visit(body2.namedChildren, depth + 1, true);
35724
+ }
35725
+ };
35726
+ return visit;
35727
+ }
35728
+ function kotlin(ctx) {
35729
+ const visit = (nodes, depth, inside3) => {
35730
+ for (const n of nodes) {
35731
+ if (n.type === "class_declaration" || n.type === "object_declaration") {
35732
+ const isInterface = n.children.some((c) => !c.isNamed && c.type === "interface");
35733
+ const name2 = n.childForFieldName("name")?.text ?? childOfType(n, "identifier")?.text ?? "";
35734
+ add(ctx, n, isInterface ? "interface" : "class", name2, depth);
35735
+ const body2 = childOfType(n, "class_body") ?? childOfType(n, "enum_class_body");
35736
+ if (body2) visit(body2.namedChildren, depth + 1, true);
35737
+ } else if (n.type === "function_declaration") {
35738
+ add(ctx, n, inside3 ? "method" : "function", n.childForFieldName("name")?.text ?? childOfType(n, "identifier")?.text ?? "", depth);
35739
+ }
35740
+ }
35741
+ };
35742
+ return visit;
35743
+ }
35744
+ function csharp(ctx) {
35745
+ const visit = (nodes, depth) => {
35746
+ for (const n of nodes) {
35747
+ let kind = null;
35748
+ if (n.type === "namespace_declaration" || n.type === "file_scoped_namespace_declaration") kind = "module";
35749
+ else if (n.type === "class_declaration" || n.type === "record_declaration") kind = "class";
35750
+ else if (n.type === "struct_declaration") kind = "struct";
35751
+ else if (n.type === "interface_declaration") kind = "interface";
35752
+ else if (n.type === "enum_declaration") kind = "enum";
35753
+ else if (n.type === "method_declaration" || n.type === "constructor_declaration") {
35754
+ add(ctx, n, "method", field(n, "name"), depth);
35755
+ continue;
35756
+ }
35757
+ if (kind === null) continue;
35758
+ add(ctx, n, kind, field(n, "name"), depth);
35759
+ const body2 = n.childForFieldName("body");
35760
+ if (body2) visit(body2.namedChildren, depth + 1, true);
35761
+ }
35762
+ };
35763
+ return visit;
35764
+ }
35765
+ function rust(ctx) {
35766
+ const visit = (nodes, depth, inside3) => {
35767
+ for (const n of nodes) {
35768
+ const body2 = n.childForFieldName("body");
35769
+ if (n.type === "function_item") add(ctx, n, inside3 ? "method" : "function", field(n, "name"), depth);
35770
+ else if (n.type === "struct_item" || n.type === "union_item") add(ctx, n, "struct", field(n, "name"), depth);
35771
+ else if (n.type === "enum_item") add(ctx, n, "enum", field(n, "name"), depth);
35772
+ else if (n.type === "type_item") add(ctx, n, "type", field(n, "name"), depth);
35773
+ else if (n.type === "trait_item") {
35774
+ add(ctx, n, "interface", field(n, "name"), depth);
35775
+ if (body2) visit(body2.namedChildren, depth + 1, true);
35776
+ } else if (n.type === "impl_item") {
35777
+ const trait = field(n, "trait");
35778
+ add(ctx, n, "class", trait ? `${trait} for ${field(n, "type")}` : field(n, "type"), depth);
35779
+ if (body2) visit(body2.namedChildren, depth + 1, true);
35780
+ } else if (n.type === "mod_item") {
35781
+ add(ctx, n, "module", field(n, "name"), depth);
35782
+ if (body2) visit(body2.namedChildren, depth + 1, false);
35783
+ }
35784
+ }
35785
+ };
35786
+ return visit;
35787
+ }
35788
+ function ruby(ctx) {
35789
+ const visit = (nodes, depth, inside3) => {
35790
+ for (const n of nodes) {
35791
+ if (n.type === "method" || n.type === "singleton_method") add(ctx, n, inside3 ? "method" : "function", field(n, "name"), depth);
35792
+ else if (n.type === "class" || n.type === "module") {
35793
+ add(ctx, n, n.type === "class" ? "class" : "module", field(n, "name"), depth);
35794
+ const body2 = n.childForFieldName("body");
35795
+ if (body2) visit(body2.namedChildren, depth + 1, true);
35796
+ }
35797
+ }
35798
+ };
35799
+ return visit;
35800
+ }
35801
+ function php(ctx) {
35802
+ const visit = (nodes, depth, inside3) => {
35803
+ for (const n of nodes) {
35804
+ let kind = null;
35805
+ if (n.type === "namespace_definition") kind = "module";
35806
+ else if (n.type === "class_declaration" || n.type === "trait_declaration") kind = "class";
35807
+ else if (n.type === "interface_declaration") kind = "interface";
35808
+ else if (n.type === "enum_declaration") kind = "enum";
35809
+ else if (n.type === "function_definition") {
35810
+ add(ctx, n, "function", field(n, "name"), depth);
35811
+ continue;
35812
+ } else if (n.type === "method_declaration") {
35813
+ add(ctx, n, inside3 ? "method" : "function", field(n, "name"), depth);
35814
+ continue;
35815
+ }
35816
+ if (kind === null) continue;
35817
+ add(ctx, n, kind, field(n, "name"), depth);
35818
+ const body2 = n.childForFieldName("body");
35819
+ if (body2) visit(body2.namedChildren, depth + 1, kind !== "module");
35820
+ }
35821
+ };
35822
+ return visit;
35823
+ }
35824
+ var WALKERS = { python, go, java, kotlin, csharp, rust, ruby, php };
35825
+ function definitionsOfFile(path, text3) {
35826
+ const lang = langOfPath(path);
35827
+ if (lang === null) return null;
35828
+ return parseWith(lang, text3, (root) => {
35829
+ const ctx = { out: [], full: false };
35830
+ WALKERS[lang](ctx)(root.namedChildren, 0, false);
35831
+ return ctx.out;
35832
+ });
35833
+ }
35834
+
35635
35835
  // src/importContext.ts
35636
35836
  var import_node_path2 = require("node:path");
35637
35837
  var REGEX_PRECEDING_KEYWORDS = /* @__PURE__ */ new Set([
@@ -35796,7 +35996,7 @@ function extractImportSpecifiers(source) {
35796
35996
  const t = tokenize(source);
35797
35997
  const found = [];
35798
35998
  const seen = /* @__PURE__ */ new Set();
35799
- const add = (s) => {
35999
+ const add2 = (s) => {
35800
36000
  if (!seen.has(s)) {
35801
36001
  seen.add(s);
35802
36002
  found.push(s);
@@ -35808,18 +36008,18 @@ function extractImportSpecifiers(source) {
35808
36008
  if (tok.k !== "id") continue;
35809
36009
  if (isP(t[i3 - 1], ".")) continue;
35810
36010
  if (tok.v === "require") {
35811
- if (isP(t[i3 + 1], "(") && t[i3 + 2]?.k === "str" && isP(t[i3 + 3], ")")) add(t[i3 + 2].v);
36011
+ if (isP(t[i3 + 1], "(") && t[i3 + 2]?.k === "str" && isP(t[i3 + 3], ")")) add2(t[i3 + 2].v);
35812
36012
  continue;
35813
36013
  }
35814
36014
  if (tok.v !== "import" && tok.v !== "export") continue;
35815
36015
  const next = t[i3 + 1];
35816
36016
  if (tok.v === "import") {
35817
36017
  if (next?.k === "str") {
35818
- add(next.v);
36018
+ add2(next.v);
35819
36019
  continue;
35820
36020
  }
35821
36021
  if (isP(next, "(")) {
35822
- if (t[i3 + 2]?.k === "str" && (isP(t[i3 + 3], ")") || isP(t[i3 + 3], ","))) add(t[i3 + 2].v);
36022
+ if (t[i3 + 2]?.k === "str" && (isP(t[i3 + 3], ")") || isP(t[i3 + 3], ","))) add2(t[i3 + 2].v);
35823
36023
  continue;
35824
36024
  }
35825
36025
  }
@@ -35828,7 +36028,7 @@ function extractImportSpecifiers(source) {
35828
36028
  if (c.k === "id") {
35829
36029
  if (c.v === "import" || c.v === "export") break;
35830
36030
  if (c.v === "from" && t[j + 1]?.k === "str") {
35831
- add(t[j + 1].v);
36031
+ add2(t[j + 1].v);
35832
36032
  break;
35833
36033
  }
35834
36034
  continue;
@@ -35960,7 +36160,7 @@ function collectImportContext(p) {
35960
36160
 
35961
36161
  // src/outline.ts
35962
36162
  var MAX_OUTLINE_ENTRIES = 200;
35963
- var MAX_NAME_CHARS = 80;
36163
+ var MAX_NAME_CHARS2 = 80;
35964
36164
  function lineStarts(code) {
35965
36165
  const starts = [0];
35966
36166
  for (let i3 = 0; i3 < code.length; i3++) if (code.charCodeAt(i3) === 10) starts.push(i3 + 1);
@@ -35984,8 +36184,8 @@ function keyName(key) {
35984
36184
  if (key.type === "Literal" && (typeof key.value === "string" || typeof key.value === "number")) return String(key.value);
35985
36185
  return null;
35986
36186
  }
35987
- function clip(name2) {
35988
- return name2.length > MAX_NAME_CHARS ? `${name2.slice(0, MAX_NAME_CHARS)}\u2026` : name2;
36187
+ function clip2(name2) {
36188
+ return name2.length > MAX_NAME_CHARS2 ? `${name2.slice(0, MAX_NAME_CHARS2)}\u2026` : name2;
35989
36189
  }
35990
36190
  function jsEntries(path, text3) {
35991
36191
  const parsed = parseProgram(path, text3);
@@ -35993,40 +36193,40 @@ function jsEntries(path, text3) {
35993
36193
  const { ast, code } = parsed;
35994
36194
  const starts = lineStarts(code);
35995
36195
  const out2 = [];
35996
- const add = (kind, name2, node, depth) => {
36196
+ const add2 = (kind, name2, node, depth) => {
35997
36197
  if (!name2) return;
35998
- out2.push({ kind, name: clip(name2), startLine: lineOf(starts, node.start), endLine: lineOf(starts, Math.max(node.start, node.end - 1)), depth });
36198
+ out2.push({ kind, name: clip2(name2), startLine: lineOf(starts, node.start), endLine: lineOf(starts, Math.max(node.start, node.end - 1)), depth });
35999
36199
  };
36000
36200
  const members = (cls, depth) => {
36001
36201
  for (const m of cls.body?.body ?? []) {
36002
- if (m.type === "MethodDefinition") add("method", keyName(m.key), m, depth);
36003
- else if (m.type === "PropertyDefinition" && isFn(m.value)) add("method", keyName(m.key), m, depth);
36202
+ if (m.type === "MethodDefinition") add2("method", keyName(m.key), m, depth);
36203
+ else if (m.type === "PropertyDefinition" && isFn(m.value)) add2("method", keyName(m.key), m, depth);
36004
36204
  }
36005
36205
  };
36006
36206
  const objectMethods = (obj, depth) => {
36007
36207
  for (const p of obj.properties ?? []) {
36008
- if (p.type === "Property" && (p.method || isFn(p.value))) add("method", keyName(p.key), p, depth);
36208
+ if (p.type === "Property" && (p.method || isFn(p.value))) add2("method", keyName(p.key), p, depth);
36009
36209
  }
36010
36210
  };
36011
36211
  const declaration = (node, exported) => {
36012
36212
  switch (node.type) {
36013
36213
  case "FunctionDeclaration":
36014
- add("function", node.id?.name ?? null, node, 0);
36214
+ add2("function", node.id?.name ?? null, node, 0);
36015
36215
  return;
36016
36216
  case "ClassDeclaration":
36017
- add("class", node.id?.name ?? null, node, 0);
36217
+ add2("class", node.id?.name ?? null, node, 0);
36018
36218
  members(node, 1);
36019
36219
  return;
36020
36220
  case "VariableDeclaration":
36021
36221
  for (const d of node.declarations) {
36022
36222
  if (d.id?.type !== "Identifier") continue;
36023
36223
  const init2 = d.init;
36024
- if (isFn(init2)) add("function", d.id.name, node, 0);
36224
+ if (isFn(init2)) add2("function", d.id.name, node, 0);
36025
36225
  else if (init2?.type === "ClassExpression") {
36026
- add("class", d.id.name, node, 0);
36226
+ add2("class", d.id.name, node, 0);
36027
36227
  members(init2, 1);
36028
36228
  } else if (exported) {
36029
- add("const", d.id.name, node, 0);
36229
+ add2("const", d.id.name, node, 0);
36030
36230
  if (init2?.type === "ObjectExpression") objectMethods(init2, 1);
36031
36231
  }
36032
36232
  }
@@ -36038,9 +36238,9 @@ function jsEntries(path, text3) {
36038
36238
  if (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") {
36039
36239
  const inner = node.declaration;
36040
36240
  if (!inner) continue;
36041
- if (inner.type === "FunctionExpression" || inner.type === "ArrowFunctionExpression") add("function", "default", node, 0);
36241
+ if (inner.type === "FunctionExpression" || inner.type === "ArrowFunctionExpression") add2("function", "default", node, 0);
36042
36242
  else if (inner.type === "ClassExpression") {
36043
- add("class", inner.id?.name ?? "default", node, 0);
36243
+ add2("class", inner.id?.name ?? "default", node, 0);
36044
36244
  members(inner, 1);
36045
36245
  } else declaration(inner, true);
36046
36246
  continue;
@@ -36052,12 +36252,12 @@ function jsEntries(path, text3) {
36052
36252
  const m = /^(?:module\.)?exports(?:\.([A-Za-z_$][\w$]*))?$/.exec(text4);
36053
36253
  if (m) {
36054
36254
  const name2 = m[1] ?? "module.exports";
36055
- if (isFn(right)) add("function", name2, node, 0);
36255
+ if (isFn(right)) add2("function", name2, node, 0);
36056
36256
  else if (right.type === "ClassExpression") {
36057
- add("class", name2, node, 0);
36257
+ add2("class", name2, node, 0);
36058
36258
  members(right, 1);
36059
36259
  } else if (right.type === "ObjectExpression") {
36060
- add("const", name2, node, 0);
36260
+ add2("const", name2, node, 0);
36061
36261
  objectMethods(right, 1);
36062
36262
  }
36063
36263
  }
@@ -36103,7 +36303,7 @@ function keywordEntries(text3, only) {
36103
36303
  if (indentOf(line) > MAX_INDENT) continue;
36104
36304
  const kind = kindOfKeyword(m[2]);
36105
36305
  if (only && !only.has(m[2])) continue;
36106
- found.push({ indent: indentOf(m[1]), kind, name: clip(m[3]), line: i3 + 1 });
36306
+ found.push({ indent: indentOf(m[1]), kind, name: clip2(m[3]), line: i3 + 1 });
36107
36307
  }
36108
36308
  const out2 = [];
36109
36309
  const stack = [];
@@ -36150,6 +36350,13 @@ function outlineOf(path, text3) {
36150
36350
  } catch {
36151
36351
  entries = null;
36152
36352
  }
36353
+ if (entries === null) {
36354
+ const tree = definitionsOfFile(path, text3);
36355
+ if (tree) {
36356
+ engine = "treesitter";
36357
+ entries = tree.map((d) => ({ kind: d.kind, name: d.name, startLine: d.startLine, endLine: d.endLine, depth: d.depth }));
36358
+ }
36359
+ }
36153
36360
  if (entries === null) {
36154
36361
  engine = "keyword";
36155
36362
  entries = keywordEntries(text3);
@@ -36527,11 +36734,18 @@ function prepareGrepV2(args2, env2) {
36527
36734
  }
36528
36735
  };
36529
36736
  }
36530
- var NOT_A_NAME = /* @__PURE__ */ new Set(["if", "for", "while", "switch", "catch", "return", "else", "do", "function", "new", "typeof", "await", "super", "this"]);
36531
- var IDENT = /^[A-Za-z_$][\w$]*$/;
36737
+ var NOT_A_NAME = /* @__PURE__ */ new Set(["if", "for", "while", "switch", "catch", "return", "else", "do"]);
36738
+ var IDENT = /^[\p{L}_$][\p{L}\p{N}_$]*[?!]?$/u;
36739
+ var escapeRegExp3 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
36740
+ var MAX_TREE_FILES = 80;
36532
36741
  var MAX_NAME_LENGTH = 80;
36533
- function definitionsIn(text3, name2) {
36534
- const id = name2.replace(/\$/g, "\\$");
36742
+ function definitionsIn(text3, name2, path, parsed) {
36743
+ if (path !== void 0 && text3.includes(name2) && (parsed === void 0 || parsed.count < MAX_TREE_FILES)) {
36744
+ const tree = definitionsOfFile(path, text3);
36745
+ if (parsed && tree !== null) parsed.count += 1;
36746
+ if (tree !== null) return tree.filter((d) => d.name === name2).map((d) => ({ line: d.startLine, kind: d.kind }));
36747
+ }
36748
+ const id = escapeRegExp3(name2);
36535
36749
  const rules = [
36536
36750
  [new RegExp(`^\\s*(?:export\\s+)?(?:default\\s+)?(?:declare\\s+)?(?:async\\s+)?function\\*?\\s+${id}(?![\\w$])`), "function"],
36537
36751
  [new RegExp(`^\\s*(?:export\\s+)?(?:default\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+${id}(?![\\w$])`), "class"],
@@ -36665,7 +36879,7 @@ function visibleSet(env2) {
36665
36879
  function prepareFindDefinition(args2, env2) {
36666
36880
  const name2 = args2.name;
36667
36881
  if (typeof name2 !== "string" || name2.length === 0 || name2.length > MAX_NAME_LENGTH || !IDENT.test(name2)) {
36668
- return bad("name must be one identifier (letters, digits, _ or $).");
36882
+ return bad("name must be one name (letters, digits, _ or $, and a Ruby-style ? or ! at the end).");
36669
36883
  }
36670
36884
  if (NOT_A_NAME.has(name2)) return bad("name must be the name of something defined, not a language keyword.");
36671
36885
  let fromPath;
@@ -36696,6 +36910,7 @@ function prepareFindDefinition(args2, env2) {
36696
36910
  let filesScanned = 0;
36697
36911
  let bytesScanned = 0;
36698
36912
  let scanCapped = false;
36913
+ const parsedFiles = { count: 0 };
36699
36914
  for (const path of env2.visible) {
36700
36915
  if (filesScanned >= env2.limits.grepMaxFiles || bytesScanned >= env2.limits.grepMaxBytes) {
36701
36916
  scanCapped = true;
@@ -36706,7 +36921,7 @@ function prepareFindDefinition(args2, env2) {
36706
36921
  const text3 = scanText(path, env2);
36707
36922
  if (text3 === null) continue;
36708
36923
  bytesScanned += text3.length;
36709
- for (const d of definitionsIn(text3, name2)) {
36924
+ for (const d of definitionsIn(text3, name2, path, parsedFiles)) {
36710
36925
  if (!seen.has(`${path}:${d.line}`)) candidates.push({ path, ...d });
36711
36926
  }
36712
36927
  }
@@ -38769,10 +38984,10 @@ function unexplainedRegressions(answer, reported) {
38769
38984
  (g) => !reported.some((r) => (g.file === "" || idPlaceMatches(g.file, r.path)) && nameEndsWithTitle(g.title, r.title, r.path))
38770
38985
  );
38771
38986
  }
38772
- var clip2 = (s, max) => s.length <= max ? s : `${s.slice(0, max - 1)}\u2026`;
38987
+ var clip3 = (s, max) => s.length <= max ? s : `${s.slice(0, max - 1)}\u2026`;
38773
38988
  function sentenceOf(g) {
38774
38989
  const rows = g.rows > 1 ? ` (${g.rows} rows)` : "";
38775
- return clip2(`${g.file ? `${clip2(g.file, MAX_FILE_CHARS)}: ` : ""}"${clip2(g.title, MAX_TITLE_CHARS)}"${rows} passed before this run and fails now.`, MAX_SENTENCE_CHARS);
38990
+ return clip3(`${g.file ? `${clip3(g.file, MAX_FILE_CHARS)}: ` : ""}"${clip3(g.title, MAX_TITLE_CHARS)}"${rows} passed before this run and fails now.`, MAX_SENTENCE_CHARS);
38776
38991
  }
38777
38992
  function giveUpSentences(groups) {
38778
38993
  if (groups.length <= MAX_SENTENCES) return groups.map(sentenceOf);
@@ -38781,7 +38996,7 @@ function giveUpSentences(groups) {
38781
38996
  }
38782
38997
  function oldBehaviourSentence(groups, max = 600) {
38783
38998
  const parts2 = groups.map((g) => `${g.file ? `${g.file}: ` : ""}"${g.title}"${g.rows > 1 ? ` (${g.rows} rows)` : ""}`);
38784
- return clip2(`existing tests that may expect the old behaviour: ${parts2.join("; ")}`, max);
38999
+ return clip3(`existing tests that may expect the old behaviour: ${parts2.join("; ")}`, max);
38785
39000
  }
38786
39001
  function withoutLoop7Words(previous) {
38787
39002
  if (!previous.steps?.some((s) => s.refused?.includes(GIVE_UP_RULE))) return previous;
@@ -44204,7 +44419,7 @@ function lineAt3(text3, offset2) {
44204
44419
  }
44205
44420
  function findTests(path, text3) {
44206
44421
  const parsed = parseProgram(path, text3);
44207
- if (!parsed) return null;
44422
+ if (!parsed) return findOtherLanguageTests(path, text3);
44208
44423
  const out2 = [];
44209
44424
  walk(parsed.ast, (n) => {
44210
44425
  if (n.type !== "CallExpression") return;
@@ -44234,6 +44449,17 @@ function findTests(path, text3) {
44234
44449
  });
44235
44450
  return out2;
44236
44451
  }
44452
+ function findOtherLanguageTests(path, text3) {
44453
+ const located = locateTests(path, text3);
44454
+ if (!located) return null;
44455
+ return allTests(located).sort((a, b) => a.start - b.start).map((t) => ({
44456
+ id: `title:${t.title}`,
44457
+ line: t.startLine,
44458
+ text: located.code.slice(t.start, t.end).replace(/\s+/g, " ").replace(/ ?([^\w$ ]) ?/g, "$1"),
44459
+ checks: t.checks ?? 0,
44460
+ skipped: t.skipped
44461
+ }));
44462
+ }
44237
44463
  function groupById(tests) {
44238
44464
  const map = /* @__PURE__ */ new Map();
44239
44465
  for (const t of tests) map.set(t.id, [...map.get(t.id) ?? [], t]);
@@ -47626,12 +47852,12 @@ var GENERIC_NAMES = /* @__PURE__ */ new Set(["main", "init", "test", "tests", "s
47626
47852
  function lookSymbolsOf(findings) {
47627
47853
  const out2 = /* @__PURE__ */ new Map();
47628
47854
  if (!findings) return out2;
47629
- const add = (path, name2) => {
47855
+ const add2 = (path, name2) => {
47630
47856
  const list2 = out2.get(path) ?? out2.set(path, []).get(path);
47631
47857
  if (!list2.includes(name2)) list2.push(name2);
47632
47858
  };
47633
- for (const f of findings.files) for (const s of f.symbols) add(f.path, s);
47634
- for (const c of findings.callPath) add(c.path, c.symbol);
47859
+ for (const f of findings.files) for (const s of f.symbols) add2(f.path, s);
47860
+ for (const c of findings.callPath) add2(c.path, c.symbol);
47635
47861
  return out2;
47636
47862
  }
47637
47863
  var baseNoExt = (p) => import_node_path18.posix.basename(p).replace(/\.[^.]+$/, "");
@@ -47656,7 +47882,7 @@ var squash = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, "");
47656
47882
  function mentionsOf(names) {
47657
47883
  const out2 = [];
47658
47884
  const seen = /* @__PURE__ */ new Set();
47659
- const add = (m) => {
47885
+ const add2 = (m) => {
47660
47886
  const key = `${m.word ?? ""}|${m.squashed ?? ""}`;
47661
47887
  if (!seen.has(key)) {
47662
47888
  seen.add(key);
@@ -47668,11 +47894,11 @@ function mentionsOf(names) {
47668
47894
  const tokens = splitName(name2);
47669
47895
  if (tokens.length >= 2) {
47670
47896
  const two = squash(tokens.slice(0, 2).join(""));
47671
- if (two.length >= 9) add({ squashed: two });
47897
+ if (two.length >= 9) add2({ squashed: two });
47672
47898
  const all = squash(name2);
47673
- if (all.length >= 9) add({ squashed: all });
47899
+ if (all.length >= 9) add2({ squashed: all });
47674
47900
  } else {
47675
- add({ word: name2 });
47901
+ add2({ word: name2 });
47676
47902
  }
47677
47903
  }
47678
47904
  return out2;
@@ -48211,12 +48437,12 @@ function testsToCheck(i3) {
48211
48437
  if (code.length === 0 || limit === 0) return [];
48212
48438
  const taken = new Set(i3.targets.map((t) => t.path));
48213
48439
  const out2 = [];
48214
- const add = (path) => {
48440
+ const add2 = (path) => {
48215
48441
  if (out2.length < limit && !taken.has(path) && !out2.includes(path)) out2.push(path);
48216
48442
  };
48217
- for (const t of code) for (const path of pairedTestPaths(t.path, world.listing, world.isTest)) add(path);
48443
+ for (const t of code) for (const path of pairedTestPaths(t.path, world.listing, world.isTest)) add2(path);
48218
48444
  for (const t of code) {
48219
- for (const path of testsImporting({ target: t.path, listing: world.listing, corpus: world.corpus, mapSpecifier: world.mapSpecifier, limit, isTest: world.isTest })) add(path);
48445
+ for (const path of testsImporting({ target: t.path, listing: world.listing, corpus: world.corpus, mapSpecifier: world.mapSpecifier, limit, isTest: world.isTest })) add2(path);
48220
48446
  }
48221
48447
  if (out2.length < SECOND_HOP_BELOW) {
48222
48448
  for (const t of code) {
@@ -48232,7 +48458,7 @@ function testsToCheck(i3) {
48232
48458
  readRel: i3.readRel,
48233
48459
  deniedPaths: i3.deniedPaths
48234
48460
  }))
48235
- add(path);
48461
+ add2(path);
48236
48462
  }
48237
48463
  }
48238
48464
  const other = code.map((t) => t.path).filter((path) => languageOf(path) !== null);
@@ -48246,7 +48472,7 @@ function testsToCheck(i3) {
48246
48472
  limit,
48247
48473
  ...i3.lookSymbols ? { lookSymbols: i3.lookSymbols } : {}
48248
48474
  });
48249
- for (const hit of reached) add(hit.path);
48475
+ for (const hit of reached) add2(hit.path);
48250
48476
  }
48251
48477
  return out2;
48252
48478
  }
@@ -49556,14 +49782,14 @@ function approvedTestsFailing(input) {
49556
49782
  }
49557
49783
  return out2;
49558
49784
  }
49559
- var clip3 = (s, max) => s.length <= max ? s : `${s.slice(0, max - 1)}\u2026`;
49785
+ var clip4 = (s, max) => s.length <= max ? s : `${s.slice(0, max - 1)}\u2026`;
49560
49786
  function misfitSentence(misfits, max = 600) {
49561
49787
  const parts2 = misfits.map((m) => {
49562
49788
  const rows = m.totalRows > 1 ? ` does not fit ${m.failingRows} of its ${m.totalRows} rows` : " does not fit: the test still fails";
49563
49789
  const now = m.examples[0] ? ` (now: "${m.examples[0]}")` : "";
49564
- return `the test change approved for ${m.path}: "${clip3(m.testTitle, 120)}"${rows}${now}`;
49790
+ return `the test change approved for ${m.path}: "${clip4(m.testTitle, 120)}"${rows}${now}`;
49565
49791
  });
49566
- return clip3(parts2.join("; "), max);
49792
+ return clip4(parts2.join("; "), max);
49567
49793
  }
49568
49794
 
49569
49795
  // src/testVerification.ts
@@ -49636,7 +49862,7 @@ function describeAutomationCoverageViolations(check) {
49636
49862
  var estraverse5 = __toESM2(require_estraverse());
49637
49863
  var MAX_UNSUPPLIED_ENTRIES = 10;
49638
49864
  var MAX_UNSUPPLIED_NAMES = 5;
49639
- var MAX_NAME_CHARS2 = 80;
49865
+ var MAX_NAME_CHARS3 = 80;
49640
49866
  var MAX_FUNCTION_CHARS = 120;
49641
49867
  var FUNCTION_TYPES = /* @__PURE__ */ new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]);
49642
49868
  var IDENTIFIER_NAME = /^[A-Za-z_$][\w$]*$/;
@@ -49777,7 +50003,7 @@ function findUnsuppliedInputs(input) {
49777
50003
  if (isCallback(site)) continue;
49778
50004
  const names = [];
49779
50005
  for (const { name: name2 } of readsOf(site)) {
49780
- if (!IDENTIFIER_NAME.test(name2) || name2.length > MAX_NAME_CHARS2) continue;
50006
+ if (!IDENTIFIER_NAME.test(name2) || name2.length > MAX_NAME_CHARS3) continue;
49781
50007
  if (known.has(name2) || supplied.has(name2) || names.includes(name2)) continue;
49782
50008
  names.push(name2);
49783
50009
  }
@@ -50141,7 +50367,7 @@ var MAX_ENTRY_CHARS = 200;
50141
50367
  var inside = (path, root) => root === "" || path === root || path.startsWith(`${root}/`);
50142
50368
  var cap = (s) => s.length <= MAX_ENTRY_CHARS ? s : `${s.slice(0, MAX_ENTRY_CHARS - 1)}\u2026`;
50143
50369
  var parentOf2 = (d) => d.includes("/") ? d.slice(0, d.lastIndexOf("/")) : "";
50144
- function clip4(text3, max) {
50370
+ function clip5(text3, max) {
50145
50371
  if (text3.length <= max) return { text: text3, truncated: false };
50146
50372
  const cut = text3.slice(0, max);
50147
50373
  const nl = cut.lastIndexOf("\n");
@@ -50159,7 +50385,7 @@ function guidanceFiles(i3, perFile2, total) {
50159
50385
  if (!tracked.has(path) || matchesDeniedPath(path, denied)) continue;
50160
50386
  const raw = i3.readText(path);
50161
50387
  if (raw === null || raw.trim() === "") continue;
50162
- const clipped = clip4(i3.scrub(raw.replace(/\r\n/g, "\n")).trim(), Math.min(perFile2, left));
50388
+ const clipped = clip5(i3.scrub(raw.replace(/\r\n/g, "\n")).trim(), Math.min(perFile2, left));
50163
50389
  out2.push({ path, ...clipped });
50164
50390
  left -= clipped.text.length;
50165
50391
  }
@@ -50643,7 +50869,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
50643
50869
  var REPORT_COPY = "final-test-report.xml";
50644
50870
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
50645
50871
  var MAX_FILES = 200;
50646
- var RUNNER_VERSION = true ? "9.3.0-rc.55" : "dev";
50872
+ var RUNNER_VERSION = true ? "9.3.0-rc.57" : "dev";
50647
50873
  function safeDestination(base, repoPath) {
50648
50874
  if (!repoPath || (0, import_node_path25.isAbsolute)(repoPath)) return null;
50649
50875
  const destination = (0, import_node_path25.resolve)(base, repoPath);
@@ -51305,6 +51531,7 @@ async function run2(env2) {
51305
51531
  const writeRoot = normaliseWorkspaceRoot(packet.workspaceRoot);
51306
51532
  scopeRoot = writeRoot;
51307
51533
  const workspaceListing = listWorkspaceFiles(writeRoot === "" ? null : writeRoot);
51534
+ await preloadLanguages(workspaceListing);
51308
51535
  const readCheckoutText2 = (path) => {
51309
51536
  try {
51310
51537
  return (0, import_node_fs25.readFileSync)(path, "utf8");