scip-query 0.11.0 → 0.13.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.
Files changed (157) hide show
  1. package/README.md +24 -0
  2. package/dist/{chunk-WQHWIVA7.js → chunk-27HMTUJE.js} +2 -2
  3. package/dist/{chunk-3KDUITBE.js → chunk-27XEGMCT.js} +2 -2
  4. package/dist/{chunk-3V6JQQM5.js → chunk-2TPCIPYA.js} +2 -2
  5. package/dist/{chunk-ALHNAPS2.js → chunk-2XRXEIRK.js} +2 -2
  6. package/dist/{chunk-K2HYR5A7.js → chunk-3AMWF6V5.js} +2 -2
  7. package/dist/{chunk-LWOOTRHC.js → chunk-3H5OSDF7.js} +2 -2
  8. package/dist/{chunk-UMPNL7T6.js → chunk-43GKP6LI.js} +2 -2
  9. package/dist/{chunk-DRPAQAFM.js → chunk-44P4SJFN.js} +2 -2
  10. package/dist/{chunk-XMR747CP.js → chunk-5JRMZMLM.js} +2 -2
  11. package/dist/{chunk-QJ3FK4TB.js → chunk-5VY3RIEI.js} +2 -2
  12. package/dist/{chunk-IFSX6YVU.js → chunk-6JUAGXR4.js} +2 -2
  13. package/dist/{chunk-BN5SXXQS.js → chunk-6KDOYKCB.js} +2 -2
  14. package/dist/chunk-6KMTPNZL.js +3 -0
  15. package/dist/{chunk-LZNLRE4X.js → chunk-72FR7KEZ.js} +2 -2
  16. package/dist/{chunk-FXG3PHVW.js → chunk-7COVQPQQ.js} +6 -6
  17. package/dist/chunk-7TVFPOD7.js +102 -0
  18. package/dist/{chunk-TTS75UF2.js → chunk-A6KSEIRN.js} +2 -2
  19. package/dist/{chunk-CMHYBXJB.js → chunk-AAMURYOK.js} +2 -2
  20. package/dist/{chunk-XEMQUN3Z.js → chunk-BP7S6V3M.js} +2 -2
  21. package/dist/{chunk-QXGTGE2C.js → chunk-BRBF3E5X.js} +2 -2
  22. package/dist/{chunk-M2YXL62V.js → chunk-BUNDZ6K2.js} +2 -2
  23. package/dist/{chunk-NAH5EAZS.js → chunk-BZXE3HO4.js} +2 -2
  24. package/dist/{chunk-ZEKBR4OK.js → chunk-CXQQOXSI.js} +2 -2
  25. package/dist/{chunk-WZLPXFZU.js → chunk-EDSD3VJK.js} +2 -2
  26. package/dist/chunk-EVZSAR3S.js +2 -0
  27. package/dist/{chunk-HZKMEXA3.js → chunk-GMOEX7EV.js} +2 -2
  28. package/dist/{chunk-BDRBPG7Y.js → chunk-GUDKRIGW.js} +2 -2
  29. package/dist/{chunk-WFGOH2UI.js → chunk-GULVO6NF.js} +2 -2
  30. package/dist/{chunk-RJMXSHKM.js → chunk-GY3HAWUA.js} +2 -2
  31. package/dist/{chunk-H56MGERE.js → chunk-HV27H2V2.js} +2 -2
  32. package/dist/chunk-HZZQKNVE.js +2 -0
  33. package/dist/{chunk-VGMUFW3J.js → chunk-I4R3SNMR.js} +2 -2
  34. package/dist/{chunk-X4O6K47U.js → chunk-IMQFJ53K.js} +2 -2
  35. package/dist/{chunk-NJJ7AS4F.js → chunk-IUSSGHJO.js} +2 -2
  36. package/dist/{chunk-Y6L4LXPG.js → chunk-JJUX2OAP.js} +2 -2
  37. package/dist/chunk-JZBGTSAB.js +13 -0
  38. package/dist/{chunk-N7PNFLGY.js → chunk-K5N5RNGM.js} +2 -2
  39. package/dist/{chunk-XHWLNQVZ.js → chunk-K7SPOJHZ.js} +2 -2
  40. package/dist/{chunk-STBXCPKY.js → chunk-KSJ544IV.js} +2 -2
  41. package/dist/{chunk-GHXRVCIY.js → chunk-KYB7FPXT.js} +2 -2
  42. package/dist/{chunk-ORBRX2QJ.js → chunk-LY7NMOBW.js} +2 -2
  43. package/dist/{chunk-NBXK32I6.js → chunk-M7EEHYSU.js} +2 -2
  44. package/dist/{chunk-U7I373V4.js → chunk-N23FT4EZ.js} +2 -2
  45. package/dist/{chunk-6Q6OFLFQ.js → chunk-N2OTJWC2.js} +2 -2
  46. package/dist/{chunk-P36UR5II.js → chunk-NCVFKOLB.js} +2 -2
  47. package/dist/{chunk-KKMOB3OJ.js → chunk-NOKUZU56.js} +2 -2
  48. package/dist/{chunk-WPSS37EW.js → chunk-OXTM2RX3.js} +2 -2
  49. package/dist/{chunk-FLJJLSGB.js → chunk-PEHDARNC.js} +2 -2
  50. package/dist/chunk-PESEPWZO.js +2 -0
  51. package/dist/{chunk-X6OGDTQH.js → chunk-PMY4UFGV.js} +2 -2
  52. package/dist/{chunk-H7NSJ7L2.js → chunk-Q7PWDXL5.js} +2 -2
  53. package/dist/{chunk-343O6EVV.js → chunk-QVGFVRKD.js} +2 -2
  54. package/dist/{chunk-7XL7J7PT.js → chunk-QYOPMTZ6.js} +2 -2
  55. package/dist/{chunk-VYF5HA76.js → chunk-QZOAOLLZ.js} +2 -2
  56. package/dist/{chunk-NLMRJ7SI.js → chunk-R7U2I55B.js} +2 -2
  57. package/dist/{chunk-UIKLA3F5.js → chunk-RLB6SG25.js} +2 -2
  58. package/dist/{chunk-3T2FNHIU.js → chunk-SFDVBARK.js} +2 -2
  59. package/dist/{chunk-ODVITBYU.js → chunk-TYCZ7S4I.js} +2 -2
  60. package/dist/{chunk-HINMXZ6J.js → chunk-U3VMUDXJ.js} +2 -2
  61. package/dist/chunk-UHPWZCYQ.js +3 -0
  62. package/dist/{chunk-N2Z3CU7X.js → chunk-V5W7H7V4.js} +2 -2
  63. package/dist/{chunk-C4ICAIJ4.js → chunk-WMO2VZZK.js} +2 -2
  64. package/dist/chunk-WPZPB42I.js +2 -0
  65. package/dist/{chunk-VXTNADIW.js → chunk-X3DTIEMU.js} +2 -2
  66. package/dist/chunk-X5C43YVI.js +2 -0
  67. package/dist/{chunk-PYZZBIEU.js → chunk-XC2PJOVM.js} +2 -2
  68. package/dist/{chunk-WGA5BBTA.js → chunk-XDESMVOL.js} +2 -2
  69. package/dist/{chunk-PZS6J5YG.js → chunk-XZBLZHXL.js} +2 -2
  70. package/dist/{chunk-7HB3CZFD.js → chunk-YQKECTPV.js} +2 -2
  71. package/dist/chunk-YTVKPJXW.js +2 -0
  72. package/dist/{chunk-75X52JTA.js → chunk-ZEO4CXQR.js} +2 -2
  73. package/dist/cli.js +259 -247
  74. package/dist/index.js +1 -1
  75. package/dist/queries/affected.js +1 -1
  76. package/dist/queries/bottlenecks.js +1 -1
  77. package/dist/queries/by-kind.js +1 -1
  78. package/dist/queries/call-graph.js +1 -1
  79. package/dist/queries/change-surface.js +1 -1
  80. package/dist/queries/cleanup-plan.js +1 -1
  81. package/dist/queries/co-change.js +1 -1
  82. package/dist/queries/code.js +1 -1
  83. package/dist/queries/complexity-hotspots.js +1 -1
  84. package/dist/queries/complexity.js +1 -1
  85. package/dist/queries/convergence.js +1 -1
  86. package/dist/queries/coupling.js +1 -1
  87. package/dist/queries/cycles.js +1 -1
  88. package/dist/queries/dataflow.js +1 -1
  89. package/dist/queries/dead.js +1 -1
  90. package/dist/queries/decorative-checkers.d.ts +34 -0
  91. package/dist/queries/decorative-checkers.js +2 -0
  92. package/dist/queries/deep-chains.js +1 -1
  93. package/dist/queries/deps.js +1 -1
  94. package/dist/queries/diff-gate.js +1 -1
  95. package/dist/queries/diff-impact.js +1 -1
  96. package/dist/queries/doc-drift.js +1 -1
  97. package/dist/queries/drift.js +1 -1
  98. package/dist/queries/duplicate-bodies.js +1 -1
  99. package/dist/queries/extract-candidates.js +1 -1
  100. package/dist/queries/fan.js +1 -1
  101. package/dist/queries/health.js +1 -1
  102. package/dist/queries/hierarchy.js +1 -1
  103. package/dist/queries/hotspots.js +1 -1
  104. package/dist/queries/imports.js +1 -1
  105. package/dist/queries/incomplete-migration.js +1 -1
  106. package/dist/queries/index.d.ts +3 -0
  107. package/dist/queries/index.js +1 -1
  108. package/dist/queries/isolated.js +1 -1
  109. package/dist/queries/locality-candidates.js +1 -1
  110. package/dist/queries/members.js +1 -1
  111. package/dist/queries/methods.js +1 -1
  112. package/dist/queries/not-implemented.d.ts +33 -0
  113. package/dist/queries/not-implemented.js +2 -0
  114. package/dist/queries/outline.js +1 -1
  115. package/dist/queries/passthrough-candidates.js +1 -1
  116. package/dist/queries/plan-context.js +1 -1
  117. package/dist/queries/recent-duplicates.js +1 -1
  118. package/dist/queries/redundant-reexports.js +1 -1
  119. package/dist/queries/refs.js +1 -1
  120. package/dist/queries/self-audit.js +1 -1
  121. package/dist/queries/similar-chains.js +1 -1
  122. package/dist/queries/similar-files.js +1 -1
  123. package/dist/queries/similar-signatures.js +1 -1
  124. package/dist/queries/similar.js +1 -1
  125. package/dist/queries/slice.js +1 -1
  126. package/dist/queries/stale-abstractions.js +1 -1
  127. package/dist/queries/surface.js +1 -1
  128. package/dist/queries/symbols.js +1 -1
  129. package/dist/queries/system.js +1 -1
  130. package/dist/queries/test-quality.d.ts +56 -0
  131. package/dist/queries/test-quality.js +2 -0
  132. package/dist/queries/trace.js +1 -1
  133. package/dist/queries/twin-ab.js +1 -1
  134. package/dist/queries/twin-drift.d.ts +23 -1
  135. package/dist/queries/twin-drift.js +1 -1
  136. package/dist/queries/unused-imports.js +1 -1
  137. package/dist/queries/unused-params.js +1 -1
  138. package/dist/queries/wrapper-candidates.js +1 -1
  139. package/dist/reindex-worker.js +9 -9
  140. package/dist/reindex.d.ts +20 -1
  141. package/dist/reindex.js +19 -19
  142. package/dist/runtime.js +1 -1
  143. package/docs/COMMAND_REFERENCE.md +6 -3
  144. package/docs/analyzer-inventory.md +16 -0
  145. package/package.json +32 -2
  146. package/skills/_shared/SKILL.md +4 -1
  147. package/skills/scip-calibrate/SKILL.md +124 -0
  148. package/skills/scip-calibrate/agents/openai.yaml +4 -0
  149. package/skills/scip-integrity-audit/SKILL.md +32 -0
  150. package/skills/scip-tla-model-system/SKILL.md +24 -14
  151. package/dist/chunk-2VSDXOG5.js +0 -2
  152. package/dist/chunk-GCN2P4EJ.js +0 -2
  153. package/dist/chunk-H4LUPLEJ.js +0 -2
  154. package/dist/chunk-HXXMPYEF.js +0 -2
  155. package/dist/chunk-MNEJYEHW.js +0 -3
  156. package/dist/chunk-R3JY4EZ4.js +0 -102
  157. package/dist/chunk-T2FQ4GHD.js +0 -9
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: scip-calibrate
3
+ description: Calibrate scip-query's detectors against a repo before trusting them. Use when adopting scip-query in a new or foreign codebase, after major detector changes, when a health score or gate output seems too noisy or too clean, or before letting diff-gate block anyone's work.
4
+ commands:
5
+ - scip-query health --json
6
+ - scip-query diff-gate --base <commit> --json
7
+ - scip-query twin-drift -s <scope> --json
8
+ - scip-query dead --json
9
+ - scip-query similar <symbol>
10
+ - scip-query config-validate
11
+ ---
12
+
13
+ # scip-calibrate
14
+
15
+ Use this skill to measure whether scip-query's detectors tell the truth about a
16
+ specific repository before believing anything they say about it. A detector
17
+ tuned on one codebase's conventions can be precise there and noisy elsewhere;
18
+ calibration is how you find out which you have — and it converts every noise
19
+ archetype you find into either a repo-side knob or an upstream detector bug.
20
+
21
+ Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md).
22
+
23
+ ## The Stance
24
+
25
+ A health score you have not calibrated is a number, not a fact. Never present
26
+ detector output from an uncalibrated repo as findings — present it as
27
+ candidate findings pending classification. The score must EARN trust the same
28
+ way a checker earns it in `scip-integrity-audit`: by being witnessed telling
29
+ the truth on samples you verified yourself.
30
+
31
+ ## Protocol
32
+
33
+ Run all five stages. Each has a checkable exit.
34
+
35
+ ### 1. Index and inventory
36
+
37
+ `scip-query reindex`, then `scip-query status --capabilities`. Record which
38
+ languages got which evidence tier (SCIP-indexed vs source-fallback vs regex) —
39
+ a detector's expected precision differs per tier, and a repo that is 80%
40
+ fallback-tier must be judged against fallback expectations. Note monorepo
41
+ shape (workspaces, cross-package imports): historically the single largest
42
+ false-positive source (dead/new-dead on cross-package consumers).
43
+ Complete when: languages, tiers, and workspace shape are written down.
44
+
45
+ ### 2. Battery sweep
46
+
47
+ Run the full detector battery and `health --json`. Do not react to anything
48
+ yet — big numbers are not findings, they are sampling frames.
49
+ Complete when: every detector's finding count is recorded.
50
+
51
+ ### 3. Retro-gate replay
52
+
53
+ Replay `diff-gate` against the last 15–20 real commits (worktree per commit,
54
+ never the user's live tree). This is the stage that exposes finding WALLS —
55
+ one hub file or one convention mismatch generating dozens of near-identical
56
+ findings per commit. A wall is always either a missing repo knob or a detector
57
+ bug; it is never "the repo is just bad."
58
+ Complete when: per-commit finding counts and every wall are recorded.
59
+
60
+ ### 4. Sample and classify — the actual calibration
61
+
62
+ For each detector with findings: sample about 10 (all of them if fewer),
63
+ READ THE CODE at each site, and classify actionable vs noise. Two rules make
64
+ this real calibration instead of theater:
65
+
66
+ - Classify from the code, never from the finding text. A finding that sounds
67
+ plausible and a finding that is true are different things; the difference is
68
+ only visible at the cited file and line.
69
+ - For every noise finding, name the ARCHETYPE (e.g. "type-only import
70
+ invisible to indexer", "delegation chain flagged as twin", "generic shared
71
+ helpers saturating similarity"). Archetypes are the deliverable: a noise
72
+ rate without archetypes cannot be fixed.
73
+
74
+ Then give each detector a verdict: **keep** (precision acceptable), **retune**
75
+ (name the threshold and the value), or **demote to advisory** for this repo.
76
+ Complete when: every detector has sampled precision, named archetypes, and a
77
+ verdict.
78
+
79
+ ### 5. Tune the knobs, file the bugs
80
+
81
+ Apply repo-side fixes for what belongs to the repo, and file upstream for what
82
+ belongs to the detector:
83
+
84
+ - `.scipquery.json` suppressions — one per accepted finding, WITH a reason;
85
+ a reasonless suppression is hiding, not tuning.
86
+ - `docs.snapshotPaths` — dated/archival docs that must never generate
87
+ doc-reference findings.
88
+ - Coverage contracts — enumerations the gate should police.
89
+ - `commandAnalysisBudget` — cap analysis honestly on very large indexes.
90
+ - Detector bugs (noise archetypes no knob can express) go to the tool's
91
+ followup ledger with the archetype, a concrete example, and the sampled
92
+ rate. Never tune a threshold to hide an archetype — that trades visible
93
+ noise for invisible blindness.
94
+
95
+ Complete when: the gate replay from stage 3 re-runs materially quieter, and
96
+ every remaining finding class is either actionable, suppressed-with-reason, or
97
+ filed upstream.
98
+
99
+ ## Failure Modes (each observed in a real calibration)
100
+
101
+ - **Sampling too few.** One good finding does not make a detector precise;
102
+ one bad finding does not make it noise. Ten per detector is the floor.
103
+ - **Classifying from the finding text.** The finding always sounds right —
104
+ it was generated to. Only the code knows.
105
+ - **Tuning to green.** Raising a threshold until the noise disappears also
106
+ disappears the real findings. If the archetype is a detector bug, file it
107
+ and live with the noise until it is fixed.
108
+ - **Trusting a clean run.** Zero findings on a detector can mean precision or
109
+ can mean the detector cannot see this repo's conventions at all (wrong
110
+ import style, unindexed language). Verify at least one known-true positive
111
+ per major detector — plant one if none exists.
112
+ - **Calibrating the wrong tree.** Clones or worktrees for anything that
113
+ mutates; the target repo is read-only unless its owner said otherwise.
114
+
115
+ ## After Calibration
116
+
117
+ The finding-outcome ledger keeps calibrating for you: once the repo uses
118
+ diff-gate, per-detector precision is recomputed from real outcomes
119
+ (`detectorPrecision` in `health --json`). Re-run this protocol only after
120
+ major detector upgrades or when the ledger's precision numbers drift from
121
+ what you measured. Write the calibration report to
122
+ `docs/validation/YYYY-MM-DD-external-calibration-<repo>.md` in the shape of
123
+ the exemplars this skill was distilled from — battery table, retro-gate
124
+ walls, per-detector verdicts, noise archetypes, caps and deviations.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "scip calibrate"
3
+ short_description: "Measure scip-query's detector precision on a repo before trusting scores or gating anyone."
4
+ default_prompt: "Run the scip-calibrate protocol against this repository: battery sweep, retro-gate replay, sample-and-classify each detector from the code, then tune repo knobs and file detector bugs."
@@ -9,6 +9,9 @@ commands:
9
9
  - scip-query twin-drift -s <scope> --json
10
10
  - scip-query twin-ab <symbolA> <symbolB>
11
11
  - scip-query outline <file> --signatures
12
+ - scip-query decorative-checkers -s <scope> --json
13
+ - scip-query not-implemented -s <scope> --json
14
+ - scip-query test-quality -s <scope> --json
12
15
  ---
13
16
 
14
17
  # scip-integrity-audit
@@ -43,6 +46,13 @@ decorative: file it as a defect, not a note.
43
46
  Complete only when every checker in scope has been witnessed rejecting a
44
47
  constructed should-fail input, or is listed with a reason it cannot be.
45
48
 
49
+ Mechanized by: `scip-query decorative-checkers` finds `validate*`/`verify*`/
50
+ `check*`/`assert*`/`is*`/`has*` callables with no reachable failure exit
51
+ anywhere in their body (calibrated 2026-07-03 against two external repos —
52
+ standalone-only; noise archetypes past one-hop delegation in
53
+ `docs/validation/2026-07-03-integrity-detector-calibration.md`). Run it first
54
+ to shortlist candidates before hand-constructing should-fail inputs.
55
+
46
56
  ### 2. Diff every adapter against captured reality
47
57
 
48
58
  For each parser/adapter of an external format (tool output, XML/JSON
@@ -65,6 +75,15 @@ feature above it is dead — date of death: birth.
65
75
  Complete only when every fallback's primary path has a witness or a filed
66
76
  defect.
67
77
 
78
+ Mechanized by: `scip-query not-implemented` finds reachable placeholder
79
+ stubs (`throw new Error('not implemented')`, TODO-comment + return-default,
80
+ empty bodies) that a real caller, entry surface, or package-surface export
81
+ can actually reach — the graph fact that separates "primary path never
82
+ built" from `dead`'s "primary path built but unreferenced." Standalone-only
83
+ (calibrated 2026-07-03; 0 live findings on two external repos post-fix, see
84
+ the calibration report) — treat a clean run as "nothing this shape found,"
85
+ not as "every fallback's primary path is proven live."
86
+
68
87
  ### 4. Hand-compute every metric twice
69
88
 
70
89
  For each number the system reports (scores, counts, estimates): pick two
@@ -101,3 +120,16 @@ the drill that exposed it, the should-fail input or real sample used, and
101
120
  the fix. The audit is complete only when every drill's exit criterion is
102
121
  met for the scope, and every defect found has a regression artifact — a
103
122
  test, fixture, or model that fails on the pre-fix behavior.
123
+
124
+ A regression artifact that doesn't actually assert anything, or asserts the
125
+ same literal it stubbed into its own mock, is a fake witness — the same
126
+ "reports success without doing the work" failure mode this skill hunts in
127
+ production code, just relocated to the test suite. Run `scip-query
128
+ test-quality -s <scope>` over the audit's own regression artifacts (and,
129
+ periodically, over the suite at large) to catch this: assertion-free test
130
+ bodies, a skipped-test ledger with git-blame age (a skip with no fix date
131
+ attached is a claim nobody is checking), and mock-echo (a test that only
132
+ proves its own stub). Standalone-only, mixed precision by sub-check
133
+ (calibrated 2026-07-03): assertion-free and skipped are high-precision;
134
+ mock-echo is intentionally low-precision (syntactic same-literal matching,
135
+ not dataflow) — treat its output as a reviewed candidate list, not a verdict.
@@ -21,33 +21,31 @@ Use this skill when a TypeScript system needs a TLA+ model tied to code evidence
21
21
  Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md).
