scip-query 0.16.1 → 0.17.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/CHANGELOG.md +21 -0
- package/README.md +59 -9
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-WN6XEYVX.js → chunk-27YDE22N.js} +2 -2
- package/dist/{chunk-VLSI5MYU.js → chunk-2DBY4MO7.js} +2 -2
- package/dist/{chunk-A46JTKTM.js → chunk-2DUWNJKE.js} +2 -2
- package/dist/{chunk-YSUD2S7T.js → chunk-2HCWAL42.js} +2 -2
- package/dist/{chunk-S5MTSES5.js → chunk-2TM23JYJ.js} +2 -2
- package/dist/{chunk-6EVORGCB.js → chunk-35DURZXI.js} +2 -2
- package/dist/{chunk-3LAKH6BV.js → chunk-3CJXFMR5.js} +2 -2
- package/dist/{chunk-UO4IADXJ.js → chunk-3YEBIYXL.js} +2 -2
- package/dist/{chunk-3YAZH3JU.js → chunk-45QWQSWS.js} +2 -2
- package/dist/{chunk-5XDNFOAH.js → chunk-4FLF7BHJ.js} +2 -2
- package/dist/{chunk-JRFCWCOD.js → chunk-4L4X66GE.js} +2 -2
- package/dist/{chunk-NLRWGGPY.js → chunk-5CJ6AQN7.js} +2 -2
- package/dist/{chunk-CM4EZLW4.js → chunk-5GAUXLOE.js} +2 -2
- package/dist/{chunk-QB7NRST4.js → chunk-5N5ZC566.js} +2 -2
- package/dist/{chunk-YD37KSEK.js → chunk-5QSMW5IO.js} +2 -2
- package/dist/{chunk-7II7NFRV.js → chunk-623AZLTE.js} +2 -2
- package/dist/{chunk-VYQY75NA.js → chunk-6TJERPN3.js} +2 -2
- package/dist/{chunk-IRIM3SUR.js → chunk-75H6GOND.js} +2 -2
- package/dist/{chunk-Q65QYKU7.js → chunk-7H37Z4UO.js} +2 -2
- package/dist/{chunk-OO6S4ECV.js → chunk-7XP7ZRSI.js} +2 -2
- package/dist/{chunk-5TVNLPUM.js → chunk-7Z5UT44B.js} +2 -2
- package/dist/{chunk-RQWNF2RM.js → chunk-BBTVIIOI.js} +2 -2
- package/dist/{chunk-MZB3DTHW.js → chunk-BGUYAA3Q.js} +2 -2
- package/dist/{chunk-3I34FZ6R.js → chunk-BTYDBDX5.js} +2 -2
- package/dist/{chunk-2EU6WVR3.js → chunk-BW4VDICR.js} +2 -2
- package/dist/{chunk-DKK2H4D7.js → chunk-CKRVVBM6.js} +2 -2
- package/dist/{chunk-ZHGUZKJL.js → chunk-CMLHZWRS.js} +2 -2
- package/dist/{chunk-OYGKBDAD.js → chunk-CSMPXDYE.js} +2 -2
- package/dist/{chunk-GWWYLYD3.js → chunk-DQYG5JHT.js} +2 -2
- package/dist/{chunk-6DNE65QS.js → chunk-E5HPTSRD.js} +2 -2
- package/dist/chunk-E7BTIEAY.js +2 -0
- package/dist/{chunk-RPMT6MTX.js → chunk-EUMETOTD.js} +2 -2
- package/dist/{chunk-2Y7YX54K.js → chunk-FY6RCFDH.js} +2 -2
- package/dist/{chunk-YFEJIYWH.js → chunk-FZXN37RN.js} +2 -2
- package/dist/{chunk-KI4WPR7Q.js → chunk-G4IUQW27.js} +2 -2
- package/dist/{chunk-U6BJVXWQ.js → chunk-GRHA5NGF.js} +2 -2
- package/dist/{chunk-XBPAJASV.js → chunk-H4T2AST4.js} +2 -2
- package/dist/{chunk-SOCS3467.js → chunk-HGO3D2JD.js} +2 -2
- package/dist/{chunk-LT6AHYVY.js → chunk-HJYHSTCP.js} +2 -2
- package/dist/{chunk-XC6PUFNN.js → chunk-HYRSGWFX.js} +2 -2
- package/dist/{chunk-K32ZOW3P.js → chunk-HZVG4KID.js} +2 -2
- package/dist/{chunk-RLB7FZKR.js → chunk-IHD2CHMX.js} +2 -2
- package/dist/{chunk-VSQRU3AP.js → chunk-IKAJI4SI.js} +2 -2
- package/dist/{chunk-BVHP2B4D.js → chunk-IZLWLO4X.js} +2 -2
- package/dist/{chunk-QSNG3NHQ.js → chunk-J7WYG63U.js} +2 -2
- package/dist/{chunk-NLVKD45E.js → chunk-JLZUM476.js} +2 -2
- package/dist/{chunk-7RAS466A.js → chunk-JYBP5ZIR.js} +2 -2
- package/dist/{chunk-S5RZQA6V.js → chunk-K3UVTL3J.js} +2 -2
- package/dist/{chunk-DA34GNNO.js → chunk-KWMRY4RN.js} +2 -2
- package/dist/{chunk-363TZ64I.js → chunk-KWQKWY6M.js} +2 -2
- package/dist/{chunk-PCCMMI2M.js → chunk-KZ2LZBQT.js} +2 -2
- package/dist/{chunk-S3IXCXW2.js → chunk-LG33DNTZ.js} +2 -2
- package/dist/chunk-M2TRDR25.js +84 -0
- package/dist/{chunk-VZCR3VQY.js → chunk-MBDBNQBW.js} +2 -2
- package/dist/chunk-MON5XXTG.js +7 -0
- package/dist/{chunk-EVCSXWER.js → chunk-O27267B6.js} +2 -2
- package/dist/{chunk-YCVYOV4A.js → chunk-O56VBJKB.js} +2 -2
- package/dist/{chunk-CS3FXTUC.js → chunk-OBPR6E5Z.js} +2 -2
- package/dist/{chunk-2LGPMYS2.js → chunk-OC7XDK62.js} +2 -2
- package/dist/{chunk-5UKDCXVC.js → chunk-OP5JXGDV.js} +2 -2
- package/dist/{chunk-CKIAEVGM.js → chunk-PA2MQKXD.js} +2 -2
- package/dist/{chunk-BFWVHD2P.js → chunk-PPAT3XUL.js} +2 -2
- package/dist/{chunk-G4KQ7S74.js → chunk-QEIGJJBC.js} +2 -2
- package/dist/{chunk-AAMZRDJT.js → chunk-QYBCGCY5.js} +2 -2
- package/dist/{chunk-W3ZVRLCH.js → chunk-RPPV6Y4K.js} +2 -2
- package/dist/{chunk-HGUNWXJX.js → chunk-RUQE7DZT.js} +2 -2
- package/dist/chunk-SMBIGBGN.js +67 -0
- package/dist/{chunk-EBSSCVR4.js → chunk-SQJ72PQW.js} +5 -5
- package/dist/{chunk-6GZ7LM7S.js → chunk-SSH2NPYS.js} +2 -2
- package/dist/{chunk-S2FZILCF.js → chunk-TAB7AWKO.js} +2 -2
- package/dist/{chunk-MCNWCJYL.js → chunk-TLTLJ4SW.js} +2 -2
- package/dist/{chunk-JXAJDINF.js → chunk-TR7C5HOC.js} +2 -2
- package/dist/{chunk-3OPIMH42.js → chunk-U244OVE6.js} +2 -2
- package/dist/chunk-U267E6YN.js +120 -0
- package/dist/chunk-U3JW5AYG.js +2 -0
- package/dist/{chunk-JQ2PCFZW.js → chunk-UKUISUS6.js} +2 -2
- package/dist/{chunk-2HFXPIBT.js → chunk-UWR52GNZ.js} +2 -2
- package/dist/{chunk-CVBS2FD4.js → chunk-V7MX6YUF.js} +2 -2
- package/dist/{chunk-BVUA3GZC.js → chunk-VCRMI56V.js} +2 -2
- package/dist/{chunk-753JWTUH.js → chunk-VDHEX6YO.js} +2 -2
- package/dist/{chunk-AMPN2VMF.js → chunk-W2I4QAW7.js} +2 -2
- package/dist/{chunk-P5QZILZ4.js → chunk-W3HSUCRG.js} +2 -2
- package/dist/{chunk-62Y3PC27.js → chunk-WENI5ZDR.js} +2 -2
- package/dist/{chunk-RYFIRFYJ.js → chunk-WGDIA2TU.js} +2 -2
- package/dist/{chunk-L27UIF3E.js → chunk-WT34AUWL.js} +2 -2
- package/dist/{chunk-HLRWOFXC.js → chunk-X566NT42.js} +2 -2
- package/dist/{chunk-ZEKBAMCN.js → chunk-XKWEMFHP.js} +2 -2
- package/dist/{chunk-SEEJPIWG.js → chunk-Y4BBVPRK.js} +2 -2
- package/dist/{chunk-KP2DJY7D.js → chunk-Y5BOEWAE.js} +2 -2
- package/dist/cli.js +321 -302
- package/dist/{config-types-SVkUIufk.d.ts → config-types-70s7NxKB.d.ts} +2 -0
- package/dist/{db-CS0TuVH6.d.ts → db-BBmJ0v3b.d.ts} +1 -1
- package/dist/{health-Btal3mQi.d.ts → health-CWpFL_6z.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- 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/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.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/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.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 +3 -3
- 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/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.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 +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 +2 -2
- 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/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.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 +26 -26
- package/dist/reindex.d.ts +3 -3
- package/dist/reindex.js +38 -34
- package/dist/runtime.d.ts +5 -3
- package/dist/runtime.js +1 -2
- package/dist/{scip-cli-BKL-26TZ.d.ts → scip-cli-CoMzb7Zu.d.ts} +1 -1
- package/dist/watch-server.js +4 -4
- package/docs/COMMAND_REFERENCE.md +1 -1
- package/package.json +2 -1
- package/skills/_shared/SKILL.md +2 -2
- package/skills/scip-calibrate/SKILL.md +5 -4
- package/skills/scip-tla-model-system/SKILL.md +10 -8
- package/skills/scip-verify/SKILL.md +3 -2
- package/dist/chunk-5P26M63Y.js +0 -2
- package/dist/chunk-FFIYGYQR.js +0 -67
- package/dist/chunk-QVZSWLLZ.js +0 -2
- package/dist/chunk-WFRZGMWJ.js +0 -71
- package/dist/chunk-XAEU4ROB.js +0 -101
- package/dist/chunk-Y42DMR6F.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `scip-query` are documented here. This file starts at 0.11.0; everything below covers behavior changes made since the 0.10.12 release.
|
|
4
4
|
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.17.1]
|
|
8
|
+
|
|
9
|
+
### Fixes (worktree watcher isolation)
|
|
10
|
+
|
|
11
|
+
- Automatic refresh now persists and validates the Git worktree identity of each daemon. Every default-managed worktree starts or reuses its own watcher, watches only its own checkout, and sends reindex output only to its own writable cache; portable source subscriptions detect ordinary unstaged edits on Node 18 Linux, Git polling independently detects `HEAD` and index changes, and `watch --status` reports the bound root and worktree ID.
|
|
12
|
+
|
|
13
|
+
## [0.17.0]
|
|
14
|
+
|
|
15
|
+
### Performance (Git worktree warm starts)
|
|
16
|
+
|
|
17
|
+
- Clean Git worktrees at the same repository snapshot now warm-start from one immutable shared index generation while retaining separate writable local caches. Concurrent cold worktrees coordinate one generation build, dirty edits stay isolated to their checkout, safe content-keyed evidence reads through a bounded repository database, and managed caches for removed worktrees are reclaimed automatically. `SCIP_QUERY_SHARED_CACHE=0` disables the behavior, and explicit cache/database overrides remain private.
|
|
18
|
+
- Shared-generation reuse now verifies producer compatibility, complete peer artifacts, SQLite state, and full source stability. Hydration rolls back the complete prior local cache on failure; cleanup coordinates with lease writes and protects live watcher/build/hydration processes, ownership checksums, and physical path containment.
|
|
19
|
+
|
|
20
|
+
### Accuracy (effectiveness verification)
|
|
21
|
+
|
|
22
|
+
- Effectiveness events now preserve the resolved Git comparison commit. After `HEAD` advances, a clean gate run replays the original comparison before marking a finding fixed: committed defects remain open, committed repairs receive verified credit, moving refs cannot change the baseline retroactively, and dirty or unavailable replays remain pending. Legacy events stay readable and retain their existing conservative classification.
|
|
23
|
+
|
|
5
24
|
## [0.16.1]
|
|
6
25
|
|
|
7
26
|
### Fixes
|
|
@@ -101,4 +120,6 @@ All notable changes to `scip-query` are documented here. This file starts at 0.1
|
|
|
101
120
|
- **Calibration retunes from external repo validation:** `duplicate-bodies`' default `--min-loc` raised from 1 to 3 (kills 1-line forwarding-stub noise); `twin-drift` excludes synthetic constructor-style leaves and test-only groups; `co-change` exempts locale/i18n sibling resource files from hidden-coupling findings; `stale-abstractions`/`wrapper-candidates` gained an explicit false-positive-rate caveat and were demoted from the default `cleanup-audit` sweep to an opt-in deep-dive.
|
|
102
121
|
- Assorted smaller fixes: parameterized SQL in a scope filter (injection-shaped hygiene, no known exploit), fan-in/hotspot queries no longer counting a symbol's own defining file as a consumer, AST-based cyclomatic-complexity counting, nested `.gitignore` support, and Vue single-file-component script extraction unified across the codebase.
|
|
103
122
|
|
|
123
|
+
[0.17.1]: https://github.com/PlunderStruck/scip-query/releases/tag/v0.17.1
|
|
124
|
+
[0.17.0]: https://github.com/PlunderStruck/scip-query/releases/tag/v0.17.0
|
|
104
125
|
[0.11.0]: https://github.com/PlunderStruck/scip-query/releases/tag/v0.11.0
|
package/README.md
CHANGED
|
@@ -242,7 +242,7 @@ scip-query suppress SQABC123DEF456 --check echo --reason "intentional compatibil
|
|
|
242
242
|
|
|
243
243
|
This writes one file per suppression under `.scipquery/suppressions/` — commit it with your change. One-file-per-suppression means two branches suppressing different findings merge without conflict; the legacy `suppressions[]` array in `.scipquery.json` is still honored (read-only). Every suppression requires a reason plus either a stable finding id or a `check` (optionally narrowed by `file`). Check+file suppressions are allowed but warn because they waive every matching finding in that file. `diff-gate --json` reports both active and suppressed findings.
|
|
244
244
|
|
|
245
|
-
**12. Measure whether the gate is earning its keep.** Every completed `diff-gate` run, including JSON and installed Stop-hook runs, writes each finding transition to its own committed `.scipquery/events/*.json` file. Independent branches add independent paths instead of editing one shared ledger file, so ordinary event writes do not create merge conflicts.
|
|
245
|
+
**12. Measure whether the gate is earning its keep.** Every completed `diff-gate` run, including JSON and installed Stop-hook runs, writes each finding transition to its own committed `.scipquery/events/*.json` file. Independent branches add independent paths instead of editing one shared ledger file, so ordinary event writes do not create merge conflicts. Each event stores the immutable Git commit used as its comparison base. A finding is a verified fix when it disappears under that same comparison—either directly or after scip-query cleanly replays the original base against a newer committed `HEAD`. Merely committing the finding cannot clear it: if replay still finds it, the outcome stays open; if the worktree is dirty or Git cannot reproduce the base, verification waits. A suppressed finding was noise or an accepted trade-off:
|
|
246
246
|
|
|
247
247
|
```bash
|
|
248
248
|
scip-query effectiveness --since 30d
|
|
@@ -254,7 +254,7 @@ echo 14 10 2 1 0 1 83% 0.8
|
|
|
254
254
|
new-dead 6 5 0 1 0 0 100% 0.3
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
`precision` is verified fixed ÷ (verified fixed + suppressed). `moved` separates rename churn, while `unverified`
|
|
257
|
+
`precision` is verified fixed ÷ (verified fixed + suppressed). `moved` separates rename churn, while `unverified` is reserved for legacy or otherwise non-comparable resolutions that lack replay proof. Run diff-gate once to record the finding and again after the repair; a pre-commit rerun uses the same base directly, while a clean post-commit run automatically replays the stored base. Filter with `--check <name>`, window with `--since 30d|12w|<ISO date>`, and get machine-readable output with `--json`. Because the event files are committed, the numbers survive re-clones and aggregate across every machine and agent working the repo. Legacy `.scipquery/ledger/events.jsonl` records remain readable and are migrated to individual files on the next gate write. Historical cross-`HEAD` events without stored comparison evidence remain unverified rather than being reclassified speculatively. Standalone health/cleanup commands are not yet outcome-tracked because they do not all expose a complete-scan contract.
|
|
258
258
|
|
|
259
259
|
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").
|
|
260
260
|
|
|
@@ -437,6 +437,55 @@ Vue single-file components are handled through the JavaScript/TypeScript indexer
|
|
|
437
437
|
|
|
438
438
|
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.
|
|
439
439
|
|
|
440
|
+
Git worktrees in the same repository also share immutable generations under
|
|
441
|
+
`~/.cache/scip-query/repositories/<repository-id>/`. A shared generation is a
|
|
442
|
+
complete index for one exact committed tree, indexing configuration, artifact
|
|
443
|
+
schema, and scip-query producer version; its immutability lets several
|
|
444
|
+
worktrees trust it without sharing later writes.
|
|
445
|
+
Before an index-reading command opens SQLite, a clean worktree with an exact
|
|
446
|
+
generation clones it into that worktree's normal writable cache. Filesystem
|
|
447
|
+
copy-on-write cloning is used when available, with an ordinary copy fallback;
|
|
448
|
+
hard links are never used. Dirty edits, watcher refreshes, locks, and local
|
|
449
|
+
`evidence.db` state therefore remain private to the worktree.
|
|
450
|
+
|
|
451
|
+
Automatic refresh follows the same boundary. When `watch.enabled` is true,
|
|
452
|
+
the first watcher-eligible command in each worktree starts or reuses a daemon
|
|
453
|
+
identified by that checkout's Git worktree ID. A Git worktree ID is a checkout
|
|
454
|
+
identifier derived from its filesystem path after symbolic-link redirects are
|
|
455
|
+
resolved and its checkout-specific Git control directory; that combination
|
|
456
|
+
distinguishes sibling worktrees even though they share repository objects. The
|
|
457
|
+
daemon observes only that worktree's files and Git index, and every reindex
|
|
458
|
+
child writes only to that worktree's writable `index.scip` and `index.db`. A
|
|
459
|
+
cross-platform source watcher maintains the directory subscriptions needed to
|
|
460
|
+
detect ordinary unstaged edits even when Node does not provide recursive
|
|
461
|
+
filesystem events, while separate Git polling detects commit and staging-state
|
|
462
|
+
changes. A
|
|
463
|
+
shared generation is only a warm starting snapshot; it never implies a shared
|
|
464
|
+
watcher or shared later writes. A daemon that exits after its configured idle
|
|
465
|
+
timeout starts warm again when that worktree is next used.
|
|
466
|
+
|
|
467
|
+
The primary checkout is only a possible source of a generation, never an
|
|
468
|
+
authority for a linked worktree. If its local cache already contains
|
|
469
|
+
uncommitted changes that are absent from a new worktree's `HEAD`, the full
|
|
470
|
+
source fingerprint differs and that cache is rejected. The new worktree uses
|
|
471
|
+
an existing immutable generation for its own `HEAD` or performs the one clean
|
|
472
|
+
build that creates it.
|
|
473
|
+
|
|
474
|
+
The same behavior applies whether a worktree was created by Git, Conductor, or
|
|
475
|
+
an agent. Concurrent cold worktrees at one snapshot coordinate one shared
|
|
476
|
+
publication. A removed managed worktree cache is deleted by the next
|
|
477
|
+
opportunistic sweep after its watcher, hydration, and index-build processes
|
|
478
|
+
have exited; a shared generation stays while a live worktree or process
|
|
479
|
+
references it, then remains for one unreferenced hour unless the 2 GiB
|
|
480
|
+
repository budget requires earlier eviction. Ownership checksums and physical
|
|
481
|
+
path containment prevent cleanup from following forged records or symlinks.
|
|
482
|
+
Explicit `dbPath`, `SCIP_QUERY_CACHE_DIR`, and
|
|
483
|
+
`SCIP_QUERY_INDEX_DB` locations are never shared or automatically deleted.
|
|
484
|
+
Those explicit overrides also bypass default path isolation, so pointing two
|
|
485
|
+
worktrees at the same mutable override is intentionally outside automatic
|
|
486
|
+
per-worktree protection.
|
|
487
|
+
Set `SCIP_QUERY_SHARED_CACHE=0` to restore worktree-local-only behavior.
|
|
488
|
+
|
|
440
489
|
Each rebuilt generation also records an affected-set shadow beside the index:
|
|
441
490
|
the files a future incremental writer would recompute, the normalized
|
|
442
491
|
documents/facts that the authoritative full rebuild actually changed, recall,
|
|
@@ -555,13 +604,14 @@ dead and isolated cleanup detectors.
|
|
|
555
604
|
|
|
556
605
|
Useful environment variables:
|
|
557
606
|
|
|
558
|
-
| Variable | Purpose
|
|
559
|
-
| ------------------------- |
|
|
560
|
-
| `SCIP_QUERY_PROJECT_ROOT` | Override the project root directory
|
|
561
|
-
| `SCIP_QUERY_INDEX_DB` | Override the SQLite database path
|
|
562
|
-
| `SCIP_QUERY_INDEX_SCIP` | Override the SCIP protobuf path
|
|
563
|
-
| `SCIP_QUERY_CACHE_DIR` | Override the cache directory
|
|
564
|
-
| `
|
|
607
|
+
| Variable | Purpose |
|
|
608
|
+
| ------------------------- | ----------------------------------------------------------------------- |
|
|
609
|
+
| `SCIP_QUERY_PROJECT_ROOT` | Override the project root directory |
|
|
610
|
+
| `SCIP_QUERY_INDEX_DB` | Override the SQLite database path and bypass automatic worktree sharing |
|
|
611
|
+
| `SCIP_QUERY_INDEX_SCIP` | Override the SCIP protobuf path |
|
|
612
|
+
| `SCIP_QUERY_CACHE_DIR` | Override the cache directory and bypass automatic worktree sharing |
|
|
613
|
+
| `SCIP_QUERY_SHARED_CACHE` | Set to `0` to disable shared generations, evidence, leases, and cleanup |
|
|
614
|
+
| `SCIP_QUERY_SCIP_BIN` | Path to a local `scip` binary (overrides PATH and the Windows sidecar) |
|
|
565
615
|
|
|
566
616
|
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.
|
|
567
617
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as t}from"./chunk-
|
|
1
|
+
import{c as t}from"./chunk-4L4X66GE.js";import"./chunk-SMBIGBGN.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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as m,c as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as m,c as d}from"./chunk-5CJ6AQN7.js";import{a as $}from"./chunk-QEIGJJBC.js";function v(r,e={}){return P(r,e).cycles}function P(r,e={}){let{scope:s,maxDepth:i=10}=e,n=$(r,s,{scipEdges:"imports-only"}),c=[],a=new Set,l=new Set,f=[],g=!1;function b(t,o){if(o>i){g=!0;return}if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),y=u.indexOf(u.reduce((C,D)=>C<D?C:D)),p=[...u.slice(y,-1),...u.slice(0,y),u[y]],k=p.join(" -> ");S.has(k)||(S.add(k),c.push({path:p,kind:w(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let x=n.get(t);if(x)for(let h of x)b(h,o+1);f.pop(),l.delete(t)}let S=new Set;for(let t of n.keys())a.has(t)||b(t,0);return c.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),{cycles:c,truncated:g,maxDepth:i}}function w(r){for(let i of r){let n=m(i);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(r.length!==3)return"real";let[e,s]=r;return!e||!s?"real":d(e)||d(s)||B(e,s)||B(s,e)||R(e,s)||R(s,e)||m(e)==="entry"||m(s)==="entry"?"module-hierarchy":"real"}function B(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=e.replace(/\.rs$/,"/");return r.startsWith(s)?!r.slice(s.length).includes("/"):!1}function R(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=r.replace(/\.rs$/,""),i=e.replace(/\.rs$/,"");if(s===i+"_tests"||s===i+"/tests")return!0;let n=r.split("/"),c=e.split("/");if(n.length===c.length&&n.includes("tests")&&c.includes("src")){let a=n[n.length-1],l=c[c.length-1];if(a&&a===l)return!0}return!1}export{v as a,P as b};
|
|
2
|
+
//# sourceMappingURL=chunk-27YDE22N.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f,b as m}from"./chunk-QZ4JVECJ.js";import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f,b as m}from"./chunk-QZ4JVECJ.js";import{a as u}from"./chunk-JLZUM476.js";import{B as g,E as d}from"./chunk-TLTLJ4SW.js";import{y as l}from"./chunk-M2TRDR25.js";import{readFileSync as E,readdirSync as h}from"fs";import{basename as k,join as c}from"path";function S(t,e,r={}){let a=new Set(t),n=new Set(e),o=[...n].filter(i=>!a.has(i)).sort(),s=r.allowExtra?[]:[...a].filter(i=>!n.has(i)).sort();return{missing:o,extra:s}}function b(t,e){let r=N(t,e.file,e.keys);if(!r.ok)return{name:e.name,file:e.file,status:"unavailable",missing:[],extra:[],unavailableReason:r.reason};let a=L(t.config.projectRoot,e.mustEqual),n=S(r.keys,a,{allowExtra:e.allowExtra??!1}),o=n.missing.length>0||n.extra.length>0?"violated":"ok";return{name:e.name,file:e.file,status:o,missing:n.missing,extra:n.extra}}function O(t,e){return e.map(r=>b(t,r))}function G(t,e){if(e.has(t.file))return!0;let r=t.mustEqual;switch(r.type){case"top-level-dirs":return[...e].some(a=>a===r.path||a.startsWith(`${r.path}/`));case"file-glob":return[...e].some(a=>f(r.pattern,a));case"registered-commands":return e.has("docs/COMMAND_REFERENCE.md");case"builtin-skills":return[...e].some(a=>a.startsWith("skills/"))}}function I(t){if(t.status==="unavailable")return`[coverage-contract] ${t.name}: DISCLOSED \u2014 could not evaluate (${t.unavailableReason})`;let e=[];return t.missing.length>0&&e.push(`missing ${t.missing.join(", ")}`),t.extra.length>0&&e.push(`extra ${t.extra.join(", ")}`),`[coverage-contract] ${t.name}: ${e.join("; ")}`}function N(t,e,r){return r.type==="markdown-list"?T(t,e,r.marker):R(t,e,r)}function R(t,e,r){if(!l(t,e))return{ok:!1,reason:`file not found: ${e}`};let n=g(e);if(!n)return{ok:!1,reason:`unsupported file type for ${r.type} extraction: ${e}`};let o=d(t,e);if(!o)return{ok:!1,reason:`tree-sitter parser unavailable for ${n} (${e}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:n,reason:"parser-unavailable"}};let s=r.type==="object-literal-keys"?D(o,r.identifier):w(o,r.identifier);return s===null?{ok:!1,reason:`no ${r.type==="object-literal-keys"?"object literal":"string array"} named "${r.identifier}" found in ${e}`}:{ok:!0,keys:s}}function y(t){let e=t.childForFieldName("value");return e?e.type==="as_expression"||e.type==="satisfies_expression"?e.namedChild(0):e:null}function D(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let n=y(r);if(n?.type==="object")return $(n)}return null}function $(t){let e=new Set;for(let r of t.namedChildren)if(r.type==="pair"){let a=r.childForFieldName("key");a&&e.add(C(a.text))}else r.type==="shorthand_property_identifier"&&e.add(r.text);return[...e].sort()}function w(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let n=y(r);if(n?.type!=="array")continue;let o=new Set;for(let s of n.namedChildren)s.type==="string"&&o.add(C(s.text));return[...o].sort()}return null}function C(t){return t.length>=2&&(t[0]==="'"&&t.endsWith("'")||t[0]==='"'&&t.endsWith('"'))?t.slice(1,-1):t}function T(t,e,r){let a=l(t,e);if(!a)return{ok:!1,reason:`file not found: ${e}`};let n=v(a,r);return n===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${r} --> ... <!-- END GENERATED ${r} --> block in ${e}`}:{ok:!0,keys:x(n)}}function v(t,e){let r=u(e),n=new RegExp(`<!--\\s*BEGIN GENERATED ${r}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${r}\\s*-->`).exec(t);return n?n[1]:null}function x(t){let e=new Set;for(let r of t.matchAll(/`([a-z][a-z0-9-]*)`/g))e.add(r[1]);for(let r of t.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))e.add(r[1]);return[...e].sort()}function L(t,e){switch(e.type){case"top-level-dirs":return p(c(t,e.path));case"file-glob":return[...new Set(m(t,e.pattern).map(r=>k(r)))].sort();case"registered-commands":return A(t);case"builtin-skills":return p(c(t,"skills"))}}function p(t){let e;try{e=h(t,{withFileTypes:!0})}catch{return[]}return e.filter(r=>r.isDirectory()&&!r.name.startsWith(".")).map(r=>r.name).sort()}function A(t){let e;try{e=E(c(t,"docs/COMMAND_REFERENCE.md"),"utf-8")}catch{return[]}let r=v(e,"COMMAND REFERENCE");return r?x(r):[]}var z={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0},isolated:{minLoc:3},similar:{minSimilarity:.6,limit:50,minCallees:4},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50},wrappers:{maxLoc:15,limit:50},passthroughs:{maxLoc:15,limit:50},stale:{minLoc:3,limit:50},drift:{},twinDrift:{minSimilarity:.3}};export{b as a,O as b,G as c,I as d,z as e};
|
|
2
|
+
//# sourceMappingURL=chunk-2DBY4MO7.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as ie,b as N,e as V,f as j,g as E,h as te,i as re}from"./chunk-KMVGRIO2.js";import{b as _}from"./chunk-B75HZHUP.js";import{a as q}from"./chunk-3I34FZ6R.js";import{a as ne}from"./chunk-UO4IADXJ.js";import{a as D}from"./chunk-YSUD2S7T.js";import{d as I,e as K,h as $}from"./chunk-OO6S4ECV.js";import{a as B}from"./chunk-NLVKD45E.js";import{a as Y}from"./chunk-64MNV6AB.js";import{d as z,h as J,q as A,s as y,v as Q,x as ee,y as U,z as H}from"./chunk-WFRZGMWJ.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=Ee(e,n,{semantic:t.semantic!==!1});if(!s)return[];if(!$(s.symbol))return[];if(s.callees.size===0)return se(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"});let a=we(e,s,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,r):se(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"})}function vn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let l=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:I(r.symbol),file:r.relativePath,loc:l},symbolB:{symbol:s.symbol,shortName:I(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),l=Me(s,r),c=j(l),m=E(s.callees,l),g=[];for(let f of a){if(f.callees.size<3)continue;let o=E(f.callees,l),u=ce(s,f,l,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:o});u&&g.push(u)}return g.sort((f,o)=>o.similarity-f.similarity),g}function Me(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:l}=r,c=a.length>0?a:l,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:I(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:I(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(I),uniqueToA:[...N(e.callees,n.callees)].map(I),uniqueToB:[...N(n.callees,e.callees)].map(I),...m}}function Te(e,n,t,i){let r=i.magnitudeA??E(e.callees,t),s=i.magnitudeB??E(n.callees,t),a=0,l=0,c=0,m=i.medianIdf??j(t);for(let o of e.callees){if(!n.callees.has(o))continue;let u=t.get(o)??0;a+=u*u,c+=1,u>=m&&(l+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:l>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?te(e.callees,n.callees,t,{medianIdf:i.medianIdf}):re(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function wn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:l}=n,c=n.semantic!==!1,m=A(),g=0,f=0,o=0,u=0,d=0,p=0,S=0;return y("similar.all",()=>{let b=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:l,semantic:c}),C=b.corpus;g=C.length;let v=n.focusFiles,k=[],P=0;return y("similar.all.pair-scan",()=>{for(let x=0;x<C.length;x+=1){let F=C[x],T=v?.has(F.file)??!1,w=b.weightedMagnitudes[x],M=new Set;for(let O of F.callees){let L=b.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=x||v&&!T&&!v.has(C[R].file)||M.add(R)}m&&(o+=M.size,M.size>0&&(f+=1));for(let O of M){let L=C[O];if(a&&F.file===L.file){m&&(d+=1);continue}if(ue(F,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(F,L,b.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:b.medianIdf,magnitudeA:w,magnitudeB:b.weightedMagnitudes[O]});R&&(Ae(k,R,i,P),m&&(S+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S,topResults:k.length})),y("similar.all.sort-project",()=>(k.sort((x,F)=>F.result.similarity-x.result.similarity||x.order-F.order),k.map(x=>x.result)),()=>({topResults:k.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:l,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S}))}function Mn(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,l=n.semantic!==!1,c=A(),m=0,g=0,f=0,o=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let h=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:l}),b=h.corpus;m=b.length;let C=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let v=0;v<b.length;v+=1){let k=b[v],P=C?.has(k.file)??!1,x=h.weightedMagnitudes[v],F=new Set;for(let T of k.callees){let w=h.candidateIndexesByCallee.get(T);if(w)for(let M of w)M<=v||C&&!P&&!C.has(b[M].file)||F.add(M)}c&&(f+=F.size,F.size>0&&(g+=1));for(let T of F){let w=b[T];if(s&&k.file===w.file){c&&(u+=1);continue}if(ue(k,w)){c&&(d+=1);continue}c&&(o+=1),Te(k,w,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:x,magnitudeB:h.weightedMagnitudes[T]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:l,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:ln,deserialize:on});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let l=e[a],c=e[r];(l.result.similarity<c.result.similarity||l.result.similarity===c.result.similarity&&l.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Be=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Ee(e,n,t){let i=D(e,n);if(!i||!$(i.symbol))return null;let r=new q(e),s=ne(e,i,{semantic:t.semantic});return{symbol:i.symbol,file:i.relativePath,callees:ge(s.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,l=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let o=l.get(c);if(m=o!==void 0,o||(o=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),l.set(c,o)),g=o.length,r===void 0)return o;let u=o.filter(d=>d.symbol!==r);return f=o.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),l=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let o=a.get(l);return c=o!==void 0,o||(o=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(l,o)),m=o.corpus.length,g=o.docFreq.size,f=o.candidateIndexesByCallee.size,o},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Ye(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Je(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let o=new Map;for(let u of e)for(let d of u.callees)o.set(d,(o.get(d)??0)+1);return t=o.size,o},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(o=>E(o.callees,s)),()=>({corpusSize:e.length})),l=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let o=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let S=o.get(p);S||(S=[],o.set(p,S)),S.push(u),n&&(l+=1)}}return n&&(m=o.size),o},()=>({corpusSize:e.length,buckets:m,candidateRefs:l,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),l=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(l.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=l.calleeMap(m,{semantic:s});if(a)for(let S of p.values())g+=S.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),o=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let p=m.map(b=>({symbol:b.symbol,file:b.relativePath,callees:ge((f.get(b.symbolId)??[]).map(C=>C.symbol)),paramCount:l.callableSignature(b)?.paramCount??-1})),S=$e(p);a&&(d=S.filter((b,C)=>b.callees.size!==p[C].callees.size).length);let h=S.filter(b=>b.callees.size>=t);return o=h.length,a&&(u=h.reduce((b,C)=>b+C.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:o,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Be.some(n=>e.includes(n))}function se(e,n,t){let i=Ke(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",l=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let o=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});l=o.length;for(let u of o){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=ie(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),S=p.size>0?d.size/p.size:0;if(S<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:I(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:I(u.symbol),fileB:u.file,similarity:S,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:l,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(S=>ae(S,n)),r=Z(t,Se),s=Z(t,be),a=Z(i,X),l=[...new Set(i.filter(oe))],c=e.filter(S=>{let h=ae(S,n);return h.some(b=>X.has(b))&&h.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&l.length>0&&m.push(`domain-specific terms: ${l.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(S=>ye.has(S));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&l.length>0,o=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&l.length>=4&&c>=2,d=u?"domain-behavior":f?o?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ge(d,p)}}function Ge(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:Ue(e))}function Ue(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!Se.has(e)&&!be.has(e)&&!ye.has(e)&&!He.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),Se=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),be=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),He=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ke(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ve(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ve(e,n){let t=K(n.symbol),i=rn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var Ze=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),We=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=Ze.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=tn(e,n),t.set(i,r)),r}function le(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Xe(Ce(e,n)),t.set(i,r)),r}function Xe(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Je(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Ye(e,n,t){let i=A(),r=new q(e),s=Qe(n.tokens.size,t.minSimilarity),a=0,l=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let S of Y(e,{includeIgnored:!1})){a+=1;let h=U(e,S);h&&(l+=1,en(h,d,s)&&p.push(S))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:l,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),o=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(o=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:o})).filter(d=>d.symbol!==n.symbol)}function Qe(e,n){return Math.max(2,Math.ceil(e*n))}function en(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(nn(i,s)&&(r+=1,r>=t))return!0;return!1}function nn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function tn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let l=J(e,r,a),c=an(e,r,l),m=!1,g=null;for(let f of s){let o=sn(f),u=c.get(o),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(o,{key:o,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&cn(e,r,l,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function rn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
|
|
1
|
+
import{a as ie,b as N,e as V,f as j,g as E,h as te,i as re}from"./chunk-KMVGRIO2.js";import{b as _}from"./chunk-B75HZHUP.js";import{a as q}from"./chunk-BTYDBDX5.js";import{a as ne}from"./chunk-3YEBIYXL.js";import{a as D}from"./chunk-2HCWAL42.js";import{d as I,e as K,h as $}from"./chunk-7XP7ZRSI.js";import{a as B}from"./chunk-JLZUM476.js";import{a as Y}from"./chunk-64MNV6AB.js";import{d as z,h as J,q as A,s as y,v as Q,x as ee,y as U,z as H}from"./chunk-M2TRDR25.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=Ee(e,n,{semantic:t.semantic!==!1});if(!s)return[];if(!$(s.symbol))return[];if(s.callees.size===0)return se(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"});let a=we(e,s,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,r):se(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"})}function vn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let l=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:I(r.symbol),file:r.relativePath,loc:l},symbolB:{symbol:s.symbol,shortName:I(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),l=Me(s,r),c=j(l),m=E(s.callees,l),g=[];for(let f of a){if(f.callees.size<3)continue;let o=E(f.callees,l),u=ce(s,f,l,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:o});u&&g.push(u)}return g.sort((f,o)=>o.similarity-f.similarity),g}function Me(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:l}=r,c=a.length>0?a:l,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:I(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:I(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(I),uniqueToA:[...N(e.callees,n.callees)].map(I),uniqueToB:[...N(n.callees,e.callees)].map(I),...m}}function Te(e,n,t,i){let r=i.magnitudeA??E(e.callees,t),s=i.magnitudeB??E(n.callees,t),a=0,l=0,c=0,m=i.medianIdf??j(t);for(let o of e.callees){if(!n.callees.has(o))continue;let u=t.get(o)??0;a+=u*u,c+=1,u>=m&&(l+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:l>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?te(e.callees,n.callees,t,{medianIdf:i.medianIdf}):re(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function wn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:l}=n,c=n.semantic!==!1,m=A(),g=0,f=0,o=0,u=0,d=0,p=0,S=0;return y("similar.all",()=>{let b=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:l,semantic:c}),C=b.corpus;g=C.length;let v=n.focusFiles,k=[],P=0;return y("similar.all.pair-scan",()=>{for(let x=0;x<C.length;x+=1){let F=C[x],T=v?.has(F.file)??!1,w=b.weightedMagnitudes[x],M=new Set;for(let O of F.callees){let L=b.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=x||v&&!T&&!v.has(C[R].file)||M.add(R)}m&&(o+=M.size,M.size>0&&(f+=1));for(let O of M){let L=C[O];if(a&&F.file===L.file){m&&(d+=1);continue}if(ue(F,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(F,L,b.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:b.medianIdf,magnitudeA:w,magnitudeB:b.weightedMagnitudes[O]});R&&(Ae(k,R,i,P),m&&(S+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S,topResults:k.length})),y("similar.all.sort-project",()=>(k.sort((x,F)=>F.result.similarity-x.result.similarity||x.order-F.order),k.map(x=>x.result)),()=>({topResults:k.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:l,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S}))}function Mn(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,l=n.semantic!==!1,c=A(),m=0,g=0,f=0,o=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let h=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:l}),b=h.corpus;m=b.length;let C=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let v=0;v<b.length;v+=1){let k=b[v],P=C?.has(k.file)??!1,x=h.weightedMagnitudes[v],F=new Set;for(let T of k.callees){let w=h.candidateIndexesByCallee.get(T);if(w)for(let M of w)M<=v||C&&!P&&!C.has(b[M].file)||F.add(M)}c&&(f+=F.size,F.size>0&&(g+=1));for(let T of F){let w=b[T];if(s&&k.file===w.file){c&&(u+=1);continue}if(ue(k,w)){c&&(d+=1);continue}c&&(o+=1),Te(k,w,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:x,magnitudeB:h.weightedMagnitudes[T]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:l,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:ln,deserialize:on});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let l=e[a],c=e[r];(l.result.similarity<c.result.similarity||l.result.similarity===c.result.similarity&&l.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Be=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Ee(e,n,t){let i=D(e,n);if(!i||!$(i.symbol))return null;let r=new q(e),s=ne(e,i,{semantic:t.semantic});return{symbol:i.symbol,file:i.relativePath,callees:ge(s.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,l=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let o=l.get(c);if(m=o!==void 0,o||(o=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),l.set(c,o)),g=o.length,r===void 0)return o;let u=o.filter(d=>d.symbol!==r);return f=o.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),l=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let o=a.get(l);return c=o!==void 0,o||(o=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(l,o)),m=o.corpus.length,g=o.docFreq.size,f=o.candidateIndexesByCallee.size,o},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Ye(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Je(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let o=new Map;for(let u of e)for(let d of u.callees)o.set(d,(o.get(d)??0)+1);return t=o.size,o},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(o=>E(o.callees,s)),()=>({corpusSize:e.length})),l=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let o=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let S=o.get(p);S||(S=[],o.set(p,S)),S.push(u),n&&(l+=1)}}return n&&(m=o.size),o},()=>({corpusSize:e.length,buckets:m,candidateRefs:l,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),l=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(l.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=l.calleeMap(m,{semantic:s});if(a)for(let S of p.values())g+=S.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),o=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let p=m.map(b=>({symbol:b.symbol,file:b.relativePath,callees:ge((f.get(b.symbolId)??[]).map(C=>C.symbol)),paramCount:l.callableSignature(b)?.paramCount??-1})),S=$e(p);a&&(d=S.filter((b,C)=>b.callees.size!==p[C].callees.size).length);let h=S.filter(b=>b.callees.size>=t);return o=h.length,a&&(u=h.reduce((b,C)=>b+C.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:o,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Be.some(n=>e.includes(n))}function se(e,n,t){let i=Ke(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",l=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let o=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});l=o.length;for(let u of o){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=ie(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),S=p.size>0?d.size/p.size:0;if(S<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:I(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:I(u.symbol),fileB:u.file,similarity:S,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:l,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(S=>ae(S,n)),r=Z(t,Se),s=Z(t,be),a=Z(i,X),l=[...new Set(i.filter(oe))],c=e.filter(S=>{let h=ae(S,n);return h.some(b=>X.has(b))&&h.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&l.length>0&&m.push(`domain-specific terms: ${l.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(S=>ye.has(S));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&l.length>0,o=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&l.length>=4&&c>=2,d=u?"domain-behavior":f?o?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ge(d,p)}}function Ge(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:Ue(e))}function Ue(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!Se.has(e)&&!be.has(e)&&!ye.has(e)&&!He.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),Se=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),be=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),He=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ke(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ve(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ve(e,n){let t=K(n.symbol),i=rn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var Ze=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),We=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=Ze.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=tn(e,n),t.set(i,r)),r}function le(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Xe(Ce(e,n)),t.set(i,r)),r}function Xe(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Je(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Ye(e,n,t){let i=A(),r=new q(e),s=Qe(n.tokens.size,t.minSimilarity),a=0,l=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let S of Y(e,{includeIgnored:!1})){a+=1;let h=U(e,S);h&&(l+=1,en(h,d,s)&&p.push(S))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:l,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),o=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(o=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:o})).filter(d=>d.symbol!==n.symbol)}function Qe(e,n){return Math.max(2,Math.ceil(e*n))}function en(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(nn(i,s)&&(r+=1,r>=t))return!0;return!1}function nn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function tn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let l=J(e,r,a),c=an(e,r,l),m=!1,g=null;for(let f of s){let o=sn(f),u=c.get(o),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(o,{key:o,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&cn(e,r,l,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function rn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
|
|
2
2
|
`);let r=[new RegExp(`\\bdef\\s+${B(i)}\\b`),new RegExp(`\\bfun\\s+${B(i)}\\b`),new RegExp(`\\bfn\\s+${B(i)}\\b`),new RegExp(`\\bfunction\\s+${B(i)}\\b`),new RegExp(`\\b${B(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(l=>l.test(a)));if(s>=0){let a=s;for(let l=s+1;l<e.length&&l<=s+8;l++){let c=e[l]??"";if(l>s&&mn(c)||(a=l,c.trim()===""&&l>s+1))break}return e.slice(s,a+1).join(`
|
|
3
3
|
`)}return e.slice(n,Math.min(e.length,n+8)).join(`
|
|
4
4
|
`)}function sn(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function an(e,n,t){return me.read(e,n,t)??new Map}function on(e){try{let n=JSON.parse(e);if(!Array.isArray(n.entries))return null;let t=new Map;for(let i of n.entries){if(!i||typeof i.key!="string"||typeof i.symbol!="string"||typeof i.startLine!="number"||typeof i.endLine!="number"||typeof i.leaf!="string"||!Array.isArray(i.tokens)||!i.tokens.every(r=>typeof r=="string"))return null;t.set(i.key,i)}return t}catch{return null}}function ln(e){let n={entries:[...e.values()].sort((t,i)=>t.key.localeCompare(i.key))};return JSON.stringify(n)}function cn(e,n,t,i){me.write(e,n,t,new Map(i))}function ke(e,n){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),i=un(n),s=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function un(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function mn(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}export{Ie as a,vn as b,Me as c,ce as d,wn as e,Mn as f,Ae as g,de as h,qe as i,G as j,Ne as k,Pe as l,fe as m,$e as n,ge as o,pe as p};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-2DUWNJKE.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{A as C,c as M,d as L,e as Q,g as I,h as E,i as K,n as y,o as d,r as b}from"./chunk-
|
|
1
|
+
import{A as C,c as M,d as L,e as Q,g as I,h as E,i as K,n as y,o as d,r as b}from"./chunk-7XP7ZRSI.js";function se(e,n){return O(e,n).match}function O(e,n){let t=z(e,n.trim()).filter(r=>!e.isIgnored(r.relative_path));if(t.length>0)return S(e,t);let o=G(e,n);if(o&&!e.isIgnored(o.relative_path))return S(e,[o]);let i=W(e,n);return i.length>0?S(e,i):X(e,n)}function W(e,n){let t=N(n),o=x(t);if(!o)return[];let i=`%${o.path}%`,r=o.leaf;return j(e,i,r,t)}function j(e,n,t,o){let i=b([],[...q(e,n,t),...T(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>f(r,o)>1);return i.sort((r,a)=>f(a,o)-f(r,o)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),i}function q(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function T(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function X(e,n){let t=N(n),o=P(n),i=V(e,o),r=ee(i,n,t).filter(s=>!e.isIgnored(s.relative_path));if(r.length>0)return S(e,r);let a=[];for(let s of i){if(e.isIgnored(s.relative_path))continue;let c=Y(s,n,t,o);c<=0||a.push({row:s,score:c})}return a.sort((s,c)=>c.score-s.score||s.row.end_line-s.row.start_line-(c.row.end_line-c.row.start_line)||s.row.relative_path.localeCompare(c.row.relative_path)||s.row.symbol.localeCompare(c.row.symbol)),S(e,a.map(s=>s.row))}function S(e,n){let t=n.map(i=>C(e,i)),o=t[0]??null;return{match:o,candidates:o?Z(t,o):[],total:t.length}}function Z(e,n){let t=new Set([`${n.symbolId}:${n.relativePath}:${n.startLine}`]),o=[];for(let i of e){let r=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!t.has(r)&&(t.add(r),o.push({symbol:i.symbol,shortName:L(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),o.length>=5))break}return o}function G(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return;let[,o,i,r]=t,a=Math.max(0,parseInt(i,10)-1),s=Math.max(a,parseInt(r,10)-1);return H(e,o,a,s)??J(e,o,a,s)}function H(e,n,t,o){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,o],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function J(e,n,t,o){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,o],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function le(e,n){let t=z(e,n).find(o=>!e.isIgnored(o.relative_path));return t?C(e,t):null}function z(e,n){let t=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line"}),o=t.length>0?[]:d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line"});return b(t,o)}function ce(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=U(e,n.symbolId)[0];return t?C(e,t):null}function U(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),o=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return b(t,o)}function V(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),o=n.flatMap(s=>{let c=`%${s}%`;return[c,c,c]}),i=t.join(`
|
|
2
2
|
AND `),r=y(e,{where:i,params:o,limit:200}),a=d(e,{where:i,params:o,limit:200});return b(r,a)}function Y(e,n,t,o){let i=n.trim(),r=t,a=r.replace(/\(\)$/,""),s=n.toLowerCase(),c=t.toLowerCase(),h=c.replace(/\(\)$/,""),k=e.symbol,v=L(e.symbol),g=Q(e.symbol),A=e.display_name??"",w=e.symbol.toLowerCase(),m=v.toLowerCase(),u=g.toLowerCase(),D=A.toLowerCase(),p=e.relative_path.toLowerCase(),F=/[/:.]/.test(t),$=x(t),_=$?.leaf.toLowerCase(),l=0;return(k===i||k===r)&&(l+=1150),(v===i||v===r)&&(l+=1100),A===a&&(l+=1180),g===a&&(l+=1160),(`${g}()`===i||`${g}()`===r)&&(l+=955),(w===s||w===c)&&(l+=1e3),(m===s||m===c)&&(l+=950),(p===s||p===c)&&(l+=925),(p.endsWith(`/${c}`)||p.endsWith(`/${s}`))&&(l+=875),D===h&&(l+=850),u===h&&(l+=825),(`${u}()`===s||`${u}()`===c)&&(l+=820),(m.endsWith(`:${c}`)||m.endsWith(`:${h}`)||m.endsWith(`:${h}()`))&&(l+=800),w.includes(c)&&(l+=120),m.includes(c)&&(l+=140),p.includes(c)&&(l+=140),D.includes(c)&&(l+=110),o.every(B=>{let R=B.toLowerCase();return w.includes(R)||m.includes(R)||p.includes(R)||D.includes(R)})&&(l+=100+o.length*15),$&&p.includes($.path.toLowerCase())&&(l+=360,_&&(u===_||`${u}()`===_||`${u}()`==`${_}()`)&&(l+=700),I(e.symbol)&&(l+=180)),E(e.symbol)&&u===h&&(l+=60),!F&&K(e.symbol)&&(l-=160),l-=Math.min(50,Math.max(0,e.end_line-e.start_line)),l}function x(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let o=n.slice(t+1).replace(/\(\)$/,"");return!o||o.includes(".")?null:{path:n.slice(0,t),leaf:o}}function N(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function P(e){let n=N(e),t=n.split(/[^A-Za-z0-9_]+/).map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?[...new Set(t)]:[n]}function ee(e,n,t){let o=n.trim(),i=e.filter(r=>{let a=L(r.symbol),s=(r.display_name??"").trim();return r.symbol===o||a===o||a===t||s===o||s===t||`${s}()`===o||f(r,t)>1||r.relative_path===o});return i.length===0?[]:(i.sort((r,a)=>f(a,t)-f(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)),i)}function f(e,n){let t=x(n);if(!t)return 0;let o=e.relative_path.toLowerCase(),i=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return o.includes(r)?i!==a?1:I(e.symbol)?M(e.symbol)===null?5:4:M(e.symbol)===null?3:2:0}export{se as a,O as b,le as c,ce as d};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-2HCWAL42.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as d}from"./chunk-
|
|
1
|
+
import{c as d}from"./chunk-3YEBIYXL.js";import{d as r,t as m}from"./chunk-7XP7ZRSI.js";function y(o,t={}){let{limit:i=30,scope:e}=t,s=e?"AND def_d.relative_path LIKE ?":"",f=e?[`%${e}%`]:[],l=o.all(`SELECT
|
|
2
2
|
gs.symbol,
|
|
3
3
|
COUNT(*) AS ref_count,
|
|
4
4
|
COUNT(DISTINCT ref_d.id) AS file_count,
|
|
@@ -23,4 +23,4 @@ import{c as d}from"./chunk-UO4IADXJ.js";import{d as r,t as m}from"./chunk-OO6S4E
|
|
|
23
23
|
GROUP BY gs.id
|
|
24
24
|
ORDER BY ref_count DESC
|
|
25
25
|
LIMIT ?`,...f,i).filter(n=>!o.isIgnored(n.defined_in)).map(n=>({symbol:n.symbol,shortName:r(n.symbol),refCount:n.ref_count,fileCount:n.file_count,definedIn:n.defined_in}));return l.length>0?l:c(o,e,i)}function c(o,t,i){return m(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,s)=>s.refCount-e.refCount||s.fileCount-e.fileCount).slice(0,i)}function u(o,t){let e=d(o,t,{limit:500}).filter(s=>s.file!==t.relativePath);return{symbol:t.symbol,shortName:r(t.symbol),refCount:e.length,fileCount:new Set(e.map(s=>s.file)).size,definedIn:t.relativePath}}export{y as a};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-2TM23JYJ.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as T,c as E,g as L,h as D}from"./chunk-
|
|
1
|
+
import{a as T,c as E,g as L,h as D}from"./chunk-EUMETOTD.js";import{j as O,o as A}from"./chunk-2DUWNJKE.js";import{d as H}from"./chunk-KMVGRIO2.js";import{a as _}from"./chunk-BTYDBDX5.js";import{d as C,e as F}from"./chunk-7XP7ZRSI.js";import{a as w}from"./chunk-JLZUM476.js";var J=5;function ae(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??E(e,{base:a}),l={available:s.note!==T,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new _(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),j=t.baseContentAt??L(e.config.projectRoot,a,D(s)),h=Z(x,k,$,j);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let q=x.calleeMap(R,{semantic:f}),B=R.map(i=>({def:i,callees:A((q.get(i.symbolId)??[]).map(p=>p.symbol))})),V=O(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of B){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=G(),N=Y(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Q(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=K({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>z(S.migrationScope)-z(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,J)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function K(e){let t=[],a=U(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=H(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=W(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function z(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function W(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!X.has(t))}function Y(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function Z(e,t,a,o){return e.productionCallableDefinitions({files:[...t],requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${w(r.leaf)}\\b`).test(c)})}function Q(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
5
5
|
WHERE m.symbol_id = ?
|
|
6
6
|
AND m.role != 1
|
|
7
7
|
${e.pathExclusionsFor("ref_d")}`,t).map(o=>o.relative_path)}export{ae as a};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-35DURZXI.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R,b as H}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as R,b as H}from"./chunk-XKWEMFHP.js";import{a as B,b,c as y,e as h,f as k}from"./chunk-B3X6KU75.js";import{a as p,b as g}from"./chunk-KMVGRIO2.js";import{N as v}from"./chunk-TLTLJ4SW.js";function V(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:i=6,limit:o=20,scope:c,scanLimit:n,filePattern:d,focusFiles:f}=s,l=v(e).reactProfiles({scope:c,minBehaviorTokens:Math.max(3,i),scanLimit:n}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r})),t=R(l,r=>r.tokens);return H({profiles:l,limit:o,filePattern:d,focusFiles:f,candidateIndex:t,profile:{name:"react-hook-candidates"},compare:(r,a)=>C(r,a,m,i),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.componentA.localeCompare(a.componentA)||r.fileB.localeCompare(a.fileB)||r.componentB.localeCompare(a.componentB)})}function C(e,s,m,i){let o=p(e.tokens,s.tokens);if(o.size<i||!E(o))return null;let c=b(e.tokens,s.tokens);if(c<m)return null;let n=h(o,"hook:"),d=h(o,"react-hook:"),f=h(o,"effect:"),l=h(o,"state:"),t=h(o,"request:"),r=h(o,"handler:"),a=h(o,"handler-verb:"),u=A({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:c,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:k(o),sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:k(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:k(g(s.tokens,e.tokens)).slice(0,25),reason:P({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a}),locA:e.profile.loc,locB:s.profile.loc}}function A(e){return B({genericWords:q,stripPrefixes:w,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:S})}function S(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function E(e){let s=0,m=0,i=0,o=0,c=0,n=0,d=0;for(let t of e)t.startsWith("hook:")?s+=1:t.startsWith("react-hook:")?m+=1:t.startsWith("effect:")?i+=1:t.startsWith("request:")?o+=1:t.startsWith("handler:")||t.startsWith("handler-verb:")?c+=1:t.startsWith("state:")?n+=1:t.startsWith("state-hook:")&&(d+=1);let f=n+d,l=s+m+i+o+c+f;return y([{name:"requests",count:o},{name:"customHooks",count:s},{name:"namedStates",count:n},{name:"handlers",count:c},{name:"effects",count:i},{name:"reactHooks",count:m},{name:"namedBehavior",count:l}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{customHooks:1,requests:1,namedBehavior:5},reason:"shared custom hook and request workflow"},{min:{customHooks:1,namedStates:1,namedBehavior:5},reason:"shared custom hook and state"},{min:{customHooks:1,handlers:2,namedBehavior:5},reason:"shared custom hook and handlers"},{min:{namedStates:1,handlers:2,effects:1,namedBehavior:5},reason:"shared stateful effects"},{min:{namedStates:1,handlers:2,reactHooks:2,namedBehavior:5},reason:"shared stateful React primitives"}]).pass}function P(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var q=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),w=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{V as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3CJXFMR5.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as ae,c as O,d as T,e as H,k as pe,l as be}from"./chunk-
|
|
1
|
+
import{b as ae,c as O,d as T,e as H,k as pe,l as be}from"./chunk-FY6RCFDH.js";import{d as le,e as me,f as $,g as de,i as ue,l as fe}from"./chunk-KWMRY4RN.js";import{D as ce,n as re,x as j}from"./chunk-SQJ72PQW.js";import{a as ne}from"./chunk-QEIGJJBC.js";import{d as ye,e as ge}from"./chunk-MTDBHTSF.js";import{e as P,g as te,s as oe,t as F,y as ie,z as se}from"./chunk-7XP7ZRSI.js";import{k as E,m as X,p as ee}from"./chunk-JLZUM476.js";import{B as w,c as Z}from"./chunk-TLTLJ4SW.js";import{a as Y}from"./chunk-64MNV6AB.js";import{c as V,d as z,g as B,h as x,j as Q,l as K,q,s as D,y as N}from"./chunk-M2TRDR25.js";function Mn(e,n,t={}){let o=Ce(e,[n],{additive:t.additive,semantic:t.semantic}),s=t.callableOnly?(o.get(n.symbolId)??[]).filter(a=>te(a.symbol)||a.source==="ast-callsite"):o.get(n.symbolId)??[];return typeof t.limit=="number"?s.slice(0,t.limit):s}function Se(e,n,t={}){let o=De(e)?ke(e,n,{semantic:t.semantic!==!1}):we(e).get(n.symbolId)??[];return typeof t.limit=="number"?o.slice(0,t.limit):o}var Le=z("caller-rows",{clearGroups:["whole-project"]}),_e=2e4;function De(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>_e}function we(e){return Le.get(e,()=>{let n=F(e),t=Ce(e,n),o=new Map;for(let i of n)o.set(i.symbol,i.symbolId);let s=new Map,a=new Map;for(let i of n){let l=t.get(i.symbolId);if(!(!l||l.length===0))for(let m of l){let c=o.get(m.symbol);if(c===void 0||c===i.symbolId)continue;let d=s.get(c);d||(d=[],s.set(c,d),a.set(c,new Set));let b=`${i.symbol}|${i.relativePath}`;a.get(c).has(b)||(a.get(c).add(b),d.push({symbol:i.symbol,file:i.relativePath,source:"caller-map-inversion"}))}}return s})}function ke(e,n,t){let o=[],s=new Set,a=l=>{if(l.symbol===n.symbol)return;let m=`${l.symbol}|${l.file}`;s.has(m)||(s.add(m),o.push(l))};for(let l of be(e,n))l.file!==n.relativePath&&a({symbol:l.enclosingSymbol??l.file,file:l.file,source:"resolved-reference"});let i=t.semantic?Ee(e,n):null;if(i)for(let l of ue(e,i)){if(l.file===n.relativePath||e.isIgnored(l.file))continue;let m=se(oe(e,l.file),l.line);a({symbol:m?.symbol??l.file,file:l.file,source:"semantic-reference"})}return o}function Ee(e,n){let t=ye().join(", "),o=ge().join(", ");return e.get(`SELECT
|
|
2
2
|
d.id AS documentId,
|
|
3
3
|
gs.id AS symbolId,
|
|
4
4
|
gs.symbol,
|
|
@@ -35,4 +35,4 @@ import{b as ae,c as O,d as T,e as H,k as pe,l as be}from"./chunk-2Y7YX54K.js";im
|
|
|
35
35
|
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
36
|
WHERE gs.id IN (${r.map(()=>"?").join(",")})`,...r,...r)),l=J([...n.map(r=>r.documentId),...i.flatMap(r=>r.document_id===null?[]:[r.document_id])]),m=new Map(l.flatMap(r=>e.all(`SELECT id, relative_path FROM documents
|
|
37
37
|
WHERE id IN (${r.map(()=>"?").join(",")})`,...r).map(y=>[y.id,y.relative_path]))),c=new Map;for(let r of i)c.has(r.symbol_id)||c.set(r.symbol_id,{symbol:r.symbol,file:r.document_id!==null?m.get(r.document_id)??"":""});let d=new Map,b=m,L=Ge(n);for(let[r,y]of L){let S=[...s.get(r)??[]].sort((u,g)=>u.start_line-g.start_line||u.end_line-g.end_line),v=[...y].sort((u,g)=>u.startLine-g.startLine||u.endLine-g.endLine),C=new Set,f=0;for(let u of v){for(;f<S.length&&S[f].start_line<=u.endLine;)C.add(S[f]),f+=1;for(let p of C)p.end_line<u.startLine&&C.delete(p);let g=new Set,k=[],R=null,G=()=>{if(R)return R;let p=b.get(u.documentId)??"",h=new Set;if(p){let I=ae(e,p),A=Math.max(0,u.startLine),W=Math.min(I.length-1,u.endLine);for(let _=A;_<=W;_+=1)for(let Ie of I[_])h.add(Ie)}return R=h,h};for(let p of C){if(p.symbol_id===u.symbolId)continue;let h=c.get(p.symbol_id);if(!h)continue;if(!(p.start_line>=u.startLine&&p.end_line<=u.endLine)){if(!(p.start_line<=u.endLine&&p.end_line>=u.startLine))continue;let _=P(h.symbol);if(!_||!G().has(_))continue}let A=`${h.symbol}|${p.chunk_id}`;g.has(A)||(g.add(A),k.push({...h,chunkId:p.chunk_id,source:"scip-chunk"}))}d.set(u.symbolId,k)}}return d}var he=500;function J(e){let n=[...new Set(e)],t=[];for(let o=0;o<n.length;o+=he)t.push(n.slice(o,o+he));return t}function Ge(e){let n=new Map;for(let t of e){let o=n.get(t.documentId);o?o.push(t):n.set(t.documentId,[t])}return n}function Be(e){let n=new Map;for(let[t,o]of e){let s=[];for(let a of o)s.push({symbol:a.symbol,file:a.file,chunkId:-1,source:"semantic-callee"});n.set(t,s)}return n}function Re(e,n,t={}){let o=new Map;if(n&&n.length===0)return o;let s=Y(e,{includeIgnored:!1}),a=H(e),i=n??F(e),l=new Set(i.map(c=>c.symbolId)),m=Qe(i);if(Ke(e,o,s,a,l,m),Je(e,o,i,l),ze(e,o,s,a,l,m),t.semantic!==!1){let c=$(e);Ze(o,c.callerMap(Ye(i)))}return o}function Ke(e,n,t,o,s,a){for(let i of t){if(!w(i))continue;let l=E(e,i);if(l)for(let m of l){if(a&&!a.has(m.calleeLeaf))continue;let c=O(i,o.get(m.calleeLeaf)??[]);if(!c||c.length===0)continue;let d=T(e,i,c,m.memberAccess);d&&s.has(d.symbolId)&&d.file!==i&&U(n,d.symbolId,i)}}}function Je(e,n,t,o){let s=We(t);for(let a of Ue(e,o))e.isIgnored(a.relative_path)||Ve(a,s.get(a.symbol_id))||U(n,a.symbol_id,a.relative_path)}function Ue(e,n){return le(e,n?[...n]:void 0)}function We(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 Ve(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function ze(e,n,t,o,s,a){for(let i of t){if(w(i)!=="rust")continue;let l=X(e,i,{includeRustAttributeNames:!0});if(l.length!==0)for(let{name:m}of l){if(a&&!a.has(m))continue;let c=o.get(m);if(c)for(let d of c)s.has(d.symbolId)&&d.file!==i&&U(n,d.symbolId,i)}}}function U(e,n,t){let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}function Qe(e){let n=new Set;for(let t of e){let o="leaf"in t&&typeof t.leaf=="string"?t.leaf:"symbol"in t&&typeof t.symbol=="string"?P(t.symbol):"";o&&n.add(o)}return n.size>0?n:null}function Ye(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function Ze(e,n){for(let[t,o]of n){let s=e.get(t);s||(s=new Set,e.set(t,s));for(let a of o)s.add(a)}}function Pn(e,n,t={}){return Se(e,n,t)}function qe(e,n,t={}){return Re(e,n,t)}function Xe(e,n,t={}){return pe(e,n,t)}function Fn(e,n,t={}){let o=qe(e,n,{semantic:t.semantic});return t.sourceFallback===!1?o:en(o,Xe(e,n))}function en(e,n){let t=new Map;for(let[o,s]of e)t.set(o,new Set(s));for(let[o,s]of n){let a=t.get(o)??new Set;for(let i of s)a.add(i);t.set(o,a)}return t}export{Mn as a,Ce as b,Pn as c,qe as d,Xe as e,Fn as f,en as g};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-3YEBIYXL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d,b as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d,b as m}from"./chunk-XKWEMFHP.js";import{c as u}from"./chunk-KMVGRIO2.js";import{a as c}from"./chunk-QEIGJJBC.js";function y(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:p}=e,r=e.minDeps??(p?1:3),{profiles:i,distinctiveDeps:f}=D(t,{scope:n,minDeps:r}),s=d(i,a=>a.deps);return m({profiles:i,limit:l,filePattern:p,overrunFactor:5,candidateIndex:s,profile:{name:"similar-files"},compare:(a,g)=>F(a,g,o,f)})}function D(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:p,distinctiveDeps:r}=S(n),i=[];for(let[f,s]of n)s.size>=l&&i.push({file:f,deps:new Set([...s].filter(a=>!p.has(a)))});return{profiles:i,distinctiveDeps:r}}function S(t){let e=new Set,o=new Set,l=t.size;if(l===0)return{universalDeps:e,distinctiveDeps:o};let n=new Map;for(let r of t.values())for(let i of r)n.set(i,(n.get(i)??0)+1);let p=Math.max(3,Math.ceil(l*.03));for(let[r,i]of n)i>=5&&i/l>.3?e.add(r):i<=p&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function F(t,e,o,l){let n=new Set;for(let s of t.deps)e.deps.has(s)&&n.add(s);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let p=0;for(let s of n)l.has(s)&&p++;if(p<2)return null;let r=u(t.deps,e.deps);if(r<o)return null;let i=[];for(let s of t.deps)e.deps.has(s)||i.push(s);let f=[];for(let s of e.deps)t.deps.has(s)||f.push(s);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:i,uniqueToB:f}}export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-45QWQSWS.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-QEIGJJBC.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4FLF7BHJ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as x,
|
|
1
|
+
import{b as x,k}from"./chunk-SMBIGBGN.js";import he from"better-sqlite3";import{existsSync as bn}from"fs";import{dirname as yn,join as xn,resolve as ye}from"path";import G from"better-sqlite3";import{execFileSync as K}from"child_process";import{existsSync as X,readdirSync as J,readFileSync as B}from"fs";import{extname as m,join as I}from"path";import{readdirSync as we}from"fs";import{execFileSync as Ae}from"child_process";import{extname as De,join as _e}from"path";var H=[".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"],v=[".vue"],V=[".tsx",".jsx"],E=[".vue"],je=[...V,...E],$e=new Set(V),Ue=new Set(E),W=new Set(H.map(e=>e.toLowerCase())),He=[...W].sort().join(","),C=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 We=x("source-files",{clearGroups:[]});function ze(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:n=>q({projectRoot:n.projectRoot,dbPath:n.dbPath,extensions:e.extensions,onStatus:n.onStatus})}}function q(e){let n=new Set((e.extensions??v).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!X(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=k(e.projectRoot),t=Y(e.projectRoot,n).filter(i=>!r.isIgnored(i)),o=new G(e.dbPath);try{let i=Q(o,t),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
2
2
|
VALUES (?, ?, NULL, ?)`),u=o.transaction(l=>{let d=0;for(let f of l){if(i.has(f))continue;let p=B(I(e.projectRoot,f),"utf-8"),U=s.run(Z(f),f,p);d+=Number(U.changes)}return d})(t),c={scanned:t.length,inserted:u,existing:t.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function Y(e,n){let r=z(e,n);if(r)return r;let t=[],o=i=>{let s=i?I(e,i):e,a;try{a=J(s,{withFileTypes:!0})}catch{return}for(let u of a){if(C.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}n.has(m(u.name).toLowerCase())&&t.push(c)}};return o(""),t.sort()}function z(e,n){try{return K("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
3
3
|
`).filter(t=>t&&n.has(m(t).toLowerCase())).sort()}catch{return null}}function Q(e,n){let r=new Set,t=500;for(let o=0;o<n.length;o+=t){let i=n.slice(o,o+t),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function Z(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{readFileSync as en,writeFileSync as nn}from"fs";function tn(e,n){let r=Date.now(),t=e.run(n);return{stageId:e.id,facts:e.facts,durationMs:Date.now()-r,result:t}}function ee(){return{"missing-source-file":0,"missing-service-script":0,"no-definition":0,"same-file-definition":0,"unindexed-definition":0}}function S(){return{skippedReferences:0,skippedReferenceReasons:ee(),skippedReferenceSamples:[]}}function T(e,n){e.skippedReferences+=n.skippedReferences;for(let r of Object.keys(e.skippedReferenceReasons)){e.skippedReferenceReasons[r]+=n.skippedReferenceReasons[r];for(let t of n.skippedReferenceSamples.filter(o=>o.reason===r))e.skippedReferenceSamples.filter(i=>i.reason===r&&i.sourceFile===t.sourceFile).length<2&&e.skippedReferenceSamples.push(t)}}import{createRequire as ne}from"module";import{existsSync as te,readFileSync as b}from"fs";import{dirname as L,extname as re,join as F,relative as oe,resolve as cn}from"path";import{pathToFileURL as ie}from"url";function O(e,n){let{vueCore:r,ts:t,volarTs:o}=se(e),{parsed:i,vueOptions:s}=ae(r,t,n),a=L(n),u=r.createVueLanguagePlugin(t,i.options,s,p=>p),c=ue(r,t,u),l=ce(a,i),{languageServiceHost:d}=o.createLanguageServiceHost(t,t.sys,c,p=>p,l),f=t.createLanguageService(d);return{ts:t,language:c,languageService:f,fileNames:i.fileNames,configDir:a}}function se(e){let n=ne(ie(F(e,"package.json")).href);return{vueCore:R(n,"@vue/language-core",e),ts:R(n,"typescript",e),volarTs:R(n,"@volar/typescript",e)}}function ae(e,n,r){let t=n.readConfigFile(r,n.sys.readFile);if(t.error||!t.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(n,n.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,n.sys.writeFile)),{parsed:n.parseJsonConfigFileContent(t.config,n.sys,L(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:n.ScriptKind.Deferred}))),vueOptions:i}}function ue(e,n,r){let t={},o=e.createLanguage([r],new Map,i=>{if(!te(i))return;let s=b(i,"utf-8");t.current?.scripts.set(i,n.ScriptSnapshot.fromString(s),r.getLanguageId(i)??fe(i))});return t.current=o,o}function ce(e,n){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>n.options,getScriptFileNames:()=>n.fileNames,getProjectReferences:()=>n.projectReferences,getProjectVersion:()=>"0"}}function R(e,n,r){try{return e(n)}catch(t){throw(typeof t=="object"&&t!==null&&"code"in t?t.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${n} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:t}):t}}function w(e,n,r){let t=le(e);return o=>{if(!o.name)return null;let i=g(n,o.fileName),s=r.get(o.fileName);if(!s)return null;let a=r.positionAt(s,o.textSpan.start),u=t.get(i);if(!u)return null;let c=u.starts.find(d=>d.line===a.line&&d.displayName===o.name);if(c)return c.symbolId;let l=u.containingByLine.get(a.line);return l&&l.displayName===o.name?l.symbolId:de(u.starts,a.line,2,o.name)}}function le(e){let n=e.prepare(`
|
|
4
4
|
SELECT
|
|
@@ -13,4 +13,4 @@ import{b as x,j as k}from"./chunk-FFIYGYQR.js";import he from"better-sqlite3";im
|
|
|
13
13
|
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
14
14
|
`).all(),r=new Map;for(let t of n){let o=r.get(t.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(t.relativePath,o)),o.starts.push({line:t.startLine,symbolId:t.symbolId,displayName:t.displayName});for(let i=t.startLine;i<=t.endLine;i++)o.containingByLine.set(i,{symbolId:t.symbolId,displayName:t.displayName})}for(let t of r.values())t.starts.sort((o,i)=>o.line-i.line);return r}function de(e,n,r,t){let o=0,i=e.length-1;for(;o<=i;){let a=Math.floor((o+i)/2);e[a].line<n?o=a+1:i=a-1}let s=null;for(let a of[i,o]){let u=e[a];if(!u||u.displayName!==t)continue;let c=Math.abs(u.line-n);c>r||(!s||c<s.distance)&&(s={distance:c,symbolId:u.symbolId})}return s?.symbolId??null}function N(e,n){let r=me(n),t=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=Se(t,r,n,i);return o.set(i,s),s}}}function A(e,n,r,t,o){if(e.fileName.endsWith(".vue")){let i=t.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=t.language.maps.get(s,i);if(h(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return n(e)}function*P(e){let n=/\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"]),t;for(;t=n.exec(e);){let o=t[0];r.has(o)||(yield{text:o,start:t.index,end:t.index+o.length})}}function D(e,n){for(let[r]of e.toGeneratedLocation(n,t=>!!t.navigation))return r;return null}function h(e,n){let r=e;for(let[t]of r.toSourceLocation(n,o=>!!o.navigation))return t;return null}function ge(e,n){let r=0,t=e.lineStarts.length-1;for(;r<=t;){let i=Math.floor((r+t)/2);e.lineStarts[i]<=n?r=i+1:t=i-1}let o=Math.max(0,t);return{line:o,character:n-e.lineStarts[o]}}function _(e,n){return g(e,n).startsWith("node_modules/")}function g(e,n){return oe(e,n).replaceAll("\\","/")}function fe(e){switch(re(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 M(){let e=new Map;return{get(n){if(e.has(n))return e.get(n)??null;try{let r=b(n,"utf-8"),t={text:r,lineStarts:pe(r)};return e.set(n,t),t}catch{return e.set(n,null),null}},positionAt:ge}}function pe(e){let n=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&n.push(r+1);return n}function me(e){try{let n=JSON.parse(b(F(e,"package.json"),"utf-8"));return{name:n.name??"workspace",version:n.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Se(e,n,r,t){let o=g(r,t),i=Re(n.name,n.version,o);return e.get(i)?.id??null}function Re(e,n,r){let t=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${n} ${t}/default.`}function Vn(e){let n=ye(e.projectRoot,e.tsconfig),r=new he(e.dbPath,{readonly:!0});try{let t=xe({db:r,projectRoot:e.projectRoot,configPath:n,vueSymbolLookup:N(r,e.projectRoot)});return ke({vueFiles:e.vueFiles??[],tasks:e.tasks,...t})}finally{r.close()}}function xe(e){let n=M();return{projectRoot:e.projectRoot,context:O(e.projectRoot,e.configPath),symbolLookup:w(e.db,e.projectRoot,n),vueSymbolLookup:e.vueSymbolLookup,sourceReader:n}}function ke(e){let n=[],r=S(),t=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of t){let i=ve(e,o);n.push(...i.occurrences),T(r,i)}return{occurrences:n,...r}}function ve(e,n){let r=e.sourceReader.get(n.fileName);if(!r)return j(e.projectRoot,n,"missing-source-file");let t=e.context.language.scripts.get(n.fileName),o=t?.generated?.languagePlugin.typescript?.getServiceScript(t.generated.root)?.code;if(!t||!o)return j(e.projectRoot,n,"missing-service-script");let i=e.context.language.maps.get(o,t),s=g(e.projectRoot,n.fileName),a=[...P(r.text)],u={tokens:a.filter(c=>c.start>=n.startOffset&&c.start<n.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:Te(a),processedStarts:new Set};return Ve({...e,fileName:n.fileName,sourceInfo:r,sourceFile:s,map:i,tokenContext:u})}function Ve(e){let n=[],r=S();for(let t of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(t.start)||Ee(e.sourceInfo.text,t.start))continue;let o=D(e.map,t.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(l=>!_(e.projectRoot,l.fileName));if(!s){y(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,"no-definition");continue}let a=g(e.projectRoot,s.fileName),u=Ce(e.sourceFile,t.text,a);if(u){y(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,u);continue}let c=A(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(c===null){y(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,"unindexed-definition");continue}$(n,e.sourceReader,e.sourceInfo,e.sourceFile,t,a,c),e.tokenContext.processedStarts.add(t.start),Ie(n,e,t,o,a,c)}return{occurrences:n,...r}}function Ee(e,n){let r=e.lastIndexOf(`
|
|
15
15
|
`,n-1)+1,t=e.slice(r,n);return/\bfrom\s+['"][^'"]*$/.test(t)||/\bimport\s*\(\s*['"][^'"]*$/.test(t)}function Ce(e,n,r){return r===e?"same-file-definition":r.endsWith(".vue")&&n!==r.split("/").at(-1)?.replace(/\.vue$/,"")?"unindexed-definition":null}function j(e,n,r){let t=S();return n.countFileSkip&&(t.skippedReferences=1,t.skippedReferenceReasons[r]=1,t.skippedReferenceSamples.push({sourceFile:g(e,n.fileName),sourceLine:0,sourceStartChar:0,sourceEndChar:0,token:"",reason:r})),{occurrences:[],...t}}function y(e,n,r,t,o,i){if(e.skippedReferences++,e.skippedReferenceReasons[i]++,e.skippedReferenceSamples.filter(a=>a.reason===i&&a.sourceFile===t).length>=2)return;let s=n.positionAt(r,o.start);e.skippedReferenceSamples.push({sourceFile:t,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,token:o.text,reason:i})}function Ie(e,n,r,t,o,i){if(!((n.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let s of Le(n.context.languageService,n.fileName,t+1,n.map,r,n.tokenContext.tokenByStart)){if(n.tokenContext.processedStarts.has(s))continue;let a=n.tokenContext.tokenByStart.get(s);a&&($(e,n.sourceReader,n.sourceInfo,n.sourceFile,a,o,i),n.tokenContext.processedStarts.add(s))}}function $(e,n,r,t,o,i,s){let a=n.positionAt(r,o.start);e.push({sourceFile:t,sourceLine:a.line,sourceStartChar:a.character,sourceEndChar:a.character+o.text.length,sourceToken:o.text,definitionFile:i,symbolId:s})}function Te(e){let n=new Map;for(let r of e)n.set(r.text,(n.get(r.text)??0)+1);return n}function Le(e,n,r,t,o,i){let s=e.getDocumentHighlights?.(n,r,[n])??[],a=[];for(let u of s)if(u.fileName===n)for(let c of u.highlightSpans){let l=Fe(t,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function Fe(e,n,r,t){let o=r.get(n);if(o?.text===t)return o.start;let i=h(e,n);if(i===null)return null;let s=r.get(i);return s?.text===t?s.start:null}export{ze as a,tn as b,Vn as c};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-4L4X66GE.js.map
|