pi-lens 4.4.11 → 4.4.12

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.
Files changed (106) hide show
  1. package/CHANGELOG-USER.md +6 -6
  2. package/CHANGELOG.md +30 -0
  3. package/README.md +1 -0
  4. package/dist/{chunk-KDGKKK7A.js → chunk-2HWVG3IM.js} +1 -1
  5. package/dist/{chunk-3QCI3V6C.js → chunk-3EIZMRXI.js} +5 -5
  6. package/dist/{chunk-NWK7KKNO.js → chunk-3MHY4BQY.js} +2 -2
  7. package/dist/{chunk-3NVGBFJS.js → chunk-3PMLYGJN.js} +2 -2
  8. package/dist/{chunk-OP5BMZKK.js → chunk-3QMLB4TI.js} +1 -1
  9. package/dist/{chunk-V7IPIAE5.js → chunk-3VWEZ6H2.js} +24 -26
  10. package/dist/{chunk-NLRKB32C.js → chunk-5EEWCJG7.js} +1 -1
  11. package/dist/{chunk-VDMF7Q2P.js → chunk-5FDUKJZO.js} +4 -4
  12. package/dist/{chunk-KBSC5Z3G.js → chunk-5KLRCUDT.js} +2 -2
  13. package/dist/{chunk-GL6J5R34.js → chunk-6EXGCXM5.js} +3 -3
  14. package/dist/{chunk-OC4ZGVMH.js → chunk-6GWCYEP7.js} +5 -7
  15. package/dist/{chunk-LXE7JAMV.js → chunk-6JLNZ6DP.js} +4 -4
  16. package/dist/{chunk-TTGDTNSN.js → chunk-75TVYCQW.js} +3 -3
  17. package/dist/{chunk-QAM2Q3VO.js → chunk-7BEADGAZ.js} +2 -2
  18. package/dist/{chunk-R5BNSOIV.js → chunk-7KWI5UHL.js} +7 -8
  19. package/dist/{chunk-5YTDZ5WP.js → chunk-7M64NTAK.js} +1 -1
  20. package/dist/{chunk-B4K6OSLL.js → chunk-7T64QA5D.js} +25 -27
  21. package/dist/{chunk-KDMJ2DJD.js → chunk-7ZVEFWOE.js} +5 -5
  22. package/dist/{chunk-D5L7Q57Z.js → chunk-AAIVSSUU.js} +1 -1
  23. package/dist/{chunk-LIDFFCZZ.js → chunk-AD7JDEI6.js} +9 -9
  24. package/dist/{chunk-WBXCIRVI.js → chunk-AVBEPUCD.js} +1 -1
  25. package/dist/{chunk-VTXJAO5R.js → chunk-AZXTLZHE.js} +9 -9
  26. package/dist/{chunk-UELHWF5I.js → chunk-BEIPWPVR.js} +10 -10
  27. package/dist/{chunk-SQBDX6IO.js → chunk-C6V2DSZZ.js} +6 -6
  28. package/dist/{chunk-ZD4KVFXI.js → chunk-D2ZYRI7M.js} +172 -3
  29. package/dist/{chunk-HIUVHRLM.js → chunk-D6ANA6YU.js} +20 -22
  30. package/dist/{chunk-YUF4DRYB.js → chunk-D7OEGXDX.js} +1 -1
  31. package/dist/{chunk-AOQKQWZU.js → chunk-DFAY7JUN.js} +1 -1
  32. package/dist/{chunk-QUZYRDT6.js → chunk-DIIDMDZU.js} +6 -6
  33. package/dist/{chunk-QBUSONNE.js → chunk-DZSQXG66.js} +45 -27
  34. package/dist/{chunk-UY3WWW5R.js → chunk-E5SSUV2A.js} +3 -3
  35. package/dist/{chunk-DNB4ZQGN.js → chunk-ET3DSSFZ.js} +1 -1
  36. package/dist/{chunk-4WWPDMRA.js → chunk-F7AMFFVK.js} +4 -4
  37. package/dist/{chunk-LHCDWFDB.js → chunk-FDLGJFAE.js} +1 -1
  38. package/dist/{chunk-C4ICGFEO.js → chunk-FVQKX5KI.js} +12 -12
  39. package/dist/{chunk-TRYOYWWU.js → chunk-G3LR6V6N.js} +4 -4
  40. package/dist/{chunk-AVOUHMCS.js → chunk-GHATCG2A.js} +10 -10
  41. package/dist/{chunk-R2UF54ON.js → chunk-HJWF7CGW.js} +9 -9
  42. package/dist/chunk-HRQTYU2T.js +355 -0
  43. package/dist/{chunk-NR4KQOXZ.js → chunk-HSTN27NR.js} +1 -1
  44. package/dist/{chunk-YVPB5YGO.js → chunk-HWMNTQBJ.js} +1 -1
  45. package/dist/{chunk-6XNVY3FW.js → chunk-HYDJUVOE.js} +1 -1
  46. package/dist/{chunk-WXMUGUZV.js → chunk-HYR25MV3.js} +4 -4
  47. package/dist/{chunk-AJ62EQIQ.js → chunk-IC4L65U7.js} +12 -9
  48. package/dist/{chunk-R2VUZZPJ.js → chunk-ILC2B7IJ.js} +4 -4
  49. package/dist/{chunk-E6Z3CJT2.js → chunk-IZ36G463.js} +5 -5
  50. package/dist/{chunk-IBEYUBCM.js → chunk-JKAVKTMY.js} +6 -6
  51. package/dist/{chunk-LHU6NG5Z.js → chunk-JLMS7EMD.js} +8 -8
  52. package/dist/{chunk-6RXMQYNU.js → chunk-JRSS6KM4.js} +1 -1
  53. package/dist/{chunk-HASJPQBC.js → chunk-K2LD6YNH.js} +4 -4
  54. package/dist/{chunk-UQ6OZYTO.js → chunk-KUDUKKQE.js} +43 -45
  55. package/dist/{chunk-34RXPR7M.js → chunk-KXDQD34C.js} +1 -1
  56. package/dist/{chunk-QDZ3ZZMY.js → chunk-LD7SXICE.js} +3 -3
  57. package/dist/{chunk-NQFXN5U7.js → chunk-MOEWCPMC.js} +1 -1
  58. package/dist/{chunk-IJ55MYO6.js → chunk-MV6ST2KT.js} +4 -4
  59. package/dist/{chunk-532X3OCZ.js → chunk-NCDH2JB7.js} +7 -9
  60. package/dist/{chunk-ITAPXBIB.js → chunk-NRVWLTOY.js} +9 -9
  61. package/dist/{chunk-DPDA3ILA.js → chunk-NZINZCHB.js} +1 -1
  62. package/dist/{chunk-A4HKPAEN.js → chunk-OEPWTSUG.js} +6 -6
  63. package/dist/{chunk-TBE4OLPA.js → chunk-OF2YGDUE.js} +21 -23
  64. package/dist/{chunk-BLL4VYGZ.js → chunk-OHEUOWYT.js} +1 -1
  65. package/dist/{chunk-PSUXESQ5.js → chunk-ORYQGVC3.js} +1 -1
  66. package/dist/{chunk-FVEEEEIM.js → chunk-OVPR3GQ6.js} +4 -4
  67. package/dist/{chunk-BN36MQW5.js → chunk-PCREZ4HJ.js} +20 -22
  68. package/dist/{chunk-KNP4ENFT.js → chunk-PK3GDU4M.js} +1 -1
  69. package/dist/{chunk-2SD2CGVH.js → chunk-PPYUBO6Y.js} +1 -1
  70. package/dist/{chunk-4HNBY7S7.js → chunk-PTJXMYRY.js} +7 -9
  71. package/dist/{chunk-VI3BJMZO.js → chunk-PXGVB2CY.js} +14 -18
  72. package/dist/{chunk-3C6ZZAB2.js → chunk-QY6J2FTK.js} +10 -12
  73. package/dist/{chunk-5RLEDUUE.js → chunk-R67WQ5RY.js} +3 -3
  74. package/dist/{chunk-WMCAEP2K.js → chunk-S6ZQFPOX.js} +2 -2
  75. package/dist/{chunk-LPM6NKVI.js → chunk-SF7KSXB5.js} +2 -2
  76. package/dist/{chunk-ECYUBKYX.js → chunk-T6PPK3T6.js} +40 -37
  77. package/dist/{chunk-RV5VX2XW.js → chunk-TM3A3K7T.js} +8 -9
  78. package/dist/{chunk-AFNPNHJV.js → chunk-TOOXNL6M.js} +3 -3
  79. package/dist/{chunk-BJDB7PXU.js → chunk-TS5EIWEF.js} +6 -6
  80. package/dist/{chunk-UG4YLCJ5.js → chunk-VD7MQFEV.js} +21 -23
  81. package/dist/{chunk-BBJXIZ3X.js → chunk-VU2PRGRI.js} +5 -34
  82. package/dist/{chunk-GTNO6F6K.js → chunk-WTSQKJAR.js} +4 -4
  83. package/dist/{chunk-TPMBNWHO.js → chunk-Y7XMKBFP.js} +16 -16
  84. package/dist/{chunk-JSQK5DH3.js → chunk-YLHJWAQS.js} +2 -2
  85. package/dist/{chunk-HTUG7ZFK.js → chunk-YLW26OHX.js} +3 -3
  86. package/dist/{chunk-C2REOMPO.js → chunk-YTXFNCVN.js} +1 -1
  87. package/dist/{chunk-F37CCZUA.js → chunk-YULIERZW.js} +8 -8
  88. package/dist/{chunk-KX4DF6XX.js → chunk-Z2W5YJBW.js} +6 -6
  89. package/dist/{chunk-DBAHJFBU.js → chunk-Z6WTLVUL.js} +13 -18
  90. package/dist/{chunk-6K4X7IIF.js → chunk-ZWZD4TJ5.js} +23 -25
  91. package/dist/index.js +1134 -618
  92. package/dist/mcp/analyze-cli.js +5 -7
  93. package/dist/mcp/cli.js +25 -27
  94. package/dist/mcp/server.js +101 -100
  95. package/dist/mcp/worker.js +43 -45
  96. package/dist/probes/installer.js +11 -11
  97. package/docs/agent-tools.md +54 -12
  98. package/docs/configuration.md +3 -3
  99. package/docs/globalconfig.md +8 -1
  100. package/docs/invariants/lsp-trust-exec.md +7 -0
  101. package/docs/mcp.md +2 -1
  102. package/docs/usage.md +1 -1
  103. package/package.json +1 -1
  104. package/dist/chunk-3HZ6MNB2.js +0 -140
  105. package/dist/chunk-43KD3PPM.js +0 -162
  106. package/dist/chunk-CKEQFGLT.js +0 -32
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  tryLazyInstallForFormatter
4
- } from "./chunk-GL6J5R34.js";
4
+ } from "./chunk-6EXGCXM5.js";
5
5
  import {
6
6
  OXFMT_SUPPORTED_EXTENSIONS,
7
7
  findPSScriptAnalyzerConfigPath,
@@ -44,7 +44,7 @@ import {
44
44
  hasToolConfig,
45
45
  hasVitePlusConfig,
46
46
  stripGradleCommentsAndStrings
47
- } from "./chunk-YUF4DRYB.js";
47
+ } from "./chunk-D7OEGXDX.js";
48
48
  import {
49
49
  readTextFileOrUndefined,
50
50
  resolveCargoPackageEdition
@@ -57,25 +57,25 @@ import {
57
57
  } from "./chunk-6HWVI6MI.js";
58
58
  import {
59
59
  getToolPath
60
- } from "./chunk-ITAPXBIB.js";
60
+ } from "./chunk-NRVWLTOY.js";
61
61
  import {
62
62
  resolveToolCwd
63
- } from "./chunk-JSQK5DH3.js";
63
+ } from "./chunk-YLHJWAQS.js";
64
64
  import {
65
65
  findGlobalBinary,
66
66
  findLocalBinUpwards,
67
67
  localBinPath
68
- } from "./chunk-FVEEEEIM.js";
68
+ } from "./chunk-OVPR3GQ6.js";
69
69
  import {
70
70
  getIsolatedNpxSpawnOptions,
71
71
  probeToolAsync
72
- } from "./chunk-OP5BMZKK.js";
72
+ } from "./chunk-3QMLB4TI.js";
73
73
  import {
74
74
  classifyFinderFailure,
75
75
  createAvailabilityLatch,
76
76
  logAvailabilityDecision,
77
77
  startHostStallSampler
78
- } from "./chunk-WBXCIRVI.js";
78
+ } from "./chunk-AVBEPUCD.js";
79
79
  import {
80
80
  VENDOR_BIN_DIRS,
81
81
  VENV_BIN_DIRS,
@@ -83,14 +83,14 @@ import {
83
83
  createGenerationSource,
84
84
  resolveWriteResult,
85
85
  safeSpawnAsync
86
- } from "./chunk-DNB4ZQGN.js";
86
+ } from "./chunk-ET3DSSFZ.js";
87
87
  import {
88
88
  TERRAGRUNT_FILENAMES
89
89
  } from "./chunk-SRXYSLMW.js";
