scip-query 0.10.10 → 0.10.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -35
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-2DOW7QCA.js +71 -0
- package/dist/chunk-2FMFF4RI.js +2 -0
- package/dist/{chunk-J7RWXLUL.js → chunk-2GLNBCHB.js} +2 -2
- package/dist/chunk-2UVCH7CQ.js +2 -0
- package/dist/{chunk-LM5SHAN4.js → chunk-3XSNW5XB.js} +2 -2
- package/dist/chunk-4ISHQ7UW.js +35 -0
- package/dist/{chunk-XXZXDXTD.js → chunk-5GXTUANY.js} +2 -2
- package/dist/{chunk-TL6QPNF5.js → chunk-5JHEN5VN.js} +2 -2
- package/dist/chunk-62ULXMQ7.js +18 -0
- package/dist/chunk-63CI3IXR.js +102 -0
- package/dist/{chunk-Z4I7BVIU.js → chunk-6BN3EHQE.js} +2 -2
- package/dist/chunk-7C6JBBE4.js +23 -0
- package/dist/chunk-7EK7OSWS.js +2 -0
- package/dist/chunk-7IWIMNHI.js +2 -0
- package/dist/chunk-7XTO4YXB.js +8 -0
- package/dist/{chunk-5NVUWIAN.js → chunk-A4UTLKHU.js} +2 -2
- package/dist/{chunk-FDEQIPPK.js → chunk-ANUEY5WV.js} +2 -2
- package/dist/chunk-AOWFUGDL.js +2 -0
- package/dist/chunk-AREANYIA.js +3 -0
- package/dist/{chunk-7UQWUVRG.js → chunk-AZBELWZQ.js} +2 -2
- package/dist/{chunk-WG6KRH5F.js → chunk-CXWCLVYL.js} +2 -2
- package/dist/chunk-CYHIKTJN.js +3 -0
- package/dist/{chunk-BVRS7RKQ.js → chunk-DDQONX6B.js} +2 -2
- package/dist/{chunk-736BLPHR.js → chunk-DFSEARAU.js} +2 -2
- package/dist/{chunk-UFX7EPBA.js → chunk-DQ6433ZG.js} +2 -2
- package/dist/chunk-DVFP6PZI.js +2 -0
- package/dist/chunk-E3ADDB43.js +2 -0
- package/dist/{chunk-YWOOQ4FF.js → chunk-ELC77ZDE.js} +1 -1
- package/dist/chunk-EOLGSSDR.js +2 -0
- package/dist/chunk-F6IXELII.js +20 -0
- package/dist/{chunk-QYB5P7GL.js → chunk-FMGVZBS2.js} +2 -2
- package/dist/{chunk-VOYOYC5T.js → chunk-FX6ULETZ.js} +2 -2
- package/dist/chunk-GG5LHT27.js +2 -0
- package/dist/chunk-GKB4JJDU.js +2 -0
- package/dist/chunk-H7JF2CKK.js +2 -0
- package/dist/chunk-HHOMJCP5.js +4 -0
- package/dist/chunk-HRDSU5FN.js +9 -0
- package/dist/{chunk-BZ53S4ZN.js → chunk-HWVYTJOV.js} +2 -2
- package/dist/chunk-JJ5SAWBT.js +2 -0
- package/dist/chunk-JNMLBL36.js +2 -0
- package/dist/chunk-JS6B76AQ.js +2 -0
- package/dist/{chunk-ZQO43G2T.js → chunk-KZ4MG5NY.js} +2 -2
- package/dist/{chunk-UQLFQLAF.js → chunk-L446VQYQ.js} +2 -2
- package/dist/{chunk-NZ4UDB5N.js → chunk-LDJUB7XW.js} +2 -2
- package/dist/{chunk-MMLZEGMS.js → chunk-LEHVP4DY.js} +2 -2
- package/dist/chunk-MNCQPMCH.js +2 -0
- package/dist/chunk-MYTUWXHK.js +4 -0
- package/dist/chunk-N25HPUOK.js +2 -0
- package/dist/chunk-NABVR6B7.js +2 -0
- package/dist/{chunk-PTQVNJ4Q.js → chunk-NBNEVLRC.js} +2 -2
- package/dist/chunk-NTSR6SRP.js +2 -0
- package/dist/{chunk-RYXW3KRC.js → chunk-OFXN2BCT.js} +2 -2
- package/dist/chunk-PWAK75BU.js +2 -0
- package/dist/chunk-Q5P7NOVM.js +2 -0
- package/dist/chunk-RGKRYO22.js +4 -0
- package/dist/chunk-RM2WQ75T.js +2 -0
- package/dist/chunk-ROGZXWN2.js +2 -0
- package/dist/chunk-RSSXKJ6J.js +38 -0
- package/dist/chunk-RUV5IY25.js +7 -0
- package/dist/chunk-RVGEZYMQ.js +2 -0
- package/dist/{chunk-IPQTC36U.js → chunk-RXINFVBN.js} +2 -2
- package/dist/{chunk-RXRLZFUL.js → chunk-S2MRVIJ5.js} +2 -2
- package/dist/chunk-SA3DPTHT.js +7 -0
- package/dist/chunk-SGTKURU6.js +52 -0
- package/dist/chunk-SQNHOOJ5.js +3 -0
- package/dist/chunk-T3AEVJBG.js +4 -0
- package/dist/{chunk-DQVKIG3D.js → chunk-T4N2ZRVY.js} +2 -2
- package/dist/{chunk-5VG7RKEF.js → chunk-TBCHRDAC.js} +2 -2
- package/dist/chunk-THB6AM3V.js +11 -0
- package/dist/chunk-ULHLDOD6.js +4 -0
- package/dist/chunk-UQ73QF5D.js +43 -0
- package/dist/chunk-UVPY3RUZ.js +2 -0
- package/dist/chunk-V5FGK3DZ.js +2 -0
- package/dist/{chunk-3DGD6NKW.js → chunk-VB2EZZPA.js} +2 -2
- package/dist/{chunk-56P7PDST.js → chunk-WTY5FERW.js} +2 -2
- package/dist/chunk-WUOB4DHH.js +6 -0
- package/dist/chunk-XHMVZFA6.js +2 -0
- package/dist/chunk-XRUGSM76.js +10 -0
- package/dist/{chunk-UYD7FJ3K.js → chunk-XUCZ3RQ5.js} +2 -2
- package/dist/chunk-YFQIKYOP.js +2 -0
- package/dist/chunk-Z2LDWIJV.js +5 -0
- package/dist/chunk-ZNWWVYQL.js +3 -0
- package/dist/{chunk-UDGXK2WA.js → chunk-ZUUNREKS.js} +2 -2
- package/dist/cli.js +277 -252
- package/dist/{config-types-BDIWAYzr.d.ts → config-types-dvHOz0zU.d.ts} +4 -1
- package/dist/{db-Djj3Nqrb.d.ts → db-rMZO5JFK.d.ts} +1 -1
- package/dist/{health-D5J42g4D.d.ts → health-CtTIGh6H.d.ts} +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.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 +2 -2
- 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 +2 -2
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- 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/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 +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +4 -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/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.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 +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- 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 +7 -4
- 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 +55 -16
- 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/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-imports.d.ts +2 -2
- package/dist/queries/unused-imports.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 +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +9 -9
- package/dist/reindex.d.ts +30 -4
- package/dist/reindex.js +19 -19
- package/dist/runtime.d.ts +4 -3
- package/dist/runtime.js +2 -2
- package/dist/{scip-cli-CnK9Va4O.d.ts → scip-cli-trnNvymv.d.ts} +1 -1
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/analyzer-inventory.md +8 -0
- package/docs/analyzer-validation-ledger.md +7 -0
- package/package.json +3 -1
- package/scripts/evidence-product-contract.mjs +197 -0
- package/skills/scip-hyper-optimization/SKILL.md +153 -24
- package/skills/scip-hyper-optimization/agents/openai.yaml +3 -3
- package/dist/chunk-2UYQLFVC.js +0 -2
- package/dist/chunk-2VM46FC5.js +0 -8
- package/dist/chunk-3Q77KKEY.js +0 -2
- package/dist/chunk-3VD3JMK2.js +0 -2
- package/dist/chunk-4KTOV4QN.js +0 -3
- package/dist/chunk-4N4WONI4.js +0 -102
- package/dist/chunk-65AU3HFZ.js +0 -2
- package/dist/chunk-6LNQOOTB.js +0 -2
- package/dist/chunk-72KY2ZFO.js +0 -2
- package/dist/chunk-7JRRXGVZ.js +0 -2
- package/dist/chunk-A536TEU4.js +0 -3
- package/dist/chunk-A6IDHNMC.js +0 -4
- package/dist/chunk-A6TANQNV.js +0 -2
- package/dist/chunk-AW2QHPLL.js +0 -4
- package/dist/chunk-BSN22NRK.js +0 -9
- package/dist/chunk-C5CTSJ6X.js +0 -6
- package/dist/chunk-CCKPYPDI.js +0 -35
- package/dist/chunk-CZ425R2B.js +0 -18
- package/dist/chunk-DS6QEB3G.js +0 -5
- package/dist/chunk-F6ICF7HL.js +0 -40
- package/dist/chunk-FAYI6KZ5.js +0 -2
- package/dist/chunk-FG4NT6VY.js +0 -2
- package/dist/chunk-FRPEPTYJ.js +0 -5
- package/dist/chunk-GBEYTDY5.js +0 -2
- package/dist/chunk-GRJY65YT.js +0 -2
- package/dist/chunk-HF25DFSC.js +0 -3
- package/dist/chunk-HHN2B5KA.js +0 -2
- package/dist/chunk-I46WR7MT.js +0 -10
- package/dist/chunk-JM72FNGA.js +0 -2
- package/dist/chunk-KX5PLFZ5.js +0 -3
- package/dist/chunk-LPL4MA6R.js +0 -2
- package/dist/chunk-LZHUWKGD.js +0 -2
- package/dist/chunk-OBGRLXWF.js +0 -3
- package/dist/chunk-P5RYBRIO.js +0 -4
- package/dist/chunk-PFOCOG57.js +0 -2
- package/dist/chunk-PKMZCDQD.js +0 -4
- package/dist/chunk-QPU7EXAW.js +0 -2
- package/dist/chunk-QVI3NR7E.js +0 -7
- package/dist/chunk-QX7LLCGB.js +0 -23
- package/dist/chunk-RVWSAMTT.js +0 -2
- package/dist/chunk-SGLLBSCV.js +0 -2
- package/dist/chunk-SULEXAHO.js +0 -38
- package/dist/chunk-TH2N6QHW.js +0 -2
- package/dist/chunk-UWYJDBDW.js +0 -2
- package/dist/chunk-VUKC6F77.js +0 -20
- package/dist/chunk-W2CBNBEL.js +0 -71
- package/dist/chunk-XIVO4SDZ.js +0 -2
- package/dist/chunk-XSNRACLV.js +0 -3
- package/dist/chunk-XUGQU7PM.js +0 -41
- package/dist/chunk-Y6E3JHC4.js +0 -2
- package/dist/chunk-YBEEVDJQ.js +0 -2
- package/dist/chunk-YGHUVQLR.js +0 -2
- package/dist/chunk-YWDVDAD7.js +0 -2
- package/dist/chunk-YZA6PPZL.js +0 -3
- package/dist/chunk-ZU6PROUY.js +0 -2
package/README.md
CHANGED
|
@@ -28,14 +28,14 @@ Agents are effective at editing the code in front of them. They are less reliabl
|
|
|
28
28
|
|
|
29
29
|
## The Agent Loop
|
|
30
30
|
|
|
31
|
-
| Phase
|
|
32
|
-
|
|
33
|
-
| Orient
|
|
34
|
-
| Plan
|
|
35
|
-
| Reuse
|
|
36
|
-
| Finish
|
|
37
|
-
| Verify
|
|
38
|
-
| Clean up | Candidate removals and newly exposed dead-code cascades
|
|
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 --json`, `doc-drift`, `diff-gate --json`, `health --baseline` |
|
|
38
|
+
| Clean up | Candidate removals and newly exposed dead-code cascades | `cleanup-plan --verify` |
|
|
39
39
|
|
|
40
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.
|
|
41
41
|
|
|
@@ -99,11 +99,13 @@ Heuristic findings are candidates for inspection, not proof of equivalence or ba
|
|
|
99
99
|
|
|
100
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.
|
|
101
101
|
|
|
102
|
+
Clojure projects are indexed through `scip-clojure`. Source fallback adds namespace imports, callable/callsite evidence, and protocol/record member evidence for `.clj`, `.cljs`, and `.cljc` files. When the project has `clj-kondo` available, cleanup-plan verification can use `clj-kondo --lint .`. Clojure does not currently have a scip-query semantic provider equivalent to TypeScript's `ts-morph` layer; capability output reports that boundary explicitly.
|
|
103
|
+
|
|
102
104
|
## Cleaning Up AI-Generated Code
|
|
103
105
|
|
|
104
106
|
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):
|
|
105
107
|
|
|
106
|
-
**1. Find the echoes.** Agents re-implement helpers, hooks, composables, and frontend components they didn't know existed. `recent-duplicates` makes similarity
|
|
108
|
+
**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:
|
|
107
109
|
|
|
108
110
|
```
|
|
109
111
|
91% ECHO react-component src/components/ProjectCardVisual.tsx ProjectCardVisual (added 62 commits ago)
|
|
@@ -114,7 +116,7 @@ These checks target specific ways AI-assisted development rots a codebase. The f
|
|
|
114
116
|
(both new - one agent session duplicated itself; consolidate before they diverge)
|
|
115
117
|
```
|
|
116
118
|
|
|
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
|
|
119
|
+
**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):
|
|
118
120
|
|
|
119
121
|
```
|
|
120
122
|
src/utils/priceLabel.ts priceLabel()
|
|
@@ -123,7 +125,7 @@ src/utils/priceLabel.ts priceLabel()
|
|
|
123
125
|
un-migrated: 100% buildReportC() (src/cards/price-summary-c.ts)
|
|
124
126
|
```
|
|
125
127
|
|
|
126
|
-
**3. Catch your standards docs lying.** If you keep in-repo standards for agents to read before implementing, a stale standard is worse than none. `doc-drift` reads every doc's file citations
|
|
128
|
+
**3. Catch your standards docs lying.** If you keep in-repo standards for agents to read before implementing, a stale standard is worse than none. `doc-drift` reads every doc's file citations _and_ its co-change history, then flags docs whose code moved on without them — including **broken references** to files that no longer exist:
|
|
127
129
|
|
|
128
130
|
```
|
|
129
131
|
staleness 94 product/domain-model.md
|
|
@@ -131,7 +133,7 @@ staleness 94 product/domain-model.md
|
|
|
131
133
|
22 change(s) since doc update src/workflows/serviceTasks.ts (referenced by doc)
|
|
132
134
|
```
|
|
133
135
|
|
|
134
|
-
**4. Delete with project checks.** `cleanup-plan` runs dead-code analysis to a
|
|
136
|
+
**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):
|
|
135
137
|
|
|
136
138
|
```
|
|
137
139
|
── Batch 0: deletable now (graph-fact, 67 LOC) ──
|
|
@@ -139,22 +141,22 @@ staleness 94 product/domain-model.md
|
|
|
139
141
|
Batch 0: COMPILER-VERIFIED
|
|
140
142
|
```
|
|
141
143
|
|
|
142
|
-
When verification
|
|
144
|
+
When verification _fails_, the errors name the exact references the static evidence missed — that failure has caught real detector mistakes and stopped build-breaking deletions.
|
|
143
145
|
|
|
144
146
|
**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.
|
|
145
147
|
|
|
146
148
|
**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` 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
149
|
|
|
148
|
-
**7. Surface hidden coupling.** `co-change` finds file pairs that repeatedly change in the same commits with
|
|
150
|
+
**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.
|
|
149
151
|
|
|
150
|
-
**8. Gate every diff.** `diff-gate` runs a defined set of checks scoped to what a change
|
|
152
|
+
**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:
|
|
151
153
|
|
|
152
154
|
```
|
|
153
155
|
[co-change-partner] schema.prisma changed, but scripts/scope-inventory.mjs did not — they change together 12x (86% of the time)
|
|
154
156
|
-> Update scripts/scope-inventory.mjs alongside this change, or confirm the coupling no longer holds.
|
|
155
157
|
```
|
|
156
158
|
|
|
157
|
-
**9. Ratchet it in CI.** `health --write-baseline` snapshots finding identities into a committable file; `health --baseline` exits 1 on any
|
|
159
|
+
**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
160
|
|
|
159
161
|
Accepted findings can be recorded without weakening the rest of the gate:
|
|
160
162
|
|
|
@@ -187,7 +189,7 @@ Axes:
|
|
|
187
189
|
|
|
188
190
|
- **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.
|
|
189
191
|
- **Every deduction is itemized** — the scalar is auditable, not vibes.
|
|
190
|
-
- **The validation axis is a falsifiability loop**: it measures whether flagged files actually attract more fix commits than the rest
|
|
192
|
+
- **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.
|
|
191
193
|
- **Suppressions are data**: every `// scip-query: ignore-*` comment is a precision label, counted and reported.
|
|
192
194
|
|
|
193
195
|
## Accuracy Model
|
|
@@ -196,7 +198,7 @@ Evidence tiers are kept explicit, strongest first:
|
|
|
196
198
|
|
|
197
199
|
1. **Compiler-backed facts** from the SCIP database (`trace`, `refs`, `deps`, `outline`, ...).
|
|
198
200
|
2. **Semantic augmentation** via `ts-morph` for TypeScript — verified references, callers, callees when SCIP alone is incomplete.
|
|
199
|
-
3. **Source-backed heuristics** (AST/text) for cleanup signals. Always labeled:
|
|
201
|
+
3. **Source-backed heuristics** (AST/text) for cleanup signals. Always labeled: _"these are candidates, not exact compiler facts."_
|
|
200
202
|
4. **Compiler verification** for deletions — the only tier that earns the word "safe."
|
|
201
203
|
|
|
202
204
|
And because accuracy you don't measure is a feeling, `self-audit` samples symbols and scores the cheap paths against the TypeScript compiler:
|
|
@@ -235,18 +237,19 @@ scip-query health --write-baseline # start the ratchet
|
|
|
235
237
|
- `scip` CLI, from [Sourcegraph SCIP releases](https://github.com/sourcegraph/scip/releases)
|
|
236
238
|
- A language-specific SCIP indexer for your project
|
|
237
239
|
|
|
238
|
-
| Language
|
|
239
|
-
|
|
240
|
-
| TypeScript / JavaScript / Vue | scip-typescript
|
|
241
|
-
| Java / Scala / Kotlin
|
|
242
|
-
| Rust
|
|
243
|
-
| Python
|
|
244
|
-
| Go
|
|
245
|
-
| Ruby
|
|
246
|
-
| C / C++
|
|
247
|
-
| C# / VB
|
|
248
|
-
| Dart
|
|
249
|
-
| PHP
|
|
240
|
+
| Language | Indexer | Install |
|
|
241
|
+
| ----------------------------- | ---------------- | --------------------------------------------------------------- |
|
|
242
|
+
| TypeScript / JavaScript / Vue | scip-typescript | `npm install -g @sourcegraph/scip-typescript` |
|
|
243
|
+
| Java / Scala / Kotlin | scip-java | [releases](https://github.com/sourcegraph/scip-java/releases) |
|
|
244
|
+
| Rust | rust-analyzer | Ships with rust-analyzer: `rust-analyzer scip` |
|
|
245
|
+
| Python | scip-python-plus | `npm install -g scip-python-plus` |
|
|
246
|
+
| Go | scip-go | `go install github.com/sourcegraph/scip-go@latest` |
|
|
247
|
+
| Ruby | scip-ruby | [releases](https://github.com/sourcegraph/scip-ruby/releases) |
|
|
248
|
+
| C / C++ | scip-clang | [releases](https://github.com/sourcegraph/scip-clang/releases) |
|
|
249
|
+
| C# / VB | scip-dotnet | [releases](https://github.com/sourcegraph/scip-dotnet/releases) |
|
|
250
|
+
| Dart | scip-dart | [releases](https://github.com/nicovince/scip-dart/releases) |
|
|
251
|
+
| PHP | scip-php | [releases](https://github.com/nicovince/scip-php/releases) |
|
|
252
|
+
| Clojure / ClojureScript | scip-clojure | `npm install -g scip-clojure` |
|
|
250
253
|
|
|
251
254
|
For Python, the executable may be `scip-python`, `scip-python-plus`, or both. `scip-query` accepts either name.
|
|
252
255
|
|
|
@@ -265,6 +268,19 @@ By default, indexes live in `~/.cache/scip-query/projects/<hash>/`, keeping proj
|
|
|
265
268
|
TypeScript monorepos can opt into project sharding with `indexer.typescript.projectMode: "workspace"`. In that mode, `scip-query` discovers repo-local TypeScript project roots, runs one `scip-typescript` process per project with bounded concurrency, merges the shard protobufs, and still publishes one TypeScript language index. Set `indexer.typescript.projects` to an explicit list of project directories or tsconfig paths when automatic discovery is too broad. Set `indexerConcurrency` when a repo needs a persistent worker cap; CLI `--indexer-concurrency` and `SCIP_QUERY_INDEXER_CONCURRENCY` still override ad hoc runs.
|
|
266
269
|
Use `indexer.typescript.pnpmWorkspaces` only with the default single-project mode; workspace mode passes explicit projects instead.
|
|
267
270
|
|
|
271
|
+
Clojure projects can pass a project-local `scip-clojure` config file through `.scipquery.json`:
|
|
272
|
+
|
|
273
|
+
```json
|
|
274
|
+
{
|
|
275
|
+
"languages": ["clojure"],
|
|
276
|
+
"indexer": {
|
|
277
|
+
"clojure": {
|
|
278
|
+
"configPath": ".scip-clojure.json"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
268
284
|
Most read-only commands accept `--json` and use the same envelope:
|
|
269
285
|
|
|
270
286
|
```json
|
|
@@ -321,14 +337,19 @@ because they share candidate and evidence policy changes:
|
|
|
321
337
|
}
|
|
322
338
|
```
|
|
323
339
|
|
|
340
|
+
The consumer evidence product migration kept this declared-coupling example
|
|
341
|
+
current: `src/queries/cleanup/stale-abstractions.ts` still belongs to the
|
|
342
|
+
cleanup detector family and still shares candidate/evidence policy with the
|
|
343
|
+
dead and isolated cleanup detectors.
|
|
344
|
+
|
|
324
345
|
Useful environment variables:
|
|
325
346
|
|
|
326
|
-
| Variable
|
|
327
|
-
|
|
347
|
+
| Variable | Purpose |
|
|
348
|
+
| ------------------------- | ----------------------------------- |
|
|
328
349
|
| `SCIP_QUERY_PROJECT_ROOT` | Override the project root directory |
|
|
329
|
-
| `SCIP_QUERY_INDEX_DB`
|
|
330
|
-
| `SCIP_QUERY_INDEX_SCIP`
|
|
331
|
-
| `SCIP_QUERY_CACHE_DIR`
|
|
350
|
+
| `SCIP_QUERY_INDEX_DB` | Override the SQLite database path |
|
|
351
|
+
| `SCIP_QUERY_INDEX_SCIP` | Override the SCIP protobuf path |
|
|
352
|
+
| `SCIP_QUERY_CACHE_DIR` | Override the cache directory |
|
|
332
353
|
|
|
333
354
|
Query results are filtered through the project's `.gitignore`. If none exists, common generated directories such as `dist/`, `target/`, `node_modules/`, and `.venv/` are excluded by default.
|
|
334
355
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{d as t}from"./chunk-2DOW7QCA.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,71 @@
|
|
|
1
|
+
import Ue from"better-sqlite3";import{existsSync as zt}from"fs";import{dirname as Yt,join as Qt,resolve as $e}from"path";import oe from"better-sqlite3";import{execFileSync as ie}from"child_process";import{existsSync as se,readdirSync as ae,readFileSync as ue}from"fs";import{extname as m,join as D}from"path";import B from"ignore";import{readFileSync as J,existsSync as h}from"fs";import{dirname as b,isAbsolute as x,join as S,relative as z,resolve as q}from"path";function V(e){let t=B(),r=!1,n=Y(e);for(let i of n)try{let o=J(i,"utf-8");t.add(o),r=!0}catch{}return r||t.add(Q),{isIgnored:i=>C(t,e,i),filter:i=>i.filter(o=>!C(t,e,o))}}function Y(e){let t=[],r=S(e,".gitignore");h(r)&&t.push(r);let n=b(e),i=0;for(;n!==b(n)&&i<5;){let o=S(n,".gitignore");if(h(o)&&t.push(o),h(S(n,".git")))break;n=b(n),i++}return t}var Q=`
|
|
2
|
+
# Dependencies
|
|
3
|
+
node_modules/
|
|
4
|
+
vendor/
|
|
5
|
+
.bundle/
|
|
6
|
+
|
|
7
|
+
# Build output
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
out/
|
|
11
|
+
target/
|
|
12
|
+
bin/
|
|
13
|
+
obj/
|
|
14
|
+
|
|
15
|
+
# Python
|
|
16
|
+
__pycache__/
|
|
17
|
+
*.pyc
|
|
18
|
+
*.pyo
|
|
19
|
+
.venv/
|
|
20
|
+
venv/
|
|
21
|
+
.env/
|
|
22
|
+
env/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
|
|
25
|
+
# Rust
|
|
26
|
+
target/
|
|
27
|
+
|
|
28
|
+
# Java / Kotlin / Scala
|
|
29
|
+
*.class
|
|
30
|
+
.gradle/
|
|
31
|
+
.mvn/
|
|
32
|
+
|
|
33
|
+
# C# / .NET
|
|
34
|
+
bin/
|
|
35
|
+
obj/
|
|
36
|
+
packages/
|
|
37
|
+
|
|
38
|
+
# Go
|
|
39
|
+
vendor/
|
|
40
|
+
|
|
41
|
+
# Dart
|
|
42
|
+
.dart_tool/
|
|
43
|
+
build/
|
|
44
|
+
|
|
45
|
+
# PHP
|
|
46
|
+
vendor/
|
|
47
|
+
|
|
48
|
+
# IDE / OS
|
|
49
|
+
.idea/
|
|
50
|
+
.vscode/
|
|
51
|
+
*.swp
|
|
52
|
+
*.swo
|
|
53
|
+
.DS_Store
|
|
54
|
+
Thumbs.db
|
|
55
|
+
|
|
56
|
+
# Type definitions (often noise in queries)
|
|
57
|
+
*.d.ts
|
|
58
|
+
`;function C(e,t,r){let n=Z(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function Z(e,t){if(!t||t===".")return null;if(!x(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=x(t)?t:q(e,t),n=z(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as it}from"fs";import{execFileSync as at}from"child_process";import{extname as ct,join as lt}from"path";var ee=[];function k(e){e.groups.length>0&&ee.push(e)}function te(){let e=new WeakMap;return{cache:e,ensure(t){let r=e.get(t);return r||(r=new Map,e.set(t,r)),r}}}function I(e,t){let{cache:r,ensure:n}=te(),i={get(o,s,a){let u=n(o);if(u.has(s))return u.get(s);let c=a();return u.set(s,c),c},invalidate(o,s){r.get(o)?.delete(s)},invalidateAll(o){r.delete(o)},size(o){return r.get(o)?.size??0}};return k({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}var ne=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],T=[".vue"],F=[".tsx",".jsx"],E=[".vue"],dt=[...F,...E],pt=new Set(F),ft=new Set(E),re=new Set(ne.map(e=>e.toLowerCase())),mt=[...re].sort().join(","),L=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var ht=I("source-files",{clearGroups:[]});function Vt(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:t=>ce({projectRoot:t.projectRoot,dbPath:t.dbPath,extensions:e.extensions,onStatus:t.onStatus})}}function ce(e){let t=new Set((e.extensions??T).map(o=>o.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!se(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=V(e.projectRoot),n=le(e.projectRoot,t).filter(o=>!r.isIgnored(o)),i=new oe(e.dbPath);try{let o=de(i,n),s=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
59
|
+
VALUES (?, ?, NULL, ?)`),u=i.transaction(l=>{let f=0;for(let g of l){if(o.has(g))continue;let d=ue(D(e.projectRoot,g),"utf-8"),X=s.run(pe(g),g,d);f+=Number(X.changes)}return f})(n),c={scanned:n.length,inserted:u,existing:n.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{i.close()}}function le(e,t){let r=ge(e,t);if(r)return r;let n=[],i=o=>{let s=o?D(e,o):e,a;try{a=ae(s,{withFileTypes:!0})}catch{return}for(let u of a){if(L.has(u.name))continue;let c=o?`${o}/${u.name}`:u.name;if(u.isDirectory()){i(c);continue}t.has(m(u.name).toLowerCase())&&n.push(c)}};return i(""),n.sort()}function ge(e,t){try{return ie("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
60
|
+
`).filter(n=>n&&t.has(m(n).toLowerCase())).sort()}catch{return null}}function de(e,t){let r=new Set,n=500;for(let i=0;i<t.length;i+=n){let o=t.slice(i,i+n),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${o.map(()=>"?").join(",")})`).all(...o);for(let a of s)r.add(a.relative_path)}return r}function pe(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{readFileSync as Tt,writeFileSync as Ft}from"fs";function Et(e,t){let r=Date.now(),n=e.run(t);return{stageId:e.id,facts:e.facts,durationMs:Date.now()-r,result:n}}import{execFileSync as fe}from"child_process";import{createHash as me}from"crypto";import{readdirSync as he,readFileSync as be}from"fs";import{join as O}from"path";function w(e){return(ye(e)??Re(e)).filter(t=>t&&!P(t)).sort()}function At(e,t={}){return(t.language?w(e).filter(n=>Se(n,t.language,t.markerFiles)):w(e)).map(n=>{let i=O(e,n);try{let o=be(i);return{path:n,size:o.byteLength,hash:me("sha256").update(o).digest("hex")}}catch{return{path:n,size:-1,hash:"unreadable"}}})}function Se(e,t,r){let n=e.split("/").at(-1)??e;if(r?.includes(e)||r?.includes(n)||xe.has(n))return!0;let i=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(Ce[t]??[]).includes(i)}function ye(e){try{return fe("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
61
|
+
`).filter(Boolean)}catch{return null}}function Re(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?O(e,n):e,o;try{o=he(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){P(a)||r.push(a);continue}t.push(a)}}return t}function P(e){let t=e.split("/");return e==="meta.json"||t.some(r=>ve.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var ve=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]),xe=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock","deps.edn","project.clj","bb.edn","shadow-cljs.edn"]),Ce={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{createRequire as Ve}from"module";import{existsSync as ke,readFileSync as R}from"fs";import{dirname as A,extname as Ie,join as j,relative as Te,resolve as Gt}from"path";import{pathToFileURL as Fe}from"url";function N(e,t){let{vueCore:r,ts:n,volarTs:i}=Ee(e),{parsed:o,vueOptions:s}=Le(r,n,t),a=A(t),u=r.createVueLanguagePlugin(n,o.options,s,d=>d),c=De(r,n,u),l=we(a,o),{languageServiceHost:f}=i.createLanguageServiceHost(n,n.sys,c,d=>d,l),g=n.createLanguageService(f);return{ts:n,language:c,languageService:g,fileNames:o.fileNames,configDir:a}}function Ee(e){let t=Ve(Fe(j(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Le(e,t,r){let n=t.readConfigFile(r,t.sys.readFile);if(n.error||!n.config)throw new Error(`Failed to read ${r}`);let o=e.createParsedCommandLine(t,t.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(o.globalTypesPath=e.createGlobalTypesWriter(o,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(n.config,t.sys,A(r),void 0,r,void 0,e.getAllExtensions(o).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:o}}function De(e,t,r){let n={},i=e.createLanguage([r],new Map,o=>{if(!ke(o))return;let s=R(o,"utf-8");n.current?.scripts.set(o,t.ScriptSnapshot.fromString(s),r.getLanguageId(o)??je(o))});return n.current=i,i}function we(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function y(e,t,r){try{return e(t)}catch(n){throw(typeof n=="object"&&n!==null&&"code"in n?n.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:n}):n}}function _(e,t,r){let n=Oe(e);return i=>{let o=p(t,i.fileName),s=r.get(i.fileName);if(!s)return null;let a=r.positionAt(s,i.textSpan.start),u=n.get(o);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Pe(u.starts,a.line,2)}}function Oe(e){let t=e.prepare(`
|
|
62
|
+
SELECT
|
|
63
|
+
d.relative_path AS relativePath,
|
|
64
|
+
der.start_line AS startLine,
|
|
65
|
+
der.end_line AS endLine,
|
|
66
|
+
der.symbol_id AS symbolId
|
|
67
|
+
FROM defn_enclosing_ranges der
|
|
68
|
+
JOIN documents d ON d.id = der.document_id
|
|
69
|
+
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
70
|
+
`).all(),r=new Map;for(let n of t){let i=r.get(n.relativePath);i||(i={containingByLine:new Map,starts:[]},r.set(n.relativePath,i)),i.starts.push({line:n.startLine,symbolId:n.symbolId});for(let o=n.startLine;o<=n.endLine;o++)i.containingByLine.set(o,n.symbolId)}for(let n of r.values())n.starts.sort((i,o)=>i.line-o.line);return r}function Pe(e,t,r){let n=0,i=e.length-1;for(;n<=i;){let s=Math.floor((n+i)/2);e[s].line<t?n=s+1:i=s-1}let o=null;for(let s of[i,n]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-t);u>r||(!o||u<o.distance)&&(o={distance:u,symbolId:a.symbolId})}return o?.symbolId??null}function M(e,t){let r=_e(t),n=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),i=new Map;return{get(o){if(i.has(o))return i.get(o)??null;let s=Me(n,r,t,o);return i.set(o,s),s}}}function G(e,t,r,n,i){if(e.fileName.endsWith(".vue")){let o=n.language.scripts.get(e.fileName),s=o?.generated?.languagePlugin.typescript?.getServiceScript(o.generated.root)?.code;if(o&&s){let a=n.language.maps.get(s,o);if(v(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(i)?r.get(e.fileName):null}return t(e)}function*U(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),n;for(;n=t.exec(e);){let i=n[0];r.has(i)||(yield{text:i,start:n.index,end:n.index+i.length})}}function $(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function v(e,t){let r=e;for(let[n]of r.toSourceLocation(t,i=>!!i.navigation))return n;return null}function Ae(e,t){let r=0,n=e.lineStarts.length-1;for(;r<=n;){let o=Math.floor((r+n)/2);e.lineStarts[o]<=t?r=o+1:n=o-1}let i=Math.max(0,n);return{line:i,character:t-e.lineStarts[i]}}function W(e,t){return p(e,t).startsWith("node_modules/")}function p(e,t){return Te(e,t).replaceAll("\\","/")}function je(e){switch(Ie(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function H(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=R(t,"utf-8"),n={text:r,lineStarts:Ne(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:Ae}}function Ne(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function _e(e){try{let t=JSON.parse(R(j(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Me(e,t,r,n){let i=p(r,n),o=Ge(t.name,t.version,i);return e.get(o)?.id??null}function Ge(e,t,r){let n=r.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function en(e){let t=$e(e.projectRoot,e.tsconfig),r=new Ue(e.dbPath,{readonly:!0});try{let n=We({db:r,projectRoot:e.projectRoot,configPath:t,vueSymbolLookup:M(r,e.projectRoot)});return He({vueFiles:e.vueFiles??[],tasks:e.tasks,...n})}finally{r.close()}}function We(e){let t=H();return{projectRoot:e.projectRoot,context:N(e.projectRoot,e.configPath),symbolLookup:_(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function He(e){let t=[],r=0,n=e.tasks??e.vueFiles.map(i=>({fileName:i,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let i of n){let o=Ke(e,i);t.push(...o.occurrences),r+=o.skippedReferences}return{occurrences:t,skippedReferences:r}}function Ke(e,t){let r=e.context.language.scripts.get(t.fileName),n=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!n)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.sourceReader.get(t.fileName);if(!i)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.context.language.maps.get(n,r),s=p(e.projectRoot,t.fileName),a=[...U(i.text)],u={tokens:a.filter(c=>c.start>=t.startOffset&&c.start<t.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:Je(a),processedStarts:new Set};return Xe({...e,fileName:t.fileName,sourceInfo:i,sourceFile:s,map:o,tokenContext:u})}function Xe(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let i=$(e.map,n.start);if(i===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(u=>!W(e.projectRoot,u.fileName));if(!s){r++;continue}let a=G(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}K(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),Be(t,e,n,i,a)}return{occurrences:t,skippedReferences:r}}function Be(e,t,r,n,i){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let o of ze(t.context.languageService,t.fileName,n+1,t.map,r,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(o))continue;let s=t.tokenContext.tokenByStart.get(o);s&&(K(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,i),t.tokenContext.processedStarts.add(o))}}function K(e,t,r,n,i,o){let s=t.positionAt(r,i.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+i.text.length,symbolId:o})}function Je(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function ze(e,t,r,n,i,o){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let u of s)if(u.fileName===t)for(let c of u.highlightSpans){let l=qe(n,c.textSpan.start,o,i.text);l!==null&&a.push(l)}return a}function qe(e,t,r,n){let i=r.get(t);if(i?.text===n)return i.start;let o=v(e,t);if(o===null)return null;let s=r.get(o);return s?.text===n?s.start:null}export{Vt as a,Et as b,At as c,en as d};
|
|
71
|
+
//# sourceMappingURL=chunk-2DOW7QCA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as D}from"./chunk-CYHIKTJN.js";import{b as v}from"./chunk-ULHLDOD6.js";import{a as f,e as F}from"./chunk-NABVR6B7.js";import{e as y}from"./chunk-SA3DPTHT.js";import{b as C,j as g}from"./chunk-SGTKURU6.js";import{c as d}from"./chunk-7S5E7KWT.js";var L=d("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),S=g({kind:"consumer-file-usage",serialize:U,deserialize:O});function $(n,e){return{forDefinitions(i,r){return E(n,e,i,r)}}}function B(n){let e=new Map;for(let[i,r]of n)e.set(i,new Set(r.files.map(t=>t.file)));return e}function J(n,e,i){return x(n,e,i).partition}function E(n,e,i,r){let t=b(i.length);return v("consumer-evidence.product",()=>{let s=M(n,e,i,r),o=new Map;t={...t,...s.counters};for(let a of i){let c=s.sources.get(a.symbolId)??new Map,l=x(n,a,[...c.keys()],c);t.realFiles+=l.partition.realConsumers.length,t.reexportOnlyFiles+=l.partition.barrelConsumers,t.importOnlyFiles+=l.partition.importOnlyConsumers,o.set(a.symbolId,{definition:a,files:l.files,...l.partition})}return o},()=>({...t}))}function b(n){return{definitions:n,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function M(n,e,i,r){let t=b(i.length),s=new Map;return m(s,t,"indexed",e.crossFileCallerMap(i,{semantic:!1})),r.semantic&&m(s,t,"semantic",D(n,i)),r.sourceFallback!==!1&&m(s,t,"source-fallback",e.sourceFallbackCallerFiles(i)),t.totalFiles=[...s.values()].reduce((o,a)=>o+a.size,0),{sources:s,counters:t}}function m(n,e,i,r){let t=0;for(let[s,o]of r){let a=n.get(s);a||(a=new Map,n.set(s,a));for(let c of o){t++;let l=a.get(c)??new Set;l.add(i),a.set(c,l)}}i==="indexed"?e.indexedFiles+=t:i==="semantic"?e.semanticFiles+=t:e.fallbackFiles+=t}function x(n,e,i,r=new Map){let t=[],s=0,o=0,a=F(e.symbol),c=[];for(let l of i){let u;k(n,l,e.relativePath,a)?(s++,u="reexport-only"):w(n,l,a)?(o++,u="import-only"):(t.push(l),u="real"),c.push({file:l,sources:[...r.get(l)??[]],classification:u})}return{partition:{realConsumers:t,barrelConsumers:s,importOnlyConsumers:o},files:c}}function w(n,e,i){if(!i)return!1;let r=y(e);if(!r)return!1;let t=L.get(n,e,()=>h(n,e,r));return t.importedLeaves.has(i)&&!t.usedLeaves.has(i)}function h(n,e,i){let r=f(n).forFile(e,{text:!0,ast:!0}),t=r.text;if(!t)return I();let s=C(n,e,t),o=S.read(n,e,s);if(o)return o;let a=P(r.ast,i);return S.write(n,e,s,a),a}function P(n,e){let i=new Set,r=new Set;if(!n)return{importedLeaves:i,usedLeaves:r};let t=e==="rust"?new Set(["use_declaration"]):e==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),s=(o,a)=>{let c=a||t.has(o.type);(o.type==="identifier"||o.type==="type_identifier"||o.type==="property_identifier"||o.type==="field_identifier")&&(c?i.add(o.text):r.add(o.text));for(let l of o.children)s(l,c)};return s(n.rootNode,!1),{importedLeaves:i,usedLeaves:r}}function I(){return{importedLeaves:new Set,usedLeaves:new Set}}function U(n){return JSON.stringify({importedLeaves:[...n.importedLeaves],usedLeaves:[...n.usedLeaves]})}function O(n){try{let e=JSON.parse(n);return!Array.isArray(e.importedLeaves)||!Array.isArray(e.usedLeaves)?null:{importedLeaves:new Set(e.importedLeaves.filter(i=>typeof i=="string")),usedLeaves:new Set(e.usedLeaves.filter(i=>typeof i=="string"))}}catch{return null}}function k(n,e,i,r){if(!r)return!1;let t=f(n).forFile(e,{lines:!0,reexports:!0}),s=t.lines??[];if(s.length===0)return!1;let o=t.reexports??[];if(o.length===0)return!1;let a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`\\b${a}\\b`),l=0;for(let u=0;u<s.length;u++){if(!c.test(s[u]??""))continue;if(l++,!o.find(p=>p.startLine<=u&&u<=p.endLine))return!1}return l>0}export{$ as a,B as b,J as c,w as d};
|
|
2
|
+
//# sourceMappingURL=chunk-2FMFF4RI.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r as f}from"./chunk-UQ73QF5D.js";import{a as d}from"./chunk-NBNEVLRC.js";import{c as m,d as g}from"./chunk-63CI3IXR.js";import{d as s,h as u}from"./chunk-NABVR6B7.js";import{a as c}from"./chunk-SA3DPTHT.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-2GLNBCHB.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as D}from"./chunk-7IWIMNHI.js";import{a as F}from"./chunk-JNMLBL36.js";import{a as f}from"./chunk-YFQIKYOP.js";import{a as g}from"./chunk-E3ADDB43.js";import{c as y}from"./chunk-Z2LDWIJV.js";import{a as h}from"./chunk-HRDSU5FN.js";import{d as p}from"./chunk-AREANYIA.js";var v=.7,R=.62,S=.45;function Y(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=h(i).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let l=I(s,e);if(l.size===0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:l}).map(r=>w(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(T);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:N(b)}}function A(i,t){let e=P(t.limit),n=[...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??v,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=p(i,{scope:t.scope});return a.react&&n.push(...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function B(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function k(i,t){return u(i,t,{query:f,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:K(...e.evidenceBuckets(n)),sharedCallees:[]}))}function E(i,t){return u(i,t,{query:g,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function L(i,t){return u(i,t,{query:F,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function x(i,t){return u(i,t,{query:D,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function I(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function w(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let l=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function T(i){let t=C(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function C(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??C(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:O(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function O(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function P(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function K(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{Y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2UVCH7CQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as c,c as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as c,c as l}from"./chunk-SA3DPTHT.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3XSNW5XB.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{a as b}from"./chunk-OFXN2BCT.js";import{c as d}from"./chunk-CYHIKTJN.js";import{a as c}from"./chunk-NBNEVLRC.js";import{d as a,e as I,i as h}from"./chunk-NABVR6B7.js";import{l as u}from"./chunk-THB6AM3V.js";import{e as g}from"./chunk-SA3DPTHT.js";import{a as p}from"./chunk-64MNV6AB.js";function U(e,r,t={}){return N(e,r,t)?.map(o=>({symbol:o.symbol,shortName:o.shortName,fromFile:o.fromFile}))??[]}function j(e,r){let t=c(e,r),o=E(e,r);if(o.length>0&&!R(t))return o;let s=y(e,r,t);return f(r)&&s.length>0?s:O([...o,...s])}function B(e,r,t={}){return N(e,r,t)?.filter(o=>!o.used).map(o=>({symbol:o.symbol,shortName:o.shortName,importedIn:o.importer}))??[]}function E(e,r){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents d ON c.document_id = d.id
|
|
5
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
+
WHERE gs.symbol LIKE ?
|
|
7
|
+
AND m.role = 2
|
|
8
|
+
ORDER BY d.relative_path`,`%${r}%`).filter(o=>!e.isIgnored(o.importer)).map(o=>({symbol:o.symbol,shortName:a(o.symbol),fromFile:o.importer}))}function y(e,r,t=c(e,r)){let o=t?.relativePath??null,s=t?I(t.symbol):r.replace(/\(\)$/,""),n=t?h(t.symbol):!1,i=new Set;for(let l of p(e,{includeIgnored:!1}))for(let F of u(e,l))k(F,l,{targetFile:o,targetLeaf:s,targetIsModule:n,targetPattern:r})&&i.add(l);let m=f(r)?r.trim():null;return[...i].sort().map(l=>({symbol:m??t?.symbol??s,shortName:m??(t?a(t.symbol):s),fromFile:l}))}function R(e){return!!(e&&(e.symbol.startsWith("scip-clojure ")||g(e.relativePath)==="clojure"))}function O(e){let r=new Set,t=[];for(let o of e){let s=`${o.symbol}|${o.fromFile}`;r.has(s)||(r.add(s),t.push(o))}return t.sort((o,s)=>o.fromFile.localeCompare(s.fromFile)||o.shortName.localeCompare(s.shortName))}function k(e,r,t){return!e.sourcePath||t.targetFile&&_(e.sourcePath)!==_(t.targetFile)?!1:e.kind==="side-effect"||t.targetFile&&M(r)||e.kind==="namespace"&&D(e,t.targetPattern)||t.targetIsModule||e.kind==="named"&&e.importedName===t.targetLeaf?!0:e.kind==="namespace"&&e.usedMembers.includes(t.targetLeaf)}function D(e,r){let t=r.trim().replace(/\(\)$/,"");return f(t)?e.importedName===t||e.localName===t:!1}function f(e){let r=e.trim().replace(/\(\)$/,"");return r.includes(".")&&!r.includes("/")&&!r.includes(":")}function N(e,r,t={}){let o=b(e,r);return o?x(e,o,t)??(t.semantic===!1?null:L(e,o))??T(e,o):null}function x(e,r,t){let s=e.all(`SELECT DISTINCT
|
|
9
|
+
gs.symbol,
|
|
10
|
+
def_d.relative_path AS from_file,
|
|
11
|
+
imp_d.relative_path AS importer,
|
|
12
|
+
EXISTS (
|
|
13
|
+
SELECT 1
|
|
14
|
+
FROM mentions ref_m
|
|
15
|
+
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
16
|
+
WHERE ref_m.symbol_id = gs.id
|
|
17
|
+
AND ref_m.role != 1
|
|
18
|
+
AND ref_c.document_id = imp_d.id
|
|
19
|
+
) AS used
|
|
20
|
+
FROM mentions m
|
|
21
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
22
|
+
JOIN documents imp_d ON c.document_id = imp_d.id
|
|
23
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
24
|
+
LEFT JOIN (
|
|
25
|
+
SELECT m2.symbol_id, c2.document_id
|
|
26
|
+
FROM mentions m2
|
|
27
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
28
|
+
WHERE m2.role = 1
|
|
29
|
+
GROUP BY m2.symbol_id
|
|
30
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
31
|
+
LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
32
|
+
WHERE imp_d.relative_path = ?
|
|
33
|
+
AND m.role = 2
|
|
34
|
+
ORDER BY def_d.relative_path, gs.symbol`,r).filter(n=>!e.isIgnored(n.importer));if(s.length>0){let n=t.semantic===!1?[]:d(e,r);return s.map(i=>({symbol:i.symbol,shortName:a(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||n.some(m=>m.isUsed&&m.sourcePath===i.from_file)}))}return null}function L(e,r){let t=d(e,r);return t.length>0?t.map(o=>{let s=S(o.importedName,o.localName,o.kind);return{symbol:s,shortName:s,fromFile:o.sourcePath??"(external)",importer:r,used:o.kind==="side-effect"?!0:o.isUsed}}):null}function T(e,r){return u(e,r).map(t=>{let o=S(t.importedName,t.localName,t.kind),s=t.kind==="side-effect"?!0:t.used;return{symbol:o,shortName:o,fromFile:t.sourcePath??"(external)",importer:r,used:s}})}function S(e,r,t){return t==="namespace"&&e==="*"&&r?`* as ${r}`:t==="default"&&r?`default as ${r}`:t==="side-effect"?"(side effect import)":r&&r!==e?`${e} as ${r}`:e}function _(e){return e.replace(/\\/g,"/")}function M(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{U as a,j as b,B as c};
|
|
35
|
+
//# sourceMappingURL=chunk-4ISHQ7UW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as m}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as m}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-L446VQYQ.js";import{a as g}from"./chunk-RSSXKJ6J.js";import{r as y}from"./chunk-UQ73QF5D.js";import{a as c}from"./chunk-NBNEVLRC.js";import{d as r}from"./chunk-NABVR6B7.js";function v(l,t,n={}){let o=c(l,t);if(!o)return null;let a=[{file:o.relativePath,line:o.startLine}],s=y(l,o,{semantic:n.semantic}).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?r(e.enclosingSymbol):"(top-level)"})),{producers:f,consumers:i}=S(l,o,s,{semantic:n.semantic!==!1});return{symbol:o.symbol,shortName:r(o.symbol),relativePath:o.relativePath,definitionSites:a.filter(e=>!l.isIgnored(e.file)),usageSites:s,producers:f.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:r(e.symbol),file:e.file})),consumers:i.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":r(e.symbol),file:e.file}))}}function S(l,t,n,o){let a=m(g(l,t,{limit:30,semantic:o.semantic}).map(i=>({symbol:i.symbol,file:i.file}))),s=m(b(l,t,{limit:30,semantic:o.semantic})),f=s.length>0?s:m(n.map(i=>({symbol:i.enclosingSymbol==="(top-level)"?i.file:i.enclosingSymbol,file:i.file})));return{producers:a,consumers:f}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5GXTUANY.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-L446VQYQ.js";import{g as l}from"./chunk-63CI3IXR.js";import{d as r}from"./chunk-NABVR6B7.js";function b(o,t={}){let{limit:n=30,scope:e}=t,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
|
|
2
2
|
gs.symbol,
|
|
3
3
|
COUNT(*) AS ref_count,
|
|
4
4
|
COUNT(DISTINCT ref_d.id) AS file_count,
|
|
@@ -22,4 +22,4 @@ import{a as d}from"./chunk-UQLFQLAF.js";import{g as l}from"./chunk-4N4WONI4.js";
|
|
|
22
22
|
GROUP BY gs.id
|
|
23
23
|
ORDER BY ref_count DESC
|
|
24
24
|
LIMIT ?`,n).filter(s=>!o.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in}));return m.length>0?m:f(o,e,n)}function f(o,t,n){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,i)=>i.refCount-e.refCount||i.fileCount-e.fileCount).slice(0,n)}function u(o,t){let n=d(o,t,{limit:500});return{symbol:t.symbol,shortName:r(t.symbol),refCount:n.length,fileCount:new Set(n.map(e=>e.file)).size,definedIn:t.relativePath}}export{b as a};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-5JHEN5VN.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{a as y}from"./chunk-RM2WQ75T.js";import{b}from"./chunk-WUOB4DHH.js";import{c as D}from"./chunk-CYHIKTJN.js";import{l as p}from"./chunk-THB6AM3V.js";import{a as h}from"./chunk-64MNV6AB.js";import g from"path";function d(e){let n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n.length<=1?"(root)":n.length>=3&&["src","lib","app","server","client"].includes(n[0])?`${n[0]}/${n[1]}`:n[0]}function S(e,t){if(e===t)return"ok";let n=m(e),i=m(t);return n&&i?k(n,i)?"ok":"violation":x(e,t)}function v(e,t){let n=m(d(e)),i=m(d(t));return!!n&&!!i}function m(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function k(e,t){return t==="instrumentation"||t==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","semantic","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(t)??!1}function x(e,t){if(t==="shared")return"ok";let n={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return n[e]?n[e].has(t)?"ok":"violation":null}function Z(e,t){let{scope:n,minDeviation:i=5}=t??{},r=t?.semantic!==!1,s=t?.includePatternDeviations!==!1,o=new y(e).fileDependencyGraph(n);return M([...$(e,o,{scope:n,semantic:r}),...P(o),...s?_(o,i):[]])}function $(e,t,n){let i=N(e,n.scope),r=[],s=new Set;for(let[o,a]of t){if(l(o))continue;let u=i.get(o)??new Set;for(let f of a)l(f)||u.has(f)||I(e,o,f,n)||(r.push({file:o,dep:f}),s.add(o))}s.size>0&&A(e,i,{paths:[...s]});let c=[];for(let{file:o,dep:a}of r)(i.get(o)??new Set).has(a)||c.push({file:o,kind:"unused-import",description:`Depends on ${a} but references none of its symbols`,dep:a,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${o} to ${a}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return c}function I(e,t,n,i){return V(e,t,n)||q(e,t,n)||j(n)||U(e,t,n)||J(n)?!0:i.semantic&&B(e,t,n)}function P(e){let t=[],n=L(e);for(let[i,r]of e){if(l(i))continue;let s=d(i);for(let c of r){if(l(c))continue;let o=d(c);if(s===o)continue;let a=S(s,o),u=a?"explicit":"inferred";if((a??n.get(`${s}->${o}`))==="violation"){let R=u==="explicit"?"direct":"signal";t.push({file:i,kind:"layer-violation",description:`Imports from ${o}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${o}/`,actionTier:R,policyBasis:u,evidenceReasons:[`dependency edge exists from ${i} to ${c}`,u==="explicit"?`explicit layer policy rejects ${s}/ -> ${o}/`:`rare cross-layer edge ${s}/ -> ${o}/ is inferred as a violation`],recommendation:u==="explicit"?"Move the dependency behind an allowed layer boundary or document a policy change.":"Review whether this is a real boundary break or an intentional exception before moving code."})}}}return t}function _(e,t){let n=[];for(let[i,r]of O(e)){let s=r.filter(o=>!l(o));if(s.length<t)continue;let c=E(e,s);for(let o of s)for(let a of e.get(o)??[])l(a)||(c.get(a)??0)===1&&g.dirname(a)!==i&&g.dirname(a)!==g.dirname(i)&&(v(o,a)||n.push({file:o,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${a}`,dep:a,actionTier:"signal",evidenceReasons:[`${s.length} sibling file(s) in ${i}/ were compared`,`${o} is the only non-skipped sibling depending on ${a}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."}))}return n}function M(e){return{results:e,unusedImports:e.filter(t=>t.kind==="unused-import").length,layerViolations:e.filter(t=>t.kind==="layer-violation").length,patternDeviations:e.filter(t=>t.kind==="pattern-deviation").length}}function O(e){let t=new Map;for(let n of e.keys()){let i=g.dirname(n),r=t.get(i);r||(r=[],t.set(i,r)),r.push(n)}return t}function E(e,t){let n=new Map;for(let i of t)for(let r of e.get(i)??[])l(r)||n.set(r,(n.get(r)??0)+1);return n}function N(e,t){let n=new Map;return F(e,n,t),n}function F(e,t,n){for(let i of T(e,n))w(e,t,i.from_file,i.to_file)}function T(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents d1 ON c.document_id = d1.id
|
|
5
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
+
JOIN (
|
|
7
|
+
SELECT m2.symbol_id, c2.document_id
|
|
8
|
+
FROM mentions m2
|
|
9
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
10
|
+
WHERE m2.role = 1
|
|
11
|
+
GROUP BY m2.symbol_id
|
|
12
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
13
|
+
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
14
|
+
WHERE d1.id != d2.id
|
|
15
|
+
AND m.role != 1
|
|
16
|
+
${e.pathExclusionsFor("d1","d2")}
|
|
17
|
+
${n}`)}function A(e,t,n={}){new y(e).scanSourceReferences({paths:n.paths??h(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},r=>{r.target.relativePath!==r.sourceFile&&(e.isIgnored(r.target.relativePath)||w(e,t,r.sourceFile,r.target.relativePath))})}function w(e,t,n,i){if(e.isIgnored(n)||e.isIgnored(i))return;let r=t.get(n);r||(r=new Set,t.set(n,r)),r.add(i)}function L(e){let t=new Map;for(let[i,r]of e){if(l(i))continue;let s=d(i);for(let c of r){if(l(c))continue;let o=d(c);if(s===o||S(s,o))continue;let a=`${s}->${o}`;t.set(a,(t.get(a)??0)+1)}}let n=new Map;for(let[i,r]of t)n.set(i,r<=2?"violation":"ok");return n}function j(e){return e.includes("types")||e.endsWith(".d.ts")}function B(e,t,n){let i=D(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.some(r=>r.isUsed)}function V(e,t,n){let i=p(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.some(r=>r.used)}function q(e,t,n){let i=p(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.every(r=>r.isTypeOnly===!0)}function J(e){return e.endsWith(".vue")}function U(e,t,n){let i=p(e,t).filter(r=>r.sourcePath===n);return i.length===0?!1:i.every(r=>r.kind==="side-effect"||r.kind==="namespace"&&r.usedMembers.length===0&&!r.used)}function l(e){let t=b(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||z(g.basename(e)))}function z(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{Z as a};
|
|
18
|
+
//# sourceMappingURL=chunk-62ULXMQ7.js.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import{a as f,b as R,c as m,d as F,e as N,f as p,h as E}from"./chunk-NABVR6B7.js";import{g as h}from"./chunk-THB6AM3V.js";import{b,c as D,h as _,j as L}from"./chunk-SGTKURU6.js";import{a as S}from"./chunk-64MNV6AB.js";import{c as g}from"./chunk-7S5E7KWT.js";function ge(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
|
+
${O(n.orderBy)}
|
|
8
|
+
${k(n.limit)}`,...n.params??[])}function be(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
|
+
${O(n.orderBy)}
|
|
26
|
+
${k(n.limit)}`,...n.params??[])}function O(e){return e?`ORDER BY ${e}`:""}function k(e){return typeof e=="number"?`LIMIT ${e}`:""}function w(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 $(e){if(!e)return null;let n=M(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(M(i)??i).replace(/\n/g," ")}function M(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function j(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&&!j(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 H=g("file-definitions",{clearGroups:["definition-catalog"]}),W=g("file-function-like-definitions",{clearGroups:["definition-catalog"]}),C=new WeakMap;function I(e,n){return H.get(e,n,()=>{let t=P(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&&Q.write(e,n,b(e,n,o),{projectFingerprint:r,definitions:i.map(s=>({...s}))}),i})}function Y(e,n){return W.get(e,n,()=>{let t=P(e,n);return t?t.filter(i=>i.isFunctionLike):B(e,n,i=>i.isFunctionLike)})}var Q=L({kind:"file-definitions",serialize:K,deserialize:G});function P(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=Q.read(e,n,b(e,n,i));return r?U(r,t,n):null}function K(e){return JSON.stringify(e)}function G(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 U(e,n,t){if(e.projectFingerprint!==n)return null;let i=[];for(let r of e.definitions){let o=q(r,t);if(!o)return null;i.push(o)}return i}function q(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(X(e,n),Z(e,n),{sort:!0}).map(J);return t&&(i=i.filter(t)),z(e,n,i)}function X(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 Z(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:N(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:E(e.symbol),isTypeLike:p(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function ke(e,n={}){return V(e,n.scope)}function V(e,n){return S(e,{scope:n,includeIgnored:!1}).flatMap(t=>I(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function we(e,n){return S(e,{scope:n,includeIgnored:!1}).flatMap(t=>Y(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function $e(e,n){let t=T(ee(e,n.scope,n.sqlPrefilter)),i=T(ne(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(...z(e,s,l.map(J)))}return o}function ee(e,n,t){let i=n?"AND d.relative_path LIKE ?":"",r=t?`AND ${v("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 ne(e,n,t){let i=n?"AND d.relative_path LIKE ?":"",r=t?`AND ${v("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 te(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function v(e,n){return n==="callable"?te(e):ie(e)}function ie(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function T(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 Ce(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:F(r.symbol),signature:w($(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function re(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 Te(e,n){let t=C.get(e);return t||(t=re(e),C.set(e,t)),t.get(n)??null}function Ae(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 z(e,n,t){let i=f(e).forFile(n,{text:!0}).text,r=h(e,n);return r?de(t,r,i):i?oe(t,i):t}function oe(e,n){let t=n.split(/\r?\n/),i=se(e,t),r=le(e,i),o=ae(r,t);return ce(e,o)}function se(e,n){let t=e.some(r=>y(r.symbol))?fe(n):null,i=new Map;for(let r of e)i.set(r.symbolId,ue(n,t,r));return i}function le(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 ae(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:pe(n,r.definition,r.startLine,s)})}return t}function ce(e,n){return e.map(t=>{let i=n.get(t.symbolId);return i?{...t,startLine:i.startLine,endLine:i.endLine}:t})}function de(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(!me(r)||!r.leaf)return A(r,t);let o=i.get(r.leaf);if(!o||o.length===0)return A(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 me(e){return y(e.symbol)?!0:p(e.symbol)==="term"&&m(e.symbol)===null}function A(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 ue(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 fe(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 pe(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=ye(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 ye(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 Qe(e){let n=R(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{ge as a,be as b,w as c,$ as d,x as e,I as f,ke as g,V as h,we as i,$e as j,Ce as k,re as l,Te as m,Ae as n,Qe as o};
|
|
102
|
+
//# sourceMappingURL=chunk-63CI3IXR.js.map
|