scip-query 0.17.2 → 0.19.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/CHANGELOG.md +25 -0
- package/README.md +3 -1
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-ATC4MEVA.js → chunk-2FAJTZSX.js} +2 -2
- package/dist/{chunk-W7FNZKX5.js → chunk-2ZNZSNVW.js} +2 -2
- package/dist/chunk-35NLDRZC.js +2 -0
- package/dist/{chunk-PQD7P6WB.js → chunk-3KQOIXLO.js} +2 -2
- package/dist/{chunk-VCRMI56V.js → chunk-3OSRXJKK.js} +2 -2
- package/dist/chunk-42QYU6FD.js +3 -0
- package/dist/{chunk-BEGHYHOQ.js → chunk-4ZCNFENR.js} +2 -2
- package/dist/{chunk-O7NA5FCA.js → chunk-4ZHJAHLE.js} +2 -2
- package/dist/chunk-547VY366.js +18 -0
- package/dist/{chunk-NX2YAXVQ.js → chunk-54UYBTZW.js} +2 -2
- package/dist/{chunk-7ROLM67J.js → chunk-6DHPQS72.js} +2 -2
- package/dist/chunk-6SHX42QQ.js +6 -0
- package/dist/{chunk-FVLZB54V.js → chunk-7EI4MU5A.js} +2 -2
- package/dist/{chunk-J7IMQRCU.js → chunk-7FG5M53V.js} +2 -2
- package/dist/chunk-A45K6VUK.js +2 -0
- package/dist/{chunk-SXDXR5FH.js → chunk-AEDB4WXE.js} +2 -2
- package/dist/{chunk-O5A7BTMA.js → chunk-AERYQJ52.js} +2 -2
- package/dist/chunk-AM2LGOEX.js +3 -0
- package/dist/{chunk-P6FOIU7O.js → chunk-AWSRND4W.js} +2 -2
- package/dist/{chunk-5GAUXLOE.js → chunk-BOXAKNN6.js} +2 -2
- package/dist/{chunk-IKMOYFUM.js → chunk-BYPVNKJT.js} +2 -2
- package/dist/chunk-DQIJMKNE.js +3 -0
- package/dist/{chunk-K65T4TJS.js → chunk-DV6B262O.js} +2 -2
- package/dist/chunk-DWN7QDTV.js +26 -0
- package/dist/{chunk-G6DDSHMD.js → chunk-EZGT3NJX.js} +2 -2
- package/dist/{chunk-MFIA6EIT.js → chunk-EZHARAL4.js} +2 -2
- package/dist/chunk-F334Z5UA.js +38 -0
- package/dist/{chunk-2A7LUMZP.js → chunk-F5L7WEZF.js} +2 -2
- package/dist/{chunk-5CJ6AQN7.js → chunk-FLIF3JWA.js} +2 -2
- package/dist/chunk-FMC3BI4I.js +2 -0
- package/dist/{chunk-YMFHC5J2.js → chunk-G6QQCX45.js} +2 -2
- package/dist/{chunk-Q4GKL4CC.js → chunk-G6RQVDTI.js} +2 -2
- package/dist/chunk-GBB2RUDN.js +927 -0
- package/dist/{chunk-LL5NQB5V.js → chunk-GJ3FR5WG.js} +2 -2
- package/dist/chunk-GMZYT44R.js +5 -0
- package/dist/{chunk-OQFPCIXO.js → chunk-GNJHHPZE.js} +2 -2
- package/dist/chunk-HOXI4F5I.js +4 -0
- package/dist/{chunk-4QBRVI7D.js → chunk-IWK562KR.js} +2 -2
- package/dist/chunk-IXORBCMR.js +120 -0
- package/dist/chunk-J3U47L4Q.js +2 -0
- package/dist/{chunk-K4XL4HOK.js → chunk-J65FQLDL.js} +2 -2
- package/dist/{chunk-45QWQSWS.js → chunk-J6BR4MD6.js} +2 -2
- package/dist/{chunk-J7WYG63U.js → chunk-JFGUBZWE.js} +2 -2
- package/dist/{chunk-BPMBOZAN.js → chunk-KD6TPIXM.js} +2 -2
- package/dist/{chunk-3M2UCPFS.js → chunk-KHE7J5ZN.js} +1 -1
- package/dist/{chunk-IG6X65MG.js → chunk-KWBA6FDD.js} +2 -2
- package/dist/{chunk-KA7RMBVU.js → chunk-LJD7V7UO.js} +2 -2
- package/dist/{chunk-ROMKXEUM.js → chunk-MDDF67O2.js} +2 -2
- package/dist/{chunk-S22ICAWV.js → chunk-MFBXBLHA.js} +2 -2
- package/dist/{chunk-A2GX3PYV.js → chunk-MTFHE7ZO.js} +2 -2
- package/dist/chunk-NEG77KKH.js +4 -0
- package/dist/{chunk-WA64GKWB.js → chunk-NH7WNNQC.js} +3 -3
- package/dist/{chunk-K3UVTL3J.js → chunk-OGHGTD6Z.js} +2 -2
- package/dist/chunk-OYYZLJVT.js +2 -0
- package/dist/{chunk-DJI446FQ.js → chunk-PAZFJMXB.js} +2 -2
- package/dist/{chunk-U244OVE6.js → chunk-PBADFBRR.js} +2 -2
- package/dist/{chunk-UWR52GNZ.js → chunk-PKAPOFF5.js} +2 -2
- package/dist/{chunk-APCXCRED.js → chunk-PXJIEMND.js} +2 -2
- package/dist/{chunk-NJD4C5G5.js → chunk-QB5WSOTY.js} +2 -2
- package/dist/{chunk-AY44MGWS.js → chunk-QHOUNTDZ.js} +2 -2
- package/dist/chunk-QN67MWDU.js +2 -0
- package/dist/{chunk-JLZUM476.js → chunk-QNMOZ3CJ.js} +2 -2
- package/dist/{chunk-AWYKDRYV.js → chunk-RIGY5DDE.js} +2 -2
- package/dist/chunk-RJLU7IMR.js +10 -0
- package/dist/{chunk-N3JH45WR.js → chunk-S65OEY2G.js} +2 -2
- package/dist/chunk-SATRCB5O.js +20 -0
- package/dist/chunk-T5CSWYAZ.js +2 -0
- package/dist/{chunk-H4T2AST4.js → chunk-TC3X33N6.js} +2 -2
- package/dist/{chunk-3CJXFMR5.js → chunk-TCVRJ56J.js} +2 -2
- package/dist/{chunk-7XP7ZRSI.js → chunk-TDGCALH6.js} +2 -2
- package/dist/chunk-TDZXQAH7.js +2 -0
- package/dist/{chunk-SUYCF4SX.js → chunk-TOYQTO44.js} +2 -2
- package/dist/chunk-UJL3N6TC.js +5 -0
- package/dist/chunk-UVMME4FI.js +16 -0
- package/dist/{chunk-6JSTKSZH.js → chunk-UXOVHGT6.js} +2 -2
- package/dist/chunk-VV5WJLRO.js +67 -0
- package/dist/{chunk-4H7T7FIM.js → chunk-WT7TOU2C.js} +2 -2
- package/dist/{chunk-4FLF7BHJ.js → chunk-X36LKKVG.js} +2 -2
- package/dist/{chunk-C7MBQSIC.js → chunk-X3OOU7CF.js} +2 -2
- package/dist/chunk-X65VYV2S.js +2 -0
- package/dist/chunk-XBN5VO53.js +2 -0
- package/dist/{chunk-TLTLJ4SW.js → chunk-XDSB47KO.js} +2 -2
- package/dist/{chunk-4L4X66GE.js → chunk-XDVT7QPG.js} +2 -2
- package/dist/chunk-XESK6725.js +2 -0
- package/dist/{chunk-OQFA2SUQ.js → chunk-XPYXEEDO.js} +2 -2
- package/dist/{chunk-T4P27T6S.js → chunk-XTSVYYAL.js} +2 -2
- package/dist/{chunk-27YDE22N.js → chunk-YBAC3RON.js} +2 -2
- package/dist/{chunk-2DBY4MO7.js → chunk-YHYTDWFT.js} +2 -2
- package/dist/chunk-YYR7ADNB.js +2 -0
- package/dist/chunk-ZL5Y23AJ.js +3 -0
- package/dist/{chunk-CMLHZWRS.js → chunk-ZNSLF5AC.js} +2 -2
- package/dist/chunk-ZXWFN7CK.js +2 -0
- package/dist/cli.js +2 -2
- package/dist/{command-descriptors-7UUURHWT.js → command-descriptors-SWFWGIFK.js} +173 -167
- package/dist/{config-types-70s7NxKB.d.ts → config-types-BA3xLCfG.d.ts} +28 -1
- package/dist/{db-BBmJ0v3b.d.ts → db-CzA-9_rL.d.ts} +6 -18
- package/dist/direct-navigation-RKMPBXMI.js +3 -0
- package/dist/{health-CWpFL_6z.d.ts → health-DYy13GAe.d.ts} +3 -1
- package/dist/index.d.ts +23 -41
- package/dist/index.js +1 -1
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/architecture.d.ts +83 -0
- package/dist/queries/architecture.js +2 -0
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +5 -3
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +27 -10
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +5 -4
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +24 -24
- package/dist/reindex.d.ts +12 -10
- package/dist/reindex.js +38 -38
- package/dist/runtime.d.ts +10 -9
- package/dist/runtime.js +2 -1
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/{scip-cli-CoMzb7Zu.d.ts → scip-cli-1bVKJgXi.d.ts} +1 -1
- package/dist/watch-server.js +7 -6
- package/docs/AI_FAILURE_MODES.md +1 -0
- package/docs/COMMAND_REFERENCE.md +4 -3
- package/docs/DETECTOR_GUIDE.md +5 -3
- package/docs/analyzer-inventory.md +16 -6
- package/docs/analyzer-validation-ledger.md +12 -1
- package/docs/architecture-coherence-vision.md +219 -0
- package/package.json +5 -1
- package/skills/_shared/SKILL.md +5 -4
- package/skills/scip-api-impact/SKILL.md +5 -1
- package/skills/scip-claim-audit/SKILL.md +1 -0
- package/skills/scip-cleanup-audit/SKILL.md +4 -0
- package/skills/scip-concrete-plan/SKILL.md +129 -48
- package/skills/scip-conductor/SKILL.md +1 -1
- package/skills/scip-debug/SKILL.md +6 -1
- package/skills/scip-directory-architecture/SKILL.md +116 -2
- package/skills/scip-explore/SKILL.md +2 -1
- package/skills/scip-integrity-audit/SKILL.md +17 -0
- package/skills/scip-maintainability/SKILL.md +9 -4
- package/skills/scip-query/SKILL.md +4 -1
- package/skills/scip-root-cause/SKILL.md +150 -0
- package/skills/scip-root-cause/agents/openai.yaml +4 -0
- package/skills/scip-tla-model-system/SKILL.md +7 -9
- package/skills/scip-twin-drift/SKILL.md +1 -1
- package/skills/scip-verify/SKILL.md +20 -3
- package/dist/chunk-6AITNECC.js +0 -928
- package/dist/chunk-7LERNHDG.js +0 -5
- package/dist/chunk-7VR5TNOI.js +0 -2
- package/dist/chunk-CHJ3QROR.js +0 -2
- package/dist/chunk-CVWX24IY.js +0 -2
- package/dist/chunk-ELLPMCWA.js +0 -3
- package/dist/chunk-IS7DZ7TB.js +0 -2
- package/dist/chunk-K53GNKY3.js +0 -2
- package/dist/chunk-KJOKTZUE.js +0 -2
- package/dist/chunk-KSD6IWF4.js +0 -38
- package/dist/chunk-LEKXKHIQ.js +0 -5
- package/dist/chunk-LFPQFRCX.js +0 -26
- package/dist/chunk-MBVHEPHQ.js +0 -16
- package/dist/chunk-NJTIAQY7.js +0 -3
- package/dist/chunk-OINSINYW.js +0 -2
- package/dist/chunk-QEIGJJBC.js +0 -20
- package/dist/chunk-RUQE7DZT.js +0 -2
- package/dist/chunk-RUV4KHWA.js +0 -2
- package/dist/chunk-SALRDXWM.js +0 -121
- package/dist/chunk-SMBIGBGN.js +0 -67
- package/dist/chunk-SON6DQNK.js +0 -7
- package/dist/chunk-SSGACGAD.js +0 -3
- package/dist/chunk-TFWDJDGO.js +0 -2
- package/dist/chunk-U4G4UYLB.js +0 -2
- package/dist/chunk-WD3PAQJT.js +0 -10
- package/dist/chunk-XLJORP6N.js +0 -4
- package/dist/chunk-XTF6ELXT.js +0 -3
- package/dist/chunk-YYYERNQL.js +0 -18
- package/dist/chunk-Z4MCFCGX.js +0 -3
- package/dist/direct-navigation-CVCFER5G.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ All notable changes to `scip-query` are documented here. This file starts at 0.1
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.19.0]
|
|
8
|
+
|
|
9
|
+
### Architecture coherence
|
|
10
|
+
|
|
11
|
+
- New `architecture` query and CLI command evaluates compiler-resolved imports and reexports against a declared layer policy, reporting forbidden, undeclared, reciprocal, and cyclic dependencies with machine-readable evidence.
|
|
12
|
+
- Architecture policy can require complete file classification and an acyclic layer graph. `diff-gate` now ratchets architecture findings so changed code cannot introduce new boundary violations.
|
|
13
|
+
- The scip-query repository now enforces a complete 14-layer target architecture: all source files are classified, every allowed relationship is explicit, and architectural cycles and implicit dependencies are rejected.
|
|
14
|
+
|
|
15
|
+
### Internal boundaries
|
|
16
|
+
|
|
17
|
+
- Project inputs, indexer toolchains, cache layout, watcher state, file resolution, and semantic evidence now have focused domain, platform, source, query, and symbol contracts instead of depending on mixed runtime or resolution modules.
|
|
18
|
+
- Git worktree-aware watcher behavior and shared-generation cache reuse retain their existing operational contracts while their host mechanisms move behind the platform boundary.
|
|
19
|
+
- Architecture guidance, planning records, command documentation, skills, tests, and committed outcome/suppression records now describe and protect the target structure.
|
|
20
|
+
|
|
21
|
+
## [0.18.0]
|
|
22
|
+
|
|
23
|
+
### Skills (semiformal reasoning certificates)
|
|
24
|
+
|
|
25
|
+
- The skill suite now enforces a semiformal certificate discipline calibrated against a 14-ticket plan→implement→review retrospective: `scip-concrete-plan` produces contextual definitions, numbered premises with complete state-authority writer/reader enumeration, counterexample attacks with permanent `HOLE`/`HELD` outcomes, a coverage matrix, per-step deployability declarations, and a derived verdict with hole counts. `scip-verify` refutes a PASS with executed probes before claiming it; `scip-debug` requires a rival hypothesis and an executed discriminator for cross-file root causes; `scip-integrity-audit` attempts the defense before filing an accusation and derives a counted verdict; `scip-maintainability` requires a unifying definition plus a strongest-dissenter check before consolidation; `scip-cleanup-audit` refutes deletions against known blind spots; `scip-claim-audit` and `scip-api-impact` gain completeness counts and consumer disposition tables; `scip-explore` distinguishes descriptions (citations) from conclusions (discriminators).
|
|
26
|
+
- New skill `scip-root-cause`: diagnose the design flaw behind a family of recurring bugs — source-traced bug-family table, falsifiable flaw hypothesis with a rival kill-list, retrodiction plus executed latent-instance hunts, and a four-rung minimal-invasiveness remedy ladder that hands off to `scip-concrete-plan`.
|
|
27
|
+
|
|
28
|
+
### Fixes (Windows indexer spawn)
|
|
29
|
+
|
|
30
|
+
- Language indexers no longer fail with `spawn EFTYPE` on Windows. Resolved `.js`/`.cjs`/`.mjs` bin targets (the bundled `@sourcegraph/scip-typescript` bin) now run through the current Node executable, Windows binary resolution only accepts real `.exe`/`.com` executables from `where` (npm's `.cmd`/sh shims fall through to the bundled bin), and npm auto-install runs through the shell on Windows. Mechanism-verified with unit tests and a macOS smoke run; not yet confirmed on a Windows machine.
|
|
31
|
+
|
|
7
32
|
## [0.17.2]
|
|
8
33
|
|
|
9
34
|
### Performance (agent command latency)
|
package/README.md
CHANGED
|
@@ -213,6 +213,7 @@ When verification _fails_, the errors name the exact references the static evide
|
|
|
213
213
|
| `co-change-partner` | Historically coupled files that usually change together but are missing from this diff. | Default diff gate. |
|
|
214
214
|
| `twin-partner` | A changed symbol has a same-(near-)name twin (identical or already-divergent) elsewhere that this diff left untouched. | Default diff gate. Advisory: findings print but never cause a nonzero exit by themselves. |
|
|
215
215
|
| `coverage-contract` | A configured `coverageContracts` entry (.scipquery.json) drifted: its declared key set no longer matches its ground-truth source. | Default diff gate, only when either side of a configured contract changed. |
|
|
216
|
+
| `architecture` | A declared architecture boundary rule has a violation absent from the committed health baseline. | Default diff gate when closed dependency rows, requireCompletePolicy, or requireAcyclic are configured and a baseline exists. |
|
|
216
217
|
| `doc-reference` | Docs that cite changed files and may need a matching update. Dated snapshot docs (docs.snapshotPaths) are excluded by policy. | Default diff gate. Advisory (21.2) for bare file-mention citations; blocking when the citation has a line anchor or the cited file was deleted/renamed. |
|
|
217
218
|
| `unused-params` | Fresh trailing parameters or options that no changed body uses. | Default diff gate. |
|
|
218
219
|
| `new-dead` | Changed production symbols with zero indexed consumers. | Default diff gate. |
|
|
@@ -318,6 +319,7 @@ One-line "essential difference" per skill — read this table before the Routes
|
|
|
318
319
|
| `scip-concrete-plan` | Specify ONE change so an executor can't guess. |
|
|
319
320
|
| `scip-conductor` | Run a multi-phase program (delegate, verify handoffs, pre-registered benchmarks). |
|
|
320
321
|
| `scip-debug` | Root-cause a failure. |
|
|
322
|
+
| `scip-root-cause` | Diagnose the design flaw behind a family of recurring bugs. |
|
|
321
323
|
| `scip-triage-issue` | Package a report into an actionable issue+fix plan. |
|
|
322
324
|
| `scip-verify` | Post-change closeout gate. |
|
|
323
325
|
| `scip-cleanup-audit` | Rank findings, no edits. |
|
|
@@ -340,7 +342,7 @@ One-line "essential difference" per skill — read this table before the Routes
|
|
|
340
342
|
| `scip-setup` | Adopt or repair scip-query in a repo. |
|
|
341
343
|
| `_shared` | Reference loaded by other skills, not user-invoked. |
|
|
342
344
|
|
|
343
|
-
The confusable clusters, disambiguated: `scip-concrete-plan` (one change) vs `scip-conductor` (a program of changes with delegation); `scip-cleanup-audit` (report only) vs `scip-cleanup-improve` (autonomous fixing loop); `scip-verify` (did this specific change land safely) vs `scip-integrity-audit` (does this code actually work at all) vs `scip-maintainability` (is this well organized) vs `scip-twin-drift` (one drifted same-name pair specifically); `scip-directory-architecture` (folder ownership) vs `scip-maintainability` (deeper structural compression). `skills/scip-query/SKILL.md`'s Tie-Breaks section has the full routing logic.
|
|
345
|
+
The confusable clusters, disambiguated: `scip-debug` (one failure, one minimal fix) vs `scip-root-cause` (a family of recurring bugs traced to a design flaw); `scip-concrete-plan` (one change) vs `scip-conductor` (a program of changes with delegation); `scip-cleanup-audit` (report only) vs `scip-cleanup-improve` (autonomous fixing loop); `scip-verify` (did this specific change land safely) vs `scip-integrity-audit` (does this code actually work at all) vs `scip-maintainability` (is this well organized) vs `scip-twin-drift` (one drifted same-name pair specifically); `scip-directory-architecture` (folder ownership) vs `scip-maintainability` (deeper structural compression). `skills/scip-query/SKILL.md`'s Tie-Breaks section has the full routing logic.
|
|
344
346
|
|
|
345
347
|
Project setup writes reviewable checkout-local lifecycle hooks for Codex and Claude Code (`.codex/hooks.json` and `.claude/settings.local.json`). A checkout-local hook is an agent-tool preference whose defining trait is that it applies to one clone rather than expressing team policy. Setup adds both paths to that clone's `.git/info/exclude`, so they do not appear in commits, and refuses to rewrite either path if it is already tracked. `setup-hooks --shared` remains accepted only as a deprecated compatibility flag; it no longer writes `.claude/settings.json`. These hooks add scip-query context at session start, route prompts toward the right skill, and run an advisory Stop-hook wrapper around the diff gate only for that repository. The Stop hook sends feedback to the agent by default instead of blocking; set `SCIP_QUERY_STOP_HOOK_MODE=warn` for a warning-only hook response, or `SCIP_QUERY_STOP_HOOK_MODE=block` to enforce the gate. Set `SCIP_QUERY_SKIP_HOOK_INSTALL=1` or run `scip-query setup --no-hooks` to skip hook installation during setup, and run `scip-query setup-hooks --json` later to repair the current checkout's hooks.
|
|
346
348
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as t}from"./chunk-
|
|
1
|
+
import{c as t}from"./chunk-XDVT7QPG.js";import"./chunk-VV5WJLRO.js";import{writeFileSync as o}from"fs";import{workerData as s}from"worker_threads";var e=s;try{let r=t({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles,tasks:e.tasks});o(e.resultPath,JSON.stringify({ok:!0,result:r}))}catch(r){o(e.resultPath,JSON.stringify({ok:!1,error:r instanceof Error?r.message:String(r)}))}finally{let r=new Int32Array(e.sharedBuffer);Atomics.add(r,0,1),Atomics.notify(r,0)}
|
|
2
2
|
//# sourceMappingURL=augment-vue-worker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as A}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as A}from"./chunk-X3OOU7CF.js";import{a as _}from"./chunk-IWK562KR.js";import{f as R,g as L}from"./chunk-AERYQJ52.js";import{a as E}from"./chunk-ZXWFN7CK.js";import{f as x,g as I}from"./chunk-FLIF3JWA.js";import{b as D}from"./chunk-B75HZHUP.js";import{a as w}from"./chunk-BGBBVSH4.js";import{d as N}from"./chunk-TDGCALH6.js";import{b as T,c as h}from"./chunk-QNMOZ3CJ.js";import{y as S}from"./chunk-M2TRDR25.js";import{a as g}from"./chunk-64MNV6AB.js";var F={caller:3,"entry-surface":2,rooted:1},O=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,P=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,C=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,v=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,K=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function et(e,n={}){let{scope:o,limit:r=30,scanLimit:l,semantic:a=!0}=n,s=new E(e),t=D(s.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),c=[];for(let i of t){let m=M(e,i);m&&c.push(m)}if(c.length===0)return[];let d=j(e,c,t),f=c.filter(i=>!d.has(i.def.symbol));if(f.length===0)return[];let p=_(e,s).forDefinitions(f.map(i=>i.def),{semantic:a}),u=[];for(let i of f){let b=p.get(i.def.symbolId)?.realConsumers.length??0,y=B(e,i.def,b);y&&u.push({symbol:i.def.symbol,shortName:N(i.def.symbol),file:i.def.relativePath,startLine:i.def.startLine,endLine:i.def.endLine,loc:w(i.def),stubKind:i.stubKind,reachability:y,callerFanIn:b,stubText:i.stubText})}return u.sort((i,m)=>F[m.reachability]-F[i.reachability]||m.callerFanIn-i.callerFanIn||i.file.localeCompare(m.file)||i.startLine-m.startLine),r?u.slice(0,r):u}function B(e,n,o){return o>0?"caller":I(e,n.symbol,n.relativePath)?"rooted":x(e,n.relativePath)?"entry-surface":null}function M(e,n){let o=R(e,n);if(!o)return null;let r=L(o),l=r.trim();if(l==="")return!z(o)||!A(e,n)?null:{def:n,stubKind:"empty-body",stubText:"(empty body)"};let a=h(r),s=T(r),t=$(a,s);if(t.length!==1)return null;let c=t[0];return U(c)?{def:n,stubKind:"throw-stub",stubText:c.trim()}:v.test(r)&&C.test(c.trim())?{def:n,stubKind:"todo-return-default",stubText:l}:null}function $(e,n){let o=[],r=0,l="";for(let a=0;a<n.length;a+=1){let s=n[a];if(s==="("||s==="["||s==="{"?r+=1:(s===")"||s==="]"||s==="}")&&(r=Math.max(0,r-1)),s===";"&&r===0){o.push(l),l="";continue}l+=e[a]??""}return l.trim()&&o.push(l),o.map(a=>a.trim()).filter(a=>a.length>0)}function U(e){let n=P.exec(e.trim());return n?O.test(n[1]??""):!1}function z(e){return K.test(e.trimEnd())}function j(e,n,o){let r=new Set,l=new Set(n.map(t=>t.def.parentTypeName).filter(t=>t!==null));if(l.size===0)return r;let a=k(e,l),s=new Map;for(let t of o){if(!t.parentTypeName)continue;let c=s.get(t.leaf)??new Set;c.add(t.parentTypeName),s.set(t.leaf,c)}for(let t of n){let c=t.def.parentTypeName;if(!c)continue;let d=a.get(c);if(!d||d.size===0)continue;let f=s.get(t.def.leaf)??new Set;[...d].every(u=>f.has(u))&&r.add(t.def.symbol)}return r}var Y=/\bclass\s+([A-Za-z_$][\w$]*)\s+extends\s+([A-Za-z_$][\w$]*)/g;function k(e,n){let o=new Map;for(let r of g(e,{includeIgnored:!1})){let l=S(e,r);if(l)for(let a of l.matchAll(Y)){let s=a[1],t=a[2];if(!s||!t||!n.has(t))continue;let c=o.get(t)??new Set;c.add(s),o.set(t,c)}}return o}export{et as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2FAJTZSX.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-DV6B262O.js";import{a as d}from"./chunk-ZXWFN7CK.js";import{j as c}from"./chunk-QB5WSOTY.js";import{d as u}from"./chunk-TDGCALH6.js";function L(e,n,i={}){let t=f(e,n);if(!t)return null;let r=h(e,t);if(!r||e.isIgnored(r.relative_path))return null;let s=[],m=0,l=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,l);for(let o of l){let a=S(e,r,o,p.get(o.symbolId)??new Set);m+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:b(a)})}return{file:r.relative_path,symbols:s,totalExternalConsumers:m}}function h(e,n){return e.get(`SELECT id, relative_path FROM documents
|
|
2
2
|
WHERE relative_path = ?
|
|
3
3
|
${e.pathExclusionsFor("documents")}
|
|
4
4
|
LIMIT 1`,n)??null}function g(e,n){return new d(e).definitionsForFile(n).sort((i,t)=>i.startLine-t.startLine||i.endLine-t.endLine)}function S(e,n,i,t){let r=e.all(`SELECT DISTINCT consumer_d.relative_path
|
|
@@ -8,4 +8,4 @@ import{a as f}from"./chunk-K65T4TJS.js";import{a as d}from"./chunk-RUV4KHWA.js";
|
|
|
8
8
|
WHERE m.symbol_id = ?
|
|
9
9
|
AND m.role != 1
|
|
10
10
|
AND c.document_id != ?`,i.symbolId,n.id);return new Set([...r.map(s=>s.relative_path),...[...t].filter(s=>s!==n.relative_path)]).size}function b(e){return e>10?"high":e>0?"medium":"low"}export{L as a};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-2ZNZSNVW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function N(h){let u=new Map,r=[],d=new Map,t=new Map,i=new Set,a=[],s=0,g=o=>(h.get(o)??[]).values();for(let o of h.keys()){if(d.has(o))continue;let l=[];for(d.set(o,s),t.set(o,s),s+=1,a.push(o),i.add(o),l.push({node:o,iter:g(o),pendingChild:null});l.length>0;){let e=l[l.length-1];if(e.pendingChild!==null){let c=e.pendingChild;e.pendingChild=null,t.set(e.node,Math.min(t.get(e.node),t.get(c)))}let m=e.iter.next();if(m.done){if(t.get(e.node)===d.get(e.node)){let c=[];for(;;){let p=a.pop();if(i.delete(p),c.push(p),u.set(p,r.length),p===e.node)break}r.push(c)}l.pop();continue}let n=m.value;d.has(n)?i.has(n)&&t.set(e.node,Math.min(t.get(e.node),d.get(n))):(d.set(n,s),t.set(n,s),s+=1,a.push(n),i.add(n),e.pendingChild=n,l.push({node:n,iter:g(n),pendingChild:null}))}}return{components:r,componentOf:u}}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-35NLDRZC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f}from"./chunk-ZXWFN7CK.js";import{a as L}from"./chunk-UXOVHGT6.js";import{d as i,e as b,f as u,l as c}from"./chunk-TDGCALH6.js";import{f as l}from"./chunk-QNMOZ3CJ.js";import{B as a}from"./chunk-XDSB47KO.js";function S(o,s){let t=L(o,s);if(!t)return[];let e=new f(o).definitionsForFile(t.relativePath).filter(r=>r.symbol!==t.symbol).filter(r=>c(t.symbol,r.symbol)).sort((r,m)=>r.startLine-m.startLine||r.endLine-m.endLine).map(r=>({symbol:r.symbol,shortName:i(r.symbol),startLine:r.startLine,endLine:r.endLine,kind:u(r.symbol)??"unknown"}));return a(t.relativePath)!=="clojure"?e:d(e,y(o,t))}function y(o,s){let t=b(s.symbol);if(!t)return[];let n=i(s.symbol);return(l(o,s.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({symbol:`${s.symbol}${e.memberName}().`,shortName:`${n}:${e.memberName}()`,startLine:e.startLine,endLine:e.endLine,kind:e.memberKind}))}function d(o,s){let t=new Map;for(let n of[...o,...s])t.set(`${n.shortName}:${n.startLine}:${n.endLine}`,n);return[...t.values()].sort((n,e)=>n.startLine-e.startLine||n.endLine-e.endLine)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3KQOIXLO.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as d,t as p}from"./chunk-
|
|
1
|
+
import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as d,t as p}from"./chunk-TDGCALH6.js";import{a as c}from"./chunk-64MNV6AB.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
|
|
2
2
|
FROM defn_enclosing_ranges der
|
|
3
3
|
JOIN global_symbols gs ON der.symbol_id = gs.id
|
|
4
4
|
JOIN documents d ON der.document_id = d.id
|
|
@@ -20,4 +20,4 @@ import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as
|
|
|
20
20
|
${n.symbolNoiseFor("gs")}
|
|
21
21
|
AND d.relative_path IN (${i})
|
|
22
22
|
ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...e))}return t}function N(n){let s=[];for(let t=0;t<n.length;t+=_)s.push(n.slice(t,t+_));return s}function R(n){return{symbol:n.symbol,kind:n.kind,documentation:n.documentation,enclosing_symbol:n.enclosingSymbol,relative_path:n.relativePath,start_line:n.startLine,end_line:n.endLine}}function k(n){return n.kind!==null&&n.kind!==0?D(n.kind,n.symbol,n.documentation):C(n.symbol,n.documentation,n.enclosing_symbol)}function D(n,s,t){let e=(t??"").toLowerCase();if(d(s)==="type"){if(e.includes("type "))return o.TypeAlias;if(e.includes("interface "))return o.Interface;if(e.includes("struct "))return o.Struct;if(e.includes("trait "))return o.Trait;if(e.includes("class "))return o.Class}return n}function C(n,s,t){let e=f(n);if("kind"in e)return null;let i=e.descriptors,l=i[i.length-2]??null,u=d(n),r=(s??"").toLowerCase();return u==="type"?r.includes("type ")?o.TypeAlias:r.includes("interface ")?o.Interface:r.includes("struct ")?o.Struct:r.includes("trait ")?o.Trait:r.includes("class ")?o.Class:o.Class:u==="method"?l?.suffix==="type"?o.Method:o.Function:u==="namespace"?o.Module:u!=="term"?null:r.includes("async def ")||r.includes("def ")?o.Function:(t?d(t):l?.suffix??null)==="type"?o.Field:o.Variable}export{v as a,T as b};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-3OSRXJKK.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as Re}from"./chunk-KD6TPIXM.js";import{a as Fe}from"./chunk-7EI4MU5A.js";import{a as se,b as F,e as ae}from"./chunk-KWBA6FDD.js";import{a as fe,c as ue,d as he,e as v}from"./chunk-YHYTDWFT.js";import{a as De}from"./chunk-MFBXBLHA.js";import{a as ke}from"./chunk-WT7TOU2C.js";import{a as ve}from"./chunk-C2QSK7E7.js";import{a as Se}from"./chunk-X3OOU7CF.js";import{a as Ce}from"./chunk-J65FQLDL.js";import{a as ye}from"./chunk-547VY366.js";import{a as be}from"./chunk-QHOUNTDZ.js";import{a as ge}from"./chunk-YBAC3RON.js";import{b as de}from"./chunk-7FG5M53V.js";import{a as ce,b as le}from"./chunk-AERYQJ52.js";import{a as ne,b as oe,c as re,g as L,h as _}from"./chunk-PAZFJMXB.js";import{b as me}from"./chunk-AM2LGOEX.js";import{a as P,c as ee,d as te,e as ie}from"./chunk-RIGY5DDE.js";import{a as Q}from"./chunk-4XTPZ5CR.js";import{a as $e,e as we}from"./chunk-UJL3N6TC.js";import{a as j,c as H,d as z,e as pe}from"./chunk-J3U47L4Q.js";import{a as Z}from"./chunk-ZXWFN7CK.js";import{f as x,g as G}from"./chunk-FLIF3JWA.js";import{e as X}from"./chunk-UVMME4FI.js";import{e as R,f as Y,g as M}from"./chunk-TDGCALH6.js";import{a as V}from"./chunk-QNMOZ3CJ.js";import{e as W}from"./chunk-XDSB47KO.js";import{s as J}from"./chunk-M2TRDR25.js";import{createHash as st}from"crypto";import{existsSync as K}from"fs";function O(e){let[t,i]=T(e,":"),o=t||"unknown",n=(a={})=>{let s=a.actionTier??Ue(o);return{sourceAnalyzer:o,actionTier:s,rootCauseKey:a.rootCauseKey??(i||e),label:a.label??`${o} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??qe(s,o),file:a.file}};if(!i)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(o)){let[a,s]=T(i,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:i,label:`${o} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(o==="cycle"){let a=i.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:i,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(o==="similar"){let a=i.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:i,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(o==="architecture"){let[a,s]=T(i,":");if(a==="forbidden-edge"){let[c,l]=T(s,":"),r=N(c),f=N(l);return n({actionTier:"direct",rootCauseKey:i,label:"architecture boundary violation",why:[`Declared boundary rule rejects ${r} -> ${f}.`],remediation:`Move the dependency behind an allowed boundary, or deliberately update the ${r} dependency rule and baseline.`})}if(a==="cycle"){let c=s.split("|").filter(Boolean).map(N);return n({actionTier:"direct",rootCauseKey:i,label:"forbidden architecture cycle",why:[`requireAcyclic rejects the connected boundary group: ${c.join(", ")}.`],remediation:"Break the boundary cycle, or deliberately revise the acyclicity rule and baseline."})}if(a==="missing-policy-row"){let c=N(s);return n({actionTier:"direct",rootCauseKey:i,label:"incomplete architecture policy",why:[`requireCompletePolicy rejects the missing outgoing dependency row for ${c}.`],remediation:`Declare the allowed outgoing dependencies for ${c}, including an empty row when it must depend on nothing.`})}}if(o==="drift"){let[a,s]=T(i,":"),[c,l]=T(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,l].filter(Boolean))],rootCauseKey:i,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...l?[`Related dependency: ${l}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Ue(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":case"architecture":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function qe(e,t){return e==="direct"?`Fix the new ${t} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${t} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function T(e,t){let i=e.indexOf(t);return i<0?[e,""]:[e.slice(0,i),e.slice(i+t.length)]}function N(e){try{return decodeURIComponent(e)}catch{return e}}import{existsSync as Te,readFileSync as Ae,writeFileSync as We}from"fs";import{isAbsolute as Je,join as Ve}from"path";var Ye=25e3,Xe=2500,Ze=2500;function Qe(e){let t=ve(e);return t.symbols>=Ye||t.documents>=Xe?Ze:void 0}var et=".scipquery-baseline.json";function A(e,t){return t&&Je(t)?t:Ve(e.config.projectRoot,t??et)}function xe(e,t={}){let{scope:i}=t,o=Qe(e),n=[],a=me(e,{scope:i,...v.dead,scanLimit:o});for(let s of a.symbols)x(e,s.relativePath)||G(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of Ce(e,{scope:i,...v.isolated,scanLimit:o}))x(e,s.relativePath)||G(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of ge(e,{scope:i}))s.kind==="real"&&n.push(`cycle:${tt(s.path)}`);for(let s of we(e,{scope:i,...v.similar,scanLimit:o}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of ce(e,{scope:i,...v.duplicateBodies,scanLimit:o}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(c=>c.symbol).sort().join("|")}`);for(let s of be(e,{scope:i,...v.extract,scanLimit:o}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of De(e,{scope:i,...v.wrappers,scanLimit:o}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of Se(e,{scope:i,...v.passthroughs,scanLimit:o}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of ke(e,{scope:i,...v.stale,scanLimit:o}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of ye(e,{scope:i,...v.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)s.kind!=="architecture-violation"&&n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return n.push(...z(H(e,{scope:i}))),[...new Set(n)].sort()}function tt(e){if(e.length===0)return"";let t=0;for(let i=1;i<e.length;i++)e[i]<e[t]&&(t=i);return[...e.slice(t),...e.slice(0,t)].join(">")}function ei(e,t={}){let i=xe(e,{scope:t.scope}),o=A(e,t.path);return We(o,JSON.stringify({version:1,findings:i},null,2)+`
|
|
2
|
+
`),{path:o,findingCount:i.length}}function Ge(e,t={}){let i=A(e,t.path);if(!Te(i))throw new Error(`No baseline found at ${i}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(Ae(i,"utf-8")),n=new Set(o.findings??[]),a=xe(e,{scope:t.scope}),s=new Set(a);return{baselinePath:i,baselineCount:n.size,current:a,newFindings:a.filter(c=>!n.has(c)),fixedFindings:[...n].filter(c=>!s.has(c))}}function Ee(e,t={}){let i=A(e,t.path);if(!Te(i))throw new Error(`No baseline found at ${i}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(Ae(i,"utf-8")),n=new Set((o.findings??[]).filter(c=>c.startsWith(j))),a=z(H(e,{scope:t.scope})),s=new Set(a);return{baselinePath:i,baselineCount:n.size,current:a,newFindings:a.filter(c=>!n.has(c)),fixedFindings:[...n].filter(c=>!s.has(c))}}import{existsSync as it,mkdirSync as ni,readdirSync as nt,readFileSync as ot,writeFileSync as oi}from"fs";import{createHash as si}from"crypto";import{join as U}from"path";var E=U(".scipquery","suppressions");function rt(e){return U(e,E)}function Ie(e){let t=rt(e);if(!it(t))return{suppressions:[],warnings:[]};let i=[],o=[];for(let n of nt(t).sort()){if(!n.endsWith(".json"))continue;let a=U(t,n),s;try{s=JSON.parse(ot(a,"utf-8"))}catch{o.push(`${E}/${n}: malformed JSON \u2014 ignored`);continue}if(typeof s!="object"||s===null||Array.isArray(s)){o.push(`${E}/${n}: not a suppression object \u2014 ignored`);continue}let c=s;if(typeof c.reason!="string"||c.reason.trim()===""){o.push(`${E}/${n}: missing reason \u2014 ignored`);continue}if(!c.id&&!c.check){o.push(`${E}/${n}: needs an id or a check \u2014 ignored`);continue}i.push(c)}return{suppressions:i,warnings:o}}var Ii=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","architecture","doc-reference","unused-params","new-dead","baseline"];function ji(e,t={}){let i=t.base??"HEAD",{minTogether:o=6,minConfidence:n=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:s=Number.POSITIVE_INFINITY,minSimilarity:c=.8,includeBaseline:l=!1,scanLimit:r}=t,f=t.semantic!==!1,p=t.historyMode??"bounded",u=new Set(t.skip??[]),h=re(e,{base:i}),m=oe(e,{base:i,plan:h}),y=m.changedFiles,S=new Set(y),d=new Set(h.changedFileLines),w=new Set([...S,...d]),$=L(e.config.projectRoot,i,_(h,y)),C=It(e.config.projectRoot,i,h,$),g={base:i,changedFiles:y,changedSymbols:m.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:m.attributionNotes,rootCauseGroups:[],note:m.summary.note};if(y.length===0)return g;let k=(I,_e)=>{if(u.has(I)){g.skipped.push({check:I,reason:"skipped via --skip"});return}let He=g.findings.length,ze=g.skipped.length,Oe=g.checksRun.length;J(`diff-gate.check.${I}`,_e,()=>({check:I,changedFiles:y.length,changedSymbols:m.changedSymbols.length,findingsAdded:g.findings.length-He,skippedAdded:g.skipped.length-ze,checksRunAdded:g.checksRun.length-Oe}))};return k("echo",()=>dt(e,m.changedSymbols,S,C,a,c,r,f,g)),k("incomplete-migration",()=>mt(e,i,h,s,r,f,$,g)),k("co-change-partner",()=>yt(e,w,o,n,p,g)),k("twin-partner",()=>bt(e,m.changedSymbols,S,r,g)),k("coverage-contract",()=>Ct(e,w,g)),k("architecture",()=>Bt(e,g)),k("doc-reference",()=>vt(e,S,d,h.changedRanges,h.renamedFiles,g)),k("unused-params",()=>Tt(e,y,g)),k("new-dead",()=>At(e,m.changedSymbols,C,g)),l&&k("baseline",()=>Nt(e,g)),ct(g,[...e.config.suppressions??[],...Ie(e.config.projectRoot).suppressions]),g.rootCauseGroups=at(g.findings),g}function Ni(e){return e.checksRun.length===0&&e.note===ne}function Bi(e){return e.filter(t=>!t.advisory)}function at(e){let t=new Map;for(let i of e){let o=i.groupKey??`${i.check}:${i.id}`,n=t.get(o);n||(n={groupKey:o,check:i.check,severity:i.severity,actionTier:i.actionTier,sourceAnalyzer:i.sourceAnalyzer,rootCauseKey:i.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:i.message,remediation:i.remediation},t.set(o,n)),n.count+=1,n.findingIds.push(i.id),n.severity=Pe(n.severity,i.severity),n.actionTier=Le(n.actionTier,i.actionTier),i.file&&n.files.add(i.file);for(let a of i.relatedFiles??[])n.relatedFiles.add(a)}return[...t.values()].map(i=>({...i,files:[...i.files].sort(),relatedFiles:[...i.relatedFiles].sort()})).sort((i,o)=>o.count-i.count||B(o.severity)-B(i.severity)||i.groupKey.localeCompare(o.groupKey))}function Pe(e,t){return B(t)>B(e)?t:e}function B(e){return e==="error"?2:e==="warning"?1:0}function Le(e,t){return e?t&&je(t)>je(e)?t:e:t}function je(e){return e==="direct"?2:e==="signal"?1:0}function ct(e,t){if(t.length===0||e.findings.length===0)return;let i=[];for(let o of e.findings){let n=t.find(a=>lt(a,o));n?e.suppressed.push({finding:o,suppression:n}):i.push(o)}e.findings=i}function lt(e,t){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==t.id&&!t.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==t.check||e.file&&e.file!==t.file?!1:!!(e.id||e.check)}function D(e,t){e.findings.push({...t,suppressionHint:`scip-query: ignore ${t.check} ${t.id} -- <reason>`})}function dt(e,t,i,o,n,a,s,c,l){l.checksRun.push("echo");for(let r of t.slice(0,n)){if(!M(r.symbol)||o(r))continue;let f=le(e,r.symbol,{maxLoc:15,scanLimit:s}).filter(d=>!i.has(d.file)).slice(0,5).map(d=>({otherFile:d.file,otherShort:d.shortName,otherSymbol:d.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${d.loc} LOC)`]}));if(f.length>0){let d=b("echo",r.symbol,r.file),w=b("echo",r.symbol,r.file,...f.map(C=>`${C.otherSymbol}|${C.otherFile}`).sort()),$=f[0];D(l,{id:d,legacySuppressionIds:w===d?void 0:[w],groupKey:d,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(f.map(C=>C.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${r.symbol}:${$.otherSymbol}`,message:Be(r,f),why:Ke(r,f),remediation:Me("direct",r.shortName,$.otherShort)});continue}let p=$e(e,r.symbol,{minSimilarity:a,limit:5,scanLimit:s,semantic:c,sourceCandidateMode:"target-pruned"}),u=[];for(let d of p){let w=d.fileA===r.file?d.fileB:d.fileA,$=d.fileA===r.file?d.shortNameB:d.shortNameA,C=d.fileA===r.file?d.symbolB:d.symbolA;i.has(w)||u.push({otherFile:w,otherShort:$,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(u.length===0)continue;let h=u[0],m=b("echo",r.symbol,r.file,...u.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),y=b("echo",r.symbol,r.file),S=ft(r,u);D(l,{id:y,legacySuppressionIds:m===y?void 0:[m],groupKey:y,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:h.similarity,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(u.map(d=>d.otherFile))].sort(),message:Be(r,u),why:Ke(r,u),remediation:Me(S,r.shortName,h.otherShort)})}t.length>n&&l.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${t.length} changed symbols`})}function ft(e,t){return t.some(o=>ut(e.symbol,o))?"direct":"signal"}function ut(e,t){if(t.similarityBasis==="exact-body")return!0;if(t.similarityBasis!=="source-tokens"||t.similarity<.98||t.sharedEvidence.length>8)return!1;let i=R(e),o=R(t.otherSymbol);return!i||!o?!1:i===o?!0:pt(t.sharedEvidence)?!1:ht(i,o)}function ht(e,t){let i=Ne(e),o=Ne(t);if(i.length===0||o.length===0)return!1;let n=new Set(o),a=i.filter(s=>n.has(s)).length;return a>=2&&a/Math.min(i.length,o.length)>=.5}function Ne(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}var gt=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function pt(e){return e.length>=3&&e.every(t=>gt.has(t.toLowerCase()))}function Be(e,t){let i=t[0],o=Math.round(i.similarity*100);return t.length===1?`${e.shortName} (${e.file}) is ${o}% similar to established ${i.otherShort} (${i.otherFile})`:`${e.shortName} (${e.file}) resembles ${t.length} established symbol(s); strongest is ${o}% similar to ${i.otherShort} (${i.otherFile})`}function Ke(e,t){let i=[`${e.shortName} was changed in this diff.`];for(let o of t.slice(0,3))i.push(`${o.otherShort} is outside this diff and scored ${Math.round(o.similarity*100)}% similar by ${o.similarityBasis} evidence.`),i.push(`Shared evidence: ${o.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return t.length>3&&i.push(`${t.length-3} additional similar match(es) grouped into this finding.`),i}function Me(e,t,i){return e==="direct"?`Extract or reuse the shared behavior with ${i}, or keep the duplicate with a suppression reason.`:`Review whether ${t} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function mt(e,t,i,o,n,a,s,c){let l=Fe(e,{base:t,maxHelpers:o,diffPlan:i,scanLimit:n,semantic:a,baseContentAt:s});if(!l.available){c.skipped.push({check:"incomplete-migration",reason:"no git history"});return}c.checksRun.push("incomplete-migration"),l.note&&c.skipped.push({check:"incomplete-migration",reason:l.note});for(let r of l.findings){let f=r.leftovers.map(d=>`${d.shortName} (${d.file}, ${Math.round(d.containment*100)}% helper / ${Math.round(d.siteCoverage*100)}% site, ${d.migrationScope})`).join(", "),p=r.leftovers.map(d=>`${d.shortName}: ${d.migrationScope} (${d.migrationScopeReasons[0]})`).join("; "),u=[...r.migratedFiles,...r.leftovers.map(d=>d.file)],h=r.leftovers.length===0?void 0:Math.max(...r.leftovers.map(d=>Math.min(d.containment,d.siteCoverage))),m=r.leftovers.some(d=>d.migrationScope==="possible-subtype"),y=b("incomplete-migration",r.helperSymbol,r.helperFile,u.join("|")),S=b("incomplete-migration",r.helperSymbol,r.helperFile);D(c,{id:S,legacySuppressionIds:y===S?void 0:[y],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:h,file:r.helperFile,symbol:r.helperSymbol,relatedFiles:u,message:`new helper ${r.helperShortName} (${r.helperFile}) is wired into ${r.migratedFiles.length} file(s), but ${r.leftovers.length} similar un-migrated site(s) remain: ${f}`,why:[`${r.helperShortName} is new in this diff and already referenced by ${r.migratedFiles.join(", ")}.`,`Helper shape: ${r.helperShape}; ${r.specificHelperCalleeCount}/${r.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${f}.`,`Migration scope hints: ${p}.`],remediation:m?`Migrate same-scope sites to ${r.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${r.helperShortName}, or confirm they are intentionally different.`})}}function yt(e,t,i,o,n,a){let s=Q(e,{historyMode:n}).directionalCoChangePairsForFiles(t,{minTogether:i,minConfidence:0,maxFilesPerCommit:20});if(!s){a.skipped.push({check:"co-change-partner",reason:"no git history"});return}a.checksRun.push("co-change-partner");let c=new Set,l;for(let r of s){let f=t.has(r.fileA),p=t.has(r.fileB);if(f===p)continue;let u=f?r.fileA:r.fileB,h=f?r.fileB:r.fileA,m=f?r.changesA:r.changesB,y=m>0?r.together/m:0;if(y<o||P(h)||P(u)||!K(`${e.config.projectRoot}/${h}`))continue;let S=`${u}|${h}`;if(c.has(S))continue;c.add(S);let d=b("co-change-partner",u,h,String(r.together)),w=b("co-change-partner",u,h),$=ee(u,h),C=te({fileA:u,fileB:h,together:r.together,confidence:y,commitScope:r.commitScope,recency:r.recency,subjectContext:r.subjectContext},$,(l??=ie(e))(u,h)),g=[u,h].sort().join("|");a.findings.push({id:w,legacySuppressionIds:d===w?void 0:[d],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${g}`,confidence:y,file:u,relatedFiles:[h],sourceAnalyzer:"co-change",rootCauseKey:g,partnerClass:$.partnerClass,partnerClassReasons:$.reasons,commitScope:r.commitScope,recency:r.recency,focusedTogether:r.focusedTogether,broadTogether:r.broadTogether,broadCommitRatio:r.broadCommitRatio,lastTogetherAt:r.lastTogetherAt,recentTogether:r.recentTogether,subjectContext:r.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${h} did not \u2014 they change together ${r.together}x (${Math.round(y*100)}% of the time)`,why:[`${u} is in this diff and ${h} is not.`,`Git history shows ${r.together} co-change(s), which is ${Math.round(y*100)}% of changes to the edited side.`,`History context: ${St(r)}.`,`Subject context: ${$t(r.subjectContext)}.`,...wt(r),`Partner class: ${$.partnerClass} (${$.reasons.join("; ")}).`],remediation:C?`Update ${h} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${h} alongside this change, or confirm the coupling no longer holds.`})}}function bt(e,t,i,o,n){n.checksRun.push("twin-partner");let a=de(e,{scanLimit:o}).filter(l=>l.relationship==="divergent"||l.relationship==="identical");if(a.length===0)return;let s=new Map;for(let l of a)for(let r of l.members)s.set(r.symbol,l);let c=new Set;for(let l of t){if(!M(l.symbol))continue;let r=s.get(l.symbol);if(!r)continue;let f=r.members.filter(m=>m.symbol!==l.symbol&&!i.has(m.file));if(f.length===0)continue;let p=[l.symbol,...f.map(m=>m.symbol)].sort().join("|");if(c.has(p))continue;c.add(p);let u=f[0],h=b("twin-partner",l.symbol,l.file,u.symbol);D(n,{id:h,groupKey:`twin-partner:${p}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:r.relationship==="identical"?1:Math.max(0,1-r.maxDivergence),file:l.file,symbol:l.symbol,relatedFiles:f.map(m=>m.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:p,message:`${l.shortName} (${l.file}) changed but its same-name twin ${u.shortName} (${u.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${l.symbol} is in this diff.`,`${u.symbol} shares its (near-)name and is classified '${r.relationship}' with it, but ${u.file} is not in this diff.`,r.relationship==="divergent"?`The two bodies already diverge (~${Math.round(r.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${u.file} alongside this change, consolidate ${l.shortName}/${u.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function Ct(e,t,i){i.checksRun.push("coverage-contract");let o=e.config.coverageContracts??[];for(let n of o){if(!ue(n,t))continue;let a=fe(e,n);if(a.status==="ok")continue;let s=b("coverage-contract",n.name,n.file);D(i,{id:s,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:a.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:he(a),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,a.status==="unavailable"?`The declared side could not be evaluated: ${a.unavailableReason}.`:`Missing: ${a.missing.join(", ")||"none"}. Extra: ${a.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:a.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function St(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${kt(e.lastTogetherAt)}`}function $t(e){let t=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",i=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",o=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${t}; refs ${i}; samples ${o}; external issue/PR labels ${e.externalIssueLabelStatus}`}function wt(e){let t=[];return e.commitScope==="broad-sweep"&&t.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&t.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),t}function kt(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var q=3;function vt(e,t,i,o,n,a){a.checksRun.push("doc-reference");let s=F.referenceTargets(e,t,o);if(s.size===0)return;let c=new Set(n.map(r=>r.from)),l=[];for(let r of ae(e,s))i.has(r.doc)||se(e,r.doc)||l.push(Dt(e,r,c));for(let r of Ft(l))D(a,r)}function Dt(e,t,i){let o=t.citedClaims.length>0?t.citedClaims:F.citationContexts(e,t.doc,t.cited),n=F.classifyCitation(o),a=F.hasLineAnchoredCitation(t.citations),s=t.cited.some(p=>i.has(p)||!K(`${e.config.projectRoot}/${p}`)),c=!(a||s),l=t.cited[0]??"",r=b("doc-reference",t.doc,t.cited.join("|")),f=b("doc-reference",t.doc,l);return{id:f,legacySuppressionIds:r===f?void 0:[r],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${l}`,rootCauseKey:l,confidence:1,file:t.doc,relatedFiles:t.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:o,...c?{advisory:!0}:{},message:`${t.doc} cites ${t.cited.join(", ")} as ${F.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${t.cited.join(", ")} changed in this diff.`,`${t.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(p=>`Citation kind evidence: ${p}`),c?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":a?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:F.citationRemediation(n.citationKind,t.doc)}}function Ft(e){let t=new Map;for(let o of e){let n=o.rootCauseKey??"",a=t.get(n);a?a.push(o):t.set(n,[o])}let i=[];for(let[o,n]of t)n.length<=q?i.push(...n):i.push(Rt(o,n));return i}function Rt(e,t){let i=[...t].sort((f,p)=>(f.file??"").localeCompare(p.file??"")),o=i.slice(0,q).map(f=>({doc:f.file??"",citedClaims:f.citedClaims??[]})),n=i.length-o.length,a=i.every(f=>f.advisory===!0),s=i.reduce((f,p)=>Pe(f,p.severity),"info"),c=i.reduce((f,p)=>Le(f,p.actionTier),void 0),l=i.map(f=>f.file??"").filter(f=>f.length>0),r=[...new Set(i.flatMap(f=>[f.id,...f.legacySuppressionIds??[]]))];return{id:b("doc-reference","hub-cluster",e),memberFindingIds:r,check:"doc-reference",severity:s,evidence:"change-graph",actionTier:c,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:o[0]?.doc,relatedFiles:[e],citationCount:i.length,citationExemplars:o,suppressedCount:n,...a?{advisory:!0}:{},message:`${e} is cited by ${i.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${o.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${i.length} doc(s) cite it but were not updated in the same diff: ${l.join(", ")}.`,...o.map(f=>`Example \u2014 ${f.doc}: ${f.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${q}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,a?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${o.length} example doc(s) above; ${i.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function Tt(e,t,i){i.checksRun.push("unused-params");for(let o of Re(e,{files:t,limit:50})){let n=b("unused-params",o.symbol,o.file,o.unusedTrailing.join("|")),a=b("unused-params",o.symbol,o.file);D(i,{id:a,legacySuppressionIds:n===a?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:o.file,startLine:o.startLine,endLine:o.endLine,symbol:o.symbol,message:`${o.shortName} (${o.file}) has trailing unused parameter(s): ${o.unusedTrailing.join(", ")}`,why:[`${o.shortName} is in a changed file.`,`The trailing parameter(s) ${o.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function At(e,t,i,o){o.checksRun.push("new-dead");let n=new Z(e),a=W(e.config.projectRoot),s=a.length>1;for(let c of t){if(i(c)||c.fanIn>0||n.fileKind(c.file)==="test"||x(e,c.file)||G(e,c.symbol,c.file)||Et(c.symbol))continue;let l=b("new-dead",c.symbol,c.file),r=s&&xt(a,c.file)&&Gt(e,c.symbol);D(o,{id:l,check:"new-dead",severity:"warning",evidence:r?"heuristic":"graph-fact",confidence:r?.4:.9,file:c.file,symbol:c.symbol,message:r?`${c.shortName} (${c.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${c.shortName} (${c.file}) was changed but has zero indexed consumers`,why:r?[`${c.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${c.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:r?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function xt(e,t){return e.some(i=>t===i.relativeDir||t.startsWith(`${i.relativeDir}/`))}function Gt(e,t){let i=R(t);return i?(X(e).get(i)?.length??0)>1:!1}function Et(e){if(Y(e)!=="type")return!1;let t=R(e);return t.startsWith("_Assert")||t.startsWith("Assert")}function It(e,t,i,o){let n=new Map(i.renamedFiles.map(s=>[s.to,s.from])),a=o??L(e,t,_(i));return s=>{let c=n.get(s.file)??s.file,l=R(s.symbol);if(!l)return!1;let r=a(c);return r!==null&&jt(r,l)}}function jt(e,t){return new RegExp(`\\b${V(t)}\\b`).test(e)}function Nt(e,t){if(!K(A(e))){t.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("baseline");let i=Ge(e);for(let o of i.newFindings.filter(n=>!n.startsWith(j))){let n=O(o),a=b("baseline",o);D(t,{id:a,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${o}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function Bt(e,t){if(!pe(e.config.architecture)){t.skipped.push({check:"architecture",reason:"no closed architecture dependency rows, requireCompletePolicy rule, or requireAcyclic rule configured"});return}if(!K(A(e))){t.skipped.push({check:"architecture",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("architecture");let i=Ee(e);for(let o of i.newFindings){let n=O(o),a=b("architecture",o);D(t,{id:a,groupKey:`architecture:${n.rootCauseKey}`,check:"architecture",severity:"error",evidence:"baseline",actionTier:"direct",confidence:1,sourceAnalyzer:"architecture",rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${o}`,why:["The project declares an enforceable architecture rule.","The current boundary graph contains a violation not present in the committed baseline.",...n.why],remediation:n.remediation})}}function b(e,...t){return`SQ${st("sha256").update([e,...t].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{xe as a,ei as b,Ge as c,Ii as d,ji as e,Ni as f,Bi as g,It as h};
|
|
3
|
+
//# sourceMappingURL=chunk-42QYU6FD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f}from"./chunk-ZXWFN7CK.js";import{a as h}from"./chunk-UXOVHGT6.js";import{e as s,g as u}from"./chunk-TDGCALH6.js";import{f as d}from"./chunk-QNMOZ3CJ.js";import{B as c}from"./chunk-XDSB47KO.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4ZCNFENR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as l}from"./chunk-
|
|
1
|
+
import{b as l}from"./chunk-DV6B262O.js";import{a}from"./chunk-ZXWFN7CK.js";import{d as i,g as n}from"./chunk-TDGCALH6.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-K65T4TJS.js";import{a}from"./chunk-RUV4KHWA.js";impor
|
|
|
26
26
|
AND ${e.localSymbolPredicate}
|
|
27
27
|
${e.pathExclusionsFor("d1")}
|
|
28
28
|
ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-4ZHJAHLE.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{c as S}from"./chunk-J3U47L4Q.js";import{a as m}from"./chunk-ZXWFN7CK.js";import{b as h}from"./chunk-FLIF3JWA.js";import{h as y}from"./chunk-QB5WSOTY.js";import{p}from"./chunk-QNMOZ3CJ.js";import{a as g}from"./chunk-64MNV6AB.js";import f from"path";function W(e,t){let{scope:i,minDeviation:r=5,limit:n=50}=t??{},a=t?.semantic!==!1,u=t?.includePatternDeviations===!0,o=new m(e).fileDependencyGraph(i),l=S(e,{scope:i}),c=x([...D(e,o,{scope:i,semantic:a}),...R(l.forbiddenEdges),...u?E(o,r):[]]);return t?.includeArchitecture===!0&&(c.architecture=l),n<=0||c.results.length<=n?c:{...c,results:c.results.slice(0,n),totalResults:c.results.length}}function D(e,t,i){let r=_(e,i.scope),n=[],a=new Set;for(let[s,o]of t){if(d(s))continue;let l=r.get(s)??new Set;for(let c of o)d(c)||l.has(c)||v(e,s,c,i)||(n.push({file:s,dep:c}),a.add(s))}a.size>0&&w(e,r,{paths:[...a]});let u=[];for(let{file:s,dep:o}of n)(r.get(s)??new Set).has(o)||u.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${s} to ${o}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return u}function v(e,t,i,r){return C(e,t,i)||M(e,t,i)||O(i)||P(e,t,i)||N(i)?!0:r.semantic&&A(e,t,i)}function R(e){return e.flatMap(t=>{let i=t.examples[0];return i?[{file:i.fromFile,kind:"architecture-violation",description:`${t.from} depends on forbidden boundary ${t.to} through ${t.fileEdgeCount} file edge(s)`,dep:i.toFile,detail:`${t.from} may not depend on ${t.to}`,actionTier:"direct",policyBasis:"explicit",architecture:{fromBoundary:t.from,toBoundary:t.to,fileEdgeCount:t.fileEdgeCount,importerCount:t.importerCount,importedFileCount:t.importedFileCount,examples:t.examples},evidenceReasons:[`configured dependency row for ${t.from} does not allow ${t.to}`,`${t.fileEdgeCount} file edge(s) connect ${t.importerCount} importer(s) to ${t.importedFileCount} imported file(s)`,...t.examples.map(r=>`${r.fromFile} imports ${r.toFile}`)],recommendation:"Move the dependency behind an allowed boundary, reverse the dependency through an owned interface, or deliberately update the project architecture rule."}]:[]})}function E(e,t){let i=[];for(let[r,n]of k(e)){let a=n.filter(s=>!d(s));if(a.length<t)continue;let u=I(e,a);for(let s of a)for(let o of e.get(s)??[])d(o)||(u.get(o)??0)===1&&f.dirname(o)!==r&&f.dirname(o)!==f.dirname(r)&&i.push({file:s,kind:"pattern-deviation",description:`Only file in ${r}/ that depends on ${o}`,dep:o,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${r}/ were compared`,`${s} is the only non-skipped sibling depending on ${o}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."})}return i}function x(e){let t=e.filter(i=>i.kind==="architecture-violation").length;return{results:e,unusedImports:e.filter(i=>i.kind==="unused-import").length,architectureViolations:t,layerViolations:t,patternDeviations:e.filter(i=>i.kind==="pattern-deviation").length}}function k(e){let t=new Map;for(let i of e.keys()){let r=f.dirname(i),n=t.get(r);n||(n=[],t.set(r,n)),n.push(i)}return t}function I(e,t){let i=new Map;for(let r of t)for(let n of e.get(r)??[])d(n)||i.set(n,(i.get(n)??0)+1);return i}function _(e,t){let i=new Map;return $(e,i,t),i}function $(e,t,i){for(let r of F(e,i))b(e,t,r.from_file,r.to_file)}function F(e,t){let i=t?"AND d1.relative_path LIKE ?":"",r=t?[`%${t}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents d1 ON c.document_id = d1.id
|
|
5
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
+
JOIN (
|
|
7
|
+
SELECT m2.symbol_id, c2.document_id
|
|
8
|
+
FROM mentions m2
|
|
9
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
10
|
+
WHERE m2.role = 1
|
|
11
|
+
GROUP BY m2.symbol_id
|
|
12
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
13
|
+
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
14
|
+
WHERE d1.id != d2.id
|
|
15
|
+
AND m.role != 1
|
|
16
|
+
${e.pathExclusionsFor("d1","d2")}
|
|
17
|
+
${i}`,...r)}function w(e,t,i={}){new m(e).scanSourceReferences({paths:i.paths??g(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},n=>{n.target.relativePath!==n.sourceFile&&(e.isIgnored(n.target.relativePath)||b(e,t,n.sourceFile,n.target.relativePath))})}function b(e,t,i,r){if(e.isIgnored(i)||e.isIgnored(r))return;let n=t.get(i);n||(n=new Set,t.set(i,n)),n.add(r)}function O(e){return e.includes("types")||e.endsWith(".d.ts")}function A(e,t,i){let r=y(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.some(n=>n.isUsed)}function C(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.some(n=>n.used)}function M(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.every(n=>n.isTypeOnly===!0)}function N(e){return e.endsWith(".vue")}function P(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length===0?!1:r.every(n=>n.kind==="side-effect"||n.kind==="namespace"&&n.usedMembers.length===0&&!n.used)}function d(e){let t=h(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||T(f.basename(e)))}function T(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{W as a};
|
|
18
|
+
//# sourceMappingURL=chunk-547VY366.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-DV6B262O.js";function _(e,n,d){let i=r(e,n)??n,o=r(e,d)??d,t=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
WHERE (
|
|
4
4
|
-- Defined in file1, referenced in file2
|
|
@@ -53,4 +53,4 @@ import{a as r}from"./chunk-K65T4TJS.js";function _(e,n,d){let i=r(e,n)??n,o=r(e,
|
|
|
53
53
|
GROUP BY def_d.id, ref_d.id
|
|
54
54
|
ORDER BY shared DESC
|
|
55
55
|
LIMIT ?`,...t,d).filter(s=>!e.isIgnored(s.file1)&&!e.isIgnored(s.file2)).map(s=>c(s.file1,s.file2,s.shared))}function c(e,n,d){return{file1:e,file2:n,sharedSymbols:d,actionTier:"signal",couplingKind:"shared-symbol-coupling",evidenceReasons:[`${d} symbol(s) are defined in one file and referenced by the other`],recommendation:"Review whether the shared symbol surface is an intentional boundary or hidden coordination pressure before moving code."}}export{_ as a,a as b};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
//# sourceMappingURL=chunk-54UYBTZW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-DV6B262O.js";import{x as o}from"./chunk-TDGCALH6.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
|
|
2
2
|
WHERE relative_path IN (${d})
|
|
3
3
|
ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
|
|
4
4
|
FROM mentions m
|
|
@@ -32,4 +32,4 @@ import{b as m}from"./chunk-K65T4TJS.js";import{x as o}from"./chunk-7XP7ZRSI.js";
|
|
|
32
32
|
WHERE d2.relative_path IN (${d})
|
|
33
33
|
AND d1.relative_path NOT IN (${d})
|
|
34
34
|
ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{h as a};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-6DHPQS72.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as t}from"./chunk-ZL5Y23AJ.js";import{execFileSync as a}from"child_process";import{createRequire as S}from"module";import{existsSync as y}from"fs";import{platform as s,arch as g}from"os";var f="v0.8.1",l="https://github.com/sourcegraph/scip",h="SCIP_QUERY_SCIP_BIN";function x(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let r=e.env[h];if(r&&e.fileExists(r))return{source:"env",path:r};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function C(e){let r=S(import.meta.url);for(let n of e==="arm64"?["arm64","x64"]:[e])try{return r.resolve(`scip-query-scip-windows/scip-win32-${n}.exe`)}catch{}return null}function m(e=process.env){return x({platform:s(),arch:g(),env:e,isOnPath:t,fileExists:y,resolveSidecar:C})?.path??null}function N(){return m()!==null}function O(){let e=m();if(!e)return null;try{return a(e,["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function P(){let e=s(),r=g(),n,o,c;switch(e){case"darwin":n="darwin",c="tar.gz";break;case"linux":n="linux",c="tar.gz";break;default:return null}switch(r){case"arm64":o="arm64";break;case"x64":o="amd64";break;default:return null}let u=`scip-${n}-${o}.${c}`;return{url:`${l}/releases/download/${f}/${u}`,filename:u}}function j(){let e=P();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),s()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
|
|
2
|
+
`),console.log("Or download manually:")):s()==="win32"?(console.log("On Windows the scip binary ships via the npm sidecar package scip-query-scip-windows,"),console.log("installed automatically with scip-query. If it is missing:"),console.log(" npm install -g scip-query-scip-windows"),console.log(`Or set ${h} to a local scip.exe path.
|
|
3
|
+
`),console.log("Upstream release page:")):console.log("Download from:"),console.log(e?` ${e.url}
|
|
4
|
+
`:` ${l}/releases/tag/${f}
|
|
5
|
+
`),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function L(e){if(s()==="darwin"&&t("brew")){e("Installing scip CLI via Homebrew...");try{if(a("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(r){let n=r instanceof Error?r.message:String(r);e(`Homebrew install failed: ${n}`)}}if(t("go")){e("Installing scip CLI via go install...");try{if(a("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(r){let n=r instanceof Error?r.message:String(r);e(`go install failed: ${n}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${l}/releases`),!1}import{createHash as w}from"crypto";import{mkdirSync as I,realpathSync as b}from"fs";import{homedir as E}from"os";import{join as i,resolve as d}from"path";function _(e,r){let n=process.env.SCIP_QUERY_CACHE_DIR;if(n)return p(n);if(r?.dbPath)return p(d(e,r.dbPath));let o=R(e);return p(o)}function v(){let e=process.env.XDG_CACHE_HOME;return i(e||i(E(),".cache"),"scip-query")}function R(e){let r=d(e);try{r=b(r)}catch{}let n=w("sha256").update(r).digest("hex").slice(0,12);return i(v(),"projects",n)}function J(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);return i(v(),"repositories",e)}function T(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function z(e,r){let n=_(e,r);return{cacheDir:n,dbPath:i(n,"index.db"),indexPath:i(n,"index.scip"),metaPath:i(n,"meta.json")}}function p(e){return I(e,{recursive:!0}),e}export{m as a,N as b,O as c,j as d,L as e,R as f,J as g,T as h,z as i};
|
|
6
|
+
//# sourceMappingURL=chunk-6SHX42QQ.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as T,c as E,g as L,h as D}from"./chunk-
|
|
1
|
+
import{a as T,c as E,g as L,h as D}from"./chunk-PAZFJMXB.js";import{j as O,o as A}from"./chunk-UJL3N6TC.js";import{d as H}from"./chunk-KMVGRIO2.js";import{a as _}from"./chunk-ZXWFN7CK.js";import{d as C,e as F}from"./chunk-TDGCALH6.js";import{a as w}from"./chunk-QNMOZ3CJ.js";var J=5;function ae(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??E(e,{base:a}),l={available:s.note!==T,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new _(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),j=t.baseContentAt??L(e.config.projectRoot,a,D(s)),h=Z(x,k,$,j);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let q=x.calleeMap(R,{semantic:f}),B=R.map(i=>({def:i,callees:A((q.get(i.symbolId)??[]).map(p=>p.symbol))})),V=O(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of B){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=G(),N=Y(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Q(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=K({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>z(S.migrationScope)-z(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,J)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function K(e){let t=[],a=U(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=H(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=W(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function z(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function W(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!X.has(t))}function Y(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function Z(e,t,a,o){return e.productionCallableDefinitions({files:[...t],requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${w(r.leaf)}\\b`).test(c)})}function Q(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
5
5
|
WHERE m.symbol_id = ?
|
|
6
6
|
AND m.role != 1
|
|
7
7
|
${e.pathExclusionsFor("ref_d")}`,t).map(o=>o.relative_path)}export{ae as a};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-7EI4MU5A.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as B,g as S}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{f as B,g as S}from"./chunk-AERYQJ52.js";import{b as L,c as k}from"./chunk-FLIF3JWA.js";import{b as O}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-BGBBVSH4.js";import{d as P}from"./chunk-MTDBHTSF.js";import{d as I,g as z,j as D,t as $}from"./chunk-TDGCALH6.js";import{b as T,k as v,p as A}from"./chunk-QNMOZ3CJ.js";import{c as b}from"./chunk-XDSB47KO.js";import{C as _,s as p}from"./chunk-M2TRDR25.js";var U=new Set(P());function $e(e,t={}){let{includeHomonyms:n=!1,limit:i}=t,s=X(e,t).filter(r=>r.relationship==="divergent"||n&&r.relationship==="homonym");return i?s.slice(0,i):s}function X(e,t={}){let{scope:n,minSimilarity:i=.3,scanLimit:s}=t,r=Q(e,{scope:n,scanLimit:s});return Y(r,{minSimilarity:i,isDelegatePair:De(e)}).filter(a=>!a.members.some(o=>_(e,o.file,o.startLine,"twin")))}function Y(e,t={}){let n=t.minSimilarity??.3,i=t.isDelegatePair,s=e.filter(c=>!V(c.leaf)&&!fe(c.leaf)&&L(c.file)!=="test"&&!D(c.symbol)&&!Z(c.symbol)&&!j(c.symbol,c.leaf)),{recordsByLeaf:r,recordOrder:a}=p("twin-drift.group-by-leaf",()=>q(s),()=>({records:s.length})),o=p("twin-drift.cluster-leaf-names",()=>W([...r.keys()]),()=>({leaves:r.size}));return p("twin-drift.compare-clusters",()=>{let c=[];for(let h of o){let u=J(h,r,a);if(u.length<2||new Set(u.map(f=>f.file)).size<2)continue;let m=null,R=!1,C=!1,y=new Set;for(let f=0;f<u.length;f+=1)for(let w=f+1;w<u.length;w+=1){let d=u[f],g=u[w];if(d.file===g.file||!ge(d,g)||i?.(d,g,u)||i?.(g,d,u))continue;if(R=!0,y.add(d.symbol),y.add(g.symbol),d.normalizedBody===g.normalizedBody){C=!0;continue}let M=oe(d.tokens,g.tokens);(!m||M>m.similarity)&&(m={a:d,b:g,similarity:M})}if(!R)continue;let x=u.filter(f=>y.has(f.symbol)).sort((f,w)=>f.file.localeCompare(w.file)||f.startLine-w.startLine).map(se);if(!m){c.push({leaf:G(h),relationship:C?"identical":"homonym",maxDivergence:0,members:x});continue}let N=m.similarity>=n?"divergent":"homonym";c.push({leaf:G(h),relationship:N,maxDivergence:Math.round((1-m.similarity)*1e3)/1e3,members:x,...N==="divergent"?{firstDivergentTokens:ae(m.a.tokens,m.b.tokens)}:{}})}return c},()=>({clusters:o.length,records:s.length})).sort((c,h)=>h.members.length-c.members.length||h.maxDivergence-c.maxDivergence||c.leaf.localeCompare(h.leaf))}function q(e){let t=new Map,n=new Map;for(let[i,s]of e.entries()){let r=t.get(s.leaf)??[];r.push(s),t.set(s.leaf,r),n.set(s,i)}return{recordsByLeaf:t,recordOrder:n}}function J(e,t,n){let i=[...e].flatMap(s=>t.get(s)??[]);return e.size>1&&i.sort((s,r)=>(n.get(s)??0)-(n.get(r)??0)),i}function Q(e,t){let n=p("twin-drift.load-definitions",()=>$(e,{scope:t.scope}).filter(r=>ee(r)&&!e.isIgnored(r.relativePath)).filter(r=>!k(r.relativePath)));p("twin-drift.sort-definitions",()=>n.sort((r,a)=>r.relativePath.localeCompare(a.relativePath)||r.startLine-a.startLine),()=>({definitions:n.length}));let i=O(n,t.scanLimit),s=p("twin-drift.select-candidates",()=>te(i),()=>({scanned:i.length}));return p("twin-drift.build-records",()=>{let r=[];for(let a of s){let o=ne(e,a);o&&r.push(o)}return r},()=>({candidates:s.length,scanned:i.length}))}function ee(e){return e.isFunctionLike?e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&U.has(e.kind):!0:!1}function te(e){let t=e.filter(r=>r.leaf&&!V(r.leaf)&&!D(r.symbol)&&!Z(r.symbol)&&!j(r.symbol,r.leaf)),n=new Map;for(let r of t){let a=n.get(r.leaf)??[];a.push(r),n.set(r.leaf,a)}let i=W([...n.keys()]),s=new Set;for(let r of i){let a=[...r].flatMap(o=>n.get(o)??[]);if(!(a.length<2)&&!(new Set(a.map(o=>o.relativePath)).size<2)&&!a.every(o=>L(o.relativePath)==="test"))for(let o of a)s.add(o)}return e.filter(r=>s.has(r))}function ne(e,t){if(!t.leaf)return null;let n=B(e,t);if(!n||!z(t.symbol)&&!re(n,t.leaf))return null;let i=T(S(n)),s=i.replace(/\s+/g,"");if(!s||s.length<8)return null;let r=i.match(ie)??[];return r.length===0?null:{leaf:t.leaf,symbol:t.symbol,shortName:I(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:E(t),normalizedBody:s,tokens:r,isThinForwarder:H(i)}}function re(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`\\b(?:const|let|var)\\s+${n}(?:\\s*:[^=]+)?\\s*=\\s*(?:async\\s*)?(?:\\([^)]*\\)|[A-Za-z_$][\\w$]*)\\s*=>`,"s").test(e)}var ie=/[A-Za-z_$][A-Za-z0-9_$]*|\d+(?:\.\d+)?|[^\sA-Za-z0-9_$]/g;function se(e){return{symbol:e.symbol,shortName:e.shortName,file:e.file,startLine:e.startLine,endLine:e.endLine,loc:e.loc}}function oe(e,t){let n=new Set(e),i=new Set(t);if(n.size===0&&i.size===0)return 1;if(n.size===0||i.size===0)return 0;let s=0;for(let a of n)i.has(a)&&(s+=1);let r=n.size+i.size-s;return r===0?0:s/r}function ae(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;let s=e.slice(i,i+6).join(" "),r=t.slice(i,i+6).join(" ");return!s&&!r?"(bodies differ only in trailing length)":`A: ${s||"(end)"} | B: ${r||"(end)"}`}function W(e){let t=new Map;for(let a of e)t.set(a,a);let n=a=>{let o=a;for(;t.get(o)!==o;)o=t.get(o);let l=a;for(;t.get(l)!==o;){let c=t.get(l);t.set(l,o),l=c}return o},i=(a,o)=>{let l=n(a),c=n(o);l!==c&&t.set(l,c)},s=new Map;for(let a of e){let o=a.slice(0,2).toLowerCase(),l=s.get(o)??[];l.push(a),s.set(o,l)}for(let a of s.values())for(let o=0;o<a.length;o+=1)for(let l=o+1;l<a.length;l+=1)le(a[o],a[l])&&i(a[o],a[l]);let r=new Map;for(let a of e){let o=n(a),l=r.get(o)??new Set;l.add(a),r.set(o,l)}return[...r.values()]}function le(e,t){return e===t||e.toLowerCase()===t.toLowerCase()?!0:e.length<8||t.length<8||Math.abs(e.length-t.length)>2||ce(e.toLowerCase(),t.toLowerCase())/Math.max(e.length,t.length)<.8?!1:pe(e.toLowerCase(),t.toLowerCase(),2)}function ce(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;return i}function fe(e){return/^[A-Z][A-Z0-9_]*$/.test(e)||/^__[^_].*__$/.test(e)||ue.has(e.toLowerCase())}var ue=new Set(["main","row"]),me=new Set(["app","component","components","feature","features","impl","index","lib","route","routes","shared","src","tsx","typescript","ui"]);function Z(e){return e.startsWith("rust-analyzer ")&&/\/(?:tests?|benches?)\//.test(e)}var de=new Set(["default","new","reset"]);function j(e,t){return e.startsWith("rust-analyzer ")&&de.has(t.toLowerCase())}function ge(e,t){if(e.leaf.toLowerCase()!==t.leaf.toLowerCase()||e.leaf.length>4)return!0;let n=F(e);return[...F(t)].some(i=>n.has(i))}function F(e){let t=e.leaf.toLowerCase();return new Set(`${e.file}/${e.shortName}`.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>2&&n!==t&&!me.has(n)))}function pe(e,t,n){if(Math.abs(e.length-t.length)>n)return!1;let i=Array.from({length:t.length+1},(s,r)=>r);for(let s=1;s<=e.length;s+=1){let r=[s],a=r[0];for(let o=1;o<=t.length;o+=1){let l=e[s-1]===t[o-1]?0:1,c=Math.min(i[o]+1,r[o-1]+1,i[o-1]+l);r.push(c),a=Math.min(a,c)}if(a>n)return!1;i=r}return i[t.length]<=n}function ke(e){return H(T(S(e)))}function H(e){let t=e.trim();if(!t||he.test(t))return!1;let n=be(t);return n.length===0||n.length>2?!1:ye(n[n.length-1])}var he=/\b(?:if|else|for|while|switch|try|catch|do)\b/,we=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[[^[\]]*\])*\((?:[^()]|\([^()]*\))*\)$/;function ye(e){let t=e.trim().replace(/^return\s+/,"").replace(/^await\s+/,"").replace(/;\s*$/,"").trim();return we.test(t)}function be(e){let t=[],n=0,i="";for(let s of e){if(s==="("||s==="["||s==="{"?n+=1:(s===")"||s==="]"||s==="}")&&(n=Math.max(0,n-1)),s===";"&&n===0){t.push(i),i="";continue}i+=s}return i.trim()&&t.push(i),t.map(s=>s.trim()).filter(s=>s.length>0)}var Te=3;function De(e){let t=new Map;return(n,i,s)=>{if(!n.isThinForwarder)return!1;let r=`${n.symbol}\0${i.symbol}`,a=t.get(r);if(a!==void 0)return a;let o=K(e,n,i,s,Te,new Set);return t.set(r,o),o}}function K(e,t,n,i,s,r){if(s<=0||r.has(t.symbol)||(r.add(t.symbol),(v(e,t.file)??[]).filter(l=>l.line>=t.startLine&&l.line<=t.endLine&&l.calleeLeaf===n.leaf).length===0))return!1;let o=new Set(A(e,t.file).filter(l=>l.sourcePath&&(l.kind!=="namespace"||l.usedMembers.includes(n.leaf))).map(l=>l.sourcePath));if([...o].some(l=>b(l,n.file)))return!0;for(let l of i)if(!(l.symbol===t.symbol||l.symbol===n.symbol||!l.isThinForwarder)&&[...o].some(c=>b(c,l.file))&&K(e,l,n,i,s-1,r))return!0;return!1}function V(e){return e.startsWith("<")&&e.endsWith(">")}function G(e){return[...e].sort()[0]}export{$e as a,X as b,Y as c,ke as d,be as e};
|
|
2
|
+
//# sourceMappingURL=chunk-7FG5M53V.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c}from"./chunk-B75HZHUP.js";import{a,c as n}from"./chunk-F334Z5UA.js";import{n as t}from"./chunk-UVMME4FI.js";import{a as m}from"./chunk-UXOVHGT6.js";import{d as o,h as r}from"./chunk-TDGCALH6.js";function N(s,y,b={}){let l=m(s,y);if(!l)return null;let i=b.semantic!==!1,f=n(s,l,{semantic:i,semanticEvidence:t}).filter(e=>r(e.symbol)).slice(0,50),p=c(a(s,l,{limit:50,additive:!0,callableOnly:!0,semantic:i,semanticEvidence:t}));return{symbol:l.symbol,shortName:o(l.symbol),callers:f.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file})),callees:p.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file}))}}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-A45K6VUK.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as y}from"./chunk-X65VYV2S.js";import{a as F}from"./chunk-4ZHJAHLE.js";import{a as B}from"./chunk-6DHPQS72.js";import{a as j}from"./chunk-HOXI4F5I.js";import{a as z}from"./chunk-TC3X33N6.js";import{a as $}from"./chunk-FMC3BI4I.js";import{a as v,b as G}from"./chunk-TOYQTO44.js";import{a as O}from"./chunk-2ZNZSNVW.js";import{b as k}from"./chunk-RIGY5DDE.js";import{a as T}from"./chunk-4XTPZ5CR.js";import{a as E}from"./chunk-AWSRND4W.js";import{a as I}from"./chunk-RJLU7IMR.js";import{a as H}from"./chunk-A45K6VUK.js";import{s as A}from"./chunk-M2TRDR25.js";function ne(n,e,o={}){let i=o.impactDepth??3,r=o.sliceDepth??3,c=o.semantic,a=!N(e),u=a?l("trace",e,()=>j(n,e,{semantic:c}),t=>({definitions:t.definitions.length,references:t.referencedBy.length})):{definitions:[],referencedBy:[]},s=a?l("call-graph",e,()=>H(n,e,{semantic:c}),t=>({callers:t?.callers.length??0,callees:t?.callees.length??0})):null,d=a?l("complexity",e,()=>E(n,e,{semantic:c}),t=>({callees:t?.calleeCount??0})):null,g=a?l("dataflow",e,()=>$(n,e,{semantic:c}),t=>({references:t?.usageSites.length??0,producers:t?.producers.length??0,consumers:t?.consumers.length??0})):null,C=a?l("backward-slice",e,()=>y(n,e,{direction:"backward",maxDepth:r,semantic:c}),t=>({maxDepth:r,connectedSymbols:t?.connectedSymbols.length??0})):null,x=a?l("forward-slice",e,()=>y(n,e,{direction:"forward",maxDepth:r,semantic:c}),t=>({maxDepth:r,connectedSymbols:t?.connectedSymbols.length??0})):null,R=a?l("affected",e,()=>I(n,e,{maxDepth:i,scope:o.scope}),t=>({maxDepth:i,affectedSymbols:t.length})):[],h=l("change-surface",e,()=>O(n,e,{semantic:c}),t=>({symbols:t?.symbols.length??0,externalConsumers:t?.totalExternalConsumers??0})),p=l("system",e,()=>B(n,e),t=>({files:t.files.length,symbols:t.symbols.length})),m=p.files.length===1,b=l("deps",e,()=>m?p.dependsOn.map(t=>({relativePath:t})):v(n,e),t=>({files:t.length,reusedSystem:m})),S=l("rdeps",e,()=>m?p.dependedOnBy.map(t=>({relativePath:t})):G(n,e),t=>({files:t.length,reusedSystem:m})),w=l("surface",e,()=>F(n,e),t=>({consumers:t.length})),f={symbol:u.definitions.length>0||u.referencedBy.length>0||s!==null||d!==null||g!==null||C!==null||x!==null||R.length>0,file:h!==null||b.length>0||S.length>0,module:p.files.length>0||p.symbols.length>0||w.length>0},D=[];!f.symbol&&!f.file&&!f.module&&D.push("No symbol, file, or module matched target.");let P=h?.file??u.definitions[0]?.relativePath??null;return{target:e,matched:f,history:l("history",P??e,()=>L(n,P,o.gitHead)),trace:u,callGraph:s,complexity:d,dataflow:g,backwardSlice:C,forwardSlice:x,affected:R,changeSurface:h,deps:b,rdeps:S,system:p,surface:w,warnings:D}}function l(n,e,o,i=()=>({})){let r;return A(`plan-context.${n}`,()=>(r=o(),r),()=>({target:e,...i(r)}))}function L(n,e,o){let i={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return i;let r=T(n,o?{head:o}:{}),c=l("history.churn",e,()=>r.fileChurn(),s=>({files:s?.size??0}));if(!c)return i;let a=l("history.co-change",e,()=>k(n,e,{limit:5,...o?{head:o}:{}}),s=>({commits:s.commitsAnalyzed,partners:s.findings.length})),u=l("history.suppressions",e,()=>z(n).byFile.get(e)??0,s=>({suppressions:s}));return{available:!0,file:e,churn:c.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:a.findings.map(s=>({file:s.fileA===e?s.fileB:s.fileA,together:s.together,confidence:s.confidence,subjectContext:s.subjectContext})),suppressionsInFile:u}}function N(n){return n.includes("/")||n.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(n)}export{ne as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AEDB4WXE.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{c as p}from"./chunk-4XTPZ5CR.js";import{b as B}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{d as f,t as g}from"./chunk-
|
|
1
|
+
import{c as p}from"./chunk-4XTPZ5CR.js";import{b as B}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{d as f,t as g}from"./chunk-TDGCALH6.js";import{b as y}from"./chunk-QNMOZ3CJ.js";import{z as d}from"./chunk-M2TRDR25.js";import{createHash as C}from"crypto";var b=3;function w(n,t={}){let{scope:e,maxLoc:o=15,minLoc:i=b,limit:r,scanLimit:a}=t,l=p(n),u=L(n,{scope:e,maxLoc:o,scanLimit:a}).map(s=>h(n,s,l,i)).filter(s=>s!==null),c=I(u);return r?c.slice(0,r):c}function H(n,t,e={}){let{scope:o,maxLoc:i=15,minLoc:r=b,scanLimit:a}=e,l=p(n),u=L(n,{scope:o,maxLoc:i,scanLimit:a}).map(s=>h(n,s,l,r)).filter(s=>s!==null),c=u.find(s=>s.symbol===t);return c?u.filter(s=>s.symbol!==c.symbol&&s.normalizedBody===c.normalizedBody&&s.file!==c.file).sort(z).map(({normalizedBody:s,...S})=>S):[]}function A(n){let t=E(n);return y(t).replace(/\s+/g,"")}function I(n){let t=new Map;for(let o of n){if(o.normalizedBody.length<8)continue;let i=W(o.normalizedBody),r=t.get(i)??[];r.push(o),t.set(i,r)}let e=[];for(let[o,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let a=[...i].sort(z).map(({normalizedBody:l,...u})=>u);e.push({hash:o,canonical:a[0],functions:a})}return e.sort((o,i)=>{let r=i.functions.length-o.functions.length;if(r!==0)return r;let a=D(i)-D(o);return a!==0?a:o.canonical.file.localeCompare(i.canonical.file)}),e}function L(n,t){let e=g(n,{scope:t.scope}).filter(o=>o.isFunctionLike&&!n.isIgnored(o.relativePath)).filter(o=>m(o)<=t.maxLoc);return e.sort((o,i)=>m(i)-m(o)||o.relativePath.localeCompare(i.relativePath)),B(e,t.scanLimit)}function h(n,t,e,o){let i=x(n,t);if(!i||P(i)<o)return null;let r=v(n,t);return r?{symbol:t.symbol,shortName:f(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:e?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function v(n,t){let e=x(n,t);return e&&A(e)||null}function x(n,t){let e=d(n,t.relativePath);return e.length===0?null:e.slice(t.startLine,t.endLine+1).join(`
|
|
2
2
|
`)}function E(n){let t=n.indexOf("{"),e=n.lastIndexOf("}");if(t>=0&&e>t)return n.slice(t+1,e);let o=n.indexOf("=>");return o>=0?n.slice(o+2).replace(/;+\s*$/,""):n}function P(n){return E(n).split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0).length}function W(n){return C("sha256").update(n).digest("hex").slice(0,16)}function z(n,t){let e=n.ageCommits??-1;return(t.ageCommits??-1)-e||n.file.localeCompare(t.file)||n.startLine-t.startLine}function D(n){return n.functions.reduce((t,e)=>t+e.loc,0)}export{w as a,H as b,A as c,I as d,v as e,x as f,E as g};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-AERYQJ52.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as le}from"./chunk-PKAPOFF5.js";import{a as T}from"./chunk-ZXWFN7CK.js";import{b as Q,e as ee,f as te,g as ne}from"./chunk-FLIF3JWA.js";import{b as ce}from"./chunk-B75HZHUP.js";import{c as P}from"./chunk-F334Z5UA.js";import{h as oe,n as N}from"./chunk-UVMME4FI.js";import{a as ie,b as re,c as se,k as ae}from"./chunk-QB5WSOTY.js";import{B as E,d as $,e as J,g as K,h as q,i as G,j as V,k as X,w as Y}from"./chunk-TDGCALH6.js";import{p as Z}from"./chunk-QNMOZ3CJ.js";import{B as H,E as x,c as w}from"./chunk-XDSB47KO.js";import{b as L,h as U,s as b,v as j,x as W,y as I,z}from"./chunk-M2TRDR25.js";import{a as S}from"./chunk-64MNV6AB.js";var _=new WeakMap,ue=j({kind:"definition-exclusions",invalidation:W("definition-exclusions"),serialize:e=>JSON.stringify(e),deserialize:Ie});function fe(e,t){let n=H(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let r=I(e,t);if(!r)return[];let o=U(e,t,r),c=ue.read(e,t,o);if(c)return c;let u=n==="rust"?Oe(e,t):ke(e,t);return ue.write(e,t,o,u),u}function Ie(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.map(Pe);return n.some(i=>i===null)?null:n}catch{return null}}function Pe(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"||t.containerName!==void 0&&typeof t.containerName!="string")return null;let n=t.disposition===void 0?Ge(t.reason):t.disposition;return n!=="exclude"&&n!=="implicit-usage"?null:{startLine:t.startLine,endLine:t.endLine,reason:t.reason,disposition:n,...t.containerName?{containerName:t.containerName}:{}}}var me=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),Ne=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,Te=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function ke(e,t){let n=I(e,t);if(!n||!Ae(n))return[];let i=x(e,t);if(!i)return[];let r=_.get(i);if(r)return r;let o=!1,c=i.rootNode;for(let l of c.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let s=d.namedChild(0);if(!s)continue;let a=s.type==="member_expression"?s.namedChild(s.namedChildCount-1)?.text:s.text;if(a&&me.has(a)){o=!0;break}}let u=[];o&&u.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)",disposition:"exclude"});for(let l of c.namedChildren){let d=null,s=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,s=l;else if(l.type==="export_statement"){let a=l.namedChild(0);a?.type==="function_declaration"&&(d=a.namedChild(0)?.text??null,s=a)}else if(l.type==="lexical_declaration"){let a=l.namedChild(0);if(a?.type==="variable_declarator"){let m=a.namedChild(0)?.text,p=a.namedChild(1);m&&(p?.type==="arrow_function"||p?.type==="function_expression")&&(d=m,s=a)}}d&&/^use[A-Z]/.test(d)&&s&&u.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:"React custom hook (use*)",disposition:"exclude"})}return u.push(...pe(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),_.set(i,u),u}function Ae(e){if(e.includes("scip-query"))return!0;let t=!1;for(let n of me)if(e.includes(n)){t=!0;break}return t&&Ne.test(e)?!0:e.includes("use")&&Te.test(e)}var Fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function Me(e){return Fe.test(e)}function pe(e,t,n){let i=[],r=o=>{if(t.has(o.type)&&o.parent){let u=o.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===o.startIndex&&u[d].type===o.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let s=u[d];if(n.has(s.type)){if(Me(s.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment",disposition:"exclude"});break}continue}if(!(s.type==="attribute_item"||s.type==="inner_attribute_item"))break}}for(let c of o.namedChildren)r(c)};return r(e.rootNode),i}function Oe(e,t){let n=x(e,t);if(!n)return[];let i=_.get(n);if(i)return i;let r=[],o=Be(n);return o?(_.set(n,o),o):(ye(n.rootNode,r,!1,!1),r.push(...pe(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...Ke(n.rootNode)),_.set(n,r),r)}function Be(e){return Ve(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)",disposition:"exclude"}]:null}function ye(e,t,n,i){let r=n,o=i;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)",disposition:"implicit-usage"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)",disposition:"implicit-usage"})),e.type==="function_item"||e.type==="function_signature_item"?Ue(e,t,n,i):i&&Je(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)",disposition:"implicit-usage"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?je(e,t,n):e.type==="mod_item"&&k(e).some(c=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(c))&&(r=!0);for(let c of e.namedChildren)ye(c,t,r,o)}function Ue(e,t,n,i){let r=k(e),o=null;i?o={reason:"trait impl method (dynamic dispatch)",disposition:"implicit-usage"}:n&&(o={reason:"inside #[cfg(test)] mod",disposition:"exclude"});for(let c of r){if(be(c)){o={reason:"#[allow(dead_code)]",disposition:"exclude"};break}let u=Ze(c);if(u){o=u;break}}o&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o.reason,disposition:o.disposition})}function je(e,t,n){let i=k(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some($e)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(...)] - generated impl may access fields",disposition:"implicit-usage",containerName:r}),i.some(be)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",disposition:"exclude",containerName:r}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",disposition:"exclude",containerName:r})}function k(e){let t=e.parent;if(!t)return[];let n=t.children,i=-1;for(let o=0;o<n.length;o+=1)if(n[o].startIndex===e.startIndex&&n[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let c=n[o];if(c.type==="attribute_item"||c.type==="inner_attribute_item")r.push(c.text);else{if(c.type==="line_comment"||c.type==="block_comment")continue;break}}return r}var We=new Set(["test","bench","tokio::test","async_std::test"]),ze=new Set(["no_mangle","export_name","link_name","used","macro_export","proc_macro","proc_macro_derive","proc_macro_attribute"]),He=new Set(["allow","warn","deny","forbid","cfg","cfg_attr","doc","inline","cold","must_use","deprecated","repr","derive","automatically_derived","non_exhaustive","path","link","link_section","global_allocator","panic_handler"]);function Ze(e){if(/#\[\s*cfg\s*\(\s*test\s*\)/.test(e))return{reason:"#[cfg(test)]",disposition:"exclude"};let t=qe(e);return t?We.has(t)?{reason:`#[${t}]`,disposition:"exclude"}:ze.has(t)?{reason:`Rust ABI/export attribute #[${t}]`,disposition:"implicit-usage"}:He.has(t)?null:{reason:`Rust attribute macro #[${t}]`,disposition:"implicit-usage"}:null}function $e(e){return/#\[\s*derive\s*\(/.test(e)}function be(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function Je(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ke(e){let t=Xe(e);if(t.size===0)return[];let n=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&t.has(r)&&n.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'attribute `with = "..."` module - body may be invoked via reflection',disposition:"implicit-usage",containerName:r})}return n}function qe(e){let t=/^#!?\[\s*([A-Za-z_][A-Za-z0-9_]*(?:\s*::\s*[A-Za-z_][A-Za-z0-9_]*)*)/.exec(e);return t?t[1].replace(/\s+/g,""):null}function Ge(e){return e==="#[tauri::command]"||e==="#[command]"||e==="#[wasm_bindgen]"||e==="#[no_mangle]"||e==="#[napi]"||e==="#[pyfunction]"||e==="#[pymethod]"||e==="#[pyo3]"||e==="#[doc(hidden)]"||e.startsWith("trait ")||e.startsWith("#[derive(<reflective>)]")||e.startsWith("#[derive(...)]")||e.startsWith('serde `with = "')||e.startsWith('attribute `with = "')||e.startsWith("Rust attribute macro #[")||e.startsWith("Rust ABI/export attribute #[")?"implicit-usage":"exclude"}function Ve(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var de=/\bwith\s*=\s*"([^"]+)"/g;function Xe(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){de.lastIndex=0;let i;for(;(i=de.exec(n.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&t.add(o)}}return t}function ge(e){let t=A(e);return(n,i,r,o)=>t(n,i,r,o)?.disposition==="exclude"}function A(e){let t=new Map,n=i=>{let r=t.get(i);if(r)return r;let o=fe(e,i),c=new Map;for(let u of o){if(!u.containerName)continue;let l=c.get(u.containerName)??[];l.push(u),c.set(u.containerName,l)}return r={ranges:o,containers:c},t.set(i,r),r};return(i,r,o,c)=>{let u=n(i),l=[];for(let s of u.ranges)r>=s.startLine&&r<=s.endLine&&l.push(s);let d=new Set;c&&d.add(c);for(let s of E(o))d.add(s);for(let s of d){let a=u.containers.get(s);a&&l.push(...a)}return Ye(l)}}function Ye(e){if(e.length===0)return null;let n=e.find(i=>i.disposition==="exclude")??e[0];return{disposition:n.disposition,reason:n.reason}}function vt(e,t={}){L(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function he(e,t,n={}){L(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function xe(e,t){if(t.isIgnoredPath(e.relativePath))return y("ignored-file");if(G(e.symbol))return y("module-like-symbol");if(!R(e.symbol))return y("non-value-symbol");if(!e.isFunctionLike&&e.enclosingSymbol&&R(e.enclosingSymbol))return y("nested-non-callable-value");if(!t.includeTests&&!Qe(e.relativePath))return y("test-file");if(!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName))return y("excluded-file-region");let n=J(e.symbol);if(n==="<constructor>")return y("implicit-constructor");if(e.symbol.startsWith("scip-python ")){if(n==="__all__")return y("python-runtime-metadata");if(/^__[^_].*__$/.test(n))return y("python-protocol-member")}return t.isDeclarationOnlyCallable()?y("declaration-only-callable"):t.isFrameworkContractCallable()?y("framework-contract-member"):V(e.symbol)?y("rust-trait-impl-member"):X(e.symbol)?y("rust-test-module"):!t.includeMembers&&!et(e)?y("member"):e.endLine-e.startLine+1<t.minLoc?y("below-min-loc"):{accepted:!0}}function Qe(e){return Q(e)!=="test"}function y(e){return{accepted:!1,rejectionReason:e}}function R(e){return q(e)||e.endsWith("().")||e.endsWith(".")}function et(e){return K(e.symbol)||E(e.symbol).length===0}function _e(){return new Map}function Se(e,t,n){let i=new Map;for(let r of ie(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||v(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function Ee(e,t,n,i={}){let r=new Set;if(i.conservative||n.size===0){for(let o of se(e,t))r.add(o.symbol_id);return r}for(let o of re(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||r.add(o.symbol_id);return r}function F(e,t){let n=e.get(t);if(!n)return!1;for(let i of n.values())if(i.occurrences>0)return!0;return!1}function C(e,t,n){let i=e.get(t);if(!i)return!1;for(let[r,o]of i)if(r!==n&&o.occurrences>0)return!0;return!1}function Re(e){return e?.occurrences??0}function v(e,t,n,i,r="source-fallback"){if(i<=0)return;let o=ve(e,t,n);o.occurrences+=i,o.sources.add(r)}function Ce(e,t,n,i,r){if(i<=0)return;let o=ve(e,t,n);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function ve(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));let r=i.get(n);return r||(r={occurrences:0,sources:new Set},i.set(n,r)),r}var tt=1e3,nt=300;function Qt(e,t={}){let{scope:n,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:c=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,s=0,a=b("dead.candidates",()=>{let f=ce(it(e,{scope:n,minLoc:i,includeTests:r,includeMembers:c}),l);return s=f.length,f},()=>({definitions:s})),m=0,p=o?b("dead.inactive-barrels",()=>{let f=new Set(ee(e));return m=f.size,f},()=>({paths:m})):new Set,M=0,g=u?_e():b("dead.mention-reference-counts",()=>{let f=Se(e,p,a.map(D=>D.symbolId));return M=f.size,f},()=>({definitions:a.length,symbolsWithReferences:M})),O=0,Le=u?b("dead.mentioned-symbol-ids",()=>{let f=Ee(e,a.map(D=>D.symbolId),p,{conservative:p.size===0});return O=f.size,f},()=>({definitions:a.length,referencedSymbols:O})):new Set,h=u?a.filter(f=>!Le.has(f.symbolId)):a.filter(f=>!C(g,f.symbolId,f.relativePath));u?b("dead.source-fallback.dead-code-only",()=>ut(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0})):b("dead.source-fallback.ast",()=>lt(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0}));let B=u?h.filter(f=>!F(g,f.symbolId)):h.filter(f=>!C(g,f.symbolId,f.relativePath));b("dead.caller-map-supplement",()=>yt(e,B,g,{inactiveBarrelPaths:p,includeSemantic:!u&&d}),()=>({definitions:B.length,semantic:!u&&d}));let we=u?h.filter(f=>!F(g,f.symbolId)):a;return ct(e,ot(we,g))}function it(e,t){let n=ge(e),i=[];for(let r of Y(e,{scope:t.scope,symbolMatches:R,sqlPrefilter:"function-like"}))xe(r,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:n,isDeclarationOnlyCallable:()=>st(e,r),isFrameworkContractCallable:()=>le(e,r)}).accepted&&i.push(r);return i}var rt=["method_signature","abstract_method_signature","call_signature","construct_signature"];function st(e,t){if(!t.parentTypeName||!/\.[cm]?[jt]sx?$/.test(t.relativePath))return!1;let n=x(e,t.relativePath);if(n)return n.rootNode.descendantsOfType([...rt]).some(r=>r.startPosition.row<=t.startLine&&r.endPosition.row>=t.endLine);let i=z(e,t.relativePath).slice(t.startLine,t.endLine+1).join(`
|
|
2
|
+
`).trim();return i.endsWith(";")&&!i.includes("=>")&&!i.includes("{")}function ot(e,t){return e.map(n=>at(n,t)).filter(n=>n.cross_file_refs===0).sort((n,i)=>i.loc-n.loc||n.relative_path.localeCompare(i.relative_path)||n.start_line-i.start_line)}function at(e,t){let n=t.get(e.symbolId)??new Map,i=Re(n.get(e.relativePath)),r=0;for(let[o,c]of n)o!==e.relativePath&&(r+=c.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,parent_type_name:e.parentTypeName,same_file_refs:i,cross_file_refs:r}}function ct(e,t){let n=A(e),i=[],r=0,o=0,c=0,u=0,l=0,d=0;for(let s of t){if(e.isIgnored(s.relative_path))continue;if(te(e,s.relative_path)){u++;continue}if(ne(e,s.symbol,s.relative_path)){l++;continue}let a=n(s.relative_path,s.start_line,s.symbol,s.parent_type_name),m=a?.disposition==="implicit-usage"?a.reason:void 0,p=m?"implicit-usage":s.same_file_refs===0?"dead-code":"file-internal";p==="dead-code"?r++:p==="file-internal"?o++:c++,d+=s.loc,i.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:$(s.symbol),sameFileRefs:s.same_file_refs,kind:p,...m?{implicitUsageReason:m}:{}})}return{symbols:i,counts:{total:i.length,deadCode:r,fileInternal:o,implicitUsage:c,loc:d},applicability:{entrySurfaceExcluded:u,externalRootExcluded:l,implicitUsageSignals:c},totalCount:i.length,deadCodeCount:r,fileInternalCount:o,implicitUsageCount:c,totalLoc:d}}function lt(e,t,n,i){if(t.length===0)return;let r=new T(e),o=new Set(t.map(l=>l.symbolId)),c=new Set(t.map(l=>l.leaf).filter(Boolean)),u=new Set(r.sourceFiles());for(let l of S(e))u.add(l);r.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:l=>i.inactiveBarrelPaths.has(l)},l=>{o.has(l.target.symbolId)&&(mt(e,l)||v(n,l.target.symbolId,l.sourceFile,pt(l),"source-fallback"))})}function ut(e,t,n,i){if(t.length===0)return;let r=new T(e),o=dt(t),c=new Set(r.sourceFiles());for(let s of S(e))c.add(s);let u=new Set(o.keys()),l=new Map,d=s=>{let a=l.get(s);return a||(a=oe(e,s),l.set(s,a)),a};r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:s=>i.inactiveBarrelPaths.has(s),resolveTargets:({sourceFile:s,name:a,kind:m})=>{let p=o.get(a);return p?ft(s,a,p,()=>d(s),{permissive:m!=="cross-language-dispatch"}):[]},afterPath:s=>{l.delete(s),he(e,s)}},s=>{let a=s.kind==="identifier"&&s.sourceFile===s.target.relativePath?Math.max(0,s.occurrences-1):s.occurrences;s.kind==="identifier"&&De(e,{sourceFile:s.sourceFile,name:s.name,target:s.target,occurrences:a})||v(n,s.target.symbolId,s.sourceFile,a,"source-fallback")})}function dt(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let i=t.get(n.leaf)??[];i.push(n),t.set(n.leaf,i)}return t}function ft(e,t,n,i,r){let o=n.filter(d=>d.relativePath===e);if(o.length>0)return o;if(!r.permissive&&n.length===1)return[...n];let c=i(),u=c.get(t);if(u)for(let d of u){let s=n.filter(a=>w(d,a.relativePath));if(s.length>0)return s}let l=new Set;for(let d of c.values())for(let s of d)l.add(s);for(let d of l){let s=n.filter(a=>w(d,a.relativePath));if(s.length>0&&s.length===n.length)return s}return r.permissive?[...n]:[]}function mt(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&De(e,t)}function pt(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function De(e,t){return t.occurrences>1?!1:Z(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function yt(e,t,n,i){let r=i.includeSemantic!==!1,o=r&&t.length>=tt&&S(e).length>=nt,c=(s,a)=>{a===s.relativePath||e.isIgnored(a)||i.inactiveBarrelPaths.has(a)||Ce(n,s.symbolId,a,1,"caller-map")};if(o?b("dead.caller-map.per-symbol-non-semantic",()=>{for(let s of t){let a=P(e,s,{semantic:!1,semanticEvidence:N});for(let m of a)c(s,m.file)}},()=>({definitions:t.length,semantic:!1})):b("dead.caller-map.per-symbol",()=>{for(let s of t){let a=P(e,s,{semantic:r,semanticEvidence:N});if(a.length!==0)for(let m of a)c(s,m.file)}},()=>({definitions:t.length,semantic:r})),!o)return;let u=0,l=b("dead.caller-map.semantic-candidates",()=>{let s=t.filter(a=>!C(n,a.symbolId,a.relativePath));return u=s.length,s},()=>({definitions:t.length,semanticCandidates:u}));if(l.length===0)return;let d=ae(e,l);for(let s of l){let a=d.get(s.symbolId);if(a)for(let m of a)c(s,m)}}export{vt as a,Qt as b};
|
|
3
|
+
//# sourceMappingURL=chunk-AM2LGOEX.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-ZXWFN7CK.js";import{a as h}from"./chunk-UXOVHGT6.js";import{d as f}from"./chunk-TDGCALH6.js";import{b as u}from"./chunk-QNMOZ3CJ.js";import{E as l}from"./chunk-XDSB47KO.js";import{readFileSync as E}from"fs";import{join as B}from"path";function j(t,e,s={}){let n=h(t,e);if(!n)return null;let a=new d(t),o=N(t,n),r=n.endLine-n.startLine+1,m=a.calleeMap([n],{additive:!0,semantic:s.semantic}).get(n.symbolId)??[],c=new Set(m.map(x=>x.symbol));return{symbol:n.symbol,shortName:f(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:r,branches:o.branches,estimateBasis:o.estimateBasis,cyclomaticEstimate:o.branches+1,calleeCount:c.size,fanIn:P(t,n.symbolId),fanOut:w(m,n.relativePath)}}function N(t,e){let s=l(t,e.relativePath);if(s){let n=g(s.rootNode,e.startLine,e.endLine);if(n)return{branches:v(n),estimateBasis:"ast"}}return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function H(t,e){let s=new Map,n=new Map;for(let a of e){let o=n.get(a.relativePath)??[];o.push(a),n.set(a.relativePath,o)}for(let[a,o]of n){let r=l(t,a),i=r===null?[]:o.filter(c=>r.rootNode.startPosition.row<=c.startLine&&r.rootNode.endPosition.row>=c.endLine),m=new Set(i.map(c=>c.symbolId));if(r&&i.length>0){for(let c of i)s.set(c.symbolId,{branches:0,estimateBasis:"ast"});C(r.rootNode,i,s)}for(let c of o)m.has(c.symbolId)||s.set(c.symbolId,L(t,c))}return s}function L(t,e){return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function y(t,e){return t.get("SELECT language FROM documents WHERE relative_path = ?",e)?.language??"unknown"}function p(t,e,s,n){try{return E(B(t.config.projectRoot,e),"utf-8").split(`
|
|
2
2
|
`).slice(s,n+1).join(`
|
|
3
3
|
`)}catch{return""}}function P(t,e){return t.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
@@ -13,4 +13,4 @@ import{a as d}from"./chunk-RUV4KHWA.js";import{a as h}from"./chunk-6JSTKSZH.js";
|
|
|
13
13
|
WHERE m.symbol_id = ?
|
|
14
14
|
AND m.role != 1
|
|
15
15
|
AND sym_def.document_id != c.document_id`,e)?.c??0}function w(t,e){return new Set(t.filter(s=>s.file!==e).map(s=>s.symbol)).size}function v(t){let e=0;return b(t,s=>{e+=S(s)}),e}function C(t,e,s){let n=[...e].sort((a,o)=>a.startLine-o.startLine||o.endLine-a.endLine);b(t,a=>{let o=S(a);if(o===0)return;let r=a.startPosition.row,i=a.endPosition.row;for(let m of n){if(m.startLine>r)break;if(m.endLine<i)continue;let c=s.get(m.symbolId);c&&(c.branches+=o)}})}function b(t,e){e(t);for(let s of t.namedChildren)b(s,e)}function g(t,e,s){if(t.startPosition.row>e||t.endPosition.row<s)return null;for(let n of t.namedChildren){let a=g(n,e,s);if(a)return a}return t}var D=new Set(["if_statement","conditional_expression","ternary_expression","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_case","case_statement","catch_clause","except_clause","elif_clause","match_arm"]);function S(t){return D.has(t.type)?1:t.type==="binary_expression"&&t.parent?.type!=="binary_expression"&&(t.text.includes("&&")||t.text.includes("||"))?I(t.text):0}function I(t){return(t.match(/&&|\|\|/g)??[]).length}function _(t,e){let s=u(t),n=0,a=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of a){let r=s.match(o);r&&(n+=r.length)}if(e==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}return n}export{j as a,N as b,H as c,v as d};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-AWSRND4W.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as f}from"./chunk-B3X6KU75.js";import{N as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{d as f}from"./chunk-B3X6KU75.js";import{N as d}from"./chunk-XDSB47KO.js";function S(n,e={}){let{minComponentLines:o=300,minFileLines:i=800,minJsxTokens:u=80,minBehaviorTokens:s=40,limit:a=20,scope:m,scanLimit:c,filePattern:p}=e;return d(n).reactProfiles({scope:m,scanLimit:c}).filter(t=>t.kind==="component").filter(t=>!p||t.file.includes(p)||t.name.includes(p)).map(t=>C(t,{minComponentLines:o,minFileLines:i,minJsxTokens:u,minBehaviorTokens:s})).filter(t=>t!==null).sort((t,r)=>r.componentLines-t.componentLines||r.fileLines-t.fileLines||t.file.localeCompare(r.file)).slice(0,a)}function C(n,e){let o=Math.max(80,Math.floor(e.minComponentLines/2)),i=f(n,x({minComponentLines:e.minComponentLines,minFileLines:e.minFileLines,minJsxTokens:e.minJsxTokens,minBehaviorTokens:e.minBehaviorTokens,substantialComponentLines:o}),"component"),{reasons:u}=i;if(u.length===0)return null;let s=i.dominantPressure,a=i.pressureKinds,m=b(n),c=R(s,a,m);return{file:n.file,component:n.name,componentLines:n.loc,fileLines:n.fileLines,jsxTokens:n.jsxTokens.size,behaviorTokens:n.behaviorTokens.size,dominantPressure:s,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:v(c,m),reasons:u,loc:n.loc}}function x(n){return[{axis:"component",value:e=>e.loc,qualifies:(e,o)=>o>=n.minComponentLines,reason:(e,o)=>`${o} component line(s)`},{axis:"file",value:e=>e.fileLines,qualifies:(e,o)=>o>=n.minFileLines&&e.loc>=n.substantialComponentLines,reason:(e,o)=>`${o} file line(s)`},{axis:"jsx-structure",value:e=>e.jsxTokens.size,weightedValue:(e,o)=>o*3,qualifies:(e,o)=>o>=n.minJsxTokens,reason:(e,o)=>`${o} JSX structure token(s)`},{axis:"hook-behavior",value:e=>e.behaviorTokens.size,weightedValue:(e,o)=>o*4,qualifies:(e,o)=>o>=n.minBehaviorTokens,reason:(e,o)=>`${o} behavior token(s)`}]}function b(n){let e=n.file.split(/[\\/]+/).filter(Boolean),o=e.slice(0,-1).map(r=>r.toLowerCase()),i=(e.at(-1)??n.name).replace(/\.[^.]+$/,""),s=o.findIndex(r=>k.has(r))>=0,a=o.some(r=>h.has(r));if(L(i)||L(n.name))return"component";let c=T.has(i.toLowerCase()),p=/(?:Page|Route|Screen)$/.test(n.name),l=s&&/View$/.test(n.name),t=!a&&i.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()===n.name.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()&&/(?:Page|Route|Screen|View)$/.test(i);return c||p||l||t?"route-page":"component"}function L(n){let e=n.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return e.at(-1)&&g.has(e.at(-1))?!0:[...g].some(o=>n.endsWith(P(o)))}function R(n,e,o){return n==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":e.includes("hook-behavior")?"behavior-extraction":e.includes("jsx-structure")?"jsx-decomposition":e.includes("file")?"file-decomposition":n==="jsx-structure"?"jsx-decomposition":n==="file"&&!e.includes("component")?"file-decomposition":"component-decomposition"}function v(n,e){switch(n){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return e==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),g=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),k=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),T=new Set(["page","route","screen"]);function P(n){return n.charAt(0).toUpperCase()+n.slice(1)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BOXAKNN6.js.map
|