22
22
 
23
23
  <!-- BEGIN GENERATED SKILL COMMANDS -->
24
-
25
24
  ## Commands for this skill
26
25
 
27
- | Command | Purpose | When |
28
- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
29
- | `scip-query tla scaffold <file>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Start here for a new model: derive a draft spec, config, and mapping from indexed code. |
30
- | `scip-query tla verify <spec>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Mechanical conformance: referents, reads/writes, calls, and the model checker. |
31
- | `scip-query tla instrument <spec>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Generate a trace recorder plus wiring sites for each mapped action. |
32
- | `scip-query tla trace-check <spec> --trace <file>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Semantic conformance: check a recorded execution against the model's Next relation. |
33
- | `scip-query tla fetch-tools` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Download the pinned tla2tools.jar into the cache when the checker is unavailable. |
26
+ | Command | Purpose | When |
27
+ | --- | --- | --- |
28
+ | `scip-query tla scaffold <file>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Start here for a new model: derive a draft spec, config, and mapping from indexed code. |
29
+ | `scip-query tla verify <spec>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Mechanical conformance: referents, reads/writes, calls, and the model checker. |
30
+ | `scip-query tla instrument <spec>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Generate a trace recorder plus wiring sites for each mapped action. |
31
+ | `scip-query tla trace-check <spec> --trace <file>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Semantic conformance: check a recorded execution against the model's Next relation. |
32
+ | `scip-query tla fetch-tools` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Download the pinned tla2tools.jar into the cache when the checker is unavailable. |
34
33
 
35
34
  Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only when it is insufficient.
36
-
37
35
  <!-- END GENERATED SKILL COMMANDS -->
38
36
 
39
37
  ## Choose the Slice
40
38
 
41
39
  Model the part with the most dangerous interleavings — retries, concurrency, partial failure, money, state machines with guards. Never model a linear happy path: a model that cannot meaningfully fail verifies nothing. If the state space would exceed roughly a million states, the model is too concrete; collapse data you never branch on and replace unbounded values with small symbolic sets. `scaffold` requires the target file to own mutable module-level state (a `let`/const plus a writer function) or, failing that, a class whose instance fields a method of that same class writes; a file of pure functions or constants is rejected — pick the file that holds the state, not the file that only computes over it.
42
40
 
43
- **Known boundary: class fields on files with any indexed method are usually invisible to `scaffold`.** The write scanner can find `this.field = ...` writes fine, but the class-field fallback only ever sees candidates that `getDefinitionsForFile` actually returns and that catalog (`definition-catalog.ts`/`symbol-row-policy.ts`) deliberately drops class-member fallback rows whenever the file has any other primary-indexed (enclosing-range) definition, which any class with a constructor or a named method always has. So a concurrency class like a lock or connection pool exactly the shape this skill most wants to model will almost always report "no mutable state discovered", not because the state isn't there but because the shared definition catalog hides it one layer below scaffold. When you hit this: model by hand from `plan-context`/`trace` evidence instead of via `scaffold`, or narrow the target file so the class in question is the only indexed definition in it. Widening the catalog itself is out of scope for this skill's tooling it's a shared primitive nearly every other command depends on.
41
+ **Known boundary: files where the indexer emitted no member rows at all are invisible to `scaffold`.** `scaffold` calls `getDefinitionsForFile(db, file, { includeClassMemberFallbacks: true })`, which surfaces class-member fallback rows (`ClassName#field.` symbols with a real definition mention) alongside primary rows even when the file has other primary-indexed definitions a concurrency class like a lock, connection pool, or watcher (verified live: `Watcher` in `src/runtime/watch.ts` 26 instance fields and 10 state-writing actions discovered, previously 0) now scaffolds correctly. What remains genuinely invisible is narrower: a file where the indexer emitted **no** member row for a class at all — neither a primary `defn_enclosing_ranges` row nor a role=1 definition mention has nothing for either query to return, and `scaffold` reports "no mutable state discovered" because there is nothing in the index to find. When you hit that: model by hand from `plan-context`/`trace` evidence instead of via `scaffold`. See `docs/plans/2026-07-02-catalog-class-members.md` for the K3 survey of whether other commands (`members`, `refs`, `trace`, `health`, `dead`) should opt in too no decision has been made there yet, so this remains scaffold-only.
44
42
 
45
43
  ## Loop
46
44
 
47
45
  1. Explore the target with `scip-query plan-context <target>`, `system`, `trace`, `call-graph`, and `dataflow` until state and transitions are concrete.
48
46
  2. Run `scip-query tla scaffold <file>` to generate the draft spec, config, and mapping (`--out` must stay inside the project root). Resolve every `TODO` it emits: guards, domains, initial values. The scaffold derives _what_ changes; you supply _when_ it may. TRIAGE the output first: if the discovered variables are mostly constants and the system's real state lives in files or a database (locks, caches, published artifacts), keep the mapping referents but discard the scaffolded variable set — hand-model the protocol's conceptual state and bind it with `resource` aliases instead. `tla verify` does not detect unfilled `TODO`s and will report PASS on a placeholder model — grep the spec for `TODO` before trusting a green run.
49
47
  3. Strengthen the model per the quality rules below.
50
- 4. Run `scip-query tla verify <spec> --map <map> --config <cfg>`. Read the Proof line: every waiver must carry a reason you would defend in review.
48
+ 4. Run `scip-query tla verify <spec> --map <map> --config <cfg>`. Read the Proof line: every waiver must carry a reason you would defend in review. `--map` is usually unnecessary: if no `Spec.scip-tla.json` sits next to `Spec.tla`, `tla verify` scans sibling `*.scip-tla.json` files for one whose `module` field names this spec (the project-relative `.tla` path, bare filename, or the TLA `MODULE` identifier are all accepted) and uses it automatically, printing `(matched by module field)` — this is what makes bare `tla verify Foo.tla` work even when the only mapping on disk is named `FooHardened.scip-tla.json`. Two or more mappings naming the same module is a hard error listing every candidate; pass `--map` explicitly to disambiguate.
51
49
  5. Wire the recorder from `scip-query tla instrument`, run the existing tests with `SCIP_TLA_TRACE=<path>`, then run `scip-query tla trace-check <spec> --trace <path>`. Acceptance means the code's observed behavior is a behavior of the model; divergence names the step to investigate. Modeling a fix-vs-regression pair as two named `Next` relations in one spec (e.g. `NextCurrent`/`NextVulnerable`)? Pass `--next <operator>` to pick which one the trace must satisfy — the harness defaults to a bare `Next`, which such specs deliberately don't define.
52
50
  6. Classify every finding as code bug, model bug, mapping bug, insufficient trace/alias evidence, or accepted non-modeled behavior.
53
51
  7. Patch code, model, or mapping and rerun until only explicitly waived uncertainty remains.
