scip-query 0.1.0
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/IMPROVEMENTS.md +143 -0
- package/PLAN.md +320 -0
- package/README.md +1213 -0
- package/dist/chunk-2QZ23IBN.js +55 -0
- package/dist/chunk-2QZ23IBN.js.map +1 -0
- package/dist/chunk-36OMT7ZJ.js +144 -0
- package/dist/chunk-36OMT7ZJ.js.map +1 -0
- package/dist/chunk-3E2X7RIE.js +101 -0
- package/dist/chunk-3E2X7RIE.js.map +1 -0
- package/dist/chunk-3UOUTZQT.js +45 -0
- package/dist/chunk-3UOUTZQT.js.map +1 -0
- package/dist/chunk-3ZZJVBIO.js +88 -0
- package/dist/chunk-3ZZJVBIO.js.map +1 -0
- package/dist/chunk-4TYLS5XX.js +10 -0
- package/dist/chunk-4TYLS5XX.js.map +1 -0
- package/dist/chunk-5FGUEU7N.js +101 -0
- package/dist/chunk-5FGUEU7N.js.map +1 -0
- package/dist/chunk-5WTJAXY2.js +61 -0
- package/dist/chunk-5WTJAXY2.js.map +1 -0
- package/dist/chunk-6NBLIDF4.js +24 -0
- package/dist/chunk-6NBLIDF4.js.map +1 -0
- package/dist/chunk-6SXADWLW.js +43 -0
- package/dist/chunk-6SXADWLW.js.map +1 -0
- package/dist/chunk-6VJ6Q7IE.js +65 -0
- package/dist/chunk-6VJ6Q7IE.js.map +1 -0
- package/dist/chunk-7OZPA5OO.js +258 -0
- package/dist/chunk-7OZPA5OO.js.map +1 -0
- package/dist/chunk-BEPIEVLR.js +76 -0
- package/dist/chunk-BEPIEVLR.js.map +1 -0
- package/dist/chunk-BFSCMC22.js +42 -0
- package/dist/chunk-BFSCMC22.js.map +1 -0
- package/dist/chunk-BP2ATLK2.js +110 -0
- package/dist/chunk-BP2ATLK2.js.map +1 -0
- package/dist/chunk-CM454WL3.js +114 -0
- package/dist/chunk-CM454WL3.js.map +1 -0
- package/dist/chunk-DCKMSTJ4.js +74 -0
- package/dist/chunk-DCKMSTJ4.js.map +1 -0
- package/dist/chunk-DEZKCZXD.js +40 -0
- package/dist/chunk-DEZKCZXD.js.map +1 -0
- package/dist/chunk-DVWGWHFW.js +99 -0
- package/dist/chunk-DVWGWHFW.js.map +1 -0
- package/dist/chunk-EMDQWNYR.js +102 -0
- package/dist/chunk-EMDQWNYR.js.map +1 -0
- package/dist/chunk-FFSWWE5O.js +33 -0
- package/dist/chunk-FFSWWE5O.js.map +1 -0
- package/dist/chunk-FGXRVW7G.js +73 -0
- package/dist/chunk-FGXRVW7G.js.map +1 -0
- package/dist/chunk-FUHJCHS4.js +158 -0
- package/dist/chunk-FUHJCHS4.js.map +1 -0
- package/dist/chunk-GJFURBEW.js +64 -0
- package/dist/chunk-GJFURBEW.js.map +1 -0
- package/dist/chunk-GTILYBH6.js +102 -0
- package/dist/chunk-GTILYBH6.js.map +1 -0
- package/dist/chunk-JJP7KQND.js +1 -0
- package/dist/chunk-JJP7KQND.js.map +1 -0
- package/dist/chunk-JKP5GH6T.js +213 -0
- package/dist/chunk-JKP5GH6T.js.map +1 -0
- package/dist/chunk-KCBMVQL5.js +38 -0
- package/dist/chunk-KCBMVQL5.js.map +1 -0
- package/dist/chunk-KVSW5KYP.js +78 -0
- package/dist/chunk-KVSW5KYP.js.map +1 -0
- package/dist/chunk-LAWMH22O.js +172 -0
- package/dist/chunk-LAWMH22O.js.map +1 -0
- package/dist/chunk-LB7OS35Q.js +72 -0
- package/dist/chunk-LB7OS35Q.js.map +1 -0
- package/dist/chunk-LUSIFBXO.js +57 -0
- package/dist/chunk-LUSIFBXO.js.map +1 -0
- package/dist/chunk-MBVNHJVN.js +44 -0
- package/dist/chunk-MBVNHJVN.js.map +1 -0
- package/dist/chunk-MGNMHKX3.js +15 -0
- package/dist/chunk-MGNMHKX3.js.map +1 -0
- package/dist/chunk-N5KEREIA.js +41 -0
- package/dist/chunk-N5KEREIA.js.map +1 -0
- package/dist/chunk-NDSQYIWT.js +71 -0
- package/dist/chunk-NDSQYIWT.js.map +1 -0
- package/dist/chunk-NUZ4OMU3.js +28 -0
- package/dist/chunk-NUZ4OMU3.js.map +1 -0
- package/dist/chunk-QOV2R2WT.js +170 -0
- package/dist/chunk-QOV2R2WT.js.map +1 -0
- package/dist/chunk-SEFSL2GF.js +78 -0
- package/dist/chunk-SEFSL2GF.js.map +1 -0
- package/dist/chunk-T6ARFSBZ.js +103 -0
- package/dist/chunk-T6ARFSBZ.js.map +1 -0
- package/dist/chunk-TBP6BICL.js +46 -0
- package/dist/chunk-TBP6BICL.js.map +1 -0
- package/dist/chunk-TDNNOR6D.js +97 -0
- package/dist/chunk-TDNNOR6D.js.map +1 -0
- package/dist/chunk-TSPZOMHC.js +195 -0
- package/dist/chunk-TSPZOMHC.js.map +1 -0
- package/dist/chunk-UNTPVD36.js +55 -0
- package/dist/chunk-UNTPVD36.js.map +1 -0
- package/dist/chunk-VRUJH4BO.js +88 -0
- package/dist/chunk-VRUJH4BO.js.map +1 -0
- package/dist/chunk-VZ7AMAFL.js +76 -0
- package/dist/chunk-VZ7AMAFL.js.map +1 -0
- package/dist/chunk-XFXDXEUN.js +24 -0
- package/dist/chunk-XFXDXEUN.js.map +1 -0
- package/dist/chunk-YZAA4LYG.js +169 -0
- package/dist/chunk-YZAA4LYG.js.map +1 -0
- package/dist/chunk-Z73NYSBZ.js +92 -0
- package/dist/chunk-Z73NYSBZ.js.map +1 -0
- package/dist/chunk-ZJRYBOEE.js +125 -0
- package/dist/chunk-ZJRYBOEE.js.map +1 -0
- package/dist/cli.js +5798 -0
- package/dist/cli.js.map +1 -0
- package/dist/db-BxaevAyc.d.ts +683 -0
- package/dist/index.d.ts +254 -0
- package/dist/index.js +1271 -0
- package/dist/index.js.map +1 -0
- package/dist/postinstall.js +167 -0
- package/dist/postinstall.js.map +1 -0
- package/dist/queries/affected.d.ts +14 -0
- package/dist/queries/affected.js +9 -0
- package/dist/queries/affected.js.map +1 -0
- package/dist/queries/bottlenecks.d.ts +18 -0
- package/dist/queries/bottlenecks.js +8 -0
- package/dist/queries/bottlenecks.js.map +1 -0
- package/dist/queries/by-kind.d.ts +20 -0
- package/dist/queries/by-kind.js +10 -0
- package/dist/queries/by-kind.js.map +1 -0
- package/dist/queries/call-graph.d.ts +13 -0
- package/dist/queries/call-graph.js +9 -0
- package/dist/queries/call-graph.js.map +1 -0
- package/dist/queries/change-surface.d.ts +10 -0
- package/dist/queries/change-surface.js +9 -0
- package/dist/queries/change-surface.js.map +1 -0
- package/dist/queries/clean-signature.d.ts +9 -0
- package/dist/queries/clean-signature.js +7 -0
- package/dist/queries/clean-signature.js.map +1 -0
- package/dist/queries/code.d.ts +17 -0
- package/dist/queries/code.js +9 -0
- package/dist/queries/code.js.map +1 -0
- package/dist/queries/complexity-hotspots.d.ts +19 -0
- package/dist/queries/complexity-hotspots.js +9 -0
- package/dist/queries/complexity-hotspots.js.map +1 -0
- package/dist/queries/complexity.d.ts +13 -0
- package/dist/queries/complexity.js +9 -0
- package/dist/queries/complexity.js.map +1 -0
- package/dist/queries/convergence.d.ts +11 -0
- package/dist/queries/convergence.js +9 -0
- package/dist/queries/convergence.js.map +1 -0
- package/dist/queries/coupling.d.ts +17 -0
- package/dist/queries/coupling.js +9 -0
- package/dist/queries/coupling.js.map +1 -0
- package/dist/queries/cycles.d.ts +16 -0
- package/dist/queries/cycles.js +8 -0
- package/dist/queries/cycles.js.map +1 -0
- package/dist/queries/dataflow.d.ts +19 -0
- package/dist/queries/dataflow.js +9 -0
- package/dist/queries/dataflow.js.map +1 -0
- package/dist/queries/dead.d.ts +10 -0
- package/dist/queries/dead.js +9 -0
- package/dist/queries/dead.js.map +1 -0
- package/dist/queries/deep-chains.d.ts +16 -0
- package/dist/queries/deep-chains.js +8 -0
- package/dist/queries/deep-chains.js.map +1 -0
- package/dist/queries/deps.d.ts +9 -0
- package/dist/queries/deps.js +9 -0
- package/dist/queries/deps.js.map +1 -0
- package/dist/queries/diff-impact.d.ts +13 -0
- package/dist/queries/diff-impact.js +9 -0
- package/dist/queries/diff-impact.js.map +1 -0
- package/dist/queries/doc-coverage.d.ts +14 -0
- package/dist/queries/doc-coverage.js +8 -0
- package/dist/queries/doc-coverage.js.map +1 -0
- package/dist/queries/drift.d.ts +25 -0
- package/dist/queries/drift.js +8 -0
- package/dist/queries/drift.js.map +1 -0
- package/dist/queries/extract-candidates.d.ts +25 -0
- package/dist/queries/extract-candidates.js +9 -0
- package/dist/queries/extract-candidates.js.map +1 -0
- package/dist/queries/fan.d.ts +29 -0
- package/dist/queries/fan.js +14 -0
- package/dist/queries/fan.js.map +1 -0
- package/dist/queries/files.d.ts +6 -0
- package/dist/queries/files.js +7 -0
- package/dist/queries/files.js.map +1 -0
- package/dist/queries/health.d.ts +18 -0
- package/dist/queries/health.js +21 -0
- package/dist/queries/health.js.map +1 -0
- package/dist/queries/hierarchy.d.ts +13 -0
- package/dist/queries/hierarchy.js +8 -0
- package/dist/queries/hierarchy.js.map +1 -0
- package/dist/queries/hotspots.d.ts +13 -0
- package/dist/queries/hotspots.js +8 -0
- package/dist/queries/hotspots.js.map +1 -0
- package/dist/queries/imports.d.ts +19 -0
- package/dist/queries/imports.js +12 -0
- package/dist/queries/imports.js.map +1 -0
- package/dist/queries/index.d.ts +47 -0
- package/dist/queries/index.js +207 -0
- package/dist/queries/index.js.map +1 -0
- package/dist/queries/isolated.d.ts +14 -0
- package/dist/queries/isolated.js +9 -0
- package/dist/queries/isolated.js.map +1 -0
- package/dist/queries/members.d.ts +10 -0
- package/dist/queries/members.js +8 -0
- package/dist/queries/members.js.map +1 -0
- package/dist/queries/methods.d.ts +6 -0
- package/dist/queries/methods.js +8 -0
- package/dist/queries/methods.js.map +1 -0
- package/dist/queries/outline.d.ts +10 -0
- package/dist/queries/outline.js +8 -0
- package/dist/queries/outline.js.map +1 -0
- package/dist/queries/passthrough-candidates.d.ts +18 -0
- package/dist/queries/passthrough-candidates.js +9 -0
- package/dist/queries/passthrough-candidates.js.map +1 -0
- package/dist/queries/redundant-reexports.d.ts +22 -0
- package/dist/queries/redundant-reexports.js +8 -0
- package/dist/queries/redundant-reexports.js.map +1 -0
- package/dist/queries/refs.d.ts +6 -0
- package/dist/queries/refs.js +7 -0
- package/dist/queries/refs.js.map +1 -0
- package/dist/queries/similar-chains.d.ts +29 -0
- package/dist/queries/similar-chains.js +8 -0
- package/dist/queries/similar-chains.js.map +1 -0
- package/dist/queries/similar-files.d.ts +19 -0
- package/dist/queries/similar-files.js +8 -0
- package/dist/queries/similar-files.js.map +1 -0
- package/dist/queries/similar-signatures.d.ts +21 -0
- package/dist/queries/similar-signatures.js +8 -0
- package/dist/queries/similar-signatures.js.map +1 -0
- package/dist/queries/similar.d.ts +34 -0
- package/dist/queries/similar.js +11 -0
- package/dist/queries/similar.js.map +1 -0
- package/dist/queries/slice.d.ts +21 -0
- package/dist/queries/slice.js +9 -0
- package/dist/queries/slice.js.map +1 -0
- package/dist/queries/stale-abstractions.d.ts +18 -0
- package/dist/queries/stale-abstractions.js +9 -0
- package/dist/queries/stale-abstractions.js.map +1 -0
- package/dist/queries/stats.d.ts +6 -0
- package/dist/queries/stats.js +7 -0
- package/dist/queries/stats.js.map +1 -0
- package/dist/queries/surface.d.ts +7 -0
- package/dist/queries/surface.js +8 -0
- package/dist/queries/surface.js.map +1 -0
- package/dist/queries/symbols.d.ts +6 -0
- package/dist/queries/symbols.js +9 -0
- package/dist/queries/symbols.js.map +1 -0
- package/dist/queries/system.d.ts +7 -0
- package/dist/queries/system.js +9 -0
- package/dist/queries/system.js.map +1 -0
- package/dist/queries/test-coverage.d.ts +22 -0
- package/dist/queries/test-coverage.js +11 -0
- package/dist/queries/test-coverage.js.map +1 -0
- package/dist/queries/trace.d.ts +6 -0
- package/dist/queries/trace.js +8 -0
- package/dist/queries/trace.js.map +1 -0
- package/dist/queries/wrapper-candidates.d.ts +17 -0
- package/dist/queries/wrapper-candidates.js +9 -0
- package/dist/queries/wrapper-candidates.js.map +1 -0
- package/dist/reindex-worker.js +368 -0
- package/dist/reindex-worker.js.map +1 -0
- package/docs/AGENT_GUIDE.md +359 -0
- package/package.json +70 -0
- package/reports/debloat/2026-04-10-scip-query-self-audit.md +161 -0
- package/skills/concrete-plan/SKILL.md +318 -0
- package/skills/scip-debloat/SKILL.md +413 -0
- package/skills/scip-explore/SKILL.md +235 -0
- package/skills/scip-verify/SKILL.md +323 -0
- package/src/cli.ts +1480 -0
- package/src/config.ts +117 -0
- package/src/db.ts +127 -0
- package/src/gitignore-filter.ts +143 -0
- package/src/index.ts +11 -0
- package/src/postinstall.ts +8 -0
- package/src/queries/affected.ts +86 -0
- package/src/queries/bottlenecks.ts +67 -0
- package/src/queries/by-kind.ts +204 -0
- package/src/queries/call-graph.ts +66 -0
- package/src/queries/change-surface.ts +110 -0
- package/src/queries/clean-signature.ts +22 -0
- package/src/queries/code.ts +101 -0
- package/src/queries/complexity-hotspots.ts +119 -0
- package/src/queries/complexity.ts +152 -0
- package/src/queries/convergence.ts +82 -0
- package/src/queries/coupling.ts +99 -0
- package/src/queries/cycles.ts +78 -0
- package/src/queries/dataflow.ts +128 -0
- package/src/queries/dead.ts +122 -0
- package/src/queries/deep-chains.ts +59 -0
- package/src/queries/deps.ts +46 -0
- package/src/queries/diff-impact.ts +204 -0
- package/src/queries/doc-coverage.ts +86 -0
- package/src/queries/drift.ts +224 -0
- package/src/queries/extract-candidates.ts +167 -0
- package/src/queries/fan.ts +148 -0
- package/src/queries/files.ts +16 -0
- package/src/queries/health.ts +324 -0
- package/src/queries/hierarchy.ts +49 -0
- package/src/queries/hotspots.ts +53 -0
- package/src/queries/imports.ts +95 -0
- package/src/queries/index.ts +45 -0
- package/src/queries/isolated.ts +67 -0
- package/src/queries/members.ts +54 -0
- package/src/queries/methods.ts +27 -0
- package/src/queries/outline.ts +52 -0
- package/src/queries/passthrough-candidates.ts +94 -0
- package/src/queries/redundant-reexports.ts +170 -0
- package/src/queries/refs.ts +27 -0
- package/src/queries/similar-chains.ts +314 -0
- package/src/queries/similar-files.ts +140 -0
- package/src/queries/similar-signatures.ts +151 -0
- package/src/queries/similar.ts +305 -0
- package/src/queries/slice.ts +154 -0
- package/src/queries/stale-abstractions.ts +82 -0
- package/src/queries/stats.ts +22 -0
- package/src/queries/surface.ts +34 -0
- package/src/queries/symbols.ts +39 -0
- package/src/queries/system.ts +86 -0
- package/src/queries/test-coverage.ts +106 -0
- package/src/queries/trace.ts +55 -0
- package/src/queries/wrapper-candidates.ts +112 -0
- package/src/query-support.ts +226 -0
- package/src/reindex/detect.ts +58 -0
- package/src/reindex/index.ts +153 -0
- package/src/reindex/indexers.ts +220 -0
- package/src/reindex/install.ts +125 -0
- package/src/reindex-worker.ts +35 -0
- package/src/setup.ts +202 -0
- package/src/symbol-parser.ts +278 -0
- package/src/types.ts +654 -0
- package/src/watch.ts +274 -0
- package/tests/gitignore-filter.test.ts +48 -0
- package/tests/queries.test.ts +300 -0
- package/tests/symbol-parser.test.ts +157 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +40 -0
- package/vitest.config.ts +7 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scip-debloat
|
|
3
|
+
description: Comprehensive codebase de-bloating using scip-query. Finds dead code, duplication, unnecessary abstractions, consolidation opportunities, pattern drift, and structural bloat from every possible angle. Produces a prioritized action list.
|
|
4
|
+
allowed-tools: [Bash, Write, Edit, Glob, Agent, TaskCreate, TaskUpdate, TaskGet, TaskList]
|
|
5
|
+
keywords: [debloat, clean, cleanup, refactor, dead-code, duplication, dry, consolidate, simplify, reduce, bloat, unused, stale, drift, health]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Codebase De-Bloating with scip-query
|
|
9
|
+
|
|
10
|
+
You are performing a comprehensive codebase audit to find every opportunity to reduce bloat, eliminate duplication, consolidate similar code, remove unnecessary abstractions, and improve structural health. You are thorough — you check from every angle, not just the obvious ones. Every finding must come from `scip-query`.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## When to Use This Skill
|
|
15
|
+
|
|
16
|
+
- "Clean up this codebase"
|
|
17
|
+
- "Find dead code"
|
|
18
|
+
- "What can we delete?"
|
|
19
|
+
- "Find duplication"
|
|
20
|
+
- "Make this codebase smaller"
|
|
21
|
+
- "Are there things we can consolidate?"
|
|
22
|
+
- "Run a health check"
|
|
23
|
+
- "De-bloat this module"
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Hard Rules
|
|
28
|
+
|
|
29
|
+
1. **Run `scip-query health` first.** It aggregates all analyses and gives you the prioritized starting point. Don't skip it.
|
|
30
|
+
|
|
31
|
+
2. **Check from every angle.** Dead code is the easy win. Go deeper — similar functions, stale abstractions, wrapper indirection, pattern drift, convergence opportunities, passthrough functions. Each catches a different class of bloat.
|
|
32
|
+
|
|
33
|
+
3. **Verify before recommending deletion.** Before saying "delete X," confirm it's truly unused: check `scip-query refs`, `scip-query affected`, and whether it's an entry point (CLI, worker, test file). Entry points appear dead because nothing imports them.
|
|
34
|
+
|
|
35
|
+
4. **Produce concrete actions.** Don't say "there's some duplication." Say "functions A and B have 80% callee overlap — consolidate into a shared helper with the 2 divergent callees as parameters (per `scip-query convergence A B`)."
|
|
36
|
+
|
|
37
|
+
5. **The report goes in `reports/debloat/YYYY-MM-DD-<scope>.md`.** If no reports directory exists, use the project root.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Symbol Lookup Tips
|
|
42
|
+
|
|
43
|
+
scip-query accepts partial symbol names — you don't need the full SCIP symbol path. These all work:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
scip-query code processVegaMention # just the function name
|
|
47
|
+
scip-query call-graph ChatService # just the class name
|
|
48
|
+
scip-query trace getActiveInferenceConfig # any unique substring
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Avoid parentheses** — `()` causes shell parse errors in zsh/bash:
|
|
52
|
+
```bash
|
|
53
|
+
# BAD — shell tries to execute a subshell
|
|
54
|
+
scip-query code processVegaMention()
|
|
55
|
+
|
|
56
|
+
# GOOD — no parens needed, scip-query strips them internally
|
|
57
|
+
scip-query code processVegaMention
|
|
58
|
+
|
|
59
|
+
# ALSO GOOD — single quotes protect special characters
|
|
60
|
+
scip-query code 'processVegaMention'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Read source by file + line range** when the symbol name is ambiguous:
|
|
64
|
+
```bash
|
|
65
|
+
scip-query code 'src/modules/chat/chat.service.ts:100-200'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**If "Symbol not found":**
|
|
69
|
+
1. Try a shorter/simpler name — `login` instead of `AuthService:login`
|
|
70
|
+
2. Try `scip-query symbols <file>` to see what symbols exist in the file
|
|
71
|
+
3. Try `scip-query trace <name>` which uses a different lookup path
|
|
72
|
+
4. Use the `file:line-line` syntax for `code` if you know the location
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## The 10 Angles of Bloat
|
|
77
|
+
|
|
78
|
+
Run every one of these. Each catches a different class of problem. Skip none.
|
|
79
|
+
|
|
80
|
+
### Angle 1: Dead Code (zero references)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
scip-query dead --min-loc 5 --skip-barrels
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Symbols with zero cross-file references. The `--skip-barrels` flag excludes references through barrel re-exports (index.ts) which can hide truly dead code.
|
|
87
|
+
|
|
88
|
+
**What to look for:**
|
|
89
|
+
- "dead code" = not referenced anywhere, not even in same file → safe to delete
|
|
90
|
+
- "dead export" = used locally but never imported → make private or delete the export
|
|
91
|
+
- Ignore entry points: `cli.ts`, worker files, `index.ts` barrels appear dead because they're consumed by the runtime, not by other source files
|
|
92
|
+
|
|
93
|
+
**Action:** Delete dead code. Remove `export` from dead exports.
|
|
94
|
+
|
|
95
|
+
### Angle 2: Isolated Symbols (completely disconnected)
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
scip-query isolated --min-loc 3
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Stricter than dead code — these symbols reference nothing AND are referenced by nothing. Completely disconnected from the codebase graph.
|
|
102
|
+
|
|
103
|
+
**Action:** Delete. These are the safest deletions possible.
|
|
104
|
+
|
|
105
|
+
### Angle 3: Similar Functions (callee overlap)
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
scip-query similar --min-similarity 0.5 --min-callees 3
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Functions that call the same set of symbols. High Jaccard similarity = doing the same work.
|
|
112
|
+
|
|
113
|
+
For each high-similarity pair, get the consolidation prescription:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
scip-query convergence <symbolA> <symbolB>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
This shows: shared callees (common body), unique callees (parameterization points), and a recommended strategy.
|
|
120
|
+
|
|
121
|
+
**What to look for:**
|
|
122
|
+
- Pairs above 70% = strong consolidation candidates
|
|
123
|
+
- Pairs above 50% = worth investigating, may share a common helper
|
|
124
|
+
- Same file = less interesting. Cross-file = more valuable to consolidate.
|
|
125
|
+
|
|
126
|
+
**Action:** Extract shared logic into a common helper. Pass divergent callees as parameters or strategy callbacks.
|
|
127
|
+
|
|
128
|
+
### Angle 4: Similar Files (dependency profile overlap)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
scip-query similar-files --min-similarity 0.6 --min-deps 3
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Files that import the same set of modules. These are structurally doing the same job.
|
|
135
|
+
|
|
136
|
+
**What to look for:**
|
|
137
|
+
- 90%+ similarity with different unique deps = copy-paste variants
|
|
138
|
+
- 100% similarity = likely redundant modules that should be merged or share a base
|
|
139
|
+
|
|
140
|
+
**Action:** Merge or extract a shared base module.
|
|
141
|
+
|
|
142
|
+
### Angle 5: Similar Chains (parallel end-to-end flows)
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
scip-query similar-chains --min-similarity 0.5
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
End-to-end dependency flows that are structurally similar but diverge at a few points. These represent "two parallel mechanisms doing the same thing."
|
|
149
|
+
|
|
150
|
+
**What to look for:**
|
|
151
|
+
- Chains with 1-2 divergence points = strongest consolidation signal
|
|
152
|
+
- Common prefix = shared entry path
|
|
153
|
+
- Common suffix = shared exit path
|
|
154
|
+
- Divergence points = where to extract a shared abstraction
|
|
155
|
+
|
|
156
|
+
**Action:** Extract the common chain into a shared pipeline. The divergence points become pluggable strategies.
|
|
157
|
+
|
|
158
|
+
### Angle 6: Extraction Candidates (large functions with callee clusters)
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
scip-query extract-candidates --min-loc 15 --min-callees 5
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Large functions where the callees form distinct, isolated clusters. Each cluster is a natural "Extract Method" seam.
|
|
165
|
+
|
|
166
|
+
**What to look for:**
|
|
167
|
+
- Clusters with high isolation (>80%) = clean extraction
|
|
168
|
+
- Multiple clusters in one function = the function is doing too many things
|
|
169
|
+
|
|
170
|
+
**Action:** Extract each isolated cluster into its own function.
|
|
171
|
+
|
|
172
|
+
### Angle 7: Wrapper Functions (single-consumer indirection)
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
scip-query wrapper-candidates --max-loc 15
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Small functions called by exactly one consumer. If the consumer is widely used but the wrapper has only one caller, the wrapper may be unnecessary indirection.
|
|
179
|
+
|
|
180
|
+
**What to look for:**
|
|
181
|
+
- LOC < 10 + single caller = strong inline candidate
|
|
182
|
+
- The caller's fan-in tells you how "public" the wrapper's consumer is
|
|
183
|
+
|
|
184
|
+
**Action:** Inline the wrapper into its single consumer, unless it serves a testing/dependency-inversion purpose.
|
|
185
|
+
|
|
186
|
+
### Angle 8: Passthrough Functions (pure forwarding)
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
scip-query passthrough-candidates --max-loc 15
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Functions with exactly one callee and small LOC. They just forward to another function without adding logic.
|
|
193
|
+
|
|
194
|
+
**Action:** Inline or verify they exist for a structural reason (DI, testing boundary).
|
|
195
|
+
|
|
196
|
+
### Angle 9: Stale Abstractions (over-engineering)
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
scip-query stale-abstractions --min-loc 3
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Types, interfaces, and classes with 0-1 cross-file consumers. An interface with one implementation isn't an abstraction — it's indirection. A type used by one file isn't reusable — it's premature.
|
|
203
|
+
|
|
204
|
+
**What to look for:**
|
|
205
|
+
- 0 consumers = completely unused type → delete
|
|
206
|
+
- 1 consumer = single-use abstraction → inline into the consumer or merge
|
|
207
|
+
|
|
208
|
+
**Action:** Delete unused types. Inline single-consumer types.
|
|
209
|
+
|
|
210
|
+
### Angle 10: Pattern Drift (convention violations)
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
scip-query drift --min-deviation 30
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Files that deviate from their directory's typical dependency pattern. If 8 of 10 services import a validator and 2 don't, those 2 are flagged.
|
|
217
|
+
|
|
218
|
+
**What to look for:**
|
|
219
|
+
- Missing expected deps = the file isn't following conventions (may be missing validation, logging, etc.)
|
|
220
|
+
- Unexpected deps = the file depends on things its siblings don't (may be reaching into the wrong layer)
|
|
221
|
+
- Barrel files (index.ts) and orchestrators naturally deviate — ignore those
|
|
222
|
+
|
|
223
|
+
**Action:** Bring drifted files into line with their neighbors, or document why the deviation is intentional.
|
|
224
|
+
|
|
225
|
+
### Angle 11: Redundant Re-exports (dead barrel entries)
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
scip-query redundant-reexports
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Barrel files (index.ts) that re-export symbols nobody actually imports through the barrel. If every consumer imports directly from the source file, the re-export is dead weight.
|
|
232
|
+
|
|
233
|
+
**What to look for:**
|
|
234
|
+
- Symbols with 0 barrel consumers = completely redundant re-export
|
|
235
|
+
- Symbols where barrel consumers < direct consumers = barrel mostly bypassed
|
|
236
|
+
|
|
237
|
+
**Action:** Remove unused re-exports from barrel files to reduce indirection.
|
|
238
|
+
|
|
239
|
+
### Angle 12: Similar Signatures (same-shape functions)
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
scip-query similar-signatures --min-loc 5
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Functions with the same parameter types and return type but different names. "Same shape" is a different signal from "same callees" — catches cases where two functions accept and return the same things even if they do different work internally.
|
|
246
|
+
|
|
247
|
+
**What to look for:**
|
|
248
|
+
- Groups of 3+ functions with identical signatures = strong consolidation signal
|
|
249
|
+
- Groups of 2 with identical signatures + similar callees = very strong signal
|
|
250
|
+
- Cross-reference with `scip-query convergence` for the consolidation prescription
|
|
251
|
+
|
|
252
|
+
**Action:** Investigate whether same-shape functions can share an implementation or a common interface.
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Structural Assessment (run alongside the 12 angles)
|
|
257
|
+
|
|
258
|
+
These provide context for the cleanup, not direct actions:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
scip-query cycles # Circular dependencies (must fix)
|
|
262
|
+
scip-query deep-chains --min-depth 5 # Excessively deep dependency chains
|
|
263
|
+
scip-query bottlenecks -n 10 # Coupling pressure points
|
|
264
|
+
scip-query complexity-hotspots -n 10 # Riskiest symbols
|
|
265
|
+
scip-query hotspots -n 10 # Most-referenced symbols
|
|
266
|
+
scip-query test-coverage # Test coverage percentage
|
|
267
|
+
scip-query doc-coverage --min-loc 5 # Documentation coverage
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Workflow
|
|
273
|
+
|
|
274
|
+
### Phase 1: Health Check (5 minutes)
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
scip-query reindex # Ensure index is fresh
|
|
278
|
+
scip-query health # Get the full report
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Read the health score, the findings breakdown, and the prioritized action list. This is your roadmap.
|
|
282
|
+
|
|
283
|
+
### Phase 2: Deep Scan (10-15 minutes)
|
|
284
|
+
|
|
285
|
+
Run all 10 angles plus the structural assessment. For each:
|
|
286
|
+
1. Run the command
|
|
287
|
+
2. Record the count and top findings
|
|
288
|
+
3. For actionable findings, drill deeper (e.g., `convergence` for similar pairs)
|
|
289
|
+
|
|
290
|
+
Use parallel subagents for speed — each angle is independent.
|
|
291
|
+
|
|
292
|
+
### Phase 3: Synthesize (5 minutes)
|
|
293
|
+
|
|
294
|
+
Produce the de-bloat report. Group findings by priority:
|
|
295
|
+
|
|
296
|
+
1. **Safe deletions** (dead code, isolated symbols) — zero risk, immediate LOC reduction
|
|
297
|
+
2. **Structural fixes** (cycles, stale abstractions) — fix architecture issues
|
|
298
|
+
3. **Consolidation** (similar functions, similar files, similar chains) — reduce duplication
|
|
299
|
+
4. **Extraction** (extract candidates, large functions) — reduce complexity
|
|
300
|
+
5. **Indirection removal** (wrappers, passthroughs) — simplify call chains
|
|
301
|
+
6. **Convention alignment** (drift) — improve consistency
|
|
302
|
+
|
|
303
|
+
### Phase 4: Estimate Impact
|
|
304
|
+
|
|
305
|
+
For each group, calculate:
|
|
306
|
+
- Number of symbols affected
|
|
307
|
+
- Lines of code recoverable
|
|
308
|
+
- Risk level (low/medium/high)
|
|
309
|
+
- Effort level (low/medium/high)
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Output Format
|
|
314
|
+
|
|
315
|
+
The report is a markdown file with:
|
|
316
|
+
|
|
317
|
+
```markdown
|
|
318
|
+
# De-Bloat Report: [project/module]
|
|
319
|
+
**Date:** YYYY-MM-DD
|
|
320
|
+
**Health Score:** N/100
|
|
321
|
+
**Scope:** [files analyzed]
|
|
322
|
+
|
|
323
|
+
## Summary
|
|
324
|
+
- Total findings: N
|
|
325
|
+
- Estimated recoverable LOC: N
|
|
326
|
+
- Safe deletions: N symbols
|
|
327
|
+
- Consolidation candidates: N pairs
|
|
328
|
+
- Structural issues: N
|
|
329
|
+
|
|
330
|
+
## Priority 1: Safe Deletions
|
|
331
|
+
[List of dead code and isolated symbols with file:line references]
|
|
332
|
+
|
|
333
|
+
## Priority 2: Structural Fixes
|
|
334
|
+
[Cycles, stale abstractions with fix recommendations]
|
|
335
|
+
|
|
336
|
+
## Priority 3: Consolidation Opportunities
|
|
337
|
+
[Similar pairs with convergence prescriptions]
|
|
338
|
+
|
|
339
|
+
## Priority 4: Extraction Opportunities
|
|
340
|
+
[Large functions with cluster analysis]
|
|
341
|
+
|
|
342
|
+
## Priority 5: Indirection Removal
|
|
343
|
+
[Wrappers and passthroughs with inline recommendations]
|
|
344
|
+
|
|
345
|
+
## Priority 6: Convention Alignment
|
|
346
|
+
[Drifted files with expected vs actual deps]
|
|
347
|
+
|
|
348
|
+
## Structural Metrics
|
|
349
|
+
- Circular dependencies: N
|
|
350
|
+
- Max dependency chain depth: N
|
|
351
|
+
- Coupling bottlenecks: [top 5]
|
|
352
|
+
- Complexity hotspots: [top 5]
|
|
353
|
+
- Test coverage: N%
|
|
354
|
+
- Doc coverage: N%
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Every finding includes the scip-query command that produced it.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Subagent Briefing Template
|
|
362
|
+
|
|
363
|
+
When using parallel subagents to scan different angles simultaneously:
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
## Task: Run de-bloat angle [N]
|
|
367
|
+
|
|
368
|
+
You are scanning a codebase for cleanup opportunities using scip-query.
|
|
369
|
+
|
|
370
|
+
Run the following command and analyze the results:
|
|
371
|
+
[specific scip-query command]
|
|
372
|
+
|
|
373
|
+
For each finding:
|
|
374
|
+
1. Record the symbol, file, line range, and LOC
|
|
375
|
+
2. Verify it's a true positive (not an entry point, not a test helper)
|
|
376
|
+
3. Classify: safe deletion / consolidation candidate / extraction candidate / indirection
|
|
377
|
+
4. Estimate effort: low (delete/inline) / medium (extract/refactor) / high (restructure)
|
|
378
|
+
|
|
379
|
+
Report format: one finding per line with file:line, symbol name, classification, and the scip-query command that found it.
|
|
380
|
+
|
|
381
|
+
Do NOT use grep, rg, or Read. Use only scip-query commands.
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## scip-query Quick Reference
|
|
387
|
+
|
|
388
|
+
| Angle | Command |
|
|
389
|
+
|---|---|
|
|
390
|
+
| Full health report | `scip-query health` |
|
|
391
|
+
| Dead code | `scip-query dead --min-loc 5 --skip-barrels` |
|
|
392
|
+
| Isolated symbols | `scip-query isolated --min-loc 3` |
|
|
393
|
+
| Similar functions | `scip-query similar --min-similarity 0.5` |
|
|
394
|
+
| Consolidation prescription | `scip-query convergence <a> <b>` |
|
|
395
|
+
| Similar files | `scip-query similar-files --min-similarity 0.6` |
|
|
396
|
+
| Similar chains | `scip-query similar-chains --min-similarity 0.5` |
|
|
397
|
+
| Extraction candidates | `scip-query extract-candidates --min-loc 15` |
|
|
398
|
+
| Wrappers | `scip-query wrapper-candidates --max-loc 15` |
|
|
399
|
+
| Passthroughs | `scip-query passthrough-candidates` |
|
|
400
|
+
| Stale abstractions | `scip-query stale-abstractions --min-loc 3` |
|
|
401
|
+
| Pattern drift | `scip-query drift --min-deviation 30` |
|
|
402
|
+
| Circular dependencies | `scip-query cycles` |
|
|
403
|
+
| Dependency depth | `scip-query deep-chains --min-depth 5` |
|
|
404
|
+
| Coupling pressure | `scip-query bottlenecks -n 10` |
|
|
405
|
+
| Complexity hotspots | `scip-query complexity-hotspots -n 10` |
|
|
406
|
+
| Most-referenced | `scip-query hotspots -n 10` |
|
|
407
|
+
| Test coverage | `scip-query test-coverage` |
|
|
408
|
+
| Doc coverage | `scip-query doc-coverage` |
|
|
409
|
+
| Redundant re-exports | `scip-query redundant-reexports` |
|
|
410
|
+
| Similar signatures | `scip-query similar-signatures --min-loc 5` |
|
|
411
|
+
| Read source | `scip-query code <symbol>` |
|
|
412
|
+
| Verify references | `scip-query refs <symbol>` |
|
|
413
|
+
| Check blast radius | `scip-query affected <symbol>` |
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scip-explore
|
|
3
|
+
description: Deep codebase exploration using scip-query. Trace how any system works end-to-end — call graphs, data flow, dependencies, blast radius — using compiler-resolved analysis. Use when you need to understand how something works before answering questions or making changes.
|
|
4
|
+
allowed-tools: [Bash, Write, Edit, Glob, Agent, TaskCreate, TaskUpdate, TaskGet, TaskList]
|
|
5
|
+
keywords: [explore, understand, trace, investigate, how-does, explain, architecture, flow, debug, navigate, codebase]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Codebase Exploration with scip-query
|
|
9
|
+
|
|
10
|
+
You are exploring a codebase to build a deep, accurate understanding of how a system works. Every claim must come from `scip-query` — not from memory, not from grep, not from file reads. You are producing verified knowledge about how code actually behaves, not guesses about how it might behave.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## When to Use This Skill
|
|
15
|
+
|
|
16
|
+
- "How does X work?"
|
|
17
|
+
- "What happens when a user does Y?"
|
|
18
|
+
- "Walk me through the flow from A to B"
|
|
19
|
+
- "What depends on this module?"
|
|
20
|
+
- "Is it safe to change this?"
|
|
21
|
+
- "Help me understand this codebase"
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Hard Rules
|
|
26
|
+
|
|
27
|
+
1. **Every claim must come from scip-query.** If you say "function X calls function Y," you must have run `scip-query call-graph X` or `scip-query code X` to verify it. No memory. No assumptions.
|
|
28
|
+
|
|
29
|
+
2. **Read the code.** Don't describe what a function "probably does" — run `scip-query code <symbol>` and describe what it actually does.
|
|
30
|
+
|
|
31
|
+
3. **Follow the graph, not the folder structure.** File organization can be misleading. Use `scip-query deps`, `scip-query rdeps`, `scip-query call-graph`, and `scip-query dataflow` to trace actual execution paths.
|
|
32
|
+
|
|
33
|
+
4. **Start wide, then narrow.** Begin with `scip-query system` for the module map, then drill into specific symbols with `scip-query call-graph`, `scip-query code`, and `scip-query dataflow`.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Symbol Lookup Tips
|
|
38
|
+
|
|
39
|
+
scip-query accepts partial symbol names — you don't need the full SCIP symbol path. These all work:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
scip-query code processVegaMention # just the function name
|
|
43
|
+
scip-query call-graph ChatService # just the class name
|
|
44
|
+
scip-query trace getActiveInferenceConfig # any unique substring
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Avoid parentheses** — `()` causes shell parse errors in zsh/bash:
|
|
48
|
+
```bash
|
|
49
|
+
# BAD — shell tries to execute a subshell
|
|
50
|
+
scip-query code processVegaMention()
|
|
51
|
+
|
|
52
|
+
# GOOD — no parens needed, scip-query strips them internally
|
|
53
|
+
scip-query code processVegaMention
|
|
54
|
+
|
|
55
|
+
# ALSO GOOD — single quotes protect special characters
|
|
56
|
+
scip-query code 'processVegaMention'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Read source by file + line range** when the symbol name is ambiguous:
|
|
60
|
+
```bash
|
|
61
|
+
scip-query code 'src/modules/chat/chat.service.ts:100-200'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**If "Symbol not found":**
|
|
65
|
+
1. Try a shorter/simpler name — `login` instead of `AuthService:login`
|
|
66
|
+
2. Try `scip-query symbols <file>` to see what symbols exist in the file
|
|
67
|
+
3. Try `scip-query trace <name>` which uses a different lookup path
|
|
68
|
+
4. Use the `file:line-line` syntax for `code` if you know the location
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Exploration Workflow
|
|
73
|
+
|
|
74
|
+
### Step 1: Orient — What are we looking at?
|
|
75
|
+
|
|
76
|
+
Start with the high-level map. Run these first:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
scip-query stats # How big is this codebase?
|
|
80
|
+
scip-query system <module> # Full module map: files, symbols, deps
|
|
81
|
+
scip-query symbols <entry-file> # What's in the entry point?
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Output:** List all files in the module, the key symbols, what it depends on, and what depends on it. This is your map.
|
|
85
|
+
|
|
86
|
+
### Step 2: Trace the entry point
|
|
87
|
+
|
|
88
|
+
Find where execution starts and follow it:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
scip-query call-graph <entry-symbol> # What does it call? Who calls it?
|
|
92
|
+
scip-query code <entry-symbol> # Read the actual source
|
|
93
|
+
scip-query dataflow <entry-symbol> # What data flows through it?
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For each callee, repeat: read the code, check the call graph, trace the dataflow. Build a chain from entry to leaf.
|
|
97
|
+
|
|
98
|
+
### Step 3: Map the dependencies
|
|
99
|
+
|
|
100
|
+
Understand what the system depends on and who depends on it:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
scip-query deps <file> # Forward: what does this file need?
|
|
104
|
+
scip-query rdeps <file> # Reverse: who breaks if this changes?
|
|
105
|
+
scip-query surface <module> # True public API (what consumers use)
|
|
106
|
+
scip-query affected <symbol> # Full transitive blast radius
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Step 4: Understand data flow
|
|
110
|
+
|
|
111
|
+
For each key symbol, trace how data moves through the system:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
scip-query dataflow <symbol> # Definition sites, usage sites, producers, consumers
|
|
115
|
+
scip-query slice <symbol> # Backward: what feeds into this?
|
|
116
|
+
scip-query slice <symbol> --forward # Forward: what does this feed into?
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Step 5: Assess complexity and risk
|
|
120
|
+
|
|
121
|
+
Identify the riskiest parts of the system:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
scip-query complexity <symbol> # Per-symbol: branches, cyclomatic, fan-in/out
|
|
125
|
+
scip-query complexity-hotspots # Top N most complex symbols
|
|
126
|
+
scip-query bottlenecks # Coupling pressure points
|
|
127
|
+
scip-query change-surface <file> # Per-file risk: consumers, test coverage
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Step 6: Check structural health
|
|
131
|
+
|
|
132
|
+
Look for red flags:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
scip-query cycles # Circular dependencies
|
|
136
|
+
scip-query deep-chains --min-depth 5 # How deep do dependency chains go?
|
|
137
|
+
scip-query coupling <file1> <file2> # How tightly coupled are two files?
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Answering Specific Questions
|
|
143
|
+
|
|
144
|
+
### "How does function X work?"
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
scip-query code X # Read the source
|
|
148
|
+
scip-query call-graph X # What it calls, who calls it
|
|
149
|
+
scip-query dataflow X # What data flows through it
|
|
150
|
+
scip-query complexity X # How complex is it
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### "What happens when a user does Y?"
|
|
154
|
+
|
|
155
|
+
1. Find the entry point: `scip-query files <handler-pattern>` or `scip-query symbols <route-file>`
|
|
156
|
+
2. Read the handler: `scip-query code <handler>`
|
|
157
|
+
3. Follow each call: `scip-query call-graph <callee>` → `scip-query code <callee>` → repeat
|
|
158
|
+
4. Trace the data: `scip-query dataflow <key-variable>` at each step
|
|
159
|
+
5. Map the end state: What gets written to DB? What gets sent to the client?
|
|
160
|
+
|
|
161
|
+
### "Is it safe to change X?"
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
scip-query change-surface <file> # Risk per symbol: consumers, tests
|
|
165
|
+
scip-query affected X --max-depth 3 # Full transitive blast radius
|
|
166
|
+
scip-query test-coverage X # Do tests reference this?
|
|
167
|
+
scip-query similar X # Is there duplicated logic to consolidate?
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### "What's the architecture of module X?"
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
scip-query system X # Files, symbols, deps in/out
|
|
174
|
+
scip-query deep-chains --scope X # Dependency depth within the module
|
|
175
|
+
scip-query bottlenecks --scope X # Coupling hotspots
|
|
176
|
+
scip-query cycles --scope X # Any circular deps?
|
|
177
|
+
scip-query hotspots --scope X # Most-referenced symbols
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### "How are these two things related?"
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
scip-query coupling <file1> <file2> # Shared symbols between files
|
|
184
|
+
scip-query convergence <sym1> <sym2> # How similar are two functions?
|
|
185
|
+
scip-query similar-chains # Do they share dependency paths?
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Output Format
|
|
191
|
+
|
|
192
|
+
When reporting exploration results, structure them as:
|
|
193
|
+
|
|
194
|
+
1. **Overview** — What the system is and what it does (1-3 sentences)
|
|
195
|
+
2. **Entry points** — Where execution begins (files + symbols + line numbers)
|
|
196
|
+
3. **Call flow** — Step-by-step trace from entry to leaf, with source citations
|
|
197
|
+
4. **Data flow** — What data enters, how it transforms, where it ends up
|
|
198
|
+
5. **Dependencies** — What the system depends on (with `deps` citations)
|
|
199
|
+
6. **Consumers** — What depends on this system (with `rdeps`/`surface` citations)
|
|
200
|
+
7. **Risk areas** — Complex symbols, high fan-in, missing tests (with `complexity`/`change-surface` citations)
|
|
201
|
+
|
|
202
|
+
Every file path, line number, and behavioral claim includes the scip-query command that verified it.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## scip-query Quick Reference
|
|
207
|
+
|
|
208
|
+
| Purpose | Command |
|
|
209
|
+
|---|---|
|
|
210
|
+
| Read source code | `scip-query code <symbol> [-C N]` |
|
|
211
|
+
| All symbols in a file | `scip-query symbols <file>` |
|
|
212
|
+
| Find files | `scip-query files <pattern>` |
|
|
213
|
+
| Full module map | `scip-query system <module>` |
|
|
214
|
+
| True public API | `scip-query surface <module>` |
|
|
215
|
+
| Callers + callees | `scip-query call-graph <symbol>` |
|
|
216
|
+
| Every reference | `scip-query refs <symbol>` |
|
|
217
|
+
| Definition + references | `scip-query trace <symbol>` |
|
|
218
|
+
| Forward dependencies | `scip-query deps <file>` |
|
|
219
|
+
| Reverse dependencies | `scip-query rdeps <file>` |
|
|
220
|
+
| Transitive blast radius | `scip-query affected <symbol>` |
|
|
221
|
+
| Pre-change risk briefing | `scip-query change-surface <file>` |
|
|
222
|
+
| Dataflow analysis | `scip-query dataflow <symbol>` |
|
|
223
|
+
| Backward slice | `scip-query slice <symbol>` |
|
|
224
|
+
| Forward slice | `scip-query slice <symbol> --forward` |
|
|
225
|
+
| Complexity per symbol | `scip-query complexity <symbol>` |
|
|
226
|
+
| Top complexity | `scip-query complexity-hotspots` |
|
|
227
|
+
| Coupling pressure | `scip-query bottlenecks` |
|
|
228
|
+
| Coupling between files | `scip-query coupling <file1> <file2>` |
|
|
229
|
+
| Circular dependencies | `scip-query cycles` |
|
|
230
|
+
| Dependency depth | `scip-query deep-chains` |
|
|
231
|
+
| Similar functions | `scip-query similar <symbol>` |
|
|
232
|
+
| Same-shape functions | `scip-query similar-signatures` |
|
|
233
|
+
| Test coverage | `scip-query test-coverage <symbol>` |
|
|
234
|
+
|
|
235
|
+
Full documentation: Run `scip-query --help` or read the README at the scip-query repo.
|