scip-query 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -58
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-3KLLFNT4.js +2 -0
- package/dist/{chunk-UIWAZ2NT.js → chunk-3UVJJ6Z7.js} +1 -1
- package/dist/chunk-3UW7VM4H.js +62 -0
- package/dist/chunk-3ZYF3ELZ.js +2 -0
- package/dist/{chunk-MN75T4UB.js → chunk-47UA45TU.js} +2 -2
- package/dist/{chunk-NC4IUW25.js → chunk-4ZUJJRWT.js} +2 -2
- package/dist/chunk-5B53WB6E.js +4 -0
- package/dist/{chunk-2WEH5QHC.js → chunk-5FOPAXWY.js} +2 -2
- package/dist/{chunk-VZRILF2Z.js → chunk-5M4TYWVI.js} +2 -2
- package/dist/{chunk-QJWN6LA5.js → chunk-5QJXH6ZL.js} +5 -5
- package/dist/{chunk-NN3O7TPH.js → chunk-64MNV6AB.js} +1 -1
- package/dist/chunk-77YBOOYT.js +2 -0
- package/dist/chunk-7KCSELEV.js +2 -0
- package/dist/{chunk-ZZ2W5P3D.js → chunk-7OHWPJ5N.js} +2 -2
- package/dist/chunk-7S5E7KWT.js +2 -0
- package/dist/chunk-A3VNUGKJ.js +2 -0
- package/dist/{chunk-ISCKLDSS.js → chunk-A4L36SZS.js} +3 -3
- package/dist/{chunk-IVAIPXNO.js → chunk-AUVBR62P.js} +2 -2
- package/dist/chunk-AW4N6MGC.js +18 -0
- package/dist/{chunk-PG3ZI5IH.js → chunk-B6MJ5VQV.js} +2 -2
- package/dist/chunk-B75HZHUP.js +2 -0
- package/dist/chunk-BGBBVSH4.js +2 -0
- package/dist/chunk-BKDXBJDQ.js +2 -0
- package/dist/{chunk-AQYBOORI.js → chunk-C2QSK7E7.js} +1 -1
- package/dist/chunk-C3MZZ2ZN.js +2 -0
- package/dist/{chunk-AP5GTKSG.js → chunk-CAWSSEVM.js} +2 -2
- package/dist/chunk-CFL2CNIF.js +10 -0
- package/dist/{chunk-4HTJZC6G.js → chunk-CJJP64OC.js} +2 -2
- package/dist/chunk-CNTEQMHA.js +2 -0
- package/dist/{chunk-WEJYUS5O.js → chunk-CRU42NJU.js} +2 -2
- package/dist/chunk-CSWZFD46.js +2 -0
- package/dist/{chunk-ZOT3WUZW.js → chunk-CTCAF3YA.js} +2 -2
- package/dist/chunk-D322LMSA.js +5 -0
- package/dist/{chunk-772YYL6I.js → chunk-DAI74TJU.js} +2 -2
- package/dist/chunk-DE7MA6OD.js +3 -0
- package/dist/chunk-DJMK4DBL.js +2 -0
- package/dist/chunk-DRAZH77R.js +7 -0
- package/dist/{chunk-L2KFPRMA.js → chunk-E44ZMVNA.js} +2 -2
- package/dist/{chunk-BNW3Q24R.js → chunk-E7KERP7E.js} +2 -2
- package/dist/{chunk-QKO474FG.js → chunk-EOZIZWW4.js} +2 -2
- package/dist/chunk-ERHOS6AW.js +2 -0
- package/dist/{chunk-ADRYSISR.js → chunk-ESG4HBEF.js} +2 -2
- package/dist/chunk-EWC3UK4V.js +3 -0
- package/dist/chunk-FGCL6NDB.js +8 -0
- package/dist/chunk-FIB4JPEX.js +2 -0
- package/dist/chunk-FNRPGGVI.js +2 -0
- package/dist/chunk-FOQHUKNZ.js +4 -0
- package/dist/chunk-FPMVCDIJ.js +2 -0
- package/dist/chunk-FUPDW5AC.js +3 -0
- package/dist/chunk-G3WGZU5Q.js +2 -0
- package/dist/chunk-GS33KGAY.js +2 -0
- package/dist/chunk-GZCQTZLK.js +2 -0
- package/dist/{chunk-VGBSY6N7.js → chunk-HVTYSC26.js} +2 -2
- package/dist/{chunk-2BMFRBV6.js → chunk-ICXVNWMI.js} +2 -2
- package/dist/chunk-JM72FNGA.js +2 -0
- package/dist/chunk-KPHKX4LP.js +71 -0
- package/dist/{chunk-6DEX3XP6.js → chunk-LPLGJ4HO.js} +2 -2
- package/dist/chunk-MHK7Z53U.js +2 -0
- package/dist/chunk-MHTDOFV7.js +5 -0
- package/dist/chunk-MUULWXSJ.js +2 -0
- package/dist/chunk-MZ7APUFN.js +3 -0
- package/dist/chunk-NNDYO2DX.js +2 -0
- package/dist/chunk-NP5HYVLX.js +20 -0
- package/dist/{chunk-Y5H7TBVE.js → chunk-NVFERV4U.js} +2 -2
- package/dist/{chunk-LWYIGRHR.js → chunk-NXIAHE7F.js} +1 -1
- package/dist/chunk-O3OKSF6O.js +2 -0
- package/dist/chunk-O4L4AB3T.js +2 -0
- package/dist/chunk-OBBDKQAG.js +3 -0
- package/dist/chunk-OLD6PBU6.js +7 -0
- package/dist/{chunk-V76FCF5F.js → chunk-PFOCOG57.js} +2 -2
- package/dist/chunk-PVZMPG5I.js +2 -0
- package/dist/chunk-QLNGUWR7.js +2 -0
- package/dist/chunk-QSXQT3NE.js +2 -0
- package/dist/{chunk-OLCKSG3Y.js → chunk-QVCCLDZI.js} +2 -2
- package/dist/chunk-RHTJBYZ5.js +2 -0
- package/dist/chunk-SPE4YCOT.js +7 -0
- package/dist/{chunk-FVIKFWUL.js → chunk-TM6GVHA6.js} +2 -2
- package/dist/chunk-TO54DY4O.js +2 -0
- package/dist/chunk-UMNENNTX.js +2 -0
- package/dist/chunk-UNJG7P2I.js +2 -0
- package/dist/{chunk-TKDJQ2WD.js → chunk-UUBMFL3F.js} +1 -1
- package/dist/chunk-VAA5FFIW.js +2 -0
- package/dist/chunk-WDUTG2ZR.js +4 -0
- package/dist/chunk-X7ZY6FFF.js +4 -0
- package/dist/{chunk-BGRPMGTD.js → chunk-YQH353VA.js} +2 -2
- package/dist/chunk-YTR4CO5S.js +38 -0
- package/dist/chunk-YUOAAR24.js +2 -0
- package/dist/{chunk-YWZBKYLS.js → chunk-YYD245WG.js} +2 -2
- package/dist/{chunk-SCEMECW7.js → chunk-Z4VHYJ5U.js} +2 -2
- package/dist/chunk-ZFMPHDAT.js +4 -0
- package/dist/chunk-ZQLO2SCU.js +6 -0
- package/dist/chunk-ZSLT7NWQ.js +61 -0
- package/dist/cli.js +276 -271
- package/dist/{config-types-CGIeLEpY.d.ts → config-types-Bj4sh28g.d.ts} +37 -1
- package/dist/{db-DdTPetj5.d.ts → db-CTarohbZ.d.ts} +1 -1
- package/dist/git-history-Dao3_Pu9.d.ts +12 -0
- package/dist/{health-C6r2VgpA.d.ts → health-Bx0x1HAG.d.ts} +64 -4
- package/dist/index.d.ts +7 -6
- package/dist/index.js +1 -1
- package/dist/postinstall.js +2 -2
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +6 -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 +40 -5
- 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 +6 -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 +10 -3
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +6 -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 +66 -3
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +20 -4
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +20 -3
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +10 -3
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +11 -3
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +16 -3
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +20 -12
- 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 +51 -0
- package/dist/queries/locality-candidates.js +2 -0
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +8 -3
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +4 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +31 -0
- package/dist/queries/react-component-duplicates.js +2 -0
- package/dist/queries/react-hook-candidates.d.ts +40 -0
- package/dist/queries/react-hook-candidates.js +2 -0
- package/dist/queries/react-large-component-pressure.d.ts +34 -0
- package/dist/queries/react-large-component-pressure.js +2 -0
- package/dist/queries/recent-duplicates.d.ts +32 -3
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +7 -3
- 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 +21 -3
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +10 -3
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-imports.d.ts +4 -0
- package/dist/queries/unused-imports.js +2 -0
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +35 -0
- package/dist/queries/vue-component-duplicates.js +2 -0
- package/dist/queries/vue-composable-candidates.d.ts +40 -0
- package/dist/queries/vue-composable-candidates.js +2 -0
- package/dist/queries/vue-large-view-pressure.d.ts +37 -0
- package/dist/queries/vue-large-view-pressure.js +2 -0
- package/dist/queries/wrapper-candidates.d.ts +6 -3
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -10
- package/dist/reindex.d.ts +1 -1
- package/dist/reindex.js +22 -22
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -2
- package/docs/AGENT_GUIDE.md +353 -0
- package/docs/AI_FAILURE_MODES.md +278 -0
- package/docs/API.md +40 -0
- package/docs/COMMAND_REFERENCE.md +131 -0
- package/docs/DETECTOR_GUIDE.md +119 -0
- package/docs/accuracy-hardening-goal.md +54 -0
- package/docs/analyzer-inventory.md +162 -0
- package/docs/analyzer-validation-ledger.md +262 -0
- package/docs/analyzer-validation-protocol.md +192 -0
- package/docs/assets/scip-query-logo-dark.svg +21 -0
- package/docs/assets/scip-query-logo.svg +24 -0
- package/docs/locality-analyzer-design.md +193 -0
- package/package.json +44 -5
- package/skills/scip-directory-architecture/SKILL.md +178 -0
- package/skills/scip-maintainability/SKILL.md +24 -3
- package/skills/scip-query/SKILL.md +4 -2
- package/skills/scip-query-setup/SKILL.md +118 -0
- package/skills/scip-react-maintainability/SKILL.md +114 -0
- package/skills/scip-vue-maintainability/SKILL.md +130 -0
- package/dist/chunk-4DAPXOWD.js +0 -2
- package/dist/chunk-4JQFTUKD.js +0 -2
- package/dist/chunk-4MHT7LKP.js +0 -3
- package/dist/chunk-5OHZEO3U.js +0 -3
- package/dist/chunk-5QJIEYFB.js +0 -34
- package/dist/chunk-6IGXZZQ4.js +0 -4
- package/dist/chunk-6K2JQ2VI.js +0 -61
- package/dist/chunk-6QVCPUK6.js +0 -2
- package/dist/chunk-6VL4AIEO.js +0 -8
- package/dist/chunk-A2VTV2QB.js +0 -7
- package/dist/chunk-AI2ECT7L.js +0 -2
- package/dist/chunk-BUAC4Q4G.js +0 -2
- package/dist/chunk-BZ6LCGE6.js +0 -2
- package/dist/chunk-CMXFASVD.js +0 -2
- package/dist/chunk-CO3AL7NZ.js +0 -2
- package/dist/chunk-FVVT7GV6.js +0 -4
- package/dist/chunk-HXXRN77A.js +0 -2
- package/dist/chunk-IC3RC3KJ.js +0 -4
- package/dist/chunk-ITHQJZTG.js +0 -2
- package/dist/chunk-IW7ASGVF.js +0 -2
- package/dist/chunk-JODYQDE4.js +0 -2
- package/dist/chunk-MCW36F2D.js +0 -2
- package/dist/chunk-MX6F756F.js +0 -2
- package/dist/chunk-NGI4V4AB.js +0 -18
- package/dist/chunk-O6KCZPJQ.js +0 -62
- package/dist/chunk-OAI5GEIN.js +0 -6
- package/dist/chunk-OH5HIAID.js +0 -4
- package/dist/chunk-OXKEUWMJ.js +0 -2
- package/dist/chunk-PBGTMPJ7.js +0 -2
- package/dist/chunk-PRVDXGSK.js +0 -2
- package/dist/chunk-QYKKTYBN.js +0 -6
- package/dist/chunk-R3G6ERW7.js +0 -7
- package/dist/chunk-R6XDPWJA.js +0 -10
- package/dist/chunk-SJR4SB7B.js +0 -2
- package/dist/chunk-SYKCO25G.js +0 -16
- package/dist/chunk-T22X7WT6.js +0 -2
- package/dist/chunk-TH4JVC34.js +0 -71
- package/dist/chunk-VDY4HYNK.js +0 -2
- package/dist/chunk-VDZIEDJB.js +0 -2
- package/dist/chunk-VDZL45XI.js +0 -2
- package/dist/chunk-WJIS6BNI.js +0 -3
- package/dist/chunk-WN5Z3UVT.js +0 -7
- package/dist/chunk-XCW7DYHM.js +0 -2
- package/dist/chunk-ZF6P2NAT.js +0 -63
- package/dist/chunk-ZGIK464P.js +0 -2
package/README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/scip-query-logo-dark.svg">
|
|
4
|
+
<img src="docs/assets/scip-query-logo.svg" alt="scip-query" width="360">
|
|
5
|
+
</picture>
|
|
6
|
+
</h1>
|
|
6
7
|
|
|
7
8
|
<p align="center">
|
|
8
|
-
<strong>
|
|
9
|
+
<strong>Evidence and verification for AI coding agents.</strong>
|
|
9
10
|
</p>
|
|
10
11
|
|
|
11
12
|
<p align="center">
|
|
12
|
-
|
|
13
|
+
<em>Map the repo. Reuse what exists. Finish the refactor. Gate the diff.</em>
|
|
13
14
|
</p>
|
|
14
15
|
|
|
15
16
|
<p align="center">
|
|
@@ -19,80 +20,98 @@
|
|
|
19
20
|
<a href="https://www.apache.org/licenses/LICENSE-2.0"><img alt="License" src="https://img.shields.io/npm/l/scip-query.svg"></a>
|
|
20
21
|
</p>
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
<a href="https://www.npmjs.com/package/scip-query"><img alt="Install from npm" src="https://img.shields.io/badge/install-npm-cb3837?style=for-the-badge&logo=npm&logoColor=white"></a>
|
|
24
|
-
<a href="docs/AGENT_GUIDE.md"><img alt="Agent guide" src="https://img.shields.io/badge/agent-guide-2563eb?style=for-the-badge"></a>
|
|
25
|
-
<a href="docs/COMMAND_REFERENCE.md"><img alt="Command reference" src="https://img.shields.io/badge/command-reference-111827?style=for-the-badge"></a>
|
|
26
|
-
</p>
|
|
23
|
+
`scip-query` is a TypeScript CLI and npm package that turns SCIP indexes, git history, language-aware source analysis, and your repository's own checks into commands AI coding agents can use before, during, and after a change.
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
Agents are effective at editing the code in front of them. They are less reliable at preserving a whole-repository model across a long task: they miss existing helpers, plan from partial context, migrate only some call sites, overlook files coupled only by history, and declare a diff finished while it still adds duplication, dead code, or stale documentation.
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
`scip-query` gives them a repeatable operating loop: map the target and its blast radius, build a concrete plan from repository evidence, check for reuse before adding a concept, detect unfinished migrations and hidden coupling, and gate the final diff. It does not replace the compiler, tests, or review; it makes structural evidence and repository checks easy for agents to invoke and report.
|
|
28
|
+
|
|
29
|
+
## The Agent Loop
|
|
30
|
+
|
|
31
|
+
| Phase | What the agent needs to establish | Commands |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| Orient | What exists, where it is defined, and what depends on it | `system`, `trace`, `affected`, `plan-context` |
|
|
34
|
+
| Plan | Externally consumed surfaces, change scope, blast radius, and historical partners | `surface`, `change-surface`, `co-change` |
|
|
35
|
+
| Reuse | Whether the helper, component, hook, or composable already exists | `similar`, `recent-duplicates` |
|
|
36
|
+
| Finish | Whether an extraction or migration reached every relevant site | `incomplete-migration`, `unused-params` |
|
|
37
|
+
| Verify | What the diff affected and whether covered structural checks regressed | `diff-impact`, `doc-drift`, `diff-gate`, `health --baseline` |
|
|
38
|
+
| Clean up | Candidate removals and newly exposed dead-code cascades | `cleanup-plan --verify` |
|
|
39
|
+
|
|
40
|
+
React and Vue repositories get additional framework-aware checks for repeated component/template structure, hook/composable behavior, and large-component or large-view pressure. These extend the same reuse and completion workflow; the core graph, history, planning, cleanup, and diff-gate commands are not frontend-specific.
|
|
31
41
|
|
|
32
42
|
## Install
|
|
33
43
|
|
|
34
44
|
```bash
|
|
35
45
|
npm install -g scip-query@latest
|
|
36
|
-
scip-query
|
|
37
|
-
scip-query
|
|
46
|
+
scip-query check-deps
|
|
47
|
+
scip-query reindex
|
|
38
48
|
```
|
|
39
49
|
|
|
40
50
|
Or without a global install: `npx scip-query@latest reindex`.
|
|
41
51
|
|
|
42
|
-
##
|
|
52
|
+
## Start with One Change
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
```bash
|
|
55
|
+
# Before editing: establish structure, consumers, history, and blast radius
|
|
56
|
+
scip-query plan-context <symbol-or-file>
|
|
45
57
|
|
|
46
|
-
|
|
58
|
+
# Before creating a helper or abstraction: look for the existing concept
|
|
59
|
+
scip-query similar <closest-symbol>
|
|
47
60
|
|
|
48
|
-
|
|
61
|
+
# After an extraction or migration: find sites that still contain old logic
|
|
62
|
+
scip-query incomplete-migration
|
|
49
63
|
|
|
50
|
-
|
|
64
|
+
# Before declaring the work complete: refresh the index and gate the diff
|
|
65
|
+
scip-query reindex && scip-query diff-gate
|
|
66
|
+
```
|
|
51
67
|
|
|
52
|
-
|
|
68
|
+
For a repository-wide cleanup pass:
|
|
53
69
|
|
|
54
|
-
|
|
70
|
+
```bash
|
|
71
|
+
scip-query health
|
|
72
|
+
scip-query recent-duplicates
|
|
73
|
+
scip-query cleanup-plan --verify
|
|
74
|
+
scip-query health --write-baseline
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Evidence and Confidence
|
|
78
|
+
|
|
79
|
+
`scip-query` keeps the source and strength of each answer visible:
|
|
55
80
|
|
|
56
81
|
```mermaid
|
|
57
82
|
flowchart LR
|
|
58
|
-
A["
|
|
59
|
-
B["
|
|
60
|
-
C["
|
|
61
|
-
D
|
|
83
|
+
A["SCIP graph facts"] --> F["evidence-ranked findings"]
|
|
84
|
+
B["semantic augmentation"] --> F
|
|
85
|
+
C["source-backed candidates"] --> F
|
|
86
|
+
D["git-history signals"] --> F
|
|
87
|
+
E["repository checks"] --> F
|
|
62
88
|
```
|
|
63
89
|
|
|
64
|
-
1. **
|
|
65
|
-
2. **
|
|
66
|
-
3. **
|
|
90
|
+
1. **SCIP graph facts** for definitions, references, imports, calls, and dependencies.
|
|
91
|
+
2. **Semantic augmentation** for TypeScript where the SCIP index needs more detail.
|
|
92
|
+
3. **Source-backed candidates** for similarity, maintainability, and cleanup checks.
|
|
93
|
+
4. **Git-history signals** for churn, co-change, recency, and documentation drift.
|
|
94
|
+
5. **Repository-toolchain verification** for supported cleanup plans.
|
|
67
95
|
|
|
68
|
-
|
|
96
|
+
Heuristic findings are candidates for inspection, not proof of equivalence or bad design. Run `scip-query capabilities` to see which evidence and verification layers are available for the current repository and language.
|
|
69
97
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
| Who uses this symbol? | `scip-query trace login` |
|
|
74
|
-
| What might break if I change it? | `scip-query affected login` |
|
|
75
|
-
| Everything I need before editing this | `scip-query plan-context login` |
|
|
76
|
-
| What did my git diff affect? | `scip-query diff-impact` |
|
|
77
|
-
| How healthy is this codebase, really? | `scip-query health` |
|
|
78
|
-
| What can I delete — *prove it* | `scip-query cleanup-plan --verify` |
|
|
79
|
-
| What new code duplicates old code? | `scip-query recent-duplicates` |
|
|
80
|
-
| Which docs lie about the code now? | `scip-query doc-drift` |
|
|
81
|
-
| What changes together but isn't linked? | `scip-query co-change` |
|
|
82
|
-
| Gate an agent's diff before merging | `scip-query diff-gate` |
|
|
83
|
-
| Did the findings get worse? (CI gate) | `scip-query health --baseline` |
|
|
98
|
+
## Language and Framework Coverage
|
|
99
|
+
|
|
100
|
+
Graph navigation works through supported [SCIP](https://github.com/sourcegraph/scip) indexers. Higher-confidence augmentation and verification vary by language and project toolchain. TypeScript currently has the richest semantic augmentation. React and Vue add built-in framework-aware maintainability checks on top of the core workflow.
|
|
84
101
|
|
|
85
102
|
## Cleaning Up AI-Generated Code
|
|
86
103
|
|
|
87
|
-
|
|
104
|
+
These checks target specific ways AI-assisted development rots a codebase. The full catalog, with prevention wiring for each detector, is in [docs/AI_FAILURE_MODES.md](docs/AI_FAILURE_MODES.md):
|
|
88
105
|
|
|
89
|
-
**1. Find the echoes.** Agents re-implement helpers they didn't know existed. `recent-duplicates` makes similarity *directional* using git file ages
|
|
106
|
+
**1. Find the echoes.** Agents re-implement helpers, hooks, composables, and frontend components they didn't know existed. `recent-duplicates` makes similarity *directional* using git file ages - which side is the established original, which is the recent echo:
|
|
90
107
|
|
|
91
108
|
```
|
|
92
|
-
91% ECHO src/components/ProjectCardVisual.tsx ProjectCardVisual
|
|
109
|
+
91% ECHO react-component src/components/ProjectCardVisual.tsx ProjectCardVisual (added 62 commits ago)
|
|
93
110
|
duplicates established src/pages/HomePage.tsx RecentProjectRow()
|
|
111
|
+
basis: jsx-structure
|
|
112
|
+
shared: component:ProjectCard, prop:title, event:click
|
|
94
113
|
100% TWIN src/workflows/a.ts ensureAccessible() / src/workflows/b.ts ensureAccessible()
|
|
95
|
-
(both new
|
|
114
|
+
(both new - one agent session duplicated itself; consolidate before they diverge)
|
|
96
115
|
```
|
|
97
116
|
|
|
98
117
|
**2. Finish the half-done extraction.** Agents extract a helper, rewire one or two call sites, and abandon the rest — the extracted logic survives inline at every site they missed. `incomplete-migration` finds helpers that are new in the diff, confirms they were wired in somewhere, and lists the established sites that still contain the helper's logic but never call it (containment scoring, because a missed site holds the helper's logic *plus* its own):
|
|
@@ -112,7 +131,7 @@ staleness 94 product/domain-model.md
|
|
|
112
131
|
22 change(s) since doc update src/workflows/serviceTasks.ts (referenced by doc)
|
|
113
132
|
```
|
|
114
133
|
|
|
115
|
-
**4. Delete with
|
|
134
|
+
**4. Delete with project checks.** `cleanup-plan` runs dead-code analysis to a *fixpoint* — deleting batch 0 makes batch 1 dead, and the plan shows the cascade. `--verify` applies each batch in a throwaway git worktree and runs the supported checker detected for your project (differentially, so pre-existing errors don't drown the signal):
|
|
116
135
|
|
|
117
136
|
```
|
|
118
137
|
── Batch 0: deletable now (graph-fact, 67 LOC) ──
|
|
@@ -124,16 +143,26 @@ When verification *fails*, the errors name the exact references the static evide
|
|
|
124
143
|
|
|
125
144
|
**5. Trim speculative generality.** `unused-params` finds trailing parameters no body ever uses (the classic "options for later"), scoped to removals that are type-safe by construction.
|
|
126
145
|
|
|
127
|
-
**6.
|
|
146
|
+
**6. Keep frontend reuse honest.** React and Vue have dedicated frontend hygiene checks: component-duplicate commands compare JSX/template structure, hook/composable commands compare state/effect/request behavior, and large-component/view commands flag files that concentrate too many reasons to change. `health` includes these as hygiene pressure, while `incomplete-migration` remains the direct check for a hook/composable/helper extraction that was wired into some sites but not all of them.
|
|
147
|
+
|
|
148
|
+
**7. Surface hidden coupling.** `co-change` finds file pairs that repeatedly change in the same commits with *no* dependency edge — schema ↔ generated inventory ↔ doc triangles, backend schemas ↔ frontend stores, `.env.example` ↔ its parser. The reference graph cannot see these; the change graph can.
|
|
128
149
|
|
|
129
|
-
**
|
|
150
|
+
**8. Gate every diff.** `diff-gate` runs a defined set of checks scoped to what a change *introduces* — echoes of established code, incomplete migrations, missing co-change partners, docs that cite the changed files, fresh unused params, new dead symbols, baseline regressions — and exits nonzero with remediation text for each finding:
|
|
130
151
|
|
|
131
152
|
```
|
|
132
153
|
[co-change-partner] schema.prisma changed, but scripts/scope-inventory.mjs did not — they change together 12x (86% of the time)
|
|
133
154
|
-> Update scripts/scope-inventory.mjs alongside this change, or confirm the coupling no longer holds.
|
|
134
155
|
```
|
|
135
156
|
|
|
136
|
-
**
|
|
157
|
+
**9. Ratchet it in CI.** `health --write-baseline` snapshots finding identities into a committable file; `health --baseline` exits 1 on any *new* finding. "Don't get worse" is an objective gate that no score arithmetic can game.
|
|
158
|
+
|
|
159
|
+
Accepted findings can be recorded without weakening the rest of the gate:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
scip-query suppress SQABC123DEF456 --check echo --reason "intentional compatibility shim"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
This appends a reasoned entry to `.scipquery.json`; `config-validate` rejects suppressions without an identity and reason, and `diff-gate --json` reports both active and suppressed findings.
|
|
137
166
|
|
|
138
167
|
Before any edit, `plan-context <target>` bundles the structural picture — definitions, references, call graph, blast radius — plus a HISTORY section: churn, fix-commit density, and the files that usually change together with the target ("editing this usually means editing these").
|
|
139
168
|
|
|
@@ -143,7 +172,7 @@ Before any edit, `plan-context <target>` bundles the structural picture — defi
|
|
|
143
172
|
|
|
144
173
|
```
|
|
145
174
|
Codebase Health Score: 95/100
|
|
146
|
-
Risk: 95/100 (
|
|
175
|
+
Risk: 95/100 (history-correlated signals: graph facts + change graph)
|
|
147
176
|
Hygiene: 100/100 (tidiness candidates)
|
|
148
177
|
|
|
149
178
|
Score Breakdown (100 minus the following):
|
|
@@ -156,9 +185,9 @@ Axes:
|
|
|
156
185
|
Validation: flagged fix-density 0.12 vs baseline 0.20 (0.6x)
|
|
157
186
|
```
|
|
158
187
|
|
|
159
|
-
- **Risk vs. Hygiene** are separate claims: risk components are
|
|
188
|
+
- **Risk vs. Hygiene** are separate claims: risk components are tied to graph facts and repository-history signals; hygiene components are tidiness. Blending them is how scores become meaningless.
|
|
160
189
|
- **Every deduction is itemized** — the scalar is auditable, not vibes.
|
|
161
|
-
- **The validation axis is a falsifiability loop**: it measures whether flagged files actually attract more fix commits than the rest *in your repo*, per detector. On some codebases
|
|
190
|
+
- **The validation axis is a falsifiability loop**: it measures whether flagged files actually attract more fix commits than the rest *in your repo*, per detector. On some codebases a detector tracks repeated fixes; on others it is mostly noise — the tool reports which, instead of assuming.
|
|
162
191
|
- **Suppressions are data**: every `// scip-query: ignore-*` comment is a precision label, counted and reported.
|
|
163
192
|
|
|
164
193
|
## Accuracy Model
|
|
@@ -180,7 +209,7 @@ Heuristic detectors carry guardrails learned from real codebases: published `pac
|
|
|
180
209
|
|
|
181
210
|
## Agent Skills
|
|
182
211
|
|
|
183
|
-
`scip-query install-skills` symlinks ready-made skills into Claude Code, Codex, and shared agent roots (`~/.agents/skills/`) — they update automatically with the package. The `scip-query` router skill triggers on any codebase work and dispatches to the right specialist: exploring (`scip-explore`), debloating (`scip-debloat`), maintainability review (`scip-maintainability`), post-change verification (`scip-verify`), doc reconciliation (`scip-doc-reconcile`), AI-rot cleanup (`scip-ai-cleanup`), per-language guidance (`scip-language-playbook`), and grounded planning (`concrete-plan`).
|
|
212
|
+
`scip-query install-skills` symlinks ready-made skills into Claude Code, Codex, and shared agent roots (`~/.agents/skills/`) — they update automatically with the package. The `scip-query` router skill triggers on any codebase work and dispatches to the right specialist: exploring (`scip-explore`), debloating (`scip-debloat`), directory architecture review (`scip-directory-architecture`), maintainability review (`scip-maintainability`), React frontend maintainability review (`scip-react-maintainability`), Vue frontend maintainability review (`scip-vue-maintainability`), post-change verification (`scip-verify`), doc reconciliation (`scip-doc-reconcile`), AI-rot cleanup (`scip-ai-cleanup`), per-language guidance (`scip-language-playbook`), and grounded planning (`concrete-plan`).
|
|
184
213
|
|
|
185
214
|
Then, once per project, `scip-query setup-agent` seeds the `AGENTS.md` guidance block (plus a `CLAUDE.md` import shim, since Claude Code doesn't read AGENTS.md natively), and `--git-hook` adds a pre-commit diff gate that fires no matter which agent — or human — wrote the change.
|
|
186
215
|
|
|
@@ -222,13 +251,21 @@ For Python, the executable may be `scip-python`, `scip-python-plus`, or both. `s
|
|
|
222
251
|
|
|
223
252
|
Vue single-file components are handled through the JavaScript/TypeScript indexer. `scip-query` also extracts the `<script>` or `<script setup>` block so symbol, reference, and import queries cover Vue components alongside regular `.ts` and `.js` files.
|
|
224
253
|
|
|
254
|
+
`scip-query capabilities` prints project-level readiness plus a per-language matrix for SCIP indexing, source fallback evidence, semantic provider support, cleanup detector support, and cleanup verification coverage. Use it when you need to know whether a finding is graph-backed, semantic, heuristic, or compiler-verified for the language in front of you.
|
|
255
|
+
|
|
225
256
|
## How It Works
|
|
226
257
|
|
|
227
258
|
1. A SCIP indexer analyzes source code with the actual compiler, type checker, or language server and produces `index.scip`.
|
|
228
259
|
2. The `scip` CLI converts that protobuf file to a SQLite database: `index.db`.
|
|
229
260
|
3. `scip-query` runs SQL queries, language-aware source augmentation, and git-history analysis against it.
|
|
230
261
|
|
|
231
|
-
By default, indexes live in `~/.cache/scip-query/projects/<hash>/`, keeping project directories clean. Override paths with `.scipquery.json` or `SCIP_QUERY_*` environment variables.
|
|
262
|
+
By default, indexes live in `~/.cache/scip-query/projects/<hash>/`, keeping project directories clean. Override paths with `.scipquery.json` or `SCIP_QUERY_*` environment variables. Reindexing writes per-language SCIP shards next to the SQLite index, so a mixed-language repo can reuse unchanged language outputs and rerun only the languages whose source/config inputs changed.
|
|
263
|
+
|
|
264
|
+
Most read-only commands accept `--json` and use the same envelope:
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{ "command": "fan-in", "args": ["login"], "options": { "json": true }, "result": [] }
|
|
268
|
+
```
|
|
232
269
|
|
|
233
270
|
## Configuration
|
|
234
271
|
|
|
@@ -256,6 +293,26 @@ It creates `.scipquery.json`:
|
|
|
256
293
|
}
|
|
257
294
|
```
|
|
258
295
|
|
|
296
|
+
Use `declaredCouplings` for files that intentionally form one maintenance unit.
|
|
297
|
+
These pairs are treated as structurally linked by `co-change` and health, while
|
|
298
|
+
still appearing in file-specific exploration:
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"declaredCouplings": [
|
|
303
|
+
{
|
|
304
|
+
"name": "cleanup detector family",
|
|
305
|
+
"reason": "These detectors share candidate, evidence, and health policy changes.",
|
|
306
|
+
"files": [
|
|
307
|
+
"src/queries/cleanup/dead.ts",
|
|
308
|
+
"src/queries/cleanup/isolated.ts",
|
|
309
|
+
"src/queries/cleanup/stale-abstractions.ts"
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
259
316
|
Useful environment variables:
|
|
260
317
|
|
|
261
318
|
| Variable | Purpose |
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as t}from"./chunk-
|
|
1
|
+
import{c as t}from"./chunk-KPHKX4LP.js";import{writeFileSync as o}from"fs";import{workerData as s}from"worker_threads";var e=s;try{let r=t({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles,tasks:e.tasks});o(e.resultPath,JSON.stringify({ok:!0,result:r}))}catch(r){o(e.resultPath,JSON.stringify({ok:!1,error:r instanceof Error?r.message:String(r)}))}finally{let r=new Int32Array(e.sharedBuffer);Atomics.add(r,0,1),Atomics.notify(r,0)}
|
|
2
2
|
//# sourceMappingURL=augment-vue-worker.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p,c as u}from"./chunk-D322LMSA.js";import{c}from"./chunk-OBBDKQAG.js";import{d as a}from"./chunk-7S5E7KWT.js";var l=a("suppression-inventory",{clearGroups:["whole-project"]});function b(e){return l.get(e,()=>f(e))}function f(e){let r={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,uncategorized:0},t=new Map,s=0;for(let o of c(e)){let n=p(e,o);if(!(!n||!n.includes("scip-query")))for(let g of n.split(/\r?\n/)){let i=u(g);if(i===null)continue;s+=1,t.set(o,(t.get(o)??0)+1);let y=d(i);r[y]+=1}}return{total:s,byCategory:r,byFile:t}}function d(e){if(!e)return"uncategorized";let r=e.toLowerCase();return r==="dead-code"?"dead":r}export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3KLLFNT4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function S(n,e){let t=new Set;for(let r of n)e.has(r)&&t.add(r);return t}function M(n,e){let t=new Set;for(let r of n)e.has(r)||t.add(r);return t}function w(n,e){if(n.size===0&&e.size===0)return 0;let t=0;for(let o of n)e.has(o)&&(t+=1);let r=n.size+e.size-t;return r===0?0:t/r}function x(n,e){if(n.size===0)return 0;let t=0;for(let r of n)e.has(r)&&(t+=1);return t/n.size}function z(n){let e=n.length;if(e===0)return new Map;let t=new Map;for(let o of n)for(let s of o)t.set(s,(t.get(s)??0)+1);let r=new Map;for(let[o,s]of t)r.set(o,Math.log(e/s));return r}function p(n){let e=[...n.values()].sort((r,o)=>r-o);if(e.length===0)return 0;let t=Math.floor(e.length/2);return e.length%2===0?(e[t-1]+e[t])/2:e[t]}function b(n,e,t){let r=S(n,e);if(r.size===0)return{similarity:0,significantShared:[],trivialShared:[]};let o=0,s=0,T=0,l=new Set([...n,...e]);for(let i of l){let a=t.get(i)??0,f=n.has(i)?a:0,u=e.has(i)?a:0;o+=f*u,s+=f*f,T+=u*u}let h=Math.sqrt(s)*Math.sqrt(T),g=h>0?o/h:0,m=p(t),c=[],d=[];for(let i of r)(t.get(i)??0)>=m?c.push(i):d.push(i);return c.sort((i,a)=>(t.get(a)??0)-(t.get(i)??0)),{similarity:g,significantShared:c,trivialShared:d}}export{S as a,M as b,w as c,x as d,z as e,b as f};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-3UVJJ6Z7.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{a as _,b as m,c as h,d as D,e as f,g as S}from"./chunk-JM72FNGA.js";import{c as L}from"./chunk-QLNGUWR7.js";import{a as x}from"./chunk-D322LMSA.js";import{a as y}from"./chunk-64MNV6AB.js";import{c as g}from"./chunk-7S5E7KWT.js";function K(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
|
|
2
|
+
FROM global_symbols gs
|
|
3
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
4
|
+
JOIN documents d ON der.document_id = d.id
|
|
5
|
+
WHERE ${n.where}
|
|
6
|
+
${e.pathExclusionsFor("d")}
|
|
7
|
+
${R(n.orderBy)}
|
|
8
|
+
${M(n.limit)}`,...n.params??[])}function V(e,n){return e.all(`SELECT
|
|
9
|
+
gs.id,
|
|
10
|
+
gs.symbol,
|
|
11
|
+
c.document_id,
|
|
12
|
+
MIN(c.start_line) AS start_line,
|
|
13
|
+
MAX(c.end_line) AS end_line,
|
|
14
|
+
d.relative_path,
|
|
15
|
+
gs.display_name,
|
|
16
|
+
gs.documentation
|
|
17
|
+
FROM global_symbols gs
|
|
18
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
19
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
20
|
+
JOIN documents d ON c.document_id = d.id
|
|
21
|
+
WHERE m.role = 1
|
|
22
|
+
AND ${n.where}
|
|
23
|
+
${e.pathExclusionsFor("d")}
|
|
24
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
|
|
25
|
+
${R(n.orderBy)}
|
|
26
|
+
${M(n.limit)}`,...n.params??[])}function R(e){return e?`ORDER BY ${e}`:""}function M(e){return typeof e=="number"?`LIMIT ${e}`:""}function N(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function w(e){if(!e)return null;let n=I(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let r=e.slice(t+1);return(I(r)??r).replace(/\n/g," ")}function I(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function F(e){if(m(e.symbol)!==null)return!1;let t=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(t)}function E(e,n,t={}){let r=new Map;for(let o of n)e.length>0&&!F(o)||r.set(o.id,o);for(let o of e)r.set(o.id,o);let i=[...r.values()];return t.sort?i.sort((o,s)=>o.start_line-s.start_line||o.end_line-s.end_line||o.symbol.localeCompare(s.symbol)):i}var v=g("file-definitions",{clearGroups:["definition-catalog"]}),O=new WeakMap;function p(e,n){return v.get(e,n,()=>{let t=E(k(e,n),$(e,n),{sort:!0});return P(e,n,t.map(A))})}function k(e,n){return e.all(`SELECT
|
|
27
|
+
gs.id,
|
|
28
|
+
gs.symbol,
|
|
29
|
+
der.document_id,
|
|
30
|
+
der.start_line,
|
|
31
|
+
der.end_line,
|
|
32
|
+
d.relative_path,
|
|
33
|
+
gs.display_name,
|
|
34
|
+
gs.kind,
|
|
35
|
+
gs.documentation,
|
|
36
|
+
gs.enclosing_symbol
|
|
37
|
+
FROM global_symbols gs
|
|
38
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
39
|
+
JOIN documents d ON der.document_id = d.id
|
|
40
|
+
WHERE d.relative_path = ?
|
|
41
|
+
${e.symbolNoiseFor("gs")}
|
|
42
|
+
ORDER BY der.start_line, der.end_line`,n)}function $(e,n){return e.all(`SELECT
|
|
43
|
+
gs.id,
|
|
44
|
+
gs.symbol,
|
|
45
|
+
c.document_id,
|
|
46
|
+
MIN(c.start_line) AS start_line,
|
|
47
|
+
MAX(c.end_line) AS end_line,
|
|
48
|
+
d.relative_path,
|
|
49
|
+
gs.display_name,
|
|
50
|
+
gs.kind,
|
|
51
|
+
gs.documentation,
|
|
52
|
+
gs.enclosing_symbol
|
|
53
|
+
FROM global_symbols gs
|
|
54
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
55
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
56
|
+
JOIN documents d ON c.document_id = d.id
|
|
57
|
+
WHERE d.relative_path = ?
|
|
58
|
+
AND m.role = 1
|
|
59
|
+
${e.symbolNoiseFor("gs")}
|
|
60
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
61
|
+
ORDER BY start_line, end_line`,n)}function A(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:D(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:S(e.symbol),isTypeLike:f(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function ce(e,n={}){return Q(e,n.scope)}function Q(e,n){return y(e,{scope:n,includeIgnored:!1}).flatMap(t=>p(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function de(e,n,t={}){if(n.length===0)return[];let r=n.flatMap(i=>p(e,i)).filter(i=>!e.isIgnored(i.relativePath));return t.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),t.sort&&(r=r.sort((i,o)=>i.relativePath.localeCompare(o.relativePath)||i.startLine-o.startLine||i.endLine-o.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:h(i.symbol),signature:N(w(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function T(e){let n=new Map,t=e.map((r,i)=>({definition:r,index:i,span:r.endLine-r.startLine})).sort((r,i)=>r.span-i.span||r.index-i.index);for(let{definition:r}of t)for(let i=r.startLine;i<=r.endLine;i+=1)n.has(i)||n.set(i,r);return n}function me(e,n){let t=O.get(e);return t||(t=T(e),O.set(e,t)),t.get(n)??null}function ue(e,n){let t=p(e,n.relative_path).find(r=>r.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function P(e,n,t){let r=x(e,n),i=L(e,n);return i?j(t,i,r):r?B(t,r):t}function B(e,n){let t=n.split(/\r?\n/),r=J(e,t),i=H(e,r),o=W(i,t);return Y(e,o)}function J(e,n){let t=e.some(i=>b(i.symbol))?Z(n):null,r=new Map;for(let i of e)r.set(i.symbolId,G(n,t,i));return r}function H(e,n){return e.filter(t=>b(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,r)=>t.startLine-r.startLine||t.definition.startLine-r.definition.startLine||t.definition.symbol.localeCompare(r.definition.symbol))}function W(e,n){let t=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],o=e[r+1],s=o?Math.max(i.startLine,o.startLine-1):n.length-1;t.set(i.definition.symbolId,{startLine:i.startLine,endLine:U(n,i.definition,i.startLine,s)})}return t}function Y(e,n){return e.map(t=>{let r=n.get(t.symbolId);return r?{...t,startLine:r.startLine,endLine:r.endLine}:t})}function j(e,n,t=null){let r=new Map;for(let i of n){let o=r.get(i.name);o?o.push(i):r.set(i.name,[i])}return e.map(i=>{if(!z(i)||!i.leaf)return C(i,t);let o=r.get(i.leaf);if(!o||o.length===0)return C(i,t);let s=o[0],a=Math.abs(s.startLine-i.startLine);for(let c=1;c<o.length;c+=1){let l=o[c],d=Math.abs(l.startLine-i.startLine);d<a&&(s=l,a=d)}return{...i,startLine:s.startLine,endLine:s.endLine}})}function z(e){return b(e.symbol)?!0:f(e.symbol)==="term"&&m(e.symbol)===null}function C(e,n){if(!n||!e.leaf||f(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),o=n.split(/\r?\n/).findIndex(s=>r.test(s));return o>=0?{...e,startLine:o,endLine:o}:e}function G(e,n,t){if(!b(t.symbol))return t.startLine;let r=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return r;let i=n.get(t.leaf);if(!i||i.length===0)return r;let o=null;for(let s of i){let a=Math.abs(s-t.startLine);(!o||a<o.distance)&&(o={line:s,distance:a})}return o?.line??r}function Z(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,o=new Map,s=(a,c)=>{let l=o.get(a);if(!l){o.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let d of c.matchAll(n))d[1]&&s(d[1],a);for(let d of c.matchAll(t))d[1]&&s(d[1],a);let l=c.match(r);l?.[1]&&s(l[1],a);for(let d of c.matchAll(i))d[1]&&s(d[1],a)}return o}function U(e,n,t,r){let i=Math.max(t,Math.min(e.length-1,r)),o=Math.max(t,Math.min(i,n.endLine)),s=0,a=0,c=!1;for(let l=t;l<=i;l+=1){let d=X(e[l]??"");for(let u of d)u==="{"?(s+=1,c=!0):u==="}"?s=Math.max(0,s-1):u==="("?a+=1:u===")"&&(a=Math.max(0,a-1));if(c&&s===0||!c&&a===0&&l>=o)return l}return o}function X(e){let n="",t=null,r=!1;for(let i=0;i<e.length;i+=1){let o=e[i],s=e[i+1];if(!t&&o==="/"&&s==="/"){n+=" ".repeat(e.length-i);break}if(t){if(r){r=!1,n+=" ";continue}if(o==="\\"){r=!0,n+=" ";continue}o===t&&(t=null),n+=" ";continue}if(o==='"'||o==="'"||o==="`"){t=o,n+=" ";continue}n+=o}return n}function b(e){return e.includes("().")}function fe(e){let n=_(e);if("kind"in n)return[];let t=[];for(let r=n.descriptors.length-2;r>=0;r-=1){let i=n.descriptors[r];i?.suffix==="type"&&i.name&&t.push(i.name)}return t}export{K as a,V as b,N as c,w as d,E as e,p as f,ce as g,Q as h,de as i,T as j,me as k,ue as l,fe as m};
|
|
62
|
+
//# sourceMappingURL=chunk-3UW7VM4H.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as y,f as w,g as E}from"./chunk-ZQLO2SCU.js";import{a as g}from"./chunk-BGBBVSH4.js";import{b as V,c as G,d as O}from"./chunk-GZCQTZLK.js";import{c as B}from"./chunk-YTR4CO5S.js";import{a as K,k as F,l as j}from"./chunk-HVTYSC26.js";import{a as T}from"./chunk-AUVBR62P.js";import{f as q,h as S}from"./chunk-3UW7VM4H.js";import{f as k,g as P,i as N,j as A}from"./chunk-JM72FNGA.js";import{a as C,f as p}from"./chunk-QLNGUWR7.js";import{a as b,b as L}from"./chunk-EWC3UK4V.js";import{d}from"./chunk-D322LMSA.js";import{c as M}from"./chunk-OBBDKQAG.js";import{a as v}from"./chunk-64MNV6AB.js";function H(r,e,t){let a=e.identifierResolution==="strict"?F:j;for(let n of e.paths)if(!(!b(n)&&!(e.includeVueSfc&&L(n)))&&!r.isIgnored(n)&&!e.skipPath?.(n))try{let l=(i,c,R,m)=>{if(e.candidateNames&&!e.candidateNames.has(i))return;let h=e.resolveTargets?e.resolveTargets({sourceFile:n,name:i,kind:c,defaultTargets:m}):m();for(let D of h)t({sourceFile:n,name:i,target:D,occurrences:R,kind:c})},f=K(r,n);for(let[i,c]of f)l(i,"identifier",c.length,()=>a(r,n,i));for(let i of p(r,n,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let c=i.kind==="cross-language-dispatch"?()=>F(r,n,i.name):()=>a(r,n,i.name);l(i.name,i.kind,i.occurrences,c)}}finally{e.afterPath?.(n)}}function W(r,e={}){let{scope:t,minLoc:a=1,maxLoc:n=Number.POSITIVE_INFINITY,excludeSymbol:o,excludeEntrySurfaces:l=!1,excludeTypesFiles:f=!1,excludeRootedSymbols:i=!1,requireFunctionLikeSymbol:c=!1,requireCallableSymbol:R=!1,excludeRustTraitImplMembers:m=!1,includeSuppressed:h=!1,sortByLocDesc:D=!1}=e,I=[];for(let s of S(r,t)){let u=s.relativePath;if(r.isIgnored(u)||l&&w(r,u)||!_(s,{requireFunctionLikeSymbol:c,requireCallableSymbol:R})||o!==void 0&&s.symbol===o)continue;let x=g(s);x<a||x>n||f&&z(u)||i&&E(r,s.symbol,u)||m&&N(s.symbol)||y(u)!=="test"&&(A(s.symbol)||!h&&d(r,u,s.startLine)||I.push(s))}return D?I.sort((s,u)=>g(u)-g(s)):I}function _(r,e){return e.requireCallableSymbol?k(r.symbol):e.requireFunctionLikeSymbol?P(r.symbol):r.isFunctionLike}function z(r){return(r.split("/").pop()??"").includes("types")}var Y=class{constructor(e){this.db=e}db;scopedDefinitions(e){return S(this.db,e)}definitionsForFile(e){return q(this.db,e)}productionCallableDefinitions(e={}){return W(this.db,e)}calleeMap(e,t={}){return B(this.db,e,t)}crossFileCallerMap(e,t={}){return V(this.db,e,t)}sourceFallbackCallerFiles(e){return G(this.db,e)}callerFileMap(e,t={}){return O(this.db,e,t)}frameworkReferencedSymbolIds(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let o=t.get(n.leaf)??[];o.push(n.symbolId),t.set(n.leaf,o)}let a=new Set;for(let n of v(this.db,{includeIgnored:!1}))if(b(n)==="rust")for(let{name:o}of p(this.db,n,{includeRustAttributeNames:!0}))for(let l of t.get(o)??[])a.add(l);return a}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let a=new Map(e.map(o=>[o.symbolId,o.symbol])),n=this.calleeMap(e,t);return new Set([...n.entries()].filter(([o,l])=>{let f=a.get(o);return l.some(i=>i.symbol!==f)}).map(([o])=>o))}fileDependencyGraph(e){return T(this.db,e)}fileKind(e){return y(e)}hasSuppressionComment(e){return d(this.db,e.relativePath,e.startLine)}sourceFiles(){return M(this.db)}scanSourceReferences(e,t){H(this.db,e,t)}callableSignature(e){let t=C(this.db,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{Y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3ZYF3ELZ.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-MZ7APUFN.js";import{a as g,c as m}from"./chunk-JM72FNGA.js";function _(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
|
|
2
2
|
WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,h=1;s>=0;s--,h++){let p=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:p,shortName:p,depth:h})}return b}export{_ as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-47UA45TU.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-CTCAF3YA.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -30,4 +30,4 @@ import{a as s}from"./chunk-ZOT3WUZW.js";function m(e,d){let i=s(e,d);return i?e.
|
|
|
30
30
|
WHERE d2.relative_path = ?
|
|
31
31
|
AND d1.relative_path != ?
|
|
32
32
|
ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{m as a,o as b};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-4ZUJJRWT.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as ee}from"./chunk-NNDYO2DX.js";import{a as X}from"./chunk-FGCL6NDB.js";import{a as y}from"./chunk-B32FX5KB.js";import{a as Q}from"./chunk-SPE4YCOT.js";import{a as J}from"./chunk-ZFMPHDAT.js";import{a as Z}from"./chunk-C2QSK7E7.js";import{a as W,b as Y}from"./chunk-MHTDOFV7.js";import{a as U}from"./chunk-G3WGZU5Q.js";import{a as V}from"./chunk-DE7MA6OD.js";import{a as q}from"./chunk-7KCSELEV.js";import{b as I,c as P,f as H}from"./chunk-NP5HYVLX.js";import{a as _,d as z}from"./chunk-WDUTG2ZR.js";import{a as O}from"./chunk-AW4N6MGC.js";import{b as E}from"./chunk-C3MZZ2ZN.js";import{a as F,c as N,d as K,e as B}from"./chunk-CNTEQMHA.js";import{f as L}from"./chunk-DRAZH77R.js";import{a as M}from"./chunk-CJJP64OC.js";import{a as j}from"./chunk-3ZYF3ELZ.js";import{f as w,g as D}from"./chunk-ZQLO2SCU.js";import{d as $,e as G}from"./chunk-JM72FNGA.js";import{createHash as ye}from"crypto";import{existsSync as x,readFileSync as oe}from"fs";import{existsSync as se,readFileSync as ae,writeFileSync as ce}from"fs";import{isAbsolute as le,join as fe}from"path";var de=75e3,ue=5e3,he=2500;function ge(e){let i=Z(e);return i.symbols>=de||i.documents>=ue?he:void 0}var me=".scipquery-baseline.json";function k(e,i){return i&&le(i)?i:fe(e.config.projectRoot,i??me)}function ne(e,i={}){let{scope:n}=i,r=ge(e),o=[],s=E(e,{scope:n,...y.dead,scanLimit:r});for(let t of s.symbols)w(e,t.relativePath)||D(e,t.symbol,t.relativePath)||t.kind==="dead-code"&&o.push(`dead:${t.relativePath}:${t.shortName}`);for(let t of U(e,{scope:n,...y.isolated,scanLimit:r}))w(e,t.relativePath)||D(e,t.symbol,t.relativePath)||o.push(`isolated:${t.relativePath}:${t.shortName}`);for(let t of M(e,{scope:n}))t.kind==="real"&&o.push(`cycle:${pe(t.path)}`);for(let t of Y(e,{scope:n,...y.similar,scanLimit:r}))o.push(`similar:${[t.symbolA,t.symbolB].sort().join("|")}`);for(let t of q(e,{scope:n,...y.extract,scanLimit:r}))o.push(`extract:${t.relativePath}:${t.shortName}`);for(let t of Q(e,{scope:n,...y.wrappers,scanLimit:r}))o.push(`wrapper:${t.file}:${t.shortName}`);for(let t of V(e,{scope:n,...y.passthroughs,scanLimit:r}))o.push(`passthrough:${t.file}:${t.shortName}`);for(let t of J(e,{scope:n,...y.stale,scanLimit:r}))o.push(`stale:${t.file}:${t.shortName}`);for(let t of O(e,{scope:n,...y.drift}).results)t.kind!=="pattern-deviation"&&o.push(`drift:${t.kind}:${t.file}:${t.dep}`);return[...new Set(o)].sort()}function pe(e){if(e.length===0)return"";let i=0;for(let n=1;n<e.length;n++)e[n]<e[i]&&(i=n);return[...e.slice(i),...e.slice(0,i)].join(">")}function $n(e,i={}){let n=ne(e,{scope:i.scope}),r=k(e,i.path);return ce(r,JSON.stringify({version:1,findings:n},null,2)+`
|
|
2
|
+
`),{path:r,findingCount:n.length}}function ie(e,i={}){let n=k(e,i.path);if(!se(n))throw new Error(`No baseline found at ${n}. Create one with: scip-query health --write-baseline`);let r=JSON.parse(ae(n,"utf-8")),o=new Set(r.findings??[]),s=ne(e,{scope:i.scope}),t=new Set(s);return{baselinePath:n,baselineCount:o.size,current:s,newFindings:s.filter(c=>!o.has(c)),fixedFindings:[...o].filter(c=>!t.has(c))}}var Bn=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function Mn(e,i={}){let n=i.base??"HEAD",{minTogether:r=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:t=Number.POSITIVE_INFINITY,minSimilarity:c=.8}=i,a=new Set(i.skip??[]),f=P(e,{base:n}),g=I(e,{base:n,plan:f}),u=g.changedFiles,d=new Set(u),l=new Set(f.changedFileLines),p=Xe(e.config.projectRoot,n,f),h={base:n,changedFiles:u,changedSymbols:g.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:g.summary.note};if(u.length===0)return h;let m=(b,S)=>{if(a.has(b)){h.skipped.push({check:b,reason:"skipped via --skip"});return}S()};return m("echo",()=>De(e,g.changedSymbols,d,p,s,c,h)),m("incomplete-migration",()=>je(e,n,f,t,h)),m("co-change-partner",()=>Ee(e,d,r,o,h)),m("doc-reference",()=>Me(e,d,l,f.changedRanges,h)),m("unused-params",()=>Je(e,u,h)),m("new-dead",()=>Ze(e,g.changedSymbols,p,h)),m("baseline",()=>tn(e,h)),$e(h,e.config.suppressions??[]),h.rootCauseGroups=be(h.findings),h}function be(e){let i=new Map;for(let n of e){let r=n.groupKey??`${n.check}:${n.id}`,o=i.get(r);o||(o={groupKey:r,check:n.check,severity:n.severity,actionTier:n.actionTier,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:n.message,remediation:n.remediation},i.set(r,o)),o.count+=1,o.findingIds.push(n.id),o.severity=Ce(o.severity,n.severity),o.actionTier=Se(o.actionTier,n.actionTier),n.file&&o.files.add(n.file);for(let s of n.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(n=>({...n,files:[...n.files].sort(),relatedFiles:[...n.relatedFiles].sort()})).sort((n,r)=>r.count-n.count||T(r.severity)-T(n.severity)||n.groupKey.localeCompare(r.groupKey))}function Ce(e,i){return T(i)>T(e)?i:e}function T(e){return e==="error"?2:e==="warning"?1:0}function Se(e,i){return e?i&&te(i)>te(e)?i:e:i}function te(e){return e==="direct"?2:e==="signal"?1:0}function $e(e,i){if(i.length===0||e.findings.length===0)return;let n=[];for(let r of e.findings){let o=i.find(s=>we(s,r));o?e.suppressed.push({finding:r,suppression:o}):n.push(r)}e.findings=n}function we(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function De(e,i,n,r,o,s,t){t.checksRun.push("echo");for(let c of i.slice(0,o)){if(r(c))continue;let a=W(e,c.symbol,{minSimilarity:s,limit:5}),f=[];for(let l of a){let p=l.fileA===c.file?l.fileB:l.fileA,h=l.fileA===c.file?l.shortNameB:l.shortNameA,m=l.fileA===c.file?l.symbolB:l.symbolA;n.has(p)||f.push({otherFile:p,otherShort:h,otherSymbol:m,similarity:l.similarity,similarityBasis:l.similarityBasis??"callees",sharedEvidence:l.sharedCallees})}if(f.length===0)continue;let g=f[0],u=C("echo",c.symbol,c.file,...f.map(l=>`${l.otherSymbol}|${l.otherFile}`).sort()),d=ke(c,f);t.findings.push({id:u,groupKey:u,actionTier:d,check:"echo",severity:"warning",evidence:"heuristic",confidence:g.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(f.map(l=>l.otherFile))].sort(),message:xe(c,f),why:Ae(c,f),remediation:Ge(d,c.shortName,g.otherShort),suppressionHint:`scip-query: ignore echo ${u} -- <reason>`})}i.length>o&&t.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function ke(e,i){return i.some(r=>Re(e.symbol,r))?"direct":"signal"}function Re(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let n=$(e),r=$(i.otherSymbol);return!n||!r?!1:n===r?!0:ve(i.sharedEvidence)?!1:Te(n,r)}function Te(e,i){let n=re(e),r=re(i);if(n.length===0||r.length===0)return!1;let o=new Set(r),s=n.filter(t=>o.has(t)).length;return s>=2&&s/Math.min(n.length,r.length)>=.5}function re(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var Fe=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function ve(e){return e.length>=3&&e.every(i=>Fe.has(i.toLowerCase()))}function xe(e,i){let n=i[0],r=Math.round(n.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${r}% similar to established ${n.otherShort} (${n.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${r}% similar to ${n.otherShort} (${n.otherFile})`}function Ae(e,i){let n=[`${e.shortName} was changed in this diff.`];for(let r of i.slice(0,3))n.push(`${r.otherShort} is outside this diff and scored ${Math.round(r.similarity*100)}% similar by ${r.similarityBasis} evidence.`),n.push(`Shared evidence: ${r.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&n.push(`${i.length-3} additional similar match(es) grouped into this finding.`),n}function Ge(e,i,n){return e==="direct"?`Extract or reuse the shared behavior with ${n}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function je(e,i,n,r,o){let s=X(e,{base:i,maxHelpers:r,diffPlan:n});if(!s.available){o.skipped.push({check:"incomplete-migration",reason:"no git history"});return}o.checksRun.push("incomplete-migration"),s.note&&o.skipped.push({check:"incomplete-migration",reason:s.note});for(let t of s.findings){let c=t.leftovers.map(l=>`${l.shortName} (${l.file}, ${Math.round(l.containment*100)}% helper / ${Math.round(l.siteCoverage*100)}% site, ${l.migrationScope})`).join(", "),a=t.leftovers.map(l=>`${l.shortName}: ${l.migrationScope} (${l.migrationScopeReasons[0]})`).join("; "),f=[...t.migratedFiles,...t.leftovers.map(l=>l.file)],g=t.leftovers.length===0?void 0:Math.max(...t.leftovers.map(l=>Math.min(l.containment,l.siteCoverage))),u=t.leftovers.some(l=>l.migrationScope==="possible-subtype"),d=C("incomplete-migration",t.helperSymbol,t.helperFile,f.join("|"));o.findings.push({id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:g,file:t.helperFile,symbol:t.helperSymbol,relatedFiles:f,message:`new helper ${t.helperShortName} (${t.helperFile}) is wired into ${t.migratedFiles.length} file(s), but ${t.leftovers.length} similar un-migrated site(s) remain: ${c}`,why:[`${t.helperShortName} is new in this diff and already referenced by ${t.migratedFiles.join(", ")}.`,`Helper shape: ${t.helperShape}; ${t.specificHelperCalleeCount}/${t.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${c}.`,`Migration scope hints: ${a}.`],remediation:u?`Migrate same-scope sites to ${t.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${t.helperShortName}, or confirm they are intentionally different.`,suppressionHint:`scip-query: ignore incomplete-migration ${d} -- <reason>`})}}function Ee(e,i,n,r,o){let s=L(e,{minTogether:n,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let t=new Set,c=B(e);for(let a of s){let f=i.has(a.fileA),g=i.has(a.fileB);if(f===g)continue;let u=f?a.fileA:a.fileB,d=f?a.fileB:a.fileA,l=f?a.changesA:a.changesB,p=l>0?a.together/l:0;if(p<r||F(d)||F(u)||!x(`${e.config.projectRoot}/${d}`))continue;let h=`${u}|${d}`;if(t.has(h))continue;t.add(h);let m=C("co-change-partner",u,d,String(a.together)),b=N(u,d),S=K({fileA:u,fileB:d,together:a.together,confidence:p,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,c(u,d)),A=[u,d].sort().join("|");o.findings.push({id:m,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${A}`,confidence:p,file:u,relatedFiles:[d],sourceAnalyzer:"co-change",rootCauseKey:A,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...S?{declaredCouplingSuggestion:S}:{},message:`${u} changed, but ${d} did not \u2014 they change together ${a.together}x (${Math.round(p*100)}% of the time)`,why:[`${u} is in this diff and ${d} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(p*100)}% of changes to the edited side.`,`History context: ${Le(a)}.`,`Subject context: ${Ne(a.subjectContext)}.`,...Ke(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:S?`Update ${d} alongside this change, declare the coupling "${S.name}", or confirm the coupling no longer holds.`:`Update ${d} alongside this change, or confirm the coupling no longer holds.`,suppressionHint:`scip-query: ignore co-change-partner ${m} -- <reason>`})}}function Le(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${Be(e.lastTogetherAt)}`}function Ne(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",n=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",r=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${n}; samples ${r}; external issue/PR labels ${e.externalIssueLabelStatus}`}function Ke(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function Be(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function Me(e,i,n,r,o){o.checksRun.push("doc-reference");let s=Oe(e,i,r);if(s.size!==0)for(let t of z(e,s)){if(n.has(t.doc))continue;let c=t.citedClaims.length>0?t.citedClaims:Pe(e,t.doc,t.cited),a=Ie(c),f=C("doc-reference",t.doc,t.cited.join("|"));o.findings.push({id:f,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:t.doc,relatedFiles:t.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:c,message:`${t.doc} cites ${t.cited.join(", ")} as ${_e(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${t.cited.join(", ")} changed in this diff.`,`${t.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(g=>`Citation kind evidence: ${g}`)],remediation:ze(a.citationKind,t.doc),suppressionHint:`scip-query: ignore doc-reference ${f} -- <reason>`})}}function Ie(e){let i=e.join(`
|
|
3
|
+
`).toLowerCase(),n=[],r=v(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(r.length>0)return n.push(`configuration/example terms near citation: ${r.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:n};let o=v(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return n.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:n};let s=v(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(n.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:n}):(n.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:n})}function Pe(e,i,n){let r;try{r=oe(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=n.flatMap(He),s=[];for(let t=0;t<r.length;t+=1){let c=r[t]??"";o.some(a=>c.includes(a))&&s.push(_(r,t))}return s}function He(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((n,r,o)=>n.length>0&&o.indexOf(n)===r)}function v(e,i){return i.filter(n=>e.includes(n))}function _e(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function ze(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function Oe(e,i,n){let r=qe(n),o=new Set;for(let s of i)Ue(e,s,r.get(s)??[])&&o.add(s);return o}function qe(e){let i=new Map;for(let n of e){let r=i.get(n.file)??[];r.push(n),i.set(n.file,r)}return i}function Ue(e,i,n){if(n.length===0)return!1;if(!Ve.test(i))return!0;let r=`${e.config.projectRoot}/${i}`;if(!x(r))return!0;let o=oe(r,"utf-8").split(/\r?\n/),s=We(o);for(let t of n)for(let c=t.startLine;c<=t.endLine;c+=1)if((o[c]??"").trim()!==""&&!s.has(c))return!0;return!1}var Ve=/\.(?:[cm]?[jt]sx?)$/i;function We(e){let i=new Set,n=!1;for(let r=0;r<e.length;r+=1){let o=e[r].trim();!n&&Ye(o)&&(n=!0),n&&(i.add(r),o.endsWith(";")&&(n=!1))}return i}function Ye(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}function Je(e,i,n){n.checksRun.push("unused-params");for(let r of ee(e,{files:i,limit:50})){let o=C("unused-params",r.symbol,r.file,r.unusedTrailing.join("|"));n.findings.push({id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:r.file,startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,message:`${r.shortName} (${r.file}) has trailing unused parameter(s): ${r.unusedTrailing.join(", ")}`,why:[`${r.shortName} is in a changed file.`,`The trailing parameter(s) ${r.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments.",suppressionHint:`scip-query: ignore unused-params ${o} -- <reason>`})}}function Ze(e,i,n,r){r.checksRun.push("new-dead");let o=new j(e);for(let s of i){if(n(s)||s.fanIn>0||o.fileKind(s.file)==="test"||w(e,s.file)||D(e,s.symbol,s.file)||Qe(s.symbol))continue;let t=C("new-dead",s.symbol,s.file);r.findings.push({id:t,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code.",suppressionHint:`scip-query: ignore new-dead ${t} -- <reason>`})}}function Qe(e){if(G(e)!=="type")return!1;let i=$(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function Xe(e,i,n){let r=new Map(n.renamedFiles.map(s=>[s.to,s.from])),o=new Map;return s=>{let t=r.get(s.file);if(!t)return!1;let c=$(s.symbol);if(!c)return!1;let a=o.get(t);return a===void 0&&(a=H(e,i,t),o.set(t,a)),a!==null&&en(a,c)}}function en(e,i){return new RegExp(`\\b${nn(i)}\\b`).test(e)}function nn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tn(e,i){if(!x(k(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let n=ie(e);for(let r of n.newFindings){let o=rn(r),s=C("baseline",r);i.findings.push({id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${r}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation,suppressionHint:`scip-query: ignore baseline ${s} -- <reason>`})}}function rn(e){let[i,n]=R(e,":"),r=i||"unknown",o=(s={})=>{let t=s.actionTier??on(r);return{sourceAnalyzer:r,actionTier:t,rootCauseKey:s.rootCauseKey??(n||e),label:s.label??`${r} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??sn(t,r),file:s.file}};if(!n)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(r)){let[s,t]=R(n,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:t?`${s}:${t}`:n,label:`${r} finding`,why:t?[`Baseline subject: ${t}.`]:[]})}if(r==="cycle"){let s=n.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:n,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(r==="similar"){let s=n.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:n,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(r==="drift"){let[s,t]=R(n,":"),[c,a]=R(t,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,a].filter(Boolean))],rootCauseKey:n,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function on(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function sn(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function R(e,i){let n=e.indexOf(i);return n<0?[e,""]:[e.slice(0,n),e.slice(n+i.length)]}function C(e,...i){return`SQ${ye("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{ne as a,$n as b,ie as c,Bn as d,Mn as e};
|
|
4
|
+
//# sourceMappingURL=chunk-5B53WB6E.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-3ZYF3ELZ.js";import{a as l}from"./chunk-MZ7APUFN.js";import{d as o,f as a}from"./chunk-JM72FNGA.js";import{basename as d}from"path";function M(t,c){let n=l(t,c);if(!n)return[];let r=o(n.symbol),s=new m(t).definitionsForFile(n.relativePath).filter(e=>a(e.symbol)),i=s.filter(e=>e.parentTypeName===r||e.symbol.includes(r));return(i.length>0?i:p(d(n.relativePath))===r?s.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:o(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5FOPAXWY.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as d}from"./chunk-
|
|
1
|
+
import{o as d}from"./chunk-HVTYSC26.js";import{a as h}from"./chunk-MZ7APUFN.js";import{g}from"./chunk-JM72FNGA.js";import{a as m}from"./chunk-D322LMSA.js";import{a as p}from"./chunk-64MNV6AB.js";function _(t,r,n={}){let e=h(t,r);if(!e)return[];let l=!g(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],c=d(t,e,{semantic:n.semantic}).map(o=>({relativePath:o.file,line:o.line})),s=R(t,e),f=new Set,a=[];for(let o of[...l,...c,...s]){let u=`${o.relativePath}:${o.line}`;f.has(u)||(f.add(u),a.push(o))}return a}function R(t,r){if(!r.relativePath.endsWith(".rb"))return[];let n=b(r.symbol);if(n.length===0)return[];let e=[];for(let i of p(t,{extensions:[".rb"],includeIgnored:!1})){let l=m(t,i);if(!l)continue;let c=l.split(`
|
|
2
2
|
`);for(let s=0;s<c.length;s++){let f=c[s]??"";n.some(a=>new RegExp(`@${a}\\b|\\b${a}:`).test(f))&&e.push({relativePath:i,line:s})}}return e}function b(t){let n=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),e=n.split("_").filter(Boolean),i=new Set;return n&&i.add(n),e.length>=1&&i.add(e[e.length-1]),e.length>=2&&i.add(e.slice(-2).join("_")),[...i]}export{_ as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-5M4TYWVI.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
1
|
+
import{a as t}from"./chunk-CTCAF3YA.js";function l(e,n,i){let d=t(e,n)??n,o=t(e,i)??i,r=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
WHERE (
|
|
4
4
|
-- Defined in file1, referenced in file2
|
|
@@ -30,7 +30,7 @@ import{a as t}from"./chunk-ZOT3WUZW.js";function r(e,n,o){let d=t(e,n)??n,s=t(e,
|
|
|
30
30
|
JOIN documents d ON c.document_id = d.id
|
|
31
31
|
WHERE m.symbol_id = gs.id AND m.role != 1 AND d.relative_path = ?
|
|
32
32
|
)
|
|
33
|
-
)`,d,
|
|
33
|
+
)`,d,o,o,d);return{...c(d,o,r?.shared??0)}}function _(e,n={}){let{limit:i=20,scope:d}=n,o=d?`AND d1.relative_path LIKE '%${d}%' AND d2.relative_path LIKE '%${d}%'`:"";return e.all(`SELECT
|
|
34
34
|
def_d.relative_path AS file1,
|
|
35
35
|
ref_d.relative_path AS file2,
|
|
36
36
|
COUNT(DISTINCT gs.id) AS shared
|
|
@@ -49,8 +49,8 @@ import{a as t}from"./chunk-ZOT3WUZW.js";function r(e,n,o){let d=t(e,n)??n,s=t(e,
|
|
|
49
49
|
WHERE m.role != 1
|
|
50
50
|
AND def_d.id != ref_d.id
|
|
51
51
|
${e.pathExclusionsFor("def_d","ref_d")}
|
|
52
|
-
${
|
|
52
|
+
${o}
|
|
53
53
|
GROUP BY def_d.id, ref_d.id
|
|
54
54
|
ORDER BY shared DESC
|
|
55
|
-
LIMIT ?`,
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
LIMIT ?`,i).filter(s=>!e.isIgnored(s.file1)&&!e.isIgnored(s.file2)).map(s=>c(s.file1,s.file2,s.shared))}function c(e,n,i){return{file1:e,file2:n,sharedSymbols:i,actionTier:"signal",couplingKind:"shared-symbol-coupling",evidenceReasons:[`${i} symbol(s) are defined in one file and referenced by the other`],recommendation:"Review whether the shared symbol surface is an intentional boundary or hidden coordination pressure before moving code."}}export{l as a,_ as b};
|
|
56
|
+
//# sourceMappingURL=chunk-5QJXH6ZL.js.map
|
|
@@ -5,4 +5,4 @@ function c(n,e={}){let s=e.scope?"AND relative_path LIKE ?":"",o=e.like?"AND rel
|
|
|
5
5
|
${s}
|
|
6
6
|
${o}
|
|
7
7
|
ORDER BY relative_path`,...r).map(t=>t.relative_path),a=e.extensions?i.filter(t=>e.extensions.some(l=>t.toLowerCase().endsWith(l.toLowerCase()))):i;return e.includeIgnored===!1?a.filter(t=>!n.isIgnored(t)):a}export{c as a};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-64MNV6AB.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as d}from"./chunk-PVZMPG5I.js";import{c as a}from"./chunk-3UVJJ6Z7.js";import{a as c}from"./chunk-AUVBR62P.js";function F(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:f}=e,r=e.minDeps??(f?1:3),{profiles:s,distinctiveDeps:p}=m(t,{scope:n,minDeps:r});return d({profiles:s,limit:l,filePattern:f,overrunFactor:5,compare:(i,u)=>D(i,u,o,p)})}function m(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:f,distinctiveDeps:r}=g(n),s=[];for(let[p,i]of n)i.size>=l&&s.push({file:p,deps:new Set([...i].filter(u=>!f.has(u)))});return{profiles:s,distinctiveDeps:r}}function g(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 s of r)n.set(s,(n.get(s)??0)+1);let f=Math.max(3,Math.ceil(l*.03));for(let[r,s]of n)s>=5&&s/l>.3?e.add(r):s<=f&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function D(t,e,o,l){let n=new Set;for(let i of t.deps)e.deps.has(i)&&n.add(i);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let f=0;for(let i of n)l.has(i)&&f++;if(f<2)return null;let r=a(t.deps,e.deps);if(r<o)return null;let s=[];for(let i of t.deps)e.deps.has(i)||s.push(i);let p=[];for(let i of e.deps)t.deps.has(i)||p.push(i);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:s,uniqueToB:p}}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-77YBOOYT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as g}from"./chunk-PFOCOG57.js";import{a as m}from"./chunk-3ZYF3ELZ.js";import{a as d}from"./chunk-BGBBVSH4.js";import{c as u}from"./chunk-JM72FNGA.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7KCSELEV.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-CTCAF3YA.js";import{c as u}from"./chunk-FUPDW5AC.js";import{a as p}from"./chunk-MZ7APUFN.js";import{b as a}from"./chunk-FOQHUKNZ.js";import{c as l,d as c,h as f}from"./chunk-JM72FNGA.js";import{a as d}from"./chunk-64MNV6AB.js";function J(e,s,t={}){return I(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function P(e,s){let t=N(e,s);return t.length>0?t:E(e,s)}function v(e,s,t={}){return I(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function N(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d ON c.document_id = d.id
|
|
@@ -32,4 +32,4 @@ import{a as g}from"./chunk-ZOT3WUZW.js";import{c as u}from"./chunk-ZF6P2NAT.js";
|
|
|
32
32
|
WHERE imp_d.relative_path = ?
|
|
33
33
|
AND m.role = 2
|
|
34
34
|
ORDER BY def_d.relative_path, gs.symbol`,s).filter(m=>!e.isIgnored(m.importer));if(o.length>0){let m=t.semantic===!1?[]:u(e,s);return o.map(i=>({symbol:i.symbol,shortName:l(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||m.some(n=>n.isUsed&&n.sourcePath===i.from_file)}))}return null}function F(e,s){let t=u(e,s);return t.length>0?t.map(r=>{let o=h(r.importedName,r.localName,r.kind);return{symbol:o,shortName:o,fromFile:r.sourcePath??"(external)",importer:s,used:r.kind==="side-effect"?!0:r.isUsed}}):null}function O(e,s){return a(e,s).map(t=>{let r=h(t.importedName,t.localName,t.kind),o=t.kind==="side-effect"?!0:t.used;return{symbol:r,shortName:r,fromFile:t.sourcePath??"(external)",importer:s,used:o}})}function h(e,s,t){return t==="namespace"&&e==="*"&&s?`* as ${s}`:t==="default"&&s?`default as ${s}`:t==="side-effect"?"(side effect import)":s&&s!==e?`${e} as ${s}`:e}function b(e){return e.replace(/\\/g,"/")}function R(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{J as a,P as b,v as c};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-7OHWPJ5N.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var b=[];function p(t){t.groups.length>0&&b.push(t)}function D(t,c){let a=new Set(c.groups);for(let n of b)n.groups.some(r=>a.has(r))&&(c.file!==void 0&&n.clearFile?n.clearFile(t,c.file):n.clearAll(t))}function g(){let t=new WeakMap;return{cache:t,ensure(c){let a=t.get(c);return a||(a=new Map,t.set(c,a)),a}}}function f(t,c){let{cache:a,ensure:n}=g(),r={get(e,i,o){let s=n(e);if(s.has(i))return s.get(i);let l=o();return s.set(i,l),l},invalidate(e,i){a.get(e)?.delete(i)},invalidateAll(e){a.delete(e)},size(e){return a.get(e)?.size??0}};return p({name:t,groups:c.clearGroups,clearAll:e=>r.invalidateAll(e),clearFile:(e,i)=>r.invalidate(e,i)}),r}function S(t,c){let a=new WeakMap,n={get(r,e){let i=a.get(r);if(i)return i.value;let o=e();return a.set(r,{value:o}),o},invalidate(r){a.delete(r)},has(r){return a.has(r)}};return p({name:t,groups:c.clearGroups,clearAll:r=>n.invalidate(r)}),n}var h={clearGroups:["whole-project","source-file"]};function P(t){return C(t,h)}function C(t,c){let{cache:a,ensure:n}=g(),r={get(e,i,o,s){let l=n(e),u=l.get(i);if(u&&u.source===o)return u.value;let d=s();return l.set(i,{source:o,value:d}),d},invalidate(e,i){a.get(e)?.delete(i)},invalidateAll(e){a.delete(e)}};return p({name:t,groups:c.clearGroups,clearAll:e=>r.invalidateAll(e),clearFile:(e,i)=>r.invalidate(e,i)}),r}export{p as a,D as b,f as c,S as d,P as e,C as f};
|
|
2
|
+
//# sourceMappingURL=chunk-7S5E7KWT.js.map
|