90
90
  import {
91
91
  assertInstallAllowed,
92
92
  getProjectTrustGeneration
93
- } from "./chunk-43KD3PPM.js";
93
+ } from "./chunk-HRQTYU2T.js";
94
94
  import {
95
95
  compareOrdinal,
96
96
  getDegradationLedgerGeneration,
@@ -2,16 +2,16 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  getToolCommandSpec,
4
4
  shouldAutoInstallTool
5
- } from "./chunk-YUF4DRYB.js";
5
+ } from "./chunk-D7OEGXDX.js";
6
6
  import {
7
7
  BUILTIN_SERVER_RUNNER_COVERS,
8
8
  getServersForFileWithConfig,
9
9
  isAuxiliary,
10
10
  resolveAnalysisRootPath
11
- } from "./chunk-DBAHJFBU.js";
11
+ } from "./chunk-Z6WTLVUL.js";
12
12
  import {
13
13
  emitBounded
14
- } from "./chunk-NLRKB32C.js";
14
+ } from "./chunk-5EEWCJG7.js";
15
15
  import {
16
16
  ensureTool,
17
17
  findManagedToolBinary,
@@ -21,20 +21,20 @@ import {
21
21
  isSpawnableCommand,
22
22
  logSessionStart,
23
23
  resetPathWalkMemo
24
- } from "./chunk-ITAPXBIB.js";
24
+ } from "./chunk-NRVWLTOY.js";
25
25
  import {
26
26
  resolveToolCwd
27
- } from "./chunk-JSQK5DH3.js";
27
+ } from "./chunk-YLHJWAQS.js";
28
28
  import {
29
29
  findGlobalBinary,
30
30
  findLocalBinAt,
31
31
  findLocalBinUpwards,
32
32
  localBinPath
33
- } from "./chunk-FVEEEEIM.js";
33
+ } from "./chunk-OVPR3GQ6.js";
34
34
  import {
35
35
  createAvailabilityProbeFlight,
36
36
  probeToolAsync
37
- } from "./chunk-OP5BMZKK.js";
37
+ } from "./chunk-3QMLB4TI.js";
38
38
  import {
39
39
  classifyProbeFailure,
40
40
  createAvailabilityLatch,
@@ -43,7 +43,7 @@ import {
43
43
  isLatchingOutcome,
44
44
  logAvailabilityDecision,
45
45
  startHostStallSampler
46
- } from "./chunk-WBXCIRVI.js";
46
+ } from "./chunk-AVBEPUCD.js";
47
47
  import {
48
48
  NODE_MODULES_BIN_DIRS,
49
49
  VENDOR_BIN_DIRS,
@@ -53,13 +53,13 @@ import {
53
53
  isInSpawnTimeoutCooldown,
54
54
  resolveWindowsCommandForEnvironment,
55
55
  safeSpawnAsync
56
- } from "./chunk-DNB4ZQGN.js";
56
+ } from "./chunk-ET3DSSFZ.js";
57
57
  import {
58
58
  PathKeyedMap
59
59
  } from "./chunk-6EIV3H7O.js";
