scip-query 0.19.8 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +97 -0
- package/README.md +158 -48
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-26QA6FAI.js +8 -0
- package/dist/{chunk-KJ2IIBZN.js → chunk-2HPVVXM5.js} +2 -2
- package/dist/chunk-2KAZEZ6M.js +2 -0
- package/dist/chunk-32LVLCLN.js +40 -0
- package/dist/{chunk-24GTWJ3N.js → chunk-3CLX5EOX.js} +2 -2
- package/dist/{chunk-QGGLL3UH.js → chunk-3G66UZBH.js} +2 -2
- package/dist/{chunk-AA4UWRNL.js → chunk-3ORVDL3H.js} +2 -2
- package/dist/chunk-4MAK2HOY.js +6 -0
- package/dist/{chunk-QIQ63BHW.js → chunk-4TURLRL5.js} +2 -2
- package/dist/chunk-4UQVNCQE.js +2 -0
- package/dist/chunk-55Q3WLZX.js +2 -0
- package/dist/{chunk-CTF2GDEX.js → chunk-5E4WNAVD.js} +2 -2
- package/dist/{chunk-ZCEJ63SP.js → chunk-5I5G2QOX.js} +2 -2
- package/dist/chunk-6LDJQXAH.js +2 -0
- package/dist/{chunk-3EDFLQ6A.js → chunk-6O5TICIZ.js} +2 -2
- package/dist/{chunk-ACAM6O5R.js → chunk-6SHPK5ZE.js} +2 -2
- package/dist/chunk-7BAVHKMJ.js +49 -0
- package/dist/chunk-7O5IKBTZ.js +16 -0
- package/dist/{chunk-WJL2L6MV.js → chunk-7PIO7NKH.js} +2 -2
- package/dist/chunk-7S5E7KWT.js +2 -0
- package/dist/{chunk-YLFORA5G.js → chunk-7SQQWSY3.js} +2 -2
- package/dist/chunk-7WPLAODU.js +5 -0
- package/dist/chunk-A73XVBCR.js +20 -0
- package/dist/chunk-AFHORGLH.js +42 -0
- package/dist/chunk-AIE7TFJW.js +9 -0
- package/dist/{chunk-TWMJ3Y3G.js → chunk-AZJQQKDD.js} +2 -2
- package/dist/{chunk-BDOIKGDI.js → chunk-B2PX5I6M.js} +2 -2
- package/dist/{chunk-DQBCO2UY.js → chunk-B7PBSLZN.js} +2 -2
- package/dist/chunk-BBW6JFHN.js +2 -0
- package/dist/{chunk-YTVWB7YJ.js → chunk-BDCC2NPY.js} +2 -2
- package/dist/{chunk-O23I56NA.js → chunk-BNXCIFVY.js} +2 -2
- package/dist/{chunk-MLFZP76A.js → chunk-BPAPWKP6.js} +2 -2
- package/dist/chunk-BS2NMXQZ.js +4 -0
- package/dist/chunk-C3KV2II6.js +2 -0
- package/dist/chunk-C43RDDP4.js +20 -0
- package/dist/{chunk-K2WO7XY7.js → chunk-CJST5ETY.js} +2 -2
- package/dist/chunk-DAFAHMNB.js +42 -0
- package/dist/{chunk-KKME5ZAI.js → chunk-DQGFVPUV.js} +2 -2
- package/dist/chunk-DQLPXMH6.js +8 -0
- package/dist/chunk-EKZTZXHZ.js +117 -0
- package/dist/{chunk-FJ5UDTQF.js → chunk-EN3O7VJA.js} +2 -2
- package/dist/{chunk-HZYDQPNY.js → chunk-EW2NTSFA.js} +2 -2
- package/dist/chunk-F3Z4OUDS.js +8 -0
- package/dist/chunk-FJH2NW7J.js +66 -0
- package/dist/{chunk-MSBDMFER.js → chunk-FKSELJQF.js} +2 -2
- package/dist/chunk-FTFP6O3L.js +11 -0
- package/dist/chunk-FYLK2DEJ.js +2 -0
- package/dist/{chunk-WUW7YUAH.js → chunk-GH74ASD6.js} +2 -2
- package/dist/{chunk-464PLI5O.js → chunk-GMXWZP2B.js} +2 -2
- package/dist/chunk-GOUBFH5O.js +3 -0
- package/dist/{chunk-FIJCV235.js → chunk-HLF2TX6R.js} +2 -2
- package/dist/{chunk-WWKWUPSU.js → chunk-HX4GQPZP.js} +2 -2
- package/dist/chunk-HX7M4BDI.js +30 -0
- package/dist/chunk-HZ72SESS.js +128 -0
- package/dist/{chunk-SERUIGV5.js → chunk-IB2N4FIY.js} +2 -2
- package/dist/chunk-ILMHV3KM.js +2 -0
- package/dist/chunk-IZYYAFN5.js +2 -0
- package/dist/{chunk-GNC4JVAN.js → chunk-JAYYFEQY.js} +2 -2
- package/dist/{chunk-QJIVBYEK.js → chunk-JDOEX4E6.js} +2 -2
- package/dist/chunk-JFGGXWQF.js +947 -0
- package/dist/chunk-JN4NMBEX.js +8 -0
- package/dist/{chunk-6M7RONVB.js → chunk-JVYA47YU.js} +2 -2
- package/dist/{chunk-7KYNAMMH.js → chunk-JW56N3KI.js} +2 -2
- package/dist/{chunk-OUBAF226.js → chunk-JZ2OXNWB.js} +2 -2
- package/dist/chunk-KMKTIO2G.js +8 -0
- package/dist/chunk-L5GJNV2T.js +8 -0
- package/dist/{chunk-MNSTUIDD.js → chunk-L7AW2QB5.js} +2 -2
- package/dist/chunk-L7JDSCDF.js +4 -0
- package/dist/chunk-LU47HG23.js +14 -0
- package/dist/chunk-LVY7NPF7.js +2 -0
- package/dist/chunk-LY4WC4AD.js +74 -0
- package/dist/{chunk-7FT5Y65S.js → chunk-MKCDWWGV.js} +2 -2
- package/dist/chunk-MNE7YG56.js +2 -0
- package/dist/{chunk-7QHY3H7P.js → chunk-MRXBEXSY.js} +2 -2
- package/dist/chunk-MV7OWDUX.js +2 -0
- package/dist/{chunk-ZJ5CBXK3.js → chunk-N5W4YZMK.js} +2 -2
- package/dist/chunk-NGEXCJJW.js +11 -0
- package/dist/{chunk-7SWJEWJF.js → chunk-NIW6JDC5.js} +2 -2
- package/dist/{chunk-O3O4XXO6.js → chunk-O64IZ6UX.js} +2 -2
- package/dist/{chunk-3ZSJ3PWF.js → chunk-PBUQFCNB.js} +2 -2
- package/dist/{chunk-7RAG65VK.js → chunk-POAVPHH7.js} +2 -2
- package/dist/{chunk-A3QXWFBK.js → chunk-PQCI4SQX.js} +2 -2
- package/dist/{chunk-4BV4QAZJ.js → chunk-PXY7F6Y4.js} +2 -2
- package/dist/chunk-RDO52JGY.js +2 -0
- package/dist/chunk-RJT3TUUZ.js +2 -0
- package/dist/{chunk-S4S2WOIX.js → chunk-RUJURYSV.js} +2 -2
- package/dist/{chunk-JAY7YWS3.js → chunk-RVLDN63O.js} +2 -2
- package/dist/chunk-RXOXSKY3.js +2 -0
- package/dist/chunk-S7OYBOCK.js +2 -0
- package/dist/chunk-SMNXQT5Z.js +3 -0
- package/dist/{chunk-NE3TZUCI.js → chunk-SRAFT254.js} +2 -2
- package/dist/{chunk-ELLMY7XJ.js → chunk-SXP2MBJH.js} +2 -2
- package/dist/chunk-T7YQSHPQ.js +3 -0
- package/dist/{chunk-WY45BHKQ.js → chunk-TFRAYKN6.js} +2 -2
- package/dist/{chunk-2SNGN6U4.js → chunk-UJCOIXDY.js} +2 -2
- package/dist/{chunk-MZZBAITE.js → chunk-UJPRPGCO.js} +2 -2
- package/dist/chunk-W4ETQAXM.js +2 -0
- package/dist/chunk-WCCFZ7V7.js +113 -0
- package/dist/chunk-WUPW3UN3.js +3 -0
- package/dist/{chunk-7LSVMFX7.js → chunk-WXZLAAWK.js} +2 -2
- package/dist/{chunk-5ML2BNRH.js → chunk-X54AGLVX.js} +2 -2
- package/dist/chunk-XKWKXZKW.js +20 -0
- package/dist/{chunk-5YLUDDAF.js → chunk-XSRF6Q77.js} +2 -2
- package/dist/chunk-Y2MVPNKY.js +5 -0
- package/dist/{chunk-JHF3E4YM.js → chunk-YKUU5AIC.js} +2 -2
- package/dist/{chunk-E3HYEQO7.js → chunk-YLCJLTPL.js} +2 -2
- package/dist/{chunk-7VCOXZH3.js → chunk-YTQVETEO.js} +2 -2
- package/dist/chunk-Z4N3MZYA.js +38 -0
- package/dist/chunk-ZHXX42OH.js +18 -0
- package/dist/chunk-ZJOOT3BG.js +2 -0
- package/dist/{chunk-P3UO3EH3.js → chunk-ZK26BAQL.js} +2 -2
- package/dist/{chunk-33KUO7CG.js → chunk-ZTETIQ35.js} +2 -2
- package/dist/cli.js +3 -8
- package/dist/command-descriptors-DSS46KXI.js +642 -0
- package/dist/{config-types-B6MEoRNy.d.ts → config-types-jVM3D7MA.d.ts} +68 -2
- package/dist/{db-DYLKr9Wn.d.ts → db-B5PM5yNk.d.ts} +20 -2
- package/dist/{diff-gate-types-C9BoYwYD.d.ts → diff-gate-types-B0QYpDv1.d.ts} +2 -1
- package/dist/direct-navigation-6YHV6IB5.js +3 -0
- package/dist/{health-DgxIDXJC.d.ts → health-Do5TKSJI.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/architecture.d.ts +2 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +22 -3
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +3 -3
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +3 -3
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +40 -7
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +84 -6
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +3 -3
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +3 -3
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +12 -3
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +8 -6
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +141 -10
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +34 -3
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +3 -3
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +3 -3
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +14 -3
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +21 -21
- package/dist/reindex.d.ts +3 -3
- package/dist/reindex.js +33 -33
- package/dist/runtime.d.ts +5 -3
- package/dist/runtime.js +3 -3
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-Cc6c00-a.d.ts → scip-cli-BnEwZRLJ.d.ts} +1 -1
- package/dist/{symbol-types-BgWU6lhL.d.ts → symbol-types-BIQwfoAx.d.ts} +7 -1
- package/dist/typescript-mailbox-worker.js +2 -0
- package/dist/watch-server.js +2 -42
- package/docs/AGENT_GUIDE.md +13 -6
- package/docs/CLI_JSON_OUTPUT.md +110 -22
- package/docs/COMMAND_REFERENCE.md +88 -88
- package/docs/COMMITTED_RECORD_COMPATIBILITY.md +55 -18
- package/docs/DURABILITY.md +88 -38
- package/docs/INDEX_GENERATIONS.md +65 -19
- package/docs/MAILBOX_LIFECYCLE.md +28 -1
- package/docs/REINDEX_METADATA_COMPATIBILITY.md +18 -8
- package/docs/SECURITY_MODEL.md +31 -14
- package/docs/TELEMETRY_RETENTION.md +11 -4
- package/docs/WATCH_REFRESH_REQUESTS.md +34 -21
- package/docs/WINDOWS_SIDECAR_RELEASE.md +9 -4
- package/docs/analyzer-inventory.md +31 -22
- package/docs/analyzer-validation-ledger.md +8 -0
- package/docs/schemas/outcome-event-record.schema.json +57 -1
- package/docs/schemas/project-config.schema.json +82 -1
- package/docs/schemas/suppression-record.schema.json +84 -3
- package/package.json +5 -5
- package/skills/_shared/SKILL.md +2 -2
- package/skills/_shared/references/agent-contract-catalog.md +1 -1
- package/skills/_shared/references/detector-precision-and-diffgate.md +1 -1
- package/skills/scip-audit/SKILL.md +6 -6
- package/skills/scip-audit/references/claims.md +1 -1
- package/skills/scip-audit/references/cleanup.md +19 -20
- package/skills/scip-audit/references/directory.md +4 -4
- package/skills/scip-audit/references/frontend.md +10 -10
- package/skills/scip-audit/references/twin-drift.md +2 -2
- package/skills/scip-diagnose/references/debug.md +8 -8
- package/skills/scip-diagnose/references/root-cause.md +3 -3
- package/skills/scip-diagnose/references/triage.md +10 -10
- package/skills/scip-explore/SKILL.md +3 -3
- package/skills/scip-improve/SKILL.md +10 -10
- package/skills/scip-improve/references/cleanup-batches.md +3 -3
- package/skills/scip-improve/references/directory-moves.md +3 -3
- package/skills/scip-improve/references/doc-reconcile.md +1 -1
- package/skills/scip-improve/references/frontend-extraction.md +2 -2
- package/skills/scip-improve/references/twin-drift.md +3 -3
- package/skills/scip-plan/SKILL.md +2 -2
- package/skills/scip-plan/references/api-impact.md +5 -5
- package/skills/scip-plan/references/conductor.md +2 -2
- package/skills/scip-plan/references/hyper-optimization.md +1 -1
- package/skills/scip-query/SKILL.md +15 -5
- package/skills/scip-setup/references/bootstrap-workflow.md +7 -8
- package/skills/scip-setup/references/language-verification.md +2 -2
- package/skills/scip-setup/references/per-repo-triage.md +1 -1
- package/skills/scip-verify/SKILL.md +10 -10
- package/skills/scip-verify/references/calibrate-detectors.md +7 -7
- package/dist/chunk-2465DLHK.js +0 -3
- package/dist/chunk-2U3OLUNJ.js +0 -61
- package/dist/chunk-33XTHFKR.js +0 -2
- package/dist/chunk-43KC6EQZ.js +0 -2
- package/dist/chunk-47BU5Z4T.js +0 -8
- package/dist/chunk-4YTUWQ6M.js +0 -18
- package/dist/chunk-64MNV6AB.js +0 -8
- package/dist/chunk-67QRR5YC.js +0 -6
- package/dist/chunk-6GXYN7YA.js +0 -40
- package/dist/chunk-A2TNXAXO.js +0 -8
- package/dist/chunk-APMMR5Y2.js +0 -2
- package/dist/chunk-AZFUMCQB.js +0 -2
- package/dist/chunk-BNXICU42.js +0 -33
- package/dist/chunk-C5Q44Q5D.js +0 -3
- package/dist/chunk-DQGSM7RZ.js +0 -20
- package/dist/chunk-E2LAW7SL.js +0 -30
- package/dist/chunk-E4NFOAD4.js +0 -6
- package/dist/chunk-E5HNT4X2.js +0 -3
- package/dist/chunk-FD3HFKXR.js +0 -5
- package/dist/chunk-GHKEJTCE.js +0 -35
- package/dist/chunk-GLZTVKAB.js +0 -16
- package/dist/chunk-HIB452NU.js +0 -949
- package/dist/chunk-IF6FP6B2.js +0 -66
- package/dist/chunk-JORHF5AL.js +0 -108
- package/dist/chunk-KSGTULOS.js +0 -9
- package/dist/chunk-KXDJAG4N.js +0 -38
- package/dist/chunk-L4S2A7BV.js +0 -2
- package/dist/chunk-LP3ARJKF.js +0 -8
- package/dist/chunk-LSOR3LQG.js +0 -3
- package/dist/chunk-NTUMF2X3.js +0 -56
- package/dist/chunk-QOXBSI6G.js +0 -20
- package/dist/chunk-QXK6UUSM.js +0 -2
- package/dist/chunk-RA3AYNWP.js +0 -112
- package/dist/chunk-RJMDJR3A.js +0 -2
- package/dist/chunk-RLH5VUMG.js +0 -2
- package/dist/chunk-SMQWE25B.js +0 -3
- package/dist/chunk-TAVELHYR.js +0 -2
- package/dist/chunk-VAXNI5NE.js +0 -146
- package/dist/chunk-VVY2G5ET.js +0 -2
- package/dist/chunk-W3DBTGL4.js +0 -11
- package/dist/chunk-WANA4KAQ.js +0 -5
- package/dist/chunk-X4FR5BZF.js +0 -9
- package/dist/chunk-X6RKPDY7.js +0 -2
- package/dist/chunk-YCPASUCX.js +0 -2
- package/dist/chunk-ZL2OGDCD.js +0 -2
- package/dist/command-descriptors-ZW5J4ZEM.js +0 -631
- package/dist/direct-navigation-42YHQPOI.js +0 -3
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import{c as v}from"./chunk-7S5E7KWT.js";import{a as f,b as B,d as $,p as H}from"./chunk-2KAZEZ6M.js";import{a as y,e as j,f as W}from"./chunk-C3KV2II6.js";function Ne(e,t){let n=e.split("/").at(-1)??e;if(q.has(n)||n===".scipquery.json"||/^tsconfig(?:\..+)?\.json$/.test(n))return"config";if(/\.d\.(?:ts|mts|cts)$/.test(e.toLowerCase()))return"ambient";let i=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return t.some(r=>(Q[r]??[]).includes(i))?"source":"other"}function G(e,t,n){let i=e.split("/").at(-1)??e;if(n?.includes(e)||n?.includes(i)||q.has(i)||i===".scipquery.json"||/^tsconfig(?:\..+)?\.json$/.test(i))return!0;let r=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(Q[t]??[]).includes(r)}function jt(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!X(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!X(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(L)?null:t}function Lt(e,t){let n=new Map((e?.files??[]).map(s=>[s.path,s])),i=new Map(t.files.map(s=>[s.path,s])),r=new Set([...n.keys(),...i.keys()]),o=[];for(let s of[...r].sort()){let c=n.get(s),d=i.get(s),E=Ne(s,t.languages);!c&&d?o.push({kind:"added",path:s,inputKind:E,after:d}):c&&!d?o.push({kind:"deleted",path:s,inputKind:E,before:c}):c&&d&&(c.hash!==d.hash||c.size!==d.size)&&o.push({kind:"modified",path:s,inputKind:E,before:c,after:d})}let a=new Set;return e||a.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&a.add("snapshot-version-changed"),(Y(e?.files??[])||Y(t.files))&&a.add("duplicate-input-path"),[...e?.files??[],...t.files].some(we)&&a.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!je(e,t):!0,uncertainty:[...a].sort()}}function X(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Y(e){return new Set(e.map(t=>t.path)).size!==e.length}function L(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"}function we(e){return e.hash==="unreadable"||e.size<0}function je(e,t){return z(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&z(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function z(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),i=[...t].sort();return n.every((r,o)=>r===i[o])}var q=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock","deps.edn","project.clj","bb.edn","shadow-cljs.edn"]),Q={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};var C=2,h=3;var I=new Set($);function J(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(a){return{kind:"malformed",reason:`invalid JSON: ${Ae(a)}`}}if(!f(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let n=t.version;if(!Number.isInteger(n))return{kind:"malformed",reason:"version must be an integer"};if(n!==C&&n!==h)return{kind:"unsupported",version:n,direction:n<C?"older":"future"};let i=Ce(t,n);if(i)return{kind:"malformed",reason:i};let r=t,o={metadata:r,capabilities:Le(r)};return n===C?{kind:"legacy",...o,metadata:r}:{kind:"supported",...o,metadata:r}}function At(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function Mt(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===h?t.sqliteLayoutVersion:void 0})}function Le(e){let t=e.fingerprint!==void 0,n=f(e.fingerprint),i=e.indexedLanguages!==void 0,r=e.status==="complete",o=e.version===h?e:null;return{usableForQuery:i,usableForEvidenceCache:t,publishableGeneration:r&&n&&i,stableGenerationIdentity:r&&t&&typeof e.updatedAt=="string",languageShardReuse:!!o?.languageFingerprints,typescriptProjectShardReuse:!!o?.typescriptProjectShards}}function Ce(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!B(e.updatedAt))return"updatedAt must be a valid timestamp";for(let n of["requestedLanguages","indexedLanguages"])if(e[n]!==void 0&&!Ie(e[n]))return`${n} must contain unique supported languages`;return e.skipped!==void 0&&!xe(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===h&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===h&&e.languageFingerprints!==void 0&&!ke(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===h&&e.typescriptProjectShards!==void 0&&!De(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function Ut(e){return e.version===h&&e.sqliteLayoutVersion===1}function Ie(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&I.has(t))?!1:new Set(e).size===e.length}function xe(e){return Array.isArray(e)&&e.every(t=>f(t)&&typeof t.language=="string"&&I.has(t.language)&&typeof t.reason=="string")}function ke(e){return f(e)&&Object.entries(e).every(([t,n])=>I.has(t)&&f(n))}function De(e){return f(e)&&Object.values(e).every(t=>f(t)&&Array.isArray(t.files)&&t.files.every(L))}function Ae(e){return e instanceof Error?e.message:String(e)}import{createHash as Me}from"crypto";import{existsSync as Bt,mkdirSync as Ue}from"fs";import{dirname as Z,join as Ve}from"path";import ee from"better-sqlite3";var Ke="evidence.db";var We=["source-facts","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],x=new Set(We);var zt=512*1024*1024,Be=6e4;var P=new WeakMap,$e=v("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),He=v("evidence-project-fingerprint",{clearGroups:["whole-project"]}),p="evidence-v1",_="version NOT LIKE 'evidence-%'";function te(e){return Me("sha256").update(e).digest("hex")}function Gt(e,t,n){return $e.get(e,t,()=>te(n))}function ne(e){return He.get(e,"current",()=>{try{if(!e.generation.metadataRaw)return null;let t=J(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=t.metadata,i=[...n.indexedLanguages??[]].sort();return te(JSON.stringify({fingerprint:n.fingerprint,indexedLanguages:i,status:n.status}))}catch(t){return S("project fingerprint unavailable",t),null}})}function S(e,t){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${e}: ${t instanceof Error?t.message:String(t)}`)}function u(e){if(P.has(e))return P.get(e)??null;let t=null;try{let n=new ee(Ve(Z(e.config.dbPath),Ke));n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 5000"),n.pragma("synchronous = NORMAL"),n.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 project_evidence (
|
|
11
|
+
kind TEXT NOT NULL,
|
|
12
|
+
cache_key TEXT NOT NULL,
|
|
13
|
+
project_fingerprint TEXT NOT NULL,
|
|
14
|
+
version TEXT NOT NULL,
|
|
15
|
+
payload TEXT NOT NULL,
|
|
16
|
+
PRIMARY KEY (kind, cache_key)
|
|
17
|
+
);
|
|
18
|
+
CREATE TABLE IF NOT EXISTS semantic_callees (
|
|
19
|
+
relative_path TEXT NOT NULL,
|
|
20
|
+
symbol TEXT NOT NULL,
|
|
21
|
+
content_hash TEXT NOT NULL,
|
|
22
|
+
deps_digest TEXT NOT NULL,
|
|
23
|
+
version TEXT NOT NULL,
|
|
24
|
+
payload TEXT NOT NULL,
|
|
25
|
+
PRIMARY KEY (relative_path, symbol)
|
|
26
|
+
);
|
|
27
|
+
CREATE TABLE IF NOT EXISTS semantic_references (
|
|
28
|
+
relative_path TEXT NOT NULL,
|
|
29
|
+
symbol TEXT NOT NULL,
|
|
30
|
+
project_fingerprint TEXT NOT NULL,
|
|
31
|
+
version TEXT NOT NULL,
|
|
32
|
+
payload TEXT NOT NULL,
|
|
33
|
+
PRIMARY KEY (relative_path, symbol)
|
|
34
|
+
);
|
|
35
|
+
CREATE TABLE IF NOT EXISTS finding_outcome_ledger (
|
|
36
|
+
check_name TEXT NOT NULL,
|
|
37
|
+
finding_id TEXT NOT NULL,
|
|
38
|
+
first_seen INTEGER NOT NULL,
|
|
39
|
+
last_seen INTEGER NOT NULL,
|
|
40
|
+
times_shown INTEGER NOT NULL,
|
|
41
|
+
outcome TEXT NOT NULL,
|
|
42
|
+
PRIMARY KEY (check_name, finding_id)
|
|
43
|
+
);
|
|
44
|
+
CREATE TABLE IF NOT EXISTS finding_outcome_observations (
|
|
45
|
+
observation_id TEXT PRIMARY KEY,
|
|
46
|
+
fingerprint TEXT NOT NULL,
|
|
47
|
+
observed_at INTEGER NOT NULL
|
|
48
|
+
);
|
|
49
|
+
`),t={evidence:n,shared:Xe(e.config.sharedEvidenceDbPath),readFileEvidence:n.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:n.prepare(`SELECT payload FROM file_evidence
|
|
50
|
+
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${_}
|
|
51
|
+
ORDER BY version DESC
|
|
52
|
+
LIMIT 1`),writeFileEvidence:n.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readProjectEvidence:n.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:n.prepare(`SELECT payload FROM project_evidence
|
|
53
|
+
WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${_}
|
|
54
|
+
ORDER BY version DESC
|
|
55
|
+
LIMIT 1`),writeProjectEvidence:n.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:n.prepare(`SELECT payload FROM semantic_callees
|
|
56
|
+
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:n.prepare(`SELECT payload FROM semantic_callees
|
|
57
|
+
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${_}
|
|
58
|
+
ORDER BY version DESC
|
|
59
|
+
LIMIT 1`),readCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
|
|
60
|
+
WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
|
|
61
|
+
WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${_}
|
|
62
|
+
ORDER BY symbol, version DESC`),writeCallees:n.prepare(`INSERT OR REPLACE INTO semantic_callees
|
|
63
|
+
(relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:n.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:n.prepare(`SELECT payload FROM semantic_references
|
|
64
|
+
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:n.prepare(`SELECT payload FROM semantic_references
|
|
65
|
+
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${_}
|
|
66
|
+
ORDER BY version DESC
|
|
67
|
+
LIMIT 1`),readReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
|
|
68
|
+
WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
|
|
69
|
+
WHERE relative_path = ? AND project_fingerprint = ? AND ${_}
|
|
70
|
+
ORDER BY symbol, version DESC`),writeReferences:n.prepare(`INSERT OR REPLACE INTO semantic_references
|
|
71
|
+
(relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:n.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?"),readFindingOutcomeLedger:n.prepare("SELECT check_name, finding_id, first_seen, last_seen, times_shown, outcome FROM finding_outcome_ledger"),claimFindingOutcomeObservation:n.prepare(`INSERT OR IGNORE INTO finding_outcome_observations
|
|
72
|
+
(observation_id, fingerprint, observed_at) VALUES (?, ?, ?)`),readFindingOutcomeObservation:n.prepare("SELECT fingerprint FROM finding_outcome_observations WHERE observation_id = ?"),upsertFindingOutcomeLedgerRow:n.prepare(`INSERT INTO finding_outcome_ledger
|
|
73
|
+
(check_name, finding_id, first_seen, last_seen, times_shown, outcome)
|
|
74
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
75
|
+
ON CONFLICT(check_name, finding_id) DO UPDATE SET
|
|
76
|
+
first_seen = MIN(finding_outcome_ledger.first_seen, excluded.first_seen),
|
|
77
|
+
last_seen = MAX(finding_outcome_ledger.last_seen, excluded.last_seen),
|
|
78
|
+
times_shown = finding_outcome_ledger.times_shown + excluded.times_shown,
|
|
79
|
+
outcome = excluded.outcome`),updateFindingOutcomeLedgerRow:n.prepare(`UPDATE finding_outcome_ledger
|
|
80
|
+
SET first_seen = MIN(first_seen, ?),
|
|
81
|
+
last_seen = MAX(last_seen, ?),
|
|
82
|
+
outcome = ?
|
|
83
|
+
WHERE check_name = ? AND finding_id = ?`),trimFindingOutcomeLedgerCheck:n.prepare(`DELETE FROM finding_outcome_ledger
|
|
84
|
+
WHERE rowid IN (
|
|
85
|
+
SELECT rowid
|
|
86
|
+
FROM finding_outcome_ledger
|
|
87
|
+
WHERE check_name = ?
|
|
88
|
+
ORDER BY last_seen DESC, first_seen DESC, finding_id DESC
|
|
89
|
+
LIMIT -1 OFFSET ?
|
|
90
|
+
)`)}}catch(n){S("disabled (open failed)",n)}return P.set(e,t),t}function g(e,t,n){S(`disabled (${t})`,n),P.set(e,null)}function Xe(e){if(!e)return null;try{Ue(Z(e),{recursive:!0});let t=new ee(e);return t.pragma("journal_mode = WAL"),t.pragma("busy_timeout = 250"),t.pragma("synchronous = NORMAL"),t.exec(`
|
|
91
|
+
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
92
|
+
kind TEXT NOT NULL,
|
|
93
|
+
relative_path TEXT NOT NULL,
|
|
94
|
+
content_hash TEXT NOT NULL,
|
|
95
|
+
version TEXT NOT NULL,
|
|
96
|
+
payload TEXT NOT NULL,
|
|
97
|
+
last_accessed_at INTEGER NOT NULL,
|
|
98
|
+
PRIMARY KEY (kind, relative_path, content_hash, version)
|
|
99
|
+
);
|
|
100
|
+
CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
|
|
101
|
+
ON file_evidence(last_accessed_at, kind, relative_path, content_hash, version);
|
|
102
|
+
`),{evidence:t,readFileEvidence:t.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:t.prepare(`INSERT INTO file_evidence (kind, relative_path, content_hash, version, payload, last_accessed_at)
|
|
103
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
104
|
+
ON CONFLICT(kind, relative_path, content_hash, version)
|
|
105
|
+
DO UPDATE SET payload = excluded.payload, last_accessed_at = excluded.last_accessed_at`),touchFileEvidence:t.prepare(`UPDATE file_evidence
|
|
106
|
+
SET last_accessed_at = ?
|
|
107
|
+
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?
|
|
108
|
+
AND last_accessed_at < ?`)}}catch(t){return S("shared cache disabled (open failed)",t),null}}function k(e,t,n){S(`shared cache disabled (${t})`,n);try{e.shared?.evidence.close()}catch{}e.shared=null}function re(e,t,n,i){let r=u(e);if(!r)return null;try{let o=r.readFileEvidence.get(t,n,i,p)??r.readLegacyFileEvidence.get(t,n,i);if(o?.payload!==void 0)return o.payload;if(!x.has(t)||!r.shared)return null;try{let a=r.shared.readFileEvidence.get(t,n,i,p);return a?.payload!==void 0&&Ye(r.shared,t,n,i),a?.payload??null}catch(a){return k(r,"file_evidence read",a),null}}catch(o){return g(e,"file_evidence read",o),null}}function Ye(e,t,n,i){let r=Date.now();try{e.touchFileEvidence.run(r,t,n,i,p,r-Be)}catch(o){S("shared file_evidence recency touch skipped",o)}}function ie(e,t,n,i,r){let o=u(e);if(o)try{if(o.writeFileEvidence.run(t,n,i,p,r),x.has(t)&&o.shared)try{o.shared.writeFileEvidence.run(t,n,i,p,r,Date.now())}catch(a){k(o,"file_evidence write",a)}}catch(a){g(e,"file_evidence write",a)}}function oe(e,t){if(t.length===0)return;let n=u(e);if(n)try{n.evidence.transaction(()=>{for(let r of t)n.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,p,r.payload)})();let i=t.filter(r=>x.has(r.kind));if(i.length>0&&n.shared)try{n.shared.evidence.transaction(()=>{for(let r of i)n.shared.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,p,r.payload,Date.now())})()}catch(r){k(n,"file_evidence batch write",r)}}catch(i){g(e,"file_evidence batch write",i)}}function ae(e,t,n,i){let r=u(e);if(!r)return null;try{return(r.readProjectEvidence.get(t,n,i,p)??r.readLegacyProjectEvidence.get(t,n,i))?.payload??null}catch(o){return g(e,"project_evidence read",o),null}}function se(e,t,n,i,r){let o=u(e);if(o)try{o.writeProjectEvidence.run(t,n,i,p,r)}catch(a){g(e,"project_evidence write",a)}}function qt(e,t,n,i){let r=u(e);if(!r)return new Map;try{let o=r.readCalleesForFile.all(t,n,i,p),a=r.readLegacyCalleesForFile.all(t,n,i);return ce([...a,...o])}catch(o){return g(e,"semantic_callees bulk read",o),new Map}}function Qt(e,t,n){let i=u(e);if(!i)return new Map;try{let r=i.readReferencesForFile.all(t,n,p),o=i.readLegacyReferencesForFile.all(t,n);return ce([...o,...r])}catch(r){return g(e,"semantic_references bulk read",r),new Map}}function ce(e){let t=new Map;for(let n of e)t.set(n.symbol,n.payload);return t}function Jt(e,t){if(t.length===0)return;let n=u(e);if(n)try{n.evidence.transaction(()=>{let i=new Set;for(let r of t){let o=`${r.relativePath}\0${r.contentHash}`;i.has(o)||(i.add(o),n.dropStaleCallees.run(r.relativePath,r.contentHash)),n.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,p,r.payload)}})()}catch(i){g(e,"semantic_callees write",i)}}function Zt(e,t){if(t.length===0)return;let n=u(e);if(n)try{n.evidence.transaction(()=>{let i=new Set;for(let r of t){let o=`${r.relativePath}\0${r.projectFingerprint}`;i.has(o)||(i.add(o),n.dropStaleReferences.run(r.relativePath,r.projectFingerprint)),n.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,p,r.payload)}})()}catch(i){g(e,"semantic_references write",i)}}function en(e){let t=u(e);if(!t)return[];try{return ze(t)}catch(n){return g(e,"finding_outcome_ledger read",n),[]}}function ze(e){return e.readFindingOutcomeLedger.all().map(n=>({check:n.check_name,findingId:n.finding_id,firstSeen:n.first_seen,lastSeen:n.last_seen,timesShown:n.times_shown,outcome:n.outcome}))}function nn(e){return typeof e=="object"&&e!==null}function rn(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}import{appendFileSync as Ge,mkdirSync as qe}from"fs";import{createHash as Qe,randomUUID as Je}from"crypto";import{dirname as Ze}from"path";import{performance as T}from"perf_hooks";var ue="SCIP_QUERY_PROFILE",ge="SCIP_QUERY_PROFILE_OUT",fe="SCIP_QUERY_PROFILE_COMMAND",me="SCIP_QUERY_PROFILE_CACHE_STATE",D="SCIP_QUERY_PROFILE_RUN_ID",A="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY",M="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND",he=[ue,ge,fe,me,D,A,M],ln=new Set(he),de=new Set,le=new Map,pe=!1;function m(){let e=process.env[ue];return e==="1"||e==="true"}function et(){return process.env[ge]}function Ee(){return process.env[fe]}function tt(){return process.env[me]}function ye(){let e=process.env[D];if(e)return e;if(!m())return;let t=Je();return process.env[D]=t,t}function ve(){return process.env[A]}function nt(e){let t=ve();if(t)return t;if(!m())return;let n=ye();if(!n)return;let i=e.projectFingerprint?"published-project":"run-only",r=R(["profile-workload-v1",e.toolVersion,e.command,e.projectFingerprint??n]);return process.env[A]=r,process.env[M]=i,r}function R(e){return Qe("sha256").update(JSON.stringify(e)).digest("hex").slice(0,24)}function pn(){return Object.fromEntries(he.flatMap(e=>{let t=process.env[e];return t===void 0?[]:[[e,t]]}))}function U(e,t,n){if(!m())return t();let i=T.now();try{let r=t();return b({type:"span",name:e,durationMs:Math.round(T.now()-i),ok:!0,...F(n)??{}}),r}catch(r){throw b({type:"span",name:e,durationMs:Math.round(T.now()-i),ok:!1,error:r instanceof Error?r.message:String(r),...F(n)??{}}),r}}async function un(e,t,n){if(!m())return t();let i=T.now();try{let r=await t();return b({type:"span",name:e,durationMs:Math.round(T.now()-i),ok:!0,...F(n)??{}}),r}catch(r){throw b({type:"span",name:e,durationMs:Math.round(T.now()-i),ok:!1,error:r instanceof Error?r.message:String(r),...F(n)??{}}),r}}function b(e,t=et()){let n=rt(e),i={timestamp:new Date().toISOString(),pid:process.pid,runId:ye(),command:Ee(),cacheState:tt(),...n,...e},r=`${JSON.stringify(i)}
|
|
109
|
+
`;if(t)try{let o=Ze(t);de.has(o)||(qe(o,{recursive:!0}),de.add(o)),Ge(t,r);return}catch(o){pe||(pe=!0,process.stderr.write(`[profile] failed to write ${t}: ${o instanceof Error?o.message:String(o)}
|
|
110
|
+
`));return}m()&&process.stderr.write(r)}function rt(e){let t=ve()??nt({command:Ee()??"unknown",toolVersion:"unknown",projectFingerprint:null});if(!t)return{};let n=process.env[M],i=typeof e.name=="string"?e.name:void 0;if(!i)return{workloadIdentity:t,workloadIdentityKind:n};let r=i.split(/[.:]/,1)[0]??i,o=`${t}\0${i}`,a=le.get(o);return a||(a=R(["profile-subsystem-v1",t,i]),le.set(o,a)),{workloadIdentity:t,workloadIdentityKind:n,subsystem:r,subsystemWorkIdentity:a}}function F(e){return typeof e=="function"?e():e}var it=[l("source-facts",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/source-facts.ts"}),l("file-definitions",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/symbols/definition-catalog.ts"}),l("definition-exclusions",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/framework-patterns.ts"}),l("doc-path-tokens",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-products.test.ts",owner:"tests/storage/evidence-cache.test.ts"}),l("doc-path-evidence",{dependsOn:["content-hash","git-history","git-head","tool-version"],keyParts:["kind","relativePath","contentHash","trackedFiles","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/cleanup/doc-drift.ts"}),l("source-imports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),l("source-reexports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),l("source-fingerprints",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/definition-catalog.test.ts",owner:"src/queries/cleanup/similar.ts"}),l("consumer-file-usage",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/internal/consumer-evidence.ts"}),l("react-component-behavior-profiles",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/react-profile.ts"}),l("git-file-adds",{dependsOn:["git-head","git-history","tool-version"],keyParts:["kind","cacheKey","head","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/git-history.ts"}),l("typescript-reference-fragments",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-reference-fragments.test.ts",owner:"src/semantic/typescript/reference-fragment-shadow.ts"}),l("typescript-import-usage",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),l("typescript-signatures",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),O("file-dependency-graph",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","scope","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/file-dep-graph.test.ts",owner:"src/symbols/graph/file-dep-graph.ts"}),O("semantic-import-usage",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","relativePath","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),O("semantic-signatures",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","symbol","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),O("health-semantic-prewarm",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","scope","cliVersion","projectFingerprint","payloadVersion"],stalenessTest:"tests/runtime/cli-support.test.ts",owner:"src/runtime/cli-support.ts"})];function yn(e){let t=new Map;return{kind:e.kind,read(n,i,r){let o=!1,a=0,s;if(m()){let c=ne(n);if(c){let d=`${c}\0${i}\0${r}`;s=t.get(d),s||(s=R(["evidence-product-file-read-v1",e.kind,c,i,r]),t.set(d,s))}}return U("evidence-product.file.read",()=>{let c=re(n,e.kind,i,r);if(c===null)return null;a=c.length;try{let d=e.deserialize(c);return o=d!==null,d}catch{return null}},()=>({...s?{workIdentity:s,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:o,payloadBytes:a}))},write(n,i,r,o){ie(n,e.kind,i,r,e.serialize(o))},writeBatch(n,i){oe(n,i.map(r=>({kind:e.kind,relativePath:r.relativePath,contentHash:r.contentHash,payload:e.serialize(r.value)})))}}}function vn(e){let t=new Map;return{kind:e.kind,read(n,i,r){let o=!1,a=0,s;if(m()){let c=`${r}\0${i}`;s=t.get(c),s||(s=R(["evidence-product-project-read-v1",e.kind,r,i]),t.set(c,s))}return U("evidence-product.project.read",()=>{let c=ae(n,e.kind,i,r);if(c===null)return null;a=c.length;try{let d=e.deserialize(c);return o=d!==null,d}catch{return null}},()=>({...s?{workIdentity:s,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:o,payloadBytes:a}))},write(n,i,r,o){se(n,e.kind,i,r,e.serialize(o))}}}function _n(e){let t=it.find(n=>n.kind===e);if(!t)throw new Error(`missing evidence product manifest entry for ${e}`);return t.invalidation}function l(e,t){return{scope:"file",kind:e,invalidation:{scope:"file",...t}}}function O(e,t){return{scope:"project",kind:e,invalidation:{scope:"project",...t}}}import{execFileSync as ot}from"child_process";import{createHash as _e}from"crypto";import{closeSync as at,fstatSync as Se,lstatSync as Te,openSync as st,readdirSync as ct,readFileSync as dt,readlinkSync as lt,realpathSync as N}from"fs";import{isAbsolute as pt,join as Re,relative as ut,resolve as gt,sep as ft}from"path";var V=64*1024*1024,w=class extends Error{constructor(n,i,r,o){super(`${n} ${JSON.stringify(i)} is ${r} bytes; the safety limit is ${o} bytes`);this.inputKind=n;this.inputPath=i;this.observedBytes=r;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="SCIP_QUERY_INPUT_TOO_LARGE"};function mt(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function Pe(e,t,n={}){let i=W(t),r=N(e),o=gt(r,...i.split("/"));if(!j(r,o)||o===r)throw new y(t,"outside-project");let a=N(o);if(!j(r,a)||a===r)throw new y(t,"outside-project");let s=Te(a);if(!s.isFile())throw new y(t,"not-a-file");let c={projectRoot:r,relativePath:i,absolutePath:a,size:s.size,mtimeMs:s.mtimeMs,device:s.dev,inode:s.ino},d=n.maxBytes??V;if(Et(d),c.size>d)throw new w(n.inputKind??"project file",c.relativePath,c.size,d);return c}function ht(e,t,n={}){let i=Pe(e,t,n),r=n.maxBytes??V,o=st(i.absolutePath,"r");try{let a=Se(o);if(!a.isFile()||a.dev!==i.device||a.ino!==i.inode||a.size!==i.size)throw new y(t,"changed-during-read");if(a.size>r)throw new w(n.inputKind??"project file",i.relativePath,a.size,r);let s=dt(o),c=Se(o);if(c.dev!==a.dev||c.ino!==a.ino||c.size!==a.size||s.byteLength!==a.size)throw new y(t,"changed-during-read");return s}finally{at(o)}}function be(e,t,n={}){return ht(e,t,n).toString("utf8")}function K(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function wn(e,t){try{return Pe(e,t),!0}catch(n){if(K(n))return!1;throw n}}function Et(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function yt(e){return(St(e)??Tt(e)).filter(t=>t&&!Fe(t)).sort()}function vt(e,t={}){let n=yt(e).filter(r=>!t.language||G(r,t.language,t.markerFiles)).filter(r=>!t.includePath||t.includePath(r)),i=N(e);return n.map(r=>{let o=Re(e,r);try{if(Te(o).isSymbolicLink()){let c=N(o),d=ut(i,c);if(d===".."||d.startsWith(`..${ft}`)||pt(d))throw new Error("external symlink");let E=lt(o);return{path:r,size:Buffer.byteLength(E),hash:_e("sha256").update("symlink\0").update(E).digest("hex")}}let a=_e("sha256"),s=H(o,{inputKind:"project fingerprint input",maxBytes:V},c=>a.update(c));return{path:r,size:s,hash:a.digest("hex")}}catch{return{path:r,size:-1,hash:"unreadable"}}})}function jn(e,t,n){return{version:2,languages:[...t].sort(),pnpmWorkspaces:n.typescriptProjectMode!=="workspace"&&n.pnpmWorkspaces===!0,typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:mt(n.typescriptProjects),clojureConfigPath:_t(n.clojureConfigPath),files:vt(e)}}function _t(e){return e?.trim()||void 0}function St(e){try{return ot("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}).split(`
|
|
111
|
+
`).filter(Boolean)}catch{return null}}function Tt(e){let t=[],n=[""];for(;n.length>0;){let i=n.pop(),r=i?Re(e,i):e,o;try{o=ct(r,{withFileTypes:!0})}catch{continue}for(let a of o){let s=i?`${i}/${a.name}`:a.name;if(a.isDirectory()){Fe(s)||n.push(s);continue}t.push(s)}}return t}function Fe(e){let t=e.split("/");return e==="meta.json"||t[0]===".scipquery"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(n=>Rt.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var Rt=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);var Pt=v("source-text",{clearGroups:["whole-project","source-file"]}),bt=v("source-lines",{clearGroups:["whole-project","source-file"]});function Ft(e,t){let n=t.replace(/\\/g,"/");return Pt.get(e,n,()=>{try{return be(e.config.projectRoot,n,{inputKind:"indexed source file"})}catch(i){if(K(i))return"";throw i}})}function Ot(e,t){let n=t.replace(/\\/g,"/");return bt.get(e,n,()=>{let i=Ft(e,n);return i?i.split(`
|
|
112
|
+
`):[]})}var Nt=/^\s*(?:\/\/|#|\/\*+|\*)\s*scip-query[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar|twin))?\b/i;function wt(e){let t=Nt.exec(e);return t?t[1]??"":null}function xn(e,t,n){return Oe(e,t,n).length>0}function kn(e,t,n,i){let r=i.toLowerCase();return Oe(e,t,n).some(o=>o.toLowerCase()===r)}function Oe(e,t,n){if(n<=0)return[];let i=Ot(e,t);if(i.length===0)return[];let r=[];for(let o=n-1;o>=0&&o>=n-5;o-=1){let a=(i[o]??"").trim();if(a==="")continue;let s=wt(a);if(s!==null){r.push(s);continue}if(!a.startsWith("//")&&!a.startsWith("*")&&!a.startsWith("/*")&&!a.startsWith("@")&&!a.startsWith("#"))return r}return r}export{Ne as a,jt as b,Lt as c,h as d,J as e,At as f,Mt as g,Le as h,Ut as i,te as j,Gt as k,ne as l,qt as m,Qt as n,Jt as o,Zt as p,en as q,nn as r,rn as s,m as t,pn as u,U as v,un as w,b as x,yn as y,vn as z,_n as A,mt as B,Pe as C,ht as D,be as E,K as F,wn as G,vt as H,jn as I,Ft as J,Ot as K,wt as L,xn as M,kn as N};
|
|
113
|
+
//# sourceMappingURL=chunk-WCCFZ7V7.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as y}from"./chunk-46XGSFNI.js";import{execFileSync as _}from"child_process";import{createHash as k}from"crypto";import{closeSync as A,fstatSync as C,lstatSync as I,openSync as N,readdirSync as W,readFileSync as B,readlinkSync as U,realpathSync as g}from"fs";import{isAbsolute as $,join as v,relative as D,resolve as K,sep as G}from"path";function R(e,t){let n=e.split("/").at(-1)??e;if(F.has(n)||n===".scipquery.json"||/^tsconfig(?:\..+)?\.json$/.test(n))return"config";if(/\.d\.(?:ts|mts|cts)$/.test(e.toLowerCase()))return"ambient";let r=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return t.some(o=>(x[o]??[]).includes(r))?"source":"other"}function b(e,t,n){let r=e.split("/").at(-1)??e;if(n?.includes(e)||n?.includes(r)||F.has(r)||r===".scipquery.json"||/^tsconfig(?:\..+)?\.json$/.test(r))return!0;let o=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(x[t]??[]).includes(o)}function ne(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!j(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!j(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(M)?null:t}function re(e,t){let n=new Map((e?.files??[]).map(s=>[s.path,s])),r=new Map(t.files.map(s=>[s.path,s])),o=new Set([...n.keys(),...r.keys()]),a=[];for(let s of[...o].sort()){let c=n.get(s),p=r.get(s),u=R(s,t.languages);!c&&p?a.push({kind:"added",path:s,inputKind:u,after:p}):c&&!p?a.push({kind:"deleted",path:s,inputKind:u,before:c}):c&&p&&(c.hash!==p.hash||c.size!==p.size)&&a.push({kind:"modified",path:s,inputKind:u,before:c,after:p})}let i=new Set;return e||i.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&i.add("snapshot-version-changed"),(m(e?.files??[])||m(t.files))&&i.add("duplicate-input-path"),[...e?.files??[],...t.files].some(L)&&i.add("unreadable-input"),{version:1,changes:a,projectIdentityChanged:e?!E(e,t):!0,uncertainty:[...i].sort()}}function j(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function m(e){return new Set(e.map(t=>t.path)).size!==e.length}function M(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"}function L(e){return e.hash==="unreadable"||e.size<0}function E(e,t){return P(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&P(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function P(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((o,a)=>o===r[a])}var F=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock","deps.edn","project.clj","bb.edn","shadow-cljs.edn"]),x={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{isAbsolute as S,relative as O}from"path";var l=class extends Error{constructor(n,r){super(`refusing unsafe project file path ${JSON.stringify(n)} (${r})`);this.relativePath=n;this.reason=r;this.name="UnsafeProjectPathError"}relativePath;reason;code="SCIP_QUERY_UNSAFE_PROJECT_PATH"};function T(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function se(e){return e.replace(/\\/g,"/")}function f(e,t){let n=O(e,t);return n===""||!n.startsWith("..")&&!S(n)}function w(e){if(!e)throw new l(e,"empty-path");if(e.includes("\0"))throw new l(e,"nul-byte");if(S(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new l(e,"absolute-path");let t=T(e);if(t.split("/").some(r=>r===".."))throw new l(e,"parent-traversal");if(!t||t===".")throw new l(e,"empty-path");return t}var h=64*1024*1024,d=class extends Error{constructor(n,r,o,a){super(`${n} ${JSON.stringify(r)} is ${o} bytes; the safety limit is ${a} bytes`);this.inputKind=n;this.inputPath=r;this.observedBytes=o;this.limitBytes=a;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="SCIP_QUERY_INPUT_TOO_LARGE"};function q(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function J(e,t,n={}){let r=w(t),o=g(e),a=K(o,...r.split("/"));if(!f(o,a)||a===o)throw new l(t,"outside-project");let i=g(a);if(!f(o,i)||i===o)throw new l(t,"outside-project");let s=I(i);if(!s.isFile())throw new l(t,"not-a-file");let c={projectRoot:o,relativePath:r,absolutePath:i,size:s.size,mtimeMs:s.mtimeMs,device:s.dev,inode:s.ino},p=n.maxBytes??h;if(H(p),c.size>p)throw new d(n.inputKind??"project file",c.relativePath,c.size,p);return c}function Y(e,t,n={}){let r=J(e,t,n),o=n.maxBytes??h,a=N(r.absolutePath,"r");try{let i=C(a);if(!i.isFile()||i.dev!==r.device||i.ino!==r.inode||i.size!==r.size)throw new l(t,"changed-during-read");if(i.size>o)throw new d(n.inputKind??"project file",r.relativePath,i.size,o);let s=B(a),c=C(a);if(c.dev!==i.dev||c.ino!==i.ino||c.size!==i.size||s.byteLength!==i.size)throw new l(t,"changed-during-read");return s}finally{A(a)}}function he(e,t,n={}){return Y(e,t,n).toString("utf8")}function ye(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function H(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function Q(e){return(V(e)??ee(e)).filter(t=>t&&!z(t)).sort()}function X(e,t={}){let n=Q(e).filter(o=>!t.language||b(o,t.language,t.markerFiles)).filter(o=>!t.includePath||t.includePath(o)),r=g(e);return n.map(o=>{let a=v(e,o);try{if(I(a).isSymbolicLink()){let c=g(a),p=D(r,c);if(p===".."||p.startsWith(`..${G}`)||$(p))throw new Error("external symlink");let u=U(a);return{path:o,size:Buffer.byteLength(u),hash:k("sha256").update("symlink\0").update(u).digest("hex")}}let i=k("sha256"),s=y(a,{inputKind:"project fingerprint input",maxBytes:h},c=>i.update(c));return{path:o,size:s,hash:i.digest("hex")}}catch{return{path:o,size:-1,hash:"unreadable"}}})}function je(e,t,n){return{version:2,languages:[...t].sort(),pnpmWorkspaces:n.typescriptProjectMode!=="workspace"&&n.pnpmWorkspaces===!0,typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:q(n.typescriptProjects),clojureConfigPath:Z(n.clojureConfigPath),files:X(e)}}function Z(e){return e?.trim()||void 0}function V(e){try{return _("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}).split(`
|
|
2
|
+
`).filter(Boolean)}catch{return null}}function ee(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),o=r?v(e,r):e,a;try{a=W(o,{withFileTypes:!0})}catch{continue}for(let i of a){let s=r?`${r}/${i.name}`:i.name;if(i.isDirectory()){z(s)||n.push(s);continue}t.push(s)}}return t}function z(e){let t=e.split("/");return e==="meta.json"||t[0]===".scipquery"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(n=>te.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var te=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{R as a,ne as b,re as c,M as d,l as e,se as f,f as g,w as h,q as i,J as j,Y as k,he as l,ye as m,X as n,je as o};
|
|
3
|
+
//# sourceMappingURL=chunk-WUPW3UN3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k,b as C}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as k,b as C}from"./chunk-AZJQQKDD.js";import{a as V,b as R,c as F,e as o,f as v}from"./chunk-B3X6KU75.js";import{a as B,b as g}from"./chunk-KMVGRIO2.js";import{J as y}from"./chunk-GH74ASD6.js";function j(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:t=6,limit:i=20,scope:l,scanLimit:c,filePattern:d,focusFiles:h}=s,u=y(e).vueProfiles({scope:l,minBehaviorTokens:Math.max(3,t),scanLimit:c}).map(r=>({file:r.file,tokens:r.behaviorTokens,profile:r})),n=k(u,r=>r.tokens);return C({profiles:u,limit:i,filePattern:d,focusFiles:h,candidateIndex:n,profile:{name:"vue-composable-candidates"},compare:(r,a)=>T(r,a,m,t),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.fileB.localeCompare(a.fileB)})}function T(e,s,m,t){let i=B(e.tokens,s.tokens);if(i.size<t||!P(i))return null;let l=R(e.tokens,s.tokens);if(l<m)return null;let c=o(i,"composable:"),d=o(i,"store:"),h=o(i,"reactivity:"),u=o(i,"lifecycle:"),n=o(i,"request:"),r=o(i,"function:"),a=o(i,"function-verb:"),b=o(i,"template-binding:"),p=o(i,"template-event:"),f=q({sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p});return{fileA:e.file,fileB:s.file,similarity:l,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:v(i),sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p,evidenceClass:f.evidenceClass,actionTier:f.actionTier,evidenceClassReasons:f.reasons,recommendation:f.recommendation,uniqueToA:v(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:v(g(s.tokens,e.tokens)).slice(0,25),reason:S({sharedComposables:c,sharedStores:d,sharedRequests:n,sharedLifecycle:u,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function q(e){return V({genericWords:A,primitiveGroups:[{values:e.sharedReactivity,reasonPrefix:"shared reactivity primitive",bucket:"generic"},{values:e.sharedLifecycle,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedComposables,label:"shared composable",fallbackBucket:"shared-abstraction"},{names:e.sharedStores,label:"shared store",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedFunctions,label:"shared function",fallbackBucket:"generic"},{names:e.sharedFunctionVerbs,label:"shared action verb",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"},{names:e.sharedTemplateEvents,label:"shared template event",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct composable-extraction evidence."}}function P(e){let s=0,m=0,t=0,i=0,l=0,c=0,d=0;for(let n of e)n.startsWith("composable:")?s+=1:n.startsWith("store:")?m+=1:n.startsWith("request:")?t+=1:n.startsWith("lifecycle:")?i+=1:n.startsWith("function:")?l+=1:n.startsWith("reactivity:")?c+=1:(n.startsWith("function-verb:")||n.startsWith("template-binding:")||n.startsWith("template-event:"))&&(d+=1);let h=s+m,u=h+t+i+l+d;return F([{name:"requests",count:t},{name:"lifecycle",count:i},{name:"functions",count:l},{name:"reusableHooks",count:h},{name:"reactivity",count:c},{name:"namedBehavior",count:u}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{lifecycle:1,functions:2,namedBehavior:4},reason:"shared lifecycle workflow"},{min:{reusableHooks:2,requests:1,namedBehavior:5},reason:"shared reusable Vue hooks and requests"},{min:{reusableHooks:2,functions:2,namedBehavior:5},reason:"shared reusable Vue hooks and functions"},{min:{functions:2,reactivity:1,namedBehavior:4},reason:"shared reactive functions"}]).pass}function S(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}var A=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WXZLAAWK.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-S7OYBOCK.js";import{m as d,x as f}from"./chunk-EKZTZXHZ.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-X54AGLVX.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{u as l,v as d,x as u}from"./chunk-HZ72SESS.js";import{h as c}from"./chunk-WUPW3UN3.js";import h from"better-sqlite3";var m=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],o=class{constructor(t,e){this.connection=t;this.releaseGenerationReader=e}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let e of m)this.connection.pragma(e);t(this.connection)}catch(e){try{this.close()}catch(n){throw new AggregateError([e,n],"SQLite initialization and rollback both failed.",{cause:n})}throw e}}close(){if(!this.active)return;this.active=!1;let t,e;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){e=n}if(t!==void 0&&e!==void 0)throw new AggregateError([t,e],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(e!==void 0)throw e}},b=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".scipquery-cache","__pycache__",".venv","venv"],p=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;constructor(t,e){this.config=t,this.pathFilter=e??null;let n=S(t),i=new o(n.db,n.release);try{i.initialize(y),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=i,this.db=g(n.db)}catch(r){try{i.close()}catch(s){throw new AggregateError([r,s],"SQLite construction and rollback both failed.",{cause:s})}throw r}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
|
|
2
|
+
EXISTS (
|
|
3
|
+
SELECT 1
|
|
4
|
+
FROM defn_enclosing_ranges local_der
|
|
5
|
+
JOIN documents local_d ON local_der.document_id = local_d.id
|
|
6
|
+
WHERE local_der.symbol_id = gs.id
|
|
7
|
+
${this.pathExclusionsFor("local_d").trimStart()}
|
|
8
|
+
)
|
|
9
|
+
OR EXISTS (
|
|
10
|
+
SELECT 1
|
|
11
|
+
FROM mentions local_m
|
|
12
|
+
JOIN chunks local_c ON local_m.chunk_id = local_c.id
|
|
13
|
+
JOIN documents local_d ON local_c.document_id = local_d.id
|
|
14
|
+
WHERE local_m.symbol_id = gs.id
|
|
15
|
+
AND local_m.role = 1
|
|
16
|
+
${this.pathExclusionsFor("local_d").trimStart()}
|
|
17
|
+
)
|
|
18
|
+
)`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(e=>b.flatMap(n=>[`AND ${e}.relative_path NOT LIKE '${n}/%'`,`AND ${e}.relative_path NOT LIKE '%/${n}/%'`])).join(`
|
|
19
|
+
`)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...e){return this.statement(t).all(...e)}get(t,...e){return this.statement(t).get(...e)}close(){this.statementCache.clear(),this.connectionOwnership.close()}statement(t){let e=this.statementCache.get(t);return e||(e=this.connection.prepare(t),this.statementCache.set(t,e)),e}};function g(a){return Object.freeze({prepare(t){let e=a.prepare(t);if(!e.readonly||!e.reader)throw new Error("ScipDatabase.db only permits read-only statements that return rows.");return f(e)}})}function f(a){let t={get:(...e)=>a.get(...e),all:(...e)=>a.all(...e),iterate:(...e)=>a.iterate(...e),pluck(e){return e===void 0?a.pluck():a.pluck(e),t},expand(e){return e===void 0?a.expand():a.expand(e),t},raw(e){return e===void 0?a.raw():a.raw(e),t},bind(...e){return a.bind(...e),t},columns:()=>a.columns(),safeIntegers(e){return e===void 0?a.safeIntegers():a.safeIntegers(e),t}};return Object.freeze(t)}function y(a){if(!a.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'documents'").get())return;let e=a.prepare("SELECT relative_path FROM documents").iterate();for(let n of e)c(n.relative_path)}function S(a){for(let t=0;t<4;t+=1){let e=l(a),n=e.generation,i;try{i=new h(n.databasePath,{readonly:!0,fileMustExist:!0})}catch(r){throw e.release(),r}if(n.source==="immutable")return{db:i,generation:n,release:e.release};try{let r=d(a);if(n.databaseFileIdentity===u(n.databasePath)&&r.source==="legacy"&&r.identity===n.identity&&r.databaseFileIdentity===n.databaseFileIdentity&&r.metadataRaw===n.metadataRaw)return{db:i,generation:n,release:e.release}}catch(r){throw i.close(),e.release(),r}i.close(),e.release()}throw new Error("SQLite index publication changed repeatedly while opening a coherent generation.")}export{p as a};
|
|
20
|
+
//# sourceMappingURL=chunk-XKWKXZKW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as f}from"./chunk-B3X6KU75.js";import{J as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{d as f}from"./chunk-B3X6KU75.js";import{J as d}from"./chunk-GH74ASD6.js";function S(n,e={}){let{minComponentLines:o=300,minFileLines:i=800,minJsxTokens:u=80,minBehaviorTokens:s=40,limit:a=20,scope:m,scanLimit:c,filePattern:p}=e;return d(n).reactProfiles({scope:m,scanLimit:c}).filter(t=>t.kind==="component").filter(t=>!p||t.file.includes(p)||t.name.includes(p)).map(t=>C(t,{minComponentLines:o,minFileLines:i,minJsxTokens:u,minBehaviorTokens:s})).filter(t=>t!==null).sort((t,r)=>r.componentLines-t.componentLines||r.fileLines-t.fileLines||t.file.localeCompare(r.file)).slice(0,a)}function C(n,e){let o=Math.max(80,Math.floor(e.minComponentLines/2)),i=f(n,x({minComponentLines:e.minComponentLines,minFileLines:e.minFileLines,minJsxTokens:e.minJsxTokens,minBehaviorTokens:e.minBehaviorTokens,substantialComponentLines:o}),"component"),{reasons:u}=i;if(u.length===0)return null;let s=i.dominantPressure,a=i.pressureKinds,m=b(n),c=R(s,a,m);return{file:n.file,component:n.name,componentLines:n.loc,fileLines:n.fileLines,jsxTokens:n.jsxTokens.size,behaviorTokens:n.behaviorTokens.size,dominantPressure:s,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:v(c,m),reasons:u,loc:n.loc}}function x(n){return[{axis:"component",value:e=>e.loc,qualifies:(e,o)=>o>=n.minComponentLines,reason:(e,o)=>`${o} component line(s)`},{axis:"file",value:e=>e.fileLines,qualifies:(e,o)=>o>=n.minFileLines&&e.loc>=n.substantialComponentLines,reason:(e,o)=>`${o} file line(s)`},{axis:"jsx-structure",value:e=>e.jsxTokens.size,weightedValue:(e,o)=>o*3,qualifies:(e,o)=>o>=n.minJsxTokens,reason:(e,o)=>`${o} JSX structure token(s)`},{axis:"hook-behavior",value:e=>e.behaviorTokens.size,weightedValue:(e,o)=>o*4,qualifies:(e,o)=>o>=n.minBehaviorTokens,reason:(e,o)=>`${o} behavior token(s)`}]}function b(n){let e=n.file.split(/[\\/]+/).filter(Boolean),o=e.slice(0,-1).map(r=>r.toLowerCase()),i=(e.at(-1)??n.name).replace(/\.[^.]+$/,""),s=o.findIndex(r=>k.has(r))>=0,a=o.some(r=>h.has(r));if(L(i)||L(n.name))return"component";let c=T.has(i.toLowerCase()),p=/(?:Page|Route|Screen)$/.test(n.name),l=s&&/View$/.test(n.name),t=!a&&i.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()===n.name.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()&&/(?:Page|Route|Screen|View)$/.test(i);return c||p||l||t?"route-page":"component"}function L(n){let e=n.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return e.at(-1)&&g.has(e.at(-1))?!0:[...g].some(o=>n.endsWith(P(o)))}function R(n,e,o){return n==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":e.includes("hook-behavior")?"behavior-extraction":e.includes("jsx-structure")?"jsx-decomposition":e.includes("file")?"file-decomposition":n==="jsx-structure"?"jsx-decomposition":n==="file"&&!e.includes("component")?"file-decomposition":"component-decomposition"}function v(n,e){switch(n){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return e==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),g=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),k=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),T=new Set(["page","route","screen"]);function P(n){return n.charAt(0).toUpperCase()+n.slice(1)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-XSRF6Q77.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as te,b as N,e as V,f as j,g as E,h as re,i as se}from"./chunk-KMVGRIO2.js";import{c as q}from"./chunk-UJCOIXDY.js";import{b as _}from"./chunk-B75HZHUP.js";import{a as ne}from"./chunk-Z4N3MZYA.js";import{o as ie}from"./chunk-7O5IKBTZ.js";import{a as D}from"./chunk-T7YQSHPQ.js";import{d as I,e as K,h as $}from"./chunk-EKZTZXHZ.js";import{a as B}from"./chunk-UJPRPGCO.js";import{A as ee,J as U,K as H,k as J,t as A,v as y,y as Q}from"./chunk-WCCFZ7V7.js";import{a as Y}from"./chunk-NGEXCJJW.js";import{d as z}from"./chunk-7S5E7KWT.js";function ve(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=ze(e,n,{semantic:t.semantic!==!1});if(!s)return[];if(!$(s.symbol))return[];if(s.callees.size===0)return ae(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"});let a=Me(e,s,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,r):ae(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"})}function Mn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=ve(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let l=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:I(r.symbol),file:r.relativePath,loc:l},symbolB:{symbol:s.symbol,shortName:I(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:we(a)}}function we(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function Me(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=je(n,r.corpus),a=Oe(s,r),l=Te(s,r),c=j(l),m=E(s.callees,l),g=[];for(let f of a){if(f.callees.size<3)continue;let o=E(f.callees,l),u=ue(s,f,l,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:o});u&&g.push(u)}return g.sort((f,o)=>o.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ue(e,n,t,i){let r=Re(e,n,t,i);if(!Ae(r,i))return null;let{similarity:s,significantShared:a,trivialShared:l}=r,c=a.length>0?a:l,m=Se(c,"callees");return{symbolA:e.symbol,shortNameA:I(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:I(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(I),uniqueToA:[...N(e.callees,n.callees)].map(I),uniqueToB:[...N(n.callees,e.callees)].map(I),...m}}function Le(e,n,t,i){let r=i.magnitudeA??E(e.callees,t),s=i.magnitudeB??E(n.callees,t),a=0,l=0,c=0,m=i.medianIdf??j(t);for(let o of e.callees){if(!n.callees.has(o))continue;let u=t.get(o)??0;a+=u*u,c+=1,u>=m&&(l+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:l>=i.requireSignificantShared||c>=i.requireSharedCount}function Re(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Ae(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Tn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:l}=n,c=n.semantic!==!1,m=A(),g=0,f=0,o=0,u=0,d=0,p=0,S=0;return y("similar.all",()=>{let b=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:l,semantic:c}),C=b.corpus;g=C.length;let v=n.focusFiles,k=[],P=0;return y("similar.all.pair-scan",()=>{for(let x=0;x<C.length;x+=1){let F=C[x],T=v?.has(F.file)??!1,w=b.weightedMagnitudes[x],M=new Set;for(let O of F.callees){let L=b.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=x||v&&!T&&!v.has(C[R].file)||M.add(R)}m&&(o+=M.size,M.size>0&&(f+=1));for(let O of M){let L=C[O];if(a&&F.file===L.file){m&&(d+=1);continue}if(me(F,L)){m&&(p+=1);continue}m&&(u+=1);let R=ue(F,L,b.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:b.medianIdf,magnitudeA:w,magnitudeB:b.weightedMagnitudes[O]});R&&(Be(k,R,i,P),m&&(S+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S,topResults:k.length})),y("similar.all.sort-project",()=>(k.sort((x,F)=>F.result.similarity-x.result.similarity||x.order-F.order),k.map(x=>x.result)),()=>({topResults:k.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:l,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,l=n.semantic!==!1,c=A(),m=0,g=0,f=0,o=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let h=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:l}),b=h.corpus;m=b.length;let C=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let v=0;v<b.length;v+=1){let k=b[v],P=C?.has(k.file)??!1,x=h.weightedMagnitudes[v],F=new Set;for(let T of k.callees){let w=h.candidateIndexesByCallee.get(T);if(w)for(let M of w)M<=v||C&&!P&&!C.has(b[M].file)||F.add(M)}c&&(f+=F.size,F.size>0&&(g+=1));for(let T of F){let w=b[T];if(s&&k.file===w.file){c&&(u+=1);continue}if(me(k,w)){c&&(d+=1);continue}c&&(o+=1),Le(k,w,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:x,magnitudeB:h.weightedMagnitudes[T]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:l,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function me(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var de=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Be(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let l=e[a],c=e[r];(l.result.similarity<c.result.similarity||l.result.similarity===c.result.similarity&&l.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["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 ze(e,n,t){let i=D(e,n);if(!i||!$(i.symbol))return null;let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return{symbol:i.symbol,file:i.relativePath,callees:pe(s.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}var De=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),qe=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function fe(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,l=De.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let o=l.get(c);if(m=o!==void 0,o||(o=$e(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),l.set(c,o)),g=o.length,r===void 0)return o;let u=o.filter(d=>d.symbol!==r);return f=o.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function Ne(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=qe.get(e,()=>new Map),l=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let o=a.get(l);return c=o!==void 0,o||(o=Pe(fe(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(l,o)),m=o.corpus.length,g=o.docFreq.size,f=o.candidateIndexesByCallee.size,o},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>fe(e,n),calleeIndex:n=>Ne(e,n),sourceCorpus:(n={})=>Fe(e,n),sourceIndex:(n={})=>ce(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,ce(e,{scanLimit:t.scanLimit}))}}function Pe(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let o=new Map;for(let u of e)for(let d of u.callees)o.set(d,(o.get(d)??0)+1);return t=o.size,o},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(o=>E(o.callees,s)),()=>({corpusSize:e.length})),l=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let o=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let S=o.get(p);S||(S=[],o.set(p,S)),S.push(u),n&&(l+=1)}}return n&&(m=o.size),o},()=>({corpusSize:e.length,buckets:m,candidateRefs:l,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Oe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function $e(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),l=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(l.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=l.calleeMap(m,{semantic:s});if(a)for(let S of p.values())g+=S.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),o=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let p=m.map(b=>({symbol:b.symbol,file:b.relativePath,callees:pe((f.get(b.symbolId)??[]).map(C=>C.symbol)),paramCount:l.callableSignature(b)?.paramCount??-1})),S=_e(p);a&&(d=S.filter((b,C)=>b.callees.size!==p[C].callees.size).length);let h=S.filter(b=>b.callees.size>=t);return o=h.length,a&&(u=h.reduce((b,C)=>b+C.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:o,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var ge=5;function _e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=ge);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function je(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=ge);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function pe(e){return new Set([...e].filter(n=>!Ge(n)))}function Ge(e){return Ee.some(n=>e.includes(n))}function ae(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",l=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let o=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});l=o.length;for(let u of o){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),S=p.size>0?d.size/p.size:0;if(S<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:I(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:I(u.symbol),fileB:u.file,similarity:S,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...Se([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:l,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function Se(e,n){let t=e.flatMap(W),i=e.flatMap(S=>oe(S,n)),r=Z(t,be),s=Z(t,ye),a=Z(i,X),l=[...new Set(i.filter(le))],c=e.filter(S=>{let h=oe(S,n);return h.some(b=>X.has(b))&&h.some(le)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&l.length>0&&m.push(`domain-specific terms: ${l.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(S=>he.has(S));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&l.length>0,o=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&l.length>=4&&c>=2,d=u?"domain-behavior":f?o?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}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 Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function oe(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function le(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!ye.has(e)&&!he.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),ye=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"]),he=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=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 Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=Ie(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function Ce(e){return`${e.scanLimit??""}`}function Fe(e,n={}){let t=We.get(e,()=>new Map),i=Ce(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function ce(e,n={}){let t=Xe.get(e,()=>new Map),i=Ce(n),r=t.get(i);return r||(r=Je(Fe(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,l=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let S of Y(e,{includeIgnored:!1})){a+=1;let h=U(e,S);h&&(l+=1,nn(h,d,s)&&p.push(S))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:l,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),o=0;return y("similar.source-shape.target-fingerprints",()=>{let d=xe(e,f);return i&&(o=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:o})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return xe(e,r)}function xe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let l=J(e,r,a),c=on(e,r,l),m=!1,g=null;for(let f of s){let o=an(f),u=c.get(o),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=Ie(ke(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(o,{key:o,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,l,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":ke(s,t,i,r)}function ke(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
|
|
2
|
+
`);let r=[new RegExp(`\\bdef\\s+${B(i)}\\b`),new RegExp(`\\bfun\\s+${B(i)}\\b`),new RegExp(`\\bfn\\s+${B(i)}\\b`),new RegExp(`\\bfunction\\s+${B(i)}\\b`),new RegExp(`\\b${B(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(l=>l.test(a)));if(s>=0){let a=s;for(let l=s+1;l<e.length&&l<=s+8;l++){let c=e[l]??"";if(l>s&&dn(c)||(a=l,c.trim()===""&&l>s+1))break}return e.slice(s,a+1).join(`
|
|
3
|
+
`)}return e.slice(n,Math.min(e.length,n+8)).join(`
|
|
4
|
+
`)}function an(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function on(e,n,t){return de.read(e,n,t)??new Map}function ln(e){try{let n=JSON.parse(e);if(!Array.isArray(n.entries))return null;let t=new Map;for(let i of n.entries){if(!i||typeof i.key!="string"||typeof i.symbol!="string"||typeof i.startLine!="number"||typeof i.endLine!="number"||typeof i.leaf!="string"||!Array.isArray(i.tokens)||!i.tokens.every(r=>typeof r=="string"))return null;t.set(i.key,i)}return t}catch{return null}}function cn(e){let n={entries:[...e.values()].sort((t,i)=>t.key.localeCompare(i.key))};return JSON.stringify(n)}function un(e,n,t,i){de.write(e,n,t,new Map(i))}function Ie(e,n){if(!e)return new Set;let t=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"]),i=mn(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(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function mn(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 dn(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}export{ve as a,Mn as b,Te as c,ue as d,Tn as e,Ln as f,Be as g,fe as h,Ne as i,G as j,Pe as k,Oe as l,ge as m,_e as n,pe as o,Se as p};
|
|
5
|
+
//# sourceMappingURL=chunk-Y2MVPNKY.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as h,o as R}from"./chunk-7O5IKBTZ.js";import{a as g}from"./chunk-T7YQSHPQ.js";import{h as d}from"./chunk-EKZTZXHZ.js";import{J as p}from"./chunk-WCCFZ7V7.js";import{a as m}from"./chunk-NGEXCJJW.js";function D(t,r,n={}){let e=g(t,r);if(!e)return[];let l=!d(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],c=h(t,e,{semantic:n.semantic,semanticEvidence:R}).map(s=>({relativePath:s.file,line:s.line})),o=b(t,e),f=new Set,a=[];for(let s of[...l,...c,...o]){let u=`${s.relativePath}:${s.line}`;f.has(u)||(f.add(u),a.push(s))}return a}function b(t,r){if(!r.relativePath.endsWith(".rb"))return[];let n=S(r.symbol);if(n.length===0)return[];let e=[];for(let i of m(t,{extensions:[".rb"],includeIgnored:!1})){let l=p(t,i);if(!l)continue;let c=l.split(`
|
|
2
2
|
`);for(let o=0;o<c.length;o++){let f=c[o]??"";n.some(a=>new RegExp(`@${a}\\b|\\b${a}:`).test(f))&&e.push({relativePath:i,line:o})}}return e}function S(t){let n=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),e=n.split("_").filter(Boolean),i=new Set;return n&&i.add(n),e.length>=1&&i.add(e[e.length-1]),e.length>=2&&i.add(e.slice(-2).join("_")),[...i]}export{D as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-YKUU5AIC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f,b as p}from"./chunk-QZ4JVECJ.js";import{a as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f,b as p}from"./chunk-QZ4JVECJ.js";import{a as g}from"./chunk-UJPRPGCO.js";import{A as m,x as d}from"./chunk-GH74ASD6.js";import{E as c,F as u,J as l}from"./chunk-WCCFZ7V7.js";import{readdirSync as k}from"fs";import{basename as S,join as y}from"path";function b(t,e,r={}){let n=new Set(t),a=new Set(e),o=[...a].filter(s=>!n.has(s)).sort(),i=r.allowExtra?[]:[...n].filter(s=>!a.has(s)).sort();return{missing:o,extra:i}}function N(t,e){let r=R(t,e.file,e.keys);if(!r.ok)return{name:e.name,file:e.file,status:"unavailable",missing:[],extra:[],unavailableReason:r.reason};let n=A(t.config.projectRoot,e.mustEqual),a=b(r.keys,n,{allowExtra:e.allowExtra??!1}),o=a.missing.length>0||a.extra.length>0?"violated":"ok";return{name:e.name,file:e.file,status:o,missing:a.missing,extra:a.extra}}function I(t,e){return e.map(r=>N(t,r))}function W(t,e){if(e.has(t.file))return!0;let r=t.mustEqual;switch(r.type){case"top-level-dirs":return[...e].some(n=>n===r.path||n.startsWith(`${r.path}/`));case"file-glob":return[...e].some(n=>f(r.pattern,n));case"registered-commands":return e.has("docs/COMMAND_REFERENCE.md");case"builtin-skills":return[...e].some(n=>n.startsWith("skills/"))}}function z(t){if(t.status==="unavailable")return`[coverage-contract] ${t.name}: DISCLOSED \u2014 could not evaluate (${t.unavailableReason})`;let e=[];return t.missing.length>0&&e.push(`missing ${t.missing.join(", ")}`),t.extra.length>0&&e.push(`extra ${t.extra.join(", ")}`),`[coverage-contract] ${t.name}: ${e.join("; ")}`}function R(t,e,r){return r.type==="markdown-list"?L(t,e,r.marker):D(t,e,r)}function D(t,e,r){if(!l(t,e))return{ok:!1,reason:`file not found: ${e}`};let a=d(e);if(!a)return{ok:!1,reason:`unsupported file type for ${r.type} extraction: ${e}`};let o=m(t,e);if(!o)return{ok:!1,reason:`tree-sitter parser unavailable for ${a} (${e}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:a,reason:"parser-unavailable"}};let i=r.type==="object-literal-keys"?$(o,r.identifier):T(o,r.identifier);return i===null?{ok:!1,reason:`no ${r.type==="object-literal-keys"?"object literal":"string array"} named "${r.identifier}" found in ${e}`}:{ok:!0,keys:i}}function v(t){let e=t.childForFieldName("value");return e?e.type==="as_expression"||e.type==="satisfies_expression"?e.namedChild(0):e:null}function $(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let a=v(r);if(a?.type==="object")return w(a)}return null}function w(t){let e=new Set;for(let r of t.namedChildren)if(r.type==="pair"){let n=r.childForFieldName("key");n&&e.add(x(n.text))}else r.type==="shorthand_property_identifier"&&e.add(r.text);return[...e].sort()}function T(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let a=v(r);if(a?.type!=="array")continue;let o=new Set;for(let i of a.namedChildren)i.type==="string"&&o.add(x(i.text));return[...o].sort()}return null}function x(t){return t.length>=2&&(t[0]==="'"&&t.endsWith("'")||t[0]==='"'&&t.endsWith('"'))?t.slice(1,-1):t}function L(t,e,r){let n=l(t,e);if(!n)return{ok:!1,reason:`file not found: ${e}`};let a=E(n,r);return a===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${r} --> ... <!-- END GENERATED ${r} --> block in ${e}`}:{ok:!0,keys:h(a)}}function E(t,e){let r=g(e),a=new RegExp(`<!--\\s*BEGIN GENERATED ${r}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${r}\\s*-->`).exec(t);return a?a[1]:null}function h(t){let e=new Set;for(let r of t.matchAll(/`([a-z][a-z0-9-]*)`/g))e.add(r[1]);for(let r of t.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))e.add(r[1]);return[...e].sort()}function A(t,e){switch(e.type){case"top-level-dirs":return C(y(t,e.path));case"file-glob":return[...new Set(p(t,e.pattern).map(r=>S(r)))].sort();case"registered-commands":return j(t);case"builtin-skills":return C(y(t,"skills"))}}function C(t){let e;try{e=k(t,{withFileTypes:!0})}catch{return[]}return e.filter(r=>r.isDirectory()&&!r.name.startsWith(".")).map(r=>r.name).sort()}function j(t){let e;try{e=c(t,"docs/COMMAND_REFERENCE.md",{maxBytes:8*1024*1024,inputKind:"generated command reference"})}catch(n){if(!u(n))throw n;return[]}let r=E(e,"COMMAND REFERENCE");return r?h(r):[]}var q={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0},isolated:{minLoc:3},similar:{minSimilarity:.6,limit:50,minCallees:4},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50},wrappers:{maxLoc:15,limit:50},passthroughs:{maxLoc:15,limit:50},stale:{minLoc:3,limit:50},drift:{},twinDrift:{minSimilarity:.3}};export{N as a,I as b,W as c,z as d,q as e};
|
|
2
|
+
//# sourceMappingURL=chunk-YLCJLTPL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as M,b as I}from"./chunk-QZ4JVECJ.js";import{a as v}from"./chunk-35NLDRZC.js";import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as M,b as I}from"./chunk-QZ4JVECJ.js";import{a as v}from"./chunk-35NLDRZC.js";import{c as P}from"./chunk-26QA6FAI.js";import{a as D}from"./chunk-C43RDDP4.js";import{s as j}from"./chunk-EKZTZXHZ.js";import{p as x}from"./chunk-UJPRPGCO.js";import{a as U}from"./chunk-NGEXCJJW.js";var O=/\.(test|spec)\.(ts|tsx|js|jsx|mts|cts)$/,V=new Map;function q(e,o,t,r){if(!o?.testPaths?.length)return[];let c=T(o),s=[];for(let i of k(e,o.testPaths)){let a=L(e,i,r),l=a?t(a):null;if(l)for(let g of x(e,i)){let b=g.sourcePath;if(!b)continue;let d=t(b);d&&d!==l&&(c.get(l)?.has(d)||s.push({testFile:i,ownerBoundary:l,importedFile:b,importedBoundary:d,reason:"outside-owner-policy"}))}}return z(s)}function T(e){let o=e.allowedDependencies??{},t=e.boundaries.map(i=>i.name),r=new Map,c=(i,a)=>{for(let l of o[i]??[])a.has(l)||(a.add(l),c(l,a))};for(let i of t){let a=new Set;c(i,a),r.set(i,a)}let s=new Map;for(let i of t){let a=new Set(r.get(i));for(let l of t)l!==i&&r.get(l)?.has(i)&&a.add(l);s.set(i,a)}return s}function k(e,o){let t=`${e.config.projectRoot}\0${o.join("\0")}`,r=V.get(t);if(r)return r;let c=new Set;for(let i of o)for(let a of I(e.config.projectRoot,i))O.test(a)&&c.add(a);let s=[...c].sort();return V.set(t,s),s}function L(e,o,t){let r=o.replace(/^tests\//,"src/").replace(/\.(test|spec)\.(\w+)$/,".$2");if(r!==o&&t(r))return r;let c=o.split("/").pop().replace(/\.(test|spec)\.(\w+)$/,".$2"),s=x(e,o).map(i=>i.sourcePath).filter(i=>!!i&&t(i)&&i.split("/").pop()===c);return s.length===1?s[0]:null}function z(e){let o=new Map;for(let t of e){let r=`${t.testFile}\0${t.importedBoundary}`;o.has(r)||o.set(r,t)}return[...o.values()].sort((t,r)=>t.testFile.localeCompare(r.testFile)||t.importedBoundary.localeCompare(r.importedBoundary))}var C="architecture:";function H(e,o,t,r={}){let c=K(e,o);if(!t||t.boundaries.length===0)return{configured:!1,boundaries:[],edges:[],forbiddenEdges:[],reciprocalPairs:[],cycles:[],coarseBoundaries:[],staleAllowances:[],boundaryLimits:[],fragileEdges:[],testBoundaryViolations:[],coverage:{totalFiles:c.length,mappedFiles:0,unmappedFiles:[],ambiguousFiles:[]},policyCoverage:{declaredRows:0,totalBoundaries:0,missingRows:[],requiresCompletePolicy:!1,requiresMinimalPolicy:!1}};let s=new Map,i=new Map(t.boundaries.map(n=>[n.name,new Set])),a=[],l=[];for(let n of c){let m=t.boundaries.filter(p=>p.paths.some(F=>M(F,n))).map(p=>p.name).sort();if(m.length===0)a.push(n);else if(m.length>1)l.push({file:n,boundaries:m});else{let p=m[0];s.set(n,p),i.get(p).add(n)}}let g=new Map;for(let[n,m]of e){let p=s.get(n);if(p)for(let F of m){let R=s.get(F);if(!R||p===R)continue;let $=B(p,R),w=g.get($);w||(w={from:p,to:R,fileEdges:[],importers:new Set,importedFiles:new Set},g.set($,w)),w.fileEdges.push({fromFile:n,toFile:F}),w.importers.add(n),w.importedFiles.add(F)}}let b=[...g.values()].map(n=>N(n,t)).sort(te),d=b,E=new Map(d.map(n=>[B(n.from,n.to),n])),S=new Map(t.boundaries.map(n=>[n.name,new Set]));for(let n of d)S.get(n.from).add(n.to);let f=[];for(let n of d){if(n.from>=n.to)continue;let m=E.get(B(n.to,n.from));m&&f.push({boundaries:[n.from,n.to],forward:n,reverse:m})}let{components:A}=v(S),y=A.filter(n=>n.length>1).map(n=>J(n,d,t.requireAcyclic===!0)).sort((n,m)=>m.boundaries.length-n.boundaries.length||n.boundaries.join("/").localeCompare(m.boundaries.join("/"))),h=t.allowedDependencies??{},u=t.boundaries.map(n=>n.name).filter(n=>!Object.hasOwn(h,n)).sort();return{configured:!0,boundaries:t.boundaries.map(n=>({name:n.name,paths:[...n.paths],fileCount:i.get(n.name).size,dependencyPolicyDeclared:Object.hasOwn(h,n.name)})).sort((n,m)=>n.name.localeCompare(m.name)),edges:b,forbiddenEdges:d.filter(n=>n.policyStatus==="forbidden"),reciprocalPairs:f,cycles:y,staleAllowances:W(t,d),boundaryLimits:Y(t,d,i),fragileEdges:d.filter(n=>n.fragile),testBoundaryViolations:r.testBoundaryViolations??[],coarseBoundaries:Q(e,i,r.isModuleHierarchyFile,t.requireResolvedBoundaries===!0,n=>t.boundaries.find(m=>m.name===n)?.subUnits??"directory"),coverage:{totalFiles:c.length,mappedFiles:s.size,unmappedFiles:a,ambiguousFiles:l},policyCoverage:{declaredRows:t.boundaries.length-u.length,totalBoundaries:t.boundaries.length,missingRows:u,requiresCompletePolicy:t.requireCompletePolicy===!0,requiresMinimalPolicy:t.requireMinimalPolicy===!0}}}function fe(e,o={}){let t=D(e,o.scope,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}),r=U(e,{includeIgnored:!1}).filter(s=>!o.scope||s.includes(o.scope)),c=new Set(r);return H(t,r,e.config.architecture,{isModuleHierarchyFile:s=>_(e,s),testBoundaryViolations:q(e,e.config.architecture,s=>G(e.config.architecture,s),s=>c.has(s))})}function G(e,o){let t=(e?.boundaries??[]).filter(r=>r.paths.some(c=>M(c,o)));return t.length===1?t[0].name:null}function _(e,o){let t=P(o);return t==="test"||t==="entry"?!0:t!=="barrel"?!1:j(e,o).length===0}function me(e){let o=e.forbiddenEdges.map(r=>`${C}forbidden-edge:${encodeURIComponent(r.from)}:${encodeURIComponent(r.to)}`);if(e.policyCoverage.requiresCompletePolicy)for(let r of e.policyCoverage.missingRows)o.push(`${C}missing-policy-row:${encodeURIComponent(r)}`);if(e.policyCoverage.requiresMinimalPolicy)for(let r of e.staleAllowances)o.push(`${C}stale-allowance:${encodeURIComponent(r.from)}:${encodeURIComponent(r.to)}`);for(let r of e.testBoundaryViolations)o.push(`${C}test-boundary:${encodeURIComponent(r.testFile)}:${encodeURIComponent(r.importedBoundary)}`);for(let r of e.boundaryLimits)o.push(`${C}boundary-limit:${r.kind}:${encodeURIComponent(r.boundary)}`);let t=new Map;for(let r of e.coarseBoundaries)r.violatesPolicy&&t.set(r.boundary,(t.get(r.boundary)??0)+1);for(let[r,c]of t){let s=`${C}coarse-boundary:${encodeURIComponent(r)}`;o.push(s);for(let i=2;i<=c;i+=1)o.push(`${s}:component:${i}`)}for(let r of e.cycles)r.violatesPolicy&&o.push(`${C}cycle:${r.boundaries.map(c=>encodeURIComponent(c)).sort().join("|")}`);return[...new Set(o)].sort()}function pe(e){return!!e&&(Object.keys(e.allowedDependencies??{}).length>0||e.requireCompletePolicy===!0||e.requireAcyclic===!0||e.requireResolvedBoundaries===!0||e.requireMinimalPolicy===!0||e.maxBoundaryFanOut!==void 0||e.maxBoundaryFiles!==void 0||e.boundaries.some(o=>o.maxFiles!==void 0)||(e.testPaths?.length??0)>0)}function K(e,o){let t=new Set(o);for(let[r,c]of e){t.add(r);for(let s of c)t.add(s)}return[...t].sort()}function N(e,o){let t=[...e.fileEdges].sort((r,c)=>r.fromFile.localeCompare(c.fromFile)||r.toFile.localeCompare(c.toFile));return{from:e.from,to:e.to,policyStatus:X(o,e.from,e.to),fileEdgeCount:t.length,importerCount:e.importers.size,importedFileCount:e.importedFiles.size,examples:t.slice(0,5),fragile:t.length===1}}function X(e,o,t){return!e.allowedDependencies||!Object.hasOwn(e.allowedDependencies,o)?"undeclared":e.allowedDependencies[o].includes(t)?"allowed":"forbidden"}function J(e,o,t){let r=[...e].sort(),c=new Set(r),s=o.filter(a=>c.has(a.from)&&c.has(a.to)),i=Math.min(...s.map(a=>a.fileEdgeCount));return{boundaries:r,internalEdges:s,narrowestEdges:s.filter(a=>a.fileEdgeCount===i),violatesPolicy:t}}function Q(e,o,t=Z,r=!1,c=()=>"directory"){let s=[];for(let[i,a]of o){let l=c(i)==="file"?f=>f:ee,g=[...a].filter(f=>!t(f));if(g.length<2)continue;let b=new Set(g),d=new Map,E=new Map;for(let f of g)E.set(l(f),new Set);for(let f of g)for(let A of e.get(f)??[]){if(!b.has(A))continue;let y=l(f),h=l(A);if(y===h)continue;let u=B(y,h),n=d.get(u);n||(n={from:y,to:h,fileEdges:[]},d.set(u,n)),n.fileEdges.push({fromFile:f,toFile:A}),E.get(y).add(h)}let{components:S}=v(E);for(let f of S){if(f.length<2)continue;let A=new Set(f),y=[...d.values()].filter(u=>A.has(u.from)&&A.has(u.to)).map(u=>({from:u.from,to:u.to,fileEdgeCount:u.fileEdges.length,examples:u.fileEdges.slice(0,5)})).sort((u,n)=>u.from.localeCompare(n.from)||u.to.localeCompare(n.to)),h=Math.min(...y.map(u=>u.fileEdgeCount));s.push({boundary:i,violatesPolicy:r,subUnits:[...f].sort(),internalEdges:y,narrowestEdges:y.filter(u=>u.fileEdgeCount===h)})}}return s.sort((i,a)=>a.subUnits.length-i.subUnits.length||i.boundary.localeCompare(a.boundary))}function W(e,o){let t=new Set(o.map(i=>B(i.from,i.to))),r=e.allowedDependencies??{},c=new Set(e.boundaries.map(i=>i.name)),s=[];for(let[i,a]of Object.entries(r))if(c.has(i))for(let l of a)!c.has(l)||t.has(B(i,l))||s.push({from:i,to:l});return s.sort((i,a)=>i.from.localeCompare(a.from)||i.to.localeCompare(a.to))}function Y(e,o,t){let r=[],c=new Map;for(let s of o)c.set(s.from,(c.get(s.from)??0)+1);for(let s of e.boundaries){if(e.maxBoundaryFanOut!==void 0){let a=c.get(s.name)??0;a>e.maxBoundaryFanOut&&r.push({boundary:s.name,kind:"fan-out",observed:a,limit:e.maxBoundaryFanOut})}let i=s.maxFiles??e.maxBoundaryFiles;if(i!==void 0){let a=t.get(s.name)?.size??0;a>i&&r.push({boundary:s.name,kind:"files",observed:a,limit:i})}}return r.sort((s,i)=>s.boundary.localeCompare(i.boundary)||s.kind.localeCompare(i.kind))}function Z(e){let o=P(e);return o==="test"||o==="entry"}function ee(e){let o=e.lastIndexOf("/");return o===-1?".":e.slice(0,o)}function B(e,o){return`${e}\0${o}`}function te(e,o){return e.from.localeCompare(o.from)||e.to.localeCompare(o.to)}export{C as a,H as b,fe as c,me as d,pe as e,Q as f};
|
|
2
|
+
//# sourceMappingURL=chunk-YTQVETEO.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{b as B,c as G,d as W,e as J,m as K}from"./chunk-7O5IKBTZ.js";import{d as Q,e as U}from"./chunk-MTDBHTSF.js";import{e as P,g as x,s as F,t as j,y as H,z as $}from"./chunk-EKZTZXHZ.js";import{k as A,p as T}from"./chunk-UJPRPGCO.js";import{x as v}from"./chunk-GH74ASD6.js";import{d as L}from"./chunk-7S5E7KWT.js";import{d as O}from"./chunk-C3KV2II6.js";function Re(o,t,e={}){let i=V(o,[t],{additive:e.additive,semantic:e.semantic,semanticEvidence:e.semanticEvidence}),l=e.callableOnly?(i.get(t.symbolId)??[]).filter(s=>x(s.symbol)||s.source==="ast-callsite"):i.get(t.symbolId)??[];return typeof e.limit=="number"?l.slice(0,e.limit):l}function Ie(o,t,e){return X(o,[t],e).get(t.symbolId)??[]}function X(o,t,e){let i=oe(o)?le(o,t,{semantic:e.semantic!==!1,semanticEvidence:e.semanticEvidence}):ie(o,e.semanticEvidence);return typeof e.limit!="number"?new Map(t.map(l=>[l.symbolId,i.get(l.symbolId)??[]])):new Map(t.map(l=>[l.symbolId,(i.get(l.symbolId)??[]).slice(0,e.limit)]))}var ee=L("caller-rows",{clearGroups:["whole-project"]}),ne=L("targeted-caller-strategy",{clearGroups:["whole-project"]}),te=2e4;function oe(o){return ne.get(o,()=>(o.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>te)}function ie(o,t){return ee.get(o,()=>{let e=j(o),i=V(o,e,{semanticEvidence:t}),l=new Map;for(let m of e)l.set(m.symbol,m.symbolId);let s=new Map,c=new Map;for(let m of e){let a=i.get(m.symbolId);if(!(!a||a.length===0))for(let u of a){let r=l.get(u.symbol);if(r===void 0||r===m.symbolId)continue;let d=s.get(r);d||(d=[],s.set(r,d),c.set(r,new Set));let p=`${m.symbol}|${m.relativePath}`;c.get(r).has(p)||(c.get(r).add(p),d.push({symbol:m.symbol,file:m.relativePath,source:"caller-map-inversion"}))}}return s})}function le(o,t,e){let i=e.semantic&&e.semanticEvidence?t.flatMap(a=>{let u=se(o,a);return u?[u]:[]}):[],l=new Map(i.map(a=>[a.symbolId,a])),s=e.semanticEvidence?.referenceMap(o,i)??new Map,c=K(o,t),m=new Map;for(let a of t){let u=[],r=new Set,d=n=>{if(n.symbol===a.symbol)return;let b=`${n.symbol}|${n.file}`;r.has(b)||(r.add(b),u.push(n))};for(let n of c.get(a.symbolId)??[])n.file!==a.relativePath&&d({symbol:n.enclosingSymbol??n.file,file:n.file,source:"resolved-reference"});let p=l.get(a.symbolId);if(p)for(let n of s.get(p.symbolId)??[]){if(n.file===a.relativePath||o.isIgnored(n.file))continue;let b=$(F(o,n.file),n.line);d({symbol:b?.symbol??n.file,file:n.file,source:"semantic-reference"})}m.set(a.symbolId,u)}return m}function se(o,t){let e=Q().join(", "),i=U().join(", ");return o.get(`SELECT
|
|
2
|
+
d.id AS documentId,
|
|
3
|
+
gs.id AS symbolId,
|
|
4
|
+
gs.symbol,
|
|
5
|
+
d.relative_path AS relativePath,
|
|
6
|
+
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
+
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
+
NULL AS parentTypeName,
|
|
10
|
+
CASE WHEN gs.kind IN (${e}) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
+
CASE WHEN gs.kind IN (${i}) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
+
gs.kind AS kind,
|
|
13
|
+
gs.documentation AS documentation,
|
|
14
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
+
FROM global_symbols gs
|
|
16
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
+
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
+
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
19
|
+
WHERE gs.id = ?
|
|
20
|
+
LIMIT 1`,t.symbolId)??null}function V(o,t,e={}){if(t.length===0)return new Map;let i=e.additive??!1,l=[],s=[];for(let r of t)v(r.relativePath)&&A(o,r.relativePath)!==null?l.push(r):s.push(r);let c=new Map,m=new Map,a=r=>{for(let[d,p]of r){let n=c.get(d);n||(n=[],c.set(d,n));let b=m.get(d);b||(b=new Set,m.set(d,b));for(let _ of p){let h=`${_.symbol}|${_.chunkId}`;b.has(h)||(b.add(h),n.push(_))}}};l.length>0&&a(ae(o,l)),e.semantic!==!1&&e.semanticEvidence&&a(fe(e.semanticEvidence.calleeMap(o,t)));let u=i?t:s;return u.length>0&&a(de(o,u)),c}function ae(o,t){let e=new Map,i=ce(t,e),l=J(o);for(let[s,c]of i){let m=A(o,s);if(!m)continue;let a=H(c);for(let u of m){let r=a.get(u.line);if(!r)continue;let d=re(o,s,l,u);d&&d.symbol!==r.symbol&&e.get(r.symbolId).push({symbol:d.symbol,file:d.file,chunkId:u.line,source:"ast-callsite"})}}return e}function ce(o,t){let e=new Map;for(let i of o){let l=e.get(i.relativePath);l?l.push(i):e.set(i.relativePath,[i]),t.set(i.symbolId,[])}for(let i of e.values())i.sort((l,s)=>l.endLine-l.startLine-(s.endLine-s.startLine));return e}function re(o,t,e,i){let l=G(t,e.get(i.calleeLeaf)??[]);if(l.length===0)return null;let s=me(o,t,l,i.calleeQualifier);return s||W(o,t,l,i.memberAccess)}function me(o,t,e,i){if(!i||v(t)!=="clojure")return null;let s=T(o,t).filter(c=>c.kind==="namespace"&&c.localName===i&&c.sourcePath).map(c=>c.sourcePath);for(let c of s){let m=e.find(a=>O(c,a.file));if(m)return m}return e.find(c=>/`([^`]+)`\//.exec(c.symbol)?.[1]===i)??null}function de(o,t){if(t.length===0)return new Map;let i=k(t.map(n=>n.documentId)).flatMap(n=>o.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
21
|
+
FROM mentions m
|
|
22
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
23
|
+
WHERE m.role != 1
|
|
24
|
+
AND c.document_id IN (${n.map(()=>"?").join(",")})`,...n)),l=new Map;for(let n of i)l.has(n.document_id)||l.set(n.document_id,[]),l.get(n.document_id).push(n);let c=k(i.map(n=>n.symbol_id)).flatMap(n=>o.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
25
|
+
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
26
|
+
FROM global_symbols gs
|
|
27
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
28
|
+
LEFT JOIN (
|
|
29
|
+
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
30
|
+
FROM mentions m
|
|
31
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
32
|
+
WHERE m.role = 1
|
|
33
|
+
AND m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
34
|
+
GROUP BY m.symbol_id
|
|
35
|
+
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
|
+
WHERE gs.id IN (${n.map(()=>"?").join(",")})`,...n,...n)),m=k([...t.map(n=>n.documentId),...c.flatMap(n=>n.document_id===null?[]:[n.document_id])]),a=new Map(m.flatMap(n=>o.all(`SELECT id, relative_path FROM documents
|
|
37
|
+
WHERE id IN (${n.map(()=>"?").join(",")})`,...n).map(b=>[b.id,b.relative_path]))),u=new Map;for(let n of c)u.has(n.symbol_id)||u.set(n.symbol_id,{symbol:n.symbol,file:n.document_id!==null?a.get(n.document_id)??"":""});let r=new Map,d=a,p=ue(t);for(let[n,b]of p){let h=[...l.get(n)??[]].sort((f,g)=>f.start_line-g.start_line||f.end_line-g.end_line),Z=[...b].sort((f,g)=>f.startLine-g.startLine||f.endLine-g.endLine),C=new Set,M=0;for(let f of Z){for(;M<h.length&&h[M].start_line<=f.endLine;)C.add(h[M]),M+=1;for(let y of C)y.end_line<f.startLine&&C.delete(y);let g=new Set,D=[],I=null,q=()=>{if(I)return I;let y=d.get(f.documentId)??"",S=new Set;if(y){let w=B(o,y),R=Math.max(0,f.startLine),N=Math.min(w.length-1,f.endLine);for(let E=R;E<=N;E+=1)for(let z of w[E])S.add(z)}return I=S,S};for(let y of C){if(y.symbol_id===f.symbolId)continue;let S=u.get(y.symbol_id);if(!S)continue;if(!(y.start_line>=f.startLine&&y.end_line<=f.endLine)){if(!(y.start_line<=f.endLine&&y.end_line>=f.startLine))continue;let E=P(S.symbol);if(!E||!q().has(E))continue}let R=`${S.symbol}|${y.chunk_id}`;g.has(R)||(g.add(R),D.push({...S,chunkId:y.chunk_id,source:"scip-chunk"}))}r.set(f.symbolId,D)}}return r}var Y=500;function k(o){let t=[...new Set(o)],e=[];for(let i=0;i<t.length;i+=Y)e.push(t.slice(i,i+Y));return e}function ue(o){let t=new Map;for(let e of o){let i=t.get(e.documentId);i?i.push(e):t.set(e.documentId,[e])}return t}function fe(o){let t=new Map;for(let[e,i]of o){let l=[];for(let s of i)l.push({symbol:s.symbol,file:s.file,chunkId:-1,source:"semantic-callee"});t.set(e,l)}return t}export{Re as a,Ie as b,X as c,V as d};
|
|
38
|
+
//# sourceMappingURL=chunk-Z4N3MZYA.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{a as G}from"./chunk-QOKYJ33H.js";import{a as O,c as z}from"./chunk-UJCOIXDY.js";import{l as $}from"./chunk-HX7M4BDI.js";import{v as C}from"./chunk-BS2NMXQZ.js";import{d as k,g as R,i as j}from"./chunk-EKZTZXHZ.js";import{A}from"./chunk-GH74ASD6.js";import{E as _}from"./chunk-WCCFZ7V7.js";import{f as N}from"./chunk-C3KV2II6.js";import{execFileSync as g}from"child_process";import{existsSync as ne}from"fs";import{basename as W}from"path";var ie="Unable to compute git diff.",se={semanticConsumers:$,sourceFallbackConsumers:O},I={resolveCommit:C,readBatch({projectRoot:e,resolvedBase:i,relativePaths:t}){let n=t.map(a=>`${i}:./${a}
|
|
2
|
+
`).join("");return g("git",["cat-file","--batch"],{cwd:e,input:n,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]})}};function Ze(e,i={}){let t=i.plan??ae(e,i);return t.note?ce(t.note,t.changedFileLines):t.changedFiles.length===0?le(t.changedFileLines):oe(t.changedFiles,[re(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function ae(e,i={}){let{base:t="HEAD"}=i;try{let n=C(e.config.projectRoot,t),a=de(e.config.projectRoot,n),s=a.changedFileLines,r=be(e,s),o=ye(e,a.changedRanges);return{changedFileLines:s,changedFiles:r,changedRanges:o,renamedFiles:ge(e.config.projectRoot,n,r,a),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:ie}}}function re(e,i,t,n=[],a={}){let s=a.evidenceRuntime??se,r=new z(e),o=new Set(t),l=G(n),u=[],d=new Map,c=i.flatMap(f=>r.definitionsForFile(f)).filter(Ne),m=c.filter(f=>Ce(f,l)),p=ve(e,c,m,l),b=Ie([...m,...p.definitions]).sort((f,h)=>f.relativePath.localeCompare(h.relativePath)||f.startLine-h.startLine),B=b.map(f=>f.symbolId),w=Pe(e,B),ee=Ee(e,B,t),y=b.filter(f=>(w.get(f.symbolId)??0)===0),M=H("semantic-consumers",y.length,()=>s.semanticConsumers(e,y)),P=M.values,E=y.filter(f=>(P.get(f.symbolId)?.size??0)===0),T=H("source-fallback-consumers",E.length,()=>s.sourceFallbackConsumers(e,E)),te=T.values;for(let f of b)Be(e,f,o,u,d,P.get(f.symbolId)??new Set,te.get(f.symbolId)??new Set,w.get(f.symbolId)??0,ee.get(f.symbolId)??new Set);return{changedSymbols:u,consumerEntries:[...d.entries()].map(([f,h])=>({file:f,symbols:[...h].sort()})),attributionNotes:p.notes,evidenceTiers:[M.status,T.status]}}function oe(e,i){let t=new Map,n=i.flatMap(o=>o.changedSymbols),a=i.flatMap(o=>o.attributionNotes??[]),s=we(i);for(let o of i)for(let l of o.consumerEntries){let u=t.get(l.file);u||(u=new Set,t.set(l.file,u));for(let d of l.symbols)u.add(d)}let r=Te(t);return{changedFiles:[...e],changedSymbols:n,affectedConsumers:r,attributionNotes:a,evidenceTiers:s,summary:{totalChangedFiles:e.length,totalChangedSymbols:n.length,totalAffectedFiles:r.length}}}function ce(e,i=[]){return{changedFiles:i,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:X(),summary:{totalChangedFiles:i.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function le(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:X(),summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function de(e,i){let t=g("git",["diff","--name-status","--find-renames",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),n=g("git",["diff","--name-status","--find-renames","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),a=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),s=g("git",["diff","--unified=0",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["diff","--unified=0","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),o=pe([t,n]);return{changedFileLines:[...new Set([...o.changedFiles,...V(a)])],changedRanges:K([...q(s),...q(r)]),renamedFiles:o.renamedFiles,deletedFiles:o.deletedFiles}}function ue(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePath:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||typeof n.relativePath!="string")throw new TypeError("fileContentAtBase requires projectRoot, base, and relativePath.");let a={projectRoot:n.projectRoot,base:n.base,relativePath:n.relativePath},{relativePath:s}=a,r=J(a);if(r.state==="unavailable")throw new Error(`Base content unavailable for ${s}: ${r.reason}`);return r.state==="present"?r.content:null}function J(e,i=I){return Z(e.relativePath),F({projectRoot:e.projectRoot,base:e.base,relativePaths:[e.relativePath]},i).get(e.relativePath)??{state:"unavailable",reason:`Base-content lookup omitted ${e.relativePath}.`}}function F(e,i=I){for(let r of e.relativePaths)Z(r);let t=[...new Set(e.relativePaths)];if(t.length===0)return new Map;let n;try{n=i.resolveCommit(e.projectRoot,e.base)}catch(r){return S(t,v(r))}let a;try{a=i.readBatch({projectRoot:e.projectRoot,resolvedBase:n,relativePaths:t})}catch(r){return S(t,v(r))}let s;try{s=me(a,t)}catch(r){return S(t,`Malformed git cat-file batch output: ${v(r)}`)}return new Map(t.map(r=>{let o=s.get(r)??null;return[r,o===null?{state:"absent"}:{state:"present",content:o}]}))}function fe(e,i=I){let t=F({projectRoot:e.projectRoot,base:e.base,relativePaths:e.preloadPaths??[]},i);return n=>(t.has(n)||t.set(n,J({projectRoot:e.projectRoot,base:e.base,relativePath:n},i)),t.get(n)??{state:"unavailable",reason:`Base-content reader omitted ${n}.`})}function Ve(e,i,t=[]){let n=typeof e=="string"?{projectRoot:e,base:i,preloadPaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string")throw new TypeError("createBaseContentReader requires projectRoot and base.");let a={projectRoot:n.projectRoot,base:n.base,preloadPaths:n.preloadPaths},s=fe(a);return r=>{let o=s(r);if(o.state==="unavailable")throw new Error(`Base content unavailable for ${r}: ${o.reason}`);return o.state==="present"?o.content:null}}function Ye(e,i=e.changedFiles){let t=new Map(e.renamedFiles.map(n=>[n.to,n.from]));return[...new Set(i.map(n=>t.get(n)??n))]}function Ke(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||!Array.isArray(n.relativePaths))throw new TypeError("fileContentsAtBase requires projectRoot, base, and relativePaths.");let a=F(n),s=new Map;for(let[r,o]of a){if(o.state==="unavailable")throw new Error(`Base content unavailable for ${r}: ${o.reason}`);s.set(r,o.state==="present"?o.content:null)}return s}function Z(e){N(e)}function S(e,i){return new Map(e.map(t=>[t,{state:"unavailable",reason:i}]))}function v(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"Git base-content lookup failed without a reason.":t}function me(e,i){let t=new Map,n=0;for(let a of i){let s=e.indexOf(10,n);if(s<0)throw new Error("git cat-file batch output ended before object header");let r=e.subarray(n,s).toString("utf-8");if(n=s+1,r.endsWith(" missing")){t.set(a,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(r);if(!o)throw new Error(`unexpected git cat-file batch header: ${r}`);let[,l,u]=o,d=Number(u);if(!Number.isFinite(d)||d<0)throw new Error(`unexpected git cat-file batch size: ${r}`);if(n+d>e.length)throw new Error("git cat-file batch output ended before blob payload");let c=e.subarray(n,n+d);t.set(a,l==="blob"?c.toString("utf-8"):null),n+=d,e[n]===10&&(n+=1)}return t}function ge(e,i,t,n){if(t.length===0)return[];let a=new Map,s=new Set;for(let o of n.renamedFiles)t.includes(o.to)&&(a.set(o.to,o),s.add(o.from));let r=n.deletedFiles;if(r.length===0)return[...a.values()].sort((o,l)=>o.to.localeCompare(l.to));for(let o of t){if(a.has(o)||!ne(`${e}/${o}`))continue;let l=r.filter(c=>!s.has(c)).filter(c=>W(c)===W(o));if(l.length===0)continue;let u=_(e,o),d=l.map(c=>({from:c,to:o,similarity:he(ue({projectRoot:e,base:i,relativePath:c})??"",u)})).sort((c,m)=>m.similarity-c.similarity)[0];d&&d.similarity>=.45&&(a.set(o,d),s.add(d.from))}return[...a.values()].sort((o,l)=>o.to.localeCompare(l.to))}function pe(e){let i=new Set,t=new Map,n=new Set;for(let a of e.flatMap(s=>V(s))){let[s,r,o]=a.split(" ");if(!(!s||!r)){if(s.startsWith("R")&&o){i.add(o),t.set(o,{from:r,to:o,similarity:Number(s.slice(1))/100});continue}i.add(r),s.startsWith("D")&&n.add(r)}}return{changedFiles:[...i],renamedFiles:[...t.values()],deletedFiles:[...n]}}function he(e,i){let t=new Set(U(e)),n=new Set(U(i));if(t.size===0&&n.size===0)return 1;if(t.size===0||n.size===0)return 0;let a=0;for(let s of t)n.has(s)&&(a+=1);return 2*a/(t.size+n.size)}function U(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function V(e){return e.split(`
|
|
3
|
+
`).map(i=>i.trim()).filter(i=>i.length>0)}function be(e,i){let t=Y(e),n=[];for(let a of i){let s=t(a);s&&!e.isIgnored(s)&&n.push(s)}return n}function ye(e,i){let t=Y(e),n=[];for(let a of i){let s=t(a.file);s&&!e.isIgnored(s)&&n.push({...a,file:s})}return K(n)}function Y(e){let i=e.all(`SELECT relative_path FROM documents
|
|
4
|
+
ORDER BY id`).map(n=>n.relative_path),t=new Map(i.map(n=>[n,n]));return n=>{let a=n.replace(/\\/g,"/"),s=t.get(a);return s||(i.find(r=>r.endsWith(a))??null)}}function q(e){let i=[],t=null;for(let n of e.split(`
|
|
5
|
+
`)){if(n.startsWith("+++ ")){t=Re(n.slice(4).trim());continue}if(!t||!n.startsWith("@@ "))continue;let a=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(n);if(!a)continue;let s=Math.max(0,Number(a[1])-1),r=a[2]===void 0?1:Number(a[2]);i.push({file:t,startLine:s,endLine:Math.max(s,s+Math.max(r,1)-1)})}return i}function Re(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function K(e){let i=new Set,t=[];for(let n of e){let a=`${n.file}:${n.startLine}:${n.endLine}`;i.has(a)||(i.add(a),t.push(n))}return t}function Ce(e,i){let t=i.get(e.relativePath);return!t||t.length===0?!0:t.some(n=>x(e.startLine,e.endLine,n.startLine,n.endLine))}function Se(e,i,t){let n=new Map,a=[],s=Q(e),r=Fe(t);for(let o of i){let l=s.get(o.file)??[];if(l.some(c=>x(c.startLine,c.endLine,o.startLine,o.endLine)))continue;let u=r.get(o.file)??[],d=xe(u,o);if(d){let c=l.find(m=>m.startLine>=d.startLine&&m.startLine<=d.endLine);if(c){n.set(c.symbolId,c),a.push(D(o,"ast-widened"));continue}}if(u.length===0){let c=[...l].filter(m=>m.startLine<=o.startLine).sort((m,p)=>p.startLine-m.startLine||m.endLine-p.endLine)[0];if(c){n.set(c.symbolId,c),a.push(D(o,"nearest-preceding"));continue}}a.push(D(o,"unattributed"))}return{definitions:[...n.values()],notes:a}}function ve(e,i,t,n){let a=Q(t),s=[],r=[],o=[...new Set(i.map(l=>l.relativePath))];for(let l of o){let u=n.get(l)??[];if(u.length===0)continue;let d=a.get(l)??[];for(let c of u)d.some(m=>x(m.startLine,m.endLine,c.startLine,c.endLine))||s.push(c);s.some(c=>c.file===l)&&r.push(...De(e,l))}return Se(i,s,r)}function De(e,i){let t=A(e,i);return t?t.rootNode.namedChildren.filter(Le).map(n=>({file:i,startLine:n.startPosition.row,endLine:n.endPosition.row})).filter(n=>n.endLine>=n.startLine):[]}function Le(e){return e.endPosition.row<e.startPosition.row?!1:!new Set(["import_statement","comment"]).has(e.type)}function Ie(e){let i=new Map;for(let t of e)i.set(t.symbolId,t);return[...i.values()]}function Q(e){let i=new Map;for(let t of e){let n=i.get(t.relativePath)??[];n.push(t),i.set(t.relativePath,n)}return i}function Fe(e){let i=new Map;for(let t of e){let n=i.get(t.file)??[];n.push(t),i.set(t.file,n)}return i}function xe(e,i){return e.filter(t=>t.startLine<=i.startLine&&t.endLine>=i.endLine).sort((t,n)=>t.endLine-t.startLine-(n.endLine-n.startLine))[0]}function D(e,i){return{file:e.file,startLine:e.startLine,endLine:e.endLine,method:i}}function x(e,i,t,n){return e<=n&&t<=i}function Be(e,i,t,n,a,s,r,o,l){let u=Math.max(o,s.size,r.size);if(!_e(i,u))return;let d=k(i.symbol);n.push({symbol:i.symbol,shortName:d,file:i.relativePath,startLine:i.startLine,endLine:i.endLine,fanIn:u});for(let c of l)L(e,t,a,c,d);for(let c of s)L(e,t,a,c,d);for(let c of r)L(e,t,a,c,d)}function H(e,i,t){try{return{values:t(),status:{tier:e,state:"complete",attemptedSymbols:i}}}catch(n){return{values:new Map,status:{tier:e,state:"failed",attemptedSymbols:i,reason:Me(n)}}}}function we(e){return["semantic-consumers","source-fallback-consumers"].map(i=>{let t=e.map(s=>s.evidenceTiers?.find(r=>r.tier===i)??{tier:i,state:"failed",attemptedSymbols:0,reason:"isolated diff-impact batch omitted its evidence-tier status"}),n=t.reduce((s,r)=>s+r.attemptedSymbols,0),a=[...new Set(t.filter(s=>s.state==="failed").map(s=>s.reason))];return a.length===0?{tier:i,state:"complete",attemptedSymbols:n}:{tier:i,state:"failed",attemptedSymbols:n,reason:a.join("; ").slice(0,500)}})}function X(){return[{tier:"semantic-consumers",state:"complete",attemptedSymbols:0},{tier:"source-fallback-consumers",state:"complete",attemptedSymbols:0}]}function Me(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"evidence provider failed without a reason":t}function Pe(e,i){if(i.length===0)return new Map;let t=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
|
|
6
|
+
FROM mentions m
|
|
7
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
8
|
+
WHERE m.symbol_id IN (${i.map(()=>"?").join(",")})
|
|
9
|
+
AND m.role != 1
|
|
10
|
+
GROUP BY m.symbol_id`,...i);return new Map(t.map(n=>[n.symbol_id,n.fan_in]))}function Ee(e,i,t){if(i.length===0||t.length===0)return new Map;let n=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
|
|
11
|
+
FROM mentions m
|
|
12
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
13
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
14
|
+
WHERE m.symbol_id IN (${i.map(()=>"?").join(",")})
|
|
15
|
+
AND m.role != 1
|
|
16
|
+
AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
|
|
17
|
+
${e.pathExclusionsFor("ref_d")}`,...i,...t),a=new Map;for(let s of n){let r=a.get(s.symbol_id);r||(r=new Set,a.set(s.symbol_id,r)),r.add(s.relative_path)}return a}function L(e,i,t,n,a){if(e.isIgnored(n)||i.has(n))return;let s=t.get(n);s||(s=new Set,t.set(n,s)),s.add(a)}function Te(e){return[...e.entries()].map(([i,t])=>({file:i,consumedSymbols:t.size})).sort((i,t)=>t.consumedSymbols-i.consumedSymbols)}function Ne(e){return!(j(e.symbol)||e.parentTypeName!==null&&!R(e.symbol))}function _e(e,i){return R(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&i>0}export{ie as a,Ze as b,ae as c,re as d,oe as e,ue as f,J as g,F as h,fe as i,Ve as j,Ye as k,Ke as l,Se as m};
|
|
18
|
+
//# sourceMappingURL=chunk-ZHXX42OH.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as i}from"./chunk-AFHORGLH.js";import{a as o}from"./chunk-S7OYBOCK.js";function l(e,s){let t=o(e,s);return t?i(e,"forward",[t]).filter(r=>!e.isIgnored(r)).map(r=>({relativePath:r})):[]}function f(e,s){let t=o(e,s);return t?i(e,"reverse",[t]).filter(r=>!e.isIgnored(r)).map(r=>({relativePath:r})):[]}export{l as a,f as b};
|
|
2
|
+
//# sourceMappingURL=chunk-ZJOOT3BG.js.map
|