scip-query 0.10.8 → 0.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/chunk-2KHTSEIL.js +102 -0
- package/dist/chunk-3VD3JMK2.js +2 -0
- package/dist/{chunk-MEKSFV6H.js → chunk-4UZO3XCV.js} +2 -2
- package/dist/{chunk-BJWNO6BU.js → chunk-54KGX7EX.js} +2 -2
- package/dist/chunk-5GOLFJEO.js +8 -0
- package/dist/chunk-5OST6GYB.js +2 -0
- package/dist/{chunk-C6BYNIH4.js → chunk-65AU3HFZ.js} +2 -2
- package/dist/{chunk-E2CCBFLR.js → chunk-6GN7FXCH.js} +2 -2
- package/dist/{chunk-RHKMQNFI.js → chunk-6IR2AOBM.js} +2 -2
- package/dist/{chunk-6EO3E3IP.js → chunk-6JRV4MY2.js} +2 -2
- package/dist/{chunk-5SMUKUV5.js → chunk-6LJHXREW.js} +2 -2
- package/dist/chunk-6QSOCTZT.js +18 -0
- package/dist/{chunk-6TDOT7B3.js → chunk-72KY2ZFO.js} +2 -2
- package/dist/{chunk-LGX2Y4BA.js → chunk-7B6LP46R.js} +2 -2
- package/dist/chunk-7GO4EQF5.js +2 -0
- package/dist/chunk-7IVSJJZU.js +7 -0
- package/dist/{chunk-EBIQY3RK.js → chunk-7TWLSZK5.js} +2 -2
- package/dist/{chunk-X3Z4MLVL.js → chunk-AVWPHM2Q.js} +2 -2
- package/dist/{chunk-GZQID3FS.js → chunk-BASVXNY3.js} +2 -2
- package/dist/{chunk-BJG67TCR.js → chunk-BFXPG2VN.js} +2 -2
- package/dist/chunk-BSN22NRK.js +9 -0
- package/dist/{chunk-ZDR4VTOP.js → chunk-BVRS7RKQ.js} +2 -2
- package/dist/{chunk-ANIOISCE.js → chunk-C5CTSJ6X.js} +2 -2
- package/dist/{chunk-VXT7WVIN.js → chunk-CO5GJRP7.js} +2 -2
- package/dist/chunk-CW5YFOCP.js +5 -0
- package/dist/chunk-E35O7UCB.js +2 -0
- package/dist/{chunk-LWTML2AN.js → chunk-EXDQ35NN.js} +2 -2
- package/dist/{chunk-Q34NWRPP.js → chunk-EY43NV4M.js} +2 -2
- package/dist/chunk-FAYI6KZ5.js +2 -0
- package/dist/{chunk-ZL52RLDK.js → chunk-FDEQIPPK.js} +2 -2
- package/dist/{chunk-5G5VI7J4.js → chunk-FFVIFETB.js} +2 -2
- package/dist/{chunk-JUIAOOK7.js → chunk-FKCGBZAC.js} +2 -2
- package/dist/{chunk-JRUKS66S.js → chunk-FXNWFMKW.js} +2 -2
- package/dist/chunk-G5UPYQGL.js +4 -0
- package/dist/chunk-GQBMH2TQ.js +2 -0
- package/dist/{chunk-VFLHKRTW.js → chunk-GRJY65YT.js} +2 -2
- package/dist/chunk-HF25DFSC.js +3 -0
- package/dist/chunk-HHN2B5KA.js +2 -0
- package/dist/{chunk-7KJBH4IP.js → chunk-IHUETYFW.js} +2 -2
- package/dist/{chunk-BEUQVBE3.js → chunk-JATUZIEH.js} +2 -2
- package/dist/chunk-JCLDUKT6.js +38 -0
- package/dist/{chunk-B4EHYG6M.js → chunk-JGN2ZFJR.js} +2 -2
- package/dist/{chunk-L4QKEQ4S.js → chunk-JME7OWD3.js} +2 -2
- package/dist/chunk-KDFONWTW.js +40 -0
- package/dist/{chunk-VMPB52FG.js → chunk-LPL4MA6R.js} +2 -2
- package/dist/{chunk-FGTHPJON.js → chunk-LSET2TXH.js} +2 -2
- package/dist/chunk-LZHUWKGD.js +2 -0
- package/dist/{chunk-JYSAYZNX.js → chunk-M4COR2H6.js} +2 -2
- package/dist/{chunk-QDGKE5HN.js → chunk-NOJAM5ZV.js} +2 -2
- package/dist/chunk-O6ZH6C6Y.js +2 -0
- package/dist/{chunk-3LQFMQPY.js → chunk-OBGRLXWF.js} +2 -2
- package/dist/chunk-OLTESY4K.js +3 -0
- package/dist/chunk-P4KYUPBD.js +4 -0
- package/dist/chunk-P5RYBRIO.js +4 -0
- package/dist/{chunk-6N6QTGSD.js → chunk-P753MDDE.js} +2 -2
- package/dist/{chunk-NWFSC356.js → chunk-P7AL7Y37.js} +2 -2
- package/dist/chunk-QLAUCRDJ.js +2 -0
- package/dist/{chunk-FHWEEQVO.js → chunk-QPU7EXAW.js} +2 -2
- package/dist/{chunk-AA7L7GKI.js → chunk-QYB5P7GL.js} +2 -2
- package/dist/chunk-RNM6LMCF.js +2 -0
- package/dist/chunk-RVWSAMTT.js +2 -0
- package/dist/{chunk-T633QLYF.js → chunk-TK7O5ER5.js} +2 -2
- package/dist/chunk-TQ5W2H3S.js +4 -0
- package/dist/chunk-USPV3T5K.js +2 -0
- package/dist/{chunk-FKUCFCLU.js → chunk-VCQYSG2M.js} +2 -2
- package/dist/{chunk-2YI45TNM.js → chunk-VUKC6F77.js} +2 -2
- package/dist/{chunk-N7F5UM6J.js → chunk-W6BVEKYC.js} +2 -2
- package/dist/{chunk-63MSELOP.js → chunk-WUCEKFQC.js} +2 -2
- package/dist/chunk-XUGQU7PM.js +41 -0
- package/dist/{chunk-KZYHFI2X.js → chunk-Y5NBHMQX.js} +2 -2
- package/dist/{chunk-6BNOACLT.js → chunk-YCOFCT4B.js} +2 -2
- package/dist/{chunk-SHM5D3DQ.js → chunk-YWYFU2V3.js} +2 -2
- package/dist/{chunk-BWL2ECGQ.js → chunk-Z3YYR4OS.js} +2 -2
- package/dist/{chunk-3FYGJ2GY.js → chunk-Z4HICZGY.js} +2 -2
- package/dist/{chunk-24S6MYOC.js → chunk-ZQDIXAF5.js} +2 -2
- package/dist/cli.js +298 -244
- package/dist/{db-BAVwb4Pb.d.ts → db-Djj3Nqrb.d.ts} +2 -0
- package/dist/{health-B17sVFYf.d.ts → health-D5J42g4D.d.ts} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -3
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +1 -1
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/health.d.ts +2 -2
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +3 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -1
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -1
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +1 -1
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +13 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-imports.d.ts +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +1 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/docs/COMMAND_REFERENCE.md +1 -1
- package/docs/analyzer-inventory.md +29 -0
- package/docs/analyzer-validation-ledger.md +32 -1
- package/package.json +1 -1
- package/skills/scip-hyper-optimization/SKILL.md +153 -24
- package/skills/scip-hyper-optimization/agents/openai.yaml +3 -3
- package/dist/chunk-2H57MJLI.js +0 -2
- package/dist/chunk-4TMJDHC6.js +0 -5
- package/dist/chunk-5GVOJOBL.js +0 -2
- package/dist/chunk-7XWXGANX.js +0 -4
- package/dist/chunk-AETMKBZR.js +0 -40
- package/dist/chunk-BTCASU5J.js +0 -3
- package/dist/chunk-C6ROZBJA.js +0 -32
- package/dist/chunk-COUFCH64.js +0 -2
- package/dist/chunk-EKECQP6Z.js +0 -2
- package/dist/chunk-FVA3NH4P.js +0 -2
- package/dist/chunk-I274B3B3.js +0 -7
- package/dist/chunk-J6ADQKQA.js +0 -2
- package/dist/chunk-K7VBTWNR.js +0 -2
- package/dist/chunk-KLXVEBVC.js +0 -2
- package/dist/chunk-KRGBLZT2.js +0 -7
- package/dist/chunk-P3K7LX7M.js +0 -4
- package/dist/chunk-PVZMPG5I.js +0 -2
- package/dist/chunk-RSKOYTSY.js +0 -3
- package/dist/chunk-RY7CAOJF.js +0 -4
- package/dist/chunk-S7YOLFLX.js +0 -2
- package/dist/chunk-SOGKYB5I.js +0 -8
- package/dist/chunk-VAXDTQHE.js +0 -18
- package/dist/chunk-X3BJUFSN.js +0 -62
- package/dist/chunk-XPOZO76D.js +0 -2
- package/dist/chunk-XWC67C3Q.js +0 -2
- package/dist/chunk-YNSVAJR6.js +0 -2
- package/dist/chunk-ZMU6IWDK.js +0 -38
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-7IVSJJZU.js";import"../chunk-GRJY65YT.js";import"../chunk-LM5SHAN4.js";import"../chunk-PFOCOG57.js";import"../chunk-B75HZHUP.js";import"../chunk-5OST6GYB.js";import"../chunk-C5CTSJ6X.js";import"../chunk-BGBBVSH4.js";import"../chunk-RNM6LMCF.js";import"../chunk-JCLDUKT6.js";import"../chunk-KDFONWTW.js";import"../chunk-OLTESY4K.js";import"../chunk-TQ5W2H3S.js";import"../chunk-TK7O5ER5.js";import"../chunk-VUKC6F77.js";import"../chunk-P5RYBRIO.js";import"../chunk-OBGRLXWF.js";import"../chunk-2KHTSEIL.js";import"../chunk-JM72FNGA.js";import"../chunk-72KY2ZFO.js";import"../chunk-YZA6PPZL.js";import"../chunk-HF25DFSC.js";import"../chunk-DS6QEB3G.js";import"../chunk-XUGQU7PM.js";import"../chunk-A536TEU4.js";import"../chunk-64MNV6AB.js";import"../chunk-7S5E7KWT.js";export{a as wrapperCandidates};
|
|
2
2
|
//# sourceMappingURL=wrapper-candidates.js.map
|
|
@@ -115,7 +115,7 @@ This syntax summary is generated from the CLI command descriptors. Keep workflow
|
|
|
115
115
|
|
|
116
116
|
| Command | Description | Options |
|
|
117
117
|
|---|---|---|
|
|
118
|
-
| `bench` | Benchmark indexing and command runtimes for this repository | `--json`<br>`--cold-index`<br>`--include-heavy`<br>`--command <cmd>`<br>`--timeout-ms <n>` |
|
|
118
|
+
| `bench` | Benchmark indexing and command runtimes for this repository | `--json`<br>`--cold-index`<br>`--include-heavy`<br>`--command <cmd>`<br>`--timeout-ms <n>`<br>`--progress`<br>`--profile`<br>`--profile-out <path>` |
|
|
119
119
|
| `install-skills` | Install skills (scip-query, scip-query-setup, scip-adoption, scip-health-audit, scip-health-improve, scip-hyper-optimization, scip-api-impact, concrete-plan, scip-ai-cleanup, scip-debug, scip-explore, scip-triage-issue, scip-diagram, scip-debloat, scip-doc-reconcile, scip-directory-architecture, scip-maintainability, scip-react-maintainability, scip-vue-maintainability, scip-verify, scip-language-playbook) into Claude Code, Codex, and shared agent roots | - |
|
|
120
120
|
| `setup-hooks` | Install or refresh project-local Codex and Claude Code lifecycle hooks | `--json` |
|
|
121
121
|
| `check-deps` | Check whether scip-query and the detected language indexers are actually runnable | - |
|
|
@@ -164,3 +164,32 @@ This should pair with `react-large-component-pressure`, `vue-large-view-pressure
|
|
|
164
164
|
## 2026-06-23 Citation Refresh
|
|
165
165
|
|
|
166
166
|
The maintainability-register completion slice rechecked the command and diff-gate guide references above. `src/runtime/commands/query-command-specs.ts` still owns the public query order, now also exporting `orderedQueryCommandDescriptors` so CLI registration can derive from that order. `src/queries/impact/diff-gate.ts` still owns `DIFF_GATE_CHECKS`; the slice only centralized finding emission through a local recorder and did not change the listed check family.
|
|
167
|
+
|
|
168
|
+
## 2026-06-28 Diff-Gate Echo Follow-Up
|
|
169
|
+
|
|
170
|
+
The diff-gate implementation still owns `DIFF_GATE_CHECKS` and the default
|
|
171
|
+
diff-scoped check family in `src/queries/impact/diff-gate.ts`. The
|
|
172
|
+
hyper-optimization follow-up only adds a callable-symbol prefilter before the
|
|
173
|
+
echo check invokes similarity, so the command surface and check inventory
|
|
174
|
+
described above are unchanged.
|
|
175
|
+
|
|
176
|
+
## 2026-06-28 Health Drift Performance Follow-Up
|
|
177
|
+
|
|
178
|
+
The `src/queries/health/health.ts` citation remains accurate. The
|
|
179
|
+
hyper-optimization follow-up only skips advisory drift `pattern-deviation` rows
|
|
180
|
+
for health and baseline paths that already hide those rows; health scoring,
|
|
181
|
+
phase inventory, and public `drift` output are unchanged.
|
|
182
|
+
|
|
183
|
+
## 2026-06-28 Diff-Gate Co-Change Follow-Up
|
|
184
|
+
|
|
185
|
+
The `src/queries/impact/diff-gate.ts` citation remains accurate. Diff-gate
|
|
186
|
+
still owns `DIFF_GATE_CHECKS`; the co-change partner check now compares against
|
|
187
|
+
the raw git changed-path set so changed docs and config files count as present
|
|
188
|
+
even when they are not indexed code files.
|
|
189
|
+
|
|
190
|
+
## 2026-06-28 Focused Co-Change History Follow-Up
|
|
191
|
+
|
|
192
|
+
The `src/queries/impact/diff-gate.ts` citation remains accurate after the
|
|
193
|
+
focused co-change history optimization. Diff-gate still owns the check list and
|
|
194
|
+
co-change partner gate; the latest change only narrows the git-history read for
|
|
195
|
+
that gate to commits in the bounded analysis window that touched changed files.
|
|
@@ -15,7 +15,7 @@ The ledger is anchored to the current tool surface, not memory.
|
|
|
15
15
|
| Surface | Source | Why it anchors the ledger |
|
|
16
16
|
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------- |
|
|
17
17
|
| Repo-wide health analysis | `scip-query code health --json` reported `src/queries/health/health.ts:194`, where `health()` runs `runHealthAnalyses()` and `buildHealthReport()`. | Every repo-wide analyzer validation must eventually reconcile with health output and scoring. |
|
|
18
|
-
| Change-time gate analysis | `scip-query code diffGate --json` reported `src/queries/impact/diff-gate.ts:94`, where `diffGate()` runs the default diff-scoped checks: `echo`, `incomplete-migration`, `co-change-partner`, `doc-reference`, `unused-params`, and `new-dead`. The baseline ratchet is explicit because it is repo-wide.
|
|
18
|
+
| Change-time gate analysis | `scip-query code diffGate --json` reported `src/queries/impact/diff-gate.ts:94`, where `diffGate()` runs the default diff-scoped checks: `echo`, `incomplete-migration`, `co-change-partner`, `doc-reference`, `unused-params`, and `new-dead`. The baseline ratchet is explicit because it is repo-wide. | Every diff-only analyzer needs a separate validation path from repo-wide health. |
|
|
19
19
|
| Public command registry | `scip-query trace queryCommandOrder --json` reported `src/runtime/commands/query-command-specs.ts:10`, where the public query command order starts. `scip-query code queryCommandDescriptor --json` reported `src/runtime/commands/query-command-specs.ts:94`, where command descriptors are resolved by id. | The ledger must not silently miss a public analyzer command. |
|
|
20
20
|
| Diff-gate check list | `scip-query trace DIFF_GATE_CHECKS --json` reported `src/queries/impact/diff-gate.ts:27`, where the canonical diff-gate check list is exported. | The ledger must cover every change-time check that can block a diff. |
|
|
21
21
|
|
|
@@ -268,3 +268,34 @@ The maintainability-register completion slice rechecked the ledger's command-sur
|
|
|
268
268
|
## 2026-06-23 Current Sweep Citation Refresh
|
|
269
269
|
|
|
270
270
|
The current maintainability sweep rechecked the `diff-gate.ts` citation again after doc-reference and baseline policy helpers moved into private query modules. The ledger remains accurate because `diffGate()` and `DIFF_GATE_CHECKS` still live in `src/queries/impact/diff-gate.ts`; the baseline policy body remains behind the same entry point, but the repo-wide baseline ratchet is explicit rather than part of default diff-gate execution.
|
|
271
|
+
|
|
272
|
+
## 2026-06-28 Diff-Gate Echo Follow-Up
|
|
273
|
+
|
|
274
|
+
The `diffGate()` citation remains accurate: default diff-gate execution still
|
|
275
|
+
runs echo, incomplete migration, co-change partner, doc-reference,
|
|
276
|
+
unused-params, and new-dead checks through `src/queries/impact/diff-gate.ts`.
|
|
277
|
+
The performance follow-up only skips non-callable changed symbols before echo
|
|
278
|
+
similarity scoring; baseline ratchet behavior and check configuration remain
|
|
279
|
+
unchanged.
|
|
280
|
+
|
|
281
|
+
## 2026-06-28 Health Drift Performance Follow-Up
|
|
282
|
+
|
|
283
|
+
The `src/queries/health/health.ts` reference remains accurate after the health
|
|
284
|
+
drift optimization. Health and the baseline ratchet now ask `drift()` to skip
|
|
285
|
+
advisory `pattern-deviation` rows they already exclude from visible output and
|
|
286
|
+
stable finding identities; the repo-wide health score contract is unchanged.
|
|
287
|
+
|
|
288
|
+
## 2026-06-28 Diff-Gate Co-Change Follow-Up
|
|
289
|
+
|
|
290
|
+
The `diffGate()` citation remains accurate. Default diff-gate still runs the
|
|
291
|
+
same check family; the co-change partner check now uses the raw git changed
|
|
292
|
+
paths when deciding whether a historical partner is already present in the
|
|
293
|
+
diff.
|
|
294
|
+
|
|
295
|
+
## 2026-06-28 Focused Co-Change History Follow-Up
|
|
296
|
+
|
|
297
|
+
The `diffGate()` citation remains accurate after the focused co-change history
|
|
298
|
+
optimization. Default diff-gate still runs the same check family; the
|
|
299
|
+
co-change partner check now reads only changed-file commits from the same
|
|
300
|
+
bounded git-history window instead of parsing the whole name-only history
|
|
301
|
+
payload.
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: scip-hyper-optimization
|
|
3
|
-
description: Run scientific performance optimization campaigns with scip-query evidence, command ledgers, and benchmark corpora. Use when the user asks to hyper optimize, make commands blazing fast, speed up a CLI/tool/app, benchmark regressions, or compare targeted tuning against radically different implementations.
|
|
3
|
+
description: Run scientific performance optimization campaigns with scip-query evidence, hierarchical profiling, command ledgers, and benchmark corpora. Use when the user asks to hyper optimize, make commands blazing fast, speed up a CLI/tool/app, find bottlenecks, benchmark regressions, optimize cold or warm paths, or compare targeted tuning against radically different implementations.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# SCIP Hyper Optimization
|
|
7
|
+
|
|
7
8
|
Use this skill to make a command, workflow, service, page, or tool as fast as
|
|
8
9
|
feasibly possible without changing its observable result. Hyper optimization is
|
|
9
10
|
a bounded campaign that improves runtime, memory use, or computational cost
|
|
@@ -12,9 +13,16 @@ benchmark and unchanged output.
|
|
|
12
13
|
|
|
13
14
|
A measurement harness is the repeatable set of commands, fixtures, corpora,
|
|
14
15
|
environment notes, and result documents used to decide whether performance
|
|
15
|
-
changed. A
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
changed. A run history is the durable time-series of those measurements: one
|
|
17
|
+
record per run, command, subprocess, or profiled stage, with enough metadata to
|
|
18
|
+
compare commits and draw charts later. A profile span is one named timed piece
|
|
19
|
+
of work inside the target process, such as input loading, cache reads, database
|
|
20
|
+
queries, graph traversal, rendering, or a child process. Hierarchical profiling
|
|
21
|
+
is using coarse spans to find the dominant stage, then recursively splitting
|
|
22
|
+
only that stage until the expensive operation is concrete enough to fix. A
|
|
23
|
+
command ledger is the living document for one target: what it returns, what code
|
|
24
|
+
runs, where time is spent, what was tried, and what evidence accepted or
|
|
25
|
+
rejected each idea.
|
|
18
26
|
|
|
19
27
|
## Rules
|
|
20
28
|
|
|
@@ -23,22 +31,43 @@ accepted or rejected each idea.
|
|
|
23
31
|
`call-graph`, `code`, `dataflow`, `complexity`, `diff-impact`, `diff-gate`.
|
|
24
32
|
3. Capture representative inputs, required output behavior, and correctness
|
|
25
33
|
checks before editing.
|
|
26
|
-
4.
|
|
27
|
-
|
|
28
|
-
5.
|
|
34
|
+
4. Record every benchmark in a machine-readable run history before and after
|
|
35
|
+
each optimization; Markdown summaries are secondary.
|
|
36
|
+
5. Measure cold-index, cold-cache or evidence-fill, warm steady-state, and
|
|
37
|
+
repeated focused paths separately when they can diverge.
|
|
38
|
+
6. Profile the target's internal chain before editing. A bare command duration
|
|
39
|
+
is enough to rank targets, not enough to choose a fix.
|
|
40
|
+
7. Treat profiling as a search algorithm: place coarse spans first, split the
|
|
41
|
+
biggest span, and stop descending only when the slow operation is identifiable
|
|
42
|
+
as a specific repeated lookup, initialization, scan, traversal, subprocess,
|
|
43
|
+
serialization step, or wait.
|
|
44
|
+
8. Attach counts to spans: files, rows, symbols, candidates, cache hits/misses,
|
|
45
|
+
subprocesses, bytes, edges, nodes, retries, and output rows. Time without
|
|
46
|
+
cardinality hides the cause.
|
|
47
|
+
9. Work both tracks: tune the current pipeline and evaluate radically different
|
|
29
48
|
algorithms or data models that preserve the same result.
|
|
30
|
-
|
|
31
|
-
|
|
49
|
+
10. Keep only changes that improve real workloads without reducing accuracy,
|
|
50
|
+
diagnostics, safety checks, or supported inputs.
|
|
51
|
+
|
|
52
|
+
## Phase 0: Target And Measurement Harness
|
|
32
53
|
|
|
33
|
-
## Phase 0: Measurement Harness
|
|
34
54
|
If the target repository is not already a reliable scip-query workspace, invoke
|
|
35
55
|
`scip-query-setup` first. Do not run setup-ci in this workflow.
|
|
36
56
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
Choose the optimization target explicitly. Use user-reported pain, production
|
|
58
|
+
telemetry, benchmark ranking, regression data, cost, frequency, or risk to
|
|
59
|
+
justify why this target comes first. Do not optimize the slowest thing by habit
|
|
60
|
+
if another path dominates real user time or compute spend.
|
|
61
|
+
|
|
62
|
+
Create or update a benchmark note and a run-history store before code changes.
|
|
63
|
+
Prefer the repo's existing convention; otherwise use
|
|
64
|
+
`docs/benchmarks/YYYY-MM-DD-<target>-baseline.md` and
|
|
65
|
+
`docs/benchmarks/runs/YYYY-MM-DD-<target>.jsonl`. Include target, machine/date
|
|
40
66
|
context, corpus or fixture list, cold/warm/correctness commands, baseline
|
|
41
|
-
timings, output-contract evidence, and slowest stages.
|
|
67
|
+
timings, output-contract evidence, and slowest stages. Append a structured run
|
|
68
|
+
record for each measurement with at least timestamp, commit/version, target,
|
|
69
|
+
corpus, scenario, command, duration, exit status, output hash or size, and
|
|
70
|
+
notes for outliers.
|
|
42
71
|
|
|
43
72
|
Choose the measurement mechanism from the target's real workload. For app
|
|
44
73
|
paths, use the app's benchmark, test, route smoke, build, profiler, load test,
|
|
@@ -51,13 +80,20 @@ scip-query bench --json
|
|
|
51
80
|
scip-query bench --json --cold-index --include-heavy --timeout-ms 600000
|
|
52
81
|
```
|
|
53
82
|
|
|
83
|
+
For long benchmark matrices, prefer progress output or incremental JSONL writes
|
|
84
|
+
so the current command, subprocess, elapsed time, and completed measurements are
|
|
85
|
+
visible while the run is still active and useful if interrupted.
|
|
86
|
+
|
|
54
87
|
## Phase 1: Command Ledger
|
|
88
|
+
|
|
55
89
|
Create one ledger per target:
|
|
56
90
|
`docs/benchmarks/YYYY-MM-DD-<target>-ledger.md`. Include Output Contract,
|
|
57
|
-
Current Pipeline,
|
|
58
|
-
|
|
91
|
+
Target Selection, Current Pipeline, Run History Location, Profile Spans,
|
|
92
|
+
Bottleneck Candidates, Measurements, Current-Pipeline Optimizations,
|
|
93
|
+
Alternative Designs, and Decisions.
|
|
59
94
|
|
|
60
95
|
## Phase 2: Trace Current Behavior
|
|
96
|
+
|
|
61
97
|
Trace the target end to end and write the actual path into the ledger:
|
|
62
98
|
|
|
63
99
|
```bash
|
|
@@ -72,26 +108,119 @@ scip-query complexity <hot-symbol>
|
|
|
72
108
|
scip-query change-surface <touched-file> --json --full
|
|
73
109
|
```
|
|
74
110
|
|
|
75
|
-
Record
|
|
76
|
-
|
|
111
|
+
Record the chain reaction from entry point to result: input parsing, option
|
|
112
|
+
resolution, subprocesses, lookups, database queries, graph traversal, source
|
|
113
|
+
scans, semantic calls, cache reads/writes, rendering, output serialization, and
|
|
114
|
+
verification. The trace should be concrete enough that each major step can be
|
|
115
|
+
timed as a profile span.
|
|
116
|
+
|
|
117
|
+
Before adding spans, use the trace to predict span boundaries. Good first spans
|
|
118
|
+
usually match the target's real pipeline nouns: load inputs, compute candidates,
|
|
119
|
+
read cache, compute misses, write cache, build graph, score, render, serialize,
|
|
120
|
+
and child process. Use `call-graph` to find nested helpers inside the slow
|
|
121
|
+
stage, `dataflow` to follow the expensive object or cache key, `refs` to learn
|
|
122
|
+
whether a suspected fix affects other paths, and `complexity` to avoid spending
|
|
123
|
+
the first profiling pass on low-risk glue.
|
|
124
|
+
|
|
125
|
+
## Phase 3: Profile The Timed Chain
|
|
126
|
+
|
|
127
|
+
Before editing, produce a stage profile for the selected target. Prefer existing
|
|
128
|
+
runtime profilers, tracing systems, structured logs, or benchmark hooks. If none
|
|
129
|
+
exist, add temporary or permanent instrumentation that names timed spans without
|
|
130
|
+
changing observable output. For CLIs and build tools, include child processes
|
|
131
|
+
and worker tasks; for services, include request handlers, database calls,
|
|
132
|
+
network calls, queue jobs, cache hits/misses, rendering, and serialization.
|
|
133
|
+
|
|
134
|
+
Use this discovery ladder:
|
|
135
|
+
|
|
136
|
+
1. Measure the target unprofiled so the user-facing baseline is real.
|
|
137
|
+
2. Measure it profiled once. If profiled and unprofiled times are close, the
|
|
138
|
+
profiler is diagnostic overhead, not the bottleneck. If profiling dominates,
|
|
139
|
+
fix the harness before trusting fine spans.
|
|
140
|
+
3. Measure distinct states separately: cold index, cold derived-cache/evidence
|
|
141
|
+
fill, warm cache hit, repeated focused run, and production-like mixed state.
|
|
142
|
+
4. Add coarse spans that cover the whole chain. If span time does not explain
|
|
143
|
+
wall time, look for uninstrumented child processes, async waits, I/O, process
|
|
144
|
+
startup, or profiler gaps.
|
|
145
|
+
5. Pick the largest span by wall time multiplied by real workload frequency.
|
|
146
|
+
Split only that span into child spans.
|
|
147
|
+
6. Repeat until a fixable operation appears: a repeated singleton creation, a
|
|
148
|
+
per-item lookup, a broad scan, a wrapper traversal, a cache miss storm, a
|
|
149
|
+
subprocess startup, a serialization step, or a wait.
|
|
150
|
+
7. Add cardinality metadata to every split: count of rows/files/symbols/nodes,
|
|
151
|
+
cache hits/misses, bytes, output rows, and skipped items.
|
|
152
|
+
8. Record the before profile in the ledger before touching code.
|
|
153
|
+
|
|
154
|
+
Write profile records to the run history with parent/child span names when
|
|
155
|
+
possible. Separate wall time from CPU time when the tools allow it. Mark cache
|
|
156
|
+
state explicitly: cold index, cold evidence/cache fill, warm cache hit, repeated
|
|
157
|
+
focused run, or production-like mixed state.
|
|
158
|
+
|
|
159
|
+
## Phase 4: Diagnose And Find Speedups
|
|
160
|
+
|
|
161
|
+
Classify the dominant span before choosing a fix:
|
|
162
|
+
|
|
163
|
+
| Profile shape | Likely cause | First fixes to test |
|
|
164
|
+
| ----------------------------------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- |
|
|
165
|
+
| Cold path huge, warm path fast | Derived evidence/cache fill, expensive initialization, or cache invalidation | Persist the derived result, reuse compatible cache versions, batch cache fills, hoist initialization |
|
|
166
|
+
| Warm path still slow | Cache scan, query shape, deserialization, reshaping, rendering, or output size | Narrow query, add indexes, store compact payloads, stream or avoid repeated object shaping |
|
|
167
|
+
| Same expensive setup repeated across many files/items | Singleton/client/checker/session/project built inside a loop | Preload required inputs, create once after inputs are stable, cache per project/process |
|
|
168
|
+
| Many medium-cost per-item operations | N+1 lookups, scalar provider calls, repeated source reads | Batch by provider/file/key, load rows in bulk, group work by locality |
|
|
169
|
+
| Traversal span grows with AST/source nodes | Wrapper allocation or broad source scan | Use lower-level APIs, prefilter by exact names only when output identity proves equivalence, index reusable facts |
|
|
170
|
+
| Database time dominates | Broad scan, missing index, many statements, repeated prepares | Push filters into SQL, batch queries, cache prepared statements, add measured indexes |
|
|
171
|
+
| Child process or startup dominates | Too many subprocesses or cold tool startup | Reuse workers, batch commands, keep warm daemons, collapse process boundaries |
|
|
172
|
+
| Serialization/output dominates | Large JSON, repeated formatting, full materialization | Stream, summarize, avoid duplicate fields, or add an explicit compact mode |
|
|
77
173
|
|
|
78
|
-
## Phase 3: Find Speedups
|
|
79
174
|
For the current pipeline, look for repeated work, broad scans, N+1 lookups,
|
|
80
175
|
uncached pure work, avoidable source or semantic reads, large arrays, late
|
|
81
|
-
filters, batchable per-file work,
|
|
176
|
+
filters, batchable per-file work, excessive subprocess startup, serialization
|
|
177
|
+
cost, cache invalidation churn, and safe parallelism. Prioritize by measured
|
|
178
|
+
span cost multiplied by real workload frequency; do not chase a large cold-only
|
|
179
|
+
span if the stated purpose depends on warm interactive latency.
|
|
180
|
+
|
|
181
|
+
Favor fixes in this order when they preserve output:
|
|
182
|
+
|
|
183
|
+
1. Remove accidental repetition: hoist, memoize, reuse, or preload.
|
|
184
|
+
2. Batch scalar work by provider, file, database key, network endpoint, or
|
|
185
|
+
process.
|
|
186
|
+
3. Move stable derived work from the hot path into an index/cache with a clear
|
|
187
|
+
invalidation key.
|
|
188
|
+
4. Replace broad scans with indexed lookups or candidate-first retrieval.
|
|
189
|
+
5. Replace high-overhead wrapper APIs with lower-level APIs only after output
|
|
190
|
+
identity checks prove equivalence.
|
|
191
|
+
6. Add pruning only when it is mathematically equivalent or output-identity
|
|
192
|
+
checks across representative corpora prove no observable change.
|
|
82
193
|
|
|
83
194
|
For alternative designs, restate the output contract first. Ask whether SQLite
|
|
84
195
|
can answer directly, an index/cache/precomputed table can move work out of the
|
|
85
196
|
hot path, batch queries can replace loops, a cheap pruning stage can precede
|
|
86
197
|
exact work, or workers can run independent phases safely.
|
|
87
198
|
|
|
88
|
-
## Phase
|
|
199
|
+
## Phase 5: Implement And Verify
|
|
200
|
+
|
|
89
201
|
Make the smallest reversible change that tests one performance hypothesis.
|
|
90
|
-
Update the ledger with hypothesis, changed files/symbols,
|
|
91
|
-
output comparison, tests, and gates.
|
|
202
|
+
Update the ledger and run history with hypothesis, changed files/symbols,
|
|
203
|
+
before/after timings, profile-span deltas, output comparison, tests, and gates.
|
|
204
|
+
|
|
205
|
+
After each candidate fix, run the smallest valid before/after matrix for the
|
|
206
|
+
target scenario: unprofiled control, profiled profile, output hash or semantic
|
|
207
|
+
identity check, and representative correctness tests. If a faster change alters
|
|
208
|
+
the output contract, reject or revert it unless the user explicitly approved a
|
|
209
|
+
behavior change.
|
|
92
210
|
|
|
93
211
|
Run the narrow correctness check, benchmark cases, `scip-query diff-impact
|
|
94
212
|
--json`, and `scip-query diff-gate --json`; reindex first if freshness is not
|
|
95
213
|
proven. Also run postchecks matching the change type. End with starting time,
|
|
96
214
|
final time, percentage change, accepted changes, rejected ideas, remaining
|
|
97
|
-
bottlenecks, and the next target.
|
|
215
|
+
bottlenecks, and the next target. If results conflict, keep the change only when
|
|
216
|
+
the target scenario and output contract justify it; otherwise revert and record
|
|
217
|
+
the rejected hypothesis.
|
|
218
|
+
|
|
219
|
+
## Phase 6: Report And Visualize
|
|
220
|
+
|
|
221
|
+
End every optimization round with a compact scoreboard generated from the run
|
|
222
|
+
history, not hand-copied memory. At minimum, show starting value, current value,
|
|
223
|
+
delta, scenario, corpus, commit/version, and output identity evidence. When the
|
|
224
|
+
history has enough rows, produce a trend table or chart for the target command
|
|
225
|
+
or workflow. Keep Markdown readable for humans, but treat the structured
|
|
226
|
+
history as the source of truth.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
|
-
display_name:
|
|
3
|
-
short_description:
|
|
4
|
-
default_prompt:
|
|
2
|
+
display_name: 'SCIP Hyper Optimization'
|
|
3
|
+
short_description: 'Hierarchical profiling-driven optimization'
|
|
4
|
+
default_prompt: 'Use $scip-hyper-optimization to choose an optimization target, capture output identity, measure cold and warm controls, profile the dominant span hierarchically, then optimize without changing behavior.'
|
package/dist/chunk-2H57MJLI.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as o,d as a}from"./chunk-BZ53S4ZN.js";import{a as p}from"./chunk-PVZMPG5I.js";import{a as c,b as m,c as f}from"./chunk-YWOOQ4FF.js";import{c as u}from"./chunk-YZA6PPZL.js";function D(n,i={}){let{minSimilarity:t=.62,minTokens:e=8,limit:l=20,scope:d,scanLimit:h,filePattern:k}=i,P=g(n,{scope:d,minTokens:e,scanLimit:h});return p({profiles:P,limit:l,filePattern:k,compare:(r,s)=>v(r,s,t),sort:(r,s)=>s.similarity-r.similarity||r.fileA.localeCompare(s.fileA)||r.fileB.localeCompare(s.fileB)})}function g(n,i){return u(n,{scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(t=>({file:t.file,tokens:t.templateTokens,loc:C(t)}))}function C(n){return n.totalLines}function v(n,i,t){let e=c(n.tokens,i.tokens);if(e.size<6||!T(e))return null;let l=f(n.tokens,i.tokens);return l<t?null:{fileA:n.file,fileB:i.file,similarity:l,sharedTokens:a(e),sharedComponents:o(e,"component:"),sharedProps:o(e,"prop:"),sharedEvents:o(e,"event:"),sharedDirectives:o(e,"directive:"),sharedSlots:o(e,"slot:"),sharedIdentifiers:o(e,"id:"),uniqueToA:a(m(n.tokens,i.tokens)).slice(0,25),uniqueToB:a(m(i.tokens,n.tokens)).slice(0,25),locA:n.loc,locB:i.loc}}function T(n){let i=0,t=0;for(let e of n)e.startsWith("component:")&&(i+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("directive:")||e.startsWith("slot:"))&&(t+=1);return i>=1||t>=3}export{D as a};
|
|
2
|
-
//# sourceMappingURL=chunk-2H57MJLI.js.map
|
package/dist/chunk-4TMJDHC6.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as L,b as F,e as D,f as E,g as k,h as z,i as $}from"./chunk-YWOOQ4FF.js";import{b as q}from"./chunk-B75HZHUP.js";import{a as w}from"./chunk-XPOZO76D.js";import{a as B}from"./chunk-ZMU6IWDK.js";import{a as v}from"./chunk-T633QLYF.js";import{c as b,d as R,g as I}from"./chunk-JM72FNGA.js";import{b as N}from"./chunk-DS6QEB3G.js";import{d as C}from"./chunk-7S5E7KWT.js";function Ne(e,n,i={}){let{minSimilarity:t=.4,limit:a=20}=i,s=ie(e,n,{semantic:i.semantic!==!1});if(!s)return[];if(!I(s.symbol))return[];let r=Y(e,s,t,{scanLimit:i.scanLimit,semantic:i.semantic!==!1});return r.length>0?r.slice(0,a):me(e,n,{minSimilarity:t,limit:a})}function Y(e,n,i,t){let a=j(e,{minCallees:3,scanLimit:t.scanLimit,semantic:t.semantic}),s=oe(n,a),r=J(n,a),o=E(r),c=k(n.callees,r),l=[];for(let m of s){if(m.callees.size<3)continue;let p=k(m.callees,r),u=P(n,m,r,{minSimilarity:i,requireSignificantShared:1,requireSharedCount:0,medianIdf:o,magnitudeA:c,magnitudeB:p});u&&l.push(u)}return l.sort((m,p)=>p.similarity-m.similarity),l}function J(e,n){let i=new Map(n.docFreq);for(let t of e.callees)i.set(t,(i.get(t)??0)+1);return D(i,n.corpus.length+1)}function P(e,n,i,t){let a=t.magnitudeA===void 0||t.magnitudeB===void 0?z(e.callees,n.callees,i,{medianIdf:t.medianIdf}):$(e.callees,n.callees,i,{medianIdf:t.medianIdf,magnitudeA:t.magnitudeA,magnitudeB:t.magnitudeB}),{similarity:s,significantShared:r,trivialShared:o}=a;if(s<t.minSimilarity)return null;let c=r.length+o.length;if(r.length<t.requireSignificantShared&&c<t.requireSharedCount)return null;let l=r.length>0?r:o,m=U(l,"callees");return{symbolA:e.symbol,shortNameA:b(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:b(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:l.map(b),uniqueToA:[...F(e.callees,n.callees)].map(b),uniqueToB:[...F(n.callees,e.callees)].map(b),...m}}function Be(e,n={}){let{minSimilarity:i=.5,limit:t=20,scope:a,minCallees:s=4,crossFileOnly:r=!1,scanLimit:o}=n,c=j(e,{minCallees:s,scope:a,scanLimit:o,semantic:n.semantic!==!1}),l=c.corpus,m=[],p=0;for(let u=0;u<l.length;u+=1){let d=l[u],y=c.weightedMagnitudes[u],h=new Set;for(let g of d.callees){let f=c.candidateIndexesByCallee.get(g);if(f)for(let S of f)S>u&&h.add(S)}for(let g of h){let f=l[g];if(r&&d.file===f.file)continue;if(d.paramCount>=0&&f.paramCount>=0){let X=Math.abs(d.paramCount-f.paramCount),Q=Math.max(2,Math.ceil(Math.max(d.paramCount,f.paramCount)*.5));if(X>Q)continue}let S=P(d,f,c.idfWeights,{minSimilarity:i,requireSignificantShared:2,requireSharedCount:4,medianIdf:c.medianIdf,magnitudeA:y,magnitudeB:c.weightedMagnitudes[g]});S&&(ee(m,S,t,p),p+=1)}}return m.sort((u,d)=>d.result.similarity-u.result.similarity||u.order-d.order),m.map(u=>u.result)}function ee(e,n,i,t){if(i<=0)return;if(e.length<i){e.push({result:n,order:t});return}let a=0;for(let r=1;r<e.length;r+=1){let o=e[r],c=e[a];(o.result.similarity<c.result.similarity||o.result.similarity===c.result.similarity&&o.order>c.order)&&(a=r)}let s=e[a];n.similarity<=s.result.similarity||(e[a]={result:n,order:t})}var ne=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function ie(e,n,i){let t=v(e,n),a=new w(e);if(!t)return null;let s=B(e,t,{semantic:i.semantic});return{symbol:t.symbol,file:t.relativePath,callees:G(s.map(r=>r.symbol)),paramCount:a.callableSignature(t)?.paramCount??-1}}var te=C("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),re=C("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function se(e,n){let{minCallees:i,scope:t,excludeSymbol:a,scanLimit:s}=n,r=n.semantic!==!1,o=te.get(e,()=>new Map),c=`${i}|${t??""}|${s??""}|${r}`,l=o.get(c);return l||(l=le(e,{minCallees:i,scope:t,scanLimit:s,semantic:r}),o.set(c,l)),a===void 0?l:l.filter(m=>m.symbol!==a)}function j(e,n){let{minCallees:i,scope:t,scanLimit:a}=n,s=n.semantic!==!1,r=re.get(e,()=>new Map),o=`${i}|${t??""}|${a??""}|${s}`,c=r.get(o);return c||(c=ae(se(e,{minCallees:i,scope:t,scanLimit:a,semantic:s})),r.set(o,c)),c}function ae(e){let n=new Map;for(let r of e)for(let o of r.callees)n.set(o,(n.get(o)??0)+1);let i=Math.max(8,Math.ceil(Math.sqrt(e.length))),t=D(n,e.length),a=e.map(r=>k(r.callees,t)),s=new Map;for(let r=0;r<e.length;r+=1){let o=e[r];for(let c of o.callees){if((n.get(c)??0)>i)continue;let l=s.get(c);l||(l=[],s.set(c,l)),l.push(r)}}return{corpus:e,candidateIndexesByCallee:s,docFreq:n,idfWeights:t,weightedMagnitudes:a,medianIdf:E(t),ubiquityThreshold:i}}function oe(e,n){let i=new Map;for(let t of e.callees)for(let a of n.candidateIndexesByCallee.get(t)??[]){let s=n.corpus[a];s.symbol!==e.symbol&&i.set(s.symbol,s)}return i.size>0?[...i.values()]:n.corpus.filter(t=>t.symbol!==e.symbol)}function le(e,n){let{minCallees:i,scope:t,scanLimit:a,semantic:s}=n,r=new w(e),o=q(r.productionCallableDefinitions({scope:t,minLoc:5,sortByLocDesc:typeof a=="number"&&a>0}),a),c=r.calleeMap(o,{semantic:s});return o.map(l=>({symbol:l.symbol,file:l.relativePath,callees:G((c.get(l.symbolId)??[]).map(m=>m.symbol)),paramCount:r.callableSignature(l)?.paramCount??-1})).filter(l=>l.callees.size>=i)}function G(e){return new Set([...e].filter(n=>!ce(n)))}function ce(e){return ne.some(n=>e.includes(n))}function me(e,n,i){let t=ge(e,n);if(!t||t.tokens.size<3)return[];let a=i.minSimilarity>=.5?i.minSimilarity:.3,s=[],r=Fe(t,he(e));for(let o of r){if(o.symbol===t.symbol||o.tokens.size<3)continue;let c=L(t.tokens,o.tokens);if(c.size<2)continue;let l=new Set([...t.tokens,...o.tokens]),m=l.size>0?c.size/l.size:0;m<a||s.push({symbolA:t.symbol,shortNameA:b(t.symbol),fileA:t.file,symbolB:o.symbol,shortNameB:b(o.symbol),fileB:o.file,similarity:m,similarityBasis:"source-tokens",sharedCallees:[...c].sort(),uniqueToA:[...F(t.tokens,o.tokens)].sort(),uniqueToB:[...F(o.tokens,t.tokens)].sort(),...U([...c],"source-tokens")})}return s.sort((o,c)=>c.similarity-o.similarity||o.shortNameB.localeCompare(c.shortNameB)),s.slice(0,i.limit)}function U(e,n){let i=e.flatMap(T),t=e.flatMap(g=>_(g,n)),a=M(i,V),s=M(i,W),r=M(t,A),o=[...new Set(t.filter(O))],c=e.filter(g=>{let f=_(g,n);return f.some(S=>A.has(S))&&f.some(O)}).length,l=[];a.length>0&&l.push(`access/query scaffolding: ${a.slice(0,5).join(", ")}`),s.length>0&&l.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),r.length>0&&l.push(`domain behavior verbs: ${r.slice(0,5).join(", ")}`),r.length>0&&o.length>0&&l.push(`domain-specific terms: ${o.slice(0,5).join(", ")}`);let m=n==="source-tokens"&&i.length>0&&i.every(g=>K.has(g));m&&l.push("shared source tokens are generic scaffolding");let p=r.length>0&&o.length>0,u=a.length+s.length>0,d=n==="callees"&&p&&e.length>=4&&o.length>=4&&c>=2,y=d?"domain-behavior":p?u?"mixed":"domain-behavior":a.length>0?"access-query-scaffolding":s.length>0||m?"framework-scaffolding":"structural-overlap";y==="structural-overlap"&&e.length>0&&l.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let h=y==="domain-behavior"&&(e.length>=3||d)?"direct":"signal";return{evidenceClass:y,actionTier:h,evidenceClassReasons:l,recommendation:ue(y,h)}}function ue(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function M(e,n){return[...new Set(e.filter(i=>n.has(i)))]}function T(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function _(e,n){if(n==="source-tokens")return T(e);let i=R(e);return T(i.length>0?i:de(e))}function de(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(t=>t.trim()).filter(t=>/[A-Za-z]/.test(t)).at(-1)?.replace(/\.$/,"")??e}function O(e){return e.length>3&&!A.has(e)&&!V.has(e)&&!W.has(e)&&!K.has(e)&&!fe.has(e)}var A=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),V=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),W=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),K=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),fe=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function ge(e,n){let i=v(e,n);if(!i||!I(i.symbol))return null;let t=pe(e,i);return t?{symbol:i.symbol,file:i.relativePath,tokens:t}:null}function pe(e,n){let i=R(n.symbol),t=Z(e,n.relativePath,n.startLine,n.endLine,i),a=H(t,i);return a.size>0?a:null}var be=C("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Se=C("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function ye(e){return be.get(e,()=>xe(e))}function he(e){return Se.get(e,()=>Ce(ye(e)))}function Ce(e){let n=new Map;for(let a of e)for(let s of a.tokens)n.set(s,(n.get(s)??0)+1);let i=Math.max(8,Math.ceil(Math.sqrt(e.length))),t=new Map;for(let a of e)for(let s of a.tokens){if((n.get(s)??0)>i)continue;let r=t.get(s);r||(r=[],t.set(s,r)),r.push(a)}return{corpus:e,candidateByToken:t,docFreq:n,ubiquityThreshold:i}}function Fe(e,n){let i=new Map;for(let t of e.tokens)for(let a of n.candidateByToken.get(t)??[])a.symbol!==e.symbol&&i.set(a.symbol,a);return i.size>0?[...i.values()]:n.corpus.filter(t=>t.symbol!==e.symbol)}function xe(e){return new w(e).productionCallableDefinitions().map(i=>({symbol:i.symbol,file:i.relativePath,tokens:H(Z(e,i.relativePath,i.startLine,i.endLine,i.leaf),i.leaf)})).filter(i=>i.tokens.size>0)}function Z(e,n,i,t,a){let s=N(e,n);if(s.length===0)return"";if(t>=i&&t-i<=12)return s.slice(i,t+1).join(`
|
|
2
|
-
`);let r=[new RegExp(`\\bdef\\s+${x(a)}\\b`),new RegExp(`\\bfun\\s+${x(a)}\\b`),new RegExp(`\\bfn\\s+${x(a)}\\b`),new RegExp(`\\bfunction\\s+${x(a)}\\b`),new RegExp(`\\b${x(a)}\\s*\\(`)],o=s.findIndex(c=>r.some(l=>l.test(c)));if(o>=0){let c=o;for(let l=o+1;l<s.length&&l<=o+8;l++){let m=s[l]??"";if(l>o&&ke(m)||(c=l,m.trim()===""&&l>o+1))break}return s.slice(o,c+1).join(`
|
|
3
|
-
`)}return s.slice(i,Math.min(s.length,i+8)).join(`
|
|
4
|
-
`)}function H(e,n){if(!e)return new Set;let i=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),t=we(n),s=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(r=>r.trim()).filter(r=>r.length>1).filter(r=>!i.has(r)).filter(r=>!t.has(r));return new Set(s)}function we(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function ke(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{Ne as a,J as b,Be as c,ee as d,se as e,j as f,ae as g,oe as h,G as i,U as j};
|
|
5
|
-
//# sourceMappingURL=chunk-4TMJDHC6.js.map
|
package/dist/chunk-5GVOJOBL.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as y}from"./chunk-B75HZHUP.js";import{a as f}from"./chunk-XPOZO76D.js";import{a as r}from"./chunk-BGBBVSH4.js";import{c as b}from"./chunk-JM72FNGA.js";function x(u,m={}){let{scope:p,minLoc:h=3,scanLimit:i}=m,s=new f(u),c=m.semantic!==!1,o=y(s.productionCallableDefinitions({scope:p,minLoc:h,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof i=="number"&&i>0}),i),I=s.crossFileCallerMap(o,{semantic:!1}),a=new Set(I.keys());for(let e of s.frameworkReferencedSymbolIds(o))a.add(e);let l=s.symbolsWithNonSelfCallees(o,{additive:!1,semantic:!1}),t=o.filter(e=>!a.has(e.symbolId)).filter(e=>!l.has(e.symbolId));if(c&&t.length>0){for(let e of s.crossFileCallerMap(t,{semantic:!0}).keys())a.add(e);for(let e of s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:!0}))l.add(e);t=t.filter(e=>!a.has(e.symbolId)).filter(e=>!l.has(e.symbolId))}let L=s.sourceFallbackCallerFiles(t);for(let e of L.keys())a.add(e);let d=t.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:c});for(let e of C)l.add(e);return d.filter(e=>!l.has(e.symbolId)).sort((e,n)=>r(n)-r(e)||e.relativePath.localeCompare(n.relativePath)||e.startLine-n.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r(e)}))}export{x as a};
|
|
2
|
-
//# sourceMappingURL=chunk-5GVOJOBL.js.map
|
package/dist/chunk-7XWXGANX.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as re}from"./chunk-S7YOLFLX.js";import{a as oe}from"./chunk-SOGKYB5I.js";import{a as S}from"./chunk-B32FX5KB.js";import{a as ne}from"./chunk-I274B3B3.js";import{a as te}from"./chunk-X3Z4MLVL.js";import{a as ie}from"./chunk-C2QSK7E7.js";import{a as X,c as ee}from"./chunk-4TMJDHC6.js";import{a as Z}from"./chunk-5GVOJOBL.js";import{a as Q}from"./chunk-63MSELOP.js";import{a as J}from"./chunk-JYSAYZNX.js";import{a as _,c as z,d as O,h as E,i as L}from"./chunk-QDGKE5HN.js";import{a as U,b as v,e as V}from"./chunk-P3K7LX7M.js";import{a as Y}from"./chunk-VAXDTQHE.js";import{b as W}from"./chunk-FVA3NH4P.js";import{a as j,c as M,d as P,e as H}from"./chunk-C6BYNIH4.js";import{g as I}from"./chunk-KRGBLZT2.js";import{a as q}from"./chunk-AA7L7GKI.js";import{a as N}from"./chunk-XPOZO76D.js";import{f as T,g as F}from"./chunk-ANIOISCE.js";import{d as R,e as K}from"./chunk-JM72FNGA.js";import{createHash as Ie}from"crypto";import{existsSync as ue}from"fs";function se(e){let[i,t]=x(e,":"),n=i||"unknown",o=(s={})=>{let r=s.actionTier??ge(n);return{sourceAnalyzer:n,actionTier:r,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${n} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??me(r,n),file:s.file}};if(!t)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(n)){let[s,r]=x(t,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:r?`${s}:${r}`:t,label:`${n} finding`,why:r?[`Baseline subject: ${r}.`]:[]})}if(n==="cycle"){let s=t.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(n==="similar"){let s=t.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(n==="drift"){let[s,r]=x(t,":"),[l,a]=x(r,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,a].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function ge(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function me(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function x(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as pe,readFileSync as ae}from"fs";var w={classifyCitation:ye,citationContexts:be,citationKindLabel:Se,citationRemediation:$e,referenceTargets:De};function ye(e){let i=e.join(`
|
|
2
|
-
`).toLowerCase(),t=[],n=v(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(n.length>0)return t.push(`configuration/example terms near citation: ${n.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:t};let o=v(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return t.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:t};let s=v(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(t.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:t}):(t.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:t})}function be(e,i,t){let n;try{n=ae(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=t.flatMap(Ce),s=[];for(let r=0;r<n.length;r+=1){let l=n[r]??"";o.some(a=>l.includes(a))&&s.push(U(n,r))}return s}function Ce(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((t,n,o)=>t.length>0&&o.indexOf(t)===n)}function Se(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function $e(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function De(e,i,t){let n=_(t),o=new Set;for(let s of i)we(e,s,n.get(s)??[])&&o.add(s);return o}function we(e,i,t){if(t.length===0)return!1;if(!ke.test(i))return!0;let n=`${e.config.projectRoot}/${i}`;if(!pe(n))return!0;let o=ae(n,"utf-8").split(/\r?\n/),s=Re(o);for(let r of t)for(let l=r.startLine;l<=r.endLine;l+=1)if((o[l]??"").trim()!==""&&!s.has(l))return!0;return!1}var ke=/\.(?:[cm]?[jt]sx?)$/i;function Re(e){let i=new Set,t=!1;for(let n=0;n<e.length;n+=1){let o=e[n].trim();!t&&Te(o)&&(t=!0),t&&(i.add(n),o.endsWith(";")&&(t=!1))}return i}function Te(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}import{existsSync as Fe,readFileSync as ve,writeFileSync as xe}from"fs";import{isAbsolute as Ae,join as Ge}from"path";var je=75e3,Ee=5e3,Le=2500;function Be(e){let i=ie(e);return i.symbols>=je||i.documents>=Ee?Le:void 0}var Ke=".scipquery-baseline.json";function A(e,i){return i&&Ae(i)?i:Ge(e.config.projectRoot,i??Ke)}function ce(e,i={}){let{scope:t}=i,n=Be(e),o=[],s=W(e,{scope:t,...S.dead,scanLimit:n});for(let r of s.symbols)T(e,r.relativePath)||F(e,r.symbol,r.relativePath)||r.kind==="dead-code"&&o.push(`dead:${r.relativePath}:${r.shortName}`);for(let r of Z(e,{scope:t,...S.isolated,scanLimit:n}))T(e,r.relativePath)||F(e,r.symbol,r.relativePath)||o.push(`isolated:${r.relativePath}:${r.shortName}`);for(let r of q(e,{scope:t}))r.kind==="real"&&o.push(`cycle:${Ne(r.path)}`);for(let r of ee(e,{scope:t,...S.similar,scanLimit:n}))o.push(`similar:${[r.symbolA,r.symbolB].sort().join("|")}`);for(let r of J(e,{scope:t,...S.extract,scanLimit:n}))o.push(`extract:${r.relativePath}:${r.shortName}`);for(let r of ne(e,{scope:t,...S.wrappers,scanLimit:n}))o.push(`wrapper:${r.file}:${r.shortName}`);for(let r of Q(e,{scope:t,...S.passthroughs,scanLimit:n}))o.push(`passthrough:${r.file}:${r.shortName}`);for(let r of te(e,{scope:t,...S.stale,scanLimit:n}))o.push(`stale:${r.file}:${r.shortName}`);for(let r of Y(e,{scope:t,...S.drift}).results)r.kind!=="pattern-deviation"&&o.push(`drift:${r.kind}:${r.file}:${r.dep}`);return[...new Set(o)].sort()}function Ne(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function Et(e,i={}){let t=ce(e,{scope:i.scope}),n=A(e,i.path);return xe(n,JSON.stringify({version:1,findings:t},null,2)+`
|
|
3
|
-
`),{path:n,findingCount:t.length}}function le(e,i={}){let t=A(e,i.path);if(!Fe(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let n=JSON.parse(ve(t,"utf-8")),o=new Set(n.findings??[]),s=ce(e,{scope:i.scope}),r=new Set(s);return{baselinePath:t,baselineCount:o.size,current:s,newFindings:s.filter(l=>!o.has(l)),fixedFindings:[...o].filter(l=>!r.has(l))}}var Jt=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function Zt(e,i={}){let t=i.base??"HEAD",{minTogether:n=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:r=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:a=!1,scanLimit:c}=i,y=i.semantic!==!1,u=new Set(i.skip??[]),f=O(e,{base:t}),p=z(e,{base:t,plan:f}),g=p.changedFiles,d=new Set(g),h=new Set(f.changedFileLines),b=E(e.config.projectRoot,t,L(f,g)),C=lt(e.config.projectRoot,t,f,b),m={base:t,changedFiles:g,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:p.summary.note};if(g.length===0)return m;let $=(B,he)=>{if(u.has(B)){m.skipped.push({check:B,reason:"skipped via --skip"});return}he()};return $("echo",()=>Oe(e,p.changedSymbols,d,C,s,l,c,y,m)),$("incomplete-migration",()=>Xe(e,t,f,r,c,y,b,m)),$("co-change-partner",()=>et(e,d,n,o,m)),$("doc-reference",()=>rt(e,d,h,f.changedRanges,m)),$("unused-params",()=>st(e,g,m)),$("new-dead",()=>at(e,p.changedSymbols,C,m)),a&&$("baseline",()=>ut(e,m)),_e(m,e.config.suppressions??[]),m.rootCauseGroups=Me(m.findings),m}function Me(e){let i=new Map;for(let t of e){let n=t.groupKey??`${t.check}:${t.id}`,o=i.get(n);o||(o={groupKey:n,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(n,o)),o.count+=1,o.findingIds.push(t.id),o.severity=Pe(o.severity,t.severity),o.actionTier=He(o.actionTier,t.actionTier),t.file&&o.files.add(t.file);for(let s of t.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,n)=>n.count-t.count||G(n.severity)-G(t.severity)||t.groupKey.localeCompare(n.groupKey))}function Pe(e,i){return G(i)>G(e)?i:e}function G(e){return e==="error"?2:e==="warning"?1:0}function He(e,i){return e?i&&fe(i)>fe(e)?i:e:i}function fe(e){return e==="direct"?2:e==="signal"?1:0}function _e(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let n of e.findings){let o=i.find(s=>ze(s,n));o?e.suppressed.push({finding:n,suppression:o}):t.push(n)}e.findings=t}function ze(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function k(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Oe(e,i,t,n,o,s,r,l,a){a.checksRun.push("echo");for(let c of i.slice(0,o)){if(n(c))continue;let y=X(e,c.symbol,{minSimilarity:s,limit:5,scanLimit:r,semantic:l}),u=[];for(let d of y){let h=d.fileA===c.file?d.fileB:d.fileA,b=d.fileA===c.file?d.shortNameB:d.shortNameA,C=d.fileA===c.file?d.symbolB:d.symbolA;t.has(h)||u.push({otherFile:h,otherShort:b,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(u.length===0)continue;let f=u[0],p=D("echo",c.symbol,c.file,...u.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),g=Ue(c,u);k(a,{id:p,groupKey:p,actionTier:g,check:"echo",severity:"warning",evidence:"heuristic",confidence:f.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(u.map(d=>d.otherFile))].sort(),message:Je(c,u),why:Ze(c,u),remediation:Qe(g,c.shortName,f.otherShort)})}i.length>o&&a.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function Ue(e,i){return i.some(n=>Ve(e.symbol,n))?"direct":"signal"}function Ve(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=R(e),n=R(i.otherSymbol);return!t||!n?!1:t===n?!0:Ye(i.sharedEvidence)?!1:qe(t,n)}function qe(e,i){let t=de(e),n=de(i);if(t.length===0||n.length===0)return!1;let o=new Set(n),s=t.filter(r=>o.has(r)).length;return s>=2&&s/Math.min(t.length,n.length)>=.5}function de(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var We=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function Ye(e){return e.length>=3&&e.every(i=>We.has(i.toLowerCase()))}function Je(e,i){let t=i[0],n=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${n}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${n}% similar to ${t.otherShort} (${t.otherFile})`}function Ze(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let n of i.slice(0,3))t.push(`${n.otherShort} is outside this diff and scored ${Math.round(n.similarity*100)}% similar by ${n.similarityBasis} evidence.`),t.push(`Shared evidence: ${n.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function Qe(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function Xe(e,i,t,n,o,s,r,l){let a=oe(e,{base:i,maxHelpers:n,diffPlan:t,scanLimit:o,semantic:s,baseContentAt:r});if(!a.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),a.note&&l.skipped.push({check:"incomplete-migration",reason:a.note});for(let c of a.findings){let y=c.leftovers.map(h=>`${h.shortName} (${h.file}, ${Math.round(h.containment*100)}% helper / ${Math.round(h.siteCoverage*100)}% site, ${h.migrationScope})`).join(", "),u=c.leftovers.map(h=>`${h.shortName}: ${h.migrationScope} (${h.migrationScopeReasons[0]})`).join("; "),f=[...c.migratedFiles,...c.leftovers.map(h=>h.file)],p=c.leftovers.length===0?void 0:Math.max(...c.leftovers.map(h=>Math.min(h.containment,h.siteCoverage))),g=c.leftovers.some(h=>h.migrationScope==="possible-subtype"),d=D("incomplete-migration",c.helperSymbol,c.helperFile,f.join("|"));k(l,{id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:c.helperFile,symbol:c.helperSymbol,relatedFiles:f,message:`new helper ${c.helperShortName} (${c.helperFile}) is wired into ${c.migratedFiles.length} file(s), but ${c.leftovers.length} similar un-migrated site(s) remain: ${y}`,why:[`${c.helperShortName} is new in this diff and already referenced by ${c.migratedFiles.join(", ")}.`,`Helper shape: ${c.helperShape}; ${c.specificHelperCalleeCount}/${c.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${y}.`,`Migration scope hints: ${u}.`],remediation:g?`Migrate same-scope sites to ${c.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${c.helperShortName}, or confirm they are intentionally different.`})}}function et(e,i,t,n,o){let s=I(e,i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let r=new Set,l;for(let a of s){let c=i.has(a.fileA),y=i.has(a.fileB);if(c===y)continue;let u=c?a.fileA:a.fileB,f=c?a.fileB:a.fileA,p=c?a.changesA:a.changesB,g=p>0?a.together/p:0;if(g<n||j(f)||j(u)||!ue(`${e.config.projectRoot}/${f}`))continue;let d=`${u}|${f}`;if(r.has(d))continue;r.add(d);let h=D("co-change-partner",u,f,String(a.together)),b=M(u,f),C=P({fileA:u,fileB:f,together:a.together,confidence:g,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(l??=H(e))(u,f)),m=[u,f].sort().join("|");o.findings.push({id:h,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${m}`,confidence:g,file:u,relatedFiles:[f],sourceAnalyzer:"co-change",rootCauseKey:m,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${f} did not \u2014 they change together ${a.together}x (${Math.round(g*100)}% of the time)`,why:[`${u} is in this diff and ${f} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(g*100)}% of changes to the edited side.`,`History context: ${tt(a)}.`,`Subject context: ${it(a.subjectContext)}.`,...nt(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:C?`Update ${f} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${f} alongside this change, or confirm the coupling no longer holds.`})}}function tt(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${ot(e.lastTogetherAt)}`}function it(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",n=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${n}; external issue/PR labels ${e.externalIssueLabelStatus}`}function nt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function ot(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function rt(e,i,t,n,o){o.checksRun.push("doc-reference");let s=w.referenceTargets(e,i,n);if(s.size!==0)for(let r of V(e,s)){if(t.has(r.doc))continue;let l=r.citedClaims.length>0?r.citedClaims:w.citationContexts(e,r.doc,r.cited),a=w.classifyCitation(l),c=D("doc-reference",r.doc,r.cited.join("|"));k(o,{id:c,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:r.doc,relatedFiles:r.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:l,message:`${r.doc} cites ${r.cited.join(", ")} as ${w.citationKindLabel(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${r.cited.join(", ")} changed in this diff.`,`${r.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(y=>`Citation kind evidence: ${y}`)],remediation:w.citationRemediation(a.citationKind,r.doc)})}}function st(e,i,t){t.checksRun.push("unused-params");for(let n of re(e,{files:i,limit:50})){let o=D("unused-params",n.symbol,n.file,n.unusedTrailing.join("|"));k(t,{id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:n.file,startLine:n.startLine,endLine:n.endLine,symbol:n.symbol,message:`${n.shortName} (${n.file}) has trailing unused parameter(s): ${n.unusedTrailing.join(", ")}`,why:[`${n.shortName} is in a changed file.`,`The trailing parameter(s) ${n.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function at(e,i,t,n){n.checksRun.push("new-dead");let o=new N(e);for(let s of i){if(t(s)||s.fanIn>0||o.fileKind(s.file)==="test"||T(e,s.file)||F(e,s.symbol,s.file)||ct(s.symbol))continue;let r=D("new-dead",s.symbol,s.file);k(n,{id:r,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code."})}}function ct(e){if(K(e)!=="type")return!1;let i=R(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function lt(e,i,t,n){let o=new Map(t.renamedFiles.map(r=>[r.to,r.from])),s=n??E(e,i,L(t));return r=>{let l=o.get(r.file)??r.file,a=R(r.symbol);if(!a)return!1;let c=s(l);return c!==null&&ft(c,a)}}function ft(e,i){return new RegExp(`\\b${dt(i)}\\b`).test(e)}function dt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ut(e,i){if(!ue(A(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=le(e);for(let n of t.newFindings){let o=se(n),s=D("baseline",n);k(i,{id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${n}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation})}}function D(e,...i){return`SQ${Ie("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{ce as a,Et as b,le as c,Jt as d,Zt as e,lt as f};
|
|
4
|
-
//# sourceMappingURL=chunk-7XWXGANX.js.map
|
package/dist/chunk-AETMKBZR.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{d as k}from"./chunk-RSKOYTSY.js";import{c as _}from"./chunk-T633QLYF.js";import{b as h}from"./chunk-RY7CAOJF.js";import{u as v}from"./chunk-3LQFMQPY.js";import{f as y,k as R}from"./chunk-X3BJUFSN.js";import{d as m}from"./chunk-JM72FNGA.js";import{a as S}from"./chunk-6TDOT7B3.js";import{a as w}from"./chunk-BTCASU5J.js";import{a as u}from"./chunk-DS6QEB3G.js";import{c as L}from"./chunk-A536TEU4.js";import{c as b,d as D}from"./chunk-7S5E7KWT.js";function I(e,r,n,t={}){if(!n)return[];let i=u(e,r);return i?i.indexOf(n)===-1?[]:(E(e,r).get(n)??[]).filter(s=>!z(s,t)):[]}function z(e,r){return typeof r.excludeStartLine=="number"&&typeof r.excludeEndLine=="number"&&e>=r.excludeStartLine&&e<=r.excludeEndLine}var Z=b("file-identifiers",{clearGroups:["whole-project","source-file"]});function F(e,r){let n=S(e,r);return n?n.fileIdentifiers:Z.get(e,r,()=>new Set(E(e,r).keys()))}var U=b("file-ident-lines",{clearGroups:["whole-project","source-file"]});function E(e,r){let n=S(e,r);return n?n.identifierLineMap:U.get(e,r,()=>Y(e,r))}var W=b("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function fe(e,r){let n=S(e,r);return n?n.identifiersByLine:W.get(e,r,()=>{let t=E(e,r),i=0;for(let s of t.values()){let o=s[s.length-1];o!==void 0&&o>i&&(i=o)}let a=new Array(i+1);for(let s=0;s<=i;s+=1)a[s]=new Set;for(let[s,o]of t)for(let c of o)a[c].add(s);return a})}function Y(e,r){let n=new Map,t=(o,c)=>{let l=n.get(o);if(!l){n.set(o,[c]);return}l[l.length-1]!==c&&l.push(c)},i=u(e,r);if(!i)return n;let a=v(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let o=0;o<a.length;o+=1){let c=a[o]??"";for(let l of c.matchAll(s))l[1]&&t(l[1],o)}return n}function A(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function d(e,r){return A(e)===A(r)}function T(e,r){let n=new Map;for(let t of h(e,r)){if(!t.sourcePath)continue;let i=t.localName??t.importedName;if(i&&O(n,i,t.sourcePath),t.kind==="namespace")for(let a of t.usedMembers)O(n,a,t.sourcePath)}return n}function O(e,r,n){let t=e.get(r);t||(t=new Set,e.set(r,t)),t.add(n)}function ge(e,r){return x(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
|
|
2
|
-
m.symbol_id,
|
|
3
|
-
d.relative_path,
|
|
4
|
-
COUNT(*) AS ref_count
|
|
5
|
-
FROM mentions m
|
|
6
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
-
JOIN documents d ON c.document_id = d.id
|
|
8
|
-
WHERE m.role != 1
|
|
9
|
-
${t}
|
|
10
|
-
${e.pathExclusionsFor("d")}
|
|
11
|
-
GROUP BY m.symbol_id, d.relative_path`,...n??[])})}function be(e,r){return x(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path
|
|
12
|
-
FROM mentions m
|
|
13
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
14
|
-
JOIN documents d ON c.document_id = d.id
|
|
15
|
-
WHERE m.role != 1
|
|
16
|
-
${t}
|
|
17
|
-
${e.pathExclusionsFor("d")}`,...n??[])}).filter(n=>n.symbol_id!==null)}function P(e,r){return x(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
|
|
18
|
-
c.start_line AS chunk_start, c.end_line AS chunk_end
|
|
19
|
-
FROM mentions m
|
|
20
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
21
|
-
JOIN documents d ON c.document_id = d.id
|
|
22
|
-
WHERE m.role != 1
|
|
23
|
-
${t}
|
|
24
|
-
${e.pathExclusionsFor("d")}
|
|
25
|
-
ORDER BY d.relative_path, c.start_line`,...n??[])})}function x(e,r,n){if(!r)return n();if(r.length===0)return[];let t=[];for(let i=0;i<r.length;i+=750)t.push(...n(r.slice(i,i+750)));return t}function Le(e,r){let n=$(e);return n?r.filter(t=>$(t.file)===n):r}function Ee(e,r,n,t){let i=n.find(a=>a.file===r);if(i)return i;if(t){let a=new Set(h(e,r).map(s=>s.sourcePath).filter(s=>!!s));for(let s of n)for(let o of a)if(d(o,s.file))return s;return null}return n.length===1?n[0]:null}function $(e){let r=w(e);return r?r==="typescript"||r==="tsx"||r==="javascript"?"javascript-family":r:null}var Q=D("global-leaf-index",{clearGroups:["whole-project"]});function N(e){return Q.get(e,()=>{let r=e.all(`SELECT gs.id, gs.symbol,
|
|
26
|
-
COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
|
|
27
|
-
FROM global_symbols gs
|
|
28
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
29
|
-
LEFT JOIN documents der_doc ON der_doc.id = der.document_id
|
|
30
|
-
LEFT JOIN (
|
|
31
|
-
SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
|
|
32
|
-
FROM mentions m
|
|
33
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
34
|
-
JOIN documents d ON c.document_id = d.id
|
|
35
|
-
WHERE m.role = 1
|
|
36
|
-
GROUP BY m.symbol_id
|
|
37
|
-
) mention_doc ON mention_doc.symbol_id = gs.id
|
|
38
|
-
WHERE 1 = 1
|
|
39
|
-
${e.symbolNoiseFor("gs")}`),n=new Map;for(let t of r){if(!t.relative_path||e.isIgnored(t.relative_path))continue;let i=m(t.symbol);if(!i)continue;let a=n.get(i);a||(a=[],n.set(i,a)),a.some(s=>s.symbolId===t.id)||a.push({symbol:t.symbol,symbolId:t.id,file:t.relative_path})}return n})}var j=/[A-Za-z_$][A-Za-z0-9_$]*/g,V=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function C(e){let r=[],n=!1;for(let t of e)t&&(n=!0,V.test(t)||r.push(t));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:r}}function B(e,r){let n=X(r)?r:C(r);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;j.lastIndex=0;let t;for(;(t=j.exec(e))!==null;)if(n.candidateNames.has(t[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function X(e){return"candidateNames"in e}function M(e,r,n){let t=N(e).get(n);if(!t||t.length===0)return[];if(t.length===1)return[p(t[0])];let i=t.filter(c=>c.file===r);if(i.length>0)return i.map(p);let a=T(e,r),s=a.get(n);if(s)for(let c of s){let l=t.filter(f=>d(c,f.file));if(l.length>0)return l.map(p)}let o=new Set;for(let c of a.values())for(let l of c)o.add(l);for(let c of o){let l=t.filter(f=>d(c,f.file));if(l.length>0&&l.length===t.length)return l.map(p)}return[]}function $e(e,r,n){let t=M(e,r,n);if(t.length>0)return t;let i=N(e).get(n);return!i||i.length===0?[]:i.map(p)}function H(e,r,n={}){let t=_(e,r);if(!t)return[];let i=m(t.symbol);if(!i)return[];if(n.semantic!==!1){let s=k(e,{...t,leaf:i,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let o=new Map;for(let c of s){let l=o.get(c.file)??[];l.push(c.line),o.set(c.file,l)}return G(e,o)}}let a=new Map;for(let s of L(e)){let o=u(e,s);if(!o||o.indexOf(i)===-1||s!==t.relativePath&&!M(e,s,i).some(f=>f.symbolId===t.symbolId))continue;let c=I(e,s,i,s===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{});c.length>0&&a.set(s,c)}return G(e,a)}function je(e,r){let n=new Map;for(let o of r){if(!o.leaf)continue;let c=n.get(o.leaf)??[];c.push(o),n.set(o.leaf,c)}if(n.size===0)return new Map;let t=new Set(r.map(o=>o.symbolId)),i=new Set(n.keys()),a=C(i),s=new Map;for(let o of L(e)){if(!B(u(e,o),a))continue;let c=F(e,o);if(c.size!==0){for(let l of c)if(n.has(l))for(let f of M(e,o,l)){if(!t.has(f.symbolId)||o===f.relativePath)continue;let g=s.get(f.symbolId);g||(g=new Set,s.set(f.symbolId,g)),g.add(o)}}}return s}function p(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function G(e,r){let n=[],t=new Set;for(let[i,a]of r){let s=y(e,i);for(let o of a){let c=R(s,o),l=`${i}|${o}|${c?.symbol??""}`;t.has(l)||(t.add(l),n.push({file:i,line:o,enclosingSymbol:c?.symbol??null}))}}return n}function q(e,r){let n=ie(e,r);return n?oe(e,ee(e,n.match,n.identifier)):[]}function We(e,r,n={}){return K(e,r,n).map(t=>({file:t.file,line:t.line,enclosingSymbol:t.enclosingSymbol}))}function K(e,r,n={}){let t=H(e,r,{semantic:n.semantic}),i=t.length>0?J(t,"source-attribution"):J(q(e,r),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(a=>!e.isIgnored(a.file))}function J(e,r){return e.map(n=>({...n,provenance:r}))}function ee(e,r,n){let t=new Map;for(let[i,a]of ne(e,r.symbolId))t.set(i,te(e,i,a,r,n));return t}function ne(e,r){let n=new Map;for(let t of P(e,[r])){if(e.isIgnored(t.relative_path))continue;let i=n.get(t.relative_path);i||(i=[],n.set(t.relative_path,i)),i.push({start_line:t.chunk_start,end_line:t.chunk_end})}return n}function te(e,r,n,t,i){let a=r===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{},s=i?I(e,r,i,a):[];return n.flatMap(o=>re(s,o))}function re(e,r){let n=e.filter(t=>t>=r.start_line&&t<=r.end_line);return n.length>0?n:[r.start_line]}function ie(e,r){let n=_(e,r);return n?{match:n,identifier:m(n.symbol)||null}:null}function oe(e,r){let n=[],t=new Set;for(let[i,a]of r){let s=y(e,i);for(let o of a){let c=R(s,o),l=`${i}|${o}|${c?.symbol??""}`;t.has(l)||(t.add(l),n.push({file:i,line:o,enclosingSymbol:c?.symbol??null}))}}return n}export{E as a,fe as b,ge as c,be as d,P as e,d as f,Le as g,Ee as h,N as i,C as j,B as k,T as l,M as m,$e as n,je as o,q as p,We as q};
|
|
40
|
-
//# sourceMappingURL=chunk-AETMKBZR.js.map
|
package/dist/chunk-BTCASU5J.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as u,b as h,e as m,g as N,i as x}from"./chunk-DS6QEB3G.js";import{c as S}from"./chunk-A536TEU4.js";import{e as f,f as g}from"./chunk-7S5E7KWT.js";import{extname as y}from"path";var F={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb"};function p(e){return F[y(e).toLowerCase()]??null}function k(e){return y(e).toLowerCase()===".vue"}import{extname as $}from"path";import{parse as E}from"@vue/compiler-sfc";function v(e){let t=E(e),n=t.descriptor.scriptSetup??t.descriptor.script;if(!n||n.src)return null;let s=N(n.lang??null);return s?{body:n.content,startLine:Math.max(0,n.loc.start.line-1),language:s}:null}var b=g("ast-trees",{clearGroups:["whole-project","source-file"]});function _(e,t){if(k(t))return B(e,t);let n=p(t);if(!n)return null;let s=u(e,t);return s?b.get(e,t,s,()=>m(n,s)):null}function B(e,t){let n=u(e,t);return n?b.get(e,t,n,()=>{let s=v(n);if(!s)return null;let r=`
|
|
2
|
-
`.repeat(s.startLine)+s.body;return m(s.language,r)}):null}var O=[".tsx",".jsx"],C=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),P=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),J=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),q=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),D=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),I=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),V=new Set(["children","className","false","key","null","style","true","undefined"]),Z=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]),z=f("react-component-behavior-profiles");function je(e,t={}){let n=S(e,{extensions:O}).filter(r=>!t.scope||r.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(r=>H(e,r)).filter(r=>(t.minJsxTokens===void 0||r.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||r.behaviorTokens.size>=t.minBehaviorTokens))}function H(e,t){let n=t.replace(/\\/g,"/"),s=u(e,n);return z.get(e,n,s,()=>M(e,n)).map(K)}function M(e,t){let n=U(t);if(!n)return[];let s=_(e,t);if(!s)return[];let r=h(e,t).length;return W(s.rootNode,n).filter(o=>o.kind==="hook"||j(o.bodyNode)).map(o=>{let i=ee(o.bodyNode),l=oe(o.bodyNode,n);return{file:t,name:o.name,kind:o.kind,startLine:o.node.startPosition.row,endLine:o.node.endPosition.row,loc:Math.max(1,o.node.endPosition.row-o.node.startPosition.row+1),fileLines:r,jsxTokens:i.tokens,behaviorTokens:l.tokens,componentNames:c(i.componentNames),nativeTags:c(i.nativeTags),propNames:c(i.propNames),eventNames:c(i.eventNames),hookNames:c(l.hookNames),requestNames:c(l.requestNames),stateNames:c(l.stateNames),effectNames:c(l.effectNames),handlerNames:c(l.handlerNames)}})}function K(e){return{...e,jsxTokens:new Set(e.jsxTokens),behaviorTokens:new Set(e.behaviorTokens),componentNames:[...e.componentNames],nativeTags:[...e.nativeTags],propNames:[...e.propNames],eventNames:[...e.eventNames],hookNames:[...e.hookNames],requestNames:[...e.requestNames],stateNames:[...e.stateNames],effectNames:[...e.effectNames],handlerNames:[...e.handlerNames]}}function U(e){let t=$(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:p(e)}function W(e,t){let n=[],s=new Set,r=a=>{let o=G(a);if(o&&!X(a)){let i=`${o.name}:${o.node.startIndex}:${o.node.endIndex}`;s.has(i)||(s.add(i),n.push(o));return}for(let i of a.namedChildren)r(i)};return(t==="tsx"||t==="javascript")&&r(e),n}function G(e){if(e.type==="function_declaration"){let a=R(e);return!a||!T(a)?null:{name:a,kind:L(a),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),s=d(t);if(!s||!n||!T(s))return null;let r=Q(n);return r?{name:s,kind:L(s),node:e,bodyNode:r}:null}function T(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function L(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function Q(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=Y(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(r=>r.type==="arguments")?.namedChildren.find(r=>r.type==="arrow_function"||r.type==="function_expression")??null}function X(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function R(e){return d(e.childForFieldName("name")??e.namedChild(0))}function Y(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function j(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(j)}function ee(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=s=>{s.type==="jsx_opening_element"||s.type==="jsx_self_closing_element"?te(s,t):s.type==="jsx_expression"?ne(s,t):s.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let r of s.namedChildren)n(r)};return n(e),t}function te(e,t){let n=se(e),s=!1;if(n){let r=w(n);s=ue(r),s?(t.componentNames.add(r),t.tokens.add(`component:${r}`)):(t.nativeTags.add(r),t.tokens.add(`native:${r}`))}for(let r of e.namedChildren)if(r.type==="jsx_attribute"){let a=re(r);if(!a)continue;let o=w(a);if(o.startsWith("on")&&o.length>2){let i=o.slice(2).replace(/^[A-Z]/,l=>l.toLowerCase());t.eventNames.add(i),t.tokens.add(`event:${i}`)}else Z.has(o)||(t.propNames.add(o),t.tokens.add(`${s?"prop":"native-prop"}:${o}`))}else r.type==="jsx_spread_attribute"&&t.tokens.add("prop:spread")}function ne(e,t){let n=e.text;(n.includes("&&")||n.includes("?"))&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let s of de(n))V.has(s)||t.tokens.add(`binding:${s}`)}function se(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function re(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function oe(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},s=r=>{if(r.type==="call_expression"){let a=x(r,t);a&&ae(a.calleeLeaf,n)}else if(r.type==="variable_declarator")ce(r,n);else if(r.type==="function_declaration"){let a=R(r);a&&A(a,n)}for(let a of r.namedChildren)s(a)};return s(e),n}function ae(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!C.has(e)&&!q.has(e)&&t.tokens.add(`hook:${e}`)),C.has(e)&&t.tokens.add(`react-hook:${e}`),P.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),J.has(e)&&t.tokens.add(`state-hook:${e}`),ie(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function ie(e){if(D.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function ce(e,t){let n=e.childForFieldName("name")??e.namedChild(0),s=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&s?.text.includes("useState")){let a=n.namedChildren.find(i=>d(i)),o=d(a);o&&(t.stateNames.add(o),t.tokens.add(`state:${o}`))}let r=d(n);r&&A(r,t)}function A(e,t){let n=le(e);!n||!I.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function le(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function ue(e){return/^[A-Z]/.test(e)||e.includes(".")}function w(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function d(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function de(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let s=n[0];t.includes(s)||t.push(s)}return t}function c(e){return[...e].sort()}export{p as a,k as b,v as c,_ as d,je as e};
|
|
3
|
-
//# sourceMappingURL=chunk-BTCASU5J.js.map
|
package/dist/chunk-C6ROZBJA.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import{c as d}from"./chunk-7S5E7KWT.js";import{createHash as h}from"crypto";import{readFileSync as T}from"fs";import{createRequire as m}from"module";import{dirname as E,join as g}from"path";import v from"better-sqlite3";var N=m(import.meta.url),S="evidence.db",p=new WeakMap,y=d("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),_=d("evidence-project-fingerprint",{clearGroups:["whole-project"]});function L(){for(let n of["../package.json","../../package.json"])try{return N(n).version}catch{}return"0.0.0"}var s=L();function f(n){return h("sha256").update(n).digest("hex")}function w(n,t,e){return y.get(n,t,()=>f(e))}function F(n){return _.get(n,"current",()=>{try{let t=JSON.parse(T(g(E(n.config.dbPath),"meta.json"),"utf-8"));if(t.version!==2&&t.version!==3||t.status!=="complete"||t.fingerprint===void 0)return null;let e=Array.isArray(t.indexedLanguages)?[...t.indexedLanguages].sort():[];return f(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:e}))}catch(t){return u("project fingerprint unavailable",t),null}})}function u(n,t){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${n}: ${t instanceof Error?t.message:String(t)}`)}function c(n){if(p.has(n))return p.get(n)??null;let t=null;try{let e=new v(g(E(n.config.dbPath),S));e.pragma("journal_mode = WAL"),e.pragma("busy_timeout = 5000"),e.pragma("synchronous = NORMAL"),e.exec(`
|
|
2
|
-
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
3
|
-
kind TEXT NOT NULL,
|
|
4
|
-
relative_path TEXT NOT NULL,
|
|
5
|
-
content_hash TEXT NOT NULL,
|
|
6
|
-
version TEXT NOT NULL,
|
|
7
|
-
payload TEXT NOT NULL,
|
|
8
|
-
PRIMARY KEY (kind, relative_path)
|
|
9
|
-
);
|
|
10
|
-
CREATE TABLE IF NOT EXISTS semantic_callees (
|
|
11
|
-
relative_path TEXT NOT NULL,
|
|
12
|
-
symbol TEXT NOT NULL,
|
|
13
|
-
content_hash TEXT NOT NULL,
|
|
14
|
-
deps_digest TEXT NOT NULL,
|
|
15
|
-
version TEXT NOT NULL,
|
|
16
|
-
payload TEXT NOT NULL,
|
|
17
|
-
PRIMARY KEY (relative_path, symbol)
|
|
18
|
-
);
|
|
19
|
-
CREATE TABLE IF NOT EXISTS semantic_references (
|
|
20
|
-
relative_path TEXT NOT NULL,
|
|
21
|
-
symbol TEXT NOT NULL,
|
|
22
|
-
project_fingerprint TEXT NOT NULL,
|
|
23
|
-
version TEXT NOT NULL,
|
|
24
|
-
payload TEXT NOT NULL,
|
|
25
|
-
PRIMARY KEY (relative_path, symbol)
|
|
26
|
-
);
|
|
27
|
-
`),t={evidence:e,readFileEvidence:e.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:e.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:e.prepare(`SELECT payload FROM semantic_callees
|
|
28
|
-
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),writeCallees:e.prepare(`INSERT OR REPLACE INTO semantic_callees
|
|
29
|
-
(relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:e.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:e.prepare(`SELECT payload FROM semantic_references
|
|
30
|
-
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),writeReferences:e.prepare(`INSERT OR REPLACE INTO semantic_references
|
|
31
|
-
(relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:e.prepare("DELETE FROM semantic_references WHERE project_fingerprint != ?")}}catch(e){u("disabled (open failed)",e)}return p.set(n,t),t}function o(n,t,e){u(`disabled (${t})`,e),p.set(n,null)}function x(n,t,e,a){let r=c(n);if(!r)return null;try{return r.readFileEvidence.get(t,e,a,s)?.payload??null}catch(i){return o(n,"file_evidence read",i),null}}function I(n,t,e,a,r){let i=c(n);if(i)try{i.writeFileEvidence.run(t,e,a,s,r)}catch(l){o(n,"file_evidence write",l)}}function U(n,t,e,a,r){let i=c(n);if(!i)return null;try{return i.readCallees.get(t,e,a,r,s)?.payload??null}catch(l){return o(n,"semantic_callees read",l),null}}function j(n,t,e,a){let r=c(n);if(!r)return null;try{return r.readReferences.get(t,e,a,s)?.payload??null}catch(i){return o(n,"semantic_references read",i),null}}function X(n,t){if(t.length===0)return;let e=c(n);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let r of t){let i=`${r.relativePath}\0${r.contentHash}`;a.has(i)||(a.add(i),e.dropStaleCallees.run(r.relativePath,r.contentHash)),e.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,s,r.payload)}})()}catch(a){o(n,"semantic_callees write",a)}}function P(n,t){if(t.length===0)return;let e=c(n);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let r of t)a.has(r.projectFingerprint)||(a.add(r.projectFingerprint),e.dropStaleReferences.run(r.projectFingerprint)),e.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,s,r.payload)})()}catch(a){o(n,"semantic_references write",a)}}export{f as a,w as b,F as c,x as d,I as e,U as f,j as g,X as h,P as i};
|
|
32
|
-
//# sourceMappingURL=chunk-C6ROZBJA.js.map
|
package/dist/chunk-COUFCH64.js
DELETED