scip-query 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -58
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-23FVN4Y5.js +2 -0
- package/dist/chunk-24PFLKFK.js +2 -0
- package/dist/{chunk-A2VTV2QB.js → chunk-27KPKLRJ.js} +2 -2
- package/dist/chunk-2NLK4INB.js +2 -0
- package/dist/{chunk-6K2JQ2VI.js → chunk-2XKAMW6B.js} +2 -2
- package/dist/{chunk-4DAPXOWD.js → chunk-332L7SRO.js} +2 -2
- package/dist/chunk-44JOJLMO.js +38 -0
- package/dist/{chunk-MCW36F2D.js → chunk-4EAANIWC.js} +2 -2
- package/dist/{chunk-FVIKFWUL.js → chunk-4N7LFYSD.js} +2 -2
- package/dist/{chunk-4MHT7LKP.js → chunk-5ALI77D7.js} +2 -2
- package/dist/{chunk-V76FCF5F.js → chunk-5BZOSICN.js} +2 -2
- package/dist/{chunk-IVAIPXNO.js → chunk-5D3BT4B4.js} +2 -2
- package/dist/{chunk-ADRYSISR.js → chunk-5HDYAOSF.js} +2 -2
- package/dist/{chunk-IC3RC3KJ.js → chunk-5IDEQEM4.js} +2 -2
- package/dist/{chunk-NC4IUW25.js → chunk-5VB3WU7K.js} +2 -2
- package/dist/chunk-623UQCVG.js +2 -0
- package/dist/chunk-62NMBOA5.js +2 -0
- package/dist/chunk-64LH2QUP.js +62 -0
- package/dist/{chunk-PG3ZI5IH.js → chunk-65UWNXEH.js} +1 -1
- package/dist/{chunk-OLCKSG3Y.js → chunk-6TWFT4Y5.js} +2 -2
- package/dist/chunk-6U4EODW3.js +2 -0
- package/dist/{chunk-MN75T4UB.js → chunk-6YKJSETN.js} +2 -2
- package/dist/chunk-A2GVUCZR.js +8 -0
- package/dist/{chunk-WEJYUS5O.js → chunk-ADKQX2OY.js} +2 -2
- package/dist/{chunk-YWZBKYLS.js → chunk-ADTG377O.js} +2 -2
- package/dist/chunk-ATGRITZP.js +20 -0
- package/dist/chunk-B3HMRQDA.js +2 -0
- package/dist/chunk-B75HZHUP.js +2 -0
- package/dist/chunk-BGBBVSH4.js +2 -0
- package/dist/chunk-BJ7OHKB5.js +2 -0
- package/dist/{chunk-VZRILF2Z.js → chunk-CCB45WDY.js} +2 -2
- package/dist/chunk-CFLYMEUS.js +2 -0
- package/dist/{chunk-ISCKLDSS.js → chunk-CMGOXDVP.js} +3 -3
- package/dist/chunk-DBIG4QAJ.js +2 -0
- package/dist/{chunk-4JQFTUKD.js → chunk-DMLPJ75B.js} +2 -2
- package/dist/chunk-DRU74YUM.js +71 -0
- package/dist/chunk-DTERBKUE.js +7 -0
- package/dist/{chunk-4HTJZC6G.js → chunk-E55WCTLH.js} +2 -2
- package/dist/{chunk-CMXFASVD.js → chunk-F4PKYBQB.js} +2 -2
- package/dist/{chunk-L2KFPRMA.js → chunk-FVX4GEAC.js} +2 -2
- package/dist/{chunk-AP5GTKSG.js → chunk-GTNPPGZJ.js} +2 -2
- package/dist/{chunk-ZZ2W5P3D.js → chunk-GZXXBDJA.js} +2 -2
- package/dist/chunk-HCQ7J2N5.js +3 -0
- package/dist/chunk-HQHFMPLJ.js +2 -0
- package/dist/{chunk-SCEMECW7.js → chunk-I6PTB2CM.js} +2 -2
- package/dist/{chunk-772YYL6I.js → chunk-IJYWCB57.js} +2 -2
- package/dist/chunk-JTRY2YRJ.js +2 -0
- package/dist/chunk-L77GXANO.js +6 -0
- package/dist/{chunk-R6XDPWJA.js → chunk-LT6GJ27X.js} +2 -2
- package/dist/chunk-LUBKUISI.js +2 -0
- package/dist/{chunk-ZGIK464P.js → chunk-LVYXX7ZW.js} +2 -2
- package/dist/{chunk-2WEH5QHC.js → chunk-LWPEZ4FP.js} +2 -2
- package/dist/chunk-LWWZBABT.js +2 -0
- package/dist/chunk-LXM7AHQG.js +4 -0
- package/dist/chunk-LY6NRJPJ.js +2 -0
- package/dist/chunk-LYS4SMAQ.js +2 -0
- package/dist/{chunk-BNW3Q24R.js → chunk-MESUJJVQ.js} +2 -2
- package/dist/{chunk-Y5H7TBVE.js → chunk-MHAQXOZY.js} +2 -2
- package/dist/chunk-N2T2GPYQ.js +2 -0
- package/dist/chunk-OB6PEVI3.js +2 -0
- package/dist/chunk-PNN3D4BE.js +2 -0
- package/dist/{chunk-QJWN6LA5.js → chunk-PV4CEDIL.js} +2 -2
- package/dist/chunk-QH5GTVVB.js +3 -0
- package/dist/{chunk-ZOT3WUZW.js → chunk-QOFKVNFE.js} +2 -2
- package/dist/chunk-QUKZ77A6.js +4 -0
- package/dist/chunk-R42LZMLX.js +2 -0
- package/dist/{chunk-2BMFRBV6.js → chunk-R7S3UCDR.js} +2 -2
- package/dist/chunk-RGDUIMNE.js +3 -0
- package/dist/{chunk-BGRPMGTD.js → chunk-RNLUCQJB.js} +2 -2
- package/dist/chunk-RYBMW2EN.js +2 -0
- package/dist/{chunk-VGBSY6N7.js → chunk-SA6B3EGD.js} +2 -2
- package/dist/chunk-T67R7V5I.js +2 -0
- package/dist/chunk-TMS4JPWY.js +3 -0
- package/dist/chunk-TTGWDUJ4.js +5 -0
- package/dist/chunk-TUAPDKBI.js +2 -0
- package/dist/chunk-UVK3SL4Z.js +2 -0
- package/dist/chunk-W3PQRAI4.js +2 -0
- package/dist/{chunk-PRVDXGSK.js → chunk-WWFBDM5Y.js} +2 -2
- package/dist/{chunk-AQYBOORI.js → chunk-WZVTADY7.js} +1 -1
- package/dist/chunk-XGGTESMN.js +2 -0
- package/dist/{chunk-NGI4V4AB.js → chunk-Y33GRQK6.js} +2 -2
- package/dist/{chunk-QKO474FG.js → chunk-YIE5FZAF.js} +2 -2
- package/dist/chunk-YISMWW66.js +7 -0
- package/dist/chunk-YVQUQIBM.js +5 -0
- package/dist/{chunk-6DEX3XP6.js → chunk-YYCQQBMG.js} +2 -2
- package/dist/cli.js +221 -233
- package/dist/{config-types-CGIeLEpY.d.ts → config-types-Bok4jrO3.d.ts} +29 -1
- package/dist/{db-DdTPetj5.d.ts → db-BkFlkzI3.d.ts} +1 -1
- package/dist/{health-C6r2VgpA.d.ts → health-CbGMdRPg.d.ts} +42 -3
- package/dist/index.d.ts +7 -6
- package/dist/index.js +1 -1
- package/dist/postinstall.js +2 -2
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +5 -4
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +21 -3
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +20 -4
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +4 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +10 -4
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +31 -0
- package/dist/queries/react-component-duplicates.js +2 -0
- package/dist/queries/react-hook-candidates.d.ts +34 -0
- package/dist/queries/react-hook-candidates.js +2 -0
- package/dist/queries/react-large-component-pressure.d.ts +28 -0
- package/dist/queries/react-large-component-pressure.js +2 -0
- package/dist/queries/recent-duplicates.d.ts +10 -3
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +8 -3
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +35 -0
- package/dist/queries/vue-component-duplicates.js +2 -0
- package/dist/queries/vue-composable-candidates.d.ts +34 -0
- package/dist/queries/vue-composable-candidates.js +2 -0
- package/dist/queries/vue-large-view-pressure.d.ts +31 -0
- package/dist/queries/vue-large-view-pressure.js +2 -0
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -10
- package/dist/reindex.d.ts +1 -1
- package/dist/reindex.js +22 -22
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -2
- package/docs/AGENT_GUIDE.md +353 -0
- package/docs/AI_FAILURE_MODES.md +278 -0
- package/docs/API.md +40 -0
- package/docs/COMMAND_REFERENCE.md +130 -0
- package/docs/DETECTOR_GUIDE.md +119 -0
- package/docs/accuracy-hardening-goal.md +54 -0
- package/docs/assets/scip-query-logo-dark.svg +21 -0
- package/docs/assets/scip-query-logo.svg +24 -0
- package/package.json +31 -3
- package/skills/scip-maintainability/SKILL.md +24 -3
- package/skills/scip-query/SKILL.md +2 -1
- package/skills/scip-react-maintainability/SKILL.md +114 -0
- package/skills/scip-vue-maintainability/SKILL.md +130 -0
- package/dist/chunk-5OHZEO3U.js +0 -3
- package/dist/chunk-5QJIEYFB.js +0 -34
- package/dist/chunk-6IGXZZQ4.js +0 -4
- package/dist/chunk-6QVCPUK6.js +0 -2
- package/dist/chunk-6VL4AIEO.js +0 -8
- package/dist/chunk-AI2ECT7L.js +0 -2
- package/dist/chunk-BUAC4Q4G.js +0 -2
- package/dist/chunk-BZ6LCGE6.js +0 -2
- package/dist/chunk-CO3AL7NZ.js +0 -2
- package/dist/chunk-FVVT7GV6.js +0 -4
- package/dist/chunk-HXXRN77A.js +0 -2
- package/dist/chunk-ITHQJZTG.js +0 -2
- package/dist/chunk-IW7ASGVF.js +0 -2
- package/dist/chunk-JODYQDE4.js +0 -2
- package/dist/chunk-MX6F756F.js +0 -2
- package/dist/chunk-O6KCZPJQ.js +0 -62
- package/dist/chunk-OAI5GEIN.js +0 -6
- package/dist/chunk-OH5HIAID.js +0 -4
- package/dist/chunk-OXKEUWMJ.js +0 -2
- package/dist/chunk-PBGTMPJ7.js +0 -2
- package/dist/chunk-QYKKTYBN.js +0 -6
- package/dist/chunk-R3G6ERW7.js +0 -7
- package/dist/chunk-SJR4SB7B.js +0 -2
- package/dist/chunk-SYKCO25G.js +0 -16
- package/dist/chunk-T22X7WT6.js +0 -2
- package/dist/chunk-TH4JVC34.js +0 -71
- package/dist/chunk-VDY4HYNK.js +0 -2
- package/dist/chunk-VDZIEDJB.js +0 -2
- package/dist/chunk-VDZL45XI.js +0 -2
- package/dist/chunk-WJIS6BNI.js +0 -3
- package/dist/chunk-WN5Z3UVT.js +0 -7
- package/dist/chunk-XCW7DYHM.js +0 -2
- package/dist/chunk-ZF6P2NAT.js +0 -63
package/README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/scip-query-logo-dark.svg">
|
|
4
|
+
<img src="docs/assets/scip-query-logo.svg" alt="scip-query" width="360">
|
|
5
|
+
</picture>
|
|
6
|
+
</h1>
|
|
6
7
|
|
|
7
8
|
<p align="center">
|
|
8
|
-
<strong>
|
|
9
|
+
<strong>Evidence and verification for AI coding agents.</strong>
|
|
9
10
|
</p>
|
|
10
11
|
|
|
11
12
|
<p align="center">
|
|
12
|
-
|
|
13
|
+
<em>Map the repo. Reuse what exists. Finish the refactor. Gate the diff.</em>
|
|
13
14
|
</p>
|
|
14
15
|
|
|
15
16
|
<p align="center">
|
|
@@ -19,80 +20,98 @@
|
|
|
19
20
|
<a href="https://www.apache.org/licenses/LICENSE-2.0"><img alt="License" src="https://img.shields.io/npm/l/scip-query.svg"></a>
|
|
20
21
|
</p>
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
<a href="https://www.npmjs.com/package/scip-query"><img alt="Install from npm" src="https://img.shields.io/badge/install-npm-cb3837?style=for-the-badge&logo=npm&logoColor=white"></a>
|
|
24
|
-
<a href="docs/AGENT_GUIDE.md"><img alt="Agent guide" src="https://img.shields.io/badge/agent-guide-2563eb?style=for-the-badge"></a>
|
|
25
|
-
<a href="docs/COMMAND_REFERENCE.md"><img alt="Command reference" src="https://img.shields.io/badge/command-reference-111827?style=for-the-badge"></a>
|
|
26
|
-
</p>
|
|
23
|
+
`scip-query` is a TypeScript CLI and npm package that turns SCIP indexes, git history, language-aware source analysis, and your repository's own checks into commands AI coding agents can use before, during, and after a change.
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
Agents are effective at editing the code in front of them. They are less reliable at preserving a whole-repository model across a long task: they miss existing helpers, plan from partial context, migrate only some call sites, overlook files coupled only by history, and declare a diff finished while it still adds duplication, dead code, or stale documentation.
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
`scip-query` gives them a repeatable operating loop: map the target and its blast radius, build a concrete plan from repository evidence, check for reuse before adding a concept, detect unfinished migrations and hidden coupling, and gate the final diff. It does not replace the compiler, tests, or review; it makes structural evidence and repository checks easy for agents to invoke and report.
|
|
28
|
+
|
|
29
|
+
## The Agent Loop
|
|
30
|
+
|
|
31
|
+
| Phase | What the agent needs to establish | Commands |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| Orient | What exists, where it is defined, and what depends on it | `system`, `trace`, `affected`, `plan-context` |
|
|
34
|
+
| Plan | Externally consumed surfaces, change scope, blast radius, and historical partners | `surface`, `change-surface`, `co-change` |
|
|
35
|
+
| Reuse | Whether the helper, component, hook, or composable already exists | `similar`, `recent-duplicates` |
|
|
36
|
+
| Finish | Whether an extraction or migration reached every relevant site | `incomplete-migration`, `unused-params` |
|
|
37
|
+
| Verify | What the diff affected and whether covered structural checks regressed | `diff-impact`, `doc-drift`, `diff-gate`, `health --baseline` |
|
|
38
|
+
| Clean up | Candidate removals and newly exposed dead-code cascades | `cleanup-plan --verify` |
|
|
39
|
+
|
|
40
|
+
React and Vue repositories get additional framework-aware checks for repeated component/template structure, hook/composable behavior, and large-component or large-view pressure. These extend the same reuse and completion workflow; the core graph, history, planning, cleanup, and diff-gate commands are not frontend-specific.
|
|
31
41
|
|
|
32
42
|
## Install
|
|
33
43
|
|
|
34
44
|
```bash
|
|
35
45
|
npm install -g scip-query@latest
|
|
36
|
-
scip-query
|
|
37
|
-
scip-query
|
|
46
|
+
scip-query check-deps
|
|
47
|
+
scip-query reindex
|
|
38
48
|
```
|
|
39
49
|
|
|
40
50
|
Or without a global install: `npx scip-query@latest reindex`.
|
|
41
51
|
|
|
42
|
-
##
|
|
52
|
+
## Start with One Change
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
```bash
|
|
55
|
+
# Before editing: establish structure, consumers, history, and blast radius
|
|
56
|
+
scip-query plan-context <symbol-or-file>
|
|
45
57
|
|
|
46
|
-
|
|
58
|
+
# Before creating a helper or abstraction: look for the existing concept
|
|
59
|
+
scip-query similar <closest-symbol>
|
|
47
60
|
|
|
48
|
-
|
|
61
|
+
# After an extraction or migration: find sites that still contain old logic
|
|
62
|
+
scip-query incomplete-migration
|
|
49
63
|
|
|
50
|
-
|
|
64
|
+
# Before declaring the work complete: refresh the index and gate the diff
|
|
65
|
+
scip-query reindex && scip-query diff-gate
|
|
66
|
+
```
|
|
51
67
|
|
|
52
|
-
|
|
68
|
+
For a repository-wide cleanup pass:
|
|
53
69
|
|
|
54
|
-
|
|
70
|
+
```bash
|
|
71
|
+
scip-query health
|
|
72
|
+
scip-query recent-duplicates
|
|
73
|
+
scip-query cleanup-plan --verify
|
|
74
|
+
scip-query health --write-baseline
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Evidence and Confidence
|
|
78
|
+
|
|
79
|
+
`scip-query` keeps the source and strength of each answer visible:
|
|
55
80
|
|
|
56
81
|
```mermaid
|
|
57
82
|
flowchart LR
|
|
58
|
-
A["
|
|
59
|
-
B["
|
|
60
|
-
C["
|
|
61
|
-
D
|
|
83
|
+
A["SCIP graph facts"] --> F["evidence-ranked findings"]
|
|
84
|
+
B["semantic augmentation"] --> F
|
|
85
|
+
C["source-backed candidates"] --> F
|
|
86
|
+
D["git-history signals"] --> F
|
|
87
|
+
E["repository checks"] --> F
|
|
62
88
|
```
|
|
63
89
|
|
|
64
|
-
1. **
|
|
65
|
-
2. **
|
|
66
|
-
3. **
|
|
90
|
+
1. **SCIP graph facts** for definitions, references, imports, calls, and dependencies.
|
|
91
|
+
2. **Semantic augmentation** for TypeScript where the SCIP index needs more detail.
|
|
92
|
+
3. **Source-backed candidates** for similarity, maintainability, and cleanup checks.
|
|
93
|
+
4. **Git-history signals** for churn, co-change, recency, and documentation drift.
|
|
94
|
+
5. **Repository-toolchain verification** for supported cleanup plans.
|
|
67
95
|
|
|
68
|
-
|
|
96
|
+
Heuristic findings are candidates for inspection, not proof of equivalence or bad design. Run `scip-query capabilities` to see which evidence and verification layers are available for the current repository and language.
|
|
69
97
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
| Who uses this symbol? | `scip-query trace login` |
|
|
74
|
-
| What might break if I change it? | `scip-query affected login` |
|
|
75
|
-
| Everything I need before editing this | `scip-query plan-context login` |
|
|
76
|
-
| What did my git diff affect? | `scip-query diff-impact` |
|
|
77
|
-
| How healthy is this codebase, really? | `scip-query health` |
|
|
78
|
-
| What can I delete — *prove it* | `scip-query cleanup-plan --verify` |
|
|
79
|
-
| What new code duplicates old code? | `scip-query recent-duplicates` |
|
|
80
|
-
| Which docs lie about the code now? | `scip-query doc-drift` |
|
|
81
|
-
| What changes together but isn't linked? | `scip-query co-change` |
|
|
82
|
-
| Gate an agent's diff before merging | `scip-query diff-gate` |
|
|
83
|
-
| Did the findings get worse? (CI gate) | `scip-query health --baseline` |
|
|
98
|
+
## Language and Framework Coverage
|
|
99
|
+
|
|
100
|
+
Graph navigation works through supported [SCIP](https://github.com/sourcegraph/scip) indexers. Higher-confidence augmentation and verification vary by language and project toolchain. TypeScript currently has the richest semantic augmentation. React and Vue add built-in framework-aware maintainability checks on top of the core workflow.
|
|
84
101
|
|
|
85
102
|
## Cleaning Up AI-Generated Code
|
|
86
103
|
|
|
87
|
-
|
|
104
|
+
These checks target specific ways AI-assisted development rots a codebase. The full catalog, with prevention wiring for each detector, is in [docs/AI_FAILURE_MODES.md](docs/AI_FAILURE_MODES.md):
|
|
88
105
|
|
|
89
|
-
**1. Find the echoes.** Agents re-implement helpers they didn't know existed. `recent-duplicates` makes similarity *directional* using git file ages
|
|
106
|
+
**1. Find the echoes.** Agents re-implement helpers, hooks, composables, and frontend components they didn't know existed. `recent-duplicates` makes similarity *directional* using git file ages - which side is the established original, which is the recent echo:
|
|
90
107
|
|
|
91
108
|
```
|
|
92
|
-
91% ECHO src/components/ProjectCardVisual.tsx ProjectCardVisual
|
|
109
|
+
91% ECHO react-component src/components/ProjectCardVisual.tsx ProjectCardVisual (added 62 commits ago)
|
|
93
110
|
duplicates established src/pages/HomePage.tsx RecentProjectRow()
|
|
111
|
+
basis: jsx-structure
|
|
112
|
+
shared: component:ProjectCard, prop:title, event:click
|
|
94
113
|
100% TWIN src/workflows/a.ts ensureAccessible() / src/workflows/b.ts ensureAccessible()
|
|
95
|
-
(both new
|
|
114
|
+
(both new - one agent session duplicated itself; consolidate before they diverge)
|
|
96
115
|
```
|
|
97
116
|
|
|
98
117
|
**2. Finish the half-done extraction.** Agents extract a helper, rewire one or two call sites, and abandon the rest — the extracted logic survives inline at every site they missed. `incomplete-migration` finds helpers that are new in the diff, confirms they were wired in somewhere, and lists the established sites that still contain the helper's logic but never call it (containment scoring, because a missed site holds the helper's logic *plus* its own):
|
|
@@ -112,7 +131,7 @@ staleness 94 product/domain-model.md
|
|
|
112
131
|
22 change(s) since doc update src/workflows/serviceTasks.ts (referenced by doc)
|
|
113
132
|
```
|
|
114
133
|
|
|
115
|
-
**4. Delete with
|
|
134
|
+
**4. Delete with project checks.** `cleanup-plan` runs dead-code analysis to a *fixpoint* — deleting batch 0 makes batch 1 dead, and the plan shows the cascade. `--verify` applies each batch in a throwaway git worktree and runs the supported checker detected for your project (differentially, so pre-existing errors don't drown the signal):
|
|
116
135
|
|
|
117
136
|
```
|
|
118
137
|
── Batch 0: deletable now (graph-fact, 67 LOC) ──
|
|
@@ -124,16 +143,26 @@ When verification *fails*, the errors name the exact references the static evide
|
|
|
124
143
|
|
|
125
144
|
**5. Trim speculative generality.** `unused-params` finds trailing parameters no body ever uses (the classic "options for later"), scoped to removals that are type-safe by construction.
|
|
126
145
|
|
|
127
|
-
**6.
|
|
146
|
+
**6. Keep frontend reuse honest.** React and Vue have dedicated frontend hygiene checks: component-duplicate commands compare JSX/template structure, hook/composable commands compare state/effect/request behavior, and large-component/view commands flag files that concentrate too many reasons to change. `health --full` includes these as hygiene pressure, while `incomplete-migration` remains the direct check for a hook/composable/helper extraction that was wired into some sites but not all of them.
|
|
147
|
+
|
|
148
|
+
**7. Surface hidden coupling.** `co-change` finds file pairs that repeatedly change in the same commits with *no* dependency edge — schema ↔ generated inventory ↔ doc triangles, backend schemas ↔ frontend stores, `.env.example` ↔ its parser. The reference graph cannot see these; the change graph can.
|
|
128
149
|
|
|
129
|
-
**
|
|
150
|
+
**8. Gate every diff.** `diff-gate` runs a defined set of checks scoped to what a change *introduces* — echoes of established code, incomplete migrations, missing co-change partners, docs that cite the changed files, fresh unused params, new dead symbols, baseline regressions — and exits nonzero with remediation text for each finding:
|
|
130
151
|
|
|
131
152
|
```
|
|
132
153
|
[co-change-partner] schema.prisma changed, but scripts/scope-inventory.mjs did not — they change together 12x (86% of the time)
|
|
133
154
|
-> Update scripts/scope-inventory.mjs alongside this change, or confirm the coupling no longer holds.
|
|
134
155
|
```
|
|
135
156
|
|
|
136
|
-
**
|
|
157
|
+
**9. Ratchet it in CI.** `health --write-baseline` snapshots finding identities into a committable file; `health --baseline` exits 1 on any *new* finding. "Don't get worse" is an objective gate that no score arithmetic can game.
|
|
158
|
+
|
|
159
|
+
Accepted findings can be recorded without weakening the rest of the gate:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
scip-query suppress SQABC123DEF456 --check echo --reason "intentional compatibility shim"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
This appends a reasoned entry to `.scipquery.json`; `config-validate` rejects suppressions without an identity and reason, and `diff-gate --json` reports both active and suppressed findings.
|
|
137
166
|
|
|
138
167
|
Before any edit, `plan-context <target>` bundles the structural picture — definitions, references, call graph, blast radius — plus a HISTORY section: churn, fix-commit density, and the files that usually change together with the target ("editing this usually means editing these").
|
|
139
168
|
|
|
@@ -143,7 +172,7 @@ Before any edit, `plan-context <target>` bundles the structural picture — defi
|
|
|
143
172
|
|
|
144
173
|
```
|
|
145
174
|
Codebase Health Score: 95/100
|
|
146
|
-
Risk: 95/100 (
|
|
175
|
+
Risk: 95/100 (history-correlated signals: graph facts + change graph)
|
|
147
176
|
Hygiene: 100/100 (tidiness candidates)
|
|
148
177
|
|
|
149
178
|
Score Breakdown (100 minus the following):
|
|
@@ -156,9 +185,9 @@ Axes:
|
|
|
156
185
|
Validation: flagged fix-density 0.12 vs baseline 0.20 (0.6x)
|
|
157
186
|
```
|
|
158
187
|
|
|
159
|
-
- **Risk vs. Hygiene** are separate claims: risk components are
|
|
188
|
+
- **Risk vs. Hygiene** are separate claims: risk components are tied to graph facts and repository-history signals; hygiene components are tidiness. Blending them is how scores become meaningless.
|
|
160
189
|
- **Every deduction is itemized** — the scalar is auditable, not vibes.
|
|
161
|
-
- **The validation axis is a falsifiability loop**: it measures whether flagged files actually attract more fix commits than the rest *in your repo*, per detector. On some codebases
|
|
190
|
+
- **The validation axis is a falsifiability loop**: it measures whether flagged files actually attract more fix commits than the rest *in your repo*, per detector. On some codebases a detector tracks repeated fixes; on others it is mostly noise — the tool reports which, instead of assuming.
|
|
162
191
|
- **Suppressions are data**: every `// scip-query: ignore-*` comment is a precision label, counted and reported.
|
|
163
192
|
|
|
164
193
|
## Accuracy Model
|
|
@@ -180,7 +209,7 @@ Heuristic detectors carry guardrails learned from real codebases: published `pac
|
|
|
180
209
|
|
|
181
210
|
## Agent Skills
|
|
182
211
|
|
|
183
|
-
`scip-query install-skills` symlinks ready-made skills into Claude Code, Codex, and shared agent roots (`~/.agents/skills/`) — they update automatically with the package. The `scip-query` router skill triggers on any codebase work and dispatches to the right specialist: exploring (`scip-explore`), debloating (`scip-debloat`), maintainability review (`scip-maintainability`), post-change verification (`scip-verify`), doc reconciliation (`scip-doc-reconcile`), AI-rot cleanup (`scip-ai-cleanup`), per-language guidance (`scip-language-playbook`), and grounded planning (`concrete-plan`).
|
|
212
|
+
`scip-query install-skills` symlinks ready-made skills into Claude Code, Codex, and shared agent roots (`~/.agents/skills/`) — they update automatically with the package. The `scip-query` router skill triggers on any codebase work and dispatches to the right specialist: exploring (`scip-explore`), debloating (`scip-debloat`), maintainability review (`scip-maintainability`), React frontend maintainability review (`scip-react-maintainability`), Vue frontend maintainability review (`scip-vue-maintainability`), post-change verification (`scip-verify`), doc reconciliation (`scip-doc-reconcile`), AI-rot cleanup (`scip-ai-cleanup`), per-language guidance (`scip-language-playbook`), and grounded planning (`concrete-plan`).
|
|
184
213
|
|
|
185
214
|
Then, once per project, `scip-query setup-agent` seeds the `AGENTS.md` guidance block (plus a `CLAUDE.md` import shim, since Claude Code doesn't read AGENTS.md natively), and `--git-hook` adds a pre-commit diff gate that fires no matter which agent — or human — wrote the change.
|
|
186
215
|
|
|
@@ -222,13 +251,21 @@ For Python, the executable may be `scip-python`, `scip-python-plus`, or both. `s
|
|
|
222
251
|
|
|
223
252
|
Vue single-file components are handled through the JavaScript/TypeScript indexer. `scip-query` also extracts the `<script>` or `<script setup>` block so symbol, reference, and import queries cover Vue components alongside regular `.ts` and `.js` files.
|
|
224
253
|
|
|
254
|
+
`scip-query capabilities` prints project-level readiness plus a per-language matrix for SCIP indexing, source fallback evidence, semantic provider support, cleanup detector support, and cleanup verification coverage. Use it when you need to know whether a finding is graph-backed, semantic, heuristic, or compiler-verified for the language in front of you.
|
|
255
|
+
|
|
225
256
|
## How It Works
|
|
226
257
|
|
|
227
258
|
1. A SCIP indexer analyzes source code with the actual compiler, type checker, or language server and produces `index.scip`.
|
|
228
259
|
2. The `scip` CLI converts that protobuf file to a SQLite database: `index.db`.
|
|
229
260
|
3. `scip-query` runs SQL queries, language-aware source augmentation, and git-history analysis against it.
|
|
230
261
|
|
|
231
|
-
By default, indexes live in `~/.cache/scip-query/projects/<hash>/`, keeping project directories clean. Override paths with `.scipquery.json` or `SCIP_QUERY_*` environment variables.
|
|
262
|
+
By default, indexes live in `~/.cache/scip-query/projects/<hash>/`, keeping project directories clean. Override paths with `.scipquery.json` or `SCIP_QUERY_*` environment variables. Reindexing writes per-language SCIP shards next to the SQLite index, so a mixed-language repo can reuse unchanged language outputs and rerun only the languages whose source/config inputs changed.
|
|
263
|
+
|
|
264
|
+
Most read-only commands accept `--json` and use the same envelope:
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{ "command": "fan-in", "args": ["login"], "options": { "json": true }, "result": [] }
|
|
268
|
+
```
|
|
232
269
|
|
|
233
270
|
## Configuration
|
|
234
271
|
|
|
@@ -256,6 +293,26 @@ It creates `.scipquery.json`:
|
|
|
256
293
|
}
|
|
257
294
|
```
|
|
258
295
|
|
|
296
|
+
Use `declaredCouplings` for files that intentionally form one maintenance unit.
|
|
297
|
+
These pairs are treated as structurally linked by `co-change` and health, while
|
|
298
|
+
still appearing in file-specific exploration:
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"declaredCouplings": [
|
|
303
|
+
{
|
|
304
|
+
"name": "cleanup detector family",
|
|
305
|
+
"reason": "These detectors share candidate, evidence, and health policy changes.",
|
|
306
|
+
"files": [
|
|
307
|
+
"src/queries/cleanup/dead.ts",
|
|
308
|
+
"src/queries/cleanup/isolated.ts",
|
|
309
|
+
"src/queries/cleanup/stale-abstractions.ts"
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
259
316
|
Useful environment variables:
|
|
260
317
|
|
|
261
318
|
| Variable | Purpose |
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as t}from"./chunk-
|
|
1
|
+
import{c as t}from"./chunk-DRU74YUM.js";import{writeFileSync as o}from"fs";import{workerData as s}from"worker_threads";var e=s;try{let r=t({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles,tasks:e.tasks});o(e.resultPath,JSON.stringify({ok:!0,result:r}))}catch(r){o(e.resultPath,JSON.stringify({ok:!1,error:r instanceof Error?r.message:String(r)}))}finally{let r=new Int32Array(e.sharedBuffer);Atomics.add(r,0,1),Atomics.notify(r,0)}
|
|
2
2
|
//# sourceMappingURL=augment-vue-worker.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p,c as u}from"./chunk-YVQUQIBM.js";import{c}from"./chunk-TMS4JPWY.js";import{d as a}from"./chunk-BJ7OHKB5.js";var l=a("suppression-inventory",{clearGroups:["whole-project"]});function b(e){return l.get(e,()=>f(e))}function f(e){let r={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,uncategorized:0},t=new Map,s=0;for(let o of c(e)){let n=p(e,o);if(!(!n||!n.includes("scip-query")))for(let g of n.split(/\r?\n/)){let i=u(g);if(i===null)continue;s+=1,t.set(o,(t.get(o)??0)+1);let y=d(i);r[y]+=1}}return{total:s,byCategory:r,byFile:t}}function d(e){if(!e)return"uncategorized";let r=e.toLowerCase();return r==="dead-code"?"dead":r}export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-24PFLKFK.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as k}from"./chunk-
|
|
1
|
+
import{b as k}from"./chunk-6U4EODW3.js";import{a as D}from"./chunk-W3PQRAI4.js";import{e as h,f as y}from"./chunk-L77GXANO.js";import{n as S}from"./chunk-SA6B3EGD.js";import{c as v,r as L}from"./chunk-64LH2QUP.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||h(e,l.relativePath)||y(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:v(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(h(e,t.relativePath)||y(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:v(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
4
4
|
JOIN documents d ON d.id = der.document_id
|
|
5
5
|
WHERE gs.symbol = ?
|
|
6
6
|
LIMIT 1`,n);return s?L(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=L(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-27KPKLRJ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as k,d as b}from"./chunk-YISMWW66.js";import{b as y,c as x,d as C}from"./chunk-CMGOXDVP.js";import{existsSync as v,readFileSync as M}from"fs";import{join as D}from"path";var h=/\.(?:md|mdx|rst|txt)$/i;function j(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var T=3,E=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function L(t,n={}){let{doc:i,limit:r=20,minCoupling:o=T}=n,e=I(t);if(!e)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=[];for(let s of e.docFiles){if(i!==void 0&&!s.includes(i)||i===void 0&&!R(t,s)||i!==void 0&&!v(D(t.config.projectRoot,s)))continue;let a=Math.max(0,...e.changeTimes.get(s)??[]),d=new Map,{resolved:g,broken:l}=F(t,s,e.tracked,e.trackedBySuffix,e.everSeenInHistory);for(let f of g){if(f===s||h.test(f))continue;let u=(e.changeTimes.get(f)??[]).filter(p=>p>a).length;u!==0&&d.set(f,{file:f,evidence:"reference",coChanges:0,changesSinceDocUpdate:u})}for(let[f,u]of e.coupling.get(s)??[]){if(u<o||!e.tracked.has(f))continue;let p=(e.changeTimes.get(f)??[]).filter(w=>w>a).length;if(p===0)continue;let S=d.get(f);S?(S.evidence="both",S.coChanges=u):d.set(f,{file:f,evidence:"co-change",coChanges:u,changesSinceDocUpdate:p})}if(d.size===0&&l.length===0)continue;let m=[...d.values()].sort((f,u)=>u.changesSinceDocUpdate-f.changesSinceDocUpdate);c.push({doc:s,docLastChangedAt:a,staleness:m.reduce((f,u)=>f+u.changesSinceDocUpdate,0)+l.length*10,subjects:m.slice(0,8),brokenReferences:l})}return c.sort((s,a)=>a.staleness-s.staleness),{available:!0,commitsAnalyzed:e.historyCommitCount,docsScanned:e.docFiles.length,findings:c.slice(0,r)}}function I(t){let n=k(t);if(!n)return null;let i=b(t)??new Set,r=new Map,o=new Map,e=new Set;for(let c of n.commits){let s=[...new Set(c.files)],a=s.filter(g=>h.test(g)),d=s.filter(g=>!h.test(g));for(let g of s){e.add(g);let l=r.get(g)??[];l.push(c.timestamp),r.set(g,l)}for(let g of a){let l=o.get(g);l||(l=new Map,o.set(g,l));for(let m of d)l.set(m,(l.get(m)??0)+1)}}return{changeTimes:r,coupling:o,docFiles:[...i].filter(c=>h.test(c)),everSeenInHistory:e,historyCommitCount:n.commits.length,tracked:i,trackedBySuffix:A(i)}}function O(t,n){let i=b(t)??new Set,r=A(i),o=[];for(let e of i){if(!R(t,e))continue;let{resolved:c}=F(t,e,i,r,new Set),s=[...c].filter(a=>n.has(a));s.length>0&&o.push({doc:e,cited:s.sort()})}return o}function R(t,n){return h.test(n)&&!j(n)&&v(D(t.config.projectRoot,n))}function A(t){let n=new Map;for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let e=r.slice(-o).join("/"),c=n.get(e)??[];c.push(i),n.set(e,c)}}return n}function F(t,n,i,r,o){let e=new Set,c=new Set,s=H(t,n);if(!s)return{resolved:e,broken:[]};for(let a of s){if(i.has(a)){e.add(a);continue}let d=r.get(a);if(d&&d.length===1){e.add(d[0]);continue}d&&d.length>1||o.has(a)&&c.add(a)}return{resolved:e,broken:[...c]}}function H(t,n){let i;try{i=M(D(t.config.projectRoot,n),"utf-8")}catch{return null}let r=y(t,n,i),o=x(t,"doc-path-tokens",n,r);if(o!==null)try{return JSON.parse(o)}catch{}let e=[...new Set([...i.matchAll(E)].map(c=>c[0].replace(/^\.?\//,"")))];return C(t,"doc-path-tokens",n,r,JSON.stringify(e)),e}export{j as a,L as b,O as c};
|
|
2
|
+
//# sourceMappingURL=chunk-2NLK4INB.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _}from"./chunk-
|
|
1
|
+
import{a as _}from"./chunk-W3PQRAI4.js";import{c as u}from"./chunk-L77GXANO.js";import{b as l,c as d}from"./chunk-QUKZ77A6.js";import{c as a,e as m}from"./chunk-64LH2QUP.js";import{a as s}from"./chunk-NN3O7TPH.js";function A(e,o={}){let{scope:n,limit:r}=o,t=new _(e),i=h([...b(e,n),...g(e,t,n)]);return y(i),r?i.slice(0,r):i}function b(e,o){let n=[];for(let r of f(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||u(e,r.barrel_path))continue;let t=R(e,r),i=t?.barrel_consumers??0,c=t?.direct_consumers??0;i!==0||c!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:a(r.symbol),originalFile:r.original_path,barrelConsumers:i,directConsumers:c})}return n}function f(e,o){let n=o?`AND barrel_d.relative_path LIKE '%${o}%'`:"";return e.all(`SELECT DISTINCT
|
|
2
2
|
barrel_d.id AS barrel_doc_id,
|
|
3
3
|
barrel_d.relative_path AS barrel_path,
|
|
4
4
|
gs.id AS symbol_id,
|
|
@@ -58,4 +58,4 @@ import{a as _}from"./chunk-IW7ASGVF.js";import{c as u}from"./chunk-QYKKTYBN.js";
|
|
|
58
58
|
${e.pathExclusionsFor("consumer_d")}
|
|
59
59
|
GROUP BY consumer_d.id
|
|
60
60
|
)`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function g(e,o,n){let r=[];for(let t of E(e,n))p(e,t,t)>0||r.push(...S(e,o,t));return r}function E(e,o){return s(e,{scope:o,includeIgnored:!1}).filter(n=>d(e,n).length>0)}function S(e,o,n){return d(e,n).filter(r=>r.sourcePath&&!e.isIgnored(r.sourcePath)).flatMap(r=>x(e,o,n,r.sourcePath))}function x(e,o,n,r){let t=N(o,r);return t?[{barrelFile:n,symbol:t.symbol,shortName:a(t.symbol),originalFile:r,barrelConsumers:0,directConsumers:p(e,r,n)}]:[]}function p(e,o,n){let r=new Set;for(let t of s(e,{includeIgnored:!1}))if(t!==n)for(let i of l(e,t))i.sourcePath===o&&r.add(t);return r.size}function N(e,o){let n=e.definitionsForFile(o);return n.find(r=>m(r.symbol)==="method")??n[0]??null}function h(e){let o=new Set,n=[];for(let r of e){let t=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(t)||(o.add(t),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{A as a};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-2XKAMW6B.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as y}from"./chunk-5D3BT4B4.js";function R(D,k={}){let{limit:x=10,scope:M,minDepth:v=3}=k,a=y(D,M),u=new Map,c=[],l=new Map,r=new Map,g=new Set,f=[],h=0;for(let t of a.keys()){if(l.has(t))continue;let n=[],s=(a.get(t)??new Set).values();for(l.set(t,h),r.set(t,h),h+=1,f.push(t),g.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let d=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(d)))}let o=e.iter.next();if(o.done){if(r.get(e.node)===l.get(e.node)){let d=[];for(;;){let p=f.pop();if(g.delete(p),d.push(p),u.set(p,c.length),p===e.node)break}c.push(d)}n.pop();continue}let i=o.value;if(l.has(i))g.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,h),r.set(i,h),h+=1,f.push(i),g.add(i);let d=(a.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:d,pendingChild:null})}}}let m=new Map,w=new Array(c.length);for(let t=0;t<c.length;t++)w[t]=c[t].length,m.set(t,new Set);for(let[t,n]of a){let s=u.get(t);for(let e of n){let o=u.get(e);o!==s&&m.get(s).add(o)}}let S=new Array(c.length),I=new Array(c.length);for(let t=0;t<c.length;t++){let n=[],s=0;for(let e of m.get(t)){let o=I[e];o>s&&(s=o,n=S[e])}S[t]=[t,...n],I[t]=w[t]+s}function A(t){return S[t]}let F=c.map(t=>[...t].sort()),C=new Set,b=[];for(let t=0;t<c.length;t++){let n=A(t),s=[];for(let o of n)s.push(...F[o]);if(s.length<v)continue;let e=s.join(" ");C.has(e)||(C.add(e),b.push({chain:s,depth:s.length}))}return b.sort((t,n)=>n.depth-t.depth),b.slice(0,x)}export{R as a};
|
|
2
|
+
//# sourceMappingURL=chunk-332L7SRO.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{b as j,g as G,h as J,i as B,n as Q}from"./chunk-SA6B3EGD.js";import{a as W,b as U,d as K,f as q}from"./chunk-QH5GTVVB.js";import{a as O}from"./chunk-5D3BT4B4.js";import{d as T,f as x,r as P,s as F,v as H,w as $}from"./chunk-64LH2QUP.js";import{d as E}from"./chunk-T67R7V5I.js";import{a as A}from"./chunk-HCQ7J2N5.js";import{a as I}from"./chunk-YVQUQIBM.js";import{a as v,b as M,e as k,f as N}from"./chunk-CMGOXDVP.js";import{c as L,d as D}from"./chunk-BJ7OHKB5.js";function Le(e,n,l={}){let o=Y(e,[n],{additive:l.additive,semantic:l.semantic}),s=l.callableOnly?(o.get(n.symbolId)??[]).filter(c=>x(c.symbol)):o.get(n.symbolId)??[];return typeof l.limit=="number"?s.slice(0,l.limit):s}function De(e,n,l={}){let o=ne(e)?oe(e,n,{semantic:l.semantic!==!1}):te(e).get(n.symbolId)??[];return typeof l.limit=="number"?o.slice(0,l.limit):o}var X=D("caller-rows",{clearGroups:["whole-project"]}),ee=2e4;function ne(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>ee}function te(e){return X.get(e,()=>{let n=F(e),l=Y(e,n),o=new Map;for(let i of n)o.set(i.symbol,i.symbolId);let s=new Map,c=new Map;for(let i of n){let a=l.get(i.symbolId);if(!(!a||a.length===0))for(let d of a){let r=o.get(d.symbol);if(r===void 0||r===i.symbolId)continue;let m=s.get(r);m||(m=[],s.set(r,m),c.set(r,new Set));let u=`${i.symbol}|${i.relativePath}`;c.get(r).has(u)||(c.get(r).add(u),m.push({symbol:i.symbol,file:i.relativePath,source:"caller-map-inversion"}))}}return s})}function oe(e,n,l){let o=[],s=new Set,c=a=>{if(a.symbol===n.symbol)return;let d=`${a.symbol}|${a.file}`;s.has(d)||(s.add(d),o.push(a))};for(let a of Q(e,n))a.file!==n.relativePath&&c({symbol:a.enclosingSymbol??a.file,file:a.file,source:"resolved-reference"});let i=l.semantic?ie(e,n):null;if(i)for(let a of K(e,i)){if(a.file===n.relativePath||e.isIgnored(a.file))continue;let d=$(P(e,a.file),a.line);c({symbol:d?.symbol??a.file,file:a.file,source:"semantic-reference"})}return o}function ie(e,n){return e.get(`SELECT
|
|
2
|
+
d.id AS documentId,
|
|
3
|
+
gs.id AS symbolId,
|
|
4
|
+
gs.symbol,
|
|
5
|
+
d.relative_path AS relativePath,
|
|
6
|
+
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
+
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
+
NULL AS parentTypeName,
|
|
10
|
+
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
+
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
+
gs.kind AS kind,
|
|
13
|
+
gs.documentation AS documentation,
|
|
14
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
+
FROM global_symbols gs
|
|
16
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
+
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
+
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
19
|
+
WHERE gs.id = ?
|
|
20
|
+
LIMIT 1`,n.symbolId)??null}function Y(e,n,l={}){if(n.length===0)return new Map;let o=l.additive??!1,s=[],c=[];for(let m of n)A(m.relativePath)&&E(e,m.relativePath)!==null?s.push(m):c.push(m);let i=new Map,a=new Map,d=m=>{for(let[u,t]of m){let b=i.get(u);b||(b=[],i.set(u,b));let p=a.get(u);p||(p=new Set,a.set(u,p));for(let g of t){let h=`${g.symbol}|${g.chunkId}`;p.has(h)||(p.add(h),b.push(g))}}};s.length>0&&d(re(e,s)),l.semantic!==!1&&d(fe(le(e,n)));let r=o?n:c;return r.length>0&&d(ue(e,r)),i}function le(e,n){let l=new Map,o=[],s=[];for(let i of n){if(!W(i.relativePath))continue;let a=I(e,i.relativePath);if(!a){s.push(i);continue}let d=M(e,i.relativePath,a),r=ce(e,i.relativePath),m=k(e,i.relativePath,i.symbol,d,r);if(m!==null){let u=se(m);if(u){u.length>0&&l.set(i.symbolId,u);continue}}o.push({def:i,contentHash:d,depsDigest:r})}if(o.length===0&&s.length===0)return l;let c=q(e,[...s,...o.map(i=>i.def)]);for(let[i,a]of c)l.set(i,a);return U(e).availability().available&&N(e,o.map(i=>({relativePath:i.def.relativePath,symbol:i.def.symbol,contentHash:i.contentHash,depsDigest:i.depsDigest,payload:JSON.stringify(c.get(i.def.symbolId)??[])}))),l}function se(e){try{return JSON.parse(e)}catch{return null}}var ae=L("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function ce(e,n){return ae.get(e,n,()=>{let o=[...O(e).get(n)??[]].sort().map(s=>`${s}:${M(e,s,I(e,s))}`);return v(o.join("|"))})}function re(e,n){let l=new Map,o=me(n,l),s=B(e);for(let[c,i]of o){let a=E(e,c);if(!a)continue;let d=H(i);for(let r of a){let m=d.get(r.line);if(!m)continue;let u=de(e,c,s,r.calleeLeaf,r.memberAccess);u&&u.symbol!==m.symbol&&l.get(m.symbolId).push({symbol:u.symbol,file:u.file,chunkId:r.line,source:"ast-callsite"})}}return l}function me(e,n){let l=new Map;for(let o of e){let s=l.get(o.relativePath);s?s.push(o):l.set(o.relativePath,[o]),n.set(o.symbolId,[])}for(let o of l.values())o.sort((s,c)=>s.endLine-s.startLine-(c.endLine-c.startLine));return l}function de(e,n,l,o,s){let c=G(n,l.get(o)??[]);return c.length===0?null:J(e,n,c,s)}function ue(e,n){if(n.length===0)return new Map;let o=R(n.map(t=>t.documentId)).flatMap(t=>e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
21
|
+
FROM mentions m
|
|
22
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
23
|
+
WHERE m.role != 1
|
|
24
|
+
AND c.document_id IN (${t.map(()=>"?").join(",")})`,...t)),s=new Map;for(let t of o)s.has(t.document_id)||s.set(t.document_id,[]),s.get(t.document_id).push(t);let i=R(o.map(t=>t.symbol_id)).flatMap(t=>e.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
25
|
+
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
26
|
+
FROM global_symbols gs
|
|
27
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
28
|
+
LEFT JOIN (
|
|
29
|
+
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
30
|
+
FROM mentions m
|
|
31
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
32
|
+
WHERE m.role = 1
|
|
33
|
+
AND m.symbol_id IN (${t.map(()=>"?").join(",")})
|
|
34
|
+
GROUP BY m.symbol_id
|
|
35
|
+
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
|
+
WHERE gs.id IN (${t.map(()=>"?").join(",")})`,...t,...t)),a=R([...n.map(t=>t.documentId),...i.flatMap(t=>t.document_id===null?[]:[t.document_id])]),d=new Map(a.flatMap(t=>e.all(`SELECT id, relative_path FROM documents
|
|
37
|
+
WHERE id IN (${t.map(()=>"?").join(",")})`,...t).map(b=>[b.id,b.relative_path]))),r=new Map;for(let t of i)r.has(t.symbol_id)||r.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?d.get(t.document_id)??"":""});let m=new Map,u=d;for(let t of n){let b=s.get(t.documentId)??[],p=new Set,g=[],h=null,Z=()=>{if(h)return h;let f=u.get(t.documentId)??"",y=new Set;if(f){let _=j(e,f),C=Math.max(0,t.startLine),w=Math.min(_.length-1,t.endLine);for(let S=C;S<=w;S+=1)for(let z of _[S])y.add(z)}return h=y,y};for(let f of b){if(f.symbol_id===t.symbolId)continue;let y=r.get(f.symbol_id);if(!y)continue;if(!(f.start_line>=t.startLine&&f.end_line<=t.endLine)){if(!(f.start_line<=t.endLine&&f.end_line>=t.startLine))continue;let S=T(y.symbol);if(!S||!Z().has(S))continue}let C=`${y.symbol}|${f.chunk_id}`;p.has(C)||(p.add(C),g.push({...y,chunkId:f.chunk_id,source:"scip-chunk"}))}m.set(t.symbolId,g)}return m}var V=500;function R(e){let n=[...new Set(e)],l=[];for(let o=0;o<n.length;o+=V)l.push(n.slice(o,o+V));return l}function fe(e){let n=new Map;for(let[l,o]of e){let s=[];for(let c of o)s.push({symbol:c.symbol,file:c.file,chunkId:-1,source:"semantic-callee"});n.set(l,s)}return n}export{Le as a,De as b,Y as c};
|
|
38
|
+
//# sourceMappingURL=chunk-44JOJLMO.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f}from"./chunk-5BZOSICN.js";import{a as m}from"./chunk-W3PQRAI4.js";import{a as d}from"./chunk-BGBBVSH4.js";import{c as u}from"./chunk-64LH2QUP.js";function w(n,a={}){let{scope:e,minLoc:r=10,minCallees:o=6,limit:t=20,scanLimit:i}=a,s=new m(n);return f({candidates:()=>s.productionCallableDefinitions({scope:e,minLoc:r,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,prepare:l=>s.calleeMap(l,{semantic:a.semantic!==!1}),evaluate:(l,c)=>g(l,c.get(l.symbolId)??[],o),orderResults:(l,c)=>c.clusters.length-l.clusters.length||c.loc-l.loc,limit:t})}function g(n,a,e){let r=new Set(a.map(s=>s.symbol));if(r.size<e)return null;let o=b(r,a),t=p(r,o);if(t.length<2)return null;let i=h(t,o);return i.length===0?null:{symbol:n.symbol,shortName:u(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:r.size,clusters:i}}function b(n,a){let e=new Map;for(let o of n)e.set(o,new Set);let r=new Map;for(let o of a){let t=r.get(o.chunkId);t||(t=new Set,r.set(o.chunkId,t)),t.add(o.symbol)}for(let o of r.values()){let t=[...o];for(let i=0;i<t.length;i++)for(let s=i+1;s<t.length;s++)e.get(t[i]).add(t[s]),e.get(t[s]).add(t[i])}return e}function p(n,a){let e=new Set,r=[];for(let o of n){if(e.has(o))continue;let t=new Set,i=[o];for(;i.length>0;){let s=i.pop();if(!e.has(s)){e.add(s),t.add(s);for(let l of a.get(s)??[])e.has(l)||i.push(l)}}r.push(t)}return r}function h(n,a){return n.filter(e=>e.size>=3).map(e=>C(e,n,a)).filter(e=>e.isolation>.5).sort((e,r)=>r.isolation-e.isolation)}function C(n,a,e){let r=new Set;for(let s of a)if(s!==n)for(let l of s)r.add(l);let o=0;for(let s of n)for(let l of e.get(s)??[])r.has(l)&&o++;let t=n.size*r.size,i=t>0?1-o/t:1;return{callees:[...n].map(u),isolation:i}}export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4EAANIWC.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-QOFKVNFE.js";import{a as d}from"./chunk-W3PQRAI4.js";import{e as c}from"./chunk-QH5GTVVB.js";import{c as u}from"./chunk-64LH2QUP.js";function L(e,n,i={}){let t=f(e,n);if(!t)return null;let r=h(e,t);if(!r||e.isIgnored(r.relative_path))return null;let s=[],m=0,l=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,l);for(let o of l){let a=S(e,r,o,p.get(o.symbolId)??new Set);m+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:b(a)})}return{file:r.relative_path,symbols:s,totalExternalConsumers:m}}function h(e,n){return e.get(`SELECT id, relative_path FROM documents
|
|
2
2
|
WHERE relative_path = ?
|
|
3
3
|
${e.pathExclusionsFor("documents")}
|
|
4
4
|
LIMIT 1`,n)??null}function g(e,n){return new d(e).definitionsForFile(n).sort((i,t)=>i.startLine-t.startLine||i.endLine-t.endLine)}function S(e,n,i,t){let r=e.all(`SELECT DISTINCT consumer_d.relative_path
|
|
@@ -8,4 +8,4 @@ import{a as f}from"./chunk-ZOT3WUZW.js";import{a as d}from"./chunk-IW7ASGVF.js";
|
|
|
8
8
|
WHERE m.symbol_id = ?
|
|
9
9
|
AND m.role != 1
|
|
10
10
|
AND c.document_id != ?`,i.symbolId,n.id);return new Set([...r.map(s=>s.relative_path),...[...t].filter(s=>s!==n.relative_path)]).size}function b(e){return e>10?"high":e>0?"medium":"low"}export{L as a};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-4N7LFYSD.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as D,c as $,d as Q,f as v,g as A,h as N,m as y,n as d,q as w,
|
|
1
|
+
import{b as D,c as $,d as Q,f as v,g as A,h as N,m as y,n as d,q as w,x as f}from"./chunk-64LH2QUP.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
|
|
2
2
|
AND `),r=y(e,{where:o,params:i,limit:200}),a=d(e,{where:o,params:i,limit:200});return w(r,a)}function J(e,n,t,i){let o=n.trim(),r=t,a=r.replace(/\(\)$/,""),c=n.toLowerCase(),l=t.toLowerCase(),S=l.replace(/\(\)$/,""),k=e.symbol,C=$(e.symbol),b=Q(e.symbol),E=e.display_name??"",g=e.symbol.toLowerCase(),u=C.toLowerCase(),m=b.toLowerCase(),R=E.toLowerCase(),p=e.relative_path.toLowerCase(),K=/[/:.]/.test(t),M=I(t),_=M?.leaf.toLowerCase(),s=0;return(k===o||k===r)&&(s+=1150),(C===o||C===r)&&(s+=1100),E===a&&(s+=1180),b===a&&(s+=1160),(`${b}()`===o||`${b}()`===r)&&(s+=955),(g===c||g===l)&&(s+=1e3),(u===c||u===l)&&(s+=950),(p===c||p===l)&&(s+=925),(p.endsWith(`/${l}`)||p.endsWith(`/${c}`))&&(s+=875),R===S&&(s+=850),m===S&&(s+=825),(`${m}()`===c||`${m}()`===l)&&(s+=820),(u.endsWith(`:${l}`)||u.endsWith(`:${S}`)||u.endsWith(`:${S}()`))&&(s+=800),g.includes(l)&&(s+=120),u.includes(l)&&(s+=140),p.includes(l)&&(s+=140),R.includes(l)&&(s+=110),i.every(B=>{let L=B.toLowerCase();return g.includes(L)||u.includes(L)||p.includes(L)||R.includes(L)})&&(s+=100+i.length*15),M&&p.includes(M.path.toLowerCase())&&(s+=360,_&&(m===_||`${m}()`===_||`${m}()`==`${_}()`)&&(s+=700),v(e.symbol)&&(s+=180)),A(e.symbol)&&m===S&&(s+=60),!K&&N(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function I(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let i=n.slice(t+1).replace(/\(\)$/,"");return!i||i.includes(".")?null:{path:n.slice(0,t),leaf:i}}function x(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function U(e){let n=x(e),t=n.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return t.length>0?[...new Set(t)]:[n]}function V(e,n,t){let i=n.trim(),o=e.filter(r=>{let a=$(r.symbol),c=(r.display_name??"").trim();return r.symbol===i||a===i||a===t||c===i||c===t||`${c}()`===i||h(r,t)>1||r.relative_path===i});return o.length===0?null:(o.sort((r,a)=>h(a,t)-h(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),o[0]??null)}function h(e,n){let t=I(n);if(!t)return 0;let i=e.relative_path.toLowerCase(),o=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return i.includes(r)?o!==a?1:v(e.symbol)?D(e.symbol)===null?5:4:D(e.symbol)===null?3:2:0}export{re as a,Z as b,ae as c};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-5ALI77D7.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as d}from"./chunk-B75HZHUP.js";function u(e){let i=e.orderCandidates?[...e.candidates()].sort(e.orderCandidates):e.candidates(),a=d(i,e.scanLimit),r=e.prepare?.(a)??void 0,t=[];for(let s of a){let n=e.evaluate(s,r);n&&t.push(n)}return e.orderResults&&t.sort(e.orderResults),typeof e.limit=="number"?t.slice(0,e.limit):t}export{u as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5BZOSICN.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as c}from"./chunk-
|
|
1
|
+
import{b as c}from"./chunk-QUKZ77A6.js";import{a}from"./chunk-NN3O7TPH.js";import{c as d}from"./chunk-BJ7OHKB5.js";var g=d("file-dep-graph",{clearGroups:["whole-project"]});function p(e,i){return g.get(e,i??"",()=>{let s=new Map,n=new Set(a(e,{includeIgnored:!1})),r=(t,o)=>f(e,s,n,t,o);for(let t of m(e,i))r(t.from_file,t.to_file);for(let t of n)if(!(i&&!t.includes(i)))for(let o of c(e,t))o.sourcePath&&r(t,o.sourcePath);return s})}function m(e,i){let s=i?`AND d1.relative_path LIKE '%${i}%'`:"";return e.all(`SELECT DISTINCT
|
|
2
2
|
d1.relative_path AS from_file,
|
|
3
3
|
d2.relative_path AS to_file
|
|
4
4
|
FROM mentions m
|
|
@@ -17,4 +17,4 @@ import{b as c}from"./chunk-FVVT7GV6.js";import{a}from"./chunk-NN3O7TPH.js";impor
|
|
|
17
17
|
AND m.role != 1
|
|
18
18
|
${e.pathExclusionsFor("d1","d2")}
|
|
19
19
|
${s}`)}function f(e,i,s,n,r){if(n===r||e.isIgnored(n)||e.isIgnored(r)||!s.has(r))return;let t=i.get(n);t||(t=new Set,i.set(n,t)),t.add(r)}export{p as a};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-5D3BT4B4.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-W3PQRAI4.js";import{a as b}from"./chunk-5ALI77D7.js";import{t as l}from"./chunk-ADKQX2OY.js";import{c as m}from"./chunk-64LH2QUP.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
|
|
2
2
|
`).slice(r,t+1).join(`
|
|
3
3
|
`)}catch{return""}}function S(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
5
5
|
JOIN chunks c ON m.chunk_id = c.id
|
|
6
6
|
WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function L(e,n){return new Set(e.filter(r=>r.file!==n).map(r=>r.symbol)).size}function P(e,n){let r=l(e),t=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=r.match(o);s&&(t+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}return t}export{O as a};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-5HDYAOSF.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as f}from"./chunk-
|
|
1
|
+
import{o as f}from"./chunk-SA6B3EGD.js";import{a as d}from"./chunk-5ALI77D7.js";import{c as s,g as u,o as m,p as g}from"./chunk-64LH2QUP.js";import{a as c}from"./chunk-YVQUQIBM.js";function E(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:y(a,t?.display_name??null,n.symbol),source:S(e,n.relativePath,n.startLine,n.endLine)}],b=f(e,n,{semantic:i.semantic}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:b}}function S(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
|
|
2
2
|
`).slice(i,n+1).join(`
|
|
3
3
|
`).trimEnd();return o.length>0?o:null}function y(e,r,i){let n=m(e);if(n&&!p(n))return n;let t=(r??"").trim();return t?u(i)&&!t.endsWith("()")?`${t}()`:t:s(i)}function p(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{E as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-5IDEQEM4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-QOFKVNFE.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -30,4 +30,4 @@ import{a as s}from"./chunk-ZOT3WUZW.js";function m(e,d){let i=s(e,d);return i?e.
|
|
|
30
30
|
WHERE d2.relative_path = ?
|
|
31
31
|
AND d1.relative_path != ?
|
|
32
32
|
ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{m as a,o as b};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-5VB3WU7K.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as h}from"./chunk-44JOJLMO.js";import{e as y,g as S,h as g,i as M,m as C}from"./chunk-SA6B3EGD.js";import{e as R}from"./chunk-QH5GTVVB.js";import{s as b}from"./chunk-64LH2QUP.js";import{d as m,f as p}from"./chunk-T67R7V5I.js";import{a as f}from"./chunk-HCQ7J2N5.js";import{a as u}from"./chunk-NN3O7TPH.js";function D(e,n,t={}){let o=new Map;if(n&&n.length===0)return o;let i=u(e,{includeIgnored:!1}),a=M(e),r=n??b(e),l=new Set(r.map(s=>s.symbolId));return k(e,o,i,a,l),I(e,o,r,l),x(e,o,i,a,l),t.semantic!==!1&&_(o,R(e,A(r))),o}function k(e,n,t,o,i){for(let a of t){if(!f(a))continue;let r=m(e,a);if(r)for(let l of r){let s=S(a,o.get(l.calleeLeaf)??[]);if(!s||s.length===0)continue;let c=g(e,a,s,l.memberAccess);c&&i.has(c.symbolId)&&c.file!==a&&d(n,c.symbolId,a)}}}function I(e,n,t,o){let i=v(t);for(let a of L(e,o))e.isIgnored(a.relative_path)||w(a,i.get(a.symbol_id))||d(n,a.symbol_id,a.relative_path)}function L(e,n){return y(e,n?[...n]:void 0)}function v(e){let n=new Map;for(let t of e)n.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return n}function w(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function x(e,n,t,o,i){for(let a of t){if(f(a)!=="rust")continue;let r=p(e,a,{includeRustAttributeNames:!0});if(r.length!==0)for(let{name:l}of r){let s=o.get(l);if(s)for(let c of s)i.has(c.symbolId)&&c.file!==a&&d(n,c.symbolId,a)}}}function d(e,n,t){let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}function A(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function _(e,n){for(let[t,o]of n){let i=e.get(t);i||(i=new Set,e.set(t,i));for(let a of o)i.add(a)}}function O(e,n,t={}){return h(e,n,t)}function F(e,n,t={}){return D(e,n,t)}function j(e,n){return C(e,n)}function Q(e,n,t={}){let o=F(e,n,{semantic:t.semantic});return t.sourceFallback===!1?o:V(o,j(e,n))}function V(e,n){let t=new Map;for(let[o,i]of e)t.set(o,new Set(i));for(let[o,i]of n){let a=t.get(o)??new Set;for(let r of i)a.add(r);t.set(o,a)}return t}export{O as a,F as b,j as c,Q as d};
|
|
2
|
+
//# sourceMappingURL=chunk-623UQCVG.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as a}from"./chunk-XGGTESMN.js";function V(e,s={}){let{minTotalLines:n=800,minTemplateLines:t=300,minScriptLines:u=300,minStyleLines:m=500,limit:L=20,scope:c,scanLimit:o,filePattern:r}=s;return a(e,{scope:c,scanLimit:o}).filter(i=>!r||i.file.includes(r)).map(i=>p(i,{minTotalLines:n,minTemplateLines:t,minScriptLines:u,minStyleLines:m})).filter(i=>i!==null).sort((i,l)=>l.totalLines-i.totalLines||i.file.localeCompare(l.file)).slice(0,L)}function p(e,s){let n=[];return e.totalLines>=s.minTotalLines&&n.push(`${e.totalLines} total component line(s)`),e.templateLines>=s.minTemplateLines&&n.push(`${e.templateLines} template line(s)`),e.scriptLines>=s.minScriptLines&&n.push(`${e.scriptLines} script line(s)`),e.styleLines>=s.minStyleLines&&n.push(`${e.styleLines} style line(s)`),n.length===0?null:{file:e.file,totalLines:e.totalLines,sfcLines:e.sfcLines,templateLines:e.templateLines,scriptLines:e.scriptLines,styleLines:e.styleLines,externalScriptLines:e.externalScriptLines,externalScriptPaths:e.externalScriptPaths,customBlockLines:e.customBlockLines,dominantPressure:b(e),reasons:n,loc:e.totalLines}}function b(e){let s=[{axis:"template",lines:e.templateLines},{axis:"script",lines:e.scriptLines-e.externalScriptLines},{axis:"style",lines:e.styleLines},{axis:"external-script",lines:e.externalScriptLines},{axis:"custom-block",lines:e.customBlockLines}];return s.sort((n,t)=>t.lines-n.lines),s[0]?.lines?s[0].axis:"total"}export{V as a};
|
|
2
|
+
//# sourceMappingURL=chunk-62NMBOA5.js.map
|