scip-query 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +244 -1
- package/README.md +2 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-H3P6BR5G.js +2 -0
- package/dist/call-graph-VTG2CUOQ.js +2 -0
- package/dist/call-graph-evidence-BociKRpF.d.ts +19 -0
- package/dist/chunk-2BMSSRBH.js +2 -0
- package/dist/{chunk-WIWY3CRX.js → chunk-2GJSD5GY.js} +2 -2
- package/dist/{chunk-W5OXRYGE.js → chunk-2M2LSIMY.js} +3 -3
- package/dist/{chunk-2LDBDR6J.js → chunk-2N6WBNDC.js} +2 -2
- package/dist/{chunk-HOENASQM.js → chunk-2USA3S3P.js} +2 -2
- package/dist/chunk-2VAHDDLM.js +133 -0
- package/dist/chunk-2XWIUW5Z.js +455 -0
- package/dist/chunk-3D4BOXW6.js +20 -0
- package/dist/{chunk-BBCIS4DX.js → chunk-3LO4FST5.js} +2 -2
- package/dist/chunk-3WTY4LP2.js +3 -0
- package/dist/{chunk-UXW33INU.js → chunk-3Z5AMSK6.js} +2 -2
- package/dist/{chunk-4ILJCCXV.js → chunk-44IETFOU.js} +2 -2
- package/dist/chunk-4FR6GQIT.js +2 -0
- package/dist/chunk-4KBTHJLP.js +2 -0
- package/dist/{chunk-SSK6LDPC.js → chunk-5BIKR67W.js} +2 -2
- package/dist/{chunk-IHGQTTVW.js → chunk-5PROPLHI.js} +2 -2
- package/dist/{chunk-TA3QKLLU.js → chunk-5V7EPTII.js} +2 -2
- package/dist/{chunk-JS4PGXMV.js → chunk-62LPZCBQ.js} +2 -2
- package/dist/{chunk-DBRSYFXR.js → chunk-64O2JHQA.js} +2 -2
- package/dist/chunk-6D4F5VWG.js +10 -0
- package/dist/{chunk-BHVUJOCQ.js → chunk-6ERFBC3X.js} +2 -2
- package/dist/{chunk-ILTDAWEF.js → chunk-6ILKOOGH.js} +2 -2
- package/dist/chunk-6MFXCMZC.js +2 -0
- package/dist/chunk-6O7FACKB.js +2 -0
- package/dist/{chunk-XDQMU3BT.js → chunk-6TS3KOXR.js} +2 -2
- package/dist/{chunk-YI2AWIHC.js → chunk-76QOU4PK.js} +2 -2
- package/dist/{chunk-7CYG22FH.js → chunk-7DUI77BN.js} +2 -2
- package/dist/{chunk-IDFEUFKS.js → chunk-7F7T6DCR.js} +2 -2
- package/dist/chunk-7H6VHWWJ.js +2 -0
- package/dist/chunk-7HXT6YLU.js +5 -0
- package/dist/{chunk-DIRJWYBM.js → chunk-7R4V5ES6.js} +4 -4
- package/dist/{chunk-SZHGTCPP.js → chunk-7RIRIADH.js} +2 -2
- package/dist/chunk-7ZLWLOGT.js +2 -0
- package/dist/{chunk-M2O5NY6W.js → chunk-A4WEAK35.js} +2 -2
- package/dist/chunk-AADQLOQ4.js +38 -0
- package/dist/{chunk-OLNV6I6U.js → chunk-AN76MGUE.js} +2 -2
- package/dist/chunk-ANLNLY66.js +2 -0
- package/dist/chunk-ATXPTSEI.js +81 -0
- package/dist/{chunk-YPWBKGFU.js → chunk-AX7IDVFT.js} +2 -2
- package/dist/chunk-B7MPDEAK.js +3 -0
- package/dist/chunk-BBB5FBX4.js +2 -0
- package/dist/{chunk-6I6L7Z62.js → chunk-BHKK5RJY.js} +2 -2
- package/dist/chunk-BJWFVAA5.js +2 -0
- package/dist/{chunk-UHFYCMZO.js → chunk-BKZYTLGE.js} +2 -2
- package/dist/chunk-BL6DCHQP.js +2 -0
- package/dist/{chunk-TEBQMNVI.js → chunk-BOW7SSQH.js} +2 -2
- package/dist/{chunk-OWOOWNJ5.js → chunk-C4RHHCKL.js} +2 -2
- package/dist/{chunk-N2ZSIIGR.js → chunk-C7C6AKAT.js} +6 -6
- package/dist/chunk-CD6M6LS2.js +16 -0
- package/dist/chunk-CFE6PSG6.js +2 -0
- package/dist/{chunk-6V5CNXL6.js → chunk-CFNIGQMT.js} +2 -2
- package/dist/{chunk-GUFSG5TX.js → chunk-CKBUBRYD.js} +2 -2
- package/dist/{chunk-4WNW27SX.js → chunk-CZW5MZ5B.js} +2 -2
- package/dist/chunk-DBBZ63ZX.js +2 -0
- package/dist/{chunk-HCXEQRFF.js → chunk-DBN7DMJB.js} +2 -2
- package/dist/{chunk-6PQNKL3G.js → chunk-DUULLZHZ.js} +2 -2
- package/dist/{chunk-Z4CDXYNQ.js → chunk-DV5Y5NOS.js} +2 -2
- package/dist/chunk-DZOIKCTM.js +3 -0
- package/dist/chunk-E4PKTOL3.js +2 -0
- package/dist/{chunk-EG2CPZMJ.js → chunk-E65ELFKU.js} +2 -2
- package/dist/{chunk-CNO7TOKL.js → chunk-E7QR35ST.js} +2 -2
- package/dist/{chunk-3D3QG236.js → chunk-EFSXAINW.js} +2 -2
- package/dist/{chunk-IL676XCC.js → chunk-EHVEIEQN.js} +2 -2
- package/dist/{chunk-BE7ZZTMC.js → chunk-EHYDXE3Z.js} +2 -2
- package/dist/{chunk-LXABEJX3.js → chunk-EP63Y6LD.js} +2 -2
- package/dist/{chunk-QU5XRYB5.js → chunk-EPX6NQN6.js} +2 -2
- package/dist/{chunk-FESCRNVV.js → chunk-ETC674NS.js} +2 -2
- package/dist/{chunk-OSSESPDX.js → chunk-F5GSBHC6.js} +2 -2
- package/dist/chunk-FH3DGXC6.js +2 -0
- package/dist/{chunk-YEN6CYC7.js → chunk-FI7VGOR4.js} +2 -2
- package/dist/chunk-FJF6VO2P.js +2 -0
- package/dist/{chunk-FRUSVINH.js → chunk-FLMTCX5R.js} +2 -2
- package/dist/chunk-FVFDOIM3.js +2 -0
- package/dist/{chunk-PJFGPYTU.js → chunk-G2HU5WRN.js} +2 -2
- package/dist/{chunk-FIQRSHVM.js → chunk-G4ALYS4J.js} +2 -2
- package/dist/{chunk-UVGEWT4Y.js → chunk-G56I7K4W.js} +2 -2
- package/dist/{chunk-WOIKCX6A.js → chunk-GC4DG2V5.js} +2 -2
- package/dist/chunk-GG45PK4S.js +4 -0
- package/dist/{chunk-XBGWL66K.js → chunk-GHNPACNP.js} +2 -2
- package/dist/{chunk-IICPE7B2.js → chunk-GINH3YQU.js} +2 -2
- package/dist/{chunk-HLZTEXRA.js → chunk-GTZZVLKJ.js} +2 -2
- package/dist/chunk-GXXW5ZHH.js +2 -0
- package/dist/{chunk-B5D7QPBE.js → chunk-HAXXKRTD.js} +2 -2
- package/dist/chunk-HEZWBAZY.js +2 -0
- package/dist/chunk-HMEWLMML.js +2 -0
- package/dist/{chunk-QUU5OBVK.js → chunk-HOBOVYPO.js} +2 -2
- package/dist/{chunk-XGZEP6GR.js → chunk-HRFQ6GW5.js} +2 -2
- package/dist/{chunk-MPQ4OTBM.js → chunk-HX4X7KG3.js} +2 -2
- package/dist/{chunk-FDLOBR6P.js → chunk-HYT2R7LX.js} +2 -2
- package/dist/chunk-IKQVBVQL.js +40 -0
- package/dist/chunk-J6GLBBRK.js +4 -0
- package/dist/{chunk-ZTI4SBFV.js → chunk-J7A4PWFX.js} +2 -2
- package/dist/{chunk-OSR2GEHQ.js → chunk-JCSAZ35V.js} +2 -2
- package/dist/{chunk-ESIQ66Z7.js → chunk-JDU2IV3A.js} +2 -2
- package/dist/chunk-JFMI5SGB.js +4 -0
- package/dist/{chunk-W6STWDQI.js → chunk-JJP37RGX.js} +2 -2
- package/dist/chunk-JZ2A7LDM.js +5 -0
- package/dist/chunk-KNLQGXVH.js +80 -0
- package/dist/chunk-KVQCECPR.js +2 -0
- package/dist/{chunk-SQXRS7BG.js → chunk-KXXORBZ2.js} +2 -2
- package/dist/{chunk-DIUFNHRJ.js → chunk-L5KYH6U3.js} +2 -2
- package/dist/chunk-L6XHYJPZ.js +21 -0
- package/dist/{chunk-2GRUZAQF.js → chunk-L7KTFEAV.js} +2 -2
- package/dist/{chunk-QBE3YX64.js → chunk-LDXHR5EL.js} +2 -2
- package/dist/{chunk-HEHOQQKH.js → chunk-MHGDSBFX.js} +2 -2
- package/dist/{chunk-PWWAJSKV.js → chunk-MLQVVDG3.js} +2 -2
- package/dist/chunk-MOKUWRHO.js +3 -0
- package/dist/{chunk-VQILFTEH.js → chunk-MPYAPMNE.js} +2 -2
- package/dist/{chunk-UICY4GTQ.js → chunk-MV6SPXCR.js} +2 -2
- package/dist/{chunk-HYO3NP5Q.js → chunk-MZPXPSUJ.js} +2 -2
- package/dist/{chunk-VZRNID6A.js → chunk-N55KIE46.js} +2 -2
- package/dist/{chunk-YF5IB2LF.js → chunk-NB4D3BNM.js} +2 -2
- package/dist/{chunk-VVZSBTSU.js → chunk-NGKBOT6G.js} +2 -2
- package/dist/{chunk-NJITK2GP.js → chunk-NJGKXKQF.js} +2 -2
- package/dist/chunk-NJQISBL4.js +8 -0
- package/dist/{chunk-T4N4P2K5.js → chunk-NJT3ZEKY.js} +2 -2
- package/dist/{chunk-FPYLNQPT.js → chunk-NKMKZP6A.js} +2 -2
- package/dist/chunk-NODFZ6ED.js +2 -0
- package/dist/{chunk-BRV7PIFF.js → chunk-NSM5IEVW.js} +2 -2
- package/dist/{chunk-3WR4E3A3.js → chunk-NTGUVNR2.js} +2 -2
- package/dist/{chunk-VUPHCS7Y.js → chunk-NU3KFF2O.js} +2 -2
- package/dist/chunk-NWLVNU66.js +557 -0
- package/dist/{chunk-D4N5SQ2M.js → chunk-NYKZMCRC.js} +2 -2
- package/dist/{chunk-VNLGKHS6.js → chunk-O6BUXZEH.js} +2 -2
- package/dist/chunk-ODPDP7A4.js +3 -0
- package/dist/{chunk-JTQVMR42.js → chunk-OHIV323X.js} +2 -2
- package/dist/chunk-OIAPEKMT.js +3 -0
- package/dist/chunk-OIOC5EHF.js +3 -0
- package/dist/{chunk-YBGKCQIS.js → chunk-ONPPQM4G.js} +2 -2
- package/dist/{chunk-64BFSI5I.js → chunk-OUHEZBYI.js} +2 -2
- package/dist/{chunk-L6PJPETJ.js → chunk-OVGYW7UD.js} +2 -2
- package/dist/{chunk-I55I7XXP.js → chunk-OYKU4B3Y.js} +2 -2
- package/dist/{chunk-J66VOFW6.js → chunk-POBJ6FR2.js} +2 -2
- package/dist/{chunk-CWFP7GM5.js → chunk-PSZPMMWN.js} +2 -2
- package/dist/chunk-PXTRBKRK.js +3 -0
- package/dist/{chunk-HKGFPJ4T.js → chunk-Q5JRIHT3.js} +2 -2
- package/dist/{chunk-P42EIXTA.js → chunk-Q7ATHARX.js} +2 -2
- package/dist/{chunk-JYR66JN5.js → chunk-Q7CSKIDM.js} +2 -2
- package/dist/{chunk-TRNAEQ6P.js → chunk-QBQE7ZJ5.js} +2 -2
- package/dist/{chunk-DULC3QFP.js → chunk-QH22UIXP.js} +2 -2
- package/dist/chunk-QXCKQTKR.js +60 -0
- package/dist/{chunk-ODDUPDP7.js → chunk-RBAD4GJ2.js} +5 -5
- package/dist/{chunk-IZDPJ2QI.js → chunk-RMDPFPNW.js} +2 -2
- package/dist/chunk-ROPJDEJZ.js +4 -0
- package/dist/{chunk-EKV5HX33.js → chunk-RVZC6TJE.js} +2 -2
- package/dist/{chunk-XFA4SSO3.js → chunk-S4QZBKSR.js} +2 -2
- package/dist/{chunk-D2DHWI3D.js → chunk-SCPMZ73U.js} +2 -2
- package/dist/{chunk-PZL5T7SU.js → chunk-SIAP5RGI.js} +2 -2
- package/dist/{chunk-7IWV2EG3.js → chunk-SIX4RFR3.js} +2 -2
- package/dist/{chunk-DYGHBZ2N.js → chunk-SKKXTABJ.js} +2 -2
- package/dist/{chunk-F7DY272B.js → chunk-SSRFUQBD.js} +2 -2
- package/dist/chunk-SYVJEEUJ.js +3 -0
- package/dist/{chunk-FGA2U4OR.js → chunk-T3CZAZSI.js} +2 -2
- package/dist/chunk-T3I6NHBH.js +2 -0
- package/dist/{chunk-EQHFIL6T.js → chunk-T6DWDI5E.js} +2 -2
- package/dist/chunk-T6HRIROJ.js +7 -0
- package/dist/{chunk-GSP44ENC.js → chunk-TAA7HXHE.js} +2 -2
- package/dist/{chunk-BQGB4HBD.js → chunk-TJ2JQYT3.js} +2 -2
- package/dist/{chunk-XPDPNWTQ.js → chunk-TULNMD5T.js} +19 -19
- package/dist/chunk-U2FPY5XA.js +3 -0
- package/dist/chunk-U3SXIMII.js +38 -0
- package/dist/{chunk-NOGJXYFO.js → chunk-U6KCHXJ4.js} +2 -2
- package/dist/chunk-UH3XSKS5.js +9 -0
- package/dist/{chunk-AFHTBORT.js → chunk-UIFUZVCC.js} +2 -2
- package/dist/{chunk-7BWFZPPZ.js → chunk-UXKURIVI.js} +2 -2
- package/dist/{chunk-2E7CX53V.js → chunk-V2RBODHL.js} +2 -2
- package/dist/{chunk-KLFEXGQA.js → chunk-VBKUWB6N.js} +2 -2
- package/dist/{chunk-WUN6KBHV.js → chunk-VBV6ALJE.js} +2 -2
- package/dist/{chunk-GZIUDL6G.js → chunk-VDGFWCQV.js} +2 -2
- package/dist/chunk-VDSDOEWF.js +2 -0
- package/dist/{chunk-WDNVY4E7.js → chunk-VZPWVCLN.js} +2 -2
- package/dist/chunk-WDSFQDPN.js +2 -0
- package/dist/{chunk-CIYLO6SI.js → chunk-WFA35BGR.js} +2 -2
- package/dist/{chunk-LMZ5PRUV.js → chunk-WLMP3OCW.js} +2 -2
- package/dist/{chunk-3SVF22I5.js → chunk-WSA52GOR.js} +2 -2
- package/dist/{chunk-VMPRET3I.js → chunk-X3YVZAKZ.js} +2 -2
- package/dist/{chunk-GYIZ4NXB.js → chunk-X6OGVFIT.js} +2 -2
- package/dist/{chunk-6HFCYNYE.js → chunk-XKXTR6ZI.js} +2 -2
- package/dist/{chunk-6VVV4WRR.js → chunk-Y5DFAW5W.js} +2 -2
- package/dist/chunk-YSYPDRD5.js +3 -0
- package/dist/{chunk-TQPCBMWT.js → chunk-ZFVPWH62.js} +2 -2
- package/dist/chunk-ZGIHTH27.js +2 -0
- package/dist/{chunk-OR2E3AGZ.js → chunk-ZGIQN2SX.js} +2 -2
- package/dist/{chunk-WNTFFKAX.js → chunk-ZHG4WAHR.js} +2 -2
- package/dist/{chunk-DTZCKZEU.js → chunk-ZKB2XUEN.js} +2 -2
- package/dist/chunk-ZLMXIQLC.js +21 -0
- package/dist/chunk-ZMCQIHI4.js +2 -0
- package/dist/cli-main.js +2 -2
- package/dist/code-TAVIKWJI.js +2 -0
- package/dist/code-result-json-5FEFQCAQ.js +2 -0
- package/dist/{command-descriptors-P34VABY5.js → command-descriptors-7BKH53Y3.js} +124 -124
- package/dist/dataflow-GFBTVDH3.js +2 -0
- package/dist/dependence-slice-GWGQCODG.js +2 -0
- package/dist/deps-4QHVDPYA.js +2 -0
- package/dist/direct-navigation-4UBC6HNW.js +3 -0
- package/dist/entry-map-QCTF4RVY.js +2 -0
- package/dist/files-M2UBF5HJ.js +2 -0
- package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
- package/dist/{health-CPp2Jf1Z.d.ts → health-BI2a9WPy.d.ts} +60 -2
- package/dist/hierarchy-2UIHRLW4.js +2 -0
- package/dist/imports-WIE3YZOB.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/members-YKD636DA.js +2 -0
- package/dist/methods-VDF4IMYG.js +2 -0
- package/dist/output-continuation-command-4UMDOOLO.js +3 -0
- package/dist/output-pagination-2GME6OPY.js +19 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-XEQTRCV5.js +3 -0
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +1 -1
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -0
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +20 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -0
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +28 -1
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +1 -1
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +50 -23
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +4 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +9 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +19 -3
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +22 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +17 -3
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +7 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +1 -1
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +22 -6
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +16 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/query-service-fastpath.js +5 -5
- package/dist/query-service-server.js +2 -2
- package/dist/refs-JNK5CLM7.js +2 -0
- package/dist/refs-pagination-6BLRYGMV.js +2 -0
- package/dist/reindex-worker.js +10 -10
- package/dist/reindex.js +18 -18
- package/dist/runtime.js +4 -4
- 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/slice-PHPVNCWX.js +2 -0
- package/dist/surface-MQX5MPIV.js +2 -0
- package/dist/{symbol-resolution-WD5EU5JE.js → symbol-resolution-DBLVXLBC.js} +2 -2
- package/dist/system-JOPKV4OG.js +2 -0
- package/dist/trace-I2P2YFH4.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/value-flow-JJVMF7NP.js +2 -0
- package/dist/watch-server.js +3 -3
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/DETECTOR_GUIDE.md +51 -12
- package/docs/accuracy-audit-checklist.md +36 -13
- package/docs/locality-analyzer-design.md +9 -9
- package/package.json +2 -2
- package/skills/conductor/SKILL.md +110 -0
- package/skills/conductor/agents/openai.yaml +4 -0
- package/skills/principal-maintainability-review/SKILL.md +273 -0
- package/skills/principal-maintainability-review/agents/openai.yaml +4 -0
- package/skills/scip-calibrate/SKILL.md +102 -0
- package/skills/scip-calibrate/agents/openai.yaml +4 -0
- package/skills/scip-claim-audit/SKILL.md +113 -0
- package/skills/scip-claim-audit/agents/openai.yaml +4 -0
- package/skills/scip-probe-reachability/SKILL.md +93 -0
- package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
- package/skills/scip-root-cause/SKILL.md +160 -0
- package/skills/scip-root-cause/agents/openai.yaml +4 -0
- package/skills/scip-system-compression/SKILL.md +252 -0
- package/skills/scip-system-compression/agents/openai.yaml +4 -0
- package/skills/scip-system-compression/references/compression-atlas.md +116 -0
- package/skills/scip-system-compression/references/compression-patterns.md +87 -0
- package/skills/scip-twin-drift/SKILL.md +109 -0
- package/skills/scip-twin-drift/agents/openai.yaml +4 -0
- package/dist/by-kind-XI2CSWEY.js +0 -2
- package/dist/call-graph-UONR6JR5.js +0 -2
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
- package/dist/chunk-2R3V3PSD.js +0 -4
- package/dist/chunk-2WC2OEDO.js +0 -4
- package/dist/chunk-3FHOF22C.js +0 -21
- package/dist/chunk-3JKSW6LJ.js +0 -2
- package/dist/chunk-3L2ZBPEX.js +0 -133
- package/dist/chunk-3PJABJSU.js +0 -2
- package/dist/chunk-4FTZ4P5G.js +0 -2
- package/dist/chunk-4UX2F3JX.js +0 -2
- package/dist/chunk-5ENOG4VP.js +0 -61
- package/dist/chunk-66DVSJQG.js +0 -455
- package/dist/chunk-AVRYW5OZ.js +0 -2
- package/dist/chunk-BDUVI7TO.js +0 -3
- package/dist/chunk-CEEZJXEF.js +0 -2
- package/dist/chunk-CJZXN4NU.js +0 -2
- package/dist/chunk-COF23M5F.js +0 -2
- package/dist/chunk-DHUIOLDT.js +0 -2
- package/dist/chunk-DRENNWRG.js +0 -2
- package/dist/chunk-E5R6AQ73.js +0 -40
- package/dist/chunk-E73UNJTF.js +0 -38
- package/dist/chunk-EVFUMY4R.js +0 -3
- package/dist/chunk-FBN2FGXG.js +0 -2
- package/dist/chunk-FFRKR4EQ.js +0 -2
- package/dist/chunk-GAS2LJMP.js +0 -3
- package/dist/chunk-HVF5VBG6.js +0 -2
- package/dist/chunk-JGKUET5J.js +0 -3
- package/dist/chunk-JWTGMPIT.js +0 -80
- package/dist/chunk-KFOYCQAJ.js +0 -9
- package/dist/chunk-KYSDI3GE.js +0 -5
- package/dist/chunk-LDVT66YM.js +0 -2
- package/dist/chunk-LQRQN2XA.js +0 -2
- package/dist/chunk-MNV5FSBW.js +0 -3
- package/dist/chunk-MV3CDXPI.js +0 -38
- package/dist/chunk-N5B2NILC.js +0 -5
- package/dist/chunk-NOYBFVJA.js +0 -554
- package/dist/chunk-NWQXSFFU.js +0 -3
- package/dist/chunk-OLIWTZI3.js +0 -3
- package/dist/chunk-PP7KNN7L.js +0 -2
- package/dist/chunk-PU7T5QYQ.js +0 -2
- package/dist/chunk-QGVTFRY2.js +0 -7
- package/dist/chunk-QOJONDS7.js +0 -2
- package/dist/chunk-RBLQNW26.js +0 -20
- package/dist/chunk-RTQ7NEKG.js +0 -81
- package/dist/chunk-TPFHAQ2G.js +0 -2
- package/dist/chunk-TQZV7KV4.js +0 -2
- package/dist/chunk-TY7CRN3Z.js +0 -2
- package/dist/chunk-W7CXK74K.js +0 -2
- package/dist/chunk-WB3WYIRE.js +0 -4
- package/dist/chunk-WK46TNUM.js +0 -3
- package/dist/chunk-WYCTJDVR.js +0 -2
- package/dist/chunk-XRYABF57.js +0 -8
- package/dist/chunk-YPWHBBIS.js +0 -2
- package/dist/chunk-YSH6U3L4.js +0 -3
- package/dist/chunk-YU5DZUZI.js +0 -10
- package/dist/chunk-YWO5DDRC.js +0 -16
- package/dist/chunk-ZF5KHH7C.js +0 -2
- package/dist/chunk-ZOHS7AQV.js +0 -21
- package/dist/code-MI6F2TTU.js +0 -2
- package/dist/code-result-json-FXALY4HE.js +0 -2
- package/dist/dataflow-4KEMJPC6.js +0 -2
- package/dist/dependence-slice-R7FPWD5M.js +0 -2
- package/dist/deps-7EMQUYUT.js +0 -2
- package/dist/direct-navigation-6YO234F2.js +0 -3
- package/dist/entry-map-KOOLR26E.js +0 -2
- package/dist/files-OPIPJIGZ.js +0 -2
- package/dist/hierarchy-QPD2CAER.js +0 -2
- package/dist/imports-M6HUXRXC.js +0 -2
- package/dist/members-I5MEFOCT.js +0 -2
- package/dist/methods-5JYGGHXA.js +0 -2
- package/dist/output-continuation-command-UPQAAKBP.js +0 -3
- package/dist/output-pagination-3OFL2MJV.js +0 -19
- package/dist/project-reindex-UKKQ5PLS.js +0 -3
- package/dist/refs-PSU4JZZW.js +0 -2
- package/dist/refs-pagination-JG6CJMRC.js +0 -2
- package/dist/slice-HYRATV64.js +0 -2
- package/dist/surface-VTGDYWF5.js +0 -2
- package/dist/system-LRQNFOR2.js +0 -2
- package/dist/trace-F4B6OLL4.js +0 -2
- package/dist/value-flow-VRPZY72V.js +0 -2
package/dist/watch-server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Ve,c as He,g as ht,j as pt,k as K,l as ft,m as ke}from"./chunk-SZHGTCPP.js";import{a as Y,b as vt,c as Rt}from"./chunk-FIQRSHVM.js";import{a as Pe,b as Pt,c as Tt,d as Ct,e as Te,f as Et,g as Ce,h as Wt,i as Mt,j as At,k as Lt,l as jt,m as _t,n as Gt}from"./chunk-GYIZ4NXB.js";import{a as wt}from"./chunk-MXNGIEPU.js";import{a as bt,c as Q}from"./chunk-BE7ZZTMC.js";import"./chunk-2OOY75BW.js";import{d as B,e as Z,f as $,g as xt}from"./chunk-TY7CRN3Z.js";import"./chunk-DHEQMPLW.js";import{a as ee,b as It,c as kt}from"./chunk-NOGJXYFO.js";import{H as gt,c as j}from"./chunk-IZDPJ2QI.js";import{c as tt,d as ye}from"./chunk-WYPL7GF7.js";import{e as dt}from"./chunk-RTQ7NEKG.js";import{a as me,d as Ke}from"./chunk-GUFSG5TX.js";import{a as ut}from"./chunk-MWN53KRN.js";import"./chunk-IW5XQG5G.js";import"./chunk-3AF4TUFK.js";import{b as ve,g as Re,i as be,m as mt,n as yt,o as we,p as xe,q as Ie,r as St}from"./chunk-FGA2U4OR.js";import{a as M}from"./chunk-B3PYOSCX.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import{c as T,d as C,e as Ye}from"./chunk-JFMEXGFE.js";import{A as q,E as rt,F as it,I as nt,J as st,K as Se,L as ot,P as at,S as ct,a as ge,c as Xe,ga as lt,t as Qe,u as O,v as Ze,x as et,y as N}from"./chunk-KYSDI3GE.js";import{h as R}from"./chunk-7F45LJKI.js";import v from"process";import{rmSync as yr}from"fs";import{resolve as Li}from"path";import{pathToFileURL as ji}from"url";import{lstatSync as wr}from"fs";function Ft(t,e){let r=te(t);if(r.kind!=="directory")throw new Error(`Watcher root is not a directory: ${t}`);if(!e)return{projectRoot:t,projectDirectory:r};let i=te(e);if(i.kind!=="directory")throw new Error(`Git control path is not a directory: ${e}`);return{projectRoot:t,projectDirectory:r,gitControlDirectory:{path:e,identity:i}}}function Ot(t){try{if(!Dt(t.projectDirectory,te(t.projectRoot)))return!1;let e=t.gitControlDirectory;return!e||Dt(e.identity,te(e.path))}catch{return!1}}function te(t){let e=wr(t,{bigint:!0}),r=e.isDirectory()?"directory":e.isFile()?"file":void 0;if(!r||e.isSymbolicLink())throw new Error(`Unsupported watcher identity path: ${t}`);return{device:e.dev,inode:e.ino,birthtimeNs:e.birthtimeNs,kind:r}}function Dt(t,e){return t.device===e.device&&t.inode===e.inode&&t.birthtimeNs===e.birthtimeNs&&t.kind===e.kind}import{existsSync as Le,lstatSync as Ir,statSync as Xt,watch as kr}from"fs";import{EventEmitter as Pr}from"events";import{basename as Tr,dirname as Kt,isAbsolute as je,join as b,relative as Yt,resolve as Qt}from"path";import{watch as Cr}from"chokidar";import Er from"ignore";var Zt=5e3,ne=class{projectRoot;config;watchConfig;outputDb;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onReindexError;onRefreshSuppressed;onError;reindexRunner;subscriptionFactory;budgetInspector;clock;activeOperation=null;stopPromise=null;stopInProgress=!1;status={state:"idle"};debounceTimer=null;cooldownTimer=null;budgetTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;pendingChanges=new Map;pendingChangesComplete=!0;pendingChangesIncompleteReason;reindexInFlight=!1;lastReindexEnd=0;lastObservedGeneration=null;publishedGeneration;indexFreshness;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;reconcileTimer=null;lastGitState=null;preferFilesystemGitState=!0;watchGitLayout=null;localCacheWatchPath;gitignoreFilter;extraIgnore;stopped=!1;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=Z(e.config),this.outputDb=e.outputDb??b(Qe(this.projectRoot,e.config),"index.db"),this.preferFilesystemGitState=e.gitReader===void 0,this.localCacheWatchPath=ei(this.projectRoot,Kt(this.outputDb)),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.clojureConfigPath=e.config.indexer?.clojure?.configPath,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onReindexError=e.onReindexError??(()=>{}),this.onRefreshSuppressed=e.onRefreshSuppressed??(()=>{}),this.onError=e.onError??(r=>console.error(r.message)),this.clock=e.clock??jr,er.set(this,ti(e.stopTimeoutMs??Zt,"watcher stop timeout")),this.reindexRunner=e.reindexRunner??Ur(),this.subscriptionFactory=e.subscriptionFactory??_r,this.budgetInspector=e.budgetInspector??ft,this.publishedGeneration=e.publishedGeneration??j,this.indexFreshness=e.indexFreshness??Zr,this.lastObservedGeneration=this.readPublishedGeneration(),tr.set(this,{projectRoot:e.projectRoot,config:e.config,gitReader:e.gitReader??rt,languages:ir(e.languages??e.config.languages),typeScriptInputPaths:null,stagedIndexEntries:null}),this.gitignoreFilter=ut(e.projectRoot),this.extraIgnore=Er(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore),We(this)}start(){if(this.stopInProgress)throw new Error("Cannot restart a watcher while its previous ownership is still draining.");this.stopped=!1,this.stopPromise=null,ie(this).errors=[],this.sourcePollingFallbackStarted=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(e){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(e)}`))}}stop(){if(this.stopPromise)return this.stopPromise;this.stopped=!0,this.stopInProgress=!0;let e=this.fsWatchers;this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearBudgetTimer(),this.clearGitPollTimer(),this.clearReconcileTimer();let r=this.activeOperation;r&&this.setStatus({state:"draining",startedAt:this.wallNow(),reason:"waiting for the active reindex worker to exit"});let i=[...ie(this).closures],n=Mr(this),s=this.clock.now()+n;return this.stopPromise=this.finishStop(e,i,r,s,n).catch(a=>{throw this.stopInProgress=!1,a}),this.stopPromise}requestRefresh(e,r={}){if(!this.stopped){if(this.markPendingChangesIncomplete(`unstructured-trigger:${e.kind}`),!r.immediate||this.reindexInFlight||this.status.state==="cooldown"||this.status.state==="budget-paused"){this.scheduleReindex(e);return}this.pendingTrigger=Ee(this.pendingTrigger,e),this.changedFiles+=1,this.clearDebounceTimer(),this.triggerReindex()}}startSourceWatcher(e=!1){let r=this.subscriptionFactory(this.projectRoot,{ignoreInitial:!0,ignored:(i,n)=>this.isIgnoredWatchPath(i,n?.isDirectory()??!1),usePolling:e,ignorePermissionErrors:!0,...e?{interval:5e3,binaryInterval:1e4}:{}});r.on("all",(i,n)=>{!this.stopped&&i!=="addDir"&&i!=="unlinkDir"&&this.handleFileChange(i,n)}),r.on("error",i=>this.handleSourceWatcherError(r,i,e)),this.fsWatchers.push(r)}handleSourceWatcherError(e,r,i){if(this.markPendingChangesIncomplete("source-watcher-error"),i||this.sourcePollingFallbackStarted||!Hr(r)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(r)}`));return}this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(n=>n!==e),Ar(ie(this),e,n=>this.onError(n));try{this.startSourceWatcher(!0)}catch(n){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(n)}`))}}isIgnoredWatchPath(e,r){let i=this.relativeWatchPath(e);if(!i)return!1;if($t(i,this.localCacheWatchPath))return!0;let n=r?`${i}/`:i;return this.gitignoreFilter.isIgnored(n)||this.extraIgnore.ignores(n)}handleFileChange(e,r){let i=this.relativeWatchPath(r);if(!i||i===".."||i.startsWith("../")||$t(i,this.localCacheWatchPath)||this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)||i.endsWith("index.db")||i.endsWith("index.scip")||i.endsWith("index.db.tmp")||Tr(i).startsWith(ht))return;i===".scipquery.json"&&Jt(this,this.projectRoot);let n=Vt(this,e,i);n!==null&&(n||this.markPendingChangesIncomplete(`unsupported-source-event:${e}`),this.scheduleReindex({kind:"watch-source",detail:i},n?[{path:i,kind:n}]:void 0,n!==void 0))}relativeWatchPath(e){let r=je(e)?e:b(this.projectRoot,e);return Yt(this.projectRoot,r).replaceAll("\\","/")}scheduleReindex(e,r,i=!1){this.pendingTrigger=Ee(this.pendingTrigger,e),i||this.markPendingChangesIncomplete(`unstructured-trigger:${e.kind}`);for(let s of r??[])this.recordPendingChange(s);if(this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});let s=this.activeOperation;s&&_.get(this)!==s&&(_.set(this,s),s.cancel().then(a=>{a.state==="degraded"&&!this.stopped&&this.onError(new Error(a.reason))},a=>{this.stopped||this.onError(a instanceof Error?a:new Error(String(a)))}));return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}if(this.status.state==="budget-paused"){this.dirty=!0,this.setStatus({...this.status,dirty:!0});return}this.clearDebounceTimer();let n=this.wallNow()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:n}),this.debounceTimer=this.clock.setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped||this.reconcileExternalPublication())return;let e=this.inspectBudget(),r=this.watchConfig.allowExpensiveRebuild&&e.state!=="paused";if(e.state==="paused"&&e.reason!=="rebuild-count"){this.dirty=!0;let c=Math.max(this.wallNow()+1,e.until);this.setStatus({state:"budget-paused",until:c,dirty:!0,reason:e.detail,rebuilt:e.rebuilt,estimatedWriteBytes:e.estimatedWriteBytes}),this.clearBudgetTimer(),this.budgetTimer=this.clock.setTimeout(()=>{this.budgetTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},Math.min(2147483647,Math.max(1,c-this.wallNow())));return}let i=this.clock.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&i<this.watchConfig.cooldownMs){let c=this.watchConfig.cooldownMs-i;this.dirty=!0;let l=this.wallNow()+c;this.setStatus({state:"cooldown",until:l,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},c);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let n=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let s=this.consumePendingChangeJournal(),a=this.wallNow();this.setStatus({state:"indexing",startedAt:a});let o=this.reindexRunner.start(this.reindexRequest(n,r,s));this.activeOperation=o,o.completion.then(c=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),re.set(this,0),this.stopped)return;if(_.get(this)===o){if(this.restorePendingChangeJournal(s),this.dirty){let u=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:u,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"});return}We(this),this.lastObservedGeneration=this.readPublishedGeneration();let l=!1;try{l=this.onReindexComplete(c,n,{pendingChanges:this.dirty})===!0}catch(u){this.onError(u instanceof Error?u:new Error(String(u)))}if(this.dirty&&!this.stopped){if(l){let d=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.resetPendingChanges(),this.onRefreshSuppressed(d),this.setStatus({state:"idle"});return}let u=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:u,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(c=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let l=c instanceof Error?c:new Error(String(c));this.restorePendingChangeJournal(s);let u=rr(l),d=0;if(u?(d=(re.get(this)??0)+1,re.set(this,d),this.dirty=!0,this.pendingTrigger=Ee(this.pendingTrigger,n)):re.set(this,0),!u&&_.get(this)!==o&&(this.onReindexError(l,n),this.onError(l)),this.dirty){let h=u?$r(this.watchConfig.cooldownMs,d):this.watchConfig.cooldownMs,p=this.wallNow()+h;this.setStatus({state:"cooldown",until:p,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},h);return}this.setStatus({state:"idle"})}).finally(()=>{this.activeOperation===o&&(this.activeOperation=null),_.get(this)===o&&_.delete(this)})}async finishStop(e,r,i,n,s){let a=[],o=e.map(async h=>{try{await h.close()}catch(p){a.push(`watch subscription close failed: ${String(p)}`)}});o.push(...r),i&&o.push((async()=>{try{let h=await i.cancel();h.state==="degraded"&&a.push(h.reason)}catch(h){a.push(`reindex cancellation failed: ${h instanceof Error?h.message:String(h)}`)}})());let c=o.length,l=o.map(h=>h.finally(()=>{c-=1})),u=await Wr(l,n,this.clock),d=ie(this);return a.push(...d.errors),d.errors=[],u?this.stopInProgress=!1:(a.push(`watch shutdown exceeded the ${s}ms deadline with ${c} operation(s) still pending`),Promise.all(l).then(()=>{this.stopInProgress=!1})),a.length>0?(this.setStatus({state:"draining",startedAt:this.wallNow(),reason:a.join("; ")}),{state:"degraded",reasons:a}):(this.setStatus({state:"idle"}),{state:"stopped"})}wallNow(){return this.clock.wallNow?.()??this.clock.now()}inspectBudget(){try{return this.budgetInspector(this.outputDb,this.watchConfig.resourceBudget,new Date(this.wallNow()))}catch(e){return{state:"paused",reason:"activity-evidence",until:this.wallNow()+this.watchConfig.resourceBudget.windowMs,rebuilt:0,estimatedWriteBytes:0,detail:`reindex activity evidence could not be read: ${e instanceof Error?e.message:String(e)}`}}}reindexRequest(e,r=!0,i){return{projectRoot:this.projectRoot,config:this.config,languages:this.languages,pnpmWorkspaces:this.pnpmWorkspaces,typescriptProjectMode:this.typescriptProjectMode,typescriptProjects:this.typescriptProjects,clojureConfigPath:this.clojureConfigPath,indexerConcurrency:this.indexerConcurrency,trigger:e,changeJournal:i,allowExpensiveRebuild:r}}setStatus(e){this.status=e,e.state==="cooldown"||e.state==="budget-paused"?this.armReconcileTimer(e.until):this.clearReconcileTimer(),this.onStatus(e)}recordPendingChange(e){if(this.pendingChanges.size>=1024&&!this.pendingChanges.has(e.path)){this.pendingChanges.clear(),this.markPendingChangesIncomplete("change-entry-limit");return}let r=this.pendingChanges.get(e.path),i=Jr(r,e.kind);i===null?this.pendingChanges.delete(e.path):this.pendingChanges.set(e.path,i)}markPendingChangesIncomplete(e){this.pendingChangesComplete=!1,this.pendingChangesIncompleteReason??=e}consumePendingChangeJournal(){let e=j(this.outputDb),r=[...this.pendingChanges.entries()].map(([a,o])=>({path:a,kind:o})).sort((a,o)=>a.path.localeCompare(o.path)),i=this.pendingChangesComplete,n=this.pendingChangesIncompleteReason;e||(i=!1,n??="accepted-generation-unavailable");let s={version:1,baseGeneration:e,complete:i,...n?{incompleteReason:n}:{},entries:r};return ke(s)||(s={version:1,baseGeneration:e,complete:!1,incompleteReason:"change-journal-byte-limit",entries:[]}),this.resetPendingChanges(),s}restorePendingChangeJournal(e){let r=[...this.pendingChanges.entries()].map(([s,a])=>({path:s,kind:a})),i=this.pendingChangesComplete,n=this.pendingChangesIncompleteReason;this.resetPendingChanges(),e.complete||this.markPendingChangesIncomplete(e.incompleteReason??"failed-reindex");for(let s of e.entries)this.recordPendingChange(s);i||this.markPendingChangesIncomplete(n??"failed-reindex");for(let s of r)this.recordPendingChange(s)}resetPendingChanges(){this.pendingChanges.clear(),this.pendingChangesComplete=!0,this.pendingChangesIncompleteReason=void 0}clearDebounceTimer(){this.debounceTimer&&(this.clock.clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(this.clock.clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}clearBudgetTimer(){this.budgetTimer&&(this.clock.clearTimeout(this.budgetTimer),this.budgetTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(x(this).stagedIndexEntries=Ht(this.projectRoot,x(this).gitReader),this.gitPollTimer=this.clock.setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}armReconcileTimer(e){this.clearReconcileTimer();let r=e-this.wallNow();if(r<=0||!(this.watchConfig.gitPollMs>0))return;let i=Math.min(this.watchConfig.gitPollMs,r);this.reconcileTimer=this.clock.setTimeout(()=>{this.reconcileTimer=null,!(this.stopped||this.reconcileExternalPublication())&&(this.status.state==="cooldown"||this.status.state==="budget-paused")&&this.armReconcileTimer(this.status.until)},i),this.reconcileTimer.unref?.()}clearReconcileTimer(){this.reconcileTimer&&(this.clock.clearTimeout(this.reconcileTimer),this.reconcileTimer=null)}readPublishedGeneration(){try{return this.publishedGeneration(this.outputDb)}catch{return null}}reconcileExternalPublication(){if(this.stopped||this.reindexInFlight||!(this.dirty||this.status.state==="budget-paused"||this.status.state==="cooldown"||this.status.state==="waiting"))return!1;let r=this.readPublishedGeneration();if(r===null||r===this.lastObservedGeneration)return!1;this.lastObservedGeneration=r;let i;try{i=this.indexFreshness(this.projectRoot,this.config,this.outputDb)}catch{return!1}if(i!=="fresh")return!1;let n=this.pendingTrigger??{kind:"unknown"};return this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearBudgetTimer(),this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.resetPendingChanges(),We(this),this.onRefreshSuppressed({...n,detail:`a generation published outside the watcher is fresh${n.detail?` (${n.detail})`:""}`}),this.setStatus({state:"idle"}),!0}pollGitState(){if(this.reindexInFlight||this.stopped)return;let e=this.lastGitState,r=this.readGitState();if(!e||!r||this.stopped){this.lastGitState=r;return}this.lastGitState=r;let i=e.head!==r.head,n=e.indexPath!==r.indexPath||e.indexMtimeMs!==r.indexMtimeMs||e.indexSize!==r.indexSize;if(!i&&!n)return;let s=x(this),a=s.stagedIndexEntries,o=Ht(this.projectRoot,s.gitReader);s.stagedIndexEntries=o;let c=si(this.projectRoot,s.gitReader,e,r,a,o,i,n),l=null;if(c!==null&&(c.includes(".scipquery.json")&&Jt(this,this.projectRoot),l=c.filter(d=>Vt(this,"add",d)!==null),l.length===0))return;let u=l?.map(d=>({path:d,kind:Le(b(this.projectRoot,d))?"change":"delete"}));i&&n?this.scheduleReindex({kind:"watch-git-state",detail:Me("HEAD and index changed",l)},u,u!==void 0):i?this.scheduleReindex({kind:"watch-git-head",detail:Me("HEAD changed",l)},u,u!==void 0):n&&this.scheduleReindex({kind:"watch-git-index",detail:Me(r.indexPath??"index changed",l)},u,u!==void 0)}readGitState(){if(this.preferFilesystemGitState){let e=this.readFilesystemGitState();if(e)return e}return this.readGitStateFromGit()}readFilesystemGitState(){let e=this.watchGitLayout??Xr(this.projectRoot);if(!e)return null;this.watchGitLayout=e;let r=Kr(e.gitDir);return r?zt(r,e.indexPath):null}readGitStateFromGit(){let e=x(this).gitReader,r=Se(this.projectRoot,["rev-parse","--git-path","index"],e);if(!r)return null;let i=ot(this.projectRoot,r);return zt(Se(this.projectRoot,["rev-parse","--verify","HEAD"],e),i)}clearGitPollTimer(){this.gitPollTimer&&(this.clock.clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};async function Wr(t,e,r){if(t.length===0)return!0;let i=Promise.all(t).then(()=>!0),n=Math.max(0,e-r.now()),s=null,a=new Promise(c=>{s=r.setTimeout(()=>c(!1),n)}),o=await Promise.race([i,a]);return o&&s&&r.clearTimeout(s),o}var qt=new WeakMap,er=new WeakMap,tr=new WeakMap,_=new WeakMap,re=new WeakMap;function ie(t){let e=qt.get(t);if(e)return e;let r={closures:new Set,errors:[]};return qt.set(t,r),r}function Mr(t){return er.get(t)??Zt}function x(t){let e=tr.get(t);if(!e)throw new Error("Watcher input state was not initialized.");return e}function Ar(t,e,r){let i=Promise.resolve().then(()=>e.close()).catch(n=>{let s=`watch subscription close failed during polling fallback: ${String(n)}`;t.errors.push(s),r(new Error(s))});t.closures.add(i),i.then(()=>t.closures.delete(i))}function Lr(t,e=T){let{projectRoot:r,config:i,languages:n,pnpmWorkspaces:s,typescriptProjectMode:a,typescriptProjects:o,clojureConfigPath:c,indexerConcurrency:l,trigger:u}=t,d=B(r),h=Object.keys(d).length>0?d:i,p=N(r,h),m=h.indexer?.typescript,f=h.indexer?.clojure,y=e(process.pid);if(!y)throw new Error(`Could not establish watcher process identity for reindex worker ownership (pid ${process.pid}).`);return{workerPath:new URL("./reindex-worker.js",import.meta.url).pathname,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:r,SCIP_REINDEX_OUTPUT_SCIP:p.indexPath,SCIP_REINDEX_OUTPUT_DB:p.dbPath,SCIP_REINDEX_LANGUAGES:(h.languages??n)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(h.indexerConcurrency??l??""),SCIP_REINDEX_PNPM_WORKSPACES:m?.pnpmWorkspaces??s?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:m?.projectMode??a,projects:m?.projects??o??[],maxHeapMb:m?.maxHeapMb}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:f?.configPath??c??"",SCIP_REINDEX_TRIGGER_KIND:u.kind,SCIP_REINDEX_TRIGGER_DETAIL:u.detail??"",SCIP_REINDEX_CHANGE_JOURNAL:t.changeJournal?ke(t.changeJournal)??"":"",SCIP_REINDEX_ALLOW_EXPENSIVE:t.allowExpensiveRebuild===!1?"0":"1",SCIP_REINDEX_PROCESS_GROUP_LEADER:"1",SCIP_REINDEX_PARENT_IDENTITY:JSON.stringify(y)}}}var jr={now:C,wallNow:()=>Date.now(),setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},_r=(t,e)=>Gr(process.platform,e.usePolling)?new Ae(t):Cr(t,e);function Gr(t,e){return t==="darwin"&&e!==!0}var U=class extends Error{constructor(e,r){super(e,r===void 0?void 0:{cause:r}),this.name="RecursiveSourceWatchError"}},Ae=class{events=new Pr;watcher;constructor(e){this.watcher=kr(e,{recursive:!0},(r,i)=>{if(i===null){this.events.emit("error",new U("Recursive source watcher omitted the changed path."));return}let n=b(e,i.toString());this.events.emit("all",Dr(r,n),n)}),this.watcher.on("error",r=>{this.events.emit("error",new U(`Recursive source watcher failed: ${r.message}`,r))})}on=(e,r)=>(this.events.on(e,r),this);close(){this.watcher.close()}};function Dr(t,e){return t==="change"?"change":Le(e)?Xt(e).isDirectory()?"addDir":"add":"unlink"}var Fr=15*6e4,Or=1e3,Nr=64*1024;function qr(){return{stdoutTail:"",stderrTail:"",stdoutTruncated:!1,stderrTruncated:!1}}function Bt(t,e){let r=t instanceof Error?t.message:String(t),i=e.stderrTail.trim()||e.stdoutTail.trim();return i?`${r}
|
|
2
|
-
${i}`:r}function
|
|
3
|
-
`)){if(r.startsWith("#")||r.startsWith("^"))continue;let i=r.indexOf(" ");if(i===-1)continue;let n=r.slice(0,i);if(r.slice(i+1).trim()===e&&_e.test(n))return n.toLowerCase()}}catch{return}}function Zr(t,e,r){let i=Kt(r);return $(t,e,{dbPath:r,metaPath:b(i,"meta.json"),cacheDir:i}).state}function zt(t,e){let r={head:t,indexPath:e};try{let i=Xt(e);r.indexMtimeMs=i.mtimeMs,r.indexSize=i.size}catch{r.indexMtimeMs=void 0,r.indexSize=void 0}return r}function ei(t,e){let r=Yt(t,e).replaceAll("\\","/");if(!(!r||r===".."||r.startsWith("../")))return r}function ti(t,e){if(!Number.isSafeInteger(t)||t<=0)throw new Error(`${e} must be a positive integer.`);return t}function ir(t){return t&&t.length>0?[...t]:me}function Jt(t,e){try{let r=x(t);r.config=B(e),r.languages=ir(r.config.languages)}catch{x(t).languages=me}}function Vt(t,e,r){let i=x(t);if(ge(r,i.languages)==="other")return null;let s=zr(e);if(r===".scipquery.json"||at(r))return i.typeScriptInputPaths=null,s;if(!ri(r,i.languages))return s;let a=i.typeScriptInputPaths;if(!a)return s;let o=a.has(r);if(s!=="add")return o?s:null;if(o)return"change";let c=nr(t);return c?c.has(r)?"add":null:s}function We(t){let e=x(t);if(!e.languages.includes("typescript")){e.typeScriptInputPaths=null;return}let r=ii(e.projectRoot,e.config,e.languages);e.typeScriptInputPaths=r??nr(t)}function nr(t){let e=x(t);if(!e.languages.includes("typescript"))return e.typeScriptInputPaths=null,null;try{let r=e.config.indexer?.typescript,i=ct(e.projectRoot,r?.projectMode,r?.projects);return e.typeScriptInputPaths=i,i}catch{return e.typeScriptInputPaths=null,null}}function ri(t,e){if(!e.includes("typescript"))return!1;let r=ge(t,["typescript","javascript"]);return r==="source"||r==="ambient"}function ii(t,e,r){try{let i=Ke(R(N(t,e).metaPath,"reindex metadata"));if(i.kind!=="supported"&&i.kind!=="legacy")return null;let n=Xe(i.metadata.fingerprint);return!n||!ni(n,r,e)?null:new Set(n.files.map(s=>s.path))}catch{return null}}function ni(t,e,r){let i=lt(e,{pnpmWorkspaces:r.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:r.indexer?.typescript?.projectMode,typescriptProjects:r.indexer?.typescript?.projects,clojureConfigPath:r.indexer?.clojure?.configPath});return t.version===i.version&&JSON.stringify([...t.languages].sort())===JSON.stringify(i.languages)&&t.pnpmWorkspaces===i.pnpmWorkspaces&&t.typescriptProjectMode===i.typescriptProjectMode&&JSON.stringify([...t.typescriptProjects].sort())===JSON.stringify(i.typescriptProjects)&&t.clojureConfigPath===i.clojureConfigPath}function si(t,e,r,i,n,s,a,o){let c=new Set;if(a){if(!r.head||!i.head)return null;let l=e.runResult(t,["diff","--name-only","-z","--no-renames","--relative",r.head,i.head,"--"]);if(l.kind!=="success")return null;for(let u of oi(l.output))c.add(u)}if(o){if(n===null||s===null)return null;for(let l of ci(n,s))c.add(l)}return[...c].sort()}function Ht(t,e){let r=e.runResult(t,["diff","--cached","--raw","-z","--no-renames","--relative","--"]);return r.kind==="success"?ai(r.output):null}function oi(t){return t.split("\0").filter(e=>e.length>0)}function ai(t){let e=t.split("\0");if(e.at(-1)===""&&e.pop(),e.length%2!==0)return null;let r=new Map;for(let i=0;i<e.length;i+=2){let n=e[i],s=e[i+1];if(!n.startsWith(":")||!s)return null;r.set(s,n)}return r}function ci(t,e){return[...new Set([...t.keys(),...e.keys()])].filter(i=>t.get(i)!==e.get(i))}function Me(t,e){return e===null?`${t}; changed paths unavailable`:e.length===0?t:e.length===1?e[0]:`${e.length} compiler inputs changed`}import{existsSync as se,lstatSync as z,readdirSync as ar,realpathSync as sr,rmSync as G,statSync as li}from"fs";import{join as S,resolve as J,sep as cr}from"path";var di=3600*1e3,ui=2*1024*1024*1024,oe=300*1e3,hi="gc-state.json",pi="gc.lock";function fi(t){let e=t.leases.filter(o=>o.managed&&!o.live&&!o.busy),r=gi(t.leases,t.locks),i={};for(let o of t.generations)r.has(o.generationId)||(i[o.generationId]=o.unreferencedAt??t.nowMs);let n=t.generations.filter(o=>!r.has(o.generationId)).sort((o,c)=>i[o.generationId]-i[c.generationId]||o.generationId.localeCompare(c.generationId)),s=new Set;for(let o of n)t.nowMs-i[o.generationId]>=t.policy.generationTtlMs&&s.add(o.generationId);let a=t.generations.filter(o=>!s.has(o.generationId)).reduce((o,c)=>o+c.size,0);for(let o of n){if(a<=t.policy.budgetBytes)break;s.has(o.generationId)||(s.add(o.generationId),a-=o.size)}for(let o of s)delete i[o];return{deleteWorktrees:e,deleteGenerations:t.generations.filter(o=>s.has(o.generationId)),deleteLocks:t.locks.filter(o=>!o.live),deleteTemporaries:t.temporaries.filter(o=>!o.live),protectedGenerationIds:[...r].sort(),unreferencedSince:i}}function gi(t,e){let r=new Set(t.filter(i=>i.managed&&(i.live||i.busy)).flatMap(i=>[i.lease.baseGenerationId,i.lease.activeGenerationId]).filter(i=>i!==void 0));for(let i of e)i.live&&r.add(i.generationId);return r}function lr(t,e,r={}){if(!et())return{kind:"disabled"};let i=r.repositoryId===void 0?it(t)?.repositoryId:r.repositoryId;if(!i)return{kind:"unavailable"};let n=S(O(),"repositories",i),s=(r.now??Date.now)(),a=se(n)?dr(t,n,i,e,s,r):{kind:"unavailable"};return mi(t,i,e,s,r),a}function dr(t,e,r,i,n,s){let a=S(e,"gc-state.json"),o=Ri(a);if(!s.force&&o&&n-Date.parse(o.lastSweepAt)<oe)return{kind:"throttled",sweptAt:o.lastSweepAt};let c=tt(e,{now:()=>n});if(!c)return{kind:"busy"};try{let l=yi(t,e,r,o?.unreferencedSince??{}),u=fi({nowMs:n,...l,policy:{generationTtlMs:s.policy?.generationTtlMs??di,budgetBytes:s.policy?.budgetBytes??ui}}),d=0,h=0;for(let f of u.deleteWorktrees){if(!Fe(f.lease))continue;if(!se(f.lease.localCacheDir)){G(f.leasePath,{force:!0}),h+=1;continue}if(!Si(f.lease))continue;let y=ye(S(f.lease.localCacheDir,"cache-lifecycle.lock"));if(y)try{if(Ge(f.lease,!0))continue;try{At({projectRoot:f.lease.projectRoot,cacheDir:f.lease.localCacheDir,cliVersion:i})}catch{continue}if(Ge(f.lease,!0))continue;G(f.lease.localCacheDir,{recursive:!0,force:!0}),G(f.leasePath,{force:!0}),h+=1}finally{y.release()}}for(let f of u.deleteLocks)G(f.path,{force:!0});for(let f of u.deleteTemporaries)G(f.path,{recursive:!0,force:!0});for(let f of u.deleteGenerations)G(f.path,{recursive:!0,force:!0}),d+=f.size;dt(S(e,"evidence.db"));let p={kind:"swept",sweptAt:new Date(n).toISOString(),deletedWorktrees:h,deletedGenerations:u.deleteGenerations.length,deletedBytes:d,protectedGenerations:u.protectedGenerationIds.length},m={version:1,lastSweepAt:p.sweptAt,unreferencedSince:u.unreferencedSince,lastResult:p};return ve(a,m,{spacing:2,trailingNewline:!0}),p}catch(l){return{kind:"failed",error:l instanceof Error?l.message:String(l)}}finally{c.release()}}function mi(t,e,r,i,n){let s=S(O(),"repositories");if(!se(s))return;let a=S(s,hi),o=bi(a);if(!n.force&&o!==void 0&&i-o<oe)return;let c=ye(S(s,pi));if(c)try{for(let l of V(s)){if(l===e||!/^[a-f0-9]{24}$/.test(l))continue;let u=S(s,l),d;try{d=z(u)}catch{continue}if(!d.isDirectory()||d.isSymbolicLink())continue;let h=vi(u)??t;dr(h,u,l,r,i,n)}ve(a,{version:1,lastSweepAt:new Date(i).toISOString()},{spacing:2,trailingNewline:!0})}finally{c.release()}}function yi(t,e,r,i){let n=new Set(st(t).map(l=>J(l.path))),s=[];for(let l of V(S(e,"worktrees"))){if(!l.endsWith(".json"))continue;let u=S(e,"worktrees",l),d=ur(u);if(!d)continue;let h=J(d.projectRoot);s.push({leasePath:u,lease:d,managed:d.repositoryId===r&&Fe(d),live:n.has(h)||se(h),busy:Ge(d)})}let a=[];for(let l of V(S(e,"locks"))){let u=/^([a-f0-9]{64})\.lock$/.exec(l);if(!u)continue;let d=S(e,"locks",l),h=De(d),p=h!==void 0&&M(h),m=u[1];a.push({generationId:m,path:d,live:p})}let o=[],c=[];for(let l of V(S(e,"generations"))){let u=/^\.tmp-(\d+)-/.exec(l);if(u){let p=S(e,"generations",l),m=Number(u[1]);try{c.push({path:p,size:or(p),live:Number.isSafeInteger(m)&&M(m)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(l))continue;let d=S(e,"generations",l),h;try{h=z(d)}catch{continue}!h.isDirectory()||h.isSymbolicLink()||o.push({generationId:l,path:d,size:or(d),...i[l]===void 0?{}:{unreferencedAt:i[l]}})}return{leases:s,generations:o,locks:a,temporaries:c}}function Fe(t){if(t.ownershipChecksum!==gt(t)||q(t.localCacheDir)!==q(Ze(t.projectRoot)))return!1;let e=q(S(O(),"projects"));return q(t.localCacheDir).startsWith(`${e}${cr}`)}function Si(t){if(!Fe(t))return!1;let e=J(O()),r=J(S(e,"projects")),i=J(t.localCacheDir);try{let n=z(e),s=z(r),a=z(i);if(!n.isDirectory()||n.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let o=sr(r);return sr(i).startsWith(`${o}${cr}`)}catch{return!1}}function vi(t){for(let e of V(S(t,"worktrees"))){if(!e.endsWith(".json"))continue;let r=ur(S(t,"worktrees",e));if(r)return r.projectRoot}}function Ge(t,e=!1){for(let i of e?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let n=De(S(t.localCacheDir,i));if(n!==void 0&&M(n))return!0}let r=De(Q(t.localCacheDir).lockPath);return r!==void 0&&M(r)}function ur(t){try{let e=JSON.parse(R(t,"worktree cache lease"));return e.version!==1||typeof e.repositoryId!="string"||typeof e.worktreeId!="string"||typeof e.projectRoot!="string"||e.treeOid!==void 0&&typeof e.treeOid!="string"||typeof e.localCacheDir!="string"||e.baseGenerationId!==void 0&&typeof e.baseGenerationId!="string"||e.activeGenerationId!==void 0&&typeof e.activeGenerationId!="string"||typeof e.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(e.ownershipChecksum)||typeof e.lastAction!="string"||e.lastReason!==void 0&&typeof e.lastReason!="string"||typeof e.lastSeenAt!="string"?null:e}catch{return null}}function De(t){try{let e=JSON.parse(R(t,"watch lock record"));return typeof e.pid=="number"&&Number.isSafeInteger(e.pid)&&e.pid>0?e.pid:void 0}catch{return}}function Ri(t){try{let e=JSON.parse(R(t,"repository cache GC state"));return e.version!==1||typeof e.lastSweepAt!="string"||!Number.isFinite(Date.parse(e.lastSweepAt))||!e.unreferencedSince||typeof e.unreferencedSince!="object"||!e.lastResult?null:e}catch{return null}}function bi(t){try{let e=JSON.parse(R(t,"global repository cache GC state"));if(e.version!==1||typeof e.lastSweepAt!="string")return;let r=Date.parse(e.lastSweepAt);return Number.isFinite(r)?r:void 0}catch{return}}function V(t){try{return ar(t)}catch{return[]}}function or(t){let e=0,r=[t];for(;r.length>0;){let i=r.pop();for(let n of ar(i,{withFileTypes:!0})){let s=S(i,n.name);n.isDirectory()?r.push(s):n.isFile()&&(e+=li(s).size)}}return e}var ae=class{root;now;randomId;retryDelayMs;active;retryNotBeforeMs=0;currentStatus;constructor(e,r={}){this.root=e,this.now=r.now??Date.now,this.randomId=r.randomId,this.retryDelayMs=Math.max(1,Math.floor(r.retryDelayMs??1e3)),this.currentStatus=Ce(e)}initializeAfterOwnershipAcquired(){let e=Et(this.root),r=Wt(this.root,{now:()=>new Date(this.now())});return this.refreshStatus(),{recoveredClaims:e,prunedHistory:r}}observeLegacyRequest(e,r){Pt(this.root,r??"stale index observed by a legacy command",{idempotencyKey:`legacy-activity:${e}`,now:()=>new Date(e)}),this.refreshStatus()}poll(e,r){if(this.active||e.state!=="idle"||this.now()<this.retryNotBeforeMs)return!1;let i=Tt(this.root,{now:()=>new Date(this.now()),...this.randomId?{randomId:this.randomId}:{}});if(this.refreshStatus(),i.requests.length===0)return!1;this.active=i;try{return r(wi(i)),!0}catch(n){throw Te(this.root,i),this.active=void 0,this.retryNotBeforeMs=this.now()+this.retryDelayMs,this.refreshStatus(),n}}completeActive(){return this.active?(Ct(this.root,this.active,()=>new Date(this.now())),this.active=void 0,this.retryNotBeforeMs=0,this.refreshStatus(),!0):!1}failActive(){return this.active?(Te(this.root,this.active),this.active=void 0,this.retryNotBeforeMs=this.now()+this.retryDelayMs,this.refreshStatus(),!0):!1}status(){return{...this.currentStatus}}refreshStatus(){this.currentStatus=Ce(this.root)}};function wi(t){if(t.requests.length===1)return t.requests[0].detail;let r=[...new Set(t.requests.map(i=>i.detail))].slice(0,3).join("; ");return`${t.requests.length} coalesced refresh requests${r?`: ${r}`:""}`.slice(0,2048)}import{randomUUID as Ii}from"crypto";import{rmSync as ki}from"fs";import{Worker as Pi}from"worker_threads";var ce=class{constructor(e){this.options=e;if(this.now=e.now??Date.now,this.setTimer=e.setTimer??setTimeout,this.clearTimer=e.clearTimer??clearTimeout,e.maxWorkerFailureRetries!==void 0&&(!Number.isInteger(e.maxWorkerFailureRetries)||e.maxWorkerFailureRetries<0))throw new Error("Worker maxWorkerFailureRetries must be a non-negative integer.")}options;now;setTimer;clearTimer;worker=null;active=null;activeFailure=null;terminating=null;closed=!1;workerGeneration=0;idleTimer=null;canAccept(){return!this.closed&&this.active===null&&this.terminating===null}hasWorker(){return this.worker!==null}start(e){if(!this.canAccept())return!1;if(this.clearIdleTimer(),e.deadlineAtMs<this.now()){try{this.options.onReject(e,`${this.options.name} request expired before processing.`)}catch(n){this.closed=!0,this.options.onFatal(Oe(n))}return!0}let r=this.ensureWorker(),i=this.deadlineTimer(e);this.active={request:e,timer:i,workerFailureRetries:0,workerFailureReasons:[]};try{r.postMessage({kind:"request",...e})}catch(n){this.failActiveAfterTermination(Ne(n),!0)}return!0}async close(e=`${this.options.name} service is shutting down.`){if(this.closed=!0,this.clearIdleTimer(),this.active){await this.failActiveAfterTermination(e);return}await this.terminateWorker()}ensureWorker(){if(this.worker)return this.worker;let e=this.options.createWorker(),r=++this.workerGeneration;return e.on("message",i=>this.handleMessage(r,i)),e.on("error",i=>{r===this.workerGeneration&&this.failActiveAfterTermination(`${this.options.name} worker failed: ${i.message}`,!0)}),e.on("exit",i=>{r!==this.workerGeneration||this.terminating||(this.worker=null,this.active&&this.failActiveAfterTermination(`${this.options.name} worker exited unexpectedly with code ${i}.`,!0))}),this.worker=e,e}handleMessage(e,r){if(e!==this.workerGeneration||this.closed||!this.active)return;let i=xi(r);if(!i){this.failActiveAfterTermination(`${this.options.name} worker returned an invalid response.`);return}if(i.requestId!==this.active.request.requestId){this.failActiveAfterTermination(`${this.options.name} worker returned a mismatched request identity.`);return}if(this.now()>this.active.request.deadlineAtMs){this.failActiveAfterTermination(`${this.options.name} request expired while it was processing.`);return}let n=this.active,s;try{this.options.onStatus(i.status),i.ok?this.options.onComplete(n.request,i.result,i.status):this.options.onReject(n.request,i.error,i.status),s=this.options.retireAfterResponse?.(i.status)??!1}catch(a){this.closed=!0,this.clearTimer(n.timer),this.options.onFatal(Oe(a));return}this.releaseActive(n),s?this.terminateWorker():this.scheduleIdleTermination()}async failActiveAfterTermination(e,r=!1){if(this.activeFailure){await this.activeFailure;return}let i=this.active;if(!i){await this.terminateWorker();return}this.clearTimer(i.timer),r&&i.workerFailureReasons.push(e);let n=(async()=>{if(!await this.terminateWorker())return;let a=this.options.maxWorkerFailureRetries??0;if(r&&!this.closed&&i.workerFailureRetries<a&&this.now()<=i.request.deadlineAtMs){i.workerFailureRetries+=1;try{let c=this.ensureWorker();i.timer=this.deadlineTimer(i.request),c.postMessage({kind:"request",...i.request});return}catch(c){let l=`Cold Worker retry failed: ${Ne(c)}`;if(i.workerFailureReasons.push(l),e=`${e} ${l}`,!await this.terminateWorker())return}}let o=i.workerFailureReasons.length===0?e:[...new Set([...i.workerFailureReasons,e])].join(" Cold Worker retry: ");try{this.options.onReject(i.request,o)}catch(c){this.closed=!0,this.options.onFatal(Oe(c));return}this.releaseActive(i)})();this.activeFailure=n;try{await n}finally{this.activeFailure===n&&(this.activeFailure=null)}}deadlineTimer(e){let r=Math.max(1,Math.min(2147483647,e.deadlineAtMs-this.now()));return this.setTimer(()=>{this.failActiveAfterTermination(`${this.options.name} request exceeded its deadline.`)},r)}releaseActive(e){this.active===e&&(this.active=null,this.clearTimer(e.timer))}scheduleIdleTermination(){let e=this.options.idleTtlMs;!e||e<=0||this.closed||this.active||!this.worker||(this.clearIdleTimer(),this.idleTimer=this.setTimer(()=>{this.idleTimer=null,!(this.closed||this.active||!this.worker)&&this.terminateWorker()},e))}clearIdleTimer(){this.idleTimer&&(this.clearTimer(this.idleTimer),this.idleTimer=null)}async terminateWorker(){if(this.clearIdleTimer(),this.terminating)return this.terminating;let e=this.worker;if(!e)return!0;this.worker=null;let r=++this.workerGeneration;return this.terminating=(async()=>{try{return await e.terminate(),!0}catch(i){return this.closed=!0,this.options.onFatal(new Error(`${this.options.name} worker termination failed: ${Ne(i)}`,{cause:i})),!1}finally{r===this.workerGeneration&&(this.terminating=null)}})(),this.terminating}};function xi(t){if(!t||typeof t!="object")return null;let e=t;if(e.kind!=="response"||typeof e.requestId!="string"||!("status"in e))return null;if(e.ok===!0){if(!("result"in e)||"error"in e)return null}else if(e.ok===!1){if("result"in e||typeof e.error!="string")return null}else return null;return e}function Oe(t){return t instanceof Error?t:new Error(String(t))}function Ne(t){return t instanceof Error?t.message:String(t)}var Ti=6e4,Ci=10*6e4;function hr(t){let e=t.maxActiveSessions??8,r=t.workerSoftMemoryMb??Wi(t.workerHeapMb),i=()=>({protocolVersion:Y,state:"idle",requests:0,sessionsCreated:0,sessionsReplaced:0,sessionsEvicted:0,activeSessions:0,maxActiveSessions:e,softMemoryLimitBytes:r*1024*1024,retireRequested:!1,initializations:0,programUpdates:0,documentsEmitted:0,documentsRemoved:0});return fr({name:"TypeScript index",paths:t.paths,now:t.now,limits:t.limits,initialStatus:i,parseEnvelope:Rt,createWorker:()=>mr(t,{kind:"index",projectRoot:t.projectRoot,dbPath:t.dbPath,maxActiveSessions:e,softMemoryLimitMb:r}),complete(n,s,a,o){we(t.paths,n,{ok:!0,protocolVersion:Y,id:s.id,baseGeneration:s.baseGeneration,response:a},{nowMs:o,limits:t.limits})},reject(n,s,a,o){xe(t.paths,n,{ok:!1,protocolVersion:Y,id:s,error:a},a,{nowMs:o,limits:t.limits})},idleTtlMs:t.workerIdleMs??Ci,maxWorkerFailureRetries:1,retireAfterResponse:n=>n.retireRequested===!0,statusWhenWorkerAbsent:n=>({...n,state:"idle",activeSessions:0,heapUsedBytes:0,retireRequested:!1}),onBusy:t.onBusy,onFatal:t.onFatal})}function pr(t){let e=()=>({protocolVersion:ee,state:"idle",requests:0,sessionsCreated:0,sessionsReused:0,sessionsRefreshed:0,sessionsReplaced:0,projectsCreated:0});return fr({name:"TypeScript semantic",paths:t.paths,now:t.now,limits:t.limits,initialStatus:e,parseEnvelope:kt,createWorker:()=>mr(t,{kind:"semantic",projectRoot:t.projectRoot}),complete(r,i,n,s){we(t.paths,r,{ok:!0,protocolVersion:ee,id:i.id,generation:i.generation,response:n},{nowMs:s,limits:t.limits})},reject(r,i,n,s){xe(t.paths,r,{ok:!1,protocolVersion:ee,id:i,error:n},n,{nowMs:s,limits:t.limits})},idleTtlMs:Ti,onBusy:t.onBusy,onFatal:t.onFatal})}function fr(t){let e=t.now??Date.now,r=T(process.pid),i={pid:process.pid,...r?{processIdentity:r}:{}},n=`${t.name.toLowerCase().replaceAll(" ","-")}-${process.pid}-${Ii()}`,s={...t.limits,maxBatch:1},a=null,o=t.initialStatus(),c=!1,l=p=>{c=!0,t.onFatal(p)},u=new ce({name:t.name,createWorker:t.createWorker,now:e,idleTtlMs:t.idleTtlMs,maxWorkerFailureRetries:t.maxWorkerFailureRetries,retireAfterResponse:t.retireAfterResponse,onComplete(p,m,f){let y=d(p.requestId);o=f;let I=e();try{t.complete(y.claim,y.envelope,m,I)}catch(k){if(!(k instanceof Re))throw k;try{t.reject(y.claim,y.envelope.id,k.message,I)}catch(P){if(!(P instanceof Re))throw P;ki(y.claim.path,{force:!0})}}h(y)},onReject(p,m,f){let y=d(p.requestId);f!==void 0&&(o=f),t.reject(y.claim,y.envelope.id,m,e()),h(y)},onStatus(p){o=p},onFatal:l});return{poll(){if(c||!u.canAccept())return 0;let p=mt(t.paths,{ownerId:n,nowMs:e(),limits:s,owner:i,liveness:{isProcessAlive:M,readProcessIdentity:T}})[0];if(!p)return 0;let m=p.requestId;try{let f=t.parseEnvelope(yt(p,s));if(m=f.id,f.id!==p.requestId)throw new Error(`${t.name} request identity does not match its mailbox path.`);if(f.deadlineAtMs<e())throw new Error(`${t.name} request expired before processing.`);if(a={claim:p,envelope:f},t.onBusy?.(f.deadlineAtMs),!u.start({requestId:f.id,deadlineAtMs:f.deadlineAtMs,payload:f}))throw new Error(`${t.name} worker lane closed admission after claiming a request.`)}catch(f){let y=Ai(f);try{t.reject(p,m,y,e()),a?.claim===p&&h(a)}catch(I){l(Mi(I))}}return 1},status(){return{...u.hasWorker()||!t.statusWhenWorkerAbsent?o:t.statusWhenWorkerAbsent(o),mailbox:St(t.paths)}},async close(p){await u.close(p)}};function d(p){let m=a;if(!m||m.envelope.id!==p)throw new Error(`${t.name} parent lost the active mailbox claim.`);return m}function h(p){a===p&&(a=null,t.onBusy?.(void 0))}}var Ei=6144;function gr(){let t=Number.parseInt(process.env.SCIP_TS_WORKER_HEAP_MB??"",10);return Number.isFinite(t)&&t>0?t:Ei}function Wi(t){return Math.max(1,Math.floor((t??gr())*.9))}function mr(t,e){if(t.createWorker)return t.createWorker(e);let r=t.workerUrl??new URL("./typescript-mailbox-worker.js",import.meta.url);return new Pi(r,{workerData:e,resourceLimits:{maxOldGenerationSizeMb:t.workerHeapMb??gr()}})}function Mi(t){return t instanceof Error?t:new Error(String(t))}function Ai(t){return t instanceof Error?t.message:String(t)}var Sr=2e3,_i=5e3,Gi=5e3,Di=6e4,Fi=10,Oi=50,Ni=1e4;function qi(t,e=1){return Ye(t,e,Fi,Oi,Ni,8)}function Bi(t,e){let r;return{begin(){return r||(e.requestStop(),e.closeWake(),r=t.stop(),r.catch(()=>{})),r}}}async function $i(t,e){let r=e.processIndexRequests(),i=e.processSemanticRequests(),n=r+i,s=n>0?0:t+1;if(e.afterMailboxPoll({indexRequests:r,semanticRequests:i,processedRequests:n}),e.shouldStop())return{indexRequests:r,semanticRequests:i,processedRequests:n,consecutiveIdlePolls:s,stopped:!0};let a=qi(n,s);return await e.wait(a),{indexRequests:r,semanticRequests:i,processedRequests:n,consecutiveIdlePolls:s,stopped:!1,delayMs:a}}function Ui(t){return t==="fresh"?null:{kind:"watch-startup",detail:`index ${t} when watch service started`}}function zi(t){Lt(t.statePath,{version:1,protocolVersion:bt,pid:v.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{},projectRoot:t.projectRoot,...t.worktreeId?{worktreeId:t.worktreeId}:{},cliVersion:t.cliVersion,startedAt:new Date(t.startedAtMs).toISOString(),heartbeatAt:new Date(t.nowMs).toISOString(),lastActivityAt:new Date(t.lastActivityAtMs).toISOString(),...t.idleTimeoutMs===0?{}:{idleDeadlineAt:new Date(t.lastActivityAtMs+t.idleTimeoutMs).toISOString()},watcher:t.watcherStatus,...t.watcherStatus.state==="idle"&&t.indexGeneration?{indexGeneration:t.indexGeneration}:{},...t.lastRefresh?{lastRefresh:t.lastRefresh}:{},...t.lastError?{lastError:t.lastError}:{},reindexActivity:t.reindexActivity,refreshRequests:t.refreshCoordinator.status(),typescriptSemantic:{...t.semanticLane.status(),...t.semanticBusyUntilMs===void 0?{}:{busyUntil:new Date(t.semanticBusyUntilMs).toISOString()}},typescriptIndex:{...t.indexLane.status(),...t.indexBusyUntilMs===void 0?{}:{busyUntil:new Date(t.indexBusyUntilMs).toISOString()}}},{durability:t.durability})}function Ji(t){let e=0,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return({processedRequests:a})=>{let o=C();if(o-i>=Gi&&(i=o,!Ot(t.worktreeLiveness))){t.requestStop();return}if(o-s>=Di&&(s=o,Ie(t.indexMailboxPaths),Ie(t.semanticMailboxPaths)),o-n>=oe&&(n=o,lr(t.projectRoot,t.cliVersion)),o-r>=_i){r=o;let c=jt(t.activityPath);c&&t.updateObservedActivity(c.atMs,o),c?.refreshRequestedAtMs!==void 0&&c.refreshRequestedAtMs>e&&(e=c.refreshRequestedAtMs,t.refreshCoordinator.observeLegacyRequest(c.refreshRequestedAtMs,c.refreshDetail??"stale index observed by a legacy command"))}t.refreshCoordinator.poll(t.watcherStatus(),c=>{t.recordActivity(),t.requestRefresh(c)}),a>0&&(t.recordActivity(),t.persistState(!0,"visibility")),t.persistState()}}async function Vi(t){let e,r=0,i=!1,n,s;v.once("SIGINT",t.stopSignal),v.once("SIGTERM",t.stopSignal);try{t.watcher.start();let o=t.initializeFreshness();for(t.recordActivity(),t.markReady(),t.persistState(!0),e=setInterval(()=>t.persistState(),Sr),e.unref?.(),o&&t.requestRefresh(o);!t.stopRequested();){let c=await $i(r,{processIndexRequests:t.processIndexRequests,processSemanticRequests:t.processSemanticRequests,afterMailboxPoll:t.afterMailboxPoll,shouldStop:t.shouldStop,wait:t.wait});if(r=c.consecutiveIdlePolls,c.stopped)break}}catch(o){i=!0,n=o}finally{v.off("SIGINT",t.stopSignal),v.off("SIGTERM",t.stopSignal),e!==void 0&&clearInterval(e);let o=t.shutdown.begin();await t.closeLanes();let c=await o;c.state==="stopped"?t.finalizeStopped():s=t.finalizeDegraded(c.reasons)}let a=t.mailboxFatalError();if(!i&&a&&(i=!0,n=a),i&&s)throw new AggregateError([n,s],"Watch service execution and shutdown both failed.");if(i)throw n;if(s)throw s}function Hi(t){let e=pr({paths:t.semanticPaths,projectRoot:t.projectRoot,onBusy:t.onSemanticBusy,onFatal:t.onFatal}),r=t.config.indexer?.typescript,i=hr({paths:t.indexPaths,projectRoot:t.projectRoot,dbPath:t.dbPath,...r?.maxWarmSessions===void 0?{}:{maxActiveSessions:r.maxWarmSessions},...r?.workerIdleMs===void 0?{}:{workerIdleMs:r.workerIdleMs},...r?.workerSoftMemoryMb===void 0?{}:{workerSoftMemoryMb:r.workerSoftMemoryMb},...r?.workerHeapMb===void 0?{}:{workerHeapMb:r.workerHeapMb},onBusy:t.onIndexBusy,onFatal:t.onFatal});return{semanticLane:e,indexLane:i}}async function Xi(t,e,r={}){let i=Mt(t,e),n=i.projectRoot,s=i.worktreeKind==="git"?Ki(n,i.worktreeId):void 0,a=Ft(n,s),o=B(n);o.watch={...o.watch,...r};let c=Z(o);if(!c.enabled)throw new Error('watch mode is disabled; set "watch.enabled": true before starting the service');let l=N(n,o),u=Q(l.cacheDir),d=T(v.pid),h=_t(u.lockPath,n,{readProcessIdentity:g=>g===v.pid?d:T(g)});if(!h.acquired)return;let p=new ae(u.refreshRequestsPath,{retryDelayMs:Math.max(1e3,c.cooldownMs)});p.initializeAfterOwnershipAcquired();let m=Date.now(),f=C(),y=m,I=f,k={state:"idle"},P,le,E,de,ue=K(l.dbPath),H=!1,qe=!1,Be=Number.NEGATIVE_INFINITY,$e,Ue,D=It(l.cacheDir),F=vt(l.cacheDir);be(D),be(F);let ze=Pe([F.pendingDir,F.legacyRequestDir,D.pendingDir,D.legacyRequestDir,u.refreshRequestsPath]),w=(g=!1,W=g?"durable":"visibility")=>{if(!qe)return;let fe=Date.now(),L=C();!g&&L-Be<Sr||(Be=L,zi({statePath:u.statePath,durability:W,processIdentity:d,projectRoot:n,worktreeId:i.worktreeId,cliVersion:e,startedAtMs:m,nowMs:fe,lastActivityAtMs:y,idleTimeoutMs:c.idleTimeoutMs,watcherStatus:k,indexGeneration:P,lastRefresh:le,lastError:E,reindexActivity:ue,refreshCoordinator:p,semanticLane:he,indexLane:pe,semanticBusyUntilMs:$e,indexBusyUntilMs:Ue}))},A=()=>{y=Date.now(),I=C()},vr=g=>{A(),de??=g,E={at:new Date().toISOString(),message:g.message},w(!0,"visibility")},{semanticLane:he,indexLane:pe}=Hi({semanticPaths:D,indexPaths:F,projectRoot:n,dbPath:l.dbPath,config:o,onSemanticBusy(g){$e=g===void 0?void 0:g+5e3,w(!0,"visibility")},onIndexBusy(g){Ue=g===void 0?void 0:g+5e3,w(!0,"visibility")},onFatal:vr}),X=new ne({projectRoot:n,config:{...o,watch:c},outputDb:l.dbPath,languages:o.languages,onStatus(g){k=g,g.state!=="idle"&&(P=void 0),g.state!=="idle"&&A(),w(!0)},onReindexComplete(g,W,fe){A();let L=fe?.pendingChanges!==!1?$(n,o,l):xt(l);return le=L.lastRefresh,P=L.state==="fresh"?j(l.dbPath)??void 0:void 0,ue=K(l.dbPath),p.completeActive(),E=void 0,w(!0),L.state==="fresh"},onReindexError(){p.failActive()},onRefreshSuppressed(g){let W=pt(l.dbPath,g);W.state==="failed"&&(E={at:new Date().toISOString(),message:`Suppressed-refresh telemetry was not recorded: ${W.reason}`},w(!0,"visibility")),ue=K(l.dbPath)},onError(g){A(),P=void 0,E={at:new Date().toISOString(),message:g.message},w(!0)}}),Je=Bi(X,{requestStop(){H=!0},closeWake(){ze.close()}}),Rr=()=>{Je.begin()},br=Ji({worktreeLiveness:a,indexMailboxPaths:F,semanticMailboxPaths:D,projectRoot:n,cliVersion:e,activityPath:u.activityPath,refreshCoordinator:p,watcherStatus:()=>k,requestRefresh:g=>X.requestRefresh({kind:"watch-demand",detail:g},{immediate:!0}),requestStop:()=>{H=!0},recordActivity:A,updateObservedActivity(g,W){g<=y||(y=g,I=W)},persistState:w});await Vi({watcher:X,shutdown:Je,stopSignal:Rr,initializeFreshness(){let g=$(n,o,l);return le=g.lastRefresh,P=g.state==="fresh"?j(l.dbPath)??void 0:void 0,Ui(g.state)},markReady:()=>{qe=!0},recordActivity:A,persistState:w,requestRefresh:g=>X.requestRefresh(g,{immediate:!0}),stopRequested:()=>H,processIndexRequests:()=>pe.poll(),processSemanticRequests:()=>he.poll(),afterMailboxPoll:br,shouldStop:()=>H||de!==void 0||Gt({watcher:k,lastActivityAtMs:I,nowMs:C(),idleTimeoutMs:c.idleTimeoutMs}),wait:g=>ze.wait(g),closeLanes:()=>Promise.all([he.close("TypeScript semantic service stopped before completing the request."),pe.close("TypeScript index service stopped before completing the request.")]).then(()=>{}),mailboxFatalError:()=>de,finalizeStopped(){yr(u.statePath,{force:!0}),yr(u.activityPath,{force:!0}),h.release()},finalizeDegraded(g){return E={at:new Date().toISOString(),message:`Watch service shutdown is degraded: ${g.join("; ")}`},w(!0),new Error(E.message)}})}function Ki(t,e){let r=nt(t);if(r.kind!=="worktree"||r.identity.worktreeId!==e)throw new Error(`Git worktree identity changed while starting the watch service for ${t}.`);return r.identity.gitDir}function Yi(t,e={report:r=>console.error(r),exit:r=>v.exit(r)}){return e.report(`watch-service: ${wt(t instanceof Error?t.message:String(t))}`),e.exit(1)}var Qi=v.argv[1]?ji(Li(v.argv[1])).href:null;if(Qi===import.meta.url){let t=v.argv[2],e=v.argv[3],r=Zi(v.argv[4]);if(!t||!e)console.error("watch-service: expected <project-root> <cli-version>"),v.exitCode=1;else try{await Xi(t,e,r)}catch(i){Yi(i)}}function Zi(t){if(!t)return{};try{let e=JSON.parse(t);return e&&typeof e=="object"?e:{}}catch{return{}}}export{Pe as createPathChangeWake,Bi as createWatchServiceShutdown,$i as runWatchServiceLoopIteration,Xi as runWatchServiceServer,Ui as startupRefreshTrigger,Yi as terminateWatchServiceProcess,qi as watchServiceLoopDelayMs};
|
|
1
|
+
import{b as Ke,c as Xe,g as gt,j as yt,k as X,l as St,m as ke}from"./chunk-7RIRIADH.js";import{a as Y,b as xt,c as It}from"./chunk-G4ALYS4J.js";import{a as Te,b as Mt,c as Wt,d as At,e as Pe,f as Lt,g as Ce,h as _t,i as jt,j as Gt,k as Dt,l as Ft,m as Ot,n as Nt}from"./chunk-X6OGVFIT.js";import{a as Tt}from"./chunk-MXNGIEPU.js";import{a as kt,c as Q}from"./chunk-EHYDXE3Z.js";import"./chunk-2OOY75BW.js";import{d as B,e as Z,f as $,g as Pt}from"./chunk-HMEWLMML.js";import"./chunk-DHEQMPLW.js";import{a as ee,b as Ct,c as Et}from"./chunk-U6KCHXJ4.js";import{H as Rt,c as _}from"./chunk-RMDPFPNW.js";import{c as it,d as ye}from"./chunk-WYPL7GF7.js";import{a as pt,b as ft}from"./chunk-T3I6NHBH.js";import{e as ht}from"./chunk-ATXPTSEI.js";import{a as ge,d as Qe}from"./chunk-CKBUBRYD.js";import{a as mt}from"./chunk-MWN53KRN.js";import"./chunk-IW5XQG5G.js";import"./chunk-3AF4TUFK.js";import{b as Re,g as ve,i as be,m as vt,n as bt,o as we,p as xe,q as Ie,r as wt}from"./chunk-T3CZAZSI.js";import{a as W}from"./chunk-B3PYOSCX.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import{c as P,d as C,e as Ze}from"./chunk-JFMEXGFE.js";import{B as q,F as nt,G as st,J as ot,K as at,L as Se,M as ct,Q as lt,T as dt,a as me,c as Ye,ha as ut,u as et,v as O,w as tt,y as rt,z as N}from"./chunk-7HXT6YLU.js";import{a as Je,g as Ve,h as v}from"./chunk-7F45LJKI.js";import Bi from"better-sqlite3";import R from"process";import{rmSync as Ir}from"fs";import{resolve as $i}from"path";import{pathToFileURL as Ui}from"url";import{lstatSync as Er}from"fs";function Bt(t,e){let r=te(t);if(r.kind!=="directory")throw new Error(`Watcher root is not a directory: ${t}`);if(!e)return{projectRoot:t,projectDirectory:r};let i=te(e);if(i.kind!=="directory")throw new Error(`Git control path is not a directory: ${e}`);return{projectRoot:t,projectDirectory:r,gitControlDirectory:{path:e,identity:i}}}function $t(t){try{if(!qt(t.projectDirectory,te(t.projectRoot)))return!1;let e=t.gitControlDirectory;return!e||qt(e.identity,te(e.path))}catch{return!1}}function te(t){let e=Er(t,{bigint:!0}),r=e.isDirectory()?"directory":e.isFile()?"file":void 0;if(!r||e.isSymbolicLink())throw new Error(`Unsupported watcher identity path: ${t}`);return{device:e.dev,inode:e.ino,birthtimeNs:e.birthtimeNs,kind:r}}function qt(t,e){return t.device===e.device&&t.inode===e.inode&&t.birthtimeNs===e.birthtimeNs&&t.kind===e.kind}import{existsSync as Le,lstatSync as Wr,statSync as Zt,watch as Ar}from"fs";import{EventEmitter as Lr}from"events";import{basename as _r,dirname as er,isAbsolute as _e,join as b,relative as tr,resolve as rr}from"path";import{watch as jr}from"chokidar";import Gr from"ignore";var ir=5e3,ne=class{projectRoot;config;watchConfig;outputDb;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onReindexError;onRefreshSuppressed;onError;reindexRunner;subscriptionFactory;budgetInspector;clock;activeOperation=null;stopPromise=null;stopInProgress=!1;status={state:"idle"};debounceTimer=null;cooldownTimer=null;budgetTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;pendingChanges=new Map;pendingChangesComplete=!0;pendingChangesIncompleteReason;reindexInFlight=!1;lastReindexEnd=0;lastObservedGeneration=null;publishedGeneration;indexFreshness;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;reconcileTimer=null;lastGitState=null;preferFilesystemGitState=!0;watchGitLayout=null;localCacheWatchPath;gitignoreFilter;extraIgnore;stopped=!1;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=Z(e.config),this.outputDb=e.outputDb??b(et(this.projectRoot,e.config),"index.db"),this.preferFilesystemGitState=e.gitReader===void 0,this.localCacheWatchPath=ai(this.projectRoot,er(this.outputDb)),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.clojureConfigPath=e.config.indexer?.clojure?.configPath,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onReindexError=e.onReindexError??(()=>{}),this.onRefreshSuppressed=e.onRefreshSuppressed??(()=>{}),this.onError=e.onError??(r=>console.error(r.message)),this.clock=e.clock??qr,nr.set(this,ci(e.stopTimeoutMs??ir,"watcher stop timeout")),this.reindexRunner=e.reindexRunner??Yr(),this.subscriptionFactory=e.subscriptionFactory??Br,this.budgetInspector=e.budgetInspector??St,this.publishedGeneration=e.publishedGeneration??_,this.indexFreshness=e.indexFreshness??oi,this.lastObservedGeneration=this.readPublishedGeneration(),sr.set(this,{projectRoot:e.projectRoot,config:e.config,gitReader:e.gitReader??nt,languages:ar(e.languages??e.config.languages),typeScriptInputPaths:null,stagedIndexEntries:null}),this.gitignoreFilter=mt(e.projectRoot),this.extraIgnore=Gr(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore),Me(this)}start(){if(this.stopInProgress)throw new Error("Cannot restart a watcher while its previous ownership is still draining.");this.stopped=!1,this.stopPromise=null,ie(this).errors=[],this.sourcePollingFallbackStarted=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(e){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(e)}`))}}stop(){if(this.stopPromise)return this.stopPromise;this.stopped=!0,this.stopInProgress=!0;let e=this.fsWatchers;this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearBudgetTimer(),this.clearGitPollTimer(),this.clearReconcileTimer();let r=this.activeOperation;r&&this.setStatus({state:"draining",startedAt:this.wallNow(),reason:"waiting for the active reindex worker to exit"});let i=[...ie(this).closures],n=Fr(this),s=this.clock.now()+n;return this.stopPromise=this.finishStop(e,i,r,s,n).catch(a=>{throw this.stopInProgress=!1,a}),this.stopPromise}requestRefresh(e,r={}){if(!this.stopped){if(this.markPendingChangesIncomplete(`unstructured-trigger:${e.kind}`),!r.immediate||this.reindexInFlight||this.status.state==="cooldown"||this.status.state==="budget-paused"){this.scheduleReindex(e);return}this.pendingTrigger=Ee(this.pendingTrigger,e),this.changedFiles+=1,this.clearDebounceTimer(),this.triggerReindex()}}startSourceWatcher(e=!1){let r=this.subscriptionFactory(this.projectRoot,{ignoreInitial:!0,ignored:(i,n)=>this.isIgnoredWatchPath(i,n?.isDirectory()??!1),usePolling:e,ignorePermissionErrors:!0,...e?{interval:5e3,binaryInterval:1e4}:{}});r.on("all",(i,n)=>{!this.stopped&&i!=="addDir"&&i!=="unlinkDir"&&this.handleFileChange(i,n)}),r.on("error",i=>this.handleSourceWatcherError(r,i,e)),this.fsWatchers.push(r)}handleSourceWatcherError(e,r,i){if(this.markPendingChangesIncomplete("source-watcher-error"),i||this.sourcePollingFallbackStarted||!ti(r)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(r)}`));return}this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(n=>n!==e),Or(ie(this),e,n=>this.onError(n));try{this.startSourceWatcher(!0)}catch(n){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(n)}`))}}isIgnoredWatchPath(e,r){let i=this.relativeWatchPath(e);if(!i)return!1;if(Jt(i,this.localCacheWatchPath))return!0;let n=r?`${i}/`:i;return this.gitignoreFilter.isIgnored(n)||this.extraIgnore.ignores(n)}handleFileChange(e,r){let i=this.relativeWatchPath(r);if(!i||i===".."||i.startsWith("../")||Jt(i,this.localCacheWatchPath)||this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)||i.endsWith("index.db")||i.endsWith("index.scip")||i.endsWith("index.db.tmp")||_r(i).startsWith(gt))return;i===".scipquery.json"&&Xt(this,this.projectRoot);let n=Yt(this,e,i);n!==null&&(n||this.markPendingChangesIncomplete(`unsupported-source-event:${e}`),this.scheduleReindex({kind:"watch-source",detail:i},n?[{path:i,kind:n}]:void 0,n!==void 0))}relativeWatchPath(e){let r=_e(e)?e:b(this.projectRoot,e);return tr(this.projectRoot,r).replaceAll("\\","/")}scheduleReindex(e,r,i=!1){this.pendingTrigger=Ee(this.pendingTrigger,e),i||this.markPendingChangesIncomplete(`unstructured-trigger:${e.kind}`);for(let s of r??[])this.recordPendingChange(s);if(this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});let s=this.activeOperation;s&&j.get(this)!==s&&(j.set(this,s),s.cancel().then(a=>{a.state==="degraded"&&!this.stopped&&this.onError(new Error(a.reason))},a=>{this.stopped||this.onError(a instanceof Error?a:new Error(String(a)))}));return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}if(this.status.state==="budget-paused"){this.dirty=!0,this.setStatus({...this.status,dirty:!0});return}this.clearDebounceTimer();let n=this.wallNow()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:n}),this.debounceTimer=this.clock.setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped||this.reconcileExternalPublication())return;let e=this.inspectBudget(),r=this.watchConfig.allowExpensiveRebuild&&e.state!=="paused";if(e.state==="paused"&&e.reason!=="rebuild-count"){this.dirty=!0;let c=Math.max(this.wallNow()+1,e.until);this.setStatus({state:"budget-paused",until:c,dirty:!0,reason:e.detail,rebuilt:e.rebuilt,estimatedWriteBytes:e.estimatedWriteBytes}),this.clearBudgetTimer(),this.budgetTimer=this.clock.setTimeout(()=>{this.budgetTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},Math.min(2147483647,Math.max(1,c-this.wallNow())));return}let i=this.clock.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&i<this.watchConfig.cooldownMs){let c=this.watchConfig.cooldownMs-i;this.dirty=!0;let l=this.wallNow()+c;this.setStatus({state:"cooldown",until:l,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},c);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let n=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let s=this.consumePendingChangeJournal(),a=this.wallNow();this.setStatus({state:"indexing",startedAt:a});let o=this.reindexRunner.start(this.reindexRequest(n,r,s));this.activeOperation=o,o.completion.then(c=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),re.set(this,0),this.stopped)return;if(j.get(this)===o){if(this.restorePendingChangeJournal(s),this.dirty){let u=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:u,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"});return}Me(this),this.lastObservedGeneration=this.readPublishedGeneration();let l=!1;try{l=this.onReindexComplete(c,n,{pendingChanges:this.dirty})===!0}catch(u){this.onError(u instanceof Error?u:new Error(String(u)))}if(this.dirty&&!this.stopped){if(l){let d=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.resetPendingChanges(),this.onRefreshSuppressed(d),this.setStatus({state:"idle"});return}let u=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:u,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(c=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let l=c instanceof Error?c:new Error(String(c));this.restorePendingChangeJournal(s);let u=or(l),d=0;if(u?(d=(re.get(this)??0)+1,re.set(this,d),this.dirty=!0,this.pendingTrigger=Ee(this.pendingTrigger,n)):re.set(this,0),!u&&j.get(this)!==o&&(this.onReindexError(l,n),this.onError(l)),this.dirty){let h=u?Xr(this.watchConfig.cooldownMs,d):this.watchConfig.cooldownMs,p=this.wallNow()+h;this.setStatus({state:"cooldown",until:p,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},h);return}this.setStatus({state:"idle"})}).finally(()=>{this.activeOperation===o&&(this.activeOperation=null),j.get(this)===o&&j.delete(this)})}async finishStop(e,r,i,n,s){let a=[],o=e.map(async h=>{try{await h.close()}catch(p){a.push(`watch subscription close failed: ${String(p)}`)}});o.push(...r),i&&o.push((async()=>{try{let h=await i.cancel();h.state==="degraded"&&a.push(h.reason)}catch(h){a.push(`reindex cancellation failed: ${h instanceof Error?h.message:String(h)}`)}})());let c=o.length,l=o.map(h=>h.finally(()=>{c-=1})),u=await Dr(l,n,this.clock),d=ie(this);return a.push(...d.errors),d.errors=[],u?this.stopInProgress=!1:(a.push(`watch shutdown exceeded the ${s}ms deadline with ${c} operation(s) still pending`),Promise.all(l).then(()=>{this.stopInProgress=!1})),a.length>0?(this.setStatus({state:"draining",startedAt:this.wallNow(),reason:a.join("; ")}),{state:"degraded",reasons:a}):(this.setStatus({state:"idle"}),{state:"stopped"})}wallNow(){return this.clock.wallNow?.()??this.clock.now()}inspectBudget(){try{return this.budgetInspector(this.outputDb,this.watchConfig.resourceBudget,new Date(this.wallNow()))}catch(e){return{state:"paused",reason:"activity-evidence",until:this.wallNow()+this.watchConfig.resourceBudget.windowMs,rebuilt:0,estimatedWriteBytes:0,detail:`reindex activity evidence could not be read: ${e instanceof Error?e.message:String(e)}`}}}reindexRequest(e,r=!0,i){return{projectRoot:this.projectRoot,config:this.config,languages:this.languages,pnpmWorkspaces:this.pnpmWorkspaces,typescriptProjectMode:this.typescriptProjectMode,typescriptProjects:this.typescriptProjects,clojureConfigPath:this.clojureConfigPath,indexerConcurrency:this.indexerConcurrency,trigger:e,changeJournal:i,allowExpensiveRebuild:r}}setStatus(e){this.status=e,e.state==="cooldown"||e.state==="budget-paused"?this.armReconcileTimer(e.until):this.clearReconcileTimer(),this.onStatus(e)}recordPendingChange(e){if(this.pendingChanges.size>=1024&&!this.pendingChanges.has(e.path)){this.pendingChanges.clear(),this.markPendingChangesIncomplete("change-entry-limit");return}let r=this.pendingChanges.get(e.path),i=Zr(r,e.kind);i===null?this.pendingChanges.delete(e.path):this.pendingChanges.set(e.path,i)}markPendingChangesIncomplete(e){this.pendingChangesComplete=!1,this.pendingChangesIncompleteReason??=e}consumePendingChangeJournal(){let e=_(this.outputDb),r=[...this.pendingChanges.entries()].map(([a,o])=>({path:a,kind:o})).sort((a,o)=>a.path.localeCompare(o.path)),i=this.pendingChangesComplete,n=this.pendingChangesIncompleteReason;e||(i=!1,n??="accepted-generation-unavailable");let s={version:1,baseGeneration:e,complete:i,...n?{incompleteReason:n}:{},entries:r};return ke(s)||(s={version:1,baseGeneration:e,complete:!1,incompleteReason:"change-journal-byte-limit",entries:[]}),this.resetPendingChanges(),s}restorePendingChangeJournal(e){let r=[...this.pendingChanges.entries()].map(([s,a])=>({path:s,kind:a})),i=this.pendingChangesComplete,n=this.pendingChangesIncompleteReason;this.resetPendingChanges(),e.complete||this.markPendingChangesIncomplete(e.incompleteReason??"failed-reindex");for(let s of e.entries)this.recordPendingChange(s);i||this.markPendingChangesIncomplete(n??"failed-reindex");for(let s of r)this.recordPendingChange(s)}resetPendingChanges(){this.pendingChanges.clear(),this.pendingChangesComplete=!0,this.pendingChangesIncompleteReason=void 0}clearDebounceTimer(){this.debounceTimer&&(this.clock.clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(this.clock.clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}clearBudgetTimer(){this.budgetTimer&&(this.clock.clearTimeout(this.budgetTimer),this.budgetTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(x(this).stagedIndexEntries=Qt(this.projectRoot,x(this).gitReader),this.gitPollTimer=this.clock.setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}armReconcileTimer(e){this.clearReconcileTimer();let r=e-this.wallNow();if(r<=0||!(this.watchConfig.gitPollMs>0))return;let i=Math.min(this.watchConfig.gitPollMs,r);this.reconcileTimer=this.clock.setTimeout(()=>{this.reconcileTimer=null,!(this.stopped||this.reconcileExternalPublication())&&(this.status.state==="cooldown"||this.status.state==="budget-paused")&&this.armReconcileTimer(this.status.until)},i),this.reconcileTimer.unref?.()}clearReconcileTimer(){this.reconcileTimer&&(this.clock.clearTimeout(this.reconcileTimer),this.reconcileTimer=null)}readPublishedGeneration(){try{return this.publishedGeneration(this.outputDb)}catch{return null}}reconcileExternalPublication(){if(this.stopped||this.reindexInFlight||!(this.dirty||this.status.state==="budget-paused"||this.status.state==="cooldown"||this.status.state==="waiting"))return!1;let r=this.readPublishedGeneration();if(r===null||r===this.lastObservedGeneration)return!1;this.lastObservedGeneration=r;let i;try{i=this.indexFreshness(this.projectRoot,this.config,this.outputDb)}catch{return!1}if(i!=="fresh")return!1;let n=this.pendingTrigger??{kind:"unknown"};return this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearBudgetTimer(),this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.resetPendingChanges(),Me(this),this.onRefreshSuppressed({...n,detail:`a generation published outside the watcher is fresh${n.detail?` (${n.detail})`:""}`}),this.setStatus({state:"idle"}),!0}pollGitState(){if(this.reindexInFlight||this.stopped)return;let e=this.lastGitState,r=this.readGitState();if(!e||!r||this.stopped){this.lastGitState=r;return}this.lastGitState=r;let i=e.head!==r.head,n=e.indexPath!==r.indexPath||e.indexMtimeMs!==r.indexMtimeMs||e.indexSize!==r.indexSize;if(!i&&!n)return;let s=x(this),a=s.stagedIndexEntries,o=Qt(this.projectRoot,s.gitReader);s.stagedIndexEntries=o;let c=hi(this.projectRoot,s.gitReader,e,r,a,o,i,n),l=null;if(c!==null&&(c.includes(".scipquery.json")&&Xt(this,this.projectRoot),l=c.filter(d=>Yt(this,"add",d)!==null),l.length===0))return;let u=l?.map(d=>({path:d,kind:Le(b(this.projectRoot,d))?"change":"delete"}));i&&n?this.scheduleReindex({kind:"watch-git-state",detail:We("HEAD and index changed",l)},u,u!==void 0):i?this.scheduleReindex({kind:"watch-git-head",detail:We("HEAD changed",l)},u,u!==void 0):n&&this.scheduleReindex({kind:"watch-git-index",detail:We(r.indexPath??"index changed",l)},u,u!==void 0)}readGitState(){if(this.preferFilesystemGitState){let e=this.readFilesystemGitState();if(e)return e}return this.readGitStateFromGit()}readFilesystemGitState(){let e=this.watchGitLayout??ri(this.projectRoot);if(!e)return null;this.watchGitLayout=e;let r=ii(e.gitDir);return r?Kt(r,e.indexPath):null}readGitStateFromGit(){let e=x(this).gitReader,r=Se(this.projectRoot,["rev-parse","--git-path","index"],e);if(!r)return null;let i=ct(this.projectRoot,r);return Kt(Se(this.projectRoot,["rev-parse","--verify","HEAD"],e),i)}clearGitPollTimer(){this.gitPollTimer&&(this.clock.clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};async function Dr(t,e,r){if(t.length===0)return!0;let i=Promise.all(t).then(()=>!0),n=Math.max(0,e-r.now()),s=null,a=new Promise(c=>{s=r.setTimeout(()=>c(!1),n)}),o=await Promise.race([i,a]);return o&&s&&r.clearTimeout(s),o}var Ht=new WeakMap,nr=new WeakMap,sr=new WeakMap,j=new WeakMap,re=new WeakMap;function ie(t){let e=Ht.get(t);if(e)return e;let r={closures:new Set,errors:[]};return Ht.set(t,r),r}function Fr(t){return nr.get(t)??ir}function x(t){let e=sr.get(t);if(!e)throw new Error("Watcher input state was not initialized.");return e}function Or(t,e,r){let i=Promise.resolve().then(()=>e.close()).catch(n=>{let s=`watch subscription close failed during polling fallback: ${String(n)}`;t.errors.push(s),r(new Error(s))});t.closures.add(i),i.then(()=>t.closures.delete(i))}function Nr(t,e=P){let{projectRoot:r,config:i,languages:n,pnpmWorkspaces:s,typescriptProjectMode:a,typescriptProjects:o,clojureConfigPath:c,indexerConcurrency:l,trigger:u}=t,d=B(r),h=Object.keys(d).length>0?d:i,p=N(r,h),g=h.indexer?.typescript,f=h.indexer?.clojure,y=e(process.pid);if(!y)throw new Error(`Could not establish watcher process identity for reindex worker ownership (pid ${process.pid}).`);return{workerPath:new URL("./reindex-worker.js",import.meta.url).pathname,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:r,SCIP_REINDEX_OUTPUT_SCIP:p.indexPath,SCIP_REINDEX_OUTPUT_DB:p.dbPath,SCIP_REINDEX_LANGUAGES:(h.languages??n)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(h.indexerConcurrency??l??""),SCIP_REINDEX_PNPM_WORKSPACES:g?.pnpmWorkspaces??s?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:g?.projectMode??a,projects:g?.projects??o??[],maxHeapMb:g?.maxHeapMb}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:f?.configPath??c??"",SCIP_REINDEX_TRIGGER_KIND:u.kind,SCIP_REINDEX_TRIGGER_DETAIL:u.detail??"",SCIP_REINDEX_CHANGE_JOURNAL:t.changeJournal?ke(t.changeJournal)??"":"",SCIP_REINDEX_ALLOW_EXPENSIVE:t.allowExpensiveRebuild===!1?"0":"1",SCIP_REINDEX_PROCESS_GROUP_LEADER:"1",SCIP_REINDEX_PARENT_IDENTITY:JSON.stringify(y)}}}var qr={now:C,wallNow:()=>Date.now(),setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Br=(t,e)=>$r(process.platform,e.usePolling)?new Ae(t):jr(t,e);function $r(t,e){return t==="darwin"&&e!==!0}var U=class extends Error{constructor(e,r){super(e,r===void 0?void 0:{cause:r}),this.name="RecursiveSourceWatchError"}},Ae=class{events=new Lr;watcher;constructor(e){this.watcher=Ar(e,{recursive:!0},(r,i)=>{if(i===null){this.events.emit("error",new U("Recursive source watcher omitted the changed path."));return}let n=b(e,i.toString());this.events.emit("all",Ur(r,n),n)}),this.watcher.on("error",r=>{this.events.emit("error",new U(`Recursive source watcher failed: ${r.message}`,r))})}on=(e,r)=>(this.events.on(e,r),this);close(){this.watcher.close()}};function Ur(t,e){return t==="change"?"change":Le(e)?Zt(e).isDirectory()?"addDir":"add":"unlink"}var Hr=15*6e4,zr=1e3,Jr=64*1024;function Vr(){return{stdoutTail:"",stderrTail:"",stdoutTruncated:!1,stderrTruncated:!1}}function zt(t,e){let r=t instanceof Error?t.message:String(t),i=e.stderrTail.trim()||e.stdoutTail.trim();return i?`${r}
|
|
2
|
+
${i}`:r}function Kr(t,e){return Object.assign(new Error(t,e===void 0?void 0:{cause:e}),{retryable:!0})}function or(t){return t instanceof Error&&"retryable"in t&&t.retryable===!0}function Xr(t,e){let r=t*2**Math.min(5,Math.max(0,e-1));return Math.max(t,Math.min(3e4,r))}function Yr(t={}){let e=t.timeoutMs??Hr,r=t.terminationGraceMs??zr,i=t.maxOutputBytes??Jr,n=t.resolveLaunch??Nr;return{start(s){let a=n(s),o=new AbortController,c=Vr(),l=!1,u=Xe({command:process.execPath,args:[...process.execArgv,a.workerPath],label:"watch reindex worker",env:a.env,timeoutMs:e,terminationGraceMs:r,maxStdoutBytes:i,maxStderrBytes:i,outputLimitBehavior:"truncate-tail",signal:o.signal,detached:!0}).then(d=>{if(c={stdoutTail:d.stdout,stderrTail:d.stderr,stdoutTruncated:d.stdoutTruncated,stderrTruncated:d.stderrTruncated},d.status!==0){let h=zt(new Error(`Reindex worker exited with ${d.signal?`signal ${d.signal}`:`code ${d.status}`}`),c);throw d.status===75?Kr(h):new Error(h)}return d.durationMs}).catch(d=>{throw or(d)?d:(d instanceof Ke&&(c={stdoutTail:d.stdout,stderrTail:d.stderr,stdoutTruncated:d.stdoutTruncated,stderrTruncated:d.stderrTruncated}),new Error(zt(d,c),{cause:d}))}).finally(()=>{l=!0});return{completion:u,async cancel(){l||o.abort();try{await u}catch{}return{state:"exited",diagnostics:c}},diagnostics:()=>c}}}}function Ee(t,e){return t?t.kind===e.kind?t.detail===e.detail?t:{kind:t.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${t.kind}, ${e.kind}`}:e}function Qr(t){if(t==="add")return"add";if(t==="change")return"change";if(t==="unlink")return"delete"}function Zr(t,e){return t?t==="add"?e==="delete"?null:"add":t==="delete"&&e==="add"?"change":e:e}function ei(t){return t instanceof Error&&"code"in t&&t.code==="EMFILE"||String(t).includes("EMFILE: too many open files")}function ti(t){return t instanceof U||ei(t)}var je=/^[0-9a-f]{40,64}$/i;function Jt(t,e){return t===".git"||t.startsWith(".git/")||t==="node_modules"||t.startsWith("node_modules/")||t.endsWith("/node_modules")||t.includes("/node_modules/")?!0:e!==void 0&&(t===e||t.startsWith(`${e}/`))}function ri(t){let e=b(t,".git");try{let r=Wr(e),i;if(r.isDirectory())i=e;else if(r.isFile()){let n=/^gitdir:\s*(.+)\s*$/m.exec(v(e,"Git directory marker"));if(!n?.[1])return null;let s=n[1].trim();i=_e(s)?s:rr(t,s)}else return null;return Le(i)?{gitDir:i,indexPath:b(i,"index")}:null}catch{return null}}function ii(t){let e;try{e=v(b(t,"HEAD"),"Git HEAD").trim()}catch{return}if(je.test(e))return e.toLowerCase();let r=/^ref:\s*(.+)$/.exec(e)?.[1]?.trim();if(!r)return;let i=ni(t);return Vt(t,r)??Vt(i,r)??si(i,r)}function ni(t){try{let e=v(b(t,"commondir"),"Git common-directory marker").trim();return e?_e(e)?e:rr(t,e):t}catch{return t}}function Vt(t,e){try{let r=v(b(t,e),"Git reference").trim();return je.test(r)?r.toLowerCase():void 0}catch{return}}function si(t,e){try{for(let r of v(b(t,"packed-refs"),"Git packed references").split(`
|
|
3
|
+
`)){if(r.startsWith("#")||r.startsWith("^"))continue;let i=r.indexOf(" ");if(i===-1)continue;let n=r.slice(0,i);if(r.slice(i+1).trim()===e&&je.test(n))return n.toLowerCase()}}catch{return}}function oi(t,e,r){let i=er(r);return $(t,e,{dbPath:r,metaPath:b(i,"meta.json"),cacheDir:i}).state}function Kt(t,e){let r={head:t,indexPath:e};try{let i=Zt(e);r.indexMtimeMs=i.mtimeMs,r.indexSize=i.size}catch{r.indexMtimeMs=void 0,r.indexSize=void 0}return r}function ai(t,e){let r=tr(t,e).replaceAll("\\","/");if(!(!r||r===".."||r.startsWith("../")))return r}function ci(t,e){if(!Number.isSafeInteger(t)||t<=0)throw new Error(`${e} must be a positive integer.`);return t}function ar(t){return t&&t.length>0?[...t]:ge}function Xt(t,e){try{let r=x(t);r.config=B(e),r.languages=ar(r.config.languages)}catch{x(t).languages=ge}}function Yt(t,e,r){let i=x(t);if(me(r,i.languages)==="other")return null;let s=Qr(e);if(r===".scipquery.json"||lt(r))return i.typeScriptInputPaths=null,s;if(!li(r,i.languages))return s;let a=i.typeScriptInputPaths;if(!a)return s;let o=a.has(r);if(s!=="add")return o?s:null;if(o)return"change";let c=cr(t);return c?c.has(r)?"add":null:s}function Me(t){let e=x(t);if(!e.languages.includes("typescript")){e.typeScriptInputPaths=null;return}let r=di(e.projectRoot,e.config,e.languages);e.typeScriptInputPaths=r??cr(t)}function cr(t){let e=x(t);if(!e.languages.includes("typescript"))return e.typeScriptInputPaths=null,null;try{let r=e.config.indexer?.typescript,i=dt(e.projectRoot,r?.projectMode,r?.projects);return e.typeScriptInputPaths=i,i}catch{return e.typeScriptInputPaths=null,null}}function li(t,e){if(!e.includes("typescript"))return!1;let r=me(t,["typescript","javascript"]);return r==="source"||r==="ambient"}function di(t,e,r){try{let i=Qe(v(N(t,e).metaPath,"reindex metadata"));if(i.kind!=="supported"&&i.kind!=="legacy")return null;let n=Ye(i.metadata.fingerprint);return!n||!ui(n,r,e)?null:new Set(n.files.map(s=>s.path))}catch{return null}}function ui(t,e,r){let i=ut(e,{pnpmWorkspaces:r.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:r.indexer?.typescript?.projectMode,typescriptProjects:r.indexer?.typescript?.projects,clojureConfigPath:r.indexer?.clojure?.configPath});return t.version===i.version&&JSON.stringify([...t.languages].sort())===JSON.stringify(i.languages)&&t.pnpmWorkspaces===i.pnpmWorkspaces&&t.typescriptProjectMode===i.typescriptProjectMode&&JSON.stringify([...t.typescriptProjects].sort())===JSON.stringify(i.typescriptProjects)&&t.clojureConfigPath===i.clojureConfigPath}function hi(t,e,r,i,n,s,a,o){let c=new Set;if(a){if(!r.head||!i.head)return null;let l=e.runResult(t,["diff","--name-only","-z","--no-renames","--relative",r.head,i.head,"--"]);if(l.kind!=="success")return null;for(let u of pi(l.output))c.add(u)}if(o){if(n===null||s===null)return null;for(let l of mi(n,s))c.add(l)}return[...c].sort()}function Qt(t,e){let r=e.runResult(t,["diff","--cached","--raw","-z","--no-renames","--relative","--"]);return r.kind==="success"?fi(r.output):null}function pi(t){return t.split("\0").filter(e=>e.length>0)}function fi(t){let e=t.split("\0");if(e.at(-1)===""&&e.pop(),e.length%2!==0)return null;let r=new Map;for(let i=0;i<e.length;i+=2){let n=e[i],s=e[i+1];if(!n.startsWith(":")||!s)return null;r.set(s,n)}return r}function mi(t,e){return[...new Set([...t.keys(),...e.keys()])].filter(i=>t.get(i)!==e.get(i))}function We(t,e){return e===null?`${t}; changed paths unavailable`:e.length===0?t:e.length===1?e[0]:`${e.length} compiler inputs changed`}import{existsSync as se,lstatSync as H,readdirSync as ur,realpathSync as lr,rmSync as G,statSync as gi}from"fs";import{join as S,resolve as z,sep as hr}from"path";var yi=3600*1e3,Si=2*1024*1024*1024,oe=300*1e3,Ri="gc-state.json",vi="gc.lock";function bi(t){let e=t.leases.filter(o=>o.managed&&!o.live&&!o.busy),r=wi(t.leases,t.locks),i={};for(let o of t.generations)r.has(o.generationId)||(i[o.generationId]=o.unreferencedAt??t.nowMs);let n=t.generations.filter(o=>!r.has(o.generationId)).sort((o,c)=>i[o.generationId]-i[c.generationId]||o.generationId.localeCompare(c.generationId)),s=new Set;for(let o of n)t.nowMs-i[o.generationId]>=t.policy.generationTtlMs&&s.add(o.generationId);let a=t.generations.filter(o=>!s.has(o.generationId)).reduce((o,c)=>o+c.size,0);for(let o of n){if(a<=t.policy.budgetBytes)break;s.has(o.generationId)||(s.add(o.generationId),a-=o.size)}for(let o of s)delete i[o];return{deleteWorktrees:e,deleteGenerations:t.generations.filter(o=>s.has(o.generationId)),deleteLocks:t.locks.filter(o=>!o.live),deleteTemporaries:t.temporaries.filter(o=>!o.live),protectedGenerationIds:[...r].sort(),unreferencedSince:i}}function wi(t,e){let r=new Set(t.filter(i=>i.managed&&(i.live||i.busy)).flatMap(i=>[i.lease.baseGenerationId,i.lease.activeGenerationId]).filter(i=>i!==void 0));for(let i of e)i.live&&r.add(i.generationId);return r}function pr(t,e,r={}){if(!rt())return{kind:"disabled"};let i=r.repositoryId===void 0?st(t)?.repositoryId:r.repositoryId;if(!i)return{kind:"unavailable"};let n=S(O(),"repositories",i),s=(r.now??Date.now)(),a=se(n)?fr(t,n,i,e,s,r):{kind:"unavailable"};return xi(t,i,e,s,r),a}function fr(t,e,r,i,n,s){let a=S(e,"gc-state.json"),o=Pi(a);if(!s.force&&o&&n-Date.parse(o.lastSweepAt)<oe)return{kind:"throttled",sweptAt:o.lastSweepAt};let c=it(e,{now:()=>n});if(!c)return{kind:"busy"};try{let l=Ii(t,e,r,o?.unreferencedSince??{}),u=bi({nowMs:n,...l,policy:{generationTtlMs:s.policy?.generationTtlMs??yi,budgetBytes:s.policy?.budgetBytes??Si}}),d=0,h=0;for(let f of u.deleteWorktrees){if(!Fe(f.lease))continue;if(!se(f.lease.localCacheDir)){G(f.leasePath,{force:!0}),h+=1;continue}if(!ki(f.lease))continue;let y=ye(S(f.lease.localCacheDir,"cache-lifecycle.lock"));if(y)try{if(Ge(f.lease,!0))continue;try{Gt({projectRoot:f.lease.projectRoot,cacheDir:f.lease.localCacheDir,cliVersion:i})}catch{continue}if(Ge(f.lease,!0))continue;G(f.lease.localCacheDir,{recursive:!0,force:!0}),G(f.leasePath,{force:!0}),h+=1}finally{y.release()}}for(let f of u.deleteLocks)G(f.path,{force:!0});for(let f of u.deleteTemporaries)G(f.path,{recursive:!0,force:!0});for(let f of u.deleteGenerations)G(f.path,{recursive:!0,force:!0}),d+=f.size;ht(S(e,"evidence.db"));let p={kind:"swept",sweptAt:new Date(n).toISOString(),deletedWorktrees:h,deletedGenerations:u.deleteGenerations.length,deletedBytes:d,protectedGenerations:u.protectedGenerationIds.length},g={version:1,lastSweepAt:p.sweptAt,unreferencedSince:u.unreferencedSince,lastResult:p};return Re(a,g,{spacing:2,trailingNewline:!0}),p}catch(l){return{kind:"failed",error:l instanceof Error?l.message:String(l)}}finally{c.release()}}function xi(t,e,r,i,n){let s=S(O(),"repositories");if(!se(s))return;let a=S(s,Ri),o=Ci(a);if(!n.force&&o!==void 0&&i-o<oe)return;let c=ye(S(s,vi));if(c)try{for(let l of J(s)){if(l===e||!/^[a-f0-9]{24}$/.test(l))continue;let u=S(s,l),d;try{d=H(u)}catch{continue}if(!d.isDirectory()||d.isSymbolicLink())continue;let h=Ti(u)??t;fr(h,u,l,r,i,n)}Re(a,{version:1,lastSweepAt:new Date(i).toISOString()},{spacing:2,trailingNewline:!0})}finally{c.release()}}function Ii(t,e,r,i){let n=new Set(at(t).map(l=>z(l.path))),s=[];for(let l of J(S(e,"worktrees"))){if(!l.endsWith(".json"))continue;let u=S(e,"worktrees",l),d=mr(u);if(!d)continue;let h=z(d.projectRoot);s.push({leasePath:u,lease:d,managed:d.repositoryId===r&&Fe(d),live:n.has(h)||se(h),busy:Ge(d)})}let a=[];for(let l of J(S(e,"locks"))){let u=/^([a-f0-9]{64})\.lock$/.exec(l);if(!u)continue;let d=S(e,"locks",l),h=De(d),p=h!==void 0&&W(h),g=u[1];a.push({generationId:g,path:d,live:p})}let o=[],c=[];for(let l of J(S(e,"generations"))){let u=/^\.tmp-(\d+)-/.exec(l);if(u){let p=S(e,"generations",l),g=Number(u[1]);try{c.push({path:p,size:dr(p),live:Number.isSafeInteger(g)&&W(g)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(l))continue;let d=S(e,"generations",l),h;try{h=H(d)}catch{continue}!h.isDirectory()||h.isSymbolicLink()||o.push({generationId:l,path:d,size:dr(d),...i[l]===void 0?{}:{unreferencedAt:i[l]}})}return{leases:s,generations:o,locks:a,temporaries:c}}function Fe(t){if(t.ownershipChecksum!==Rt(t)||q(t.localCacheDir)!==q(tt(t.projectRoot)))return!1;let e=q(S(O(),"projects"));return q(t.localCacheDir).startsWith(`${e}${hr}`)}function ki(t){if(!Fe(t))return!1;let e=z(O()),r=z(S(e,"projects")),i=z(t.localCacheDir);try{let n=H(e),s=H(r),a=H(i);if(!n.isDirectory()||n.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let o=lr(r);return lr(i).startsWith(`${o}${hr}`)}catch{return!1}}function Ti(t){for(let e of J(S(t,"worktrees"))){if(!e.endsWith(".json"))continue;let r=mr(S(t,"worktrees",e));if(r)return r.projectRoot}}function Ge(t,e=!1){for(let i of e?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let n=De(S(t.localCacheDir,i));if(n!==void 0&&W(n))return!0}let r=De(Q(t.localCacheDir).lockPath);return r!==void 0&&W(r)}function mr(t){try{let e=JSON.parse(v(t,"worktree cache lease"));return e.version!==1||typeof e.repositoryId!="string"||typeof e.worktreeId!="string"||typeof e.projectRoot!="string"||e.treeOid!==void 0&&typeof e.treeOid!="string"||typeof e.localCacheDir!="string"||e.baseGenerationId!==void 0&&typeof e.baseGenerationId!="string"||e.activeGenerationId!==void 0&&typeof e.activeGenerationId!="string"||typeof e.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(e.ownershipChecksum)||typeof e.lastAction!="string"||e.lastReason!==void 0&&typeof e.lastReason!="string"||typeof e.lastSeenAt!="string"?null:e}catch{return null}}function De(t){try{let e=JSON.parse(v(t,"watch lock record"));return typeof e.pid=="number"&&Number.isSafeInteger(e.pid)&&e.pid>0?e.pid:void 0}catch{return}}function Pi(t){try{let e=JSON.parse(v(t,"repository cache GC state"));return e.version!==1||typeof e.lastSweepAt!="string"||!Number.isFinite(Date.parse(e.lastSweepAt))||!e.unreferencedSince||typeof e.unreferencedSince!="object"||!e.lastResult?null:e}catch{return null}}function Ci(t){try{let e=JSON.parse(v(t,"global repository cache GC state"));if(e.version!==1||typeof e.lastSweepAt!="string")return;let r=Date.parse(e.lastSweepAt);return Number.isFinite(r)?r:void 0}catch{return}}function J(t){try{return ur(t)}catch{return[]}}function dr(t){let e=0,r=[t];for(;r.length>0;){let i=r.pop();for(let n of ur(i,{withFileTypes:!0})){let s=S(i,n.name);n.isDirectory()?r.push(s):n.isFile()&&(e+=gi(s).size)}}return e}var ae=class{root;now;randomId;retryDelayMs;active;retryNotBeforeMs=0;currentStatus;constructor(e,r={}){this.root=e,this.now=r.now??Date.now,this.randomId=r.randomId,this.retryDelayMs=Math.max(1,Math.floor(r.retryDelayMs??1e3)),this.currentStatus=Ce(e)}initializeAfterOwnershipAcquired(){let e=Lt(this.root),r=_t(this.root,{now:()=>new Date(this.now())});return this.refreshStatus(),{recoveredClaims:e,prunedHistory:r}}observeLegacyRequest(e,r){Mt(this.root,r??"stale index observed by a legacy command",{idempotencyKey:`legacy-activity:${e}`,now:()=>new Date(e)}),this.refreshStatus()}poll(e,r){if(this.active||e.state!=="idle"||this.now()<this.retryNotBeforeMs)return!1;let i=Wt(this.root,{now:()=>new Date(this.now()),...this.randomId?{randomId:this.randomId}:{}});if(this.refreshStatus(),i.requests.length===0)return!1;this.active=i;try{return r(Ei(i)),!0}catch(n){throw Pe(this.root,i),this.active=void 0,this.retryNotBeforeMs=this.now()+this.retryDelayMs,this.refreshStatus(),n}}completeActive(){return this.active?(At(this.root,this.active,()=>new Date(this.now())),this.active=void 0,this.retryNotBeforeMs=0,this.refreshStatus(),!0):!1}failActive(){return this.active?(Pe(this.root,this.active),this.active=void 0,this.retryNotBeforeMs=this.now()+this.retryDelayMs,this.refreshStatus(),!0):!1}status(){return{...this.currentStatus}}refreshStatus(){this.currentStatus=Ce(this.root)}};function Ei(t){if(t.requests.length===1)return t.requests[0].detail;let r=[...new Set(t.requests.map(i=>i.detail))].slice(0,3).join("; ");return`${t.requests.length} coalesced refresh requests${r?`: ${r}`:""}`.slice(0,2048)}import{totalmem as Wi}from"os";import{randomUUID as Ai}from"crypto";import{rmSync as Li}from"fs";import{Worker as _i}from"worker_threads";var ce=class{constructor(e){this.options=e;if(this.now=e.now??Date.now,this.setTimer=e.setTimer??setTimeout,this.clearTimer=e.clearTimer??clearTimeout,e.maxWorkerFailureRetries!==void 0&&(!Number.isInteger(e.maxWorkerFailureRetries)||e.maxWorkerFailureRetries<0))throw new Error("Worker maxWorkerFailureRetries must be a non-negative integer.")}options;now;setTimer;clearTimer;worker=null;active=null;activeFailure=null;terminating=null;closed=!1;workerGeneration=0;idleTimer=null;canAccept(){return!this.closed&&this.active===null&&this.terminating===null}hasWorker(){return this.worker!==null}start(e){if(!this.canAccept())return!1;if(this.clearIdleTimer(),e.deadlineAtMs<this.now()){try{this.options.onReject(e,`${this.options.name} request expired before processing.`)}catch(n){this.closed=!0,this.options.onFatal(Oe(n))}return!0}let r=this.ensureWorker(),i=this.deadlineTimer(e);this.active={request:e,timer:i,workerFailureRetries:0,workerFailureReasons:[]};try{r.postMessage({kind:"request",...e})}catch(n){this.failActiveAfterTermination(Ne(n),!0)}return!0}async close(e=`${this.options.name} service is shutting down.`){if(this.closed=!0,this.clearIdleTimer(),this.active){await this.failActiveAfterTermination(e);return}await this.terminateWorker()}ensureWorker(){if(this.worker)return this.worker;let e=this.options.createWorker(),r=++this.workerGeneration;return e.on("message",i=>this.handleMessage(r,i)),e.on("error",i=>{r===this.workerGeneration&&this.failActiveAfterTermination(`${this.options.name} worker failed: ${i.message}`,!0)}),e.on("exit",i=>{r!==this.workerGeneration||this.terminating||(this.worker=null,this.active&&this.failActiveAfterTermination(`${this.options.name} worker exited unexpectedly with code ${i}.`,!0))}),this.worker=e,e}handleMessage(e,r){if(e!==this.workerGeneration||this.closed||!this.active)return;let i=Mi(r);if(!i){this.failActiveAfterTermination(`${this.options.name} worker returned an invalid response.`);return}if(i.requestId!==this.active.request.requestId){this.failActiveAfterTermination(`${this.options.name} worker returned a mismatched request identity.`);return}if(this.now()>this.active.request.deadlineAtMs){this.failActiveAfterTermination(`${this.options.name} request expired while it was processing.`);return}let n=this.active,s;try{this.options.onStatus(i.status),i.ok?this.options.onComplete(n.request,i.result,i.status):this.options.onReject(n.request,i.error,i.status),s=this.options.retireAfterResponse?.(i.status)??!1}catch(a){this.closed=!0,this.clearTimer(n.timer),this.options.onFatal(Oe(a));return}this.releaseActive(n),s?this.terminateWorker():this.scheduleIdleTermination()}async failActiveAfterTermination(e,r=!1){if(this.activeFailure){await this.activeFailure;return}let i=this.active;if(!i){await this.terminateWorker();return}this.clearTimer(i.timer),r&&i.workerFailureReasons.push(e);let n=(async()=>{if(!await this.terminateWorker())return;let a=this.options.maxWorkerFailureRetries??0;if(r&&!this.closed&&i.workerFailureRetries<a&&this.now()<=i.request.deadlineAtMs){i.workerFailureRetries+=1;try{let c=this.ensureWorker();i.timer=this.deadlineTimer(i.request),c.postMessage({kind:"request",...i.request});return}catch(c){let l=`Cold Worker retry failed: ${Ne(c)}`;if(i.workerFailureReasons.push(l),e=`${e} ${l}`,!await this.terminateWorker())return}}let o=i.workerFailureReasons.length===0?e:[...new Set([...i.workerFailureReasons,e])].join(" Cold Worker retry: ");try{this.options.onReject(i.request,o)}catch(c){this.closed=!0,this.options.onFatal(Oe(c));return}this.releaseActive(i)})();this.activeFailure=n;try{await n}finally{this.activeFailure===n&&(this.activeFailure=null)}}deadlineTimer(e){let r=Math.max(1,Math.min(2147483647,e.deadlineAtMs-this.now()));return this.setTimer(()=>{this.failActiveAfterTermination(`${this.options.name} request exceeded its deadline.`)},r)}releaseActive(e){this.active===e&&(this.active=null,this.clearTimer(e.timer))}scheduleIdleTermination(){let e=this.options.idleTtlMs;!e||e<=0||this.closed||this.active||!this.worker||(this.clearIdleTimer(),this.idleTimer=this.setTimer(()=>{this.idleTimer=null,!(this.closed||this.active||!this.worker)&&this.terminateWorker()},e))}clearIdleTimer(){this.idleTimer&&(this.clearTimer(this.idleTimer),this.idleTimer=null)}async terminateWorker(){if(this.clearIdleTimer(),this.terminating)return this.terminating;let e=this.worker;if(!e)return!0;this.worker=null;let r=++this.workerGeneration;return this.terminating=(async()=>{try{return await e.terminate(),!0}catch(i){return this.closed=!0,this.options.onFatal(new Error(`${this.options.name} worker termination failed: ${Ne(i)}`,{cause:i})),!1}finally{r===this.workerGeneration&&(this.terminating=null)}})(),this.terminating}};function Mi(t){if(!t||typeof t!="object")return null;let e=t;if(e.kind!=="response"||typeof e.requestId!="string"||!("status"in e))return null;if(e.ok===!0){if(!("result"in e)||"error"in e)return null}else if(e.ok===!1){if("result"in e||typeof e.error!="string")return null}else return null;return e}function Oe(t){return t instanceof Error?t:new Error(String(t))}function Ne(t){return t instanceof Error?t.message:String(t)}var ji=6e4,Gi=10*6e4;function gr(t){let e=t.maxActiveSessions??8,r=t.workerSoftMemoryMb??wr(t.workerHeapMb),i=()=>({protocolVersion:Y,state:"idle",requests:0,sessionsCreated:0,sessionsReplaced:0,sessionsEvicted:0,activeSessions:0,maxActiveSessions:e,softMemoryLimitBytes:r*1024*1024,retireRequested:!1,initializations:0,programUpdates:0,documentsEmitted:0,documentsRemoved:0});return Sr({name:"TypeScript index",paths:t.paths,now:t.now,limits:t.limits,initialStatus:i,parseEnvelope:It,createWorker:()=>xr(t,{kind:"index",projectRoot:t.projectRoot,dbPath:t.dbPath,maxActiveSessions:e,softMemoryLimitMb:r}),complete(n,s,a,o){we(t.paths,n,{ok:!0,protocolVersion:Y,id:s.id,baseGeneration:s.baseGeneration,response:a},{nowMs:o,limits:t.limits})},reject(n,s,a,o){xe(t.paths,n,{ok:!1,protocolVersion:Y,id:s,error:a},a,{nowMs:o,limits:t.limits})},idleTtlMs:t.workerIdleMs??Gi,maxWorkerFailureRetries:1,retireAfterResponse:n=>n.retireRequested===!0,statusWhenWorkerAbsent:n=>({...n,state:"idle",activeSessions:0,heapUsedBytes:0,retireRequested:!1}),onBusy:t.onBusy,onFatal:t.onFatal})}function yr(t){let e=t.workerSoftMemoryMb??wr(t.workerHeapMb),r=()=>({protocolVersion:ee,state:"idle",requests:0,sessionsCreated:0,sessionsReused:0,sessionsRefreshed:0,sessionsReplaced:0,projectsCreated:0,softMemoryLimitBytes:e*1024*1024,retireRequested:!1});return Sr({name:"TypeScript semantic",paths:t.paths,now:t.now,limits:t.limits,initialStatus:r,parseEnvelope:Et,createWorker:()=>xr(t,{kind:"semantic",projectRoot:t.projectRoot,softMemoryLimitMb:e}),complete(i,n,s,a){we(t.paths,i,{ok:!0,protocolVersion:ee,id:n.id,generation:n.generation,response:s},{nowMs:a,limits:t.limits})},reject(i,n,s,a){xe(t.paths,i,{ok:!1,protocolVersion:ee,id:n,error:s},s,{nowMs:a,limits:t.limits})},idleTtlMs:ji,maxWorkerFailureRetries:1,retireAfterResponse:i=>i.retireRequested===!0,statusWhenWorkerAbsent:i=>({...i,state:"idle",heapUsedBytes:0,retireRequested:!1}),onBusy:t.onBusy,onFatal:t.onFatal})}function Sr(t){let e=t.now??Date.now,r=P(process.pid),i={pid:process.pid,...r?{processIdentity:r}:{}},n=`${t.name.toLowerCase().replaceAll(" ","-")}-${process.pid}-${Ai()}`,s={...t.limits,maxBatch:1},a=null,o=t.initialStatus(),c=!1,l=p=>{c=!0,t.onFatal(p)},u=new ce({name:t.name,createWorker:t.createWorker,now:e,idleTtlMs:t.idleTtlMs,maxWorkerFailureRetries:t.maxWorkerFailureRetries,retireAfterResponse:t.retireAfterResponse,onComplete(p,g,f){let y=d(p.requestId);o=f;let I=e();try{t.complete(y.claim,y.envelope,g,I)}catch(k){if(!(k instanceof ve))throw k;try{t.reject(y.claim,y.envelope.id,k.message,I)}catch(T){if(!(T instanceof ve))throw T;Li(y.claim.path,{force:!0})}}h(y)},onReject(p,g,f){let y=d(p.requestId);f!==void 0&&(o=f),t.reject(y.claim,y.envelope.id,g,e()),h(y)},onStatus(p){o=p},onFatal:l});return{poll(){if(c||!u.canAccept())return 0;let p=vt(t.paths,{ownerId:n,nowMs:e(),limits:s,owner:i,liveness:{isProcessAlive:W,readProcessIdentity:P}})[0];if(!p)return 0;let g=p.requestId;try{let f=t.parseEnvelope(bt(p,s));if(g=f.id,f.id!==p.requestId)throw new Error(`${t.name} request identity does not match its mailbox path.`);if(f.deadlineAtMs<e())throw new Error(`${t.name} request expired before processing.`);if(a={claim:p,envelope:f},t.onBusy?.(f.deadlineAtMs),!u.start({requestId:f.id,deadlineAtMs:f.deadlineAtMs,payload:f}))throw new Error(`${t.name} worker lane closed admission after claiming a request.`)}catch(f){let y=qi(f);try{t.reject(p,g,y,e()),a?.claim===p&&h(a)}catch(I){l(Ni(I))}}return 1},status(){return{...u.hasWorker()||!t.statusWhenWorkerAbsent?o:t.statusWhenWorkerAbsent(o),mailbox:wt(t.paths)}},async close(p){await u.close(p)}};function d(p){let g=a;if(!g||g.envelope.id!==p)throw new Error(`${t.name} parent lost the active mailbox claim.`);return g}function h(p){a===p&&(a=null,t.onBusy?.(void 0))}}var Rr=6144;function vr(){let t=Number.parseInt(process.env.SCIP_TS_WORKER_HEAP_MB??"",10);return Number.isFinite(t)&&t>0?t:Rr}var Di=.6;function br(t,e=Fi()){let r=Number.parseInt(process.env.SCIP_TS_WORKER_HEAP_MB??"",10);if(Number.isFinite(r)&&r>0)return r;let i=Math.ceil(pt+t*ft),n=Math.floor(e*Di/(1024*1024));return Math.max(Rr,Math.min(i,n))}function Fi(t=Oi,e=Wi()){let r=[t("/sys/fs/cgroup/memory.max"),t("/sys/fs/cgroup/memory/memory.limit_in_bytes")].map(i=>i===null?Number.NaN:Number.parseInt(i.trim(),10)).filter(i=>Number.isFinite(i)&&i>0&&i<e);return r.length>0?Math.min(...r):e}function Oi(t){try{return Ve(t,{maxBytes:Je,inputKind:"cgroup memory limit"})}catch{return null}}function wr(t){return Math.max(1,Math.floor((t??vr())*.9))}function xr(t,e){if(t.createWorker)return t.createWorker(e);let r=t.workerUrl??new URL("./typescript-mailbox-worker.js",import.meta.url);return new _i(r,{workerData:e,resourceLimits:{maxOldGenerationSizeMb:t.workerHeapMb??vr()}})}function Ni(t){return t instanceof Error?t:new Error(String(t))}function qi(t){return t instanceof Error?t.message:String(t)}var kr=2e3,Hi=5e3,zi=5e3,Ji=6e4,Vi=10,Ki=50,Xi=1e4;function Yi(t,e=1){return Ze(t,e,Vi,Ki,Xi,8)}function Qi(t,e){let r;return{begin(){return r||(e.requestStop(),e.closeWake(),r=t.stop(),r.catch(()=>{})),r}}}async function Zi(t,e){let r=e.processIndexRequests(),i=e.processSemanticRequests(),n=r+i,s=n>0?0:t+1;if(e.afterMailboxPoll({indexRequests:r,semanticRequests:i,processedRequests:n}),e.shouldStop())return{indexRequests:r,semanticRequests:i,processedRequests:n,consecutiveIdlePolls:s,stopped:!0};let a=Yi(n,s);return await e.wait(a),{indexRequests:r,semanticRequests:i,processedRequests:n,consecutiveIdlePolls:s,stopped:!1,delayMs:a}}function en(t){return t==="fresh"?null:{kind:"watch-startup",detail:`index ${t} when watch service started`}}function tn(t){Dt(t.statePath,{version:1,protocolVersion:kt,pid:R.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{},projectRoot:t.projectRoot,...t.worktreeId?{worktreeId:t.worktreeId}:{},cliVersion:t.cliVersion,startedAt:new Date(t.startedAtMs).toISOString(),heartbeatAt:new Date(t.nowMs).toISOString(),lastActivityAt:new Date(t.lastActivityAtMs).toISOString(),...t.idleTimeoutMs===0?{}:{idleDeadlineAt:new Date(t.lastActivityAtMs+t.idleTimeoutMs).toISOString()},watcher:t.watcherStatus,...t.watcherStatus.state==="idle"&&t.indexGeneration?{indexGeneration:t.indexGeneration}:{},...t.lastRefresh?{lastRefresh:t.lastRefresh}:{},...t.lastError?{lastError:t.lastError}:{},reindexActivity:t.reindexActivity,refreshRequests:t.refreshCoordinator.status(),typescriptSemantic:{...t.semanticLane.status(),...t.semanticBusyUntilMs===void 0?{}:{busyUntil:new Date(t.semanticBusyUntilMs).toISOString()}},typescriptIndex:{...t.indexLane.status(),...t.indexBusyUntilMs===void 0?{}:{busyUntil:new Date(t.indexBusyUntilMs).toISOString()}}},{durability:t.durability})}function rn(t){let e=0,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return({processedRequests:a})=>{let o=C();if(o-i>=zi&&(i=o,!$t(t.worktreeLiveness))){t.requestStop();return}if(o-s>=Ji&&(s=o,Ie(t.indexMailboxPaths),Ie(t.semanticMailboxPaths)),o-n>=oe&&(n=o,pr(t.projectRoot,t.cliVersion)),o-r>=Hi){r=o;let c=Ft(t.activityPath);c&&t.updateObservedActivity(c.atMs,o),c?.refreshRequestedAtMs!==void 0&&c.refreshRequestedAtMs>e&&(e=c.refreshRequestedAtMs,t.refreshCoordinator.observeLegacyRequest(c.refreshRequestedAtMs,c.refreshDetail??"stale index observed by a legacy command"))}t.refreshCoordinator.poll(t.watcherStatus(),c=>{t.recordActivity(),t.requestRefresh(c)}),a>0&&(t.recordActivity(),t.persistState(!0,"visibility")),t.persistState()}}async function nn(t){let e,r=0,i=!1,n,s;R.once("SIGINT",t.stopSignal),R.once("SIGTERM",t.stopSignal);try{t.watcher.start();let o=t.initializeFreshness();for(t.recordActivity(),t.markReady(),t.persistState(!0),e=setInterval(()=>t.persistState(),kr),e.unref?.(),o&&t.requestRefresh(o);!t.stopRequested();){let c=await Zi(r,{processIndexRequests:t.processIndexRequests,processSemanticRequests:t.processSemanticRequests,afterMailboxPoll:t.afterMailboxPoll,shouldStop:t.shouldStop,wait:t.wait});if(r=c.consecutiveIdlePolls,c.stopped)break}}catch(o){i=!0,n=o}finally{R.off("SIGINT",t.stopSignal),R.off("SIGTERM",t.stopSignal),e!==void 0&&clearInterval(e);let o=t.shutdown.begin();await t.closeLanes();let c=await o;c.state==="stopped"?t.finalizeStopped():s=t.finalizeDegraded(c.reasons)}let a=t.mailboxFatalError();if(!i&&a&&(i=!0,n=a),i&&s)throw new AggregateError([n,s],"Watch service execution and shutdown both failed.");if(i)throw n;if(s)throw s}function sn(t){try{let e=new Bi(t,{readonly:!0,fileMustExist:!0});try{return e.prepare("SELECT count(*) AS documents FROM documents").get().documents}finally{e.close()}}catch{return 0}}function on(t){let e=t.config.indexer?.typescript,r=e?.workerHeapMb??br(sn(t.dbPath)),i=yr({paths:t.semanticPaths,projectRoot:t.projectRoot,workerHeapMb:r,onBusy:t.onSemanticBusy,onFatal:t.onFatal}),n=gr({paths:t.indexPaths,projectRoot:t.projectRoot,dbPath:t.dbPath,...e?.maxWarmSessions===void 0?{}:{maxActiveSessions:e.maxWarmSessions},...e?.workerIdleMs===void 0?{}:{workerIdleMs:e.workerIdleMs},...e?.workerSoftMemoryMb===void 0?{}:{workerSoftMemoryMb:e.workerSoftMemoryMb},workerHeapMb:r,onBusy:t.onIndexBusy,onFatal:t.onFatal});return{semanticLane:i,indexLane:n}}async function an(t,e,r={}){let i=jt(t,e),n=i.projectRoot,s=i.worktreeKind==="git"?cn(n,i.worktreeId):void 0,a=Bt(n,s),o=B(n);o.watch={...o.watch,...r};let c=Z(o);if(!c.enabled)throw new Error('watch mode is disabled; set "watch.enabled": true before starting the service');let l=N(n,o),u=Q(l.cacheDir),d=P(R.pid),h=Ot(u.lockPath,n,{readProcessIdentity:m=>m===R.pid?d:P(m)});if(!h.acquired)return;let p=new ae(u.refreshRequestsPath,{retryDelayMs:Math.max(1e3,c.cooldownMs)});p.initializeAfterOwnershipAcquired();let g=Date.now(),f=C(),y=g,I=f,k={state:"idle"},T,le,E,de,ue=X(l.dbPath),V=!1,qe=!1,Be=Number.NEGATIVE_INFINITY,$e,Ue,D=Ct(l.cacheDir),F=xt(l.cacheDir);be(D),be(F);let He=Te([F.pendingDir,F.legacyRequestDir,D.pendingDir,D.legacyRequestDir,u.refreshRequestsPath]),w=(m=!1,M=m?"durable":"visibility")=>{if(!qe)return;let fe=Date.now(),L=C();!m&&L-Be<kr||(Be=L,tn({statePath:u.statePath,durability:M,processIdentity:d,projectRoot:n,worktreeId:i.worktreeId,cliVersion:e,startedAtMs:g,nowMs:fe,lastActivityAtMs:y,idleTimeoutMs:c.idleTimeoutMs,watcherStatus:k,indexGeneration:T,lastRefresh:le,lastError:E,reindexActivity:ue,refreshCoordinator:p,semanticLane:he,indexLane:pe,semanticBusyUntilMs:$e,indexBusyUntilMs:Ue}))},A=()=>{y=Date.now(),I=C()},Tr=m=>{A(),de??=m,E={at:new Date().toISOString(),message:m.message},w(!0,"visibility")},{semanticLane:he,indexLane:pe}=on({semanticPaths:D,indexPaths:F,projectRoot:n,dbPath:l.dbPath,config:o,onSemanticBusy(m){$e=m===void 0?void 0:m+5e3,w(!0,"visibility")},onIndexBusy(m){Ue=m===void 0?void 0:m+5e3,w(!0,"visibility")},onFatal:Tr}),K=new ne({projectRoot:n,config:{...o,watch:c},outputDb:l.dbPath,languages:o.languages,onStatus(m){k=m,m.state!=="idle"&&(T=void 0),m.state!=="idle"&&A(),w(!0)},onReindexComplete(m,M,fe){A();let L=fe?.pendingChanges!==!1?$(n,o,l):Pt(l);return le=L.lastRefresh,T=L.state==="fresh"?_(l.dbPath)??void 0:void 0,ue=X(l.dbPath),p.completeActive(),E=void 0,w(!0),L.state==="fresh"},onReindexError(){p.failActive()},onRefreshSuppressed(m){let M=yt(l.dbPath,m);M.state==="failed"&&(E={at:new Date().toISOString(),message:`Suppressed-refresh telemetry was not recorded: ${M.reason}`},w(!0,"visibility")),ue=X(l.dbPath)},onError(m){A(),T=void 0,E={at:new Date().toISOString(),message:m.message},w(!0)}}),ze=Qi(K,{requestStop(){V=!0},closeWake(){He.close()}}),Pr=()=>{ze.begin()},Cr=rn({worktreeLiveness:a,indexMailboxPaths:F,semanticMailboxPaths:D,projectRoot:n,cliVersion:e,activityPath:u.activityPath,refreshCoordinator:p,watcherStatus:()=>k,requestRefresh:m=>K.requestRefresh({kind:"watch-demand",detail:m},{immediate:!0}),requestStop:()=>{V=!0},recordActivity:A,updateObservedActivity(m,M){m<=y||(y=m,I=M)},persistState:w});await nn({watcher:K,shutdown:ze,stopSignal:Pr,initializeFreshness(){let m=$(n,o,l);return le=m.lastRefresh,T=m.state==="fresh"?_(l.dbPath)??void 0:void 0,en(m.state)},markReady:()=>{qe=!0},recordActivity:A,persistState:w,requestRefresh:m=>K.requestRefresh(m,{immediate:!0}),stopRequested:()=>V,processIndexRequests:()=>pe.poll(),processSemanticRequests:()=>he.poll(),afterMailboxPoll:Cr,shouldStop:()=>V||de!==void 0||Nt({watcher:k,lastActivityAtMs:I,nowMs:C(),idleTimeoutMs:c.idleTimeoutMs}),wait:m=>He.wait(m),closeLanes:()=>Promise.all([he.close("TypeScript semantic service stopped before completing the request."),pe.close("TypeScript index service stopped before completing the request.")]).then(()=>{}),mailboxFatalError:()=>de,finalizeStopped(){Ir(u.statePath,{force:!0}),Ir(u.activityPath,{force:!0}),h.release()},finalizeDegraded(m){return E={at:new Date().toISOString(),message:`Watch service shutdown is degraded: ${m.join("; ")}`},w(!0),new Error(E.message)}})}function cn(t,e){let r=ot(t);if(r.kind!=="worktree"||r.identity.worktreeId!==e)throw new Error(`Git worktree identity changed while starting the watch service for ${t}.`);return r.identity.gitDir}function ln(t,e={report:r=>console.error(r),exit:r=>R.exit(r)}){return e.report(`watch-service: ${Tt(t instanceof Error?t.message:String(t))}`),e.exit(1)}var dn=R.argv[1]?Ui($i(R.argv[1])).href:null;if(dn===import.meta.url){let t=R.argv[2],e=R.argv[3],r=un(R.argv[4]);if(!t||!e)console.error("watch-service: expected <project-root> <cli-version>"),R.exitCode=1;else try{await an(t,e,r)}catch(i){ln(i)}}function un(t){if(!t)return{};try{let e=JSON.parse(t);return e&&typeof e=="object"?e:{}}catch{return{}}}export{Te as createPathChangeWake,Qi as createWatchServiceShutdown,Zi as runWatchServiceLoopIteration,an as runWatchServiceServer,en as startupRefreshTrigger,ln as terminateWatchServiceProcess,Yi as watchServiceLoopDelayMs};
|
|
4
4
|
//# sourceMappingURL=watch-server.js.map
|
|
@@ -208,7 +208,7 @@ An unavailable frontier is a relationship class for which no registered analyzer
|
|
|
208
208
|
| `vue-composable-candidates [file]` | Find heuristic Vue composable extraction candidates from shared state, effects, requests, and template bindings | variable | `inspect`, `code` | `--min-similarity <n>`<br>`--min-shared-behaviors <n>`<br>`-n, --limit <n>`<br>`-s, --scope <path>`<br>`--full`<br>`--json`<br>`--result-only`<br>`--compact` |
|
|
209
209
|
| `vue-large-view-pressure [file]` | Find heuristic large Vue view pressure candidates from template, script, style, and external script line counts | variable | `inspect`, `code` | `--min-total-lines <n>`<br>`--min-template-lines <n>`<br>`--min-script-lines <n>`<br>`--min-style-lines <n>`<br>`--review-thresholds`<br>`-n, --limit <n>`<br>`-s, --scope <path>`<br>`--full`<br>`--json`<br>`--result-only`<br>`--compact` |
|
|
210
210
|
| `similar-chains` | Find heuristic similar-chain candidates from dependency flows | variable | `inspect`, `code` | `--min-similarity <n>`<br>`-n, --limit <n>`<br>`-s, --scope <path>`<br>`--min-length <n>`<br>`--max-length <n>`<br>`--full`<br>`--json`<br>`--result-only`<br>`--compact` |
|
|
211
|
-
| `extract-candidates` | Find
|
|
211
|
+
| `extract-candidates` | Find extraction candidates: contiguous regions whose callees are used nowhere else in the function | variable | `inspect`, `code` | `-s, --scope <path>`<br>`--min-loc <n>`<br>`--min-callees <n>`<br>`-n, --limit <n>`<br>`--full`<br>`--json`<br>`--result-only`<br>`--compact` |
|
|
212
212
|
| `locality-candidates [symbol-or-file]` | Find directory-locality and ancestry candidates from consumer ownership | variable | `inspect`, `code` | `-s, --scope <path>`<br>`--min-consumers <n>`<br>`-n, --limit <n>`<br>`--full`<br>`--json`<br>`--result-only`<br>`--compact` |
|
|
213
213
|
| `cleanup-plan` | Ordered, batched deletion plan: graph-fact dead code plus the cascade candidates it unlocks | variable | `inspect`, `code` | `-s, --scope <path>`<br>`--min-loc <n>`<br>`--max-depth <n>`<br>`--verify`<br>`--patch`<br>`--full`<br>`--json`<br>`--result-only`<br>`--compact` |
|
|
214
214
|
| `recent-duplicates` | Directional duplicate candidates: recent code that re-implements established callable, React, or Vue code | variable | `inspect`, `code` | `--window <n>`<br>`--min-similarity <n>`<br>`-n, --limit <n>`<br>`-s, --scope <path>`<br>`--full`<br>`--json`<br>`--result-only`<br>`--compact` |
|
|
@@ -278,7 +278,7 @@ An unavailable frontier is a relationship class for which no registered analyzer
|
|
|
278
278
|
|
|
279
279
|
| Command | Description | Cost | Closes disclosed gaps with | Options |
|
|
280
280
|
|---|---|---|---|---|
|
|
281
|
-
| `install-skills` | Install skills (scip-query, scip-explore, scip-plan, scip-setup, scip-integrity-audit) into Claude Code, Codex, and shared agent roots | variable | - | - |
|
|
281
|
+
| `install-skills` | Install skills (scip-query, scip-explore, scip-plan, scip-setup, scip-integrity-audit, principal-maintainability-review, scip-system-compression, scip-root-cause, scip-claim-audit, scip-probe-reachability, scip-twin-drift, scip-calibrate, conductor) into Claude Code, Codex, and shared agent roots | variable | - | - |
|
|
282
282
|
| `check-deps` | Check whether scip-query and the detected language indexers are runnable | bounded | `inspect`, `code` | - |
|
|
283
283
|
| `capabilities` | Report which mapping and analysis capabilities are available in this project | bounded | `inspect`, `code` | `--matrix`<br>`--json`<br>`--result-only`<br>`--compact` |
|
|
284
284
|
| `init` | Create a .scipquery.json configuration file for this project | variable | - | - |
|
package/docs/DETECTOR_GUIDE.md
CHANGED
|
@@ -13,21 +13,27 @@ scip-query health --full
|
|
|
13
13
|
|
|
14
14
|
The health report combines graph structure, duplication, drift, complexity,
|
|
15
15
|
history, suppressions, coverage contracts, and React and Vue analyses. Its
|
|
16
|
-
score is a summary, not proof of correctness.
|
|
16
|
+
score is a summary, not proof of correctness. The `Input:` line under the
|
|
17
|
+
file and symbol counts names the index generation and the git commit,
|
|
18
|
+
branch, and uncommitted-path count the report was computed from
|
|
19
|
+
(`provenance` in `health --json`); compare two reports only when that line
|
|
20
|
+
matches, because a repository change and a detector change move the same
|
|
21
|
+
numbers.
|
|
17
22
|
|
|
18
23
|
## Focused detector families
|
|
19
24
|
|
|
20
|
-
| Concern
|
|
21
|
-
|
|
|
22
|
-
| Exact or near duplication
|
|
23
|
-
| Parallel implementations
|
|
24
|
-
| Unused or disconnected code | `dead`, `isolated`, `unused-params`
|
|
25
|
-
| Excess indirection
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
25
|
+
| Concern | Commands |
|
|
26
|
+
| --------------------------- | ------------------------------------------------------------------------------------------- |
|
|
27
|
+
| Exact or near duplication | `duplicate-bodies`, `similar`, `recent-duplicates` |
|
|
28
|
+
| Parallel implementations | `twin-drift`, `incomplete-migration`, `drift` |
|
|
29
|
+
| Unused or disconnected code | `dead`, `isolated`, `unused-params` |
|
|
30
|
+
| Excess indirection | `wrapper-candidates`, `passthrough-candidates`, `stale-abstractions`, `redundant-reexports` |
|
|
31
|
+
| Extraction seams | `extract-candidates` |
|
|
32
|
+
| Change pressure | `complexity-hotspots`, `co-change`, `cycles` |
|
|
33
|
+
| Documentation | `doc-drift` |
|
|
34
|
+
| React | `react-component-duplicates`, `react-hook-candidates`, `react-large-component-pressure` |
|
|
35
|
+
| Vue | `vue-component-duplicates`, `vue-composable-candidates`, `vue-large-view-pressure` |
|
|
36
|
+
| Team structure policy | `architecture` |
|
|
31
37
|
|
|
32
38
|
Run focused commands through the `scip-query` CLI. Add `--full` only when that
|
|
33
39
|
command supports it and exhaustive command coverage can change the decision.
|
|
@@ -44,3 +50,36 @@ command supports it and exhaustive command coverage can change the decision.
|
|
|
44
50
|
Suppress a false or accepted finding with `scip-query suppress <id>` and a
|
|
45
51
|
specific reason. A suppression addresses one finding; it must not disable an
|
|
46
52
|
unrelated detector family.
|
|
53
|
+
|
|
54
|
+
## Policy exclusions
|
|
55
|
+
|
|
56
|
+
Some rows match a detector's pattern because a convention demands the
|
|
57
|
+
match, not because anyone copied or wrapped anything. Detectors remove those
|
|
58
|
+
rows from the counts `health` scores and disclose the removal instead of
|
|
59
|
+
hiding it, under `Policy exclusions` in the text report and `policyExclusions`
|
|
60
|
+
in `health --json`. An excluded row is still listed by its focused command
|
|
61
|
+
(often at support tier), so a reviewer who disagrees with the policy can
|
|
62
|
+
still find it.
|
|
63
|
+
|
|
64
|
+
| Detector | Excluded by policy |
|
|
65
|
+
| --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `react-component-duplicates`, `react-hook-candidates`, `react-large-component-pressure` | components in test files; pairs of vendored UI-kit primitives (the shadcn `components.json` `aliases.ui` directory or a `components/ui` directory); hook-versus-component pairs; loading placeholders that share only a skeleton primitive |
|
|
67
|
+
| `react-component-duplicates` | two framework route entries whose JSX overlaps (support tier: routing scaffolding); shared _behavior_ between route entries still counts |
|
|
68
|
+
| `react-component-duplicates`, `react-hook-candidates` | an intercepting route and its target are kept, with the recommendation to render one shared view |
|
|
69
|
+
| `react-hook-candidates` | pairs whose overlap is only generic React or data-fetching mechanics (`useState`, `useMutation`, `.mutate()`, `useRouter`) |
|
|
70
|
+
| `wrapper-candidates` | constructors; single-consumer callables whose body is not exactly one call with plain-value arguments (a preparatory statement, a callback, a nested call, or a literal the body builds makes it `bodyShape: helper`, signal tier) |
|
|
71
|
+
| `duplicate-bodies` | duplicate members that are constructors, test-file bodies, route-file verb exports, or vendored UI-kit bodies; a group must keep two product files to count |
|
|
72
|
+
| `dead` | zero-reference symbols in framework entry surfaces (route handlers, pages, Trigger.dev task directories from `trigger.config.*`, live barrels) and in generated artifacts (`drizzle-kit pull` dumps, migration snapshots, codegen output) |
|
|
73
|
+
| `dead` | exports of source files a root configuration names by path (`next.config.js` `images.loaderFile`, `package.json` scripts) |
|
|
74
|
+
| `twin-drift` | route-file convention names (`handler`, `handleGet`, `*Page`, `generateMetadata`) inside framework entry files |
|
|
75
|
+
| `twin-drift` | CRUD and lifecycle method names (`create`, `delete`, `getById`, `shutdown`, ...) declared directly on unrelated classes; free functions with those names keep the ordinary rules |
|
|
76
|
+
| `twin-drift` | a member that calls its same-name counterpart, directly or under an import alias (an operations function over its use-case, a component over the function it renders): a layer, not a parallel implementation |
|
|
77
|
+
| `twin-drift` | a thin forwarder whose single call is named differently from itself (a web API client, a vendor adapter) is a stub over its peer's concept; overrides of one abstract member; key-qualified lookup members (`getBySlug`, `findByEmail`) on unrelated classes |
|
|
78
|
+
| `passthrough-candidates` | a file with three or more methods forwarding to the same collaborator is a facade; its forwards become boundary signals instead of direct inline advice |
|
|
79
|
+
| `wrapper-candidates`, `passthrough-candidates` | boundary terms are read from leaf names, and a term both sides carry (`toBaseRate` forwarding to `parseBaseRate`; a wrapper and its caller both under `lib/auth/`) is shared vocabulary, not a boundary; only asymmetric terms demote a finding to signal tier |
|
|
80
|
+
| `passthrough-candidates` | a class whose methods forward to members of three or more collaborators is a composed-service facade; a curried handler (`return jsonHandler(async () => {...})(req, res, next)`) is not a literal forward |
|
|
81
|
+
| `wrapper-candidates` | a forward through a module-private variable (`return loadedLanguages.has(lang)`) is a boundary signal because inlining would export the state |
|
|
82
|
+
| `co-change` (hidden coupling) | documentation that changes alongside the code it describes (`doc-drift` owns stale docs); generated artifacts such as migration journals, snapshots, and codegen output |
|
|
83
|
+
| `co-change` | pairs whose shared commits were only broad sweeps, stale pairs with at most two focused co-changes, and configuration or schema partners (signal tier; listed by co-change) |
|
|
84
|
+
| `complexity-hotspots` (extreme count) | callables above the extreme score only through fan-in, with fewer than 10 branches |
|
|
85
|
+
| `extract-candidates` | regions whose extraction would take more than five locals in or hand more than two back (support tier: wide interface); only regions with a narrow or unknown interface count |
|
|
@@ -42,6 +42,29 @@ The certification thresholds and publication rules live in
|
|
|
42
42
|
Program closure and the private-shadow decision live in
|
|
43
43
|
[`2026-07-11-accuracy-program-closure.md`](./validation/2026-07-11-accuracy-program-closure.md).
|
|
44
44
|
|
|
45
|
+
## 2026-09-02 TypeScript label review
|
|
46
|
+
|
|
47
|
+
The matrix below is the 2026-07-10 snapshot. On 2026-09-02 the TypeScript
|
|
48
|
+
detectors that feed the health report were re-audited against reviewed
|
|
49
|
+
label sets (`docs/validation/labels/<repository>/<detector>.json`, scored by
|
|
50
|
+
`scripts/score-detector-labels.ts`). Each row names the repository, the
|
|
51
|
+
sample, and the result after that day's fixes; the truth rules are in the
|
|
52
|
+
label files' notes.
|
|
53
|
+
|
|
54
|
+
| Detector | Repository | Sample | Precision / recall of labeled rows | Notes |
|
|
55
|
+
| ----------------------------------------------------- | ----------------- | -------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
56
|
+
| `dead` | Launchpoint | 20 of 65 dead-code rows | 0.95 / 1.0, then 1.0 after the config-referenced entry surface | word search outside the defining file as the truth rule |
|
|
57
|
+
| `similar` | Launchpoint | 20 pairs | 1.0 / 0.43 | four true pairs sit at signal tier by the earlier scaffolding calibration |
|
|
58
|
+
| `stale-abstractions` | Launchpoint | 5 direct, 10 signal | 1.0 / 1.0 | signal rows are counted findings (`countedTiers`) |
|
|
59
|
+
| `complexity-hotspots` | Launchpoint | 20 of the 192 extreme rows | 1.0 / 1.0 | text recount of branch tokens agrees |
|
|
60
|
+
| `react-large-component-pressure` | Launchpoint | 20 components | 1.0 / 1.0 | two static templates labeled uncertain |
|
|
61
|
+
| `co-change` | Launchpoint | 20 non-doc pairs | 0.53 before the signal tier | sweep-only, stale, and configuration pairs are signal tier and not counted |
|
|
62
|
+
| `extract-candidates` | Launchpoint, Vega | 20 each | 1.0 / 1.0; 0.875 / 0.54 | Vega misses are wide-interface support rows; element-boundary snapping added |
|
|
63
|
+
| `wrapper-candidates` | Launchpoint, Vega | 20 each | direct tier 0 false; 1.0 / 1.0 | forwarding shape, owner-qualified boundary names, module-private state |
|
|
64
|
+
| `passthrough-candidates` | Launchpoint, Vega | 20 each | 1.0 / 1.0; 1.0 / 1.0 | shared vocabulary, composed-service facades, curried handlers |
|
|
65
|
+
| `twin-drift` | Launchpoint, Vega | 20 groups each | 0.77 / 1.0; 0.83 / 0.71 | layering, stubs, overrides, key-qualified lookups, near-name suffix words |
|
|
66
|
+
| `react-component-duplicates`, `react-hook-candidates` | Launchpoint | full-list review (morning) | see the calibration document | policy exclusions for generic mechanics, hook/component pairs, vendored primitives |
|
|
67
|
+
|
|
45
68
|
## Certification Matrix
|
|
46
69
|
|
|
47
70
|
Legend: `certified`, `qualified`, `experimental`, `insufficient`, `unsupported`,
|
|
@@ -97,8 +120,8 @@ state. A checked box does not upgrade an `insufficient` state to `certified`.
|
|
|
97
120
|
|
|
98
121
|
- [x] `unused-imports` — certified
|
|
99
122
|
- [x] `unused-params` — insufficient population evidence
|
|
100
|
-
- [x] `cycles` — insufficient population evidence
|
|
101
|
-
- [x] `duplicate-bodies` — certified
|
|
123
|
+
- [x] `cycles` — insufficient population evidence (2026-09-02: consistent across generations; the Launchpoint change was the repository removing its cycles)
|
|
124
|
+
- [x] `duplicate-bodies` — certified (2026-09-02: constructors, test bodies, route verb exports, and UI-kit bodies removed before grouping)
|
|
102
125
|
- [x] `complexity` — certified
|
|
103
126
|
- [x] `isolated` — insufficient population evidence
|
|
104
127
|
- [x] `redundant-reexports` — certified
|
|
@@ -151,8 +174,8 @@ certificate:
|
|
|
151
174
|
- [x] `similar-files` — certified relationship
|
|
152
175
|
- [x] `similar-chains` — qualified within a bounded candidate frame
|
|
153
176
|
- [x] `similar-signatures` — certified relationship
|
|
154
|
-
- [x] `twin-drift` — qualified; 37/40 valid
|
|
155
|
-
- [x] `react-component-duplicates` — certified relationship
|
|
177
|
+
- [x] `twin-drift` — qualified; 37/40 valid (2026-09-02: route-convention and CRUD/lifecycle member names excluded; no reviewed precision sample yet)
|
|
178
|
+
- [x] `react-component-duplicates` — certified relationship (2026-09-02: test-file, UI-kit, route-scaffolding, and hook-versus-component policies; Launchpoint label set precision 1.0 / recall 1.0)
|
|
156
179
|
- [x] `vue-component-duplicates` — certified relationship
|
|
157
180
|
- [x] `convergence` alias parity with `similar --plan`
|
|
158
181
|
- [x] `twin-ab` — certified generated-scaffold correctness for importable named
|
|
@@ -164,18 +187,18 @@ consolidation would improve the code.
|
|
|
164
187
|
|
|
165
188
|
## Architecture and Refactoring Signals
|
|
166
189
|
|
|
167
|
-
- [x] `wrapper-candidates` — certified production single-caller relationship
|
|
168
|
-
- [x] `passthrough-candidates` — certified literal-forwarding relationship
|
|
190
|
+
- [x] `wrapper-candidates` — certified production single-caller relationship (2026-09-02: constructors excluded, body shape distinguishes forwarders from helpers; no reviewed precision sample yet)
|
|
191
|
+
- [x] `passthrough-candidates` — certified literal-forwarding relationship (2026-09-02: facade files (three or more forwards to one collaborator) become boundary signals; no reviewed precision sample yet)
|
|
169
192
|
- [x] `stale-abstractions` — certified relationship
|
|
170
|
-
- [x] `extract-candidates` — certified measurement; extraction remains contextual
|
|
193
|
+
- [x] `extract-candidates` — certified measurement; extraction remains contextual. Rebuilt 2026-09-02 around exclusive line regions with compiler-known locals; the Python row above predates the rebuild, and the current reviewed sample is `docs/validation/labels/launchpoint-backend/extract-candidates.json`
|
|
171
194
|
- [x] `locality-candidates` — certified relationship; movement remains contextual
|
|
172
195
|
- [x] `drift` — qualified; subtype breadth incomplete
|
|
173
|
-
- [x] `co-change` — certified relationship
|
|
196
|
+
- [x] `co-change` — certified relationship (2026-09-02: doc-code and generated-artifact partners weight zero)
|
|
174
197
|
- [x] `doc-drift` — certified relationship
|
|
175
198
|
- [x] `coupling` — certified graph fact
|
|
176
199
|
- [x] `bottlenecks` — certified disclosed graph fact; utility remains contextual
|
|
177
200
|
- [x] `deep-chains` — certified condensed-component path
|
|
178
|
-
- [x] `complexity-hotspots` — certified measurement
|
|
201
|
+
- [x] `complexity-hotspots` — certified measurement (2026-09-02: rendered children count as fan-out; extreme requires ten branches; pressure threshold scales with file count)
|
|
179
202
|
- [x] `hotspots` — certified graph fact
|
|
180
203
|
- [x] `fan-in` — certified exact-symbol graph fact
|
|
181
204
|
- [x] `fan-out` — certified graph fact
|
|
@@ -185,9 +208,9 @@ action. A real relationship can still be an unhelpful recommendation.
|
|
|
185
208
|
|
|
186
209
|
## React and Vue Signals
|
|
187
210
|
|
|
188
|
-
- [x] `react-component-duplicates` — 48/48, certified relationship
|
|
189
|
-
- [x] `react-hook-candidates` — 48/48, certified relationship
|
|
190
|
-
- [x] `react-large-component-pressure` — 48/48, certified measurement
|
|
211
|
+
- [x] `react-component-duplicates` — 48/48, certified relationship (2026-09-02: test-file, UI-kit, route-scaffolding, and hook-versus-component policies; Launchpoint label set precision 1.0 / recall 1.0)
|
|
212
|
+
- [x] `react-hook-candidates` — 48/48, certified relationship (2026-09-02: generic-mechanics and shared-hook policies; Launchpoint label set precision 1.0 / recall 1.0)
|
|
213
|
+
- [x] `react-large-component-pressure` — 48/48, certified measurement (2026-09-02: UI-kit directories excluded; token axes gated by size)
|
|
191
214
|
- [x] `vue-component-duplicates` — 41/41, certified relationship
|
|
192
215
|
- [x] `vue-composable-candidates` — 48/48, certified relationship
|
|
193
216
|
- [x] `vue-large-view-pressure` — 64/64, certified measurement
|
|
@@ -218,7 +241,7 @@ was not independently actionable without local design context.
|
|
|
218
241
|
- [x] `new-dead` — qualified candidate with unconfirmed tier
|
|
219
242
|
- [x] `baseline` — qualified exact set difference
|
|
220
243
|
- [x] `health` — experimental composite; private shadow only
|
|
221
|
-
- [x] `self-audit` — qualified; partial oracles withhold precision
|
|
244
|
+
- [x] `self-audit` — qualified; partial oracles withhold precision (2026-09-02: renders question, per-symbol complete oracle, callee precision measured (Vega 1.0 / Launchpoint 0.988))
|
|
222
245
|
- [x] `effectiveness` — qualified ledger-transition facts
|
|
223
246
|
- [x] `affected` — qualified indexed closure
|
|
224
247
|
- [x] `change-surface` — qualified indexed consumer counts
|
|
@@ -91,15 +91,15 @@ The output should include confidence, reasons, counterevidence, and the exact co
|
|
|
91
91
|
|
|
92
92
|
The locality analyzer should not replace existing analyzers. It should complete their story.
|
|
93
93
|
|
|
94
|
-
| Existing analyzer | What it says today
|
|
95
|
-
| ---------------------------------------------------- |
|
|
96
|
-
| `react-large-component-pressure` | This React component is too large.
|
|
97
|
-
| `vue-large-view-pressure` | This Vue SFC is too large.
|
|
98
|
-
| `extract-candidates` | This function
|
|
99
|
-
| `react-hook-candidates`, `vue-composable-candidates` | Several components repeat behavior.
|
|
100
|
-
| `recent-duplicates`, `echo` | New code duplicates older code.
|
|
101
|
-
| `incomplete-migration` | A helper extraction stopped halfway.
|
|
102
|
-
| `co-change` | Files move together historically.
|
|
94
|
+
| Existing analyzer | What it says today | Locality companion question |
|
|
95
|
+
| ---------------------------------------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| `react-large-component-pressure` | This React component is too large. | If pieces are extracted, which ones are private, feature-local, or shared? |
|
|
97
|
+
| `vue-large-view-pressure` | This Vue SFC is too large. | Should extracted child components/composables live beside the view, in the feature, or in app shared? |
|
|
98
|
+
| `extract-candidates` | This function has a region of exclusive callees. | Would the extracted helper have one real owner or a broader consumer set? |
|
|
99
|
+
| `react-hook-candidates`, `vue-composable-candidates` | Several components repeat behavior. | Is the hook/composable local to one feature or reusable across domains? |
|
|
100
|
+
| `recent-duplicates`, `echo` | New code duplicates older code. | Which existing owner should the new code reuse, and would reuse widen the wrong API? |
|
|
101
|
+
| `incomplete-migration` | A helper extraction stopped halfway. | Is the helper in the right place for all remaining call sites? |
|
|
102
|
+
| `co-change` | Files move together historically. | Does history imply a hidden shared owner or only a local synchronization point? |
|
|
103
103
|
|
|
104
104
|
## Algorithm Sketch
|
|
105
105
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scip-query",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Evidence and verification for AI coding agents: map code, reuse concepts, finish migrations, and gate diffs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -371,7 +371,7 @@
|
|
|
371
371
|
"api:report": "node scripts/api-surface-contract.mjs report",
|
|
372
372
|
"api:check": "npm run build && node scripts/api-surface-contract.mjs check && tsc -p tests/fixtures/public-api-consumer/tsconfig.json",
|
|
373
373
|
"api:update": "npm run build && node scripts/api-surface-contract.mjs update",
|
|
374
|
-
"lint": "npm run format:check && eslint src tests tsup.config.ts scripts/api-surface-contract.mjs scripts/audit-production-dependencies.mjs scripts/benchmark-cold-reindex.ts scripts/benchmark-graph-literal.ts scripts/benchmark-query-service.ts scripts/benchmark-reindex-accounting.ts scripts/benchmark-source-search.ts scripts/build-scip-windows.mjs scripts/cache-lifecycle-soak.ts scripts/codex-exploration-sandbox.mjs scripts/codex-exploration-trial-core.mjs scripts/codex-exploration-trial.mjs scripts/compare-exploration-trials.mjs scripts/exploration-benchmark-core.mjs scripts/exploration-benchmark.mjs scripts/npm-release-state.ts scripts/npm-release.ts scripts/publish-scip-windows.ts scripts/release-npm-guard.ts scripts/release-npm.ts scripts/scip-windows-package-identity.ts scripts/scip-windows-provenance.mjs scripts/scip-windows-release.ts scripts/verify-identity-collision-cli.mjs scripts/verify-scip-windows.mjs scripts/verify-scip-windows-registry.ts skills/scip-explore/scripts/capture-evidence.mjs && npm run api:check && node scripts/check-skill-links.mjs",
|
|
374
|
+
"lint": "npm run format:check && eslint src tests tsup.config.ts scripts/api-surface-contract.mjs scripts/audit-production-dependencies.mjs scripts/benchmark-cold-reindex.ts scripts/benchmark-graph-literal.ts scripts/benchmark-query-service.ts scripts/benchmark-reindex-accounting.ts scripts/benchmark-source-search.ts scripts/build-scip-windows.mjs scripts/cache-lifecycle-soak.ts scripts/codex-exploration-sandbox.mjs scripts/codex-exploration-trial-core.mjs scripts/codex-exploration-trial.mjs scripts/compare-exploration-trials.mjs scripts/exploration-benchmark-core.mjs scripts/exploration-benchmark.mjs scripts/npm-release-state.ts scripts/npm-release.ts scripts/publish-scip-windows.ts scripts/release-npm-guard.ts scripts/release-npm.ts scripts/scip-windows-package-identity.ts scripts/scip-windows-provenance.mjs scripts/scip-windows-release.ts scripts/score-detector-labels.ts scripts/verify-identity-collision-cli.mjs scripts/verify-scip-windows.mjs scripts/verify-scip-windows-registry.ts skills/scip-explore/scripts/capture-evidence.mjs && npm run api:check && node scripts/check-skill-links.mjs",
|
|
375
375
|
"build:scip-windows": "node scripts/build-scip-windows.mjs",
|
|
376
376
|
"verify:scip-windows": "node scripts/verify-scip-windows.mjs",
|
|
377
377
|
"verify:identity-collision-cli": "node scripts/verify-identity-collision-cli.mjs",
|