scip-query 0.19.4 → 0.19.6
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 +75 -1
- package/README.md +242 -49
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-2YU7I3QO.js → chunk-24QNP7MN.js} +2 -2
- package/dist/{chunk-CNKAGUPL.js → chunk-26X7KCJR.js} +2 -2
- package/dist/{chunk-GPBBJ5Y4.js → chunk-273W2U4Y.js} +3 -3
- package/dist/{chunk-7GXM52MI.js → chunk-2CVXCGL4.js} +2 -2
- package/dist/{chunk-ABMYA4TN.js → chunk-2EZSOTSY.js} +2 -2
- package/dist/{chunk-HKEHS2AS.js → chunk-2GSQR6YA.js} +2 -2
- package/dist/{chunk-FECYOO5O.js → chunk-2OXVAGGT.js} +2 -2
- package/dist/chunk-2ZOCHAL2.js +8 -0
- package/dist/{chunk-QGXBRIM5.js → chunk-336DC5NJ.js} +2 -2
- package/dist/chunk-35SQLYCQ.js +2 -0
- package/dist/{chunk-VXQNNXJE.js → chunk-3OIKRYU5.js} +2 -2
- package/dist/{chunk-52ZYCAEO.js → chunk-47X75ZKH.js} +2 -2
- package/dist/{chunk-NPKYOIFM.js → chunk-4CGVLUDP.js} +2 -2
- package/dist/chunk-4RI4BJGT.js +8 -0
- package/dist/{chunk-P2PC2WGR.js → chunk-52HQTTPB.js} +2 -2
- package/dist/{chunk-YNRNA5LK.js → chunk-5OC3HWP5.js} +2 -2
- package/dist/{chunk-STOL2BTL.js → chunk-6XFC7PQ5.js} +2 -2
- package/dist/{chunk-J77UIT3I.js → chunk-6XHTISLI.js} +2 -2
- package/dist/chunk-6YTSKJJ3.js +2 -0
- package/dist/{chunk-BTEE5NZQ.js → chunk-7E3TH5ZN.js} +2 -2
- package/dist/{chunk-X6D5IC6I.js → chunk-7LABSJSR.js} +2 -2
- package/dist/chunk-7Q6VYYCH.js +2 -0
- package/dist/{chunk-FWUUZTIO.js → chunk-A43URCQ3.js} +2 -2
- package/dist/chunk-A63U2W3P.js +3 -0
- package/dist/{chunk-3MJ5YA4Y.js → chunk-ADFSIJP2.js} +2 -2
- package/dist/chunk-AOLE4DYM.js +6 -0
- package/dist/chunk-APMMR5Y2.js +2 -0
- package/dist/chunk-B5MHCHP3.js +107 -0
- package/dist/{chunk-4RSI5EMG.js → chunk-CSTYYXKC.js} +2 -2
- package/dist/{chunk-25LPM4DG.js → chunk-CYJM7CYF.js} +2 -2
- package/dist/{chunk-S44IULR6.js → chunk-DD5BOU5I.js} +2 -2
- package/dist/{chunk-YGAGTIDK.js → chunk-DGMCFMPG.js} +7 -7
- package/dist/{chunk-UOAV44HR.js → chunk-E2ZXPB7J.js} +2 -2
- package/dist/{chunk-IZKFSVBV.js → chunk-EVOC5I5I.js} +2 -2
- package/dist/{chunk-XTX6QHOF.js → chunk-F42A3AKG.js} +2 -2
- package/dist/{chunk-Q4IIEGXJ.js → chunk-FHCTEANE.js} +2 -2
- package/dist/{chunk-3SVWW4PN.js → chunk-FKGN4A4E.js} +2 -2
- package/dist/{chunk-IG7N5ZIK.js → chunk-FQTPPXNA.js} +2 -2
- package/dist/{chunk-F6O7AAC3.js → chunk-G4UQL4CP.js} +2 -2
- package/dist/chunk-GA64UPMI.js +6 -0
- package/dist/{chunk-ZXJYMGD3.js → chunk-GK3GRUJX.js} +2 -2
- package/dist/chunk-HEBAY673.js +2 -0
- package/dist/chunk-HELS7KFF.js +2 -0
- package/dist/{chunk-B5NLK2B3.js → chunk-IPDCSB6N.js} +2 -2
- package/dist/{chunk-M7MTH5NR.js → chunk-IYAOX36F.js} +2 -2
- package/dist/{chunk-YVVCVR2L.js → chunk-J7VT2CRB.js} +2 -2
- package/dist/{chunk-4333ETTV.js → chunk-JELJLXEE.js} +2 -2
- package/dist/{chunk-LBMJEAEW.js → chunk-JERWGHQT.js} +2 -2
- package/dist/chunk-JJJCO4QC.js +945 -0
- package/dist/{chunk-6E7UTQY7.js → chunk-JZNLMHWY.js} +2 -2
- package/dist/{chunk-R4FQGQ4X.js → chunk-K42M2KWT.js} +2 -2
- package/dist/{chunk-H7UKLTWJ.js → chunk-KLVJABXA.js} +2 -2
- package/dist/chunk-KP4KBDVF.js +3 -0
- package/dist/{chunk-RV2FQIX3.js → chunk-LMFVTUW2.js} +2 -2
- package/dist/chunk-LRTP3DKL.js +3 -0
- package/dist/{chunk-U6WNH5GC.js → chunk-MGBJHRFB.js} +2 -2
- package/dist/{chunk-QDV6RDCP.js → chunk-MLGTCX56.js} +2 -2
- package/dist/{chunk-54HA4ZXH.js → chunk-N3SE646F.js} +2 -2
- package/dist/{chunk-KP6XRY5Z.js → chunk-NBRUH7OE.js} +2 -2
- package/dist/{chunk-M7AIS73L.js → chunk-NN4ZIRPK.js} +2 -2
- package/dist/{chunk-I5RJM53C.js → chunk-NQLSSVOB.js} +2 -2
- package/dist/{chunk-4SALD7RU.js → chunk-OBKDTVZ3.js} +2 -2
- package/dist/{chunk-GBQ5NYPR.js → chunk-OHWZKLVA.js} +6 -6
- package/dist/{chunk-6NSFJYRC.js → chunk-OP3MTFJR.js} +2 -2
- package/dist/{chunk-EOOJGLDU.js → chunk-OQ2A4G2G.js} +2 -2
- package/dist/{chunk-DLWR3NUU.js → chunk-P6HBYNBE.js} +2 -2
- package/dist/{chunk-QVWS2VWZ.js → chunk-PC44K7RF.js} +2 -2
- package/dist/{chunk-A2EZV2UM.js → chunk-QBYYWGAT.js} +2 -2
- package/dist/{chunk-QRGV2F7L.js → chunk-QHKUY4FW.js} +2 -2
- package/dist/chunk-QHRL4LKM.js +2 -0
- package/dist/{chunk-I5AWSI2G.js → chunk-QQWOFXNW.js} +2 -2
- package/dist/{chunk-WQTAC523.js → chunk-RBFFD4V2.js} +2 -2
- package/dist/{chunk-SOAT6NLA.js → chunk-RJHCPSZ7.js} +2 -2
- package/dist/{chunk-VGRICIQI.js → chunk-RWRLUZ6U.js} +2 -2
- package/dist/{chunk-4T3LTWUS.js → chunk-S2GP3CU3.js} +2 -2
- package/dist/{chunk-HEXVUYFQ.js → chunk-SHKZ7OVJ.js} +2 -2
- package/dist/{chunk-NSS46APD.js → chunk-TFUU5MQQ.js} +2 -2
- package/dist/{chunk-IUFDSKGG.js → chunk-TYQ76QHQ.js} +2 -2
- package/dist/{chunk-NRCXJDHL.js → chunk-U5CNPPTZ.js} +2 -2
- package/dist/{chunk-MITTUCEH.js → chunk-UQK5CRUK.js} +2 -2
- package/dist/{chunk-XLTP42QA.js → chunk-UUJBLG6J.js} +2 -2
- package/dist/chunk-UXP636P5.js +144 -0
- package/dist/{chunk-64RFXJT5.js → chunk-VEVBIAOJ.js} +6 -6
- package/dist/chunk-VKRQDBW5.js +9 -0
- package/dist/{chunk-C7NIYIQ4.js → chunk-VOQFGC2W.js} +4 -4
- package/dist/{chunk-DZ74OMG6.js → chunk-VP542C25.js} +2 -2
- package/dist/{chunk-Q3AFUTGB.js → chunk-WMXRRBII.js} +2 -2
- package/dist/{chunk-ZGZUZ7XE.js → chunk-WXAAURU7.js} +2 -2
- package/dist/chunk-X3NLZHPA.js +20 -0
- package/dist/{chunk-WER3B7MI.js → chunk-XF3KLXN3.js} +2 -2
- package/dist/{chunk-NH5ALKPW.js → chunk-XVJ3V7LM.js} +2 -2
- package/dist/{chunk-4XTA5OMB.js → chunk-YGQN3XGZ.js} +2 -2
- package/dist/{chunk-CFMXJPHH.js → chunk-YHXBD52M.js} +2 -2
- package/dist/{chunk-7B3UPBVA.js → chunk-YLVE3SXZ.js} +2 -2
- package/dist/{chunk-YIJ7ZAA4.js → chunk-YTUD45PU.js} +2 -2
- package/dist/{chunk-VTKGCT3V.js → chunk-YWB2EBNB.js} +2 -2
- package/dist/{chunk-UKZBVX4U.js → chunk-Z2LHPIOM.js} +2 -2
- package/dist/chunk-Z5QQPJ3U.js +30 -0
- package/dist/{chunk-NZL2DBT7.js → chunk-ZLJLE6LK.js} +2 -2
- package/dist/{chunk-XYADIZHU.js → chunk-ZTTISZ7J.js} +2 -2
- package/dist/cli.js +3 -3
- package/dist/command-descriptors-SJDZ7QGR.js +617 -0
- package/dist/{config-types-D20KuvvZ.d.ts → config-types-BWQ5xPGI.d.ts} +4 -0
- package/dist/{db-G_II8yXU.d.ts → db-B0r1o7Vt.d.ts} +18 -1
- package/dist/direct-navigation-HTKOZEOM.js +3 -0
- package/dist/{health-oblXYgkF.d.ts → health-CFnlCiTz.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- 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 +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +3 -3
- 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 +30 -2
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +17 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +3 -3
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/stats.js +1 -1
- 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 +3 -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 +23 -24
- package/dist/reindex.d.ts +10 -4
- package/dist/reindex.js +33 -38
- package/dist/runtime.d.ts +167 -11
- package/dist/runtime.js +3 -2
- 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-kRpaexVJ.d.ts → scip-cli-DCvnlZCu.d.ts} +5 -1
- package/dist/watch-server.js +5 -5
- package/docs/AGENT_GUIDE.md +1 -1
- package/docs/AI_FAILURE_MODES.md +18 -18
- package/docs/API_EVOLUTION.md +71 -0
- package/docs/CLI_JSON_OUTPUT.md +83 -0
- package/docs/COMMAND_REFERENCE.md +10 -8
- package/docs/COMMITTED_RECORD_COMPATIBILITY.md +117 -0
- package/docs/CONFIGURATION_WRITE_SAFETY.md +130 -0
- package/docs/DETECTOR_GUIDE.md +47 -47
- package/docs/DURABILITY.md +103 -0
- package/docs/INDEX_GENERATIONS.md +121 -0
- package/docs/LOCK_PROTOCOL.md +133 -0
- package/docs/MAILBOX_LIFECYCLE.md +197 -0
- package/docs/REINDEX_METADATA_COMPATIBILITY.md +84 -0
- package/docs/RUST_DURABLE_SESSION_PROTOCOL.md +126 -0
- package/docs/TELEMETRY_RETENTION.md +72 -0
- package/docs/TIME_SEMANTICS.md +77 -0
- package/docs/WATCH_REFRESH_REQUESTS.md +110 -0
- package/docs/WINDOWS_SIDECAR_RELEASE.md +298 -0
- package/docs/analyzer-validation-ledger.md +24 -23
- package/docs/schemas/cli-json-envelope.schema.json +53 -0
- package/docs/schemas/npm-release-state.schema.json +146 -0
- package/docs/schemas/outcome-event-record.schema.json +39 -0
- package/docs/schemas/project-config.schema.json +247 -0
- package/docs/schemas/suppression-record.schema.json +31 -0
- package/docs/schemas/windows-sidecar-provenance.schema.json +137 -0
- package/package.json +15 -5
- package/scripts/build-scip-windows.mjs +180 -61
- package/scripts/scip-windows-provenance.mjs +364 -0
- package/scripts/verify-scip-windows.mjs +29 -0
- package/skills/_shared/SKILL.md +91 -242
- package/skills/_shared/agents/openai.yaml +1 -1
- package/skills/_shared/references/agent-contract-catalog.md +105 -0
- package/skills/_shared/references/command-catalog.md +118 -0
- package/skills/_shared/references/detector-precision-and-diffgate.md +59 -0
- package/skills/_shared/references/evidence-and-dead-code.md +25 -0
- package/skills/scip-audit/SKILL.md +76 -0
- package/skills/scip-audit/agents/openai.yaml +4 -0
- package/skills/scip-audit/references/claims.md +98 -0
- package/skills/scip-audit/references/cleanup.md +101 -0
- package/skills/scip-audit/references/directory.md +222 -0
- package/skills/scip-audit/references/frontend.md +130 -0
- package/skills/scip-audit/references/integrity.md +154 -0
- package/skills/scip-audit/references/maintainability.md +162 -0
- package/skills/scip-audit/references/twin-drift.md +104 -0
- package/skills/scip-diagnose/SKILL.md +52 -0
- package/skills/scip-diagnose/agents/openai.yaml +4 -0
- package/skills/scip-diagnose/references/debug.md +117 -0
- package/skills/{scip-probe-reachability/SKILL.md → scip-diagnose/references/probe-reachability.md} +12 -27
- package/skills/scip-diagnose/references/root-cause.md +145 -0
- package/skills/scip-diagnose/references/triage.md +119 -0
- package/skills/scip-explore/SKILL.md +53 -84
- package/skills/scip-explore/agents/openai.yaml +2 -2
- package/skills/scip-explore/references/diagrams.md +40 -0
- package/skills/scip-explore/references/language-playbook.md +49 -0
- package/skills/scip-improve/SKILL.md +56 -0
- package/skills/scip-improve/agents/openai.yaml +4 -0
- package/skills/scip-improve/references/cleanup-batches.md +53 -0
- package/skills/scip-improve/references/directory-moves.md +53 -0
- package/skills/scip-improve/references/doc-reconcile.md +30 -0
- package/skills/scip-improve/references/frontend-extraction.md +39 -0
- package/skills/scip-improve/references/maintainability-mechanism.md +43 -0
- package/skills/scip-improve/references/twin-drift.md +35 -0
- package/skills/scip-plan/SKILL.md +68 -0
- package/skills/scip-plan/agents/openai.yaml +4 -0
- package/skills/scip-plan/references/api-impact.md +19 -0
- package/skills/scip-plan/references/conductor.md +41 -0
- package/skills/scip-plan/references/high-assurance.md +43 -0
- package/skills/scip-plan/references/hyper-optimization.md +50 -0
- package/skills/scip-plan/references/tla-model.md +88 -0
- package/skills/scip-query/SKILL.md +52 -97
- package/skills/scip-query/agents/openai.yaml +2 -2
- package/skills/scip-setup/SKILL.md +65 -176
- package/skills/scip-setup/agents/openai.yaml +3 -3
- package/skills/scip-setup/references/bootstrap-workflow.md +120 -0
- package/skills/scip-setup/references/language-verification.md +61 -0
- package/skills/scip-setup/references/lifecycle-commands.md +119 -0
- package/skills/scip-setup/references/per-repo-triage.md +24 -0
- package/skills/scip-verify/SKILL.md +123 -70
- package/skills/scip-verify/agents/openai.yaml +2 -2
- package/skills/scip-verify/references/calibrate-detectors.md +170 -0
- package/dist/chunk-2CTX5CMX.js +0 -4
- package/dist/chunk-2Y373BDD.js +0 -2
- package/dist/chunk-C2QSK7E7.js +0 -2
- package/dist/chunk-D4U5Q3FT.js +0 -7
- package/dist/chunk-K2ERX4UT.js +0 -3
- package/dist/chunk-KHE7J5ZN.js +0 -3
- package/dist/chunk-L7SPDE73.js +0 -84
- package/dist/chunk-LHMNRHGV.js +0 -3
- package/dist/chunk-LM72NQ7T.js +0 -3
- package/dist/chunk-MSWVMDAH.js +0 -122
- package/dist/chunk-NH7WNNQC.js +0 -20
- package/dist/chunk-OMPZHGHO.js +0 -2
- package/dist/chunk-SVLTAG5O.js +0 -927
- package/dist/chunk-U7DSEKOM.js +0 -30
- package/dist/chunk-V27BEQJN.js +0 -7
- package/dist/chunk-VMNZB6WI.js +0 -4
- package/dist/chunk-XBN5VO53.js +0 -2
- package/dist/chunk-ZAIILQNP.js +0 -5
- package/dist/command-descriptors-MFU4BCJ7.js +0 -612
- package/dist/direct-navigation-MRMQFIRB.js +0 -3
- package/skills/scip-api-impact/SKILL.md +0 -139
- package/skills/scip-api-impact/agents/openai.yaml +0 -4
- package/skills/scip-calibrate/SKILL.md +0 -131
- package/skills/scip-calibrate/agents/openai.yaml +0 -4
- package/skills/scip-claim-audit/SKILL.md +0 -106
- package/skills/scip-claim-audit/agents/openai.yaml +0 -4
- package/skills/scip-cleanup-audit/SKILL.md +0 -126
- package/skills/scip-cleanup-audit/agents/openai.yaml +0 -4
- package/skills/scip-cleanup-improve/SKILL.md +0 -84
- package/skills/scip-cleanup-improve/agents/openai.yaml +0 -4
- package/skills/scip-concrete-plan/SKILL.md +0 -262
- package/skills/scip-concrete-plan/agents/openai.yaml +0 -4
- package/skills/scip-conductor/SKILL.md +0 -133
- package/skills/scip-conductor/agents/openai.yaml +0 -4
- package/skills/scip-debug/SKILL.md +0 -130
- package/skills/scip-debug/agents/openai.yaml +0 -4
- package/skills/scip-diagram/SKILL.md +0 -110
- package/skills/scip-diagram/agents/openai.yaml +0 -4
- package/skills/scip-directory-architecture/SKILL.md +0 -254
- package/skills/scip-directory-architecture/agents/openai.yaml +0 -4
- package/skills/scip-doc-reconcile/SKILL.md +0 -89
- package/skills/scip-doc-reconcile/agents/openai.yaml +0 -4
- package/skills/scip-hyper-optimization/SKILL.md +0 -156
- package/skills/scip-hyper-optimization/agents/openai.yaml +0 -4
- package/skills/scip-integrity-audit/SKILL.md +0 -152
- package/skills/scip-integrity-audit/agents/openai.yaml +0 -4
- package/skills/scip-language-playbook/SKILL.md +0 -106
- package/skills/scip-language-playbook/agents/openai.yaml +0 -4
- package/skills/scip-maintainability/SKILL.md +0 -158
- package/skills/scip-maintainability/agents/openai.yaml +0 -4
- package/skills/scip-probe-reachability/agents/openai.yaml +0 -4
- package/skills/scip-react-maintainability/SKILL.md +0 -101
- package/skills/scip-react-maintainability/agents/openai.yaml +0 -4
- package/skills/scip-root-cause/SKILL.md +0 -150
- package/skills/scip-root-cause/agents/openai.yaml +0 -4
- package/skills/scip-tla-model-system/SKILL.md +0 -148
- package/skills/scip-tla-model-system/agents/openai.yaml +0 -4
- package/skills/scip-triage-issue/SKILL.md +0 -126
- package/skills/scip-triage-issue/agents/openai.yaml +0 -4
- package/skills/scip-twin-drift/SKILL.md +0 -107
- package/skills/scip-twin-drift/agents/openai.yaml +0 -4
- package/skills/scip-vue-maintainability/SKILL.md +0 -107
- package/skills/scip-vue-maintainability/agents/openai.yaml +0 -4
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Calibrate detectors
|
|
2
|
+
|
|
3
|
+
Use this when adopting scip-query in a new or foreign codebase, after major
|
|
4
|
+
detector changes, when a health score or gate output seems too noisy or too
|
|
5
|
+
clean, or before letting `diff-gate` block anyone's work.
|
|
6
|
+
|
|
7
|
+
## The stance
|
|
8
|
+
|
|
9
|
+
A detector tuned on one codebase's conventions can be precise there and
|
|
10
|
+
noisy elsewhere. Calibration finds out which, on this repo, and converts
|
|
11
|
+
every noise archetype into either a repo-side knob or an upstream detector
|
|
12
|
+
bug. A health score that hasn't been calibrated is a number, not a fact:
|
|
13
|
+
never present detector output from an uncalibrated repo as findings —
|
|
14
|
+
present it as candidate findings pending classification. A calibrated score
|
|
15
|
+
has to earn trust the same way a checker earns it in the integrity scenario
|
|
16
|
+
of `scip-audit`:
|
|
17
|
+
by being witnessed telling the truth on samples verified by hand.
|
|
18
|
+
|
|
19
|
+
Run all five stages below. Each has a checkable completion criterion — don't
|
|
20
|
+
move on until it's met.
|
|
21
|
+
|
|
22
|
+
## Stage 1 — Index and inventory
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
scip-query reindex
|
|
26
|
+
scip-query status --capabilities
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Record which languages got which evidence tier (SCIP-indexed vs
|
|
30
|
+
source-fallback vs regex): a detector's expected precision differs per tier,
|
|
31
|
+
and a repo that is 80% fallback-tier must be judged against fallback
|
|
32
|
+
expectations, not SCIP-tier expectations. Note the monorepo shape
|
|
33
|
+
(workspaces, cross-package imports) — historically the single largest
|
|
34
|
+
false-positive source is `dead`/`new-dead` findings on cross-package
|
|
35
|
+
consumers.
|
|
36
|
+
|
|
37
|
+
Complete only when languages, evidence tiers, and workspace shape are
|
|
38
|
+
written down.
|
|
39
|
+
|
|
40
|
+
## Stage 2 — Battery sweep
|
|
41
|
+
|
|
42
|
+
Run the full detector battery and don't react to any of the numbers yet —
|
|
43
|
+
big counts here are sampling frames, not findings:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
scip-query health --json
|
|
47
|
+
scip-query dead --json
|
|
48
|
+
scip-query similar <symbol>
|
|
49
|
+
scip-query twin-drift -s <scope> --json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Complete only when every detector's finding count is recorded.
|
|
53
|
+
|
|
54
|
+
## Stage 3 — Retro-gate replay
|
|
55
|
+
|
|
56
|
+
Replay the gate against the last 15-20 real commits, using a worktree per
|
|
57
|
+
commit — never the user's live tree:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
scip-query diff-gate --base <commit> --json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This is the stage that exposes finding WALLS: one hub file or one convention
|
|
64
|
+
mismatch generating dozens of near-identical findings per commit. A finding
|
|
65
|
+
wall is always either a missing repo knob or a detector bug — it is never
|
|
66
|
+
simply "the repo is just bad."
|
|
67
|
+
|
|
68
|
+
Complete only when per-commit finding counts and every wall are recorded.
|
|
69
|
+
|
|
70
|
+
## Stage 4 — Sample and classify
|
|
71
|
+
|
|
72
|
+
This is the actual calibration. For each detector with findings: sample
|
|
73
|
+
about 10 of them (all of them if fewer), read the code at each cited site,
|
|
74
|
+
and classify actionable vs noise.
|
|
75
|
+
|
|
76
|
+
- Classify from the code, never from the finding text. A finding that
|
|
77
|
+
sounds plausible and a finding that is true are different things, and the
|
|
78
|
+
difference is only visible at the cited file and line.
|
|
79
|
+
- For every noise finding, name the archetype (e.g. "type-only import
|
|
80
|
+
invisible to indexer", "delegation chain flagged as twin", "generic
|
|
81
|
+
shared helpers saturating similarity"). Archetypes are the deliverable —
|
|
82
|
+
a noise rate without archetypes cannot be fixed.
|
|
83
|
+
|
|
84
|
+
Give each detector a verdict: **keep** (precision acceptable), **retune**
|
|
85
|
+
(name the threshold and the value), or **demote to advisory** for this repo.
|
|
86
|
+
|
|
87
|
+
Complete only when every detector has sampled precision, named archetypes,
|
|
88
|
+
and a verdict.
|
|
89
|
+
|
|
90
|
+
## Stage 5 — Tune the knobs, file the bugs
|
|
91
|
+
|
|
92
|
+
Apply repo-side fixes for what belongs to the repo, and file upstream for
|
|
93
|
+
what belongs to the detector:
|
|
94
|
+
|
|
95
|
+
- `.scipquery.json` suppressions — one per accepted finding, each with a
|
|
96
|
+
reason. A reasonless suppression is hiding, not tuning.
|
|
97
|
+
- `docs.snapshotPaths` — mark dated/archival docs that must never generate
|
|
98
|
+
doc-reference findings.
|
|
99
|
+
- Coverage contracts — declare enumerations the gate should police.
|
|
100
|
+
- `commandAnalysisBudget` — cap analysis honestly on very large indexes.
|
|
101
|
+
|
|
102
|
+
Validate any config change:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
scip-query config-validate
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Detector bugs — noise archetypes no config knob can express — go to the
|
|
109
|
+
tool's followup ledger with the archetype, a concrete example, and the
|
|
110
|
+
sampled rate. Never tune a threshold to hide an archetype; that trades
|
|
111
|
+
visible noise for invisible blindness. File it and live with the noise
|
|
112
|
+
until it's fixed.
|
|
113
|
+
|
|
114
|
+
Confirm the repair:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
scip-query diff-gate --json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
run before and after, to check it worked.
|
|
121
|
+
|
|
122
|
+
Complete only when the stage-3 gate replay re-runs materially quieter and
|
|
123
|
+
every remaining finding class is actionable, suppressed-with-reason, or
|
|
124
|
+
filed upstream.
|
|
125
|
+
|
|
126
|
+
## Failure modes
|
|
127
|
+
|
|
128
|
+
Each of these has been observed in a real calibration:
|
|
129
|
+
|
|
130
|
+
- **Sampling too few.** One good finding does not make a detector precise;
|
|
131
|
+
one bad finding does not make it noise. Ten samples per detector is the
|
|
132
|
+
floor.
|
|
133
|
+
- **Classifying from the finding text.** The finding always sounds right —
|
|
134
|
+
it was generated to. Only the code knows.
|
|
135
|
+
- **Tuning to green.** Raising a threshold until the noise disappears also
|
|
136
|
+
disappears the real findings. If the archetype is a detector bug, file it
|
|
137
|
+
and live with the noise rather than tuning it away.
|
|
138
|
+
- **Trusting a clean run.** Zero findings on a detector can mean precision,
|
|
139
|
+
or it can mean the detector cannot see this repo's conventions at all
|
|
140
|
+
(wrong import style, unindexed language). Verify at least one known-true
|
|
141
|
+
positive per major detector — plant one if none exists.
|
|
142
|
+
- **Calibrating the wrong tree.** Use clones or worktrees for anything that
|
|
143
|
+
mutates during calibration. The target repo is read-only unless its owner
|
|
144
|
+
said otherwise.
|
|
145
|
+
|
|
146
|
+
## After calibration
|
|
147
|
+
|
|
148
|
+
The finding-outcome ledger keeps calibrating automatically. Once the repo
|
|
149
|
+
uses `diff-gate`, per-detector precision is recomputed from real outcomes as
|
|
150
|
+
`detectorPrecision` in `health --json`. The committed event ledger under
|
|
151
|
+
`.scipquery/events/*.json` makes those outcomes durable and queryable:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
scip-query effectiveness --since 30d --json
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
reports, per check, caught / comparison-verified-fixed / suppressed / open /
|
|
158
|
+
unverified counts, precision, and median days-to-fix, sourced from those
|
|
159
|
+
individual records.
|
|
160
|
+
|
|
161
|
+
If `HEAD` advances during or after calibration, use a clean worktree so
|
|
162
|
+
scip-query can replay the stored comparison base instead of mistaking an
|
|
163
|
+
empty diff for a fix. Re-run this protocol only after major detector
|
|
164
|
+
upgrades, or when the ledger's precision numbers drift from what was
|
|
165
|
+
measured previously.
|
|
166
|
+
|
|
167
|
+
Write the calibration report to
|
|
168
|
+
`docs/validation/YYYY-MM-DD-external-calibration-<repo>.md`, shaped like the
|
|
169
|
+
exemplars this protocol was distilled from: battery table, retro-gate walls,
|
|
170
|
+
per-detector verdicts, noise archetypes, caps and deviations.
|
package/dist/chunk-2CTX5CMX.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as O,c as X}from"./chunk-LM72NQ7T.js";import{a as I}from"./chunk-7B3UPBVA.js";import{d as G,g as N,s as B,v as J,x as K}from"./chunk-L7SPDE73.js";import{a as V}from"./chunk-64MNV6AB.js";import{execFileSync as Z}from"child_process";import{existsSync as L,readFileSync as je}from"fs";import{createRequire as xe}from"module";import{platform as Q}from"os";import{dirname as Y,join as R}from"path";var Fe=xe(import.meta.url),At={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function W(t){return[t.indexerBinary,...t.binaryAliases??[]]}function Pe(t){let e=W(t);return e.length===1?e[0]:e.join(" or ")}function _(t){for(let e of W(t))if(Q()==="win32"){let n=X(e);if(n)return n}else if(O(e))return e;return Re(t)}function Et(t){return _(t)!==null||Ie(t)}function Ie(t){return ee(t)!==null}function Re(t){let e=ee(t);if(!e)return null;let r=JSON.parse(je(e,"utf8")).bin;if(!r)return null;if(typeof r=="string")return R(Y(e),r);for(let i of W(t)){let s=r[i];if(s)return R(Y(e),s)}return null}function ee(t){if(!t.bundledNpmPackage)return null;try{return Fe.resolve(`${t.bundledNpmPackage}/package.json`)}catch{return null}}function Te(t,e){for(let n of t.projectLocalBinaries??[]){let r=R(e,n);if(L(r))return r}return null}function ve(t,e){return Te(t,e)??_(t)}function Dt(t,e=process.env,n=t.indexerBinary){if(t.indexerBinary!=="scip-dotnet"||$(n,e))return e;let r=te(n,e);return r?{...e,DOTNET_ROOT:r}:e}function Nt(t,e){let n=Pe(t),r=e?ve(t,e):_(t);if(!r)return{language:t.language,binaryLabel:n,installed:!1,runnable:!1,resolvedBinary:null,installUrl:t.installUrl};if(t.indexerBinary!=="scip-dotnet")return{language:t.language,binaryLabel:n,installed:!0,runnable:!0,resolvedBinary:r};let i=ke(r);return{language:t.language,binaryLabel:n,installed:!0,runnable:i.runnable,resolvedBinary:r,installUrl:t.installUrl,note:i.note}}function ke(t){if($(t,process.env))return{runnable:!0};let e=te(t,process.env);if(e)return{runnable:!0,note:`using .NET 9 runtime from ${e}`};let n=ne(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function te(t,e){for(let n of ne(e))if($(t,{...e,DOTNET_ROOT:n}))return n;return null}function ne(t){let e=[],n=t.DOTNET_ROOT;if(n&&L(n)&&e.push(n),Q()==="darwin"&&O("brew"))try{let r=Z("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:t}).toString().trim(),i=R(r,"libexec");L(i)&&!e.includes(i)&&e.push(i)}catch{}return e}function $(t,e){try{return Z(t,["--version"],{stdio:"pipe",env:e}),!0}catch{return!1}}function Ot(t){try{return process.kill(t,0),!0}catch(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EPERM"}}import{mkdirSync as we,renameSync as Ce,writeFileSync as Me}from"fs";import{dirname as Ae}from"path";function $t(t,e,n={}){we(Ae(t),{recursive:!0});let r=`${t}.${process.pid}.${Date.now()}.tmp`,i=JSON.stringify(e,null,n.spacing);Me(r,n.trailingNewline?`${i}
|
|
2
|
-
`:i),Ce(r,t)}function z(t,e){let n=t.split("/").at(-1)??t;if(ce.has(n)||n===".scipquery.json"||/^tsconfig(?:\..+)?\.json$/.test(n))return"config";if(/\.d\.(?:ts|mts|cts)$/.test(t.toLowerCase()))return"ambient";let r=t.includes(".")?`.${t.split(".").at(-1).toLowerCase()}`:"";return e.some(i=>(pe[i]??[]).includes(r))?"source":"other"}function oe(t,e,n){let r=t.split("/").at(-1)??t;if(n?.includes(t)||n?.includes(r)||ce.has(r))return!0;let i=t.includes(".")?`.${t.split(".").at(-1).toLowerCase()}`:"";return(pe[e]??[]).includes(i)}function ae(t){if(typeof t!="object"||t===null)return null;let e=t;return typeof e.version!="number"||!re(e.languages)||typeof e.pnpmWorkspaces!="boolean"||typeof e.typescriptProjectMode!="string"||!re(e.typescriptProjects)||e.clojureConfigPath!==void 0&&typeof e.clojureConfigPath!="string"||!Array.isArray(e.files)||!e.files.every(Ee)?null:e}function Ut(t,e){let n=new Map((t?.files??[]).map(a=>[a.path,a])),r=new Map(e.files.map(a=>[a.path,a])),i=new Set([...n.keys(),...r.keys()]),s=[];for(let a of[...i].sort()){let p=n.get(a),u=r.get(a),d=z(a,e.languages);!p&&u?s.push({kind:"added",path:a,inputKind:d,after:u}):p&&!u?s.push({kind:"deleted",path:a,inputKind:d,before:p}):p&&u&&(p.hash!==u.hash||p.size!==u.size)&&s.push({kind:"modified",path:a,inputKind:d,before:p,after:u})}let o=new Set;return t||o.add("prior-snapshot-unavailable"),t&&t.version!==e.version&&o.add("snapshot-version-changed"),(ie(t?.files??[])||ie(e.files))&&o.add("duplicate-input-path"),[...t?.files??[],...e.files].some(De)&&o.add("unreadable-input"),{version:1,changes:s,projectIdentityChanged:t?!Ne(t,e):!0,uncertainty:[...o].sort()}}function re(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function ie(t){return new Set(t.map(e=>e.path)).size!==t.length}function Ee(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.path=="string"&&typeof e.size=="number"&&typeof e.hash=="string"}function De(t){return t.hash==="unreadable"||t.size<0}function Ne(t,e){return se(t.languages,e.languages)&&t.pnpmWorkspaces===e.pnpmWorkspaces&&t.typescriptProjectMode===e.typescriptProjectMode&&se(t.typescriptProjects,e.typescriptProjects)&&t.clojureConfigPath===e.clojureConfigPath}function se(t,e){if(t.length!==e.length)return!1;let n=[...t].sort(),r=[...e].sort();return n.every((i,s)=>i===r[s])}var ce=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"]),pe={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{execFileSync as Be}from"child_process";import{createHash as le}from"crypto";import{lstatSync as Oe,readdirSync as Le,readFileSync as We,readlinkSync as _e,realpathSync as ue}from"fs";import{isAbsolute as $e,join as de,relative as ze,sep as Ue}from"path";function He(t){return[...new Set((t??[]).map(e=>e.trim()).filter(Boolean))].sort((e,n)=>e.localeCompare(n))}function qe(t){return(Je(t)??Ke(t)).filter(e=>e&&!fe(e)).sort()}function Ge(t,e={}){let n=qe(t).filter(i=>!e.language||oe(i,e.language,e.markerFiles)).filter(i=>!e.includePath||e.includePath(i)),r=ue(t);return n.map(i=>{let s=de(t,i);try{if(Oe(s).isSymbolicLink()){let a=ue(s),p=ze(r,a);if(p===".."||p.startsWith(`..${Ue}`)||$e(p))throw new Error("external symlink");let u=_e(s);return{path:i,size:Buffer.byteLength(u),hash:le("sha256").update("symlink\0").update(u).digest("hex")}}let o=We(s);return{path:i,size:o.byteLength,hash:le("sha256").update(o).digest("hex")}}catch{return{path:i,size:-1,hash:"unreadable"}}})}function Xt(t,e,n){return{version:2,languages:[...e].sort(),pnpmWorkspaces:n.typescriptProjectMode!=="workspace"&&n.pnpmWorkspaces===!0,typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:He(n.typescriptProjects),clojureConfigPath:Ve(n.clojureConfigPath),files:Ge(t)}}function Ve(t){return t?.trim()||void 0}function Je(t){try{return Be("git",["-C",t,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
3
|
-
`).filter(Boolean)}catch{return null}}function Ke(t){let e=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?de(t,r):t,s;try{s=Le(i,{withFileTypes:!0})}catch{continue}for(let o of s){let a=r?`${r}/${o.name}`:o.name;if(o.isDirectory()){fe(a)||n.push(a);continue}e.push(a)}}return e}function fe(t){let e=t.split("/");return t==="meta.json"||e.some(n=>Xe.has(n))||t.endsWith(".db")||t.endsWith(".db-wal")||t.endsWith(".db-shm")||t.endsWith(".scip")}var Xe=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import{readFileSync as rt}from"fs";import{dirname as it,join as st}from"path";var Ye=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function T(t){let e=t.toLowerCase();return Ye.some(n=>e.endsWith(n))}function k(t){let e=v(t.projectFiles),n=new Set(e),r=new Map(t.snapshot.files.map(c=>[c.path,c])),i=t.snapshot.files.filter(c=>{let f=z(c.path,["typescript"]);return f==="config"||f==="ambient"}).map(c=>c.path),s=v([...e,...i]),o=s.find(c=>!r.has(c)),a=new Set(t.snapshot.files.map(c=>c.path)).size!==t.snapshot.files.length,p=!o&&s.some(c=>me(r.get(c))),u=N(JSON.stringify({pnpmWorkspaces:t.snapshot.pnpmWorkspaces,typescriptProjectMode:t.snapshot.typescriptProjectMode,typescriptProjects:v(t.snapshot.typescriptProjects),membership:e})),d=new Map;return{identityFor(c,f){if(!n.has(c))return b("target-outside-project");if(a)return b("duplicate-input-path");if(o)return b("missing-input-fingerprint");if(p)return b("unreadable-input");let h=[],l,S;if(t.graph===null)h.push("dependency-graph-unavailable"),S="whole-project",l=s;else{let P=Qe(c,t.graph,d);if(P.find(D=>!r.has(D)))return b("missing-input-fingerprint");if(l=v([...P,...i]),l.some(D=>me(r.get(D))))return b("unreadable-input");S="dependency-closure"}let F=l.map(P=>et(r.get(P)));return{version:1,key:N(JSON.stringify({version:1,engineIdentity:t.engineIdentity,schemaVersion:f,projectIdentity:u,inputs:F})),mode:S,inputFiles:l,reasons:h}}}}function Ze(t,e){let n=new Set,r=[t];for(let i=0;i<r.length;i+=1){let s=r[i];if(!(s===void 0||n.has(s))){n.add(s);for(let o of[...e.get(s)??[]].sort())n.has(o)||r.push(o)}}return[...n].sort()}function Qe(t,e,n){let r=n.get(t);if(r)return r;let i=Ze(t,e);return n.set(t,i),i}function et(t){return{path:t.path,size:t.size,hash:t.hash}}function me(t){return t.size<0||t.hash==="unreadable"}function b(t){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[t]}}function v(t){return[...new Set(t)].sort()}import{createRequire as tt}from"module";var ge=tt(import.meta.url),j,w;function nt(){if(j!==void 0)return j;try{j=ge("ts-morph")}catch{j=null}return j}function C(){if(w)return w;let t=nt();if(!t)return"ts-morph:unavailable";let e="unknown";try{e=ge("ts-morph/package.json").version??"unknown"}catch{}return w=`ts-morph:${e}:typescript:${t.ts.version}`,w}function rn(t,e){return e.map(n=>({tsconfigPath:n,project:new t.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function sn(t,e,n){return{language:"typescript",availability:()=>({available:!1,reason:t,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var ot=G("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function U(t,e,n){let r=ot.get(t,()=>at(t));if(!r)return null;let i=`${n}\0${e}`,s=r.identities.get(i);if(s)return s;let o=r.builder.identityFor(e,n);return r.identities.set(i,o),o}function x(t){return V(t,{includeIgnored:!1}).filter(T).sort()}function at(t){try{let e=JSON.parse(rt(st(it(t.config.dbPath),"meta.json"),"utf8")),n=ae(e.fingerprint);return n?{builder:k({projectFiles:x(t),snapshot:n,graph:I(t),engineIdentity:C()}),identities:new Map}:null}catch{return null}}function M(t,e){let n=new Map(t.map(i=>[i.symbol,i])),r=new Map(t.map(i=>[i.symbolId,[]]));for(let i of e.values())for(let s of i){let o=n.get(s.targetSymbol);o&&r.get(o.symbolId).push(s.location)}for(let[i,s]of r)r.set(i,ct(s));return r}function Se(t,e,n){let r=he(t,e),i=he(t,n),s=[...r].filter(c=>!i.has(c)).sort(),o=[...i].filter(c=>!r.has(c)).sort(),a=ye(t,e),p=ye(t,n),u=[...a].filter(c=>!p.has(c)).sort(),d=[...p].filter(c=>!a.has(c)).sort();return{passed:s.length===0&&o.length===0,expectedCount:r.size,actualCount:i.size,missing:s,extra:o,callerFiles:{passed:u.length===0&&d.length===0,expectedCount:a.size,actualCount:p.size,missing:u,extra:d}}}function ye(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function hn(t,e,n){let r=new Set(n),i=new Map(n.map(s=>[s,[]]));for(let s of t)for(let o of e.get(s.symbolId)??[])r.has(o.file)&&i.get(o.file).push({targetSymbol:s.symbol,location:o});for(let[s,o]of i)i.set(s,pt(o));return i}function he(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function ct(t){let e=new Map;for(let n of t)e.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...e.values()].sort(be)}function pt(t){let e=new Map;for(let n of t){let{location:r}=n;e.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...e.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||be(n.location,r.location))}function be(t,e){return t.file.localeCompare(e.file)||t.line-e.line||t.column-e.column}var H="typescript-reference-fragment-v2",E=J({kind:"typescript-reference-fragments",invalidation:K("typescript-reference-fragments"),serialize:t=>JSON.stringify(t),deserialize:ut});function vn(t,e,n,r=t){let i=x(t),s=k({projectFiles:i,snapshot:e,graph:I(t),engineIdentity:C()}),o=[...n].map(([a,p])=>({relativePath:a,contentHash:s.identityFor(a,H).key,value:[...p]}));if(o.some(a=>a.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return E.writeBatch(r,o.map(a=>({...a,contentHash:a.contentHash}))),o.length}function kn(t,e,n,r){let i=e.filter(o=>T(o.relativePath));if(i.length===0)return A("no TypeScript definitions");let s=A("shadow did not run");return B("typescript.reference-fragments.shadow",()=>{try{let o=r(i[0].relativePath);if(!o.availability().available||!o.referenceFragmentsForFiles)return s=A("TypeScript reference fragment provider is unavailable"),s;let a=x(t),p=new Set(a),u=o.referenceFragmentsForFiles(a),d=M(i,u),c=Se(i,lt(n,p),d);if(!c.passed)return s={state:"failing",files:a.length,keyedFiles:0,writtenFiles:0,...c},s;let f=[];for(let h of a){let l=U(t,h,H);l?.key&&f.push({relativePath:h,contentHash:l.key,value:u.get(h)??[]})}return E.writeBatch(t,f),s={state:"passing",files:a.length,keyedFiles:f.length,writtenFiles:f.length,...c},s}catch(o){return s=A(o instanceof Error?o.message:String(o)),s}},()=>({...s}))}function lt(t,e){return new Map([...t].map(([n,r])=>[n,r.filter(i=>e.has(i.file))]))}function wn(t,e,n){if(e.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,s=0,o=0,a=0;return B("typescript.reference-fragments.materialize",()=>{try{let p=x(t);i=p.length;let u=new Map,d=new Map,c=[];for(let l of p){let S=U(t,l,H);if(!S?.key)return null;u.set(l,S.key);let F=E.read(t,l,S.key);F===null?(o+=1,c.push(l)):(s+=1,d.set(l,F))}if(o===0)return r="hit",{references:M(e,d),files:i,cacheHits:s,cacheMisses:o,computedFiles:a};let f=n(e[0].relativePath);if(!f.availability().available||!f.referenceFragmentsForFiles)return null;let h=f.referenceFragmentsForFiles(c);if(c.some(l=>!h.has(l)))return null;a=h.size,E.writeBatch(t,c.map(l=>({relativePath:l,contentHash:u.get(l),value:h.get(l)??[]})));for(let[l,S]of h)d.set(l,S);return r="computed",{references:M(e,d),files:i,cacheHits:s,cacheMisses:o,computedFiles:a}}catch{return null}},()=>({state:r,files:i,cacheHits:s,cacheMisses:o,computedFiles:a}))}function A(t){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:t}}function ut(t){try{let e=JSON.parse(t);return!Array.isArray(e)||!e.every(dt)?null:e}catch{return null}}function dt(t){if(!t||typeof t!="object")return!1;let e=t,n=e.location;return typeof e.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}import{readFileSync as ft}from"fs";import{join as q}from"path";var En=5e3,mt="watch.lock",gt="watch-state.json",yt="watch-activity.json";function Dn(t){return{lockPath:q(t,mt),statePath:q(t,gt),activityPath:q(t,yt)}}function Nn(t){try{return ht(JSON.parse(ft(t,"utf8")))}catch{return null}}function ht(t){if(!t||typeof t!="object")return null;let e=t;return e.version!==1||typeof e.protocolVersion!="number"||typeof e.pid!="number"||!Number.isInteger(e.pid)||e.pid<=0||typeof e.projectRoot!="string"||e.worktreeId!==void 0&&(typeof e.worktreeId!="string"||e.worktreeId.length===0)||typeof e.cliVersion!="string"||!y(e.startedAt)||!y(e.heartbeatAt)||!y(e.lastActivityAt)||!St(e.watcher)||e.idleDeadlineAt!==void 0&&!y(e.idleDeadlineAt)||e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration)||e.lastError!==void 0&&!bt(e.lastError)||e.lastRefresh!==void 0&&!jt(e.lastRefresh)||e.reindexActivity!==void 0&&!xt(e.reindexActivity)||e.typescriptSemantic!==void 0&&!Ft(e.typescriptSemantic)||e.typescriptIndex!==void 0&&!Pt(e.typescriptIndex)?null:e}function y(t){return typeof t=="string"&&Number.isFinite(Date.parse(t))}function St(t){if(!t||typeof t!="object"||!("state"in t))return!1;let e=t;switch(e.state){case"idle":return!0;case"waiting":return g(e.changedFiles)&&g(e.reindexAt);case"indexing":return g(e.startedAt);case"cooldown":return g(e.until)&&typeof e.dirty=="boolean";default:return!1}}function bt(t){if(!t||typeof t!="object")return!1;let e=t;return y(e.at)&&typeof e.message=="string"}function jt(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.trigger?.kind=="string"&&typeof e.result=="string"&&y(e.startedAt)&&y(e.completedAt)&&g(e.durationMs)}function xt(t){if(!t||typeof t!="object")return!1;let e=t;return!y(e.windowStartedAt)||!y(e.windowEndedAt)||!m(e.runs)||!m(e.rebuilt)||!m(e.reused)||!m(e.failed)||!m(e.suppressed)||!g(e.estimatedLogicalOutputBytes)||e.estimatedLogicalOutputBytes<0||!e.byTrigger||typeof e.byTrigger!="object"?!1:Object.values(e.byTrigger).every(n=>n===void 0||m(n))}function Ft(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&g(e.requests)&&g(e.sessionsCreated)&&g(e.sessionsReused)&&g(e.sessionsRefreshed)&&g(e.sessionsReplaced)&&g(e.projectsCreated)&&(e.lastRequestAt===void 0||y(e.lastRequestAt))&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||y(e.busyUntil))}function Pt(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&m(e.requests)&&m(e.sessionsCreated)&&m(e.sessionsReplaced)&&m(e.initializations)&&m(e.programUpdates)&&m(e.documentsEmitted)&&m(e.documentsRemoved)&&(e.lastRequestAt===void 0||y(e.lastRequestAt))&&(e.lastDurationMs===void 0||g(e.lastDurationMs)&&e.lastDurationMs>=0)&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||y(e.busyUntil))}function g(t){return typeof t=="number"&&Number.isFinite(t)}function m(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}export{At as a,Pe as b,_ as c,Et as d,Te as e,Dt as f,Nt as g,Ot as h,$t as i,z as j,ae as k,Ut as l,He as m,Ge as n,Xt as o,En as p,Dn as q,Nn as r,Ye as s,T as t,nt as u,rn as v,sn as w,hn as x,k as y,U as z,vn as A,kn as B,wn as C};
|
|
4
|
-
//# sourceMappingURL=chunk-2CTX5CMX.js.map
|
package/dist/chunk-2Y373BDD.js
DELETED
package/dist/chunk-C2QSK7E7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{statSync as c}from"fs";function o(t){let e=t.get("SELECT COUNT(*) as c FROM documents").c,s=t.get("SELECT COUNT(*) as c FROM global_symbols").c,n=t.get("SELECT COUNT(*) as c FROM mentions WHERE role = 1").c,i=t.get("SELECT COUNT(*) as c FROM mentions WHERE role != 1").c;return{documents:e,symbols:s,definitions:n,references:i,...r(t.config.dbPath)}}function r(t){try{let e=c(t);return{indexSizeBytes:e.size,lastBuilt:e.mtime}}catch{return{indexSizeBytes:0,lastBuilt:null}}}export{o as a};
|
|
2
|
-
//# sourceMappingURL=chunk-C2QSK7E7.js.map
|
package/dist/chunk-D4U5Q3FT.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import d from"process";import{existsSync as J,readFileSync as Re}from"fs";import{dirname as D,join as we,resolve as v,sep as be}from"path";import{fileURLToPath as Se}from"url";import{spawn as Z}from"child_process";var l=class extends Error{},h=class extends Error{constructor(r,n,i){super(`rust-analyzer LSP request ${n} failed: ${i}`);this.code=r}code},ee=3e4,g=class{constructor(e,r={}){this.transport=e;this.requestTimeoutMs=r.requestTimeoutMs??ee,this.configuration=r.configuration??{},this.transport.onData(n=>this.handleData(n)),this.transport.onClose((n,i)=>this.rejectPending(new Error(ae(n,i)))),this.transport.onError(n=>this.rejectPending(n))}transport;nextId=1;buffer=Buffer.alloc(0);pending=new Map;diagnosedUris=new Set;diagnosticWaiters=new Map;readinessWaiters=new Set;requestTimeoutMs;configuration;currentServerStatusGeneration=0;latestServerStatus=null;shutdownStarted=!1;async initialize(e,r={}){let n=e.capabilities??{},i=n.experimental&&typeof n.experimental=="object"&&!Array.isArray(n.experimental)?n.experimental:{},s=await this.request("initialize",{...e,capabilities:{...n,experimental:{...i,serverStatusNotification:!0}}},r);return this.notify("initialized",{}),s}async references(e,r={}){let n=await this.request("textDocument/references",e,r);return Array.isArray(n)?n:[]}async definition(e,r={}){let n=await this.request("textDocument/definition",e,r);return ne(n)}async prepareCallHierarchy(e,r={}){let n=await this.request("textDocument/prepareCallHierarchy",e,r);return Array.isArray(n)?n:[]}async outgoingCalls(e,r={}){let n=await this.request("callHierarchy/outgoingCalls",{item:e},r);return Array.isArray(n)?n:[]}async hover(e,r={}){let n=await this.request("textDocument/hover",e,r);return n&&typeof n=="object"?n:null}async readinessBarrier(e={}){try{await this.request("scip-query/readinessBarrier",null,e)}catch(r){if(r instanceof h&&r.code===-32601)return;throw r}}serverStatusGeneration(){return this.currentServerStatusGeneration}serverStatusSnapshot(){let e=this.latestServerStatus;return e?{generation:e.generation,status:{...e.status}}:null}waitForQuiescence(e,r){let n=this.latestServerStatus;if(n&&n.generation>e){if(n.status.health==="error")return Promise.reject(q());if(n.status.quiescent)return Promise.resolve(n.status)}return new Promise((i,s)=>{let u={afterGeneration:e,resolve:i,reject:s,timeout:setTimeout(()=>{this.readinessWaiters.delete(u),s(new Error(`rust-analyzer readiness timed out after ${r}ms`))},r)};this.readinessWaiters.add(u)})}didOpenTextDocument(e){this.notify("textDocument/didOpen",{textDocument:e})}waitForDiagnostics(e,r){return this.diagnosedUris.has(e)?Promise.resolve(!0):new Promise(n=>{let i=a=>{clearTimeout(s),n(a)},s=setTimeout(()=>{let a=this.diagnosticWaiters.get(e)?.filter(c=>c!==i);a&&a.length>0?this.diagnosticWaiters.set(e,a):this.diagnosticWaiters.delete(e),n(!1)},r),u=this.diagnosticWaiters.get(e)??[];u.push(i),this.diagnosticWaiters.set(e,u)})}async shutdown(e={}){if(!this.shutdownStarted){this.shutdownStarted=!0;try{await this.request("shutdown",null,e),this.notify("exit",null)}catch(r){throw this.notify("exit",null),this.transport.kill(),r}}}request(e,r,n={}){let i=R(n.timeoutMs??this.requestTimeoutMs,n.deadlineMs),s=this.nextId++,u={jsonrpc:"2.0",id:s,method:e,params:r};return new Promise((a,c)=>{let f=setTimeout(()=>{this.pending.delete(s),c(i.deadlineLimited?new l(`rust-analyzer readiness deadline expired during LSP request ${e}`):new Error(`rust-analyzer LSP request ${e} timed out after ${i.timeoutMs}ms`))},i.timeoutMs);this.pending.set(s,{method:e,deadlineMs:n.deadlineMs,resolve:y=>a(y),reject:c,timeout:f}),this.transport.write(z(u))})}notify(e,r){this.transport.write(z({jsonrpc:"2.0",method:e,params:r}))}handleData(e){for(this.buffer=Buffer.concat([this.buffer,e]);;){let r=this.buffer.indexOf(`\r
|
|
2
|
-
\r
|
|
3
|
-
`);if(r<0)return;let n=this.buffer.subarray(0,r).toString("ascii"),i=/(?:^|\r\n)Content-Length:\s*(\d+)/i.exec(n);if(!i){this.rejectPending(new Error("rust-analyzer LSP response missing Content-Length header"));return}let s=Number(i[1]),u=r+4,a=u+s;if(this.buffer.length<a)return;let c=this.buffer.subarray(u,a).toString("utf8");this.buffer=this.buffer.subarray(a),this.dispatchMessage(oe(c))}}dispatchMessage(e){if(this.recordDiagnosticNotification(e),this.recordServerStatusNotification(e),e.id!==void 0&&e.id!==null&&e.method){this.respondToServerRequest(e);return}if(e.id===void 0||e.id===null)return;let r=this.pending.get(e.id);if(r){if(clearTimeout(r.timeout),this.pending.delete(e.id),e.error){r.reject(new h(e.error.code,r.method,e.error.message));return}if(r.deadlineMs!==void 0&&Date.now()>=r.deadlineMs){r.reject(new l(`rust-analyzer readiness deadline expired during LSP request ${r.method}`));return}r.resolve(e.result)}}recordDiagnosticNotification(e){if(e.method!=="textDocument/publishDiagnostics")return;let r=e.params,n=r&&typeof r=="object"&&typeof r.uri=="string"?r.uri:null;if(!n)return;this.diagnosedUris.add(n);let i=this.diagnosticWaiters.get(n)??[];this.diagnosticWaiters.delete(n),i.forEach(s=>s(!0))}recordServerStatusNotification(e){if(e.method!=="experimental/serverStatus"||e.id!==void 0||!te(e.params))return;let r=e.params,n={health:r.health,quiescent:r.quiescent,...typeof r.message=="string"?{message:r.message}:{}},i=++this.currentServerStatusGeneration;if(this.latestServerStatus={generation:i,status:n},n.health==="error"){this.rejectReadinessWaiters(q());return}if(n.quiescent)for(let s of this.readinessWaiters)i<=s.afterGeneration||(clearTimeout(s.timeout),this.readinessWaiters.delete(s),s.resolve(n))}respondToServerRequest(e){if(e.id===void 0||e.id===null||!e.method)return;let r=e.method==="workspace/configuration"?this.workspaceConfiguration(e.params):null;this.transport.write(z({jsonrpc:"2.0",id:e.id,result:r}))}workspaceConfiguration(e){return(e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]).map(n=>typeof n.section=="string"?re(this.configuration,n.section):this.configuration)}rejectPending(e){for(let[r,n]of this.pending)clearTimeout(n.timeout),n.reject(e),this.pending.delete(r);this.rejectReadinessWaiters(e)}rejectReadinessWaiters(e){for(let r of this.readinessWaiters)clearTimeout(r.timeout),r.reject(e),this.readinessWaiters.delete(r)}};function R(t,e,r=Date.now){if(e===void 0)return{timeoutMs:t,deadlineLimited:!1};let n=e-r();if(n<=0)throw new l("rust-analyzer readiness deadline expired before LSP operation");return{timeoutMs:Math.min(t,n),deadlineLimited:n<=t}}function te(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return(e.health==="ok"||e.health==="warning"||e.health==="error")&&typeof e.quiescent=="boolean"&&(e.message===void 0||e.message===null||typeof e.message=="string")}function q(){return new l("rust-analyzer reported error health before reaching readiness")}function re(t,e){let r=e.startsWith("rust-analyzer.")?e.slice(14):e;if(r===""||r==="rust-analyzer")return t;let n=t;for(let i of r.split(".")){if(!n||typeof n!="object")return null;n=n[i]}return n??null}function ne(t){return t?(Array.isArray(t)?t:[t]).flatMap(r=>ie(r)?[r]:se(r)?[{uri:r.targetUri,range:r.targetSelectionRange}]:[]):[]}function ie(t){return!!(t&&typeof t=="object"&&typeof t.uri=="string")}function se(t){return!!(t&&typeof t=="object"&&typeof t.targetUri=="string")}function W(t,e,r=process.env){let n=Z(t,[],{cwd:e,env:r,stdio:["pipe","pipe","pipe"]});return{write(i){n.stdin.write(i)},onData(i){n.stdout.on("data",i)},onClose(i){n.on("close",i)},onError(i){n.on("error",i)},kill(){n.kill()}}}function z(t){let e=JSON.stringify(t);return`Content-Length: ${Buffer.byteLength(e,"utf8")}\r
|
|
4
|
-
\r
|
|
5
|
-
${e}`}function oe(t){let e=JSON.parse(t);if(!e||typeof e!="object")throw new Error("rust-analyzer LSP response was not a JSON object");return e}function ae(t,e){return`rust-analyzer LSP transport closed${e?` by ${e}`:t===null?"":` with code ${t}`}`}async function j(t,e,r,n=Date.now){let i=r-n();if(i<=0)throw new l("rust-analyzer readiness deadline expired before quiescence");try{let s=await t.waitForQuiescence(e,i);if(w(r,n,"during quiescence"),s.health==="error")throw new l("rust-analyzer reported error health before reaching readiness");if(!s.quiescent)throw new l("rust-analyzer did not report quiescence before reaching readiness");return s}catch(s){throw s instanceof l?s:new l(s instanceof Error?s.message:String(s))}}async function Ge(t,e,r,n,i,s=Date.now,u=x){let a=await j(t,e,n,s);if(r===0)return a;let c=t.serverStatusSnapshot();if(!c)throw new l("rust-analyzer status is unavailable after initial document open");return await ue(t,c,r,n,i,s,u)??a}async function ue(t,e,r,n,i,s=Date.now,u=x){if(r===0)return null;if(!e)throw new l("rust-analyzer status is unavailable before document open");E(e.status,"before document open");try{await t.readinessBarrier({deadlineMs:n}),w(n,s,"during post-open synchronization")}catch(f){throw f instanceof l?f:new l(f instanceof Error?f.message:String(f))}let a=t.serverStatusSnapshot();if(!a||a.generation<e.generation)throw new l("rust-analyzer status is unavailable after document open");let c;return a.generation===e.generation?(E(a.status,"after document open"),c=a.status):c=await j(t,e.generation,n,s),await P(i,n,s,u),c}async function Qe(t,e,r,n=Date.now){let i=R(e,r,n);await t(i.timeoutMs),w(r,n,"during diagnostics")}async function P(t,e,r=Date.now,n=x){if(t<=0)return;if(R(t,e,r).deadlineLimited)throw new l("rust-analyzer readiness deadline cannot accommodate delay");await n(t),w(e,r,"during delay")}async function Ke(t,e){try{return await t()}catch(r){throw r instanceof l&&await e(),r}}function Ve(t){return t instanceof l?{ok:!1,error:t.message}:null}function w(t,e,r){if(t-e()<=0)throw new l(`rust-analyzer readiness deadline expired ${r}`)}function E(t,e){if(t.health==="error")throw new l(`rust-analyzer reported error health ${e}`);if(!t.quiescent)throw new l(`rust-analyzer did not report quiescence ${e}`)}function x(t){return new Promise(e=>setTimeout(e,t))}import{existsSync as le,readFileSync as ce}from"fs";import{relative as fe,resolve as H,sep as de}from"path";import{fileURLToPath as pe,pathToFileURL as me}from"url";function b(t,e){return me(H(t,e)).href}function C(t,e){let r=pe(e);return fe(t,r).split(de).join("/")}function S(t,e,r){return{textDocument:{uri:b(t,e.relativePath)},position:ye(t,e),context:{includeDeclaration:r}}}function ye(t,e){let r={line:e.startLine,character:e.startChar??0},n=H(t,e.relativePath);if(!le(n))return r;try{return he(ce(n,"utf8"),e,r)}catch{return r}}function he(t,e,r={line:e.startLine,character:e.startChar??0}){let n=t.split(/\r?\n/),i=n[e.startLine];if(i===void 0||e.leaf.length===0)return r;let s=Math.max(0,Math.min(r.character,i.length)),u=i.indexOf(e.leaf,s);if(u>=0)return{line:e.startLine,character:A(u,e.leaf)};let a=i.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:A(a,e.leaf)};let c=ge(n,e.startLine,e.leaf);return c||r}function A(t,e){return t+Math.max(0,e.length-2)}function ge(t,e,r){for(let n of[-1,1,-2,2]){let i=e+n;if(i<0||i>=t.length)continue;let s=t[i].indexOf(r);if(s>=0)return{line:i,character:A(s,r)}}return null}function F(t,e){return e.map(r=>({file:C(t,r.uri),line:r.range.start.line,column:r.range.start.character}))}function $(t){let e=new Map;for(let r of t)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,n)=>{let i=r.file.localeCompare(n.file);return i!==0?i:r.line!==n.line?r.line-n.line:r.column-n.column})}async function ve(t){let e=t.includeReferences!==!1,r=t.includeCallees===!0,n=t.includeSignatures===!0,i={timeoutMs:t.requestTimeoutMs},s=Le(t),u=B(t),a=U(t),c=N(t),f=ke(t.projectRoot,s),y=Me(t.projectRoot,f),k=De(f),p=new g(W(t.rustAnalyzerBinary,y),{requestTimeoutMs:t.requestTimeoutMs,configuration:k});try{let L=await p.initialize({processId:d.pid,rootUri:b(y,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:k});if(e&&!L.capabilities.referencesProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/references support.",references:u.map(o=>[o.symbolId,[]]),...r?{callees:a.map(o=>[o.symbolId,[]])}:{}};if(r&&!L.capabilities.callHierarchyProvider)return{available:!1,reason:"rust-analyzer initialized without call hierarchy support.",references:u.map(o=>[o.symbolId,[]]),callees:a.map(o=>[o.symbolId,[]]),...n?{signatures:c.map(o=>[o.symbolId,null])}:{}};if(n&&!L.capabilities.hoverProvider)return{available:!1,reason:"rust-analyzer initialized without hover support.",references:u.map(o=>[o.symbolId,[]]),...r?{callees:a.map(o=>[o.symbolId,[]])}:{},signatures:c.map(o=>[o.symbolId,null])};let V=Ie(p,t.projectRoot,s);await Oe(p,V,t.diagnosticsTimeoutMs??1e4),await K(t.settleDelayMs??5e3);let I=e?await T(u,t.concurrency??8,async o=>{let O=await _(p,S(t.projectRoot,o,!1),{requestTimeoutMs:t.requestTimeoutMs,retryTimeoutMs:t.referenceRetryTimeoutMs});return{symbolId:o.symbolId,references:$(F(t.projectRoot,O.locations)),complete:O.complete}}):u.map(o=>({symbolId:o.symbolId,references:[],complete:!0})),X=r?await T(a,t.concurrency??8,async o=>({symbolId:o.symbolId,callees:await We(p,t.projectRoot,o,i)})):[],Y=n?await T(c,t.concurrency??8,async o=>({symbolId:o.symbolId,signature:await ze(p,t.projectRoot,o,i)})):[];return{available:!0,references:I.filter(o=>o.complete).map(o=>[o.symbolId,o.references]),incompleteReferenceSymbolIds:I.filter(o=>!o.complete).map(o=>o.symbolId),...r?{callees:X.map(o=>[o.symbolId,o.callees])}:{},...n?{signatures:Y.map(o=>[o.symbolId,o.signature])}:{}}}finally{await p.shutdown().catch(()=>{})}}function B(t){return t.referenceDefinitions??t.definitions}function U(t){return t.calleeDefinitions??t.definitions}function N(t){return t.signatureDefinitions??t.definitions}function Le(t){return[...t.includeReferences!==!1?B(t):[],...t.includeCallees===!0?U(t):[],...t.includeSignatures===!0?N(t):[]]}async function ze(t,e,r,n={}){let i=S(e,r,!1),s=await Pe(t,{textDocument:i.textDocument,position:i.position},n);return xe(s)}async function Pe(t,e,r={}){try{return await t.hover(e,r)}catch(n){if(m(n),!(n instanceof Error?n.message:String(n)).includes("content modified"))return null;await Q(r.deadlineMs);try{return await t.hover(e,r)}catch(s){return m(s),null}}}function xe(t){if(!t)return null;let e=Ae(t.contents),r=/```(?:rust)?\s*([\s\S]*?)```/i.exec(e),n=r?r[1]:e;for(let i of n.split(/\r?\n/)){let s=i.replace(/^`+|`+$/g,"").trim();if(s&&Te(s))return s}return null}function Ae(t){return typeof t=="string"?t:Array.isArray(t)?t.map(Ce).join(`
|
|
6
|
-
`):"value"in t?t.value:""}function Ce(t){return typeof t=="string"?t:t.value}function Te(t){return/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?(?:unsafe\s+)?(?:extern\s+(?:"[^"]+"\s+)?)?(?:fn|struct|enum|trait|type|const|static|mod)\b/.test(t)}function De(t){return{...t.length>0?{linkedProjects:t}:{},references:{excludeImports:!1,excludeTests:!1}}}function Me(t,e){return e.length===1?D(e[0]):v(t)}function ke(t,e){let r=v(t),n=[],i=new Set;for(let s of e){let u=D(v(r,s.relativePath));for(;$e(r,u);){let a=we(u,"Cargo.toml");if(J(a)){i.has(a)||(i.add(a),n.push(a));break}let c=D(u);if(c===u)break;u=c}}return n}function Ie(t,e,r){let n=new Set,i=[];for(let s of r){if(n.has(s.relativePath))continue;n.add(s.relativePath);let u=v(e,s.relativePath);if(!J(u))continue;let a=b(e,s.relativePath);t.didOpenTextDocument({uri:a,languageId:"rust",version:1,text:Re(u,"utf8")}),i.push(a)}return i}async function Oe(t,e,r){await Promise.all(e.map(n=>t.waitForDiagnostics(n,r).catch(()=>!1)))}async function lt(t,e){return(await _(t,e)).locations}async function _(t,e,r={}){try{return{locations:await t.references(e,{timeoutMs:r.requestTimeoutMs,deadlineMs:r.deadlineMs}),complete:!0}}catch(n){m(n);let i=n instanceof Error?n.message:String(n);if(M(n))return qe(t,e,r);if(!i.includes("content modified"))return{locations:[],complete:!0};await Q(r.deadlineMs);try{return{locations:await t.references(e,G(r)),complete:!0}}catch(s){return m(s),{locations:[],complete:!M(s)}}}}async function qe(t,e,r){if(!r.retryTimeoutMs||r.retryTimeoutMs<=0)return{locations:[],complete:!1};let n=G(r);try{return{locations:await t.references(e,n),complete:!0}}catch(i){return m(i),{locations:[],complete:!M(i)}}}function G(t){return{...t.retryTimeoutMs&&t.retryTimeoutMs>0?{timeoutMs:t.retryTimeoutMs}:{},...t.deadlineMs!==void 0?{deadlineMs:t.deadlineMs}:{}}}function M(t){let e=t instanceof Error?t.message:String(t);return e.includes("rust-analyzer LSP request")&&e.includes("timed out after")}async function We(t,e,r,n={}){let i=S(e,r,!1),s=await Ee(t,{textDocument:i.textDocument,position:i.position},n),u=(await Promise.all(s.map(a=>je(t,a,n)))).flat();return Fe(He(e,u))}async function Ee(t,e,r={}){try{return await t.prepareCallHierarchy(e,r)}catch(n){return m(n),[]}}async function je(t,e,r={}){try{return await t.outgoingCalls(e,r)}catch(n){return m(n),[]}}async function Q(t){if(t===void 0){await K(1e3);return}await P(1e3,t)}function m(t){if(t instanceof l)throw t}function He(t,e){return e.map(r=>({symbol:r.to.name,file:C(t,r.to.uri),line:r.to.selectionRange.start.line}))}function Fe(t){let e=new Set,r=[];for(let n of t){let i=`${n.symbol}\0${n.file}\0${n.line}`;e.has(i)||(e.add(i),r.push(n))}return r.sort((n,i)=>n.file.localeCompare(i.file)||n.line-i.line||n.symbol.localeCompare(i.symbol))}function K(t){return t<=0?Promise.resolve():new Promise(e=>setTimeout(e,t))}function $e(t,e){return e===t||e.startsWith(`${t}${be}`)}async function T(t,e,r){let n=new Array(t.length),i=0,s=Math.max(1,Math.min(t.length,Math.floor(e)));return await Promise.all(Array.from({length:s},async()=>{for(;i<t.length;){let u=i++;n[u]=await r(t[u])}})),n}async function Je(){return new Promise((t,e)=>{let r=[];d.stdin.on("data",n=>r.push(n)),d.stdin.on("error",e),d.stdin.on("end",()=>t(Buffer.concat(r).toString("utf8")))})}async function Be(){try{let t=JSON.parse(await Je()),e=await ve(t);d.stdout.write(JSON.stringify(e))}catch(t){let e={available:!1,reason:t instanceof Error?t.message:String(t),references:[]};d.stdout.write(JSON.stringify(e)),d.exitCode=1}}d.argv[1]&&Se(import.meta.url)===d.argv[1]&&Be();export{g as a,W as b,Ge as c,ue as d,Qe as e,Ke as f,Ve as g,b as h,C as i,S as j,F as k,$ as l,ve as m,B as n,U as o,N as p,Le as q,ze as r,Pe as s,xe as t,De as u,Me as v,ke as w,Ie as x,Oe as y,lt as z,_ as A,We as B,K as C,T as D};
|
|
7
|
-
//# sourceMappingURL=chunk-D4U5Q3FT.js.map
|
package/dist/chunk-K2ERX4UT.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as le}from"./chunk-4SALD7RU.js";import{c as T}from"./chunk-NH5ALKPW.js";import{b as Q,e as ee,f as te,g as ne}from"./chunk-Q3AFUTGB.js";import{b as ce}from"./chunk-B75HZHUP.js";import{b as P}from"./chunk-UOAV44HR.js";import{h as oe,n as N}from"./chunk-LBMJEAEW.js";import{a as ie,b as re,c as se,m as ae}from"./chunk-U7DSEKOM.js";import{B as E,d as $,e as J,g as K,h as q,i as G,j as V,k as X,w as Y}from"./chunk-XYADIZHU.js";import{p as Z}from"./chunk-X6D5IC6I.js";import{B as H,E as x,c as w}from"./chunk-YGAGTIDK.js";import{b as L,h as U,s as b,v as j,x as W,y as I,z}from"./chunk-L7SPDE73.js";import{a as S}from"./chunk-64MNV6AB.js";var _=new WeakMap,ue=j({kind:"definition-exclusions",invalidation:W("definition-exclusions"),serialize:e=>JSON.stringify(e),deserialize:Ie});function fe(e,t){let n=H(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let r=I(e,t);if(!r)return[];let o=U(e,t,r),c=ue.read(e,t,o);if(c)return c;let u=n==="rust"?Oe(e,t):ke(e,t);return ue.write(e,t,o,u),u}function Ie(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.map(Pe);return n.some(i=>i===null)?null:n}catch{return null}}function Pe(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"||t.containerName!==void 0&&typeof t.containerName!="string")return null;let n=t.disposition===void 0?Ge(t.reason):t.disposition;return n!=="exclude"&&n!=="implicit-usage"?null:{startLine:t.startLine,endLine:t.endLine,reason:t.reason,disposition:n,...t.containerName?{containerName:t.containerName}:{}}}var me=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),Ne=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,Te=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function ke(e,t){let n=I(e,t);if(!n||!Ae(n))return[];let i=x(e,t);if(!i)return[];let r=_.get(i);if(r)return r;let o=!1,c=i.rootNode;for(let l of c.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let s=d.namedChild(0);if(!s)continue;let a=s.type==="member_expression"?s.namedChild(s.namedChildCount-1)?.text:s.text;if(a&&me.has(a)){o=!0;break}}let u=[];o&&u.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)",disposition:"exclude"});for(let l of c.namedChildren){let d=null,s=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,s=l;else if(l.type==="export_statement"){let a=l.namedChild(0);a?.type==="function_declaration"&&(d=a.namedChild(0)?.text??null,s=a)}else if(l.type==="lexical_declaration"){let a=l.namedChild(0);if(a?.type==="variable_declarator"){let m=a.namedChild(0)?.text,p=a.namedChild(1);m&&(p?.type==="arrow_function"||p?.type==="function_expression")&&(d=m,s=a)}}d&&/^use[A-Z]/.test(d)&&s&&u.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:"React custom hook (use*)",disposition:"exclude"})}return u.push(...pe(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),_.set(i,u),u}function Ae(e){if(e.includes("scip-query"))return!0;let t=!1;for(let n of me)if(e.includes(n)){t=!0;break}return t&&Ne.test(e)?!0:e.includes("use")&&Te.test(e)}var Fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function Me(e){return Fe.test(e)}function pe(e,t,n){let i=[],r=o=>{if(t.has(o.type)&&o.parent){let u=o.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===o.startIndex&&u[d].type===o.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let s=u[d];if(n.has(s.type)){if(Me(s.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment",disposition:"exclude"});break}continue}if(!(s.type==="attribute_item"||s.type==="inner_attribute_item"))break}}for(let c of o.namedChildren)r(c)};return r(e.rootNode),i}function Oe(e,t){let n=x(e,t);if(!n)return[];let i=_.get(n);if(i)return i;let r=[],o=Be(n);return o?(_.set(n,o),o):(ye(n.rootNode,r,!1,!1),r.push(...pe(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...Ke(n.rootNode)),_.set(n,r),r)}function Be(e){return Ve(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)",disposition:"exclude"}]:null}function ye(e,t,n,i){let r=n,o=i;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)",disposition:"implicit-usage"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)",disposition:"implicit-usage"})),e.type==="function_item"||e.type==="function_signature_item"?Ue(e,t,n,i):i&&Je(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)",disposition:"implicit-usage"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?je(e,t,n):e.type==="mod_item"&&k(e).some(c=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(c))&&(r=!0);for(let c of e.namedChildren)ye(c,t,r,o)}function Ue(e,t,n,i){let r=k(e),o=null;i?o={reason:"trait impl method (dynamic dispatch)",disposition:"implicit-usage"}:n&&(o={reason:"inside #[cfg(test)] mod",disposition:"exclude"});for(let c of r){if(be(c)){o={reason:"#[allow(dead_code)]",disposition:"exclude"};break}let u=Ze(c);if(u){o=u;break}}o&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o.reason,disposition:o.disposition})}function je(e,t,n){let i=k(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some($e)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(...)] - generated impl may access fields",disposition:"implicit-usage",containerName:r}),i.some(be)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",disposition:"exclude",containerName:r}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",disposition:"exclude",containerName:r})}function k(e){let t=e.parent;if(!t)return[];let n=t.children,i=-1;for(let o=0;o<n.length;o+=1)if(n[o].startIndex===e.startIndex&&n[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let c=n[o];if(c.type==="attribute_item"||c.type==="inner_attribute_item")r.push(c.text);else{if(c.type==="line_comment"||c.type==="block_comment")continue;break}}return r}var We=new Set(["test","bench","tokio::test","async_std::test"]),ze=new Set(["no_mangle","export_name","link_name","used","macro_export","proc_macro","proc_macro_derive","proc_macro_attribute"]),He=new Set(["allow","warn","deny","forbid","cfg","cfg_attr","doc","inline","cold","must_use","deprecated","repr","derive","automatically_derived","non_exhaustive","path","link","link_section","global_allocator","panic_handler"]);function Ze(e){if(/#\[\s*cfg\s*\(\s*test\s*\)/.test(e))return{reason:"#[cfg(test)]",disposition:"exclude"};let t=qe(e);return t?We.has(t)?{reason:`#[${t}]`,disposition:"exclude"}:ze.has(t)?{reason:`Rust ABI/export attribute #[${t}]`,disposition:"implicit-usage"}:He.has(t)?null:{reason:`Rust attribute macro #[${t}]`,disposition:"implicit-usage"}:null}function $e(e){return/#\[\s*derive\s*\(/.test(e)}function be(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function Je(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ke(e){let t=Xe(e);if(t.size===0)return[];let n=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&t.has(r)&&n.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'attribute `with = "..."` module - body may be invoked via reflection',disposition:"implicit-usage",containerName:r})}return n}function qe(e){let t=/^#!?\[\s*([A-Za-z_][A-Za-z0-9_]*(?:\s*::\s*[A-Za-z_][A-Za-z0-9_]*)*)/.exec(e);return t?t[1].replace(/\s+/g,""):null}function Ge(e){return e==="#[tauri::command]"||e==="#[command]"||e==="#[wasm_bindgen]"||e==="#[no_mangle]"||e==="#[napi]"||e==="#[pyfunction]"||e==="#[pymethod]"||e==="#[pyo3]"||e==="#[doc(hidden)]"||e.startsWith("trait ")||e.startsWith("#[derive(<reflective>)]")||e.startsWith("#[derive(...)]")||e.startsWith('serde `with = "')||e.startsWith('attribute `with = "')||e.startsWith("Rust attribute macro #[")||e.startsWith("Rust ABI/export attribute #[")?"implicit-usage":"exclude"}function Ve(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var de=/\bwith\s*=\s*"([^"]+)"/g;function Xe(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){de.lastIndex=0;let i;for(;(i=de.exec(n.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&t.add(o)}}return t}function ge(e){let t=A(e);return(n,i,r,o)=>t(n,i,r,o)?.disposition==="exclude"}function A(e){let t=new Map,n=i=>{let r=t.get(i);if(r)return r;let o=fe(e,i),c=new Map;for(let u of o){if(!u.containerName)continue;let l=c.get(u.containerName)??[];l.push(u),c.set(u.containerName,l)}return r={ranges:o,containers:c},t.set(i,r),r};return(i,r,o,c)=>{let u=n(i),l=[];for(let s of u.ranges)r>=s.startLine&&r<=s.endLine&&l.push(s);let d=new Set;c&&d.add(c);for(let s of E(o))d.add(s);for(let s of d){let a=u.containers.get(s);a&&l.push(...a)}return Ye(l)}}function Ye(e){if(e.length===0)return null;let n=e.find(i=>i.disposition==="exclude")??e[0];return{disposition:n.disposition,reason:n.reason}}function vt(e,t={}){L(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function he(e,t,n={}){L(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function xe(e,t){if(t.isIgnoredPath(e.relativePath))return y("ignored-file");if(G(e.symbol))return y("module-like-symbol");if(!R(e.symbol))return y("non-value-symbol");if(!e.isFunctionLike&&e.enclosingSymbol&&R(e.enclosingSymbol))return y("nested-non-callable-value");if(!t.includeTests&&!Qe(e.relativePath))return y("test-file");if(!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName))return y("excluded-file-region");let n=J(e.symbol);if(n==="<constructor>")return y("implicit-constructor");if(e.symbol.startsWith("scip-python ")){if(n==="__all__")return y("python-runtime-metadata");if(/^__[^_].*__$/.test(n))return y("python-protocol-member")}return t.isDeclarationOnlyCallable()?y("declaration-only-callable"):t.isFrameworkContractCallable()?y("framework-contract-member"):V(e.symbol)?y("rust-trait-impl-member"):X(e.symbol)?y("rust-test-module"):!t.includeMembers&&!et(e)?y("member"):e.endLine-e.startLine+1<t.minLoc?y("below-min-loc"):{accepted:!0}}function Qe(e){return Q(e)!=="test"}function y(e){return{accepted:!1,rejectionReason:e}}function R(e){return q(e)||e.endsWith("().")||e.endsWith(".")}function et(e){return K(e.symbol)||E(e.symbol).length===0}function _e(){return new Map}function Se(e,t,n){let i=new Map;for(let r of ie(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||v(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function Ee(e,t,n,i={}){let r=new Set;if(i.conservative||n.size===0){for(let o of se(e,t))r.add(o.symbol_id);return r}for(let o of re(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||r.add(o.symbol_id);return r}function F(e,t){let n=e.get(t);if(!n)return!1;for(let i of n.values())if(i.occurrences>0)return!0;return!1}function C(e,t,n){let i=e.get(t);if(!i)return!1;for(let[r,o]of i)if(r!==n&&o.occurrences>0)return!0;return!1}function Re(e){return e?.occurrences??0}function v(e,t,n,i,r="source-fallback"){if(i<=0)return;let o=ve(e,t,n);o.occurrences+=i,o.sources.add(r)}function Ce(e,t,n,i,r){if(i<=0)return;let o=ve(e,t,n);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function ve(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));let r=i.get(n);return r||(r={occurrences:0,sources:new Set},i.set(n,r)),r}var tt=1e3,nt=300;function Qt(e,t={}){let{scope:n,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:c=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,s=0,a=b("dead.candidates",()=>{let f=ce(it(e,{scope:n,minLoc:i,includeTests:r,includeMembers:c}),l);return s=f.length,f},()=>({definitions:s})),m=0,p=o?b("dead.inactive-barrels",()=>{let f=new Set(ee(e));return m=f.size,f},()=>({paths:m})):new Set,M=0,g=u?_e():b("dead.mention-reference-counts",()=>{let f=Se(e,p,a.map(D=>D.symbolId));return M=f.size,f},()=>({definitions:a.length,symbolsWithReferences:M})),O=0,Le=u?b("dead.mentioned-symbol-ids",()=>{let f=Ee(e,a.map(D=>D.symbolId),p,{conservative:p.size===0});return O=f.size,f},()=>({definitions:a.length,referencedSymbols:O})):new Set,h=u?a.filter(f=>!Le.has(f.symbolId)):a.filter(f=>!C(g,f.symbolId,f.relativePath));u?b("dead.source-fallback.dead-code-only",()=>ut(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0})):b("dead.source-fallback.ast",()=>lt(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0}));let B=u?h.filter(f=>!F(g,f.symbolId)):h.filter(f=>!C(g,f.symbolId,f.relativePath));b("dead.caller-map-supplement",()=>yt(e,B,g,{inactiveBarrelPaths:p,includeSemantic:!u&&d}),()=>({definitions:B.length,semantic:!u&&d}));let we=u?h.filter(f=>!F(g,f.symbolId)):a;return ct(e,ot(we,g))}function it(e,t){let n=ge(e),i=[];for(let r of Y(e,{scope:t.scope,symbolMatches:R,sqlPrefilter:"function-like"}))xe(r,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:n,isDeclarationOnlyCallable:()=>st(e,r),isFrameworkContractCallable:()=>le(e,r)}).accepted&&i.push(r);return i}var rt=["method_signature","abstract_method_signature","call_signature","construct_signature"];function st(e,t){if(!t.parentTypeName||!/\.[cm]?[jt]sx?$/.test(t.relativePath))return!1;let n=x(e,t.relativePath);if(n)return n.rootNode.descendantsOfType([...rt]).some(r=>r.startPosition.row<=t.startLine&&r.endPosition.row>=t.endLine);let i=z(e,t.relativePath).slice(t.startLine,t.endLine+1).join(`
|
|
2
|
-
`).trim();return i.endsWith(";")&&!i.includes("=>")&&!i.includes("{")}function ot(e,t){return e.map(n=>at(n,t)).filter(n=>n.cross_file_refs===0).sort((n,i)=>i.loc-n.loc||n.relative_path.localeCompare(i.relative_path)||n.start_line-i.start_line)}function at(e,t){let n=t.get(e.symbolId)??new Map,i=Re(n.get(e.relativePath)),r=0;for(let[o,c]of n)o!==e.relativePath&&(r+=c.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,parent_type_name:e.parentTypeName,same_file_refs:i,cross_file_refs:r}}function ct(e,t){let n=A(e),i=[],r=0,o=0,c=0,u=0,l=0,d=0;for(let s of t){if(e.isIgnored(s.relative_path))continue;if(te(e,s.relative_path)){u++;continue}if(ne(e,s.symbol,s.relative_path)){l++;continue}let a=n(s.relative_path,s.start_line,s.symbol,s.parent_type_name),m=a?.disposition==="implicit-usage"?a.reason:void 0,p=m?"implicit-usage":s.same_file_refs===0?"dead-code":"file-internal";p==="dead-code"?r++:p==="file-internal"?o++:c++,d+=s.loc,i.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:$(s.symbol),sameFileRefs:s.same_file_refs,kind:p,...m?{implicitUsageReason:m}:{}})}return{symbols:i,counts:{total:i.length,deadCode:r,fileInternal:o,implicitUsage:c,loc:d},applicability:{entrySurfaceExcluded:u,externalRootExcluded:l,implicitUsageSignals:c},totalCount:i.length,deadCodeCount:r,fileInternalCount:o,implicitUsageCount:c,totalLoc:d}}function lt(e,t,n,i){if(t.length===0)return;let r=new T(e),o=new Set(t.map(l=>l.symbolId)),c=new Set(t.map(l=>l.leaf).filter(Boolean)),u=new Set(r.sourceFiles());for(let l of S(e))u.add(l);r.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:l=>i.inactiveBarrelPaths.has(l)},l=>{o.has(l.target.symbolId)&&(mt(e,l)||v(n,l.target.symbolId,l.sourceFile,pt(l),"source-fallback"))})}function ut(e,t,n,i){if(t.length===0)return;let r=new T(e),o=dt(t),c=new Set(r.sourceFiles());for(let s of S(e))c.add(s);let u=new Set(o.keys()),l=new Map,d=s=>{let a=l.get(s);return a||(a=oe(e,s),l.set(s,a)),a};r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:s=>i.inactiveBarrelPaths.has(s),resolveTargets:({sourceFile:s,name:a,kind:m})=>{let p=o.get(a);return p?ft(s,a,p,()=>d(s),{permissive:m!=="cross-language-dispatch"}):[]},afterPath:s=>{l.delete(s),he(e,s)}},s=>{let a=s.kind==="identifier"&&s.sourceFile===s.target.relativePath?Math.max(0,s.occurrences-1):s.occurrences;s.kind==="identifier"&&De(e,{sourceFile:s.sourceFile,name:s.name,target:s.target,occurrences:a})||v(n,s.target.symbolId,s.sourceFile,a,"source-fallback")})}function dt(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let i=t.get(n.leaf)??[];i.push(n),t.set(n.leaf,i)}return t}function ft(e,t,n,i,r){let o=n.filter(d=>d.relativePath===e);if(o.length>0)return o;if(!r.permissive&&n.length===1)return[...n];let c=i(),u=c.get(t);if(u)for(let d of u){let s=n.filter(a=>w(d,a.relativePath));if(s.length>0)return s}let l=new Set;for(let d of c.values())for(let s of d)l.add(s);for(let d of l){let s=n.filter(a=>w(d,a.relativePath));if(s.length>0&&s.length===n.length)return s}return r.permissive?[...n]:[]}function mt(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&De(e,t)}function pt(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function De(e,t){return t.occurrences>1?!1:Z(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function yt(e,t,n,i){let r=i.includeSemantic!==!1,o=r&&t.length>=tt&&S(e).length>=nt,c=(s,a)=>{a===s.relativePath||e.isIgnored(a)||i.inactiveBarrelPaths.has(a)||Ce(n,s.symbolId,a,1,"caller-map")};if(o?b("dead.caller-map.per-symbol-non-semantic",()=>{for(let s of t){let a=P(e,s,{semantic:!1,semanticEvidence:N});for(let m of a)c(s,m.file)}},()=>({definitions:t.length,semantic:!1})):b("dead.caller-map.per-symbol",()=>{for(let s of t){let a=P(e,s,{semantic:r,semanticEvidence:N});if(a.length!==0)for(let m of a)c(s,m.file)}},()=>({definitions:t.length,semantic:r})),!o)return;let u=0,l=b("dead.caller-map.semantic-candidates",()=>{let s=t.filter(a=>!C(n,a.symbolId,a.relativePath));return u=s.length,s},()=>({definitions:t.length,semanticCandidates:u}));if(l.length===0)return;let d=ae(e,l);for(let s of l){let a=d.get(s.symbolId);if(a)for(let m of a)c(s,m)}}export{vt as a,Qt as b};
|
|
3
|
-
//# sourceMappingURL=chunk-K2ERX4UT.js.map
|
package/dist/chunk-KHE7J5ZN.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
function m(e){try{return process.kill(e,0),!0}catch(n){return typeof n=="object"&&n!==null&&"code"in n&&n.code==="EPERM"}}import{mkdirSync as t,renameSync as c,writeFileSync as s}from"fs";import{dirname as l}from"path";function d(e,n,r={}){t(l(e),{recursive:!0});let o=`${e}.${process.pid}.${Date.now()}.tmp`,i=JSON.stringify(n,null,r.spacing);s(o,r.trailingNewline?`${i}
|
|
2
|
-
`:i),c(o,e)}export{m as a,d as b};
|
|
3
|
-
//# sourceMappingURL=chunk-KHE7J5ZN.js.map
|
package/dist/chunk-L7SPDE73.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var k=[];function _(e){e.groups.length>0&&k.push(e)}function Ie(e,t){let n=new Set(t.groups);for(let i of k)i.groups.some(r=>n.has(r))&&(t.file!==void 0&&i.clearFile?i.clearFile(e,t.file):i.clearAll(e))}function A(){let e=new WeakMap;return{cache:e,ensure(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}}}function E(e,t){let{cache:n,ensure:i}=A(),r={get(a,s,o){let c=i(a);if(c.has(s))return c.get(s);let d=o();return c.set(s,d),d},invalidate(a,s){n.get(a)?.delete(s)},invalidateAll(a){n.delete(a)},size(a){return n.get(a)?.size??0}};return _({name:e,groups:t.clearGroups,clearAll:a=>r.invalidateAll(a),clearFile:(a,s)=>r.invalidate(a,s)}),r}function xe(e,t){let n=new WeakMap,i={get(r,a){let s=n.get(r);if(s)return s.value;let o=a();return n.set(r,{value:o}),o},invalidate(r){n.delete(r)},has(r){return n.has(r)}};return _({name:e,groups:t.clearGroups,clearAll:r=>i.invalidate(r)}),i}var ie={clearGroups:["whole-project","source-file"]};function Me(e){return ae(e,ie)}function ae(e,t){let{cache:n,ensure:i}=A(),r={get(a,s,o,c){let d=i(a),C=d.get(s);if(C&&C.source===o)return C.value;let I=c();return d.set(s,{source:o,value:I}),I},invalidate(a,s){n.get(a)?.delete(s)},invalidateAll(a){n.delete(a)}};return _({name:e,groups:t.clearGroups,clearAll:a=>r.invalidateAll(a),clearFile:(a,s)=>r.invalidate(a,s)}),r}import{createHash as se}from"crypto";import{existsSync as Ue,mkdirSync as oe,readFileSync as ce}from"fs";import{dirname as R,join as x}from"path";import M from"better-sqlite3";var de="evidence.db";var le=["source-facts","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],b=new Set(le);var Ye=512*1024*1024;var T=new WeakMap,pe=E("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),ue=E("evidence-project-fingerprint",{clearGroups:["whole-project"]}),p="evidence-v1",h="version NOT LIKE 'evidence-%'";function j(e){return se("sha256").update(e).digest("hex")}function Be(e,t,n){return pe.get(e,t,()=>j(n))}function V(e){return ue.get(e,"current",()=>{try{let t=JSON.parse(ce(x(R(e.config.dbPath),"meta.json"),"utf-8"));if(t.version!==2&&t.version!==3||t.status!=="complete"&&t.status!=="partial"||t.fingerprint===void 0)return null;let n=Array.isArray(t.indexedLanguages)?[...t.indexedLanguages].sort():[];return j(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:n,status:t.status}))}catch(t){return m("project fingerprint unavailable",t),null}})}function m(e,t){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${e}: ${t instanceof Error?t.message:String(t)}`)}function u(e){if(T.has(e))return T.get(e)??null;let t=null;try{let n=new M(x(R(e.config.dbPath),de));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
|
-
`),t={evidence:n,shared:ge(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
|
|
45
|
-
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${h}
|
|
46
|
-
ORDER BY version DESC
|
|
47
|
-
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
|
|
48
|
-
WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${h}
|
|
49
|
-
ORDER BY version DESC
|
|
50
|
-
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
|
|
51
|
-
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:n.prepare(`SELECT payload FROM semantic_callees
|
|
52
|
-
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${h}
|
|
53
|
-
ORDER BY version DESC
|
|
54
|
-
LIMIT 1`),readCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
|
|
55
|
-
WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
|
|
56
|
-
WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${h}
|
|
57
|
-
ORDER BY symbol, version DESC`),writeCallees:n.prepare(`INSERT OR REPLACE INTO semantic_callees
|
|
58
|
-
(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
|
|
59
|
-
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:n.prepare(`SELECT payload FROM semantic_references
|
|
60
|
-
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${h}
|
|
61
|
-
ORDER BY version DESC
|
|
62
|
-
LIMIT 1`),readReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
|
|
63
|
-
WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
|
|
64
|
-
WHERE relative_path = ? AND project_fingerprint = ? AND ${h}
|
|
65
|
-
ORDER BY symbol, version DESC`),writeReferences:n.prepare(`INSERT OR REPLACE INTO semantic_references
|
|
66
|
-
(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"),deleteFindingOutcomeLedgerForCheck:n.prepare("DELETE FROM finding_outcome_ledger WHERE check_name = ?"),writeFindingOutcomeLedgerRow:n.prepare(`INSERT INTO finding_outcome_ledger
|
|
67
|
-
(check_name, finding_id, first_seen, last_seen, times_shown, outcome) VALUES (?, ?, ?, ?, ?, ?)`)}}catch(n){m("disabled (open failed)",n)}return T.set(e,t),t}function g(e,t,n){m(`disabled (${t})`,n),T.set(e,null)}function ge(e){if(!e)return null;try{oe(R(e),{recursive:!0});let t=new M(e);return t.pragma("journal_mode = WAL"),t.pragma("busy_timeout = 250"),t.pragma("synchronous = NORMAL"),t.exec(`
|
|
68
|
-
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
69
|
-
kind TEXT NOT NULL,
|
|
70
|
-
relative_path TEXT NOT NULL,
|
|
71
|
-
content_hash TEXT NOT NULL,
|
|
72
|
-
version TEXT NOT NULL,
|
|
73
|
-
payload TEXT NOT NULL,
|
|
74
|
-
last_accessed_at INTEGER NOT NULL,
|
|
75
|
-
PRIMARY KEY (kind, relative_path, content_hash, version)
|
|
76
|
-
);
|
|
77
|
-
`),{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)
|
|
78
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
79
|
-
ON CONFLICT(kind, relative_path, content_hash, version)
|
|
80
|
-
DO UPDATE SET payload = excluded.payload, last_accessed_at = excluded.last_accessed_at`)}}catch(t){return m("shared cache disabled (open failed)",t),null}}function P(e,t,n){m(`shared cache disabled (${t})`,n);try{e.shared?.evidence.close()}catch{}e.shared=null}function K(e,t,n,i){let r=u(e);if(!r)return null;try{let a=r.readFileEvidence.get(t,n,i,p)??r.readLegacyFileEvidence.get(t,n,i);if(a?.payload!==void 0)return a.payload;if(!b.has(t)||!r.shared)return null;try{return r.shared.readFileEvidence.get(t,n,i,p)?.payload??null}catch(s){return P(r,"file_evidence read",s),null}}catch(a){return g(e,"file_evidence read",a),null}}function U(e,t,n,i,r){let a=u(e);if(a)try{if(a.writeFileEvidence.run(t,n,i,p,r),b.has(t)&&a.shared)try{a.shared.writeFileEvidence.run(t,n,i,p,r,Date.now())}catch(s){P(a,"file_evidence write",s)}}catch(s){g(e,"file_evidence write",s)}}function H(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=>b.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){P(n,"file_evidence batch write",r)}}catch(i){g(e,"file_evidence batch write",i)}}function W(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(a){return g(e,"project_evidence read",a),null}}function X(e,t,n,i,r){let a=u(e);if(a)try{a.writeProjectEvidence.run(t,n,i,p,r)}catch(s){g(e,"project_evidence write",s)}}function $e(e,t,n,i){let r=u(e);if(!r)return new Map;try{let a=r.readCalleesForFile.all(t,n,i,p),s=r.readLegacyCalleesForFile.all(t,n,i);return Y([...s,...a])}catch(a){return g(e,"semantic_callees bulk read",a),new Map}}function Ge(e,t,n){let i=u(e);if(!i)return new Map;try{let r=i.readReferencesForFile.all(t,n,p),a=i.readLegacyReferencesForFile.all(t,n);return Y([...a,...r])}catch(r){return g(e,"semantic_references bulk read",r),new Map}}function Y(e){let t=new Map;for(let n of e)t.set(n.symbol,n.payload);return t}function ze(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 a=`${r.relativePath}\0${r.contentHash}`;i.has(a)||(i.add(a),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 Je(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 a=`${r.relativePath}\0${r.projectFingerprint}`;i.has(a)||(i.add(a),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 Qe(e){let t=u(e);if(!t)return[];try{return t.readFindingOutcomeLedger.all().map(i=>({check:i.check_name,findingId:i.finding_id,firstSeen:i.first_seen,lastSeen:i.last_seen,timesShown:i.times_shown,outcome:i.outcome}))}catch(n){return g(e,"finding_outcome_ledger read",n),[]}}function Ze(e){return typeof e=="object"&&e!==null}function et(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}import{appendFileSync as fe,mkdirSync as Ee}from"fs";import{createHash as he,randomUUID as ve}from"crypto";import{dirname as me}from"path";import{performance as v}from"perf_hooks";var z="SCIP_QUERY_PROFILE",J="SCIP_QUERY_PROFILE_OUT",Q="SCIP_QUERY_PROFILE_COMMAND",q="SCIP_QUERY_PROFILE_CACHE_STATE",O="SCIP_QUERY_PROFILE_RUN_ID",w="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY",L="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND",Z=[z,J,Q,q,O,w,L],st=new Set(Z),B=new Set,$=new Map,G=!1;function f(){let e=process.env[z];return e==="1"||e==="true"}function ye(){return process.env[J]}function ee(){return process.env[Q]}function _e(){return process.env[q]}function te(){let e=process.env[O];if(e)return e;if(!f())return;let t=ve();return process.env[O]=t,t}function ne(){return process.env[w]}function Te(e){let t=ne();if(t)return t;if(!f())return;let n=te();if(!n)return;let i=e.projectFingerprint?"published-project":"run-only",r=y(["profile-workload-v1",e.toolVersion,e.command,e.projectFingerprint??n]);return process.env[w]=r,process.env[L]=i,r}function y(e){return he("sha256").update(JSON.stringify(e)).digest("hex").slice(0,24)}function ot(){return Object.fromEntries(Z.flatMap(e=>{let t=process.env[e];return t===void 0?[]:[[e,t]]}))}function F(e,t,n){if(!f())return t();let i=v.now();try{let r=t();return S({type:"span",name:e,durationMs:Math.round(v.now()-i),ok:!0,...D(n)??{}}),r}catch(r){throw S({type:"span",name:e,durationMs:Math.round(v.now()-i),ok:!1,error:r instanceof Error?r.message:String(r),...D(n)??{}}),r}}async function ct(e,t,n){if(!f())return t();let i=v.now();try{let r=await t();return S({type:"span",name:e,durationMs:Math.round(v.now()-i),ok:!0,...D(n)??{}}),r}catch(r){throw S({type:"span",name:e,durationMs:Math.round(v.now()-i),ok:!1,error:r instanceof Error?r.message:String(r),...D(n)??{}}),r}}function S(e,t=ye()){let n=Se(e),i={timestamp:new Date().toISOString(),pid:process.pid,runId:te(),command:ee(),cacheState:_e(),...n,...e},r=`${JSON.stringify(i)}
|
|
81
|
-
`;if(t)try{let a=me(t);B.has(a)||(Ee(a,{recursive:!0}),B.add(a)),fe(t,r);return}catch(a){G||(G=!0,process.stderr.write(`[profile] failed to write ${t}: ${a instanceof Error?a.message:String(a)}
|
|
82
|
-
`));return}f()&&process.stderr.write(r)}function Se(e){let t=ne()??Te({command:ee()??"unknown",toolVersion:"unknown",projectFingerprint:null});if(!t)return{};let n=process.env[L],i=typeof e.name=="string"?e.name:void 0;if(!i)return{workloadIdentity:t,workloadIdentityKind:n};let r=i.split(/[.:]/,1)[0]??i,a=`${t}\0${i}`,s=$.get(a);return s||(s=y(["profile-subsystem-v1",t,i]),$.set(a,s)),{workloadIdentity:t,workloadIdentityKind:n,subsystem:r,subsystemWorkIdentity:s}}function D(e){return typeof e=="function"?e():e}var De=[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"}),N("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"}),N("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"}),N("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"}),N("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 ft(e){let t=new Map;return{kind:e.kind,read(n,i,r){let a=!1,s=0,o;if(f()){let c=V(n);if(c){let d=`${c}\0${i}\0${r}`;o=t.get(d),o||(o=y(["evidence-product-file-read-v1",e.kind,c,i,r]),t.set(d,o))}}return F("evidence-product.file.read",()=>{let c=K(n,e.kind,i,r);if(c===null)return null;s=c.length;try{let d=e.deserialize(c);return a=d!==null,d}catch{return null}},()=>({...o?{workIdentity:o,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:a,payloadBytes:s}))},write(n,i,r,a){U(n,e.kind,i,r,e.serialize(a))},writeBatch(n,i){H(n,i.map(r=>({kind:e.kind,relativePath:r.relativePath,contentHash:r.contentHash,payload:e.serialize(r.value)})))}}}function Et(e){let t=new Map;return{kind:e.kind,read(n,i,r){let a=!1,s=0,o;if(f()){let c=`${r}\0${i}`;o=t.get(c),o||(o=y(["evidence-product-project-read-v1",e.kind,r,i]),t.set(c,o))}return F("evidence-product.project.read",()=>{let c=W(n,e.kind,i,r);if(c===null)return null;s=c.length;try{let d=e.deserialize(c);return a=d!==null,d}catch{return null}},()=>({...o?{workIdentity:o,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:a,payloadBytes:s}))},write(n,i,r,a){X(n,e.kind,i,r,e.serialize(a))}}}function ht(e){let t=De.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 N(e,t){return{scope:"project",kind:e,invalidation:{scope:"project",...t}}}import{readFileSync as Ne}from"fs";import{join as Ce}from"path";var Re=E("source-text",{clearGroups:["whole-project","source-file"]}),be=E("source-lines",{clearGroups:["whole-project","source-file"]});function Pe(e,t){let n=t.replace(/\\/g,"/");return Re.get(e,n,()=>{let i=Ce(e.config.projectRoot,n);try{return Ne(i,"utf-8")}catch(r){if(Oe(r))return"";throw r}})}function Oe(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function we(e,t){let n=t.replace(/\\/g,"/");return be.get(e,n,()=>{let i=Pe(e,n);return i?i.split(`
|
|
83
|
-
`):[]})}var Le=/^\s*(?:\/\/|#|\/\*+|\*)\s*scip-query[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar|twin))?\b/i;function Fe(e){let t=Le.exec(e);return t?t[1]??"":null}function Tt(e,t,n){return re(e,t,n).length>0}function St(e,t,n,i){let r=i.toLowerCase();return re(e,t,n).some(a=>a.toLowerCase()===r)}function re(e,t,n){if(n<=0)return[];let i=we(e,t);if(i.length===0)return[];let r=[];for(let a=n-1;a>=0&&a>=n-5;a-=1){let s=(i[a]??"").trim();if(s==="")continue;let o=Fe(s);if(o!==null){r.push(o);continue}if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return r}return r}export{_ as a,Ie as b,E as c,xe as d,Me as e,ae as f,j as g,Be as h,V as i,$e as j,Ge as k,ze as l,Je as m,Qe as n,Ze as o,et as p,f as q,ot as r,F as s,ct as t,S as u,ft as v,Et as w,ht as x,Pe as y,we as z,Fe as A,Tt as B,St as C};
|
|
84
|
-
//# sourceMappingURL=chunk-L7SPDE73.js.map
|
package/dist/chunk-LHMNRHGV.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as xe}from"./chunk-VXQNNXJE.js";import{a as Ae}from"./chunk-M7AIS73L.js";import{a as le,b as F,e as de}from"./chunk-DLWR3NUU.js";import{a as pe,c as me,d as ge,e as D}from"./chunk-2YU7I3QO.js";import{a as Te}from"./chunk-QVWS2VWZ.js";import{a as Fe}from"./chunk-QDV6RDCP.js";import{a as Re}from"./chunk-C2QSK7E7.js";import{a as ke}from"./chunk-ZGZUZ7XE.js";import{a as we}from"./chunk-H7UKLTWJ.js";import{a as Se}from"./chunk-NRCXJDHL.js";import{a as $e}from"./chunk-ZXJYMGD3.js";import{a as be}from"./chunk-NSS46APD.js";import{b as he}from"./chunk-M7MTH5NR.js";import{a as fe,b as ue}from"./chunk-4333ETTV.js";import{a as se,b as ae,c as ce,g as O,h as U}from"./chunk-NPKYOIFM.js";import{b as Ce}from"./chunk-K2ERX4UT.js";import{a as z,c as ne,d as re,e as oe}from"./chunk-QRGV2F7L.js";import{a as ie}from"./chunk-GBQ5NYPR.js";import{a as De,e as ve}from"./chunk-CNKAGUPL.js";import{a as I,c as B,d as N,e as ye}from"./chunk-52ZYCAEO.js";import{c as te}from"./chunk-NH5ALKPW.js";import{f as x,g as G}from"./chunk-Q3AFUTGB.js";import{e as ee}from"./chunk-LBMJEAEW.js";import{d as _,e as R,f as Q,g as H}from"./chunk-XYADIZHU.js";import{a as Z}from"./chunk-X6D5IC6I.js";import{e as Y}from"./chunk-YGAGTIDK.js";import{s as X}from"./chunk-L7SPDE73.js";import{createHash as lt}from"crypto";import{existsSync as L}from"fs";function q(e){let[t,i]=T(e,":"),r=t||"unknown",n=(a={})=>{let s=a.actionTier??qe(r);return{sourceAnalyzer:r,actionTier:s,rootCauseKey:a.rootCauseKey??(i||e),label:a.label??`${r} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??We(s,r),file:a.file}};if(!i)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(r)){let[a,s]=T(i,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:i,label:`${r} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(r==="cycle"){let a=i.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:i,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(r==="similar"){let a=i.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:i,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(r==="architecture"){let[a,s]=T(i,":");if(a==="forbidden-edge"){let[c,l]=T(s,":"),o=K(c),f=K(l);return n({actionTier:"direct",rootCauseKey:i,label:"architecture boundary violation",why:[`Declared boundary rule rejects ${o} -> ${f}.`],remediation:`Move the dependency behind an allowed boundary, or deliberately update the ${o} dependency rule and baseline.`})}if(a==="cycle"){let c=s.split("|").filter(Boolean).map(K);return n({actionTier:"direct",rootCauseKey:i,label:"forbidden architecture cycle",why:[`requireAcyclic rejects the connected boundary group: ${c.join(", ")}.`],remediation:"Break the boundary cycle, or deliberately revise the acyclicity rule and baseline."})}if(a==="missing-policy-row"){let c=K(s);return n({actionTier:"direct",rootCauseKey:i,label:"incomplete architecture policy",why:[`requireCompletePolicy rejects the missing outgoing dependency row for ${c}.`],remediation:`Declare the allowed outgoing dependencies for ${c}, including an empty row when it must depend on nothing.`})}}if(r==="drift"){let[a,s]=T(i,":"),[c,l]=T(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,l].filter(Boolean))],rootCauseKey:i,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...l?[`Related dependency: ${l}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function qe(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":case"architecture":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function We(e,t){return e==="direct"?`Fix the new ${t} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${t} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function T(e,t){let i=e.indexOf(t);return i<0?[e,""]:[e.slice(0,i),e.slice(i+t.length)]}function K(e){try{return decodeURIComponent(e)}catch{return e}}import{writeFileSync as Qe}from"fs";import{existsSync as Ve,readFileSync as Je}from"fs";import{isAbsolute as Ye,join as Xe}from"path";var Ze=".scipquery-baseline.json";function W(e){if(e.startsWith("similar:")){let t=e.slice(8).split("|");return t.length!==2?e:`similar:${t.map(_).sort().join("|")}`}if(e.startsWith("duplicate-bodies:")){let t=e.slice(17),i=t.indexOf(":");if(i<0)return e;let r=t.slice(0,i),n=t.slice(i+1).split("|");return n.length<2?e:`duplicate-bodies:${r}:${n.map(_).sort().join("|")}`}return e}function A(e,t){return t&&Ye(t)?t:Xe(e.config.projectRoot,t??Ze)}function M(e,t,i={}){let r=A(e,i.path);if(!Ve(r))throw new Error(`No baseline found at ${r}. Create one with: scip-query health --write-baseline`);let a=(JSON.parse(Je(r,"utf-8")).findings??[]).map(W),s=new Set(i.accept?a.filter(i.accept):a),c=new Set(t);return{baselinePath:r,baselineCount:s.size,current:[...t],newFindings:t.filter(l=>!s.has(l)),fixedFindings:[...s].filter(l=>!c.has(l))}}var et=25e3,tt=2500,it=2500;function nt(e){let t=Re(e);return t.symbols>=et||t.documents>=tt?it:void 0}function Ge(e,t={}){let{scope:i}=t,r=nt(e),n=[],a=Ce(e,{scope:i,...D.dead,scanLimit:r});for(let s of a.symbols)x(e,s.relativePath)||G(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of we(e,{scope:i,...D.isolated,scanLimit:r}))x(e,s.relativePath)||G(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of be(e,{scope:i}))s.kind==="real"&&n.push(`cycle:${rt(s.path)}`);for(let s of ve(e,{scope:i,...D.similar,scanLimit:r}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of fe(e,{scope:i,...D.duplicateBodies,scanLimit:r}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(c=>c.symbol).sort().join("|")}`);for(let s of $e(e,{scope:i,...D.extract,scanLimit:r}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of Te(e,{scope:i,...D.wrappers,scanLimit:r}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of ke(e,{scope:i,...D.passthroughs,scanLimit:r}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of Fe(e,{scope:i,...D.stale,scanLimit:r}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of Se(e,{scope:i,...D.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)s.kind!=="architecture-violation"&&n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return n.push(...N(B(e,{scope:i}))),[...new Set(n.map(W))].sort()}function rt(e){if(e.length===0)return"";let t=0;for(let i=1;i<e.length;i++)e[i]<e[t]&&(t=i);return[...e.slice(t),...e.slice(0,t)].join(">")}function ai(e,t={}){let i=Ge(e,{scope:t.scope}),r=A(e,t.path);return Qe(r,JSON.stringify({version:1,findings:i},null,2)+`
|
|
2
|
-
`),{path:r,findingCount:i.length}}function Ee(e,t={}){return M(e,Ge(e,{scope:t.scope}),{path:t.path})}function je(e,t={}){let i=N(B(e,{scope:t.scope}));return M(e,i,{path:t.path,accept:r=>r.startsWith(I)})}import{existsSync as ot,mkdirSync as hi,readdirSync as st,readFileSync as at,writeFileSync as pi}from"fs";import{createHash as gi}from"crypto";import{join as V}from"path";var E=V(".scipquery","suppressions");function ct(e){return V(e,E)}function Ie(e){let t=ct(e);if(!ot(t))return{suppressions:[],warnings:[]};let i=[],r=[];for(let n of st(t).sort()){if(!n.endsWith(".json"))continue;let a=V(t,n),s;try{s=JSON.parse(at(a,"utf-8"))}catch{r.push(`${E}/${n}: malformed JSON \u2014 ignored`);continue}if(typeof s!="object"||s===null||Array.isArray(s)){r.push(`${E}/${n}: not a suppression object \u2014 ignored`);continue}let c=s;if(typeof c.reason!="string"||c.reason.trim()===""){r.push(`${E}/${n}: missing reason \u2014 ignored`);continue}if(!c.id&&!c.check){r.push(`${E}/${n}: needs an id or a check \u2014 ignored`);continue}i.push(c)}return{suppressions:i,warnings:r}}var Ui=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","architecture","doc-reference","unused-params","new-dead","baseline"];function qi(e,t={}){let i=t.base??"HEAD",{minTogether:r=6,minConfidence:n=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:s=Number.POSITIVE_INFINITY,minSimilarity:c=.8,includeBaseline:l=!1,scanLimit:o}=t,f=t.semantic!==!1,m=t.historyMode??"bounded",u=new Set(t.skip??[]),h=ce(e,{base:i}),g=ae(e,{base:i,plan:h}),y=g.changedFiles,S=new Set(y),d=new Set(h.changedFileLines),w=new Set([...S,...d]),$=O(e.config.projectRoot,i,U(h,y)),C=Nt(e.config.projectRoot,i,h,$),p={base:i,changedFiles:y,changedSymbols:g.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:g.attributionNotes,rootCauseGroups:[],note:g.summary.note};if(y.length===0)return p;let k=(j,He)=>{if(u.has(j)){p.skipped.push({check:j,reason:"skipped via --skip"});return}let ze=p.findings.length,Oe=p.skipped.length,Ue=p.checksRun.length;X(`diff-gate.check.${j}`,He,()=>({check:j,changedFiles:y.length,changedSymbols:g.changedSymbols.length,findingsAdded:p.findings.length-ze,skippedAdded:p.skipped.length-Oe,checksRunAdded:p.checksRun.length-Ue}))};return k("echo",()=>ht(e,g.changedSymbols,S,C,a,c,o,f,p)),k("incomplete-migration",()=>Ct(e,i,h,s,o,f,$,p)),k("co-change-partner",()=>St(e,w,r,n,m,p)),k("twin-partner",()=>$t(e,g.changedSymbols,S,o,p)),k("coverage-contract",()=>wt(e,w,p)),k("architecture",()=>Pt(e,p)),k("doc-reference",()=>Rt(e,S,d,h.changedRanges,h.renamedFiles,p)),k("unused-params",()=>Gt(e,y,p)),k("new-dead",()=>Et(e,g.changedSymbols,C,p)),l&&k("baseline",()=>Mt(e,p)),ft(p,[...e.config.suppressions??[],...Ie(e.config.projectRoot).suppressions]),p.rootCauseGroups=dt(p.findings),p}function Wi(e){return e.checksRun.length===0&&e.note===se}function Vi(e){return e.filter(t=>!t.advisory)}function dt(e){let t=new Map;for(let i of e){let r=i.groupKey??`${i.check}:${i.id}`,n=t.get(r);n||(n={groupKey:r,check:i.check,severity:i.severity,actionTier:i.actionTier,sourceAnalyzer:i.sourceAnalyzer,rootCauseKey:i.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:i.message,remediation:i.remediation},t.set(r,n)),n.count+=1,n.findingIds.push(i.id),n.severity=Le(n.severity,i.severity),n.actionTier=_e(n.actionTier,i.actionTier),i.file&&n.files.add(i.file);for(let a of i.relatedFiles??[])n.relatedFiles.add(a)}return[...t.values()].map(i=>({...i,files:[...i.files].sort(),relatedFiles:[...i.relatedFiles].sort()})).sort((i,r)=>r.count-i.count||P(r.severity)-P(i.severity)||i.groupKey.localeCompare(r.groupKey))}function Le(e,t){return P(t)>P(e)?t:e}function P(e){return e==="error"?2:e==="warning"?1:0}function _e(e,t){return e?t&&Be(t)>Be(e)?t:e:t}function Be(e){return e==="direct"?2:e==="signal"?1:0}function ft(e,t){if(t.length===0||e.findings.length===0)return;let i=[];for(let r of e.findings){let n=t.find(a=>ut(a,r));n?e.suppressed.push({finding:r,suppression:n}):i.push(r)}e.findings=i}function ut(e,t){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==t.id&&!t.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==t.check||e.file&&e.file!==t.file?!1:!!(e.id||e.check)}function v(e,t){e.findings.push({...t,suppressionHint:`scip-query: ignore ${t.check} ${t.id} -- <reason>`})}function ht(e,t,i,r,n,a,s,c,l){l.checksRun.push("echo");for(let o of t.slice(0,n)){if(!H(o.symbol)||r(o))continue;let f=ue(e,o.symbol,{maxLoc:15,scanLimit:s}).filter(d=>!i.has(d.file)).slice(0,5).map(d=>({otherFile:d.file,otherShort:d.shortName,otherSymbol:d.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${d.loc} LOC)`]}));if(f.length>0){let d=b("echo",o.symbol,o.file),w=b("echo",o.symbol,o.file,...f.map(C=>`${C.otherSymbol}|${C.otherFile}`).sort()),$=f[0];v(l,{id:d,legacySuppressionIds:w===d?void 0:[w],groupKey:d,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:o.file,symbol:o.symbol,relatedFiles:[...new Set(f.map(C=>C.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${o.symbol}:${$.otherSymbol}`,message:Ke(o,f),why:Me(o,f),remediation:Pe("direct",o.shortName,$.otherShort)});continue}let m=De(e,o.symbol,{minSimilarity:a,limit:5,scanLimit:s,semantic:c,sourceCandidateMode:"target-pruned"}),u=[];for(let d of m){let w=d.fileA===o.file?d.fileB:d.fileA,$=d.fileA===o.file?d.shortNameB:d.shortNameA,C=d.fileA===o.file?d.symbolB:d.symbolA;i.has(w)||u.push({otherFile:w,otherShort:$,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(u.length===0)continue;let h=u[0],g=b("echo",o.symbol,o.file,...u.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),y=b("echo",o.symbol,o.file),S=pt(o,u);v(l,{id:y,legacySuppressionIds:g===y?void 0:[g],groupKey:y,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:h.similarity,file:o.file,symbol:o.symbol,relatedFiles:[...new Set(u.map(d=>d.otherFile))].sort(),message:Ke(o,u),why:Me(o,u),remediation:Pe(S,o.shortName,h.otherShort)})}t.length>n&&l.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${t.length} changed symbols`})}function pt(e,t){return t.some(r=>mt(e.symbol,r))?"direct":"signal"}function mt(e,t){if(t.similarityBasis==="exact-body")return!0;if(t.similarityBasis!=="source-tokens"||t.similarity<.98||t.sharedEvidence.length>8)return!1;let i=R(e),r=R(t.otherSymbol);return!i||!r?!1:i===r?!0:bt(t.sharedEvidence)?!1:gt(i,r)}function gt(e,t){let i=Ne(e),r=Ne(t);if(i.length===0||r.length===0)return!1;let n=new Set(r),a=i.filter(s=>n.has(s)).length;return a>=2&&a/Math.min(i.length,r.length)>=.5}function Ne(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}var yt=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function bt(e){return e.length>=3&&e.every(t=>yt.has(t.toLowerCase()))}function Ke(e,t){let i=t[0],r=Math.round(i.similarity*100);return t.length===1?`${e.shortName} (${e.file}) is ${r}% similar to established ${i.otherShort} (${i.otherFile})`:`${e.shortName} (${e.file}) resembles ${t.length} established symbol(s); strongest is ${r}% similar to ${i.otherShort} (${i.otherFile})`}function Me(e,t){let i=[`${e.shortName} was changed in this diff.`];for(let r of t.slice(0,3))i.push(`${r.otherShort} is outside this diff and scored ${Math.round(r.similarity*100)}% similar by ${r.similarityBasis} evidence.`),i.push(`Shared evidence: ${r.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return t.length>3&&i.push(`${t.length-3} additional similar match(es) grouped into this finding.`),i}function Pe(e,t,i){return e==="direct"?`Extract or reuse the shared behavior with ${i}, or keep the duplicate with a suppression reason.`:`Review whether ${t} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function Ct(e,t,i,r,n,a,s,c){let l=Ae(e,{base:t,maxHelpers:r,diffPlan:i,scanLimit:n,semantic:a,baseContentAt:s});if(!l.available){c.skipped.push({check:"incomplete-migration",reason:"no git history"});return}c.checksRun.push("incomplete-migration"),l.note&&c.skipped.push({check:"incomplete-migration",reason:l.note});for(let o of l.findings){let f=o.leftovers.map(d=>`${d.shortName} (${d.file}, ${Math.round(d.containment*100)}% helper / ${Math.round(d.siteCoverage*100)}% site, ${d.migrationScope})`).join(", "),m=o.leftovers.map(d=>`${d.shortName}: ${d.migrationScope} (${d.migrationScopeReasons[0]})`).join("; "),u=[...o.migratedFiles,...o.leftovers.map(d=>d.file)],h=o.leftovers.length===0?void 0:Math.max(...o.leftovers.map(d=>Math.min(d.containment,d.siteCoverage))),g=o.leftovers.some(d=>d.migrationScope==="possible-subtype"),y=b("incomplete-migration",o.helperSymbol,o.helperFile,u.join("|")),S=b("incomplete-migration",o.helperSymbol,o.helperFile);v(c,{id:S,legacySuppressionIds:y===S?void 0:[y],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:h,file:o.helperFile,symbol:o.helperSymbol,relatedFiles:u,message:`new helper ${o.helperShortName} (${o.helperFile}) is wired into ${o.migratedFiles.length} file(s), but ${o.leftovers.length} similar un-migrated site(s) remain: ${f}`,why:[`${o.helperShortName} is new in this diff and already referenced by ${o.migratedFiles.join(", ")}.`,`Helper shape: ${o.helperShape}; ${o.specificHelperCalleeCount}/${o.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${f}.`,`Migration scope hints: ${m}.`],remediation:g?`Migrate same-scope sites to ${o.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${o.helperShortName}, or confirm they are intentionally different.`})}}function St(e,t,i,r,n,a){let s=ie(e,{historyMode:n}).directionalCoChangePairsForFiles(t,{minTogether:i,minConfidence:0,maxFilesPerCommit:20});if(!s){a.skipped.push({check:"co-change-partner",reason:"no git history"});return}a.checksRun.push("co-change-partner");let c=new Set,l;for(let o of s){let f=t.has(o.fileA),m=t.has(o.fileB);if(f===m)continue;let u=f?o.fileA:o.fileB,h=f?o.fileB:o.fileA,g=f?o.changesA:o.changesB,y=g>0?o.together/g:0;if(y<r||z(h)||z(u)||!L(`${e.config.projectRoot}/${h}`))continue;let S=`${u}|${h}`;if(c.has(S))continue;c.add(S);let d=b("co-change-partner",u,h,String(o.together)),w=b("co-change-partner",u,h),$=ne(u,h),C=re({fileA:u,fileB:h,together:o.together,confidence:y,commitScope:o.commitScope,recency:o.recency,subjectContext:o.subjectContext},$,(l??=oe(e))(u,h)),p=[u,h].sort().join("|");a.findings.push({id:w,legacySuppressionIds:d===w?void 0:[d],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${p}`,confidence:y,file:u,relatedFiles:[h],sourceAnalyzer:"co-change",rootCauseKey:p,partnerClass:$.partnerClass,partnerClassReasons:$.reasons,commitScope:o.commitScope,recency:o.recency,focusedTogether:o.focusedTogether,broadTogether:o.broadTogether,broadCommitRatio:o.broadCommitRatio,lastTogetherAt:o.lastTogetherAt,recentTogether:o.recentTogether,subjectContext:o.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${h} did not \u2014 they change together ${o.together}x (${Math.round(y*100)}% of the time)`,why:[`${u} is in this diff and ${h} is not.`,`Git history shows ${o.together} co-change(s), which is ${Math.round(y*100)}% of changes to the edited side.`,`History context: ${kt(o)}.`,`Subject context: ${Dt(o.subjectContext)}.`,...vt(o),`Partner class: ${$.partnerClass} (${$.reasons.join("; ")}).`],remediation:C?`Update ${h} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${h} alongside this change, or confirm the coupling no longer holds.`})}}function $t(e,t,i,r,n){n.checksRun.push("twin-partner");let a=he(e,{scanLimit:r}).filter(l=>l.relationship==="divergent"||l.relationship==="identical");if(a.length===0)return;let s=new Map;for(let l of a)for(let o of l.members)s.set(o.symbol,l);let c=new Set;for(let l of t){if(!H(l.symbol))continue;let o=s.get(l.symbol);if(!o)continue;let f=o.members.filter(g=>g.symbol!==l.symbol&&!i.has(g.file));if(f.length===0)continue;let m=[l.symbol,...f.map(g=>g.symbol)].sort().join("|");if(c.has(m))continue;c.add(m);let u=f[0],h=b("twin-partner",l.symbol,l.file,u.symbol);v(n,{id:h,groupKey:`twin-partner:${m}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:o.relationship==="identical"?1:Math.max(0,1-o.maxDivergence),file:l.file,symbol:l.symbol,relatedFiles:f.map(g=>g.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:m,message:`${l.shortName} (${l.file}) changed but its same-name twin ${u.shortName} (${u.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${l.symbol} is in this diff.`,`${u.symbol} shares its (near-)name and is classified '${o.relationship}' with it, but ${u.file} is not in this diff.`,o.relationship==="divergent"?`The two bodies already diverge (~${Math.round(o.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${u.file} alongside this change, consolidate ${l.shortName}/${u.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function wt(e,t,i){i.checksRun.push("coverage-contract");let r=e.config.coverageContracts??[];for(let n of r){if(!me(n,t))continue;let a=pe(e,n);if(a.status==="ok")continue;let s=b("coverage-contract",n.name,n.file);v(i,{id:s,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:a.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:ge(a),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,a.status==="unavailable"?`The declared side could not be evaluated: ${a.unavailableReason}.`:`Missing: ${a.missing.join(", ")||"none"}. Extra: ${a.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:a.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function kt(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${Ft(e.lastTogetherAt)}`}function Dt(e){let t=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",i=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",r=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${t}; refs ${i}; samples ${r}; external issue/PR labels ${e.externalIssueLabelStatus}`}function vt(e){let t=[];return e.commitScope==="broad-sweep"&&t.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&t.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),t}function Ft(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var J=3;function Rt(e,t,i,r,n,a){a.checksRun.push("doc-reference");let s=F.referenceTargets(e,t,r);if(s.size===0)return;let c=new Set(n.map(o=>o.from)),l=[];for(let o of de(e,s))i.has(o.doc)||le(e,o.doc)||l.push(Tt(e,o,c));for(let o of At(l))v(a,o)}function Tt(e,t,i){let r=t.citedClaims.length>0?t.citedClaims:F.citationContexts(e,t.doc,t.cited),n=F.classifyCitation(r),a=F.hasLineAnchoredCitation(t.citations),s=t.cited.some(m=>i.has(m)||!L(`${e.config.projectRoot}/${m}`)),c=!(a||s),l=t.cited[0]??"",o=b("doc-reference",t.doc,t.cited.join("|")),f=b("doc-reference",t.doc,l);return{id:f,legacySuppressionIds:o===f?void 0:[o],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${l}`,rootCauseKey:l,confidence:1,file:t.doc,relatedFiles:t.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:r,...c?{advisory:!0}:{},message:`${t.doc} cites ${t.cited.join(", ")} as ${F.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${t.cited.join(", ")} changed in this diff.`,`${t.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(m=>`Citation kind evidence: ${m}`),c?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":a?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:F.citationRemediation(n.citationKind,t.doc)}}function At(e){let t=new Map;for(let r of e){let n=r.rootCauseKey??"",a=t.get(n);a?a.push(r):t.set(n,[r])}let i=[];for(let[r,n]of t)n.length<=J?i.push(...n):i.push(xt(r,n));return i}function xt(e,t){let i=[...t].sort((f,m)=>(f.file??"").localeCompare(m.file??"")),r=i.slice(0,J).map(f=>({doc:f.file??"",citedClaims:f.citedClaims??[]})),n=i.length-r.length,a=i.every(f=>f.advisory===!0),s=i.reduce((f,m)=>Le(f,m.severity),"info"),c=i.reduce((f,m)=>_e(f,m.actionTier),void 0),l=i.map(f=>f.file??"").filter(f=>f.length>0),o=[...new Set(i.flatMap(f=>[f.id,...f.legacySuppressionIds??[]]))];return{id:b("doc-reference","hub-cluster",e),memberFindingIds:o,check:"doc-reference",severity:s,evidence:"change-graph",actionTier:c,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:r[0]?.doc,relatedFiles:[e],citationCount:i.length,citationExemplars:r,suppressedCount:n,...a?{advisory:!0}:{},message:`${e} is cited by ${i.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${r.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${i.length} doc(s) cite it but were not updated in the same diff: ${l.join(", ")}.`,...r.map(f=>`Example \u2014 ${f.doc}: ${f.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${J}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,a?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${r.length} example doc(s) above; ${i.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function Gt(e,t,i){i.checksRun.push("unused-params");for(let r of xe(e,{files:t,limit:50})){let n=b("unused-params",r.symbol,r.file,r.unusedTrailing.join("|")),a=b("unused-params",r.symbol,r.file);v(i,{id:a,legacySuppressionIds:n===a?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:r.file,startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,message:`${r.shortName} (${r.file}) has trailing unused parameter(s): ${r.unusedTrailing.join(", ")}`,why:[`${r.shortName} is in a changed file.`,`The trailing parameter(s) ${r.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function Et(e,t,i,r){r.checksRun.push("new-dead");let n=new te(e),a=Y(e.config.projectRoot),s=a.length>1;for(let c of t){if(i(c)||c.fanIn>0||n.fileKind(c.file)==="test"||x(e,c.file)||G(e,c.symbol,c.file)||Bt(c.symbol))continue;let l=b("new-dead",c.symbol,c.file),o=s&&jt(a,c.file)&&It(e,c.symbol);v(r,{id:l,check:"new-dead",severity:"warning",evidence:o?"heuristic":"graph-fact",confidence:o?.4:.9,file:c.file,symbol:c.symbol,message:o?`${c.shortName} (${c.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${c.shortName} (${c.file}) was changed but has zero indexed consumers`,why:o?[`${c.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${c.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:o?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function jt(e,t){return e.some(i=>t===i.relativeDir||t.startsWith(`${i.relativeDir}/`))}function It(e,t){let i=R(t);return i?(ee(e).get(i)?.length??0)>1:!1}function Bt(e){if(Q(e)!=="type")return!1;let t=R(e);return t.startsWith("_Assert")||t.startsWith("Assert")}function Nt(e,t,i,r){let n=new Map(i.renamedFiles.map(s=>[s.to,s.from])),a=r??O(e,t,U(i));return s=>{let c=n.get(s.file)??s.file,l=R(s.symbol);if(!l)return!1;let o=a(c);return o!==null&&Kt(o,l)}}function Kt(e,t){return new RegExp(`\\b${Z(t)}\\b`).test(e)}function Mt(e,t){if(!L(A(e))){t.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("baseline");let i=Ee(e);for(let r of i.newFindings.filter(n=>!n.startsWith(I))){let n=q(r),a=b("baseline",r);v(t,{id:a,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${r}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function Pt(e,t){if(!ye(e.config.architecture)){t.skipped.push({check:"architecture",reason:"no closed architecture dependency rows, requireCompletePolicy rule, or requireAcyclic rule configured"});return}if(!L(A(e))){t.skipped.push({check:"architecture",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("architecture");let i=je(e);for(let r of i.newFindings){let n=q(r),a=b("architecture",r);v(t,{id:a,groupKey:`architecture:${n.rootCauseKey}`,check:"architecture",severity:"error",evidence:"baseline",actionTier:"direct",confidence:1,sourceAnalyzer:"architecture",rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${r}`,why:["The project declares an enforceable architecture rule.","The current boundary graph contains a violation not present in the committed baseline.",...n.why],remediation:n.remediation})}}function b(e,...t){return`SQ${lt("sha256").update([e,...t].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{Ge as a,ai as b,Ee as c,je as d,Ui as e,qi as f,Wi as g,Vi as h,Nt as i};
|
|
3
|
-
//# sourceMappingURL=chunk-LHMNRHGV.js.map
|
package/dist/chunk-LM72NQ7T.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{execFileSync as k,spawnSync as H}from"child_process";import{platform as C}from"os";var y=C()==="win32";function j(t){let e=y?"where":"which";try{return k(e,[t],{stdio:"pipe"}),!0}catch{return!1}}var R=/\.(?:c|m)?js$/i,b=/\.(?:exe|com)$/i;function z(t,e){return R.test(t)?{binary:process.execPath,args:[t,...e]}:{binary:t,args:[...e]}}function w(t,e){return k(t,e,{stdio:["ignore","pipe","ignore"],encoding:"utf8"})}function F(t,e={}){let r=e.isWindows??y,i=e.lookup??w,n;try{n=i(r?"where":"which",[t])}catch{return null}let o=n.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);return r?o.find(s=>b.test(s))??null:o[0]??null}import{spawnSync as v}from"child_process";import{createHash as W}from"crypto";import{existsSync as E,lstatSync as D,realpathSync as I}from"fs";import{dirname as O,isAbsolute as S,join as A,resolve as c}from"path";var p={run(t,e){let r=h(t,e);return r.kind==="success"?r.output:void 0},runResult:h},T=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],G=/^[0-9a-f]{40,64}$/;function q(t,e=p){let r=e.runResult(t,T);if(r.kind==="success"){let i=_(r.output);if(i)return N(i,e)}return P(t,e)}function _(t){let e=t.split(`
|
|
2
|
-
`).map(l=>l.trim());if(e.length!==5)return;let[r,i,n,o,s]=e;if(!r||!i||!n||!o||!s||!G.test(o)||!G.test(s))return;let d=u(r);return{root:d,gitDir:u(a(d,i)),commonDir:u(a(d,n)),headCommit:o,treeOid:s}}function N(t,e){let r=e.run(t.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...x(t.root,t.gitDir),commonDir:t.commonDir,repositoryId:g("repository",t.commonDir),headCommit:t.headCommit,treeOid:t.treeOid,clean:r.length===0}}function P(t,e){let r=B(t,e);if(r.kind!=="worktree")return;let i=r.identity,n=i.projectRoot,o=e.run(n,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=u(a(n,o)),d=f(e.run(n,["rev-parse","--verify","HEAD"])),l=f(e.run(n,["rev-parse","--verify","HEAD^{tree}"])),m=e.run(n,["status","--porcelain=v1","-z","--untracked-files=all"]);if(m!==void 0)return{...i,commonDir:s,repositoryId:g("repository",s),headCommit:d,treeOid:l,clean:m.length===0}}function B(t,e=p){let r=e.runResult(t,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let i=r.output.trim();if(!i)return{kind:"error",message:"Git returned an empty worktree root."};let n=u(i),o=e.run(n,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=u(a(n,o));return{kind:"worktree",identity:x(n,s)}}function x(t,e){return{projectRoot:t,gitDir:e,worktreeId:g("worktree",`${t}\0${e}`)}}function Q(t,e,r=p){return f(r.run(t,e))}function a(t,e){return S(e)?e:c(t,e)}function u(t){try{return I(t)}catch{return c(t)}}function g(t,e){return W("sha256").update(`${t}\0${e}`).digest("hex").slice(0,24)}function f(t){return t?.trim()||void 0}function h(t,e){let r=v("git",["-C",t,...e],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"]});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let n=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,o=r.error?.code;return(/not a git repository/i.test(n)||o==="ENOENT"&&E(c(t)))&&!M(t)?{kind:"not-repository"}:{kind:"error",message:n}}function M(t){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let e=c(t);for(;;){try{return D(A(e,".git")),!0}catch(i){let n=i.code;if(n!=="ENOENT"&&n!=="ENOTDIR")return!0}let r=O(e);if(r===e)return!1;e=r}}export{j as a,z as b,F as c,q as d,Q as e,a as f,u as g};
|
|
3
|
-
//# sourceMappingURL=chunk-LM72NQ7T.js.map
|