@@ -88,6 +86,11 @@ A regression model is a small TLA+ module or checker config derived from a count
88
86
  "aliases": ["pid"],
89
87
  "resource": { "path": "lockPath" }
90
88
  },
89
+ "status": {
90
+ "code": ["src/queue/lock.ts/LockMetadata#lifecycleStage"],
91
+ "aliases": ["lifecycleStage"],
92
+ "selfAlias": false
93
+ },
91
94
  "phase": {
92
95
  "code": ["src/queue/lock.ts/__phase_no_stored_field__"],
93
96
  "aliases": ["__phase_unmatchable__"],
@@ -107,12 +110,18 @@ A regression model is a small TLA+ module or checker config derived from a count
107
110
  }
108
111
  ```
109
112
 
110
- `code` entries must resolve through `scip-query trace`; variables must map to value-like symbols (a const, let, field, or property holding runtime state — never a type). Waivers are per-fact and require a reason; blanket `allowUnknown` is legacy.
113
+ `code` entries must resolve through `scip-query trace`; variables must map to value-like symbols (a const, let, field, or property holding runtime state — never a type). Waivers are per-fact and require a reason; blanket `allowUnknown` is legacy. Waivers cover write facts symmetrically with reads: `actions.<name>.waive.writes` exempts `model-code-write`, `undeclared-write`, and `missing-write-evidence` findings the same way `waive.reads` exempts the read-side equivalents, and a variable-level `waive` on `actions.<name>.writes` also exempts the corresponding `model-mapping-write` mismatch against the SANY-derived model text. A waived write still shows up in the Proof line's waiver ledger with its reason — it never silently vanishes.
114
+
115
+ An action `code` entry can narrow itself to a line window, `"file#function@L<start>-L<end>"` (C3) — when several guard/branch actions share one function, whole-function `code` forces every sibling to claim every write in it; a window scopes fact collection to that sub-range instead, so each branch action attributes only its own write. The window must fall entirely inside the referent's actual resolved span or `tla verify` reports a hard `invalid-line-window` error naming the file, function, and actual span — never a silent clamp back to the whole function. Windows are line-number-brittle by design: a later refactor that shifts lines is caught loudly (the containment check plus `tla verify`'s referent resolution), not silently mis-scanned.
111
116
 
112
117
  `resource` binds a variable to filesystem state — a lock file, a published artifact — anything the model treats as owned state but that code only touches through path-taking calls, never a plain assignment. The conformance scanner classifies `writeFileSync`/`rmSync`/`renameSync`/`mkdirSync`/`unlinkSync` calls whose first argument's text contains the declared `path` as writes of the variable, and `readFileSync`/`existsSync`/`statSync` calls the same way as reads. The match is textual containment, not a resolved value — evidence tier stays `static-action`, and a resource-bound variable still needs a value-like `code` referent for the kind check.
113
118
 
114
119
  `statements` (Q2) binds a variable to SQL-backed state — prepared statements, table rows behind `db.prepare(...)`/`.exec(...)`/tagged templates. Each entry is `{ "pattern": "<substring or regex>" }`, compiled as a RegExp. Any call expression argument whose static string text (a string literal, or the static fragments of a template literal — `${...}` interpolations excluded) matches `pattern` is classified by its leading SQL verb: `INSERT`/`UPDATE`/`DELETE`/`REPLACE` is a write, `SELECT` is a read. Matching is not restricted to a callee allowlist (SQL APIs vary too much) — classification comes entirely from the matched text's leading verb. Two variables sharing a `statements` pattern is a mapping-load error, same as a shared `resource` path. Evidence tier stays `static-action`. Dynamic SQL built by string concatenation has no static text to match and still falls through to a waiver.
115
120
 
121
+ `ormCalls` (C1) binds a variable to ORM-backed state when there is no literal SQL text to match at all — Drizzle-style query builders (`db.update(t).set(...)`, `db.insert(t).values(...)`, `db.select().from(t)`, `db.delete(t)`). Each entry is `{ "table": "<identifier>", "methods"?: [...] }`. A call chain whose own method name is in the write set (`update`/`insert`/`delete` by default) or read set (`select`/`query`/`findFirst`/`findMany` by default) AND whose own table argument (or, for `select`, the `.from(t)` chain segment) names `table` attributes to the variable — matching never looks at the receiver (`db`, `tx`, ...), only the method + table-arg shape. `methods` narrows the effective set to a subset of that seven-name vocabulary; an unrecognized name fails to load. Two variables binding the same `(table, method)` pair is a mapping-load error, same category as a shared `statements` pattern — but a write-only binding and a read-only binding on the same table do not collide. Evidence tier stays `static-action`.
122
+
123
+ `variables.<v>.selfAlias: false` opts out of the automatic self-name alias (default `true`, fully backward compatible): normally a variable's own TLA+ name is always added to its alias list, which means an object-literal key or identifier that merely echoes the variable's name — but means something unrelated elsewhere in scope — becomes an unavoidable false write/read attribution. Set it `false` and give a precise, unambiguous alias instead (as `status` does above, aliased only to `lifecycleStage`); a `selfAlias: false` variable with no other alias, no `resource`, no `statements`, and no `waive` is a load error, since it would otherwise be silently unattributable.
124
+
116
125
  `variables.<v>.waive: {reason}` exempts that one variable's `missing-referent`/`invalid-referent-kind` findings — for state that genuinely has no code twin (a pure control-flow position, a derived decision, a value observable only through `process.exitCode`). It does not exempt read/write facts; those stay on the action's own `waive`. Prefer this over the old workaround of citing an unrelated real symbol just to satisfy the value-like-kind check — name a referent that plainly does not resolve (or does resolve but to the wrong kind) and waive it honestly; a reader should never have to guess that a `code[]` entry is a decoy.
117
126
 
118
127
  Top-level `"unmappedWriteScope": "actions" | "scope-files"` (default `"scope-files"`) controls how strictly `scope` is enforced: the default requires every function anywhere in `scope` that touches a modeled variable to be mapped as an action, or its write is a hard `unmapped-write` error. Set `"actions"` to opt out of that whole-file sweep when `scope` legitimately contains code the mapping was never meant to cover in full — only the per-action write/read checks still run.
@@ -122,10 +131,11 @@ Top-level `"init": { "codeRefs": ["file#function", ...], "waive"?: {"reason": ..
122
131
  ## Mapping Discipline
123
132
 
124
133
  - **Alias selection is the sharpest knife.** Never alias a variable to a ubiquitous local identifier (`connection`, `result`, `data`) — every function touching that local gets misattributed across actions. For state with no code twin, use a deliberately unmatchable alias (e.g. `evidenceRowsModelOnly`) so the static layer neither proves nor pollutes, and let the reasoned waiver carry the fact.
125
- - **Know the three state backings.** Program variables: normal aliases. Filesystem-backed state (locks, published artifacts): `resource: { "path": ... }` bindings make fs calls provable. Database/SQL-backed state (prepared statements, table rows): `statements: [{ "pattern": ... }]` bindings make it provable too (Q2)a call argument's static SQL text matching `pattern` is classified as a write or read by its leading verb. Only genuinely dynamic SQL (built by string concatenation, no static text to match) still needs a waiver naming the residual class; never fake attribution.
134
+ - **Turn off the forced self-alias when the variable's own name is a common word.** A TLA+ variable named `status`, `phase`, or `state` gets its own name auto-included as an alias by defaultand object literals elsewhere in scope (`{ status: 'ok' }` in an unrelated response shape) will match it. If the variable's own name is common enough to collide, set `selfAlias: false` and give a precise alias that names the actual stored field instead.
135
+ - **Know the four state backings.** Program variables: normal aliases. Filesystem-backed state (locks, published artifacts): `resource: { "path": ... }` bindings make fs calls provable. SQL-backed state (prepared statements, table rows behind literal SQL text): `statements: [{ "pattern": ... }]` bindings make it provable too (Q2) — a call argument's static SQL text matching `pattern` is classified as a write or read by its leading verb. ORM-backed state with no literal SQL to match (Drizzle-style query builders): `ormCalls: [{ "table": ... }]` bindings (C1) classify by the call chain's own method + table-arg shape instead. Only genuinely dynamic SQL (built by string concatenation, no static text to match) or an ORM shape the method/table matcher cannot see still needs a waiver naming the residual class; never fake attribution.
126
136
  - **Lazy initialization is Init, not an action.** A factory that lazily builds state corresponds to the model's `Init`. Top-level `"init": { "codeRefs": ["file#function", ...] }` (Q3) binds it: writes statically found inside an Init referent are Init-attributed and excluded from `unmapped-write` findings without needing `unmappedWriteScope: "actions"` as a whole-file workaround. `init.codeRefs` must not overlap any action's `code` referents — map the factory to `init`, never to an action.
127
137
  - **Design for traces early.** The trace encoder pins scalar (and scalar-array) variables only; a model whose state is all functions and tuple-sets cannot be trace-validated. If trace-check matters for the slice, add scalar projection variables (counts, last outcomes, a phase) alongside the structured state.
128
- - **Trace until covered.** One accepted trace proves one path, not the mapping. Record traces until every Current action with a code twin is exercised by at least one accepted trace, or is explicitly classified with why it cannot be (unreachable without fault injection, environment-gated, model-only). An action no trace ever exercises is a conformance claim resting on static mapping alone.
138
+ - **Trace until covered.** One accepted trace proves one path, not the mapping. Record traces until every Current action with a code twin is exercised by at least one accepted trace, or is explicitly classified with why it cannot be (unreachable without fault injection, environment-gated, model-only). An action no trace ever exercises is a conformance claim resting on static mapping alone. `tla trace-check ... --coverage` (C2) mechanizes the check: it reports steps-exercised-per-action, counted from accepted steps only (a step that never proved a legal transition — checker unavailable, or past the divergence point of a rejected trace — does not count), and names every action still unexercised. `--trace` is repeatable (merged and deduped with the mapping's own `traces` list) so recording another trace to cover a gap is additive, not a rewrite. Coverage is informational — it does not change `trace-check`'s exit code — so it never substitutes for actually closing the gap.
129
139
 
130
140
  ## Accuracy Rules
131
141
 
@@ -1,2 +0,0 @@
1
- import{b as r}from"./chunk-XHWLNQVZ.js";import{k as e}from"./chunk-R3JY4EZ4.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
- //# sourceMappingURL=chunk-2VSDXOG5.js.map
@@ -1,2 +0,0 @@
1
- import{a as f}from"./chunk-X4O6K47U.js";import{a as h}from"./chunk-WQHWIVA7.js";import{e as s,g as u}from"./chunk-HXXMPYEF.js";import{d}from"./chunk-T2FQ4GHD.js";import{x as c}from"./chunk-ISLWJ4PY.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
2
- //# sourceMappingURL=chunk-GCN2P4EJ.js.map
@@ -1,2 +0,0 @@
1
- import{c as x,f as C,g as w}from"./chunk-K2HYR5A7.js";import{b as k}from"./chunk-B75HZHUP.js";import{b as A,c as M}from"./chunk-NAH5EAZS.js";import{a as N}from"./chunk-BGBBVSH4.js";import{g as z}from"./chunk-R3JY4EZ4.js";import{d as v}from"./chunk-HXXMPYEF.js";import{b as h,i as S,m as R}from"./chunk-T2FQ4GHD.js";import{c as p}from"./chunk-GNG622H3.js";function fe(t,e={}){let{includeHomonyms:i=!1,limit:s}=e,r=F(t,e).filter(o=>o.relationship==="divergent"||i&&o.relationship==="homonym");return s?r.slice(0,s):r}function F(t,e={}){let{scope:i,minSimilarity:s=.3,scanLimit:r}=e,o=B(t,{scope:i,scanLimit:r});return $(o,{minSimilarity:s,isDelegatePair:Y(t)})}function $(t,e={}){let i=e.minSimilarity??.3,s=e.isDelegatePair,r=t.filter(n=>!ee(n.leaf)),o=[...new Set(r.map(n=>n.leaf))],a=H(o),l=[];for(let n of a){let c=r.filter(f=>n.has(f.leaf));if(c.length<2||new Set(c.map(f=>f.file)).size<2||c.every(f=>A(f.file)==="test"))continue;let m=null,b=!1,y=!1;for(let f=0;f<c.length;f+=1)for(let u=f+1;u<c.length;u+=1){let g=c[f],d=c[u];if(g.file===d.file||s?.(g,d,c)||s?.(d,g,c))continue;if(b=!0,g.normalizedBody===d.normalizedBody){y=!0;continue}let L=E(g.tokens,d.tokens);(!m||L>m.similarity)&&(m={a:g,b:d,similarity:L})}if(!b)continue;let T=[...c].sort((f,u)=>f.file.localeCompare(u.file)||f.startLine-u.startLine).map(O);if(!m){l.push({leaf:P(n),relationship:y?"identical":"homonym",maxDivergence:0,members:T});continue}let D=m.similarity>=i?"divergent":"homonym";l.push({leaf:P(n),relationship:D,maxDivergence:Math.round((1-m.similarity)*1e3)/1e3,members:T,...D==="divergent"?{firstDivergentTokens:Z(m.a.tokens,m.b.tokens)}:{}})}return l.sort((n,c)=>c.members.length-n.members.length||c.maxDivergence-n.maxDivergence||n.leaf.localeCompare(c.leaf))}function B(t,e){let i=z(t,{scope:e.scope}).filter(o=>o.isFunctionLike&&!t.isIgnored(o.relativePath)).filter(o=>!M(o.relativePath));i.sort((o,a)=>o.relativePath.localeCompare(a.relativePath)||o.startLine-a.startLine);let s=k(i,e.scanLimit),r=[];for(let o of s){let a=I(t,o);a&&r.push(a)}return r}function I(t,e){if(!e.leaf)return null;let i=C(t,e);if(!i)return null;let s=x(i);if(!s||s.length<8)return null;let r=G(i);return r.length===0?null:{leaf:e.leaf,symbol:e.symbol,shortName:v(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:N(e),normalizedBody:s,tokens:r,isThinForwarder:X(i)}}var j=/[A-Za-z_$][A-Za-z0-9_$]*|\d+(?:\.\d+)?|[^\sA-Za-z0-9_$]/g;function G(t){let e=w(t);return h(e).match(j)??[]}function O(t){return{symbol:t.symbol,shortName:t.shortName,file:t.file,startLine:t.startLine,endLine:t.endLine,loc:t.loc}}function E(t,e){let i=new Set(t),s=new Set(e);if(i.size===0&&s.size===0)return 1;if(i.size===0||s.size===0)return 0;let r=0;for(let a of i)s.has(a)&&(r+=1);let o=i.size+s.size-r;return o===0?0:r/o}function Z(t,e){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t[s]===e[s];)s+=1;let r=t.slice(s,s+6).join(" "),o=e.slice(s,s+6).join(" ");return!r&&!o?"(bodies differ only in trailing length)":`A: ${r||"(end)"} | B: ${o||"(end)"}`}function H(t){let e=new Map;for(let a of t)e.set(a,a);let i=a=>{let l=a;for(;e.get(l)!==l;)l=e.get(l);let n=a;for(;e.get(n)!==l;){let c=e.get(n);e.set(n,l),n=c}return l},s=(a,l)=>{let n=i(a),c=i(l);n!==c&&e.set(n,c)},r=new Map;for(let a of t){let l=a.slice(0,1).toLowerCase(),n=r.get(l)??[];n.push(a),r.set(l,n)}for(let a of r.values())for(let l=0;l<a.length;l+=1)for(let n=l+1;n<a.length;n+=1)W(a[l],a[n])&&s(a[l],a[n]);let o=new Map;for(let a of t){let l=i(a),n=o.get(l)??new Set;n.add(a),o.set(l,n)}return[...o.values()]}function W(t,e){return t===e||t.toLowerCase()===e.toLowerCase()?!0:t.length<8||e.length<8||Math.abs(t.length-e.length)>2?!1:K(t.toLowerCase(),e.toLowerCase(),2)}function K(t,e,i){if(Math.abs(t.length-e.length)>i)return!1;let s=Array.from({length:e.length+1},(r,o)=>o);for(let r=1;r<=t.length;r+=1){let o=[r],a=o[0];for(let l=1;l<=e.length;l+=1){let n=t[r-1]===e[l-1]?0:1,c=Math.min(s[l]+1,o[l-1]+1,s[l-1]+n);o.push(c),a=Math.min(a,c)}if(a>i)return!1;s=o}return s[e.length]<=i}function X(t){let e=h(w(t)).trim();if(!e||q.test(e))return!1;let i=U(e);return i.length===0||i.length>2?!1:Q(i[i.length-1])}var q=/\b(?:if|else|for|while|switch|try|catch|do)\b/,J=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[[^[\]]*\])*\((?:[^()]|\([^()]*\))*\)$/;function Q(t){let e=t.trim().replace(/^return\s+/,"").replace(/^await\s+/,"").replace(/;\s*$/,"").trim();return J.test(e)}function U(t){let e=[],i=0,s="";for(let r of t){if(r==="("||r==="["||r==="{"?i+=1:(r===")"||r==="]"||r==="}")&&(i=Math.max(0,i-1)),r===";"&&i===0){e.push(s),s="";continue}s+=r}return s.trim()&&e.push(s),e.map(r=>r.trim()).filter(r=>r.length>0)}var V=3;function Y(t){let e=new Map;return(i,s,r)=>{if(!i.isThinForwarder)return!1;let o=`${i.symbol}\0${s.symbol}`,a=e.get(o);if(a!==void 0)return a;let l=_(t,i,s,r,V,new Set);return e.set(o,l),l}}function _(t,e,i,s,r,o){if(r<=0||o.has(e.symbol)||(o.add(e.symbol),(S(t,e.file)??[]).filter(n=>n.line>=e.startLine&&n.line<=e.endLine&&n.calleeLeaf===i.leaf).length===0))return!1;let l=new Set(R(t,e.file).filter(n=>n.sourcePath&&(n.kind!=="namespace"||n.usedMembers.includes(i.leaf))).map(n=>n.sourcePath));if([...l].some(n=>p(n,i.file)))return!0;for(let n of s)if(!(n.symbol===e.symbol||n.symbol===i.symbol||!n.isThinForwarder)&&[...l].some(c=>p(c,n.file))&&_(t,n,i,s,r-1,o))return!0;return!1}function ee(t){return t.startsWith("<")&&t.endsWith(">")}function P(t){return[...t].sort()[0]}export{fe as a,F as b,$ as c};
2
- //# sourceMappingURL=chunk-H4LUPLEJ.js.map
@@ -1,2 +0,0 @@
1
- import{e as g,l as S,m as x}from"./chunk-T2FQ4GHD.js";import{A as m}from"./chunk-ISLWJ4PY.js";import{p as u,q as d}from"./chunk-WS3Z6W3M.js";var y={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function a(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let s=e.split(" ");if(s.length<4)return{scheme:s[0]??"",manager:s[1]??"",packageName:s[2]??"",version:"",descriptors:[],raw:e};let t=s[0],r=s[1],n=e.slice(t.length+1+r.length+1),i;if(n.startsWith("`")){let f=n.indexOf("`",1);f===-1?(i=n.slice(1),n=""):(i=n.slice(1,f),n=n.slice(f+2))}else{let f=n.indexOf(" ");f===-1?(i=n,n=""):(i=n.slice(0,f),n=n.slice(f+1))}let o,c=n.indexOf(" ");c===-1?(o=n,n=""):(o=n.slice(0,c),n=n.slice(c+1));let l=v(n);return{scheme:t,manager:r,packageName:i,version:o,descriptors:l,raw:e}}function M(e){let s=a(e);if("kind"in s)return null;for(let t=s.descriptors.length-2;t>=0;t--){let r=s.descriptors[t];if(r?.suffix==="type")return r.name}return null}function v(e){let s=[],t=0;for(;t<e.length;){if(e[t]==="["){let i=e.indexOf("]",t+1);if(i===-1){s.push({name:e.slice(t+1),suffix:"type-param"});break}s.push({name:e.slice(t+1,i),suffix:"type-param"}),t=i+1;continue}if(e[t]==="("&&(s.length===0||t===0||h(e[t-1]))){let i=e.indexOf(")",t+1);if(i!==-1&&e[i+1]!=="."){s.push({name:e.slice(t+1,i),suffix:"parameter"}),t=i+1;continue}}let r;if(e[t]==="`"){let i=e.indexOf("`",t+1);if(i===-1){r=e.slice(t+1),s.push({name:r,suffix:"term"});break}r=e.slice(t+1,i),t=i+1}else{let i=t;for(;t<e.length&&!h(e[t]);)t++;r=e.slice(i,t)}if(t>=e.length){r&&s.push({name:r,suffix:"term"});break}let n=e[t];if(n==="("){let i=e.indexOf(")",t+1);i!==-1&&e[i+1]==="."?(s.push({name:r,suffix:"method"}),t=i+2):i!==-1?(s.push({name:r,suffix:"method"}),t=i+1):(s.push({name:r,suffix:"term"}),t++)}else{let i=y[n];i&&s.push({name:r,suffix:i}),t+=1}}return s}function h(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function R(e){let s=a(e);if("kind"in s&&s.kind==="local")return`local:${s.id}`;let t=s;if(t.descriptors.length===0)return t.raw;let r=[];for(let n of t.descriptors){let i=k(n);i&&r.push(i)}return r.join(":")}function k(e){let s=e.suffix==="namespace"?F(e.name):e.name;return s?e.suffix==="method"?`${s}()`:s:""}function F(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function $(e){let s=a(e);if("kind"in s&&s.kind==="local")return s.id;let t=s;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let s=a(e);if("kind"in s&&s.kind==="local")return null;let t=s;return t.descriptors[t.descriptors.length-1]?.suffix??null}function T(e){return e.endsWith("().")||p(e)==="method"}function j(e){let s=p(e);return s==="method"?!0:s!=="term"?!1:e.endsWith("().")||!e.startsWith("scip-typescript ")?!0:!/#[A-Za-z0-9_$]+\.$/.test(e)}function I(e){return p(e)==="namespace"}var D=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function L(e){return D.test(e)}var E=new Set(["test","tests","_tests"]);function O(e){let s=a(e);if("kind"in s)return!1;for(let t=0;t<s.descriptors.length-1;t+=1){let r=s.descriptors[t];if(r?.suffix==="namespace"&&r.name&&E.has(r.name))return!0}return!1}function P(e,s){let t=a(e),r=a(s);if("kind"in t||"kind"in r)return!1;let n=t.descriptors,i=r.descriptors;if(i.length!==n.length+1)return!1;for(let o=0;o<n.length;o++){let c=n[o],l=i[o];if(c.name!==l.name||c.suffix!==l.suffix)return!1}return!0}function _(e,s){let t=a(e),r=a(s);if("kind"in t||"kind"in r)return!1;let n=t.descriptors,i=r.descriptors;if(i.length<=n.length)return!1;for(let o=0;o<n.length;o++){let c=n[o],l=i[o];if(c.name!==l.name||c.suffix!==l.suffix)return!1}return!0}function z(e){return{forFile(s,t){return b(e,s,t)},forFiles(s,t){let r=new Map;for(let n of s)r.set(n,b(e,n,t));return r}}}function b(e,s,t){let r={file:s},n=t.facts||t.identifiers;if(t.text&&(r.text=u(e,s)),t.lines&&(r.lines=d(e,s)),t.ast&&(r.ast=m(e,s)),t.imports&&(r.imports=x(e,s)),t.reexports&&(r.reexports=S(e,s)),n){let i=g(e,s),o=i.facts;t.facts&&(r.facts=o),i.unavailable&&(r.sourceFactsUnavailable=i.unavailable),t.identifiers&&o&&(r.identifiers=o.fileIdentifiers,r.identifierLineMap=o.identifierLineMap)}return r}export{z as a,a as b,M as c,R as d,$ as e,p as f,T as g,j as h,I as i,L as j,O as k,P as l,_ as m};
2
- //# sourceMappingURL=chunk-HXXMPYEF.js.map
@@ -1,3 +0,0 @@
1
- import{a as S}from"./chunk-QARYU7R3.js";import{a as y}from"./chunk-K6UI6EBZ.js";import{a as P}from"./chunk-B75HZHUP.js";import{a as x}from"./chunk-X4O6K47U.js";import{a as h,g as b}from"./chunk-NAH5EAZS.js";import{a as v}from"./chunk-BGBBVSH4.js";import{d as l,e as p,h as u}from"./chunk-HXXMPYEF.js";import{a as f,f as m,g}from"./chunk-T2FQ4GHD.js";import{q as d}from"./chunk-WS3Z6W3M.js";import{basename as L,extname as D}from"path";function H(i,e){let{scope:n,maxLoc:t=15,limit:o=30,scanLimit:s}=e??{},a=new x(i);return y({candidates:()=>A(i,a,n,t),orderCandidates:P,scanLimit:s,profile:{name:"passthrough-candidates"},prepare:r=>a.calleeMap(r,{semantic:e?.semantic!==!1}),evaluate:(r,c)=>I(i,r,c.get(r.symbolId)??[]),orderResults:(r,c)=>r.loc-c.loc||r.file.localeCompare(c.file),limit:o})}function I(i,e,n){let t=j(n);if(t.size!==1||!m(i,e.relativePath,e.startLine,e.endLine))return null;let[,o]=[...t.entries()][0],s=T(i,e,o),a=w(i,e),r=s.length>0||a.length>0?"signal":"direct";return{symbol:e.symbol,shortName:l(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:v(e),forwardsTo:o.symbol,forwardsToShort:l(o.symbol),forwardsToFile:o.file,actionTier:r,boundaryEvidence:s,publicFacadeEvidence:a,recommendation:E(r,s,a)}}function T(i,e,n){return S(i,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:l(e.symbol)},{label:"callee name",value:l(n.symbol)},{label:"passthrough module",value:L(e.relativePath,D(e.relativePath))},{label:"callee module",value:L(n.file,D(n.file))}])}function E(i,e,n){if(i==="signal"){if(n.length>0)return`Review the public API before inlining; public-facade evidence: ${n.slice(0,2).join("; ")}.`;let t=e.filter(F);return t.length>0?`Review the public API before inlining; public-surface evidence: ${t.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function w(i,e){return C(i,e)?h(i,e.relativePath)?["exported passthrough is declared on the package public surface"]:b(i,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function C(i,e){let n=d(i,e.relativePath);if(n.length===0)return!1;let t=n.slice(Math.max(0,e.startLine-2),e.startLine+1).join(`
2
- `);return M.test(t)?!0:R(n,p(e.symbol))}function R(i,e){if(!e)return!1;let n=new RegExp(`^\\s*export\\s*\\{[^}\\n]*\\b${f(e)}\\b`);return i.some(t=>n.test(t))}function F(i){return i.includes("public surface")}function j(i){let e=i.some(t=>u(t.symbol))?i.filter(t=>u(t.symbol)):i,n=new Map;for(let t of e)n.has(t.symbol)||n.set(t.symbol,t);return n}function A(i,e,n,t){return e.productionCallableDefinitions({scope:n,minLoc:3,maxLoc:t,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0}).filter(o=>!g(i,o))}var M=/^\s*export\s+(?:default\s+)?(?:(?:async\s+)?function\b|(?:const|let|var)\b)/m;export{H as a,C as b};
3
- //# sourceMappingURL=chunk-MNEJYEHW.js.map
@@ -1,102 +0,0 @@
1
- import{a as f,b as F,c as m,d as N,e as E,f as p,h as M}from"./chunk-HXXMPYEF.js";import{h as R}from"./chunk-T2FQ4GHD.js";import{b,c as D,i as _,m as L,o as h}from"./chunk-WS3Z6W3M.js";import{a as S}from"./chunk-64MNV6AB.js";import{c as g}from"./chunk-7S5E7KWT.js";function be(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
2
- FROM global_symbols gs
3
- JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
- JOIN documents d ON der.document_id = d.id
5
- WHERE ${n.where}
6
- ${e.pathExclusionsFor("d")}
7
- ${k(n.orderBy)}
8
- ${w(n.limit)}`,...n.params??[])}function De(e,n){return e.all(`SELECT
9
- gs.id,
10
- gs.symbol,
11
- c.document_id,
12
- MIN(c.start_line) AS start_line,
13
- MAX(c.end_line) AS end_line,
14
- d.relative_path,
15
- gs.display_name,
16
- gs.documentation
17
- FROM global_symbols gs
18
- JOIN mentions m ON m.symbol_id = gs.id
19
- JOIN chunks c ON m.chunk_id = c.id
20
- JOIN documents d ON c.document_id = d.id
21
- WHERE m.role = 1
22
- AND ${n.where}
23
- ${e.pathExclusionsFor("d")}
24
- GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
25
- ${k(n.orderBy)}
26
- ${w(n.limit)}`,...n.params??[])}function k(e){return e?`ORDER BY ${e}`:""}function w(e){return typeof e=="number"?`LIMIT ${e}`:""}function $(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function C(e){if(!e)return null;let n=O(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let i=e.slice(t+1);return(O(i)??i).replace(/\n/g," ")}function O(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function H(e){if(m(e.symbol)!==null)return!1;let t=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(t)}function x(e,n,t={}){let i=new Map;for(let o of n)e.length>0&&!H(o)||i.set(o.id,o);for(let o of e)i.set(o.id,o);let r=[...i.values()];return t.sort?r.sort((o,s)=>o.start_line-s.start_line||o.end_line-s.end_line||o.symbol.localeCompare(s.symbol)):r}var W=g("file-definitions",{clearGroups:["definition-catalog"]}),Y=g("file-function-like-definitions",{clearGroups:["definition-catalog"]}),T=new WeakMap;function I(e,n){return W.get(e,n,()=>{let t=v(e,n);if(t)return t;let i=B(e,n),r=D(e),o=f(e).forFile(n,{text:!0}).text;return r&&o&&P.write(e,n,b(e,n,o),{projectFingerprint:r,definitions:i.map(s=>({...s}))}),i})}function K(e,n){return Y.get(e,n,()=>{let t=v(e,n);return t?t.filter(i=>i.isFunctionLike):B(e,n,i=>i.isFunctionLike)})}var P=L({kind:"file-definitions",invalidation:h("file-definitions"),serialize:G,deserialize:U});function v(e,n){let t=D(e);if(!t)return null;let i=f(e).forFile(n,{text:!0}).text;if(!i)return null;let r=P.read(e,n,b(e,n,i));return r?q(r,t,n):null}function G(e){return JSON.stringify(e)}function U(e){try{let n=JSON.parse(e);return!_(n)||typeof n.projectFingerprint!="string"||!Array.isArray(n.definitions)?null:{projectFingerprint:n.projectFingerprint,definitions:n.definitions}}catch{return null}}function q(e,n,t){if(e.projectFingerprint!==n)return null;let i=[];for(let r of e.definitions){let o=X(r,t);if(!o)return null;i.push(o)}return i}function X(e,n){return!_(e)||typeof e.symbolId!="number"||typeof e.symbol!="string"||typeof e.documentId!="number"||typeof e.startLine!="number"||typeof e.endLine!="number"||e.relativePath!==n||typeof e.leaf!="string"||typeof e.parentTypeName!="string"&&e.parentTypeName!==null||typeof e.isFunctionLike!="boolean"||typeof e.isTypeLike!="boolean"||typeof e.kind!="number"&&e.kind!==null||typeof e.documentation!="string"&&e.documentation!==null||typeof e.enclosingSymbol!="string"&&e.enclosingSymbol!==null?null:{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,endLine:e.endLine,relativePath:e.relativePath,leaf:e.leaf,parentTypeName:e.parentTypeName,isFunctionLike:e.isFunctionLike,isTypeLike:e.isTypeLike,kind:e.kind,documentation:e.documentation,enclosingSymbol:e.enclosingSymbol}}function B(e,n,t){let i=x(Z(e,n),V(e,n),{sort:!0}).map(J);return t&&(i=i.filter(t)),j(e,n,i)}function Z(e,n){return e.all(`SELECT
27
- gs.id,
28
- gs.symbol,
29
- der.document_id,
30
- der.start_line,
31
- der.end_line,
32
- d.relative_path,
33
- gs.display_name,
34
- gs.kind,
35
- gs.documentation,
36
- gs.enclosing_symbol
37
- FROM global_symbols gs
38
- JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
39
- JOIN documents d ON der.document_id = d.id
40
- WHERE d.relative_path = ?
41
- ${e.symbolNoiseFor("gs")}
42
- ORDER BY der.start_line, der.end_line`,n)}function V(e,n){return e.all(`SELECT
43
- gs.id,
44
- gs.symbol,
45
- c.document_id,
46
- MIN(c.start_line) AS start_line,
47
- MAX(c.end_line) AS end_line,
48
- d.relative_path,
49
- gs.display_name,
50
- gs.kind,
51
- gs.documentation,
52
- gs.enclosing_symbol
53
- FROM global_symbols gs
54
- JOIN mentions m ON m.symbol_id = gs.id
55
- JOIN chunks c ON m.chunk_id = c.id
56
- JOIN documents d ON c.document_id = d.id
57
- WHERE d.relative_path = ?
58
- AND m.role = 1
59
- ${e.symbolNoiseFor("gs")}
60
- GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
61
- ORDER BY start_line, end_line`,n)}function J(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:E(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:M(e.symbol),isTypeLike:p(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function we(e,n={}){return ee(e,n.scope)}function ee(e,n){return S(e,{scope:n,includeIgnored:!1}).flatMap(t=>I(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function $e(e,n){return S(e,{scope:n,includeIgnored:!1}).flatMap(t=>K(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function Ce(e,n){let t=A(ne(e,n.scope,n.sqlPrefilter)),i=A(te(e,n.scope,n.sqlPrefilter)),r=new Set([...t.keys(),...i.keys()]),o=[];for(let s of[...r].sort()){if(e.isIgnored(s))continue;let l=x(t.get(s)??[],i.get(s)??[],{sort:!0}).filter(a=>n.symbolMatches(a.symbol));l.length!==0&&o.push(...j(e,s,l.map(J)))}return o}function ne(e,n,t){let i=n?"AND d.relative_path LIKE ?":"",r=t?`AND ${z("gs",t)}`:"",o=n?[`%${n}%`]:[];return e.all(`SELECT
62
- gs.id,
63
- gs.symbol,
64
- der.document_id,
65
- der.start_line,
66
- der.end_line,
67
- d.relative_path,
68
- gs.display_name,
69
- gs.kind,
70
- gs.documentation,
71
- gs.enclosing_symbol
72
- FROM global_symbols gs
73
- JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
74
- JOIN documents d ON der.document_id = d.id
75
- WHERE 1 = 1
76
- ${e.pathExclusionsFor("d")}
77
- ${i}
78
- ${r}
79
- ${e.symbolNoiseFor("gs")}
80
- ORDER BY d.relative_path, der.start_line, der.end_line`,...o)}function te(e,n,t){let i=n?"AND d.relative_path LIKE ?":"",r=t?`AND ${z("gs",t)}`:"",o=n?[`%${n}%`]:[];return e.all(`SELECT
81
- gs.id,
82
- gs.symbol,
83
- c.document_id,
84
- MIN(c.start_line) AS start_line,
85
- MAX(c.end_line) AS end_line,
86
- d.relative_path,
87
- gs.display_name,
88
- gs.kind,
89
- gs.documentation,
90
- gs.enclosing_symbol
91
- FROM global_symbols gs
92
- JOIN mentions m ON m.symbol_id = gs.id
93
- JOIN chunks c ON m.chunk_id = c.id
94
- JOIN documents d ON c.document_id = d.id
95
- WHERE m.role = 1
96
- ${e.pathExclusionsFor("d")}
97
- ${i}
98
- ${r}
99
- ${e.symbolNoiseFor("gs")}
100
- GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
101
- ORDER BY d.relative_path, start_line, end_line`,...o)}function ie(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function z(e,n){return n==="callable"?ie(e):re(e)}function re(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function A(e){let n=new Map;for(let t of e){let i=n.get(t.relative_path);i?i.push(t):n.set(t.relative_path,[t])}return n}function Te(e,n,t={}){if(n.length===0)return[];let i=n.flatMap(r=>I(e,r)).filter(r=>!e.isIgnored(r.relativePath));return t.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),t.sort&&(i=i.sort((r,o)=>r.relativePath.localeCompare(o.relativePath)||r.startLine-o.startLine||r.endLine-o.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:N(r.symbol),signature:$(C(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function oe(e){let n=new Map,t=e.map((i,r)=>({definition:i,index:r,span:i.endLine-i.startLine})).sort((i,r)=>i.span-r.span||i.index-r.index);for(let{definition:i}of t)for(let r=i.startLine;r<=i.endLine;r+=1)n.has(r)||n.set(r,i);return n}function Ae(e,n){let t=T.get(e);return t||(t=oe(e),T.set(e,t)),t.get(n)??null}function Qe(e,n){let t=I(e,n.relative_path).find(i=>i.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function j(e,n,t){let i=f(e).forFile(n,{text:!0}).text,r=R(e,n);return r?me(t,r,i):i?se(t,i):t}function se(e,n){let t=n.split(/\r?\n/),i=le(e,t),r=ae(e,i),o=ce(r,t);return de(e,o)}function le(e,n){let t=e.some(r=>y(r.symbol))?pe(n):null,i=new Map;for(let r of e)i.set(r.symbolId,fe(n,t,r));return i}function ae(e,n){return e.filter(t=>y(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,i)=>t.startLine-i.startLine||t.definition.startLine-i.definition.startLine||t.definition.symbol.localeCompare(i.definition.symbol))}function ce(e,n){let t=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],o=e[i+1],s=o?Math.max(r.startLine,o.startLine-1):n.length-1;t.set(r.definition.symbolId,{startLine:r.startLine,endLine:ye(n,r.definition,r.startLine,s)})}return t}function de(e,n){return e.map(t=>{let i=n.get(t.symbolId);return i?{...t,startLine:i.startLine,endLine:i.endLine}:t})}function me(e,n,t=null){let i=new Map;for(let r of n){let o=i.get(r.name);o?o.push(r):i.set(r.name,[r])}return e.map(r=>{if(!ue(r)||!r.leaf)return Q(r,t);let o=i.get(r.leaf);if(!o||o.length===0)return Q(r,t);let s=o[0],l=Math.abs(s.startLine-r.startLine);for(let a=1;a<o.length;a+=1){let c=o[a],d=Math.abs(c.startLine-r.startLine);d<l&&(s=c,l=d)}return{...r,startLine:s.startLine,endLine:s.endLine}})}function ue(e){return y(e.symbol)?!0:p(e.symbol)==="term"&&m(e.symbol)===null}function Q(e,n){if(!n||!e.leaf||p(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),o=n.split(/\r?\n/).findIndex(s=>i.test(s));return o>=0?{...e,startLine:o,endLine:o}:e}function fe(e,n,t){if(!y(t.symbol))return t.startLine;let i=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return i;let r=n.get(t.leaf);if(!r||r.length===0)return i;let o=null;for(let s of r){let l=Math.abs(s-t.startLine);(!o||l<o.distance)&&(o={line:s,distance:l})}return o?.line??i}function pe(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,o=new Map,s=(l,a)=>{let c=o.get(l);if(!c){o.set(l,[a]);return}c[c.length-1]!==a&&c.push(a)};for(let l=0;l<e.length;l+=1){let a=e[l]??"";for(let d of a.matchAll(n))d[1]&&s(d[1],l);for(let d of a.matchAll(t))d[1]&&s(d[1],l);let c=a.match(i);c?.[1]&&s(c[1],l);for(let d of a.matchAll(r))d[1]&&s(d[1],l)}return o}function ye(e,n,t,i){let r=Math.max(t,Math.min(e.length-1,i)),o=Math.max(t,Math.min(r,n.endLine)),s=0,l=0,a=!1;for(let c=t;c<=r;c+=1){let d=ge(e[c]??"");for(let u of d)u==="{"?(s+=1,a=!0):u==="}"?s=Math.max(0,s-1):u==="("?l+=1:u===")"&&(l=Math.max(0,l-1));if(a&&s===0||!a&&l===0&&c>=o)return c}return o}function ge(e){let n="",t=null,i=!1;for(let r=0;r<e.length;r+=1){let o=e[r],s=e[r+1];if(!t&&o==="/"&&s==="/"){n+=" ".repeat(e.length-r);break}if(t){if(i){i=!1,n+=" ";continue}if(o==="\\"){i=!0,n+=" ";continue}o===t&&(t=null),n+=" ";continue}if(o==='"'||o==="'"||o==="`"){t=o,n+=" ";continue}n+=o}return n}function y(e){return e.includes("().")}function Pe(e){let n=F(e);if("kind"in n)return[];let t=[];for(let i=n.descriptors.length-2;i>=0;i-=1){let r=n.descriptors[i];r?.suffix==="type"&&r.name&&t.push(r.name)}return t}export{be as a,De as b,$ as c,C as d,x as e,I as f,we as g,ee as h,$e as i,Ce as j,Te as k,oe as l,Ae as m,Qe as n,Pe as o};
102
- //# sourceMappingURL=chunk-R3JY4EZ4.js.map
@@ -1,9 +0,0 @@
1
- import{A as R,B as We,C as he,D as He,E as Je,c as je,d as De,e as _,f as Oe,g as Me,h as ve,i as B,j as $e,k as H,l as Ue,m as qe,n as Be,o as L,p as J,q as A,r as me,s as de,t as S,u as fe,v as ze,w as ge,x as Q,y as G,z as Ve}from"./chunk-ISLWJ4PY.js";import{b as W,i as Se,m as K,o as X,p as k}from"./chunk-WS3Z6W3M.js";import{b as ne}from"./chunk-GNG622H3.js";import{a as we,c as q,f as re}from"./chunk-7S5E7KWT.js";function O(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _t(e){return e.replace(/'''[\s\S]*?'''/g,w).replace(/"""[\s\S]*?"""/g,w).replace(/#.*$/gm,w).replace(/\/\/.*$/gm,w).replace(/\/\*[\s\S]*?\*\//g,w).replace(/`(?:\\[\s\S]|[^`])*`/g,w).replace(/'(?:\\.|[^'\\\r\n])*'/g,w).replace(/"(?:\\.|[^"\\\r\n])*"/g,w)}function w(e){return e.replace(/[^\r\n]/g," ")}var $n=re("stripped-lines",{clearGroups:["whole-project","source-file"]});we({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{se=null,Y=""},clearFile:()=>{se=null,Y=""}});var se=null,Y="";function Rt(e){return se===e||(se=e,Y=_t(e)),Y}function j(e,r,t){let n=Rt(e);return`${n.slice(0,r)}${" ".repeat(t-r)}${n.slice(t)}`}function x(e,r){return new RegExp(`\\b${O(r)}\\b`,"m").test(e)}function z(e,r){let t=new Set,n=new RegExp(`\\b${O(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let s of e.matchAll(n)){let o=s[1];o&&t.add(o)}return[...t]}function xe(e){let r=0;for(let t of e)t==="("&&(r+=1),t===")"&&(r-=1);return r}var Et=new Set(["identifier","type_identifier","field_identifier"]),Tt=new Set(["identifier"]),Ft=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),Lt=new Set(["rust","python"]),At=/\{([^{}]*)\}/g,kt=/\b([A-Za-z_][\w]*)\b/g;function Ke(e,r){return wt(r).has(e.type)}function Xe(e,r){return Lt.has(r)&&e.type==="string_content"}function ye(e){let r=0;for(let n of e.values()){let s=n[n.length-1];s!==void 0&&s>r&&(r=s)}let t=new Array(r+1);for(let n=0;n<=r;n+=1)t[n]=new Set;for(let[n,s]of e)for(let o of s)t[o].add(n);return t}function wt(e){return e==="rust"?Et:e==="python"?Tt:Ft}function Qe(e,r){let t=e.startPosition.row;for(let n of e.text.matchAll(At)){let s=n[1]??"";for(let o of s.matchAll(kt))o[1]&&r(o[1],t)}}var jt=[/\bdefault\s*=\s*"([^"]+)"/g,/\bwith\s*=\s*"([^"]+)"/g,/\bserialize_with\s*=\s*"([^"]+)"/g,/\bdeserialize_with\s*=\s*"([^"]+)"/g,/\bskip_serializing_if\s*=\s*"([^"]+)"/g,/\bgetter\s*=\s*"([^"]+)"/g,/\brename_all_with\s*=\s*"([^"]+)"/g,/\bschema_with\s*=\s*"([^"]+)"/g],Dt=/^#!?\[\s*serde\s*\(/,Ot=/^#!?\[\s*schemars\s*\(/,Mt=/^#!?\[\s*validate\s*\(/,vt=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function Ge(e,r,t){if(r!=="typescript"&&r!=="tsx"&&r!=="javascript"||e.type!=="call_expression")return;let n=e.childForFieldName("function")??e.namedChild(0);if(!n)return;let s=he(n);if(!s||!vt.has(s))return;let o=e.namedChildren.find(c=>c.type==="arguments");if(!o)return;let i=o.namedChild(0);if(!i||i.type!=="string")return;let a=i.namedChildren.find(c=>c.type==="string_fragment");a&&t.add(a.text)}function Ye(e,r){let t=Dt.test(e),n=Ot.test(e),s=Mt.test(e);if(!(!t&&!n&&!s))for(let o of jt){o.lastIndex=0;let i;for(;(i=o.exec(e))!==null;){let a=i[1],c=a.split("::").pop()??a;c==="is_none"&&/\bOption\b/.test(a)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(a)||c&&r.add(c)}}}function Ze(e,r){let t=new Map,n=(i,a)=>{if(i===a)return;let c=t.get(i);c||(c=new Set,t.set(i,c)),c.add(a)},s=r==="python"?new Set(["identifier"]):new Set(["type_identifier"]),o=(i,a)=>{let c=l=>{s.has(l.type)&&l.text!==a&&n(l.text,a);for(let p of l.children)c(p)};for(let l of i.children)c(l)};if(r==="rust")for(let i of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let a=i.namedChildren.find(l=>l.type==="type_identifier")?.text;if(!a)continue;let c=i.namedChildren.find(l=>l.type==="field_declaration_list"||l.type==="enum_variant_list"||l.type==="ordered_field_declaration_list");c&&o(c,a),i.type==="type_item"&&o(i,a)}else if(r==="python")for(let i of e.rootNode.descendantsOfType("class_definition")){let a=i.namedChildren.find(l=>l.type==="identifier")?.text;if(!a)continue;let c=i.namedChildren.find(l=>l.type==="block");if(c)for(let l of c.descendantsOfType("type"))for(let p of l.descendantsOfType("identifier"))p.text!==a&&n(p.text,a)}else for(let i of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let a=i.namedChildren.find(c=>c.type==="type_identifier")?.text;a&&o(i,a)}return t}var $t=new Map([["defn","function"],["defn-","function"],["defmacro","macro"],["defmacro-","macro"],["defmethod","method"]]),be=new Set(["catch","comment","def","defprotocol","defrecord","deftype","defmethod","defmacro","defmacro-","defn","defn-","do","doseq","dotimes","fn","for","if","let","loop","ns","quote","recur","throw","try","extend-protocol","extend-type","when","when-let","when-not"]);function et(e){let r=[],t=[],n=[],s=new Map,o=[],i=0,a=0,c=(l,p)=>{let u=s.get(l);if(!u){s.set(l,[p]);return}u[u.length-1]!==p&&u.push(p)};for(;a<e.length;){let l=e[a];if(l===`
2
- `){i+=1,a+=1;continue}if(/\s|,/.test(l)){a+=1;continue}if(l===";"){a=ie(e,a);continue}if(l==='"'){let h=ee(e,a,i);i=h.line,a=h.index;continue}if(l==="("||l==="["||l==="{"){o.push({kind:l,startLine:i,endLine:i,headTokens:[],tokens:[],children:[]}),a+=1;continue}if(l===")"||l==="]"||l==="}"){let h=o.pop();h&&(h.endLine=i,Ut(h,{callables:r,callSites:t,clojureMembers:n,recordIdentifier:c}),o[o.length-1]?.children.push(h)),a+=1;continue}if(Ne(l)){a+=1;continue}let p=i,u=a;for(;a<e.length&&!Ie(e[a]);)a+=1;let m=e.slice(u,a);if(!m)continue;let d={text:m,line:p};qt(o[o.length-1],d),c(N(m),p)}return{language:"clojure",callables:r,callSites:t,clojureMembers:n,typeContainerMap:new Map,identifierLineMap:s,identifiersByLine:Ht(s),fileIdentifiers:new Set(s.keys()),rustAttrReferencedNames:new Set,crossLanguageDispatchNames:new Set}}function Ut(e,r){if(e.kind!=="("||e.headTokens.length===0)return;let t=e.headTokens[0],n=N(t.text),s=$t.get(t.text);if(s){let i=e.headTokens[1];if(i){let a=N(i.text);r.recordIdentifier(a,i.line),r.callables.push({name:a,startLine:e.startLine,endLine:e.endLine,paramCount:0,params:[],paramsEndLine:i.line,isLiteralPassthrough:!1,clojureKind:s})}}if(Bt(e,r),!n||be.has(t.text)||be.has(n)||n.startsWith(":"))return;let o=Wt(t.text);r.callSites.push({calleeLeaf:o.leaf,calleeQualifier:o.qualifier,calleeText:o.text,memberAccess:!1,line:t.line})}function qt(e,r){e&&(e.headTokens.length<2&&e.headTokens.push(r),e.tokens.length<200&&e.tokens.push(r))}function Bt(e,r){let t=N(e.tokens[0]?.text??"");if(t==="defprotocol"){let n=N(e.tokens[1]?.text??"");if(!n)return;for(let s of oe(e))Z(r,n,"protocol",s,"protocol-method");return}if(t==="defrecord"||t==="deftype"){let n=N(e.tokens[1]?.text??"");if(!n)return;let s=t==="defrecord"?"record":"type",o=t==="defrecord"?"record-method":"type-method";for(let i of oe(e))Z(r,n,s,i,o);return}if(t==="extend-type"){let n=N(e.tokens[1]?.text??"");if(!n)return;for(let s of oe(e))Z(r,n,"extension",s,"extension-method");return}if(t==="extend-protocol"){let n=N(e.tokens[1]?.text??"");for(let s of oe(e)){n&&Z(r,n,"extension",s,"extension-method");let o=Vt(e,s.startLine);o&&o!==n&&Z(r,o,"extension",s,"extension-method")}}}function oe(e){return e.children.filter(zt)}function zt(e){if(e.kind!=="(")return!1;let r=N(e.tokens[0]?.text??"");return!!(r&&!be.has(r)&&!r.startsWith(":"))}function Z(e,r,t,n,s){let o=n.tokens[0],i=N(o?.text??"");!o||!i||(e.recordIdentifier(i,o.line),e.clojureMembers.push({ownerName:r,ownerKind:t,memberName:i,memberKind:s,startLine:n.startLine,endLine:n.endLine}))}function Vt(e,r){let t=null;for(let n=2;n<e.tokens.length;n+=1){let s=e.tokens[n];if(s.line>r)break;let o=N(s.text);o&&!o.startsWith(":")&&(t=o)}return t}function N(e){return e.replace(/^#?['`~@]+/,"").split("/").pop()?.replace(/^\./,"")??""}function Wt(e){let r=e.replace(/^#?['`~@]+/,""),t=r.lastIndexOf("/"),n=N(r);if(t<=0)return{leaf:n,text:r};let s=r.slice(0,t);return{leaf:n,qualifier:s,text:r}}function ie(e,r){let t=r;for(;t<e.length&&e[t]!==`
3
- `;)t+=1;return t}function ee(e,r,t){let n=r+1,s=t;for(;n<e.length;){let o=e[n];if(o==="\\"){n+=2;continue}if(o===`
4
- `&&(s+=1),n+=1,o==='"')break}return{index:n,line:s}}function Ne(e){return e==="'"||e==="`"||e==="~"||e==="@"||e==="^"||e==="#"}function Ie(e){return/\s|,/.test(e)||e==="("||e===")"||e==="["||e==="]"||e==="{"||e==="}"||e==='"'||e===";"}function Ht(e){let r=[];for(let[t,n]of e)for(let s of n)r[s]??=new Set,r[s].add(t);return r}var Jt=re("source-facts",{clearGroups:["whole-project","source-file"]}),Ce=K({kind:"source-facts",invalidation:X("source-facts"),serialize:Gt,deserialize:Yt});function T(e,r){return Kt(e,r).facts}function Kt(e,r){let t=k(e,r);if(!t)return{facts:null};let n=Xt(e,r,t);return n?Jt.get(e,r,t,()=>Qt(e,r,n,t)):{facts:null}}function Xt(e,r,t){return G(r)?Ve(e,r,t)?.language??null:Q(r)}function Qt(e,r,t,n){let s=W(e,r,n),o=Ce.read(e,r,s);if(o&&o.language===t)return{facts:o};if(t==="clojure"){let c=et(n);return Ce.write(e,r,s,c),{facts:c}}let i=R(e,r);if(!i)return{facts:null,unavailable:{language:t,reason:"parser-unavailable"}};let a=rr(i,t);return Ce.write(e,r,s,a),{facts:a}}function Gt(e){let r={language:e.language,callables:e.callables,callSites:e.callSites,clojureMembers:e.clojureMembers,typeContainerMap:[...e.typeContainerMap.entries()].map(([t,n])=>[t,[...n]]),identifierLineMap:[...e.identifierLineMap.entries()],rustAttrReferencedNames:[...e.rustAttrReferencedNames],crossLanguageDispatchNames:[...e.crossLanguageDispatchNames]};return JSON.stringify(r)}function Yt(e){try{let r=JSON.parse(e);if(r.language==="clojure"&&(r.clojureMembers===void 0||r.callSites.some(n=>n.calleeText===void 0)))return null;let t=new Map(r.identifierLineMap);return{language:r.language,callables:r.callables,callSites:r.callSites,clojureMembers:r.clojureMembers??[],typeContainerMap:new Map(r.typeContainerMap.map(([n,s])=>[n,new Set(s)])),identifierLineMap:t,identifiersByLine:ye(t),fileIdentifiers:new Set(t.keys()),rustAttrReferencedNames:new Set(r.rustAttrReferencedNames),crossLanguageDispatchNames:new Set(r.crossLanguageDispatchNames)}}catch{return null}}function Zt(e,r,t,n){let s=T(e,r);return s?tr(s,t,n)?.isLiteralPassthrough??!0:!0}function er(e,r){return r.relativePath.includes(".clj-kondo/hooks/")?!0:T(e,r.relativePath)?.callables.find(n=>n.startLine===r.startLine&&n.endLine===r.endLine)?.clojureKind==="macro"}function tr(e,r,t){return e.callables.find(n=>n.startLine===r&&n.endLine===t)??null}function rr(e,r){let t=[],n=[],s=new Set,o=new Set,i=new Map,a=(l,p)=>{let u=i.get(l);if(!u){i.set(l,[p]);return}u[u.length-1]!==p&&u.push(p)},c=l=>{let p=He(l,r);p&&t.push(p);let u=We(l,r);u&&n.push(u),Ge(l,r,o),r==="rust"&&(l.type==="attribute_item"||l.type==="inner_attribute_item")&&Ye(l.text,s),Ke(l,r)&&a(l.text,l.startPosition.row),Xe(l,r)&&Qe(l,a);for(let m of l.children)c(m)};return c(e.rootNode),{language:r,callables:t,callSites:n,clojureMembers:[],typeContainerMap:Ze(e,r),identifierLineMap:i,identifiersByLine:ye(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:s,crossLanguageDispatchNames:o}}var tt=new Set(["rust","typescript","tsx","javascript","python","clojure"]);function nr(e,r){let t=T(e,r);return!t||!tt.has(t.language)?null:t.callables.map(n=>({name:n.name,startLine:n.startLine,endLine:n.endLine}))}function sr(e,r){let t=T(e,r);return!t||!tt.has(t.language)?null:t.callSites}function or(e,r){return T(e,r)?.typeContainerMap??new Map}function ir(e,r,t={}){let n=T(e,r);if(!n)return[];let s=[];if(t.includeCrossLanguageDispatchNames)for(let o of n.crossLanguageDispatchNames)s.push({name:o,kind:"cross-language-dispatch",occurrences:1});if(t.includeRustAttributeNames&&n.language==="rust")for(let o of n.rustAttrReferencedNames)s.push({name:o,kind:"rust-attribute",occurrences:1});return s}import{basename as rt}from"path";var ar=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function y(e){let r=[],t=0,n=0;for(let s=0;s<e.length;s++){let o=e[s];(o==="{"||o==="["||o==="(")&&t++,(o==="}"||o==="]"||o===")")&&t--,o===","&&t===0&&(r.push(e.slice(n,s)),n=s+1)}return r.push(e.slice(n)),r}function b(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function g(e,r){let t=new Set,n=(s,o)=>{let i=o||r.has(s.type);!i&&ar.has(s.type)&&t.add(s.text);for(let a of s.children)n(a,i)};return n(e.rootNode,!1),t}function E(e,r,t,n,s,o,i){return{importedName:s,localName:o,sourcePath:i??S(e,n,Be(r)),kind:"named",used:x(t,o),usedMembers:[]}}function f(e,r,t,n,s="named",o={}){return{importedName:e,localName:r,sourcePath:t,kind:s,used:n.has(r),usedMembers:[],isTypeOnly:o.isTypeOnly}}function F(e,r,t,n,s="named",o=[],i={}){return{importedName:e,localName:r,sourcePath:t,kind:s,used:n,usedMembers:o,isTypeOnly:i.isTypeOnly}}function M(e,r){return{importedName:e,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function v(e,r,t={}){return{importedName:e,localName:t.localName??null,sourcePath:r,kind:"namespace",used:t.used??!0,usedMembers:t.usedMembers??[],isTypeOnly:t.isTypeOnly}}function I(e,r,t){let n=[];for(let s of e.matchAll(r)){let o=s[0];if(!o||typeof s.index!="number")continue;let i=j(e,s.index,s.index+o.length);for(let a of t(s,i))n.push(a)}return n}function C(e,r,t,n){let s=R(e,r);if(s){let o=t(s);if(o)return o}return n()}function ae(e,r,t,n){let s=R(e,r),o=Q(r),i=o?t[o]:void 0;return s&&i?i(s):n()}function nt(e,r,t){return C(e,r,n=>lr(e,r,n),()=>cr(e,r,t))}function cr(e,r,t){return I(t,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,s)=>{let o=n[1]?.trim();if(!o)return[];let i=rt(o).replace(/\.[^.]+$/,"");return[F(o,i,de(e,r,o),x(s,i))]})}function lr(e,r,t){let n=g(t,new Set(["preproc_include"])),s=[];for(let o of t.rootNode.descendantsOfType("preproc_include")){let i=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){i=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){i=c.namedChildren.find(p=>p.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=rt(i).replace(/\.[^.]+$/,"");s.push(f(i,a,de(e,r,i),n))}return s}var pr=new Set([":require",":require-macros",":use"]),Re=String.raw`A-Za-z0-9_$*+!?.<>=-`;function ot(e,r,t){let n=Nr(t);if(!n)return[];let s=br(t,n.start,n.end),o=[];for(let i of n.children.slice(2)){if(i.type!=="list"||i.children.length===0)continue;let a=P(i.children[0]);if(a){if(pr.has(a)){for(let c of dr(i.children.slice(1)))o.push(...mr(e,c,s));continue}if(a===":import")for(let c of gr(i.children.slice(1)))o.push(c)}}return o}function ur(e){return e.type==="list"&&P(e.children[0])==="ns"}function mr(e,r,t){let n=ze(e,r.namespace),s=r.alias??r.namespace,o=hr(t,s),i=[{importedName:r.namespace,localName:s,sourcePath:n,kind:"namespace",used:r.refers.length>0||r.referAll||o.length>0||xr(t,r.namespace),usedMembers:o}];r.referAll&&i.push({importedName:"*",localName:null,sourcePath:n,kind:"side-effect",used:!0,usedMembers:[]});for(let a of r.refers)i.push({importedName:a,localName:a,sourcePath:n,kind:"named",used:yr(t,a),usedMembers:[]});return i}function dr(e){return e.flatMap(r=>ce(r,null))}function ce(e,r){if(e.type==="atom")return e.text.startsWith(":")?[]:[{namespace:_e(r,e.text),alias:null,refers:[],referAll:!1}];if(e.type==="vector")return e.children.length>0&&P(e.children[0])===null?e.children.flatMap(t=>ce(t,r)):fr(e,r);if(e.type==="list"&&e.children.length>0){let t=P(e.children[0]);return t?!t||t.startsWith(":")?[]:e.children.slice(1).flatMap(n=>ce(n,_e(r,t))):e.children.flatMap(n=>ce(n,r))}return[]}function fr(e,r){let t=P(e.children[0]);if(!t||t.startsWith(":"))return[];let n={namespace:_e(r,t),alias:null,refers:[],referAll:!1};for(let s=1;s<e.children.length;s+=1){let o=P(e.children[s]);if(!o?.startsWith(":"))continue;let i=e.children[s+1];if((o===":as"||o===":as-alias")&&i){n.alias=P(i),s+=1;continue}o===":refer"&&i&&(P(i)===":all"?n.referAll=!0:(i.type==="vector"||i.type==="list")&&n.refers.push(...i.children.map(P).filter(Sr)),s+=1)}return[n]}function gr(e){let r=[];for(let t of e){if(t.type==="atom"){let s=t.text.split(".").pop()??t.text;r.push(F(s,s,null,!0));continue}if(t.type!=="vector")continue;let n=P(t.children[0]);if(n)for(let s of t.children.slice(1)){let o=P(s);o&&r.push(F(`${n}.${o}`,o,null,!0))}}return r}function _e(e,r){return e?`${e}.${r}`:r}function P(e){return e?.type==="atom"?e.text:null}function Sr(e){return!!(e&&!e.startsWith(":"))}function hr(e,r){let t=new Set,n=new RegExp(`${Ee()}${O(r)}\\s*/\\s*([${Re}]+)`,"g");for(let s of e.matchAll(n)){let o=s[1];o&&t.add(o)}return[...t]}function xr(e,r){return new RegExp(`${Ee()}${O(r)}\\s*/`,"m").test(e)}function yr(e,r){return new RegExp(`${Ee()}${O(r)}(?![${Re}])`,"m").test(e)}function Ee(){return`(?<![${Re}])`}function br(e,r,t){let n="",s=0;for(;s<e.length;){if(s>=r&&s<t){n+=e[s]===`
5
- `?`
6
- `:" ",s+=1;continue}let o=e[s];if(o===";"){let i=ie(e,s);n+=st(e.slice(s,i)),s=i;continue}if(o==='"'){let i=ee(e,s,0).index;n+=st(e.slice(s,i)),s=i;continue}n+=o,s+=1}return n}function Nr(e){let r=0;for(;r<e.length&&(r=Te(e,r),!(r>=e.length));){let t=le(e,r);if(!t){r+=1;continue}if(ur(t.form))return t.form;r=t.index}return null}function le(e,r){let t=Te(e,r);if(e.startsWith("#?@",t)||e.startsWith("#?",t))return Ir(e,t);if(e.startsWith("#_",t)){let s=le(e,t+2);return s?{form:{type:"atom",text:"",start:t,end:s.index},index:s.index}:null}for(;Ne(e[t]);)t+=1;let n=e[t];return n?n==="("?Pe(e,t,"list",")"):n==="["?Pe(e,t,"vector","]"):n==="{"?Pe(e,t,"map","}"):n==='"'?{form:{type:"atom",text:"",start:t,end:ee(e,t,0).index},index:ee(e,t,0).index}:Pr(e,t):null}function Ir(e,r){let t=e.startsWith("#?@",r)?3:2,n=le(e,r+t);return n?{form:{type:"list",children:n.form.type==="list"||n.form.type==="vector"||n.form.type==="map"?Cr(n.form.children):[],start:r,end:n.index},index:n.index}:null}function Cr(e){let r=[];for(let t=0;t<e.length;t+=2){let n=P(e[t]),s=e[t+1];n?.startsWith(":")&&s&&r.push(s)}return r}function Pe(e,r,t,n){let s=[],o=r+1;for(;o<e.length;){if(o=Te(e,o),e[o]===n)return{form:{type:t,children:s,start:r,end:o+1},index:o+1};let i=le(e,o);if(!i){o+=1;continue}i.form.type==="atom"&&i.form.text===""||s.push(i.form),o=i.index}return{form:{type:t,children:s,start:r,end:e.length},index:e.length}}function Pr(e,r){let t=r;for(;t<e.length&&!Ie(e[t]);)t+=1;return{form:{type:"atom",text:e.slice(r,t),start:r,end:t},index:t}}function Te(e,r){let t=r;for(;t<e.length;){let n=e[t];if(/\s|,/.test(n)){t+=1;continue}if(n===";"){t=ie(e,t);continue}break}return t}function st(e){return e.replace(/[^\r\n]/g," ")}function it(e,r,t){let n=[];for(let s of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=s[1]?.trim(),i=s[2]?.trim()??null,a=s[0];if(!o||!a||typeof s.index!="number")continue;let c=j(t,s.index,s.index+a.length);n.push({importedName:o,localName:i,sourcePath:fe(e,r,o),kind:i?"namespace":"side-effect",used:i?x(c,i):!0,usedMembers:i?z(c,i):[]})}return n}function at(e,r,t){let n=[];for(let s of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=s[1]?.trim();o&&n.push({specifier:o,sourcePath:fe(e,r,o)})}return n}function ct(e,r,t){return ae(e,r,{csharp:n=>Rr(e,r,n),vb:n=>_r(e,r,n)},()=>{let n=qe(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return I(t,n,(s,o)=>{let i=s[1]?.trim();if(!i)return[];let[a,c]=i.split(/\s*=\s*/),l=!!c,p=(l?c:a)?.trim()??i,u=p.split(".").pop()??p,m=l?a?.trim()??u:u;return[E(e,r,o,p,u,m,S(e,p,B))]})})}function _r(e,r,t){let n=g(t,new Set(["imports_statement"])),s=[];for(let o of t.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(m=>m.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],c=i.length>1?i[0]:null,l=a.text,p=l.split(".").pop()??l,u=c?.text??p;s.push(f(p,u,S(e,l,B),n,c?"namespace":"named"))}return s}function Rr(e,r,t){let n=g(t,new Set(["using_directive"])),s=[];for(let o of t.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,c;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],c=i[1]):c=i[i.length-1];let l=c.text,p=l.split(".").pop()??l,u=a?.text??p;s.push(f(p,u,S(e,l,B),n,a?"namespace":"named"))}return s}var Er=q("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function lt(e,r){return Er.get(e,r,()=>{let t=new Set,n=k(e,r);if(!n)return t;let o=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))t.add(i[0]);return t})}function Fe(e,r,t){return C(e,r,n=>Fr(e,r,n),()=>Tr(e,r,t))}function Tr(e,r,t){return Ur(t).flatMap(n=>qr(e,r,n.clause,n.specifier,n.start,n.end,t))}function Fr(e,r,t){let n=Lr(e,r,t),s=[];for(let o of t.rootNode.descendantsOfType("import_statement"))s.push(...Ar(e,r,t,o,n));return s}function Lr(e,r,t){let n=g(t,new Set(["import_statement"]));if(G(r))for(let s of lt(e,r))n.add(s);return n}function Ar(e,r,t,n,s){let o=Or(n);if(!o)return[];let i=L(e,r,o),a=b(n,"import_clause");return a?kr(t,a,i,s,Mr(n.text)):[M("*",i)]}function kr(e,r,t,n,s){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(wr(i.text,t,n,s));else if(i.type==="namespace_import"){let a=jr(e,i,t,n,s);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Dr(i,t,n,s));return o}function wr(e,r,t,n){return f("default",e,r,t,"default",{isTypeOnly:n})}function jr(e,r,t,n,s){let i=b(r,"identifier")?.text??"";if(!i)return null;let a=$r(e,i);return v("*",t,{localName:i,usedMembers:a,isTypeOnly:s,used:a.length>0||n.has(i)})}function Dr(e,r,t,n){let s=[];for(let o of e.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let c=i.text,l=a?.text??c;s.push(f(c,l,r,t,"named",{isTypeOnly:n||vr(o.text)}))}return s}function Or(e){let r=b(e,"string");if(!r)return null;let t=b(r,"string_fragment");return t?t.text:null}function Mr(e){return/^\s*import\s+type\b/.test(e)}function vr(e){return/^\s*type\b/.test(e.trim())}function $r(e,r){let t=new Set;for(let n of e.rootNode.descendantsOfType("member_expression")){let s=n.namedChild(0),o=n.namedChild(1);!s||!o||s.type!=="identifier"||s.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&t.add(o.text)}return[...t]}function Ur(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(t)){let o=s[0],i=s[1],a=s[2];!o||!a||typeof s.index!="number"||r.push({clause:i,specifier:a,start:s.index,end:s.index+o.length})}let n=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(n)){let o=s[0],i=s[1];!o||!i||typeof s.index!="number"||r.push({clause:null,specifier:i,start:s.index,end:s.index+o.length})}return r.sort((s,o)=>s.start-o.start)}function qr(e,r,t,n,s,o,i){let a=L(e,r,n),c=j(i,s,o);return t?Br(t).map(p=>({...p,sourcePath:a})).map(p=>{if(p.kind==="namespace"){let u=z(c,p.localName);return v(p.importedName,p.sourcePath,{localName:p.localName,usedMembers:u,used:u.length>0||x(c,p.localName),isTypeOnly:p.isTypeOnly})}return p.kind==="side-effect"?M(p.importedName,p.sourcePath):F(p.importedName,p.localName??"",p.sourcePath,p.localName?x(c,p.localName):!1,p.kind,[],{isTypeOnly:p.isTypeOnly})}):[M("*",a)]}function Br(e){let r=e.trim(),t=/^type\b/.test(r),n=r.replace(/^type\s+/,""),[s,o]=zr(n),i=[];return s&&i.push(...pt(s,t)),o&&i.push(...pt(o,t)),i}function pt(e,r){let t=e.trim();if(!t)return[];if(t.startsWith("{")){let n=t.slice(1,-1).trim();return n?y(n).map(s=>{let o=s.trim(),i=r||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[c,l]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(l??c).trim(),kind:"named",isTypeOnly:i}}):[]}return t.startsWith("* as ")?[{importedName:"*",localName:t.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:t,kind:"default",isTypeOnly:r}]}function zr(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];if(n==="{"&&r++,n==="}"&&r--,n===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function Le(e,r,t){let n=R(e,r);return n?Xr(e,r,n):Vr(e,r,t)}function Vr(e,r,t){return[...Wr(e,r,t),...Hr(e,r,t),...Jr(e,r,t)]}function Wr(e,r,t){let n=[],s=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(s)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",c=y(i).map(u=>Kr(u.trim())).filter(u=>!!u),l=V(t,o.index),p=V(t,o.index+o[0].length-1);n.push({kind:"named",sourcePath:L(e,r,a),names:c,startLine:l,endLine:p})}return n}function Hr(e,r,t){let n=[],s=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(s)){if(typeof o.index!="number")continue;let i=o[2]??"",a=V(t,o.index),c=V(t,o.index+o[0].length-1);n.push({kind:"star-as",sourcePath:L(e,r,i),names:[],startLine:a,endLine:c})}return n}function Jr(e,r,t){let n=[],s=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of t.matchAll(s)){if(typeof o.index!="number")continue;let i=o[1]??"",a=V(t,o.index),c=V(t,o.index+o[0].length-1);n.push({kind:"star",sourcePath:L(e,r,i),names:[],startLine:a,endLine:c})}return n}function Kr(e){if(!e)return null;let r=e.replace(/^type\s+/,"").trim();if(!r)return null;let t=r.match(/^(\w+)\s+as\s+(\w+)$/);if(t)return t[2]??null;let n=r.match(/^(\w+)$/);return n?n[1]??null:null}function V(e,r){let t=0;for(let n=0;n<r&&n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function Xr(e,r,t){let n=[];for(let s of t.rootNode.descendantsOfType("export_statement")){let o=Qr(e,r,s);if(o===void 0)continue;let i=s.startPosition.row,a=s.endPosition.row,c=Gr(s,o,i,a);n.push(c)}return n}function Qr(e,r,t){let n=b(t,"string");if(!n)return;let s=b(n,"string_fragment");if(s)return L(e,r,s.text)}function Gr(e,r,t,n){let s=b(e,"export_clause");if(s){let i=[];for(let a of s.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),l=a.namedChild(1);c&&i.push((l??c).text)}return{kind:"named",sourcePath:r,names:i,startLine:t,endLine:n}}return b(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:n}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:n}}function ut(e,r,t){return ae(e,r,{java:n=>Yr(e,r,n),kotlin:n=>Zr(e,r,n),scala:n=>en(e,r,n)},()=>I(t,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(n,s)=>{let o=n[1]?.trim();return o?tn(e,r,o,s):[]}))}function Yr(e,r,t){let n=g(t,new Set(["import_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(u=>u.type==="asterisk"),c=o.namedChildren.find(u=>u.type==="scoped_identifier")??o.namedChildren.find(u=>u.type==="identifier");if(!c)continue;let l=c.text;if(i){s.push(v("*",S(e,l,_)));continue}let p=l.split(".").pop()??l;s.push(f(p,p,S(e,l,_),n))}return s}function Zr(e,r,t){let n=g(t,new Set(["import_header","import_list"])),s=[];for(let o of t.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),c=o.namedChildren.find(d=>d.type==="import_alias");if(a){s.push(v("*",S(e,i.text,_)));continue}let l=i.text,p=l.split(".").pop()??l,m=c?.namedChild(0)?.text??p;s.push(f(p,m,S(e,l,_),n))}return s}function en(e,r,t){let n=g(t,new Set(["import_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(u=>u.type==="namespace_selectors"||u.type==="namespace_wildcard"),a=o.namedChildren.filter(u=>u!==i&&(u.type==="identifier"||u.type==="stable_identifier")),c=a.map(u=>u.text).join(".");if(!c)continue;if(i?.type==="namespace_wildcard"){s.push(v("*",S(e,c,_)));continue}if(i?.type==="namespace_selectors"){for(let u of i.namedChildren)if(u.type==="arrow_renamed_identifier"){let[m,d]=u.namedChildren;if(!m)continue;let h=m.text,$=d?.text??h;if(h==="_")continue;s.push(f(h,$,S(e,`${c}.${h}`,_),n))}else if(u.type==="identifier"){let m=u.text;s.push(f(m,m,S(e,`${c}.${m}`,_),n))}continue}let l=a[a.length-1]?.text??c,p=a.slice(0,-1).map(u=>u.text).join(".")||c;s.push(f(l,l,S(e,p&&a.length>1?`${p}.${l}`:c,_),n))}return s}function tn(e,r,t,n){if(t.includes("{")&&t.includes("}")){let s=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),o=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return y(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,l]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),p=c?.trim();if(!p||p==="_")return[];let u=(l??p.split(".").pop()??p).trim(),m=p==="_"?s:`${s}.${p}`.replace(/\.\./g,".");return[E(e,r,n,m,p,u)]})}return[E(e,r,n,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function dt(e,r,t){return C(e,r,n=>rn(e,r,n),()=>I(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,s)=>{let o=n[1]?.trim();return o?y(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,l]=a.split(/\s+as\s+/i),p=c?.trim()??a,u=p.split("\\").pop()??p,m=(l??u).trim();return[E(e,r,s,p,u,m,S(e,p.replace(/\\/g,"."),H))]}):[]}))}function rn(e,r,t){let n=g(t,new Set(["namespace_use_declaration"])),s=[],o=(i,a,c)=>{s.push(f(a,c,S(e,i.replace(/\\/g,"."),H),n))};for(let i of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=i.namedChildren.find(l=>l.type==="namespace_name")?.text??"";for(let l of a.namedChildren){if(l.type!=="namespace_use_clause")continue;let{importedName:p,localName:u,qualified:m}=mt(l,c);p&&o(m,p,u)}continue}for(let c of i.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:l,localName:p,qualified:u}=mt(c,"");l&&o(u,l,p)}}return s}function mt(e,r){let t=e.namedChildren.find(l=>l.type==="qualified_name"),n=e.namedChildren.filter(l=>l.type==="name"),s="";t?s=t.text:n.length>=1&&(s=n[0].text);let o=t&&n.length>0?n[n.length-1]:null,i=s.split("\\").pop()??s,a=o?.text??i,c=r?`${r}\\${s}`:s;return{importedName:i,localName:a,qualified:c}}function gt(e,r,t){return C(e,r,n=>nn(e,r,n),()=>on(t).flatMap(n=>cn(e,r,n,t)))}function nn(e,r,t){let n=g(t,new Set(["import_statement","import_from_statement"])),s=[];for(let o of t.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=ft(i);if(!a)continue;let c=J(e,r,a.qualifiedName);s.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:n.has(a.localName),usedMembers:[]})}for(let o of t.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=sn(i);if(a===null)continue;let c=J(e,r,a);for(let l=1;l<o.namedChildCount;l+=1){let p=o.namedChild(l);if(p.type==="wildcard_import"){s.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let u=ft(p);u&&s.push({importedName:u.qualifiedName,localName:u.localName,sourcePath:c,kind:"named",used:n.has(u.localName),usedMembers:[]})}}return s}function ft(e){if(e.type==="aliased_import"){let r=e.namedChild(0),t=e.namedChild(1);return!r||!t?null:{qualifiedName:r.text,localName:t.text}}if(e.type==="dotted_name"){let r=e.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function sn(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=b(e,"import_prefix")?.text??"",t=b(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function on(e){let r=e.split(`
7
- `),t=[],n=0;for(let s=0;s<r.length;s++){let o=r[s],i=o.trimStart(),a=n;if(n+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let c=o,l=a+o.length,p=xe(o);for(;s+1<r.length&&(p>0||c.trimEnd().endsWith("\\"));){s++;let m=r[s];c+=`
8
- ${m}`,l+=1+m.length,p+=xe(m),n+=m.length+1}let u=an(c);u&&t.push({...u,start:a,end:l})}return t}function an(e){let r=e.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let t=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!t)return null;let n=t[2].trim();return n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1).trim()),{kind:"from",module:t[1],clause:n}}function cn(e,r,t,n){let s=j(n,t.start,t.end),o=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return y(o).flatMap(c=>{let l=c.trim().replace(/,$/,"");if(!l)return[];let[p,u]=l.split(/\s+as\s+/),m=p.trim(),d=(u??m.split(".")[0]??m).trim(),h=J(e,r,m),$=z(s,d);return[{importedName:m,localName:d,sourcePath:h,kind:"namespace",used:x(s,d)||$.length>0,usedMembers:$}]});let i=t.module?J(e,r,t.module):null,a=[];for(let c of y(o)){let l=c.trim().replace(/,$/,"");if(!l)continue;if(l==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[p,u]=l.split(/\s+as\s+/),m=(u??p).trim();a.push({importedName:p.trim(),localName:m,sourcePath:i,kind:"named",used:x(s,m),usedMembers:[]})}return a}import{basename as ln}from"path";function St(e,r,t){return C(e,r,n=>un(e,r,n),()=>pn(e,r,t))}function pn(e,r,t){return I(t,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,s)=>{let o=n[1],i=n[2];if(!o||!i)return[];let a=o==="require_relative"?me(e,r,i):null;if(a){let c=ht(i);return[F(c,c,a,x(s,c))]}return[M(i,a)]})}function un(e,r,t){let n=g(t,new Set([])),s=[],o=new Set(["require","require_relative","load"]);for(let i of t.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let l=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!l||l.type!=="string")continue;let u=l.namedChildren.find(d=>d.type==="string_content")?.text;if(!u)continue;let m=a.text==="require_relative"?me(e,r,u):null;if(m){let d=ht(u);s.push(f(d,d,m,n))}else s.push(M(u,m))}return s}function ht(e){return Je(ln(e).replace(/\.[^.]+$/,""),/_/)}function xt(e,r,t){return C(e,r,n=>mn(e,r,n),()=>I(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,s)=>{let o=n[1]?.trim();return o?dn(e,r,o,s):[]}))}function mn(e,r,t){let n=g(t,new Set(["use_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of te(i,"")){if(!a.importedName||a.importedName==="*")continue;let c=A(e,r,a.qualifiedName)??A(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));s.push(f(a.importedName,a.localName,c,n))}}return s}function te(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:pe(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,n=t.split("::").pop()??t;return[{qualifiedName:pe(r,t),importedName:n,localName:n}]}case"scoped_use_list":{let t=e.namedChild(0),n=e.namedChild(1);if(!t||!n)return[];let s=pe(r,t.text),o=[];for(let i of n.namedChildren)o.push(...te(i,s));return o}case"use_list":{let t=[];for(let n of e.namedChildren)t.push(...te(n,r));return t}case"use_as_clause":{let t=e.namedChild(0),n=e.namedChild(1);if(!t||!n)return[];let s=te(t,r),o=n.text;return s.map(i=>({...i,localName:o}))}case"use_wildcard":{let t=e.namedChild(0),n=t?t.text:"";return[{qualifiedName:pe(r,`${n}::*`),importedName:"*",localName:"*"}]}default:return[]}}function pe(e,r){return e?r?`${e}::${r}`:e:r}function dn(e,r,t,n){let s=t.trim();if(s.includes("{")&&s.includes("}")){let p=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),u=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return y(u).flatMap(m=>{let d=m.trim();if(!d||d==="self")return[];let[h,$]=d.split(/\s+as\s+/),U=h?.trim();if(!U)return[];let Ct=($??U.split("::").pop()??U).trim(),Pt=`${p}::${U}`.replace(/::::/g,"::");return[E(e,r,n,Pt,U.split("::").pop()??U,Ct,A(e,r,p))]})}let[o,i]=s.split(/\s+as\s+/),a=o?.trim()??s,c=(i??a.split("::").pop()??a).trim(),l=A(e,r,a)??A(e,r,a.split("::").slice(0,-1).join("::"));return[E(e,r,n,a,a.split("::").pop()??a,c,l)]}function yt(e,r,t){let n=R(e,r);if(n)return fn(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&s.push(...Sn(e,r,i))}return s}function fn(e,r,t){let n=[];for(let s of t.rootNode.descendantsOfType("use_declaration")){if(!gn(s))continue;let o=s.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of te(o,""))i.importedName&&n.push(Ae(e,r,i.qualifiedName))}return n}function gn(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function Sn(e,r,t){let n=t.trim();if(n.includes("{")&&n.includes("}")){let s=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),o=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return y(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),l=`${s}::${c?.trim()??a}`.replace(/::::/g,"::");return[Ae(e,r,l)]})}return[Ae(e,r,n)]}function Ae(e,r,t){return{specifier:t,sourcePath:A(e,r,t)??A(e,r,t.split("::").slice(0,-1).join("::"))}}function D({language:e,extensions:r,imports:t,parseImports:n}){return{language:e,extensions:r,capabilities:{imports:t},parseImports:n}}function bt(e,r){let t=r.toLowerCase();for(let n of e)for(let s of n.extensions)if(t.endsWith(s))return n;return null}var hn={language:"javascript",extensions:je,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:Fe,parseReExports:Le},xn=D({language:"python",extensions:De,imports:"ast-with-regex-fallback",parseImports:gt}),yn=D({language:"jvm",extensions:_,imports:"ast-dispatch-with-regex-fallback",parseImports:ut}),bn={language:"rust",extensions:Oe,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:xt,parseExports:yt},Nn=D({language:"ruby",extensions:Me,imports:"ast-with-regex-fallback",parseImports:St}),In=D({language:"c/cpp",extensions:ve,imports:"ast-with-regex-fallback",parseImports:nt}),Cn=D({language:"dotnet",extensions:B,imports:"ast-dispatch-with-regex-fallback",parseImports:ct}),Pn={language:"dart",extensions:$e,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:it,parseExports:at},_n=D({language:"php",extensions:H,imports:"ast-with-regex-fallback",parseImports:dt}),Rn=D({language:"clojure",extensions:Ue,imports:"regex-only",parseImports:ot}),En=[hn,xn,yn,bn,Nn,In,Cn,Pn,_n,Rn];function ue(e){return bt(En,e)}var ke={clearGroups:["whole-project","source-file"]},Tn=q("source-imports",ke),Fn=q("source-exports",ke),Ln=q("source-reexports",ke),Nt=K({kind:"source-imports",invalidation:X("source-imports"),serialize:An,deserialize:kn}),It=K({kind:"source-reexports",invalidation:X("source-reexports"),serialize:wn,deserialize:jn});function zo(e,r){let t=ne(r);return Ln.get(e,t,()=>{let n=ue(t);if(!n?.parseReExports)return[];let s=k(e,t);if(!s)return[];let o=W(e,t,s),i=ge(e),a=It.read(e,t,o);if(a?.resolutionFingerprint===i)return a.reExports;let c=n.parseReExports(e,t,s);return It.write(e,t,o,{resolutionFingerprint:i,reExports:c}),c})}function Vo(e,r){let t=ne(r);return Tn.get(e,t,()=>{let n=ue(t);if(!n)return[];let s=k(e,t);if(!s)return[];let o=W(e,t,s),i=ge(e),a=Nt.read(e,t,o);if(a?.resolutionFingerprint===i)return a.imports;let c=n.parseImports(e,t,s);return Nt.write(e,t,o,{resolutionFingerprint:i,imports:c}),c})}function Wo(e,r){let t=ne(r);return Fn.get(e,t,()=>{let n=ue(t);if(!n?.parseExports)return[];let s=k(e,t);return s?n.parseExports(e,t,s):[]})}function An(e){return JSON.stringify(e)}function kn(e){try{let r=JSON.parse(e);return!Se(r)||typeof r.resolutionFingerprint!="string"||!Array.isArray(r.imports)?null:{resolutionFingerprint:r.resolutionFingerprint,imports:r.imports}}catch{return null}}function wn(e){return JSON.stringify(e)}function jn(e){try{let r=JSON.parse(e);return!Se(r)||typeof r.resolutionFingerprint!="string"||!Array.isArray(r.reExports)?null:{resolutionFingerprint:r.resolutionFingerprint,reExports:r.reExports}}catch{return null}}export{O as a,_t as b,xe as c,T as d,Kt as e,Zt as f,er as g,nr as h,sr as i,or as j,ir as k,zo as l,Vo as m,Wo as n};
9
- //# sourceMappingURL=chunk-T2FQ4GHD.js.map