scip-query 0.7.1 → 0.7.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 +88 -1007
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-2QNKEJ7R.js +2 -0
- package/dist/{chunk-JTXKS5GK.js → chunk-3X43EYFU.js} +2 -2
- package/dist/{chunk-JB4PUN5S.js → chunk-4GPWGSOE.js} +2 -2
- package/dist/{chunk-WODJHE6Z.js → chunk-4LKJMRT5.js} +2 -2
- package/dist/{chunk-2IYEIFPP.js → chunk-4T35WUCX.js} +2 -2
- package/dist/chunk-4VYIZV3S.js +62 -0
- package/dist/{chunk-7O4MJYIW.js → chunk-5RGK4YA5.js} +2 -2
- package/dist/{chunk-KJ3ZJIE5.js → chunk-5TB4N27G.js} +2 -2
- package/dist/{chunk-ROOHENEP.js → chunk-6QC7SCKV.js} +2 -2
- package/dist/{chunk-6H2XIIPY.js → chunk-6QH2L26C.js} +6 -6
- package/dist/{chunk-MDAYGS6T.js → chunk-6SR4UNWI.js} +2 -2
- package/dist/chunk-6XEWA6FX.js +2 -0
- package/dist/{chunk-3GNFUVFA.js → chunk-7WHNTKSD.js} +2 -2
- package/dist/{chunk-XO6R3X5J.js → chunk-D62LLANH.js} +2 -2
- package/dist/{chunk-OHEIZWIA.js → chunk-EDXML2HI.js} +2 -2
- package/dist/{chunk-23YIGCYF.js → chunk-EIGCLVKK.js} +5 -5
- package/dist/{chunk-ZNUPGRPR.js → chunk-EVXQF7DM.js} +2 -2
- package/dist/chunk-EZQOVY3C.js +2 -0
- package/dist/{chunk-563HLCDW.js → chunk-FU5WRWAN.js} +2 -2
- package/dist/{chunk-4STLJYHI.js → chunk-GIRI7FHW.js} +2 -2
- package/dist/{chunk-A2AVLALL.js → chunk-HTVLH3NL.js} +2 -2
- package/dist/{chunk-J6Z5YKGQ.js → chunk-IFGEPTH5.js} +2 -2
- package/dist/chunk-JDFWJ7VK.js +2 -0
- package/dist/{chunk-33SSUPCB.js → chunk-LLL7THVV.js} +2 -2
- package/dist/{chunk-72JOIFXL.js → chunk-LXJTDFOV.js} +2 -2
- package/dist/chunk-NBUINPSH.js +2 -0
- package/dist/{chunk-NSTZMBAB.js → chunk-OPWOX7NT.js} +2 -2
- package/dist/{chunk-TRNAQABL.js → chunk-OPZQIJZU.js} +2 -2
- package/dist/chunk-P3PVY6TX.js +2 -0
- package/dist/{chunk-3OUC276S.js → chunk-P7UMQ7R7.js} +2 -2
- package/dist/{chunk-VUBQBW7H.js → chunk-PEU24CSY.js} +2 -2
- package/dist/{chunk-GAQGJ52J.js → chunk-QBXTQODK.js} +2 -2
- package/dist/{chunk-LDV2B7ET.js → chunk-QP6FLI6D.js} +2 -2
- package/dist/{chunk-NYEMZHUC.js → chunk-QVPYMZUJ.js} +2 -2
- package/dist/{chunk-2JEFS2YJ.js → chunk-RFCR2BRD.js} +2 -2
- package/dist/chunk-S5VMVNFM.js +2 -0
- package/dist/{chunk-DFK54IRN.js → chunk-SDPP5KVQ.js} +2 -2
- package/dist/{chunk-ZXFTC5ET.js → chunk-SVSLAUSJ.js} +2 -2
- package/dist/{chunk-WPLKHAH7.js → chunk-TB2OYNRS.js} +2 -2
- package/dist/chunk-TGNL3ZKZ.js +2 -0
- package/dist/{chunk-7H4RJ4MC.js → chunk-UHMJYNTK.js} +2 -2
- package/dist/{chunk-QPRIYXH4.js → chunk-VMS5YTBS.js} +2 -2
- package/dist/{chunk-FD37DBTD.js → chunk-WJQFABZN.js} +2 -2
- package/dist/{chunk-KNA6Z7JB.js → chunk-X2JB54QF.js} +2 -2
- package/dist/{chunk-QWJBIBE6.js → chunk-XANDY7N5.js} +2 -2
- package/dist/{chunk-WJQY2LGT.js → chunk-XDXZP3BE.js} +2 -2
- package/dist/{chunk-ARBZM2NF.js → chunk-YH6TTQEI.js} +2 -2
- package/dist/cli.js +122 -123
- package/dist/index.d.ts +21 -28
- package/dist/index.js +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/dist/reindex.js +16 -16
- package/package.json +2 -1
- package/dist/chunk-7OX2O53H.js +0 -62
- package/dist/chunk-CKIO6SVS.js +0 -2
- package/dist/chunk-D6Z67MZL.js +0 -2
- package/dist/chunk-FOQQDXE7.js +0 -2
- package/dist/chunk-QAEDNTY7.js +0 -2
- package/dist/chunk-TGK5DFBJ.js +0 -2
- package/dist/chunk-V53J46BX.js +0 -2
- package/dist/chunk-YSZNAG4G.js +0 -2
package/README.md
CHANGED
|
@@ -165,1027 +165,108 @@ All query results are filtered through your project's `.gitignore`. Build artifa
|
|
|
165
165
|
|
|
166
166
|
## Command Reference
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
<!-- BEGIN GENERATED COMMAND REFERENCE -->
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
This syntax summary is generated from the CLI command descriptors. Keep workflow guidance hand-authored, but keep command syntax, descriptions, and option flags descriptor-owned.
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
### Indexing
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
**Options:**
|
|
181
|
-
- `-l, --language <lang>` — Index only this language (can repeat)
|
|
182
|
-
- `--pnpm-workspaces` — Enable pnpm workspace support (TypeScript)
|
|
183
|
-
|
|
184
|
-
**When to use:** After significant code changes, after pulling, or before running analysis commands for the first time.
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
#### `watch`
|
|
189
|
-
|
|
190
|
-
Watch the project for file changes and automatically reindex in the background. Uses a single-flight model: only one reindex runs at a time, changes during reindex set a dirty flag for one follow-up run.
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
scip-query watch
|
|
194
|
-
scip-query watch --debounce 60000 # wait 60s after last change
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
**Options:**
|
|
198
|
-
- `--debounce <ms>` — Milliseconds to wait after the last file change before reindexing (default: 30000)
|
|
199
|
-
- `--cooldown <ms>` — Minimum milliseconds between reindex completions (default: 60000)
|
|
200
|
-
|
|
201
|
-
**How it works:** Watches for file changes (respecting `.gitignore`), debounces, runs reindex in a child process writing to a temp file, then atomically swaps the database. Queries against the old index continue working during reindex — no downtime.
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
#### `status`
|
|
206
|
-
|
|
207
|
-
Show the current index status: where it's stored, how big it is, when it was built.
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
scip-query status
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
#### `stats`
|
|
216
|
-
|
|
217
|
-
Show index statistics: document count, symbol count, definition count, reference count, database size.
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
scip-query stats
|
|
221
|
-
# Documents: 42
|
|
222
|
-
# Symbols: 1111
|
|
223
|
-
# Definitions: 803
|
|
224
|
-
# References: 2094
|
|
225
|
-
# Index size: 660 KB
|
|
226
|
-
# Last built: 2026-04-10 16:12:58
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
**Value:** Quick sanity check that your index is healthy and up to date.
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
#### `init`
|
|
234
|
-
|
|
235
|
-
Create a `.scipquery.json` config file in the project root with auto-detected languages and default settings.
|
|
174
|
+
| Command | Description | Options |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `reindex` | Index the codebase and convert to SQLite | `-l, --language <lang>`<br>`--pnpm-workspaces`<br>`--force`<br>`--allow-partial`<br>`--indexer-concurrency <n>` |
|
|
177
|
+
| `augment-sources` | Add source files skipped by upstream SCIP indexers to the SQLite documents table | - |
|
|
178
|
+
| `augment-vue` | Add compiler-resolved Vue SFC references to the SQLite index using Volar | `--project <tsconfig>` |
|
|
236
179
|
|
|
237
|
-
|
|
238
|
-
scip-query init
|
|
239
|
-
```
|
|
180
|
+
### Core
|
|
240
181
|
|
|
241
|
-
|
|
182
|
+
| Command | Description | Options |
|
|
183
|
+
|---|---|---|
|
|
184
|
+
| `stats` | Show index statistics | - |
|
|
242
185
|
|
|
243
186
|
### Navigation
|
|
244
187
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
Show a symbol's definition (with signature) and every file that references it. Like `refs` but also shows you where the symbol is defined.
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
scip-query trace parseSymbol
|
|
311
|
-
# ═══ DEFINITION ═══
|
|
312
|
-
# src/symbols/symbol-parser.ts:35-99 — parseSymbol(raw: string): ScipSymbol | ScipLocalSymbol
|
|
313
|
-
#
|
|
314
|
-
# ═══ REFERENCED BY ═══
|
|
315
|
-
# src/index.ts
|
|
316
|
-
# src/symbols/symbol-parser.ts
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
**Value:** End-to-end symbol investigation. Answers "where is this defined, what's its signature, and who uses it?" in one command.
|
|
320
|
-
|
|
321
|
-
---
|
|
322
|
-
|
|
323
|
-
#### `outline <file>`
|
|
324
|
-
|
|
325
|
-
Tree-structured view of all symbols in a file, using parent-child nesting when the indexer provides `enclosing_symbol` data.
|
|
326
|
-
|
|
327
|
-
```bash
|
|
328
|
-
scip-query outline db.ts
|
|
329
|
-
# 0-111 src:db
|
|
330
|
-
# 19-110 src:db:ScipDatabase
|
|
331
|
-
# 24-29 src:db:ScipDatabase:constructor()
|
|
332
|
-
# 32-34 src:db:ScipDatabase:setPathFilter()
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
**Value:** Visual file structure at a glance — like an IDE's outline panel but in the terminal.
|
|
336
|
-
|
|
337
|
-
---
|
|
338
|
-
|
|
339
|
-
#### `hierarchy <symbol>`
|
|
340
|
-
|
|
341
|
-
Show a symbol's ancestry chain — from the symbol up through its enclosing scopes (method → class → module → file).
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
scip-query hierarchy login
|
|
345
|
-
# src:auth:AuthService:login()
|
|
346
|
-
# src:auth:AuthService
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
**Value:** Understand where a symbol lives in the nesting hierarchy. Requires the indexer to populate `enclosing_symbol`.
|
|
350
|
-
|
|
351
|
-
---
|
|
352
|
-
|
|
353
|
-
#### `members <symbol>`
|
|
354
|
-
|
|
355
|
-
Find all direct children of a symbol (methods, fields, nested types) using the enclosing_symbol relationship.
|
|
356
|
-
|
|
357
|
-
```bash
|
|
358
|
-
scip-query members AuthService
|
|
359
|
-
# 5-20 [method] login
|
|
360
|
-
# 22-35 [method] logout
|
|
361
|
-
# 37-37 [term] tokenSecret
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
**Value:** Like `methods` but includes fields, nested types, and anything else directly inside a symbol. Requires `enclosing_symbol` support from the indexer.
|
|
365
|
-
|
|
366
|
-
---
|
|
367
|
-
|
|
368
|
-
#### `call-graph <symbol>`
|
|
369
|
-
|
|
370
|
-
Show what calls a symbol (incoming) and what the symbol calls (outgoing).
|
|
371
|
-
|
|
372
|
-
```bash
|
|
373
|
-
scip-query call-graph shortenSymbol
|
|
374
|
-
# Symbol: src:symbol-parser:shortenSymbol()
|
|
375
|
-
#
|
|
376
|
-
# ═══ CALLERS (16) ═══
|
|
377
|
-
# src/queries/dead.ts src:queries:dead
|
|
378
|
-
# src/queries/hotspots.ts src:queries:hotspots
|
|
379
|
-
# ...
|
|
380
|
-
#
|
|
381
|
-
# ═══ CALLEES (0) ═══
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
**Value:** Understand a function's role in the call chain. High caller count = widely used, be careful changing it. Many callees = complex function, may need decomposition.
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
### Dependency Analysis
|
|
389
|
-
|
|
390
|
-
These commands map how files and modules depend on each other — forward deps, reverse deps, and full module maps.
|
|
391
|
-
|
|
392
|
-
#### `deps <file>`
|
|
393
|
-
|
|
394
|
-
List all internal files that this file depends on (forward dependencies).
|
|
395
|
-
|
|
396
|
-
```bash
|
|
397
|
-
scip-query deps cli.ts
|
|
398
|
-
# src/runtime/config.ts
|
|
399
|
-
# src/storage/db.ts
|
|
400
|
-
# src/queries/index.ts
|
|
401
|
-
# src/reindex/index.ts
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
**Value:** "What does this file need to work?" Useful before refactoring — tells you what you're coupled to.
|
|
405
|
-
|
|
406
|
-
---
|
|
407
|
-
|
|
408
|
-
#### `rdeps <file>`
|
|
409
|
-
|
|
410
|
-
List all files that depend on this file (reverse dependencies).
|
|
411
|
-
|
|
412
|
-
```bash
|
|
413
|
-
scip-query rdeps symbol-parser
|
|
414
|
-
# src/index.ts
|
|
415
|
-
# src/queries/dead.ts
|
|
416
|
-
# src/queries/hotspots.ts
|
|
417
|
-
# ...
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
**Value:** "Who breaks if I change this?" The blast radius of a modification. High rdeps count = be very careful with changes.
|
|
421
|
-
|
|
422
|
-
---
|
|
423
|
-
|
|
424
|
-
#### `system <module>`
|
|
425
|
-
|
|
426
|
-
Full module map: all files in the module, all exported symbols, all inbound and outbound dependencies.
|
|
427
|
-
|
|
428
|
-
```bash
|
|
429
|
-
scip-query system queries
|
|
430
|
-
# ═══ FILES ═══
|
|
431
|
-
# src/queries/dead.ts
|
|
432
|
-
# src/queries/deps.ts
|
|
433
|
-
# ...
|
|
434
|
-
#
|
|
435
|
-
# ═══ EXPORTED SYMBOLS ═══
|
|
436
|
-
# 8-124 dead()
|
|
437
|
-
# 4-23 deps()
|
|
438
|
-
# ...
|
|
439
|
-
#
|
|
440
|
-
# ═══ DEPENDS ON (internal) ═══
|
|
441
|
-
# src/storage/db.ts
|
|
442
|
-
# src/symbols/symbol-parser.ts
|
|
443
|
-
#
|
|
444
|
-
# ═══ DEPENDED ON BY ═══
|
|
445
|
-
# src/runtime/cli.ts
|
|
446
|
-
# src/index.ts
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
**Value:** Complete module overview in one command. Shows the module's interface, its internal structure, and its position in the dependency graph.
|
|
450
|
-
|
|
451
|
-
---
|
|
452
|
-
|
|
453
|
-
#### `surface <module>`
|
|
454
|
-
|
|
455
|
-
What symbols do external consumers actually use from this module? The true public API — not what's exported, but what's actually imported and referenced by other modules.
|
|
456
|
-
|
|
457
|
-
```bash
|
|
458
|
-
scip-query surface storage/db.ts
|
|
459
|
-
# src/runtime/cli.ts → ScipDatabase
|
|
460
|
-
# src/runtime/cli.ts → ScipDatabase:close()
|
|
461
|
-
# src/queries/dead.ts → ScipDatabase:all()
|
|
462
|
-
# src/queries/dead.ts → ScipDatabase:isIgnored()
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
**Value:** Distinguish "exported" from "actually used." If you export 20 symbols but only 5 are referenced externally, the other 15 are candidates for removal or making private.
|
|
466
|
-
|
|
467
|
-
---
|
|
468
|
-
|
|
469
|
-
#### `imports <file>`
|
|
470
|
-
|
|
471
|
-
What symbols does this file import? Uses SCIP `role=2` (import) mentions.
|
|
472
|
-
|
|
473
|
-
```bash
|
|
474
|
-
scip-query imports auth.controller.ts
|
|
475
|
-
# AuthService:login() ← src/services/auth.service.ts
|
|
476
|
-
# validateInput() ← src/utils/validation.ts
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
**Value:** Quick import inventory. Note: depends on the indexer emitting `role=2` — not all do (e.g., `scip-typescript` currently doesn't).
|
|
480
|
-
|
|
481
|
-
---
|
|
482
|
-
|
|
483
|
-
#### `imported-by <symbol>`
|
|
484
|
-
|
|
485
|
-
Which files import this symbol?
|
|
486
|
-
|
|
487
|
-
```bash
|
|
488
|
-
scip-query imported-by AuthService
|
|
489
|
-
# src/controllers/auth.controller.ts
|
|
490
|
-
# src/__tests__/auth.test.ts
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
---
|
|
494
|
-
|
|
495
|
-
#### `unused-imports <file>`
|
|
496
|
-
|
|
497
|
-
Find imports in a file that are never referenced in the same file — likely unused imports that should be cleaned up.
|
|
498
|
-
|
|
499
|
-
```bash
|
|
500
|
-
scip-query unused-imports auth.controller.ts
|
|
501
|
-
# formatDate in src/controllers/auth.controller.ts
|
|
502
|
-
# 1 unused import(s)
|
|
503
|
-
```
|
|
504
|
-
|
|
505
|
-
**Value:** Automated unused import detection. Note: same `role=2` limitation as `imports`.
|
|
506
|
-
|
|
507
|
-
---
|
|
508
|
-
|
|
509
|
-
### Code Quality & Dead Code
|
|
510
|
-
|
|
511
|
-
These commands find code that can be removed, consolidated, or cleaned up.
|
|
512
|
-
|
|
513
|
-
#### `dead [scope]`
|
|
514
|
-
|
|
515
|
-
Find dead exports: symbols defined locally with no cross-file references. Distinguishes between "dead code" (not referenced anywhere, even in the same file) and "dead exports" (used locally but never imported by other files).
|
|
516
|
-
|
|
517
|
-
```bash
|
|
518
|
-
scip-query dead --min-loc 10
|
|
519
|
-
scip-query dead src/utils --skip-barrels --include-members
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
**Options:**
|
|
523
|
-
- `--min-loc <n>` — Only show symbols >= N lines (default: 1)
|
|
524
|
-
- `--include-tests` — Include test files in results (excluded by default)
|
|
525
|
-
- `--skip-barrels` — Ignore references from inactive barrel re-export files
|
|
526
|
-
- `--include-members` — Include class members (module-level only by default)
|
|
527
|
-
- `--only-dead` — Show only `[dead code]` symbols (skip `[file-internal only]`)
|
|
528
|
-
- `--only-internal` — Show only `[file-internal only]` symbols (skip `[dead code]`)
|
|
529
|
-
|
|
530
|
-
**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.
|
|
531
|
-
|
|
532
|
-
---
|
|
533
|
-
|
|
534
|
-
#### `isolated`
|
|
535
|
-
|
|
536
|
-
Find completely orphaned symbols: defined locally, not referenced by anything (not even in the same file), and not referencing anything external. These are truly disconnected from the codebase graph.
|
|
537
|
-
|
|
538
|
-
```bash
|
|
539
|
-
scip-query isolated --min-loc 5
|
|
540
|
-
scip-query isolated --scope src/utils
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
**Options:**
|
|
544
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
545
|
-
- `--min-loc <n>` — Minimum lines of code (default: 3)
|
|
546
|
-
|
|
547
|
-
**Value:** Stricter than `dead` — these symbols serve no purpose at all. Safe deletion candidates.
|
|
548
|
-
|
|
549
|
-
---
|
|
550
|
-
|
|
551
|
-
### Codebase Metrics
|
|
552
|
-
|
|
553
|
-
These commands measure structural properties of the codebase — hotspots, coupling, bottlenecks, fan-in/out.
|
|
554
|
-
|
|
555
|
-
#### `hotspots`
|
|
556
|
-
|
|
557
|
-
Find the most-referenced symbols in the codebase. These are the choke points where changes have the widest blast radius.
|
|
558
|
-
|
|
559
|
-
```bash
|
|
560
|
-
scip-query hotspots -n 15
|
|
561
|
-
# refs files symbol
|
|
562
|
-
# ──── ───── ──────
|
|
563
|
-
# 39 39 src:types
|
|
564
|
-
# 33 31 src:db:ScipDatabase
|
|
565
|
-
# 27 27 src:db:ScipDatabase:all()
|
|
566
|
-
```
|
|
567
|
-
|
|
568
|
-
**Options:**
|
|
569
|
-
- `-n, --limit <n>` — Number of results (default: 30)
|
|
570
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
571
|
-
|
|
572
|
-
**Value:** Identify the symbols where a bug or breaking change would affect the most consumers. Hotspots deserve the most careful review and the most stable interfaces.
|
|
573
|
-
|
|
574
|
-
---
|
|
575
|
-
|
|
576
|
-
#### `fan-in [symbol]`
|
|
577
|
-
|
|
578
|
-
How many distinct files reference a symbol. Without an argument, shows the top N symbols by fan-in across the codebase.
|
|
579
|
-
|
|
580
|
-
```bash
|
|
581
|
-
scip-query fan-in ScipDatabase
|
|
582
|
-
# 19 files ScipDatabase
|
|
583
|
-
# 16 files ScipDatabase:all()
|
|
584
|
-
# 13 files ScipDatabase:isIgnored()
|
|
585
|
-
|
|
586
|
-
scip-query fan-in -n 10
|
|
587
|
-
# files symbol
|
|
588
|
-
# ───── ──────
|
|
589
|
-
# 31 ScipDatabase
|
|
590
|
-
# 27 ScipDatabase:all()
|
|
591
|
-
```
|
|
592
|
-
|
|
593
|
-
**Options:**
|
|
594
|
-
- `-n, --limit <n>` — Number of results for top mode (default: 30)
|
|
595
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
596
|
-
|
|
597
|
-
**Value:** High fan-in = widely depended upon. Changes to high fan-in symbols have large blast radius. These symbols should have stable interfaces and careful review.
|
|
598
|
-
|
|
599
|
-
---
|
|
600
|
-
|
|
601
|
-
#### `fan-out [file]`
|
|
602
|
-
|
|
603
|
-
How many external symbols a file references. Without an argument, shows the top N files by fan-out. High fan-out files are fragile — they depend on many things, so upstream changes are more likely to break them.
|
|
604
|
-
|
|
605
|
-
```bash
|
|
606
|
-
scip-query fan-out runtime/cli.ts
|
|
607
|
-
# 23 symbols src/runtime/cli.ts
|
|
608
|
-
|
|
609
|
-
scip-query fan-out -n 10
|
|
610
|
-
# symbols file
|
|
611
|
-
# ─────── ────
|
|
612
|
-
# 68 src/queries/index.ts
|
|
613
|
-
# 23 src/runtime/cli.ts
|
|
614
|
-
```
|
|
615
|
-
|
|
616
|
-
**Options:**
|
|
617
|
-
- `-n, --limit <n>` — Number of results for top mode (default: 30)
|
|
618
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
619
|
-
|
|
620
|
-
**Value:** Identify files that are tightly coupled to the rest of the codebase. High fan-out files are the first to break when dependencies change.
|
|
621
|
-
|
|
622
|
-
---
|
|
623
|
-
|
|
624
|
-
#### `bottlenecks`
|
|
625
|
-
|
|
626
|
-
Find coupling hubs: symbols with both high fan-in (many consumers) AND high fan-out (many dependencies). Score = fan-in × fan-out. These are the most dangerous symbols to change — they sit at the intersection of many dependency paths.
|
|
627
|
-
|
|
628
|
-
```bash
|
|
629
|
-
scip-query bottlenecks -n 10
|
|
630
|
-
# score fan-in fan-out symbol
|
|
631
|
-
# ───── ────── ─────── ──────
|
|
632
|
-
# 136 2 68 src:queries:index
|
|
633
|
-
# 124 31 4 src:storage:db:ScipDatabase
|
|
634
|
-
```
|
|
635
|
-
|
|
636
|
-
**Options:**
|
|
637
|
-
- `-n, --limit <n>` — Number of results (default: 20)
|
|
638
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
639
|
-
- `--min-fan-in <n>` — Minimum fan-in (default: 2)
|
|
640
|
-
- `--min-fan-out <n>` — Minimum fan-out (default: 2)
|
|
641
|
-
|
|
642
|
-
**Value:** These are the architectural pressure points. A symbol with fan-in=20 and fan-out=5 is both heavily depended upon and heavily dependent — changes to it are risky in both directions.
|
|
643
|
-
|
|
644
|
-
---
|
|
645
|
-
|
|
646
|
-
#### `coupling [file1] [file2]`
|
|
647
|
-
|
|
648
|
-
Measure coupling between two specific files (how many symbols they share), or find the most coupled file pairs across the codebase.
|
|
649
|
-
|
|
650
|
-
```bash
|
|
651
|
-
scip-query coupling storage/db.ts runtime/cli.ts
|
|
652
|
-
# storage/db.ts ↔ runtime/cli.ts: 4 shared symbols
|
|
653
|
-
|
|
654
|
-
scip-query coupling -n 10
|
|
655
|
-
# shared file1 → file2
|
|
656
|
-
# ────── ─────────────
|
|
657
|
-
# 5 src/storage/db.ts → src/queries/stats.ts
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
**Options:**
|
|
661
|
-
- `-n, --limit <n>` — Number of results for top mode (default: 20)
|
|
662
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
663
|
-
|
|
664
|
-
**Value:** Quantify how tightly two files are linked. High coupling between files that shouldn't be related is a design smell. Useful for identifying candidates for interface extraction.
|
|
665
|
-
|
|
666
|
-
---
|
|
667
|
-
|
|
668
|
-
#### `cycles`
|
|
669
|
-
|
|
670
|
-
Detect circular dependency chains between files. A cycle exists when file A depends on B, B on C, and C on A.
|
|
671
|
-
|
|
672
|
-
```bash
|
|
673
|
-
scip-query cycles
|
|
674
|
-
# No circular dependencies found.
|
|
675
|
-
|
|
676
|
-
scip-query cycles --scope src/services
|
|
677
|
-
# Cycle 1 (3 files):
|
|
678
|
-
# src/services/auth.ts →
|
|
679
|
-
# src/services/user.ts →
|
|
680
|
-
# src/services/auth.ts (cycle)
|
|
681
|
-
```
|
|
682
|
-
|
|
683
|
-
**Options:**
|
|
684
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
685
|
-
- `--max-depth <n>` — Maximum cycle depth (default: 10)
|
|
686
|
-
|
|
687
|
-
**Value:** Circular dependencies make code harder to test, harder to understand, and harder to refactor. This command finds them so you can break the cycles.
|
|
688
|
-
|
|
689
|
-
---
|
|
690
|
-
|
|
691
|
-
#### `deep-chains`
|
|
692
|
-
|
|
693
|
-
Find the longest transitive dependency chains in the codebase. A chain A → B → C → D means A depends on B, B on C, C on D.
|
|
694
|
-
|
|
695
|
-
```bash
|
|
696
|
-
scip-query deep-chains -n 5 --min-depth 4
|
|
697
|
-
# Chain 1 (depth 5):
|
|
698
|
-
# → src/runtime/cli.ts
|
|
699
|
-
# → src/queries/index.ts
|
|
700
|
-
# → src/queries/surface.ts
|
|
701
|
-
# → src/storage/db.ts
|
|
702
|
-
# → src/domain/types.ts
|
|
703
|
-
```
|
|
704
|
-
|
|
705
|
-
**Options:**
|
|
706
|
-
- `-n, --limit <n>` — Number of chains to show (default: 10)
|
|
707
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
708
|
-
- `--min-depth <n>` — Minimum chain depth (default: 3)
|
|
709
|
-
|
|
710
|
-
**Value:** Long dependency chains mean changes at the bottom ripple through many layers. If chains are excessively deep, it may indicate that the architecture needs flattening or that intermediate layers aren't adding value.
|
|
711
|
-
|
|
712
|
-
---
|
|
713
|
-
|
|
714
|
-
#### `by-kind <kind>`
|
|
715
|
-
|
|
716
|
-
Find symbols by their SCIP symbol kind (class, interface, enum, function, struct, method, etc.).
|
|
717
|
-
|
|
718
|
-
```bash
|
|
719
|
-
scip-query by-kind class
|
|
720
|
-
scip-query by-kind interface --scope src/types
|
|
721
|
-
scip-query by-kind 68 # kind number for Struct
|
|
722
|
-
```
|
|
723
|
-
|
|
724
|
-
**Options:**
|
|
725
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
726
|
-
- `-n, --limit <n>` — Number of results (default: 100)
|
|
727
|
-
|
|
728
|
-
**Value:** Structural inventory — "how many classes do we have?", "where are all the interfaces?", "list every enum." Requires the indexer to populate the `kind` field.
|
|
729
|
-
|
|
730
|
-
---
|
|
731
|
-
|
|
732
|
-
#### `kind-counts`
|
|
733
|
-
|
|
734
|
-
Show a histogram of symbol kinds in the codebase.
|
|
735
|
-
|
|
736
|
-
```bash
|
|
737
|
-
scip-query kind-counts
|
|
738
|
-
# count kind
|
|
739
|
-
# ───── ────
|
|
740
|
-
# 45 Class (9)
|
|
741
|
-
# 23 Interface (27)
|
|
742
|
-
# 12 Enum (16)
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
**Options:**
|
|
746
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
747
|
-
|
|
748
|
-
**Value:** Architectural overview — what types of symbols make up the codebase? Useful for understanding whether a codebase is class-heavy, function-heavy, interface-driven, etc.
|
|
749
|
-
|
|
750
|
-
---
|
|
751
|
-
|
|
752
|
-
### Similarity & Consolidation
|
|
753
|
-
|
|
754
|
-
These commands find duplication, redundancy, and extraction opportunities — the tools for de-bloating a codebase.
|
|
755
|
-
|
|
756
|
-
#### `similar [symbol]`
|
|
757
|
-
|
|
758
|
-
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.
|
|
759
|
-
|
|
760
|
-
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.
|
|
761
|
-
|
|
762
|
-
```bash
|
|
763
|
-
scip-query similar --min-similarity 0.5
|
|
764
|
-
# 80% similar:
|
|
765
|
-
# A: by-kind (src/queries/by-kind.ts)
|
|
766
|
-
# B: call-graph (src/queries/call-graph.ts)
|
|
767
|
-
# Shared: ScipDatabase, db.all(), db.get(), db.isIgnored(), shortenSymbol()
|
|
768
|
-
|
|
769
|
-
scip-query similar dead --min-similarity 0.3
|
|
770
|
-
# 64% similar:
|
|
771
|
-
# A: dead (src/queries/dead.ts)
|
|
772
|
-
# B: bottlenecks (src/queries/bottlenecks.ts)
|
|
773
|
-
# Shared callees: db, ScipDatabase, db.all(), db.isIgnored(), shortenSymbol()
|
|
774
|
-
# Only in A: DeadOptions, DeadSummary, DeadSymbolResult
|
|
775
|
-
# Only in B: BottleneckResult
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
**Options:**
|
|
779
|
-
- `--min-similarity <n>` — Minimum cosine similarity 0-1 (default: 0.4)
|
|
780
|
-
- `-n, --limit <n>` — Number of results (default: 20)
|
|
781
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
782
|
-
- `--min-callees <n>` — Minimum callees to consider a symbol (default: 4)
|
|
783
|
-
- `--cross-file-only` — Only show cross-file pairs (skip same-file matches)
|
|
784
|
-
|
|
785
|
-
**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.
|
|
786
|
-
|
|
787
|
-
---
|
|
788
|
-
|
|
789
|
-
#### `similar-files [file]`
|
|
790
|
-
|
|
791
|
-
Find files with similar dependency profiles using Jaccard similarity on their dependency sets. Files that import the same modules are structurally doing similar work.
|
|
792
|
-
|
|
793
|
-
```bash
|
|
794
|
-
scip-query similar-files --min-similarity 0.7
|
|
795
|
-
# 100% similar:
|
|
796
|
-
# src/queries/symbols.ts
|
|
797
|
-
# src/queries/system.ts
|
|
798
|
-
# Shared deps (4): db.ts, types.ts, symbol-parser.ts, clean-signature.ts
|
|
799
|
-
|
|
800
|
-
scip-query similar-files auth.controller.ts
|
|
801
|
-
```
|
|
802
|
-
|
|
803
|
-
**Options:**
|
|
804
|
-
- `--min-similarity <n>` — Minimum Jaccard similarity 0-1 (default: 0.5)
|
|
805
|
-
- `-n, --limit <n>` — Number of results (default: 20)
|
|
806
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
807
|
-
- `--min-deps <n>` — Minimum dependencies on the smaller side (auto-tunes by default; pass to override)
|
|
808
|
-
|
|
809
|
-
**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.
|
|
810
|
-
|
|
811
|
-
---
|
|
812
|
-
|
|
813
|
-
#### `similar-chains`
|
|
814
|
-
|
|
815
|
-
Find end-to-end dependency flows through the codebase that are structurally similar but diverge at a few points. Uses edit distance on the file-node sequences.
|
|
816
|
-
|
|
817
|
-
```bash
|
|
818
|
-
scip-query similar-chains --min-similarity 0.5
|
|
819
|
-
# ── Chain pair 1 (67% similar, 1 divergence point) ──
|
|
820
|
-
# Chain A: auth.controller.ts → auth.service.ts → user.repo.ts
|
|
821
|
-
# Chain B: org.controller.ts → org.service.ts → user.repo.ts
|
|
822
|
-
# Common suffix: user.repo.ts
|
|
823
|
-
# Divergence points (consolidation targets):
|
|
824
|
-
# [0] auth.controller.ts ↔ org.controller.ts
|
|
825
|
-
# [1] auth.service.ts ↔ org.service.ts
|
|
826
|
-
```
|
|
827
|
-
|
|
828
|
-
**Options:**
|
|
829
|
-
- `--min-similarity <n>` — Minimum chain similarity 0-1 (default: 0.5)
|
|
830
|
-
- `-n, --limit <n>` — Number of results (default: 15)
|
|
831
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
832
|
-
- `--min-length <n>` — Minimum chain length (default: 3)
|
|
833
|
-
- `--max-length <n>` — Maximum chain length (default: 8)
|
|
834
|
-
|
|
835
|
-
**Value:** This is the most powerful consolidation finder. It detects "you have two parallel end-to-end mechanisms doing the same thing through different code paths." The divergence points are exactly where to extract a shared abstraction. Unlike function-level similarity, this catches architectural-level duplication.
|
|
836
|
-
|
|
837
|
-
---
|
|
838
|
-
|
|
839
|
-
#### `extract-candidates`
|
|
840
|
-
|
|
841
|
-
Find large functions with natural extraction seams — isolated groups of callees that form distinct clusters within a single function. When a function calls symbols A, B, C together and separately calls D, E, F, that's two potential extracted functions.
|
|
842
|
-
|
|
843
|
-
```bash
|
|
844
|
-
scip-query extract-candidates --min-loc 20 --min-callees 6
|
|
845
|
-
# src/services/auth.ts:10-85 processAuth (75 LOC, 12 callees)
|
|
846
|
-
# Cluster 1 (92% isolated, 4 callees):
|
|
847
|
-
# validateToken, parseJwt, checkExpiry, refreshToken
|
|
848
|
-
# Cluster 2 (88% isolated, 3 callees):
|
|
849
|
-
# formatUser, enrichProfile, cacheResult
|
|
850
|
-
```
|
|
851
|
-
|
|
852
|
-
**Options:**
|
|
853
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
854
|
-
- `--min-loc <n>` — Minimum function LOC (default: 10)
|
|
855
|
-
- `--min-callees <n>` — Minimum callees to analyze (default: 6)
|
|
856
|
-
- `-n, --limit <n>` — Number of results (default: 20)
|
|
857
|
-
|
|
858
|
-
**Value:** Identifies concrete extraction opportunities within large functions. Each cluster is a group of callees that are used together but independently from the rest of the function — a natural candidate for "Extract Method" refactoring. The isolation score tells you how cleanly the extraction would separate.
|
|
859
|
-
|
|
860
|
-
---
|
|
861
|
-
|
|
862
|
-
### Impact & Planning
|
|
863
|
-
|
|
864
|
-
#### `affected <symbol>`
|
|
865
|
-
|
|
866
|
-
Full transitive closure of symbols that could break if this symbol changes. BFS through the mention graph at configurable depth.
|
|
867
|
-
|
|
868
|
-
```bash
|
|
869
|
-
scip-query affected login --max-depth 3
|
|
870
|
-
# ── Depth 1 ──
|
|
871
|
-
# src/controllers/auth.controller.ts handleLogin
|
|
872
|
-
# src/__tests__/auth.test.ts authTests
|
|
873
|
-
#
|
|
874
|
-
# ── Depth 2 ──
|
|
875
|
-
# src/routes/index.ts routes
|
|
876
|
-
```
|
|
877
|
-
|
|
878
|
-
**Options:**
|
|
879
|
-
- `--max-depth <n>` — Maximum traversal depth (default: 5)
|
|
880
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
881
|
-
|
|
882
|
-
**Value:** "If I change this, what's the full blast wave?" Goes beyond direct `rdeps` to show consumers-of-consumers.
|
|
883
|
-
|
|
884
|
-
---
|
|
885
|
-
|
|
886
|
-
#### `change-surface <file>`
|
|
887
|
-
|
|
888
|
-
Pre-change briefing for a file: every exported symbol, consumer count, and blast-radius risk.
|
|
889
|
-
|
|
890
|
-
```bash
|
|
891
|
-
scip-query change-surface auth.service.ts
|
|
892
|
-
# File: src/services/auth.service.ts
|
|
893
|
-
# External consumers: 45
|
|
894
|
-
#
|
|
895
|
-
# 1-50 AuthService [12 consumers] *** HIGH RISK ***
|
|
896
|
-
# 5-20 login() [8 consumers] * medium risk *
|
|
897
|
-
# 22-35 logout() [0 consumers]
|
|
898
|
-
```
|
|
899
|
-
|
|
900
|
-
**Value:** One command before modifying any file. Shows what's exported, who uses it, and which symbols carry the largest downstream blast radius.
|
|
901
|
-
|
|
902
|
-
---
|
|
903
|
-
|
|
904
|
-
#### `diff-impact`
|
|
905
|
-
|
|
906
|
-
Compute affected symbols from the current git diff.
|
|
907
|
-
|
|
908
|
-
```bash
|
|
909
|
-
scip-query diff-impact
|
|
910
|
-
scip-query diff-impact --base main
|
|
911
|
-
# Changed files: 3
|
|
912
|
-
# Changed symbols: 12
|
|
913
|
-
# Affected consumer files: 28
|
|
914
|
-
```
|
|
915
|
-
|
|
916
|
-
**Options:**
|
|
917
|
-
- `--base <ref>` — Git ref to diff against (default: HEAD)
|
|
918
|
-
|
|
919
|
-
**Value:** Run before committing. Shows everything your changes affect and which consumer files sit downstream of the changed symbols.
|
|
920
|
-
|
|
921
|
-
---
|
|
922
|
-
|
|
923
|
-
### De-bloating
|
|
924
|
-
|
|
925
|
-
#### `drift [module]`
|
|
926
|
-
|
|
927
|
-
Detect unused imports, layer violations, and dependency-pattern deviations.
|
|
928
|
-
|
|
929
|
-
```bash
|
|
930
|
-
scip-query drift --min-deviation 6
|
|
931
|
-
#
|
|
932
|
-
# src/services/legacy-auth.ts
|
|
933
|
-
# [LAYER] Imports from infra/ (infra/raw-sql.ts) — may cross architectural boundary
|
|
934
|
-
# app/ should not depend on infra/
|
|
935
|
-
```
|
|
936
|
-
|
|
937
|
-
**Options:**
|
|
938
|
-
- `--min-deviation <n>` — Minimum sibling files before reporting unique dependency deviations (default: 5)
|
|
939
|
-
|
|
940
|
-
**Value:** Finds unused imports, layer-policy violations, and files that don't follow their neighbors' dependency conventions. The outliers are either legacy code needing migration or intentional exceptions needing documentation.
|
|
941
|
-
|
|
942
|
-
---
|
|
943
|
-
|
|
944
|
-
#### `wrapper-candidates`
|
|
945
|
-
|
|
946
|
-
Find symbols only called by one consumer — potential premature abstractions.
|
|
947
|
-
|
|
948
|
-
```bash
|
|
949
|
-
scip-query wrapper-candidates --max-loc 15
|
|
950
|
-
# src/utils/format.ts:10-18 formatCurrency (8 LOC)
|
|
951
|
-
# Only called by: formatInvoice (fan-in: 12)
|
|
952
|
-
```
|
|
953
|
-
|
|
954
|
-
**Options:**
|
|
955
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
956
|
-
- `--max-loc <n>` — Maximum LOC (default: 15)
|
|
957
|
-
- `-n, --limit <n>` — Number of results (default: 30)
|
|
958
|
-
|
|
959
|
-
**Value:** If a function is only called by one other function, it might be inlineable. The smaller it is, the stronger the signal.
|
|
960
|
-
|
|
961
|
-
---
|
|
962
|
-
|
|
963
|
-
#### `passthrough-candidates`
|
|
964
|
-
|
|
965
|
-
Find functions that forward to exactly one callee — pure indirection.
|
|
966
|
-
|
|
967
|
-
```bash
|
|
968
|
-
scip-query passthrough-candidates
|
|
969
|
-
# src/services/user.ts:5-10 getUser (5 LOC)
|
|
970
|
-
# Forwards to: userRepo.findById (src/repos/user.repo.ts)
|
|
971
|
-
```
|
|
972
|
-
|
|
973
|
-
**Options:**
|
|
974
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
975
|
-
- `--max-loc <n>` — Maximum LOC (default: 15)
|
|
976
|
-
- `-n, --limit <n>` — Number of results (default: 30)
|
|
977
|
-
|
|
978
|
-
**Value:** Functions that just call one other function without adding logic. Either inline them or verify they serve a purpose (testing boundary, dependency inversion).
|
|
979
|
-
|
|
980
|
-
---
|
|
981
|
-
|
|
982
|
-
#### `stale-abstractions`
|
|
983
|
-
|
|
984
|
-
Find types, interfaces, and classes with 0-1 cross-file consumers.
|
|
985
|
-
|
|
986
|
-
```bash
|
|
987
|
-
scip-query stale-abstractions --min-loc 5
|
|
988
|
-
# src/types/deprecated.ts:1-25 OldUserType (25 LOC, unused)
|
|
989
|
-
# src/interfaces/single.ts:1-15 ISingleUse (15 LOC, 1 consumer)
|
|
990
|
-
```
|
|
991
|
-
|
|
992
|
-
**Options:**
|
|
993
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
994
|
-
- `--min-loc <n>` — Minimum LOC (default: 3)
|
|
995
|
-
- `-n, --limit <n>` — Number of results (default: 30)
|
|
996
|
-
- `--include-low-confidence` — Include 1-consumer classes (usually encapsulation, not stale)
|
|
997
|
-
|
|
998
|
-
**Value:** An interface with one implementation isn't an abstraction — it's indirection. Finds over-engineering.
|
|
999
|
-
|
|
1000
|
-
---
|
|
1001
|
-
|
|
1002
|
-
#### `complexity-hotspots`
|
|
1003
|
-
|
|
1004
|
-
Composite complexity score per symbol: LOC x fan-in x fan-out.
|
|
1005
|
-
|
|
1006
|
-
```bash
|
|
1007
|
-
scip-query complexity-hotspots -n 10
|
|
1008
|
-
# score LOC fan-in fan-out callees symbol
|
|
1009
|
-
# ───── ──── ────── ─────── ─────── ──────
|
|
1010
|
-
# 101.7 541 47 0 16 types
|
|
1011
|
-
# 31.3 279 28 5 33 symbol-parser
|
|
1012
|
-
```
|
|
1013
|
-
|
|
1014
|
-
**Options:**
|
|
1015
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
1016
|
-
- `--min-loc <n>` — Minimum LOC (default: 10)
|
|
1017
|
-
- `-n, --limit <n>` — Number of results (default: 20)
|
|
1018
|
-
|
|
1019
|
-
**Value:** The symbols most likely to contain bugs and be hardest to modify. High score = high LOC + many consumers + many dependencies.
|
|
1020
|
-
|
|
1021
|
-
---
|
|
1022
|
-
|
|
1023
|
-
### Composite Reports
|
|
1024
|
-
|
|
1025
|
-
#### `health`
|
|
1026
|
-
|
|
1027
|
-
Single command that runs all analyses and produces a prioritized action list with a health score.
|
|
1028
|
-
|
|
1029
|
-
```bash
|
|
1030
|
-
scip-query health
|
|
1031
|
-
# Codebase Health Score: 72/100
|
|
1032
|
-
# 54 files | 1501 symbols | 900 KB
|
|
1033
|
-
#
|
|
1034
|
-
# Findings:
|
|
1035
|
-
# Dead code: 12 symbols (340 LOC)
|
|
1036
|
-
# Similar pairs: 8
|
|
1037
|
-
# Stale abstractions: 5
|
|
1038
|
-
#
|
|
1039
|
-
# Prioritized Actions:
|
|
1040
|
-
# 1. [low effort / high impact] 12 symbols with zero references — safe to delete (~340 LOC)
|
|
1041
|
-
# 2. [low effort / medium impact] 5 types with 0-1 consumers — premature abstraction
|
|
1042
|
-
# 3. [medium effort / medium impact] 8 pairs with >60% callee overlap — consolidation candidates
|
|
1043
|
-
|
|
1044
|
-
scip-query health --json # JSON output for programmatic use
|
|
1045
|
-
```
|
|
1046
|
-
|
|
1047
|
-
**Options:**
|
|
1048
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
1049
|
-
- `--json` — Output as JSON
|
|
1050
|
-
|
|
1051
|
-
**Value:** The one command to rule them all. Runs every cleanup analysis, scores the codebase, and tells you exactly what to fix and in what order.
|
|
1052
|
-
|
|
1053
|
-
---
|
|
1054
|
-
|
|
1055
|
-
#### `convergence <symbol1> <symbol2>`
|
|
1056
|
-
|
|
1057
|
-
Given two similar functions (from `similar`), show what a consolidated version would look like.
|
|
1058
|
-
|
|
1059
|
-
```bash
|
|
1060
|
-
scip-query convergence bottlenecks hotspots
|
|
1061
|
-
# 82% callee overlap
|
|
1062
|
-
#
|
|
1063
|
-
# A: bottlenecks (src/queries/bottlenecks.ts, 68 LOC)
|
|
1064
|
-
# B: hotspots (src/queries/hotspots.ts, 54 LOC)
|
|
1065
|
-
#
|
|
1066
|
-
# Shared callees (9): ScipDatabase, db.all(), db.isIgnored(), ...
|
|
1067
|
-
# Unique to A (1): BottleneckResult
|
|
1068
|
-
# Unique to B (1): HotspotResult
|
|
1069
|
-
#
|
|
1070
|
-
# Strategy: Create a shared function with the 9 common callees.
|
|
1071
|
-
# Pass the 2 divergent callees as parameters or strategy callbacks.
|
|
1072
|
-
```
|
|
1073
|
-
|
|
1074
|
-
**Value:** Turns "these two functions are similar" into a concrete refactoring prescription.
|
|
1075
|
-
|
|
1076
|
-
---
|
|
1077
|
-
|
|
1078
|
-
### Source & Analysis
|
|
1079
|
-
|
|
1080
|
-
#### `code <symbol>`
|
|
1081
|
-
|
|
1082
|
-
Read the source code for a symbol, bounded to its definition range.
|
|
1083
|
-
|
|
1084
|
-
```bash
|
|
1085
|
-
scip-query code shortenSymbol
|
|
1086
|
-
scip-query code shortenSymbol -C 5 # 5 extra lines of context
|
|
1087
|
-
```
|
|
1088
|
-
|
|
1089
|
-
**Options:**
|
|
1090
|
-
- `-C, --context <n>` — Extra lines above/below the definition (default: 0)
|
|
1091
|
-
|
|
1092
|
-
**Value:** Read source without leaving the terminal. Language-agnostic — just reads the file at the line range from the index.
|
|
1093
|
-
|
|
1094
|
-
---
|
|
1095
|
-
|
|
1096
|
-
#### `complexity <symbol>`
|
|
1097
|
-
|
|
1098
|
-
Per-symbol complexity analysis: source-level branch counting + index-level metrics.
|
|
1099
|
-
|
|
1100
|
-
```bash
|
|
1101
|
-
scip-query complexity login
|
|
1102
|
-
# LOC: 41
|
|
1103
|
-
# Branches: 8
|
|
1104
|
-
# Cyclomatic estimate: 9
|
|
1105
|
-
# Callees: 5
|
|
1106
|
-
# Fan-in: 12
|
|
1107
|
-
# Fan-out: 3
|
|
1108
|
-
```
|
|
1109
|
-
|
|
1110
|
-
**Value:** Combines source-level analysis (branch counting via language-aware regex) with graph-level metrics (fan-in, fan-out, callee count) for a complete complexity picture.
|
|
1111
|
-
|
|
1112
|
-
---
|
|
1113
|
-
|
|
1114
|
-
#### `dataflow <symbol>`
|
|
1115
|
-
|
|
1116
|
-
Reference-level dataflow: where data around a symbol comes from and where it goes.
|
|
1117
|
-
|
|
1118
|
-
```bash
|
|
1119
|
-
scip-query dataflow login
|
|
1120
|
-
# ═══ DEFINED AT ═══
|
|
1121
|
-
# src/auth.service.ts:5
|
|
1122
|
-
# ═══ USED AT ═══
|
|
1123
|
-
# src/auth.controller.ts:15 in handleAuth
|
|
1124
|
-
# ═══ PRODUCERS (feeds into this) ═══
|
|
1125
|
-
# validateInput, formatName
|
|
1126
|
-
# ═══ CONSUMERS (this feeds into) ═══
|
|
1127
|
-
# sendEmail, logAudit
|
|
1128
|
-
```
|
|
1129
|
-
|
|
1130
|
-
**Value:** Shows the data flow context: what other symbols are referenced alongside this one, what feeds in, what consumes it.
|
|
1131
|
-
|
|
1132
|
-
---
|
|
1133
|
-
|
|
1134
|
-
#### `slice <symbol>`
|
|
1135
|
-
|
|
1136
|
-
Reference-level program slicing: what affects a symbol (backward) or what it affects (forward).
|
|
1137
|
-
|
|
1138
|
-
```bash
|
|
1139
|
-
scip-query slice login # backward: what feeds in
|
|
1140
|
-
scip-query slice login --forward # forward: what this feeds into
|
|
1141
|
-
```
|
|
1142
|
-
|
|
1143
|
-
**Options:**
|
|
1144
|
-
- `--forward` — Forward slice instead of backward (default: backward)
|
|
1145
|
-
- `--depth <n>` — Max transitive depth for backward slice (default: 3)
|
|
1146
|
-
|
|
1147
|
-
**Value:** Backward slice shows inputs/dependencies. Forward slice shows outputs/effects. Useful for tracing data flow through error handling and concurrency paths.
|
|
1148
|
-
|
|
1149
|
-
---
|
|
1150
|
-
|
|
1151
|
-
### Additional Cleanup
|
|
1152
|
-
|
|
1153
|
-
#### `redundant-reexports`
|
|
1154
|
-
|
|
1155
|
-
Find barrel file re-exports that nobody imports through.
|
|
1156
|
-
|
|
1157
|
-
```bash
|
|
1158
|
-
scip-query redundant-reexports
|
|
1159
|
-
# No redundant re-exports found.
|
|
1160
|
-
```
|
|
1161
|
-
|
|
1162
|
-
**Options:**
|
|
1163
|
-
- `-s, --scope <path>` — Limit to files matching path
|
|
1164
|
-
- `-n, --limit <n>` — Number of results (default: 30)
|
|
1165
|
-
|
|
1166
|
-
**Value:** Finds dead entries in inactive barrel files. Live barrels are skipped so shared entry surfaces like package roots and CLI registries do not show up as false positives.
|
|
1167
|
-
|
|
1168
|
-
---
|
|
188
|
+
| Command | Description | Options |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| `files <pattern>` | Find files matching a pattern | - |
|
|
191
|
+
| `symbols <file>` | List symbols defined in a file (with line ranges + signatures) | - |
|
|
192
|
+
| `methods <className>` | List methods of a class (with line ranges) | - |
|
|
193
|
+
| `refs <symbol>` | Find all files referencing a symbol | `--full` |
|
|
194
|
+
| `trace <symbol>` | Trace a symbol: definition + all references | `--full` |
|
|
195
|
+
| `deps <file>` | Files this file depends on (internal) | - |
|
|
196
|
+
| `rdeps <file>` | Files that depend on this file/module | - |
|
|
197
|
+
| `system <module>` | Full module map: files, symbols, deps in/out | - |
|
|
198
|
+
| `surface <module>` | What symbols consumers actually use from this module | - |
|
|
199
|
+
| `imports <file>` | What symbols does this file import? | `--full` |
|
|
200
|
+
| `imported-by <symbol>` | Which files import this symbol? | - |
|
|
201
|
+
| `outline <file>` | Tree view of symbols in a file (using nesting hierarchy) | - |
|
|
202
|
+
| `members <symbol>` | All children of a symbol (methods, fields, nested types) | - |
|
|
203
|
+
| `by-kind <kind>` | Find symbols by SCIP kind (class, interface, enum, function, etc.) | `-s, --scope <path>`<br>`-n, --limit <n>` |
|
|
204
|
+
| `kind-counts` | Histogram of symbol kinds in the codebase | `-s, --scope <path>` |
|
|
205
|
+
| `hierarchy <symbol>` | Show a symbol's ancestry chain (method → class → module) | - |
|
|
206
|
+
| `code <symbol>` | Read the source code for a symbol (bounded to its definition range) | `-C, --context <n>` |
|
|
207
|
+
| `dataflow <symbol>` | Reference-level dataflow: definition sites, usage sites, producers, consumers | `--full` |
|
|
208
|
+
| `slice <symbol>` | Reference-level program slice: what affects this (backward) or what this affects (forward) | `--forward`<br>`--depth <n>`<br>`--full` |
|
|
209
|
+
|
|
210
|
+
### Cleanup
|
|
211
|
+
|
|
212
|
+
| Command | Description | Options |
|
|
213
|
+
|---|---|---|
|
|
214
|
+
| `dead [scope]` | Find dead code and file-internal symbols (no cross-file consumers) | `--min-loc <n>`<br>`--include-tests`<br>`--skip-barrels`<br>`--include-members`<br>`--only-dead`<br>`--only-internal`<br>`--full` |
|
|
215
|
+
| `unused-imports <file>` | Find imports not referenced in the same file | `--full` |
|
|
216
|
+
| `isolated` | Find completely orphaned symbols (no references at all) | `-s, --scope <path>`<br>`--min-loc <n>`<br>`--full` |
|
|
217
|
+
| `similar [symbol]` | Find heuristic function similarity candidates from callee fingerprints | `--min-similarity <n>`<br>`-n, --limit <n>`<br>`-s, --scope <path>`<br>`--min-callees <n>`<br>`--cross-file-only`<br>`--full` |
|
|
218
|
+
| `similar-files [file]` | Find heuristic similar-file candidates from dependency profiles | `--min-similarity <n>`<br>`-n, --limit <n>`<br>`-s, --scope <path>`<br>`--min-deps <n>` |
|
|
219
|
+
| `similar-chains` | Find heuristic similar-chain candidates from dependency flows | `--min-similarity <n>`<br>`-n, --limit <n>`<br>`-s, --scope <path>`<br>`--min-length <n>`<br>`--max-length <n>` |
|
|
220
|
+
| `extract-candidates` | Find heuristic extraction candidates from isolated callee clusters | `-s, --scope <path>`<br>`--min-loc <n>`<br>`--min-callees <n>`<br>`-n, --limit <n>`<br>`--full` |
|
|
221
|
+
| `drift [module]` | Detect heuristic drift candidates: unused imports, layer violations, and pattern deviations | `--min-deviation <n>`<br>`--full` |
|
|
222
|
+
| `wrapper-candidates` | Find heuristic wrapper candidates only called by one consumer | `-s, --scope <path>`<br>`--max-loc <n>`<br>`-n, --limit <n>`<br>`--full` |
|
|
223
|
+
| `passthrough-candidates` | Find heuristic passthrough candidates that forward to one callee | `-s, --scope <path>`<br>`--max-loc <n>`<br>`-n, --limit <n>`<br>`--full` |
|
|
224
|
+
| `stale-abstractions` | Find heuristic stale abstraction candidates with 0-1 consumers | `-s, --scope <path>`<br>`--min-loc <n>`<br>`-n, --limit <n>`<br>`--include-low-confidence`<br>`--full` |
|
|
225
|
+
| `complexity-hotspots` | Find heuristic complexity hotspot candidates from LOC x fan-in x fan-out | `-s, --scope <path>`<br>`--min-loc <n>`<br>`-n, --limit <n>`<br>`--full` |
|
|
226
|
+
| `convergence <symbol1> <symbol2>` | Show what a consolidated version of two similar functions would look like | `--full` |
|
|
227
|
+
| `redundant-reexports` | Find barrel re-exports that nobody imports through | `-s, --scope <path>`<br>`-n, --limit <n>` |
|
|
228
|
+
| `similar-signatures` | Find functions with near-identical type signatures (same shape) | `-s, --scope <path>`<br>`--min-loc <n>`<br>`-n, --limit <n>`<br>`--full` |
|
|
229
|
+
|
|
230
|
+
### Graph
|
|
231
|
+
|
|
232
|
+
| Command | Description | Options |
|
|
233
|
+
|---|---|---|
|
|
234
|
+
| `hotspots` | Most-referenced symbols in the codebase (choke points) | `-n, --limit <n>`<br>`-s, --scope <path>` |
|
|
235
|
+
| `fan-in [symbol]` | How many files reference a symbol (or top fan-in across codebase) | `-n, --limit <n>`<br>`-s, --scope <path>` |
|
|
236
|
+
| `fan-out [file]` | How many external symbols a file uses (or top fan-out across codebase) | `-n, --limit <n>`<br>`-s, --scope <path>` |
|
|
237
|
+
| `coupling [file1] [file2]` | Coupling between two files, or top coupled pairs in codebase | `-n, --limit <n>`<br>`-s, --scope <path>` |
|
|
238
|
+
| `cycles` | Detect circular dependency chains between files | `-s, --scope <path>`<br>`--max-depth <n>` |
|
|
239
|
+
| `bottlenecks` | Find coupling hubs: high fan-in AND high fan-out | `-n, --limit <n>`<br>`-s, --scope <path>`<br>`--min-fan-in <n>`<br>`--min-fan-out <n>`<br>`--full` |
|
|
240
|
+
| `deep-chains` | Find the longest transitive dependency chains | `-n, --limit <n>`<br>`-s, --scope <path>`<br>`--min-depth <n>` |
|
|
241
|
+
| `call-graph <symbol>` | Show incoming callers and outgoing callees for a symbol | `--full` |
|
|
242
|
+
|
|
243
|
+
### Impact
|
|
244
|
+
|
|
245
|
+
| Command | Description | Options |
|
|
246
|
+
|---|---|---|
|
|
247
|
+
| `affected <symbol>` | Transitive closure of symbols that could break if this symbol changes | `--max-depth <n>`<br>`-s, --scope <path>` |
|
|
248
|
+
| `change-surface <file>` | Pre-change briefing: exports, consumers, and blast-radius risk | `--full` |
|
|
249
|
+
| `diff-impact` | Compute changed symbols and downstream consumers from current git diff | `--base <ref>` |
|
|
1169
250
|
|
|
1170
|
-
|
|
251
|
+
### Health
|
|
1171
252
|
|
|
1172
|
-
|
|
253
|
+
| Command | Description | Options |
|
|
254
|
+
|---|---|---|
|
|
255
|
+
| `health` | Composite codebase health report with prioritized action list | `-s, --scope <path>`<br>`--full`<br>`--json` |
|
|
256
|
+
| `complexity <symbol>` | Per-symbol complexity: branches, cyclomatic estimate, fan-in/out, callees | `--full` |
|
|
1173
257
|
|
|
1174
|
-
|
|
1175
|
-
scip-query similar-signatures --min-loc 5
|
|
1176
|
-
# Signature: (email: string): Promise<Token> (2 functions)
|
|
1177
|
-
# src/auth.ts:5-20 login (15 LOC)
|
|
1178
|
-
# src/auth.ts:22-37 signup (15 LOC)
|
|
1179
|
-
```
|
|
258
|
+
### Maintenance
|
|
1180
259
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
-
|
|
1184
|
-
-
|
|
260
|
+
| Command | Description | Options |
|
|
261
|
+
|---|---|---|
|
|
262
|
+
| `install-skills` | Install skills (concrete-plan, scip-explore, scip-debloat, scip-verify, scip-language-playbook) into Claude Code and Codex | - |
|
|
263
|
+
| `check-deps` | Check whether scip-query and the detected language indexers are actually runnable | - |
|
|
264
|
+
| `init` | Create a .scipquery.json config file for this project | - |
|
|
265
|
+
| `watch` | Watch for file changes and reindex automatically | `--debounce <ms>`<br>`--cooldown <ms>` |
|
|
266
|
+
| `status` | Show index status for this project | - |
|
|
1185
267
|
|
|
1186
|
-
|
|
268
|
+
<!-- END GENERATED COMMAND REFERENCE -->
|
|
1187
269
|
|
|
1188
|
-
---
|
|
1189
270
|
|
|
1190
271
|
## Programmatic API
|
|
1191
272
|
|