scip-query 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Language-agnostic code intelligence CLI powered by [SCIP](https://github.com/sourcegraph/scip) indexes. Index any codebase, then query it for references, dependencies, dead code, similarity, coupling, and more — without an IDE or language server running.
|
|
4
4
|
|
|
5
|
-
Works with every language that has a SCIP indexer: TypeScript, JavaScript, Java, Scala, Kotlin, Rust, Python, Ruby, Go, C/C++, C#, Dart, PHP.
|
|
5
|
+
Works with every language that has a SCIP indexer: TypeScript, JavaScript, Vue, Java, Scala, Kotlin, Rust, Python, Ruby, Go, C/C++, C#, Visual Basic, Dart, PHP.
|
|
6
6
|
|
|
7
7
|
## Workflows
|
|
8
8
|
|
|
@@ -43,7 +43,7 @@ scip-query diff-impact # what did my changes affect?
|
|
|
43
43
|
|
|
44
44
|
| Language | Indexer | Install |
|
|
45
45
|
|---|---|---|
|
|
46
|
-
| TypeScript / JavaScript | scip-typescript | `npm install -g @sourcegraph/scip-typescript` |
|
|
46
|
+
| TypeScript / JavaScript / Vue | scip-typescript | `npm install -g @sourcegraph/scip-typescript` |
|
|
47
47
|
| Java / Scala / Kotlin | scip-java | [releases](https://github.com/sourcegraph/scip-java/releases) |
|
|
48
48
|
| Rust | rust-analyzer | Ships with rust-analyzer (`rust-analyzer scip`) |
|
|
49
49
|
| Python | scip-python-plus | `npm install -g scip-python-plus` |
|
|
@@ -54,7 +54,9 @@ scip-query diff-impact # what did my changes affect?
|
|
|
54
54
|
| Dart | scip-dart | [releases](https://github.com/nicovince/scip-dart/releases) |
|
|
55
55
|
| PHP | scip-php | [releases](https://github.com/nicovince/scip-php/releases) |
|
|
56
56
|
|
|
57
|
-
For Python, the npm package is `scip-python-plus`. Depending on which version you installed, the executable on your `PATH` may be `scip-python`, `scip-python-plus`, or both. `scip-query`
|
|
57
|
+
For Python, the npm package is `scip-python-plus`. Depending on which version you installed, the executable on your `PATH` may be `scip-python`, `scip-python-plus`, or both. `scip-query` accepts either name.
|
|
58
|
+
|
|
59
|
+
Vue single-file components (`.vue`) are handled by the JavaScript/TypeScript indexer. `scip-query` extracts the `<script>` block (or `<script setup>`, picking the language from the `lang=` attribute) and parses it as TS/JS so symbol, reference, and import queries cover Vue components alongside regular `.ts`/`.js` files.
|
|
58
60
|
|
|
59
61
|
## How It Works
|
|
60
62
|
|
|
@@ -466,6 +468,8 @@ scip-query dead src/utils --skip-barrels --include-members
|
|
|
466
468
|
- `--include-tests` — Include test files in results (excluded by default)
|
|
467
469
|
- `--skip-barrels` — Ignore references from inactive barrel re-export files
|
|
468
470
|
- `--include-members` — Include class members (module-level only by default)
|
|
471
|
+
- `--only-dead` — Show only `[dead code]` symbols (skip `[file-internal only]`)
|
|
472
|
+
- `--only-internal` — Show only `[file-internal only]` symbols (skip `[dead code]`)
|
|
469
473
|
|
|
470
474
|
**Value:** Find code you can delete. The `--skip-barrels` flag is key when a codebase has unused barrels, but it now keeps live entry-surface barrels counted so active exports do not look dead.
|
|
471
475
|
|
|
@@ -695,7 +699,7 @@ These commands find duplication, redundancy, and extraction opportunities — th
|
|
|
695
699
|
|
|
696
700
|
#### `similar [symbol]`
|
|
697
701
|
|
|
698
|
-
Find functions with similar callee fingerprints using
|
|
702
|
+
Find functions with similar callee fingerprints using TF-IDF weighted cosine similarity. Each callee is weighted by how rare it is across the codebase — two functions sharing a niche helper (`sendWelcomeEmail()`) score much higher than two functions sharing infrastructure callees (`db.all()`, `shortenSymbol()`). The "shared" list shown for each pair is the high-IDF (significant) intersection, not every shared callee.
|
|
699
703
|
|
|
700
704
|
Without a symbol argument, finds the top N most similar pairs across the codebase. With a symbol, finds what's most similar to that specific function.
|
|
701
705
|
|
|
@@ -716,10 +720,11 @@ scip-query similar dead --min-similarity 0.3
|
|
|
716
720
|
```
|
|
717
721
|
|
|
718
722
|
**Options:**
|
|
719
|
-
- `--min-similarity <n>` — Minimum
|
|
723
|
+
- `--min-similarity <n>` — Minimum cosine similarity 0-1 (default: 0.4)
|
|
720
724
|
- `-n, --limit <n>` — Number of results (default: 20)
|
|
721
725
|
- `-s, --scope <path>` — Limit to files matching path
|
|
722
726
|
- `--min-callees <n>` — Minimum callees to consider a symbol (default: 4)
|
|
727
|
+
- `--cross-file-only` — Only show cross-file pairs (skip same-file matches)
|
|
723
728
|
|
|
724
729
|
**Value:** Finds "these two functions do basically the same thing" at scale. The shared callee list shows exactly what's duplicated. The unique callees show where they diverge — that's the parameterization point for a consolidated version.
|
|
725
730
|
|
|
@@ -743,7 +748,7 @@ scip-query similar-files auth.controller.ts
|
|
|
743
748
|
- `--min-similarity <n>` — Minimum Jaccard similarity 0-1 (default: 0.5)
|
|
744
749
|
- `-n, --limit <n>` — Number of results (default: 20)
|
|
745
750
|
- `-s, --scope <path>` — Limit to files matching path
|
|
746
|
-
- `--min-deps <n>` — Minimum dependencies
|
|
751
|
+
- `--min-deps <n>` — Minimum dependencies on the smaller side (auto-tunes by default; pass to override)
|
|
747
752
|
|
|
748
753
|
**Value:** Finds copy-paste file variants and structurally redundant modules. When two files have 90%+ dependency overlap, they're likely doing similar jobs and should share code or be merged.
|
|
749
754
|
|
|
@@ -928,6 +933,7 @@ scip-query stale-abstractions --min-loc 5
|
|
|
928
933
|
- `-s, --scope <path>` — Limit to files matching path
|
|
929
934
|
- `--min-loc <n>` — Minimum LOC (default: 3)
|
|
930
935
|
- `-n, --limit <n>` — Number of results (default: 30)
|
|
936
|
+
- `--include-low-confidence` — Include 1-consumer classes (usually encapsulation, not stale)
|
|
931
937
|
|
|
932
938
|
**Value:** An interface with one implementation isn't an abstraction — it's indirection. Finds over-engineering.
|
|
933
939
|
|
|
@@ -1076,6 +1082,7 @@ scip-query slice login --forward # forward: what this feeds into
|
|
|
1076
1082
|
|
|
1077
1083
|
**Options:**
|
|
1078
1084
|
- `--forward` — Forward slice instead of backward (default: backward)
|
|
1085
|
+
- `--depth <n>` — Max transitive depth for backward slice (default: 3)
|
|
1079
1086
|
|
|
1080
1087
|
**Value:** Backward slice shows inputs/dependencies. Forward slice shows outputs/effects. Useful for tracing data flow through error handling and concurrency paths.
|
|
1081
1088
|
|
|
@@ -1124,7 +1131,7 @@ scip-query similar-signatures --min-loc 5
|
|
|
1124
1131
|
|
|
1125
1132
|
## Programmatic API
|
|
1126
1133
|
|
|
1127
|
-
|
|
1134
|
+
Every CLI command is also a TypeScript function. The `queries` namespace exports cover all of them — including the `top*` variants of `fan-in`, `fan-out`, and `coupling`, plus `similarAll` for the cross-codebase mode of `similar`:
|
|
1128
1135
|
|
|
1129
1136
|
```typescript
|
|
1130
1137
|
import {
|
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ This skill deliberately excludes `Grep` and `Read` from its allowed tools. This
|
|
|
67
67
|
- Using `Read` via a subagent to browse files for discovery. Subagents must also use scip-query.
|
|
68
68
|
- Spawning Explore agents that fall back to grep and file reads. If a subagent's output does not cite scip-query commands, reject its findings and re-run.
|
|
69
69
|
|
|
70
|
-
**Instead, use scip-query (
|
|
70
|
+
**Instead, use scip-query (full reference at `/Users/aydansalois/Documents/GitHub/scip-query/README.md`):**
|
|
71
71
|
|
|
72
72
|
| You want to... | Use this |
|
|
73
73
|
|---|---|
|
|
@@ -107,7 +107,7 @@ If none of these can answer your question, say so explicitly in the plan rather
|
|
|
107
107
|
|
|
108
108
|
### Full Documentation
|
|
109
109
|
|
|
110
|
-
- **
|
|
110
|
+
- **Every command with options and examples:** `/Users/aydansalois/Documents/GitHub/scip-query/README.md`
|
|
111
111
|
- **Goal-oriented agent workflows:** `/Users/aydansalois/Documents/GitHub/scip-query/docs/AGENT_GUIDE.md`
|
|
112
112
|
|
|
113
113
|
---
|
|
@@ -255,7 +255,7 @@ When spawning any subagent for this planning process, **include the following bl
|
|
|
255
255
|
|
|
256
256
|
You have the `scip-query` CLI for compiler-resolved code intelligence. Use it for ALL code references — do not use grep, rg, Read, or cat.
|
|
257
257
|
|
|
258
|
-
### scip-query commands
|
|
258
|
+
### scip-query commands
|
|
259
259
|
|
|
260
260
|
Navigation:
|
|
261
261
|
- `scip-query code <symbol>` — read source code (bounded to definition range)
|
|
@@ -73,7 +73,7 @@ scip-query code 'src/modules/chat/chat.service.ts:100-200'
|
|
|
73
73
|
|
|
74
74
|
---
|
|
75
75
|
|
|
76
|
-
## The
|
|
76
|
+
## The 12 Angles of Bloat
|
|
77
77
|
|
|
78
78
|
Run every one of these. Each catches a different class of problem. Skip none.
|
|
79
79
|
|
|
@@ -108,7 +108,7 @@ Stricter than dead code — these symbols reference nothing AND are referenced b
|
|
|
108
108
|
scip-query similar --min-similarity 0.5 --min-callees 3
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
Functions that call the same set of symbols.
|
|
111
|
+
Functions that call the same set of symbols. Uses TF-IDF weighted cosine similarity over the callee set, so rare shared callees score higher than ubiquitous infrastructure ones — a high score means the pair shares meaningful work, not just the same `db` and `logger`.
|
|
112
112
|
|
|
113
113
|
For each high-similarity pair, get the consolidation prescription:
|
|
114
114
|
|
|
@@ -263,7 +263,6 @@ scip-query deep-chains --min-depth 5 # Excessively deep dependency chains
|
|
|
263
263
|
scip-query bottlenecks -n 10 # Coupling pressure points
|
|
264
264
|
scip-query complexity-hotspots -n 10 # Riskiest symbols
|
|
265
265
|
scip-query hotspots -n 10 # Most-referenced symbols
|
|
266
|
-
scip-query doc-coverage --min-loc 5 # Documentation coverage
|
|
267
266
|
```
|
|
268
267
|
|
|
269
268
|
---
|
|
@@ -281,7 +280,7 @@ Read the health score, the findings breakdown, and the prioritized action list.
|
|
|
281
280
|
|
|
282
281
|
### Phase 2: Deep Scan (10-15 minutes)
|
|
283
282
|
|
|
284
|
-
Run all
|
|
283
|
+
Run all 12 angles plus the structural assessment. For each:
|
|
285
284
|
1. Run the command
|
|
286
285
|
2. Record the count and top findings
|
|
287
286
|
3. For actionable findings, drill deeper (e.g., `convergence` for similar pairs)
|
|
@@ -349,7 +348,6 @@ The report is a markdown file with:
|
|
|
349
348
|
- Max dependency chain depth: N
|
|
350
349
|
- Coupling bottlenecks: [top 5]
|
|
351
350
|
- Complexity hotspots: [top 5]
|
|
352
|
-
- Doc coverage: N%
|
|
353
351
|
```
|
|
354
352
|
|
|
355
353
|
Every finding includes the scip-query command that produced it.
|
|
@@ -402,7 +400,6 @@ Do NOT use grep, rg, or Read. Use only scip-query commands.
|
|
|
402
400
|
| Coupling pressure | `scip-query bottlenecks -n 10` |
|
|
403
401
|
| Complexity hotspots | `scip-query complexity-hotspots -n 10` |
|
|
404
402
|
| Most-referenced | `scip-query hotspots -n 10` |
|
|
405
|
-
| Doc coverage | `scip-query doc-coverage` |
|
|
406
403
|
| Redundant re-exports | `scip-query redundant-reexports` |
|
|
407
404
|
| Similar signatures | `scip-query similar-signatures --min-loc 5` |
|
|
408
405
|
| Read source | `scip-query code <symbol>` |
|
|
@@ -62,6 +62,8 @@ scip-query redundant-reexports
|
|
|
62
62
|
|
|
63
63
|
Why this row is strong: TypeScript has the broadest verified command surface in the current suite, especially for imports, members, call flow, change risk, and DRY analysis.
|
|
64
64
|
|
|
65
|
+
Vue note: `.vue` single-file components are handled by the same path. scip-query extracts the `<script>` (or `<script setup>`) block and parses it as TS/JS, so the TypeScript commands above also work on the Vue file's `<script>` symbols. Identifiers used only in `<template>`/`<style>` are tracked through a separate identifier scan so they don't show up as unused imports.
|
|
66
|
+
|
|
65
67
|
### Python
|
|
66
68
|
|
|
67
69
|
Use first:
|