60
60
  import {
61
61
  getProjectTrustState
62
- } from "./chunk-43KD3PPM.js";
62
+ } from "./chunk-HRQTYU2T.js";
63
63
  import {
64
64
  compareOrdinal,
65
65
  incrementDegradationCount
@@ -8,16 +8,16 @@ import {
8
8
  getDefaultStartupTools,
9
9
  resolveLanguageRootForFile,
10
10
  rootMarkersForFile
11
- } from "./chunk-TTGDTNSN.js";
12
- import "./chunk-34RXPR7M.js";
13
- import "./chunk-3NVGBFJS.js";
14
- import "./chunk-C2REOMPO.js";
15
- import "./chunk-DNB4ZQGN.js";
11
+ } from "./chunk-75TVYCQW.js";
12
+ import "./chunk-KXDQD34C.js";
13
+ import "./chunk-3PMLYGJN.js";
14
+ import "./chunk-YTXFNCVN.js";
15
+ import "./chunk-ET3DSSFZ.js";
16
16
  import "./chunk-QYF5S6P6.js";
17
17
  import "./chunk-SRXYSLMW.js";
18
18
  import "./chunk-6EIV3H7O.js";
19
19
  import "./chunk-3R3Z54J7.js";
20
- import "./chunk-43KD3PPM.js";
20
+ import "./chunk-HRQTYU2T.js";
21
21
  import "./chunk-AGEQRJ5A.js";
22
22
  import "./chunk-S26LC76R.js";
23
23
  import "./chunk-K2GV34T2.js";
@@ -1,4 +1,10 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ buildQualifiedName
4
+ } from "./chunk-5W3R6LFT.js";
5
+ import {
6
+ firstChildOfType
7
+ } from "./chunk-6GWCYEP7.js";
2
8
 
3
9
  // dist/clients/metrics/function-metrics.js
4
10
  var JSTS = {
@@ -10,6 +16,12 @@ var JSTS = {
10
16
  "generator_function",
11
17
  "generator_function_declaration"
12
18
  ]),
19
+ containers: /* @__PURE__ */ new Set([
20
+ "class_declaration",
21
+ "abstract_class_declaration",
22
+ "class",
23
+ "interface_declaration"
24
+ ]),
13
25
  // `switch_default` is not a decision.
14
26
  decisions: /* @__PURE__ */ new Set([
15
27
  "if_statement",
@@ -44,6 +56,7 @@ var JSTS = {
44
56
  };
45
57
  var PYTHON = {
46
58
  functions: /* @__PURE__ */ new Set(["function_definition", "lambda"]),
59
+ containers: /* @__PURE__ */ new Set(["class_definition"]),
47
60
  decisions: /* @__PURE__ */ new Set([
48
61
  "if_statement",
49
62
  "elif_clause",
@@ -77,6 +90,8 @@ var GO = {
77
90
  "method_declaration",
78
91
  "func_literal"
79
92
  ]),
93
+ // A Go method's owner is its receiver type (`ownerOf`), not a container.
94
+ containers: /* @__PURE__ */ new Set(),
80
95
  // `default_case` is not a decision.
81
96
  decisions: /* @__PURE__ */ new Set([
82
97
  "if_statement",
@@ -103,6 +118,7 @@ var GO = {
103
118
  };
104
119
  var RUST = {
105
120
  functions: /* @__PURE__ */ new Set(["function_item", "closure_expression"]),
121
+ containers: /* @__PURE__ */ new Set(["impl_item", "trait_item", "mod_item"]),
106
122
  decisions: /* @__PURE__ */ new Set([
107
123
  "if_expression",
108
124
  "while_expression",
@@ -212,23 +228,176 @@ function measureFunction(fn, languageId, visit) {
212
228
  parameters: countParameters(fn)
213
229
  };
214
230
  }
215
- function measureFile(root, languageId) {
231
+ function functionName(node) {
232
+ const type = node.type;
233
+ if (type === "function_declaration") {
234
+ return firstChildOfType(node, "identifier")?.text;
235
+ }
236
+ if (type === "method_definition") {
237
+ const kids = node.children ?? [];
238
+ const paramsIdx = kids.findIndex((c) => c?.type === "formal_parameters");
239
+ for (let i = paramsIdx - 1; i >= 0; i -= 1) {
240
+ const t = kids[i]?.type;
241
+ if (t === "property_identifier" || t === "private_property_identifier" || t === "computed_property_name" || t === "string" || t === "number") {
242
+ return kids[i].text;
243
+ }
244
+ }
245
+ return void 0;
246
+ }
247
+ if (type === "arrow_function" || type === "function_expression") {
248
+ const parent = node.parent;
249
+ if (parent?.type === "variable_declarator") {
250
+ return firstChildOfType(parent, "identifier")?.text;
251
+ }
252
+ if (parent?.type === "pair")
253
+ return (parent.children ?? [])[0]?.text;
254
+ return void 0;
255
+ }
256
+ if (type === "lambda") {
257
+ const parent = node.parent;
258
+ return parent?.type === "assignment" ? parent.childForFieldName("left")?.text : void 0;
259
+ }
260
+ return node.childForFieldName("name")?.text;
261
+ }
262
+ function receiverType(fn) {
263
+ const receiver = fn.childForFieldName("receiver");
264
+ if (!receiver)
265
+ return void 0;
266
+ let found;
267
+ const visit = (node) => {
268
+ if (found !== void 0)
269
+ return;
270
+ if (node.type === "type_identifier") {
271
+ found = node.text;
272
+ return;
273
+ }
274
+ for (const child of node.children ?? [])
275
+ if (child)
276
+ visit(child);
277
+ };
278
+ visit(receiver);
279
+ return found;
280
+ }
281
+ function containerName(node) {
282
+ return node.childForFieldName("name")?.text ?? node.childForFieldName("type")?.text;
283
+ }
284
+ var ANONYMOUS_KEY = "<anonymous>";
285
+ var MAX_MEASURED_BYTES = 256 * 1024;
286
+ function assignKeys(functions, declared, receivers, containers, languageId) {
287
+ const owners = [...containers];
288
+ functions.forEach((fn, i) => {
289
+ const name = declared[i];
290
+ if (name !== void 0)
291
+ owners.push({ name, startLine: fn.line, endLine: fn.endLine });
292
+ });
293
+ owners.forEach((owner, priority) => {
294
+ owner.priority = priority;
295
+ });
296
+ const entries = [
297
+ ...owners.map((owner) => ({ ...owner, index: -1 })),
298
+ ...functions.map((fn, index) => ({
299
+ name: void 0,
300
+ startLine: fn.line,
301
+ endLine: fn.endLine,
302
+ index
303
+ }))
304
+ ];
305
+ const byEnd = [];
306
+ let lastLine = 0;
307
+ for (const entry of entries) {
308
+ (byEnd[entry.endLine] ??= []).push(entry);
309
+ lastLine = Math.max(lastLine, entry.endLine);
310
+ }
311
+ const byStart = [];
312
+ for (let line = lastLine; line >= 0; line--) {
313
+ for (const entry of byEnd[line] ?? []) {
314
+ (byStart[entry.startLine] ??= []).push(entry);
315
+ }
316
+ }
317
+ const ending = [];
318
+ for (const owner of owners) {
319
+ const prior = ending[owner.endLine];
320
+ const span = owner.endLine - owner.startLine;
321
+ if (span > 0 && (!prior || span < prior.endLine - prior.startLine))
322
+ ending[owner.endLine] = owner;
323
+ }
324
+ const open = [];
325
+ const ownerNames = [];
326
+ for (let line = 0; line <= lastLine; line++) {
327
+ for (const entry of byStart[line] ?? []) {
328
+ while (open.length && open[open.length - 1].endLine < entry.endLine)
329
+ open.pop();
330
+ const top = open[open.length - 1];
331
+ const equal = top?.startLine === entry.startLine && top.endLine === entry.endLine;
332
+ if (entry.index >= 0) {
333
+ let owner = equal ? open[open.length - 2] : top;
334
+ const boundary = ending[entry.endLine];
335
+ if (entry.startLine === entry.endLine && boundary && (!owner || boundary.endLine - boundary.startLine < owner.endLine - owner.startLine || boundary.endLine - boundary.startLine === owner.endLine - owner.startLine && boundary.priority < owner.priority))
336
+ owner = boundary;
337
+ ownerNames[entry.index] = owner?.name;
338
+ }
339
+ if (entry.name !== void 0 && !equal)
340
+ open.push({ ...entry, name: entry.name });
341
+ }
342
+ }
343
+ const seen = /* @__PURE__ */ new Map();
344
+ return functions.map((fn, i) => {
345
+ const base = declared[i] ?? ANONYMOUS_KEY;
346
+ const owner = languageId === "go" && receivers[i] !== null ? receivers[i] : ownerNames[i];
347
+ const qualified = buildQualifiedName(owner, base) ?? base;
348
+ const count = (seen.get(qualified) ?? 0) + 1;
349
+ seen.set(qualified, count);
350
+ return { ...fn, key: count === 1 ? qualified : `${qualified}#${count}` };
351
+ });
352
+ }
353
+ function measureFile(root, languageId, keyFunctions = true) {
216
354
  const table = TABLES[languageId];
217
355
  const functions = [];
356
+ const declared = [];
357
+ const receivers = [];
358
+ const containers = [];
218
359
  const { cognitive, nesting } = tally(root, table, false, (node, type) => {
360
+ if (keyFunctions && table.containers.has(type)) {
361
+ const name = containerName(node);
362
+ if (name !== void 0)
363
+ containers.push({
364
+ name,
365
+ startLine: node.startPosition.row + 1,
366
+ endLine: node.endPosition.row + 1
367
+ });
368
+ return;
369
+ }
219
370
  if (!table.functions.has(type) || !node.isNamed)
220
371
  return;
221
372
  const line = node.startPosition.row + 1;
373
+ if (keyFunctions) {
374
+ declared.push(functionName(node));
375
+ receivers.push(languageId === "go" && type === "method_declaration" ? receiverType(node) : null);
376
+ }
222
377
  functions.push({
223
- name: node.childForFieldName("name")?.text ?? `<anonymous@L${line}>`,
378
+ name: functionName(node) ?? `<anonymous@L${line}>`,
224
379
  line,
380
+ endLine: node.endPosition.row + 1,
225
381
  ...measureFunction(node, languageId)
226
382
  });
227
383
  });
228
- return { cognitive, nesting, functions };
384
+ let keyed;
385
+ return {
386
+ cognitive,
387
+ nesting,
388
+ functions: !keyFunctions ? functions.map((fn) => ({ ...fn, key: ANONYMOUS_KEY })) : functions.map((fn, index) => ({
389
+ ...fn,
390
+ get key() {
391
+ keyed ??= assignKeys(functions, declared, receivers, containers, languageId);
392
+ return keyed[index].key;
393
+ }
394
+ }))
395
+ };
229
396
  }
230
397
 
231
398
  export {
232
399
  measureFunction,
400
+ functionName,
401
+ MAX_MEASURED_BYTES,
233
402
  measureFile
234
403
  };
@@ -2,42 +2,40 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  createAvailabilityChecker,
4
4
  resolveAvailableOrInstall
5
- } from "./chunk-UELHWF5I.js";
5
+ } from "./chunk-BEIPWPVR.js";
6
6
  import {
7
7
  ruffConfigArgs
8
- } from "./chunk-YUF4DRYB.js";
9
- import "./chunk-DBAHJFBU.js";
10
- import "./chunk-2SD2CGVH.js";
11
- import "./chunk-NLRKB32C.js";
8
+ } from "./chunk-D7OEGXDX.js";
9
+ import "./chunk-Z6WTLVUL.js";
10
+ import "./chunk-PPYUBO6Y.js";
11
+ import "./chunk-5EEWCJG7.js";
12
12
  import "./chunk-QJ4T73J5.js";
13
- import "./chunk-HTUG7ZFK.js";
13
+ import "./chunk-YLW26OHX.js";
14
14
  import "./chunk-7424ANRU.js";
15
15
  import "./chunk-SUIZOCSY.js";
16
- import "./chunk-5YTDZ5WP.js";
16
+ import "./chunk-7M64NTAK.js";
17
17
  import "./chunk-E3PNZDPH.js";
18
- import "./chunk-KNP4ENFT.js";
19
- import "./chunk-CKEQFGLT.js";
20
- import "./chunk-LXE7JAMV.js";
18
+ import "./chunk-PK3GDU4M.js";
19
+ import "./chunk-6JLNZ6DP.js";
21
20
  import "./chunk-IT7MFVGP.js";
22
21
  import "./chunk-AYDE7RFV.js";
23
- import "./chunk-3HZ6MNB2.js";
24
22
  import "./chunk-2BEMIWEW.js";
25
23
  import "./chunk-IJYGIDF4.js";
26
- import "./chunk-ITAPXBIB.js";
24
+ import "./chunk-NRVWLTOY.js";
27
25
  import {
28
26
  resolveToolCwd
29
- } from "./chunk-JSQK5DH3.js";
30
- import "./chunk-FVEEEEIM.js";
31
- import "./chunk-OP5BMZKK.js";
27
+ } from "./chunk-YLHJWAQS.js";
28
+ import "./chunk-OVPR3GQ6.js";
29
+ import "./chunk-3QMLB4TI.js";
32
30
  import "./chunk-UYXV5NIS.js";
33
- import "./chunk-WBXCIRVI.js";
34
- import "./chunk-TTGDTNSN.js";
35
- import "./chunk-34RXPR7M.js";
36
- import "./chunk-3NVGBFJS.js";
37
- import "./chunk-C2REOMPO.js";
31
+ import "./chunk-AVBEPUCD.js";
32
+ import "./chunk-75TVYCQW.js";
33
+ import "./chunk-KXDQD34C.js";
34
+ import "./chunk-3PMLYGJN.js";
35
+ import "./chunk-YTXFNCVN.js";
38
36
  import {
39
37
  safeSpawnAsync
40
- } from "./chunk-DNB4ZQGN.js";
38
+ } from "./chunk-ET3DSSFZ.js";
41
39
  import "./chunk-B4FAFEBP.js";
42
40
  import "./chunk-QYF5S6P6.js";
43
41
  import {
@@ -46,7 +44,7 @@ import {
46
44
  import "./chunk-6EIV3H7O.js";
47
45
  import "./chunk-3R3Z54J7.js";
48
46
  import "./chunk-CIA7X2PZ.js";
49
- import "./chunk-43KD3PPM.js";
47
+ import "./chunk-HRQTYU2T.js";
50
48
  import {
51
49
  createSubsystemLogger
52
50
  } from "./chunk-AGEQRJ5A.js";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  loadProjectSnapshotWithoutWordIndex
4
- } from "./chunk-HTUG7ZFK.js";
4
+ } from "./chunk-YLW26OHX.js";
5
5
  import {
6
6
  hasTomlTable,
7
7
  normalizeToml
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  getProjectDataDir
4
- } from "./chunk-DNB4ZQGN.js";
4
+ } from "./chunk-ET3DSSFZ.js";
5
5
  import {
6
6
  createNdjsonLogger,
7
7
  getGlobalPiLensLogDir,
@@ -3,7 +3,7 @@ import {
3
3
  augmentPythonEnvironment,
4
4
  detectPythonEnvironment,
5
5
  emitBounded
6
- } from "./chunk-NLRKB32C.js";
6
+ } from "./chunk-5EEWCJG7.js";
7
7
  import {
8
8
  scannerReportParentDir
9
9
  } from "./chunk-QJ4T73J5.js";
@@ -12,23 +12,23 @@ import {
12
12
  } from "./chunk-6HWVI6MI.js";
13
13
  import {
14
14
  resolveToolCwd
15
- } from "./chunk-JSQK5DH3.js";
15
+ } from "./chunk-YLHJWAQS.js";
16
16
  import {
17
17
  findGlobalBinary,
18
18
  findLocalBinAt,
19
19
  localBinPath
20
- } from "./chunk-FVEEEEIM.js";
20
+ } from "./chunk-OVPR3GQ6.js";
21
21
  import {
22
22
  getIsolatedNpxSpawnOptions
23
- } from "./chunk-OP5BMZKK.js";
23
+ } from "./chunk-3QMLB4TI.js";
24
24
  import {
25
25
  resolveLanguageRootForFile
26
- } from "./chunk-TTGDTNSN.js";
26
+ } from "./chunk-75TVYCQW.js";
27
27
  import {
28
28
  resolveGitCheckout,
29
29
  safeSpawn,
30
30
  safeSpawnAsync
31
- } from "./chunk-DNB4ZQGN.js";
31
+ } from "./chunk-ET3DSSFZ.js";
32
32
  import {
33
33
  DOTNET_CSHARP_ROOT_MARKERS,
34
34
  detectFileKind