@opencode-ai/core 0.0.0-next-17403 → 0.0.0-next-17430
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/dist/account/sql.js +2 -2
- package/dist/agent.js +72 -71
- package/dist/aisdk-native.js +3 -3
- package/dist/aisdk.js +4 -4
- package/dist/app.js +2 -2
- package/dist/bus.js +70 -69
- package/dist/catalog.js +80 -79
- package/dist/chunks/{file-02dbfq60.js → location-mutation-02dbfq60.js} +1 -1
- package/dist/chunks/{file-04kwjb53.js → location-mutation-04kwjb53.js} +2 -2
- package/dist/chunks/{file-5h7b67x4.js → location-mutation-04t2zee8.js} +2 -2
- package/dist/chunks/location-mutation-0brv01ad.js +49 -0
- package/dist/chunks/{file-ffwyrq4f.js → location-mutation-0d1fy242.js} +3 -3
- package/dist/chunks/{file-hzcp77hd.js → location-mutation-0frekq84.js} +4 -4
- package/dist/chunks/{file-yq3qvvc0.js → location-mutation-0ftgkncw.js} +19 -20
- package/dist/chunks/{file-gtmsfgej.js → location-mutation-0hd32y2v.js} +2 -2
- package/dist/chunks/{file-0kvmztkf.js → location-mutation-0kvmztkf.js} +1 -1
- package/dist/chunks/{file-0r325ptc.js → location-mutation-0r325ptc.js} +2 -2
- package/dist/chunks/{file-k24ym88j.js → location-mutation-0r823fba.js} +5 -5
- package/dist/chunks/{file-b1205z0m.js → location-mutation-0vsj68r5.js} +4 -4
- package/dist/chunks/{file-10xtr3be.js → location-mutation-10xtr3be.js} +2 -2
- package/dist/chunks/{file-epr59vh3.js → location-mutation-125t8n5e.js} +2 -2
- package/dist/chunks/{file-18pv8fg3.js → location-mutation-18pv8fg3.js} +2 -2
- package/dist/chunks/{file-1c00jchy.js → location-mutation-1c00jchy.js} +2 -2
- package/dist/chunks/{file-fzt78a2e.js → location-mutation-1hheb5wa.js} +3 -3
- package/dist/chunks/{file-1kvtxahz.js → location-mutation-1kvtxahz.js} +1 -1
- package/dist/chunks/{file-1xksxgzs.js → location-mutation-1xksxgzs.js} +2 -2
- package/dist/chunks/{file-9qhx1q0s.js → location-mutation-1xqbk91z.js} +8 -8
- package/dist/chunks/{file-25pxtba7.js → location-mutation-25pxtba7.js} +1 -1
- package/dist/chunks/{file-qe29gfxk.js → location-mutation-2hdgz33f.js} +8 -8
- package/dist/chunks/{file-1j6sm257.js → location-mutation-2hv0exgv.js} +19 -19
- package/dist/chunks/{file-2m0g72hh.js → location-mutation-2m0g72hh.js} +1 -1
- package/dist/chunks/{file-whdt0xgm.js → location-mutation-2n0gcgrs.js} +5 -5
- package/dist/chunks/{file-2nmyybe0.js → location-mutation-2nmyybe0.js} +1 -1
- package/dist/chunks/{file-z98ygq6h.js → location-mutation-2raxx5kq.js} +14 -14
- package/dist/chunks/{file-qpxjj5fe.js → location-mutation-34tb0anc.js} +8 -8
- package/dist/chunks/{file-w5haq628.js → location-mutation-36y0ktj1.js} +25 -25
- package/dist/chunks/{file-37rcj8p3.js → location-mutation-37rcj8p3.js} +3 -3
- package/dist/chunks/{file-je3y3jh3.js → location-mutation-3b1fswre.js} +4 -4
- package/dist/chunks/{file-wsvrv759.js → location-mutation-3c4ted42.js} +2 -2
- package/dist/chunks/{file-3e69n02a.js → location-mutation-3e69n02a.js} +3 -3
- package/dist/chunks/{file-x7r4ry9d.js → location-mutation-3g101c70.js} +4 -4
- package/dist/chunks/{file-21rsh1dw.js → location-mutation-3g7f11td.js} +10 -10
- package/dist/chunks/{file-3mfgaav1.js → location-mutation-3mfgaav1.js} +4 -4
- package/dist/chunks/{file-nwdbh955.js → location-mutation-3pmhp4vf.js} +2 -2
- package/dist/chunks/{file-3thh6229.js → location-mutation-3thh6229.js} +2 -2
- package/dist/chunks/{file-3vh42rcr.js → location-mutation-3vh42rcr.js} +2 -2
- package/dist/chunks/{file-3w0f1yxt.js → location-mutation-3w0f1yxt.js} +3 -3
- package/dist/chunks/{file-myfsnmxq.js → location-mutation-41tyvzhk.js} +2 -2
- package/dist/chunks/{file-ek6pkfvs.js → location-mutation-47kkmjdz.js} +13 -13
- package/dist/chunks/{file-4seewwjc.js → location-mutation-4ehync6t.js} +29 -34
- package/dist/chunks/{file-60tcngwc.js → location-mutation-4fwscp80.js} +7 -7
- package/dist/chunks/{file-06c3hbpw.js → location-mutation-4s2x3fer.js} +8 -8
- package/dist/chunks/{file-4s2xwh5d.js → location-mutation-4s2xwh5d.js} +3 -3
- package/dist/chunks/{file-d3xxf7rh.js → location-mutation-4t2p9scn.js} +10 -10
- package/dist/chunks/{file-04fhvk4h.js → location-mutation-4vtx7cev.js} +6 -6
- package/dist/chunks/{file-4zzdwbaz.js → location-mutation-4zzdwbaz.js} +2 -2
- package/dist/chunks/{file-50jxp3hw.js → location-mutation-50jxp3hw.js} +1 -1
- package/dist/chunks/{file-52jzav25.js → location-mutation-52jzav25.js} +1 -1
- package/dist/chunks/{file-t68bqjdv.js → location-mutation-540j0gfy.js} +3 -3
- package/dist/chunks/{file-56p2m126.js → location-mutation-56p2m126.js} +1 -1
- package/dist/chunks/{file-57tzwnz4.js → location-mutation-57tzwnz4.js} +1 -1
- package/dist/chunks/{file-sb0z03rs.js → location-mutation-59bcz2pr.js} +10 -10
- package/dist/chunks/{file-5gcdyz0j.js → location-mutation-5gcdyz0j.js} +4 -4
- package/dist/chunks/{file-r181tj8c.js → location-mutation-5nh5hezc.js} +10 -10
- package/dist/chunks/{file-5p2sx24b.js → location-mutation-5p2sx24b.js} +3 -3
- package/dist/chunks/{file-5pfeh60c.js → location-mutation-5pfeh60c.js} +2 -2
- package/dist/chunks/{file-5rs65q6p.js → location-mutation-5rs65q6p.js} +1 -1
- package/dist/chunks/{file-5sgbvx3z.js → location-mutation-5sgbvx3z.js} +2 -2
- package/dist/chunks/location-mutation-61kbpxak.js +252 -0
- package/dist/chunks/{file-q50btfg8.js → location-mutation-64jjq47w.js} +13 -13
- package/dist/chunks/{file-m1kg34f8.js → location-mutation-68x2vr81.js} +28 -28
- package/dist/chunks/{file-ajdmexs0.js → location-mutation-6gnb35n6.js} +60 -60
- package/dist/chunks/{file-agatm6vw.js → location-mutation-6j3axpbw.js} +27 -27
- package/dist/chunks/{file-rcfw24gw.js → location-mutation-6rkf06x9.js} +3 -3
- package/dist/chunks/{file-6sc9h3ca.js → location-mutation-6sc9h3ca.js} +1 -1
- package/dist/chunks/{file-706a4azd.js → location-mutation-706a4azd.js} +1 -1
- package/dist/chunks/{file-56r190jv.js → location-mutation-753v6vp3.js} +8 -8
- package/dist/chunks/{file-74fq3cfj.js → location-mutation-78fah0z2.js} +4 -4
- package/dist/chunks/{file-099wjcm7.js → location-mutation-7jcjw3aq.js} +3 -3
- package/dist/chunks/{file-7mrpdsq5.js → location-mutation-7mrpdsq5.js} +1 -1
- package/dist/chunks/{file-7wcmqxrc.js → location-mutation-7wcmqxrc.js} +1 -1
- package/dist/chunks/{file-857g7h76.js → location-mutation-857g7h76.js} +1 -1
- package/dist/chunks/{file-88jbfw8z.js → location-mutation-88jbfw8z.js} +2 -2
- package/dist/chunks/{file-gm8kdh5e.js → location-mutation-8v47shgf.js} +3 -9
- package/dist/chunks/{file-82q3fqf6.js → location-mutation-8v70s6ab.js} +3 -3
- package/dist/chunks/location-mutation-8vhzxx5g.js +25 -0
- package/dist/chunks/{file-8ywqk2j9.js → location-mutation-8ywqk2j9.js} +1 -1
- package/dist/chunks/{file-93qdgxxd.js → location-mutation-93qdgxxd.js} +1 -1
- package/dist/chunks/{file-zdpmb5x8.js → location-mutation-96r5thkw.js} +7 -7
- package/dist/chunks/{file-999qd968.js → location-mutation-999qd968.js} +1 -1
- package/dist/chunks/{file-52pf4f5y.js → location-mutation-9a17mjm1.js} +10 -10
- package/dist/chunks/{file-9d2xhdr4.js → location-mutation-9d2xhdr4.js} +3 -3
- package/dist/chunks/{file-9f0rnpkn.js → location-mutation-9f0rnpkn.js} +1 -1
- package/dist/chunks/{file-ew2nsy16.js → location-mutation-9hkg5kd0.js} +90 -86
- package/dist/chunks/{file-5fvy871a.js → location-mutation-9q0jhgvd.js} +6 -6
- package/dist/chunks/{file-9q1hedyj.js → location-mutation-9q1hedyj.js} +2 -2
- package/dist/chunks/{file-9r0qzhnf.js → location-mutation-9r0qzhnf.js} +2 -2
- package/dist/chunks/{file-wcn5x42d.js → location-mutation-a1rjphzg.js} +2 -2
- package/dist/chunks/{file-hqcvr4pq.js → location-mutation-a5wmgav8.js} +15 -15
- package/dist/chunks/{file-a65h300v.js → location-mutation-a65h300v.js} +2 -2
- package/dist/chunks/{file-m059dh9g.js → location-mutation-arz1ps0t.js} +24 -24
- package/dist/chunks/{file-ayfwnm78.js → location-mutation-ayfwnm78.js} +2 -2
- package/dist/chunks/{file-6mkabcbx.js → location-mutation-b0mbejr1.js} +1 -1
- package/dist/chunks/{file-bxwqh45t.js → location-mutation-b9h1f4dj.js} +30 -30
- package/dist/chunks/{file-x5mvbkbt.js → location-mutation-bqqx0tzx.js} +8 -8
- package/dist/chunks/{file-1a5z6bwx.js → location-mutation-bw2d55k2.js} +2 -2
- package/dist/chunks/{file-byab506k.js → location-mutation-byab506k.js} +1 -1
- package/dist/chunks/{file-xq5g3gjg.js → location-mutation-byapkyxa.js} +7 -7
- package/dist/chunks/{file-kbfzcbvy.js → location-mutation-bzdn223g.js} +5 -5
- package/dist/chunks/{file-cgvnqv92.js → location-mutation-cgvnqv92.js} +1 -1
- package/dist/chunks/{file-as13d7jp.js → location-mutation-cnjn67jn.js} +8 -4
- package/dist/chunks/{file-88s0dgdc.js → location-mutation-csnfef6e.js} +8 -8
- package/dist/chunks/{file-699y0wfg.js → location-mutation-cyc4yvfk.js} +3 -3
- package/dist/chunks/{file-cz3dkvcz.js → location-mutation-cz3dkvcz.js} +1 -1
- package/dist/chunks/{file-d076mabj.js → location-mutation-d076mabj.js} +2 -2
- package/dist/chunks/{file-my4a0tz0.js → location-mutation-d6jrwgq9.js} +10 -10
- package/dist/chunks/{file-7mqnjm5g.js → location-mutation-d6vgw2a8.js} +5 -5
- package/dist/chunks/{file-d6vvk673.js → location-mutation-d6vvk673.js} +1 -1
- package/dist/chunks/{file-ddn74qps.js → location-mutation-ddn74qps.js} +2 -2
- package/dist/chunks/{file-16eg45cq.js → location-mutation-dgjrfg3r.js} +9 -9
- package/dist/chunks/{file-dhphtf1x.js → location-mutation-dhphtf1x.js} +1 -1
- package/dist/chunks/{file-k7px6p1j.js → location-mutation-djcms1h8.js} +5 -5
- package/dist/chunks/{file-a2j6wc1m.js → location-mutation-ds2n1rwg.js} +87 -88
- package/dist/chunks/{file-e1z9a0ts.js → location-mutation-e1z9a0ts.js} +2 -2
- package/dist/chunks/{file-jkrm4ad7.js → location-mutation-ecxv0vtt.js} +10 -0
- package/dist/chunks/{file-ed4jjjcc.js → location-mutation-ed4jjjcc.js} +2 -2
- package/dist/chunks/{file-jdqyj7wg.js → location-mutation-ef6yet2x.js} +3 -3
- package/dist/chunks/location-mutation-em6xpscd.js +35 -0
- package/dist/chunks/{file-nhv9h1t5.js → location-mutation-en0xy9gf.js} +7 -7
- package/dist/chunks/{file-erj4j75s.js → location-mutation-erj4j75s.js} +1 -1
- package/dist/chunks/{file-eyk9wdct.js → location-mutation-eyk9wdct.js} +2 -2
- package/dist/chunks/{file-3r07cnyb.js → location-mutation-eynva1vt.js} +4 -4
- package/dist/chunks/{file-m0s62zhg.js → location-mutation-ezdcc31m.js} +9 -9
- package/dist/chunks/{file-f05p34aa.js → location-mutation-f05p34aa.js} +3 -3
- package/dist/chunks/{file-fm1nvm5g.js → location-mutation-fm1nvm5g.js} +1 -1
- package/dist/chunks/{file-fk4yarb0.js → location-mutation-fmfg4dfa.js} +7 -7
- package/dist/chunks/{file-fmyre8m1.js → location-mutation-fmyre8m1.js} +1 -1
- package/dist/chunks/{file-nd15qks4.js → location-mutation-fyf1y3p4.js} +8 -8
- package/dist/chunks/{file-0cgwng91.js → location-mutation-g64ww8jz.js} +5 -5
- package/dist/chunks/{file-5wm2dksb.js → location-mutation-g6tw2wts.js} +4 -4
- package/dist/chunks/{file-g9yygpzr.js → location-mutation-g9yygpzr.js} +1 -1
- package/dist/chunks/{file-gcay93cp.js → location-mutation-gcay93cp.js} +1 -1
- package/dist/chunks/{file-gd2xppx8.js → location-mutation-gd2xppx8.js} +1 -1
- package/dist/chunks/{file-h8ecejt5.js → location-mutation-h8ecejt5.js} +1 -1
- package/dist/chunks/{file-8nwtst08.js → location-mutation-h90cytwx.js} +6 -6
- package/dist/chunks/{file-j2z43mps.js → location-mutation-hcewn7yc.js} +3 -3
- package/dist/chunks/{file-hkse6vtj.js → location-mutation-hx586e8c.js} +9 -9
- package/dist/chunks/location-mutation-j1x99epj.js +1022 -0
- package/dist/chunks/{file-p6y5138g.js → location-mutation-j4vd37kq.js} +14 -14
- package/dist/chunks/{file-kqpvkp9c.js → location-mutation-j6db3kpr.js} +6 -6
- package/dist/chunks/{file-s87aan9s.js → location-mutation-jccmgrt1.js} +13 -13
- package/dist/chunks/{file-ngff2d33.js → location-mutation-jjyvhwzc.js} +1 -1
- package/dist/chunks/{file-jssy2dr3.js → location-mutation-jssy2dr3.js} +2 -2
- package/dist/chunks/{file-n23a2b6z.js → location-mutation-jz4dr5fs.js} +3 -3
- package/dist/chunks/{file-c28j3fgz.js → location-mutation-karq4m2g.js} +8 -8
- package/dist/chunks/{file-f9c6f2tj.js → location-mutation-kb4hzjkb.js} +9 -9
- package/dist/chunks/{file-kcwh27nh.js → location-mutation-kcwh27nh.js} +3 -3
- package/dist/chunks/{file-kg1345f7.js → location-mutation-kg1345f7.js} +1 -1
- package/dist/chunks/{file-re7fg789.js → location-mutation-khwhzsbc.js} +3 -3
- package/dist/chunks/{file-x76ytg7n.js → location-mutation-kv1bkwfy.js} +4 -4
- package/dist/chunks/{file-m01ryvbe.js → location-mutation-m01ryvbe.js} +1 -1
- package/dist/chunks/{file-zvvqrm9j.js → location-mutation-m1a1hezg.js} +8 -8
- package/dist/chunks/{file-mf0hyk7z.js → location-mutation-mf0hyk7z.js} +1 -1
- package/dist/chunks/location-mutation-mh28new4.js +17 -0
- package/dist/chunks/{file-6ny9qv71.js → location-mutation-mhv1kjkc.js} +2 -2
- package/dist/chunks/{file-pev1jjfq.js → location-mutation-mm9ph8xs.js} +10 -10
- package/dist/chunks/{file-dg389w8c.js → location-mutation-mqjfxy6k.js} +34 -32
- package/dist/chunks/{file-9bfkaaey.js → location-mutation-mvnm9zw2.js} +6 -6
- package/dist/chunks/{file-mwceq5am.js → location-mutation-mwceq5am.js} +1 -1
- package/dist/chunks/{file-ezatpk0p.js → location-mutation-n6x25y5w.js} +42 -20
- package/dist/chunks/{file-knch8gq3.js → location-mutation-n8nwk0yn.js} +6 -6
- package/dist/chunks/{file-nesb2rcz.js → location-mutation-nesb2rcz.js} +2 -2
- package/dist/chunks/{file-nr76rjj3.js → location-mutation-nr76rjj3.js} +2 -2
- package/dist/chunks/{file-nv7zjdpe.js → location-mutation-nv7zjdpe.js} +2 -2
- package/dist/chunks/{file-nzrjycs5.js → location-mutation-nzrjycs5.js} +1 -1
- package/dist/chunks/{file-yn1hcdhn.js → location-mutation-p1ndb1ng.js} +19 -19
- package/dist/chunks/{file-pfqehjmy.js → location-mutation-pfqehjmy.js} +2 -2
- package/dist/chunks/{file-ph1me6ah.js → location-mutation-ph1me6ah.js} +2 -2
- package/dist/chunks/{file-dpr2gw0q.js → location-mutation-pmk17571.js} +12 -12
- package/dist/chunks/{file-pq4b4pqk.js → location-mutation-pq4b4pqk.js} +2 -2
- package/dist/chunks/{file-prf9bavk.js → location-mutation-prf9bavk.js} +3 -3
- package/dist/chunks/{file-q4r4pzs4.js → location-mutation-q4r4pzs4.js} +1 -1
- package/dist/chunks/{file-dsax7ex2.js → location-mutation-qcrc8pqp.js} +3 -3
- package/dist/chunks/{file-qe0d689s.js → location-mutation-qe0d689s.js} +2 -2
- package/dist/chunks/{file-8mc0j7z9.js → location-mutation-qk93sxrf.js} +3 -3
- package/dist/chunks/{file-f498y0cd.js → location-mutation-qs8s5cph.js} +14 -14
- package/dist/chunks/{file-j3k1mby6.js → location-mutation-r25d42v2.js} +9 -9
- package/dist/chunks/{file-r3k9abhd.js → location-mutation-r3k9abhd.js} +2 -2
- package/dist/chunks/{file-spj6bbpr.js → location-mutation-r5fy7jaj.js} +7 -7
- package/dist/chunks/{file-rqswsgbs.js → location-mutation-rqswsgbs.js} +2 -2
- package/dist/chunks/{file-rt6yg6j2.js → location-mutation-rt6yg6j2.js} +2 -2
- package/dist/chunks/{file-ryap75b3.js → location-mutation-ryap75b3.js} +1 -1
- package/dist/chunks/{file-qzd0yz0t.js → location-mutation-s4grnc9c.js} +2 -2
- package/dist/chunks/{file-s6by3cc4.js → location-mutation-s6by3cc4.js} +3 -3
- package/dist/chunks/{file-s9f13v9h.js → location-mutation-s9f13v9h.js} +1 -1
- package/dist/chunks/{file-smpeg8c9.js → location-mutation-smpeg8c9.js} +2 -2
- package/dist/chunks/{file-8c7fbazd.js → location-mutation-sqc4mbth.js} +3 -3
- package/dist/chunks/{file-szax8zgv.js → location-mutation-szax8zgv.js} +2 -2
- package/dist/chunks/{file-szjq6xea.js → location-mutation-szjq6xea.js} +2 -2
- package/dist/chunks/{file-t2j2ttmx.js → location-mutation-t2j2ttmx.js} +1 -1
- package/dist/chunks/{file-tcn24h1d.js → location-mutation-tcn24h1d.js} +1 -1
- package/dist/chunks/{file-tenv3kfs.js → location-mutation-tenv3kfs.js} +2 -2
- package/dist/chunks/{file-thstd87d.js → location-mutation-thstd87d.js} +1 -1
- package/dist/chunks/{file-ts4t4v20.js → location-mutation-ts4t4v20.js} +2 -2
- package/dist/chunks/{file-cs7xdwz4.js → location-mutation-tst25v8q.js} +11 -11
- package/dist/chunks/{file-tyh0a1hs.js → location-mutation-tyh0a1hs.js} +3 -3
- package/dist/chunks/{file-d1tntka9.js → location-mutation-v0g6bhw5.js} +4 -4
- package/dist/chunks/{file-pthvd50e.js → location-mutation-v2mmxxct.js} +9 -9
- package/dist/chunks/{file-v972xay6.js → location-mutation-v972xay6.js} +1 -1
- package/dist/chunks/{file-v9bfv94f.js → location-mutation-v9bfv94f.js} +1 -1
- package/dist/chunks/{file-c9jmxy9r.js → location-mutation-vbef7eh6.js} +10 -10
- package/dist/chunks/{file-jxr968m5.js → location-mutation-vgxq4rwz.js} +27 -16
- package/dist/chunks/{file-vynn1k31.js → location-mutation-vynn1k31.js} +2 -2
- package/dist/chunks/{file-vz89hfgr.js → location-mutation-vz89hfgr.js} +1 -1
- package/dist/chunks/{file-qj2eh82a.js → location-mutation-w5qc46y3.js} +5 -5
- package/dist/chunks/{file-3ws22bxm.js → location-mutation-wan5jy23.js} +32 -10
- package/dist/chunks/{file-wd268jeg.js → location-mutation-wd268jeg.js} +1 -1
- package/dist/chunks/{file-we2zmhe4.js → location-mutation-we2zmhe4.js} +2 -2
- package/dist/chunks/{file-b0gc5gc4.js → location-mutation-wf2b4nse.js} +7 -7
- package/dist/chunks/{file-wf37p1a1.js → location-mutation-wf37p1a1.js} +1 -1
- package/dist/chunks/{file-gym540kj.js → location-mutation-whywamfh.js} +10 -10
- package/dist/chunks/{file-bf1spywk.js → location-mutation-wjkswe73.js} +3 -3
- package/dist/chunks/{file-wmxdh12w.js → location-mutation-wmxdh12w.js} +1 -1
- package/dist/chunks/{file-wps8gh8n.js → location-mutation-wps8gh8n.js} +2 -2
- package/dist/chunks/{file-wt193r4g.js → location-mutation-wt193r4g.js} +1 -1
- package/dist/chunks/{file-vnxy6gek.js → location-mutation-x5y972rn.js} +7 -7
- package/dist/chunks/{file-v1wjczmx.js → location-mutation-x7qpnwtz.js} +18 -18
- package/dist/chunks/{file-xn9zgn7q.js → location-mutation-x8rs9ht6.js} +11 -11
- package/dist/chunks/{file-xfd1xnk3.js → location-mutation-xfd1xnk3.js} +2 -2
- package/dist/chunks/{file-xfrawapx.js → location-mutation-xfrawapx.js} +1 -1
- package/dist/chunks/{file-xgv25zxy.js → location-mutation-xgv25zxy.js} +1 -1
- package/dist/chunks/{file-89xgxbta.js → location-mutation-xh32hk89.js} +2 -2
- package/dist/chunks/location-mutation-xhz3jyrc.js +674 -0
- package/dist/chunks/{file-xq1vkeee.js → location-mutation-xq1vkeee.js} +2 -2
- package/dist/chunks/{file-zkw93360.js → location-mutation-xs439e4m.js} +5 -5
- package/dist/chunks/{file-xwftk1fd.js → location-mutation-xwftk1fd.js} +2 -2
- package/dist/chunks/{file-4pj9r35m.js → location-mutation-y0h0ays1.js} +5 -5
- package/dist/chunks/{file-y0x38cee.js → location-mutation-y0x38cee.js} +1 -1
- package/dist/chunks/{file-y3haz9xp.js → location-mutation-y5k63rkj.js} +56 -56
- package/dist/chunks/{file-y67x6rf6.js → location-mutation-y67x6rf6.js} +1 -1
- package/dist/chunks/{file-y8rs54ne.js → location-mutation-y8rs54ne.js} +1 -1
- package/dist/chunks/{file-k6vwd7kr.js → location-mutation-y980s7ka.js} +5 -5
- package/dist/chunks/{file-jann6xtr.js → location-mutation-yd9b12c5.js} +9 -18
- package/dist/chunks/{file-xyy9q1qk.js → location-mutation-yh0w3p42.js} +3 -3
- package/dist/chunks/{file-pea3nhwj.js → location-mutation-yh2ps9fk.js} +7 -7
- package/dist/chunks/{file-n7fc11e4.js → location-mutation-ys5ebwvd.js} +33 -33
- package/dist/chunks/{file-zv2xrqy4.js → location-mutation-ytkjjj9h.js} +8 -8
- package/dist/chunks/{file-sqg3c206.js → location-mutation-yvxhf1xv.js} +4 -4
- package/dist/chunks/{file-sr3gq9h2.js → location-mutation-yy8pjdz2.js} +113 -113
- package/dist/chunks/{file-yz0wm9s3.js → location-mutation-yz0wm9s3.js} +2 -2
- package/dist/chunks/{file-7n4s3vap.js → location-mutation-z9ywtz8k.js} +2 -2
- package/dist/chunks/{file-zbqqnp0n.js → location-mutation-zbqqnp0n.js} +1 -1
- package/dist/chunks/{file-zdkg1k91.js → location-mutation-zdkg1k91.js} +1 -1
- package/dist/chunks/{file-zfxc0ze5.js → location-mutation-zfxc0ze5.js} +1 -1
- package/dist/chunks/{file-5hy0t314.js → location-mutation-zstfrfkx.js} +3 -3
- package/dist/chunks/{file-zthe9zqc.js → location-mutation-zthe9zqc.js} +1 -1
- package/dist/chunks/{file-c8p0xtv5.js → location-mutation-zwb0c8qn.js} +7 -7
- package/dist/chunks/{file-as8pbtrg.js → location-mutation-zwmvj6m4.js} +10 -10
- package/dist/codemode/catalog.js +2 -2
- package/dist/codemode/instructions.js +4 -4
- package/dist/codemode/tool.js +3 -3
- package/dist/command.js +130 -129
- package/dist/config/markdown.js +2 -2
- package/dist/config/normalize.js +20 -20
- package/dist/config/plugin/agent.js +131 -130
- package/dist/config/plugin/command.js +132 -131
- package/dist/config/plugin/instruction.js +87 -86
- package/dist/config/plugin/policy.js +112 -111
- package/dist/config/plugin/provider.js +111 -110
- package/dist/config/plugin/reference.js +115 -114
- package/dist/config/plugin/skill-file.js +104 -103
- package/dist/config/plugin/skill.js +134 -133
- package/dist/config/plugin/source.js +111 -110
- package/dist/config/plugin/websearch.js +111 -110
- package/dist/config/variable.js +4 -4
- package/dist/config.js +110 -109
- package/dist/credential/sql.js +3 -3
- package/dist/credential.js +70 -69
- package/dist/database/database.js +67 -66
- package/dist/database/drizzle/effect-sqlite/driver.js +16 -16
- package/dist/database/drizzle/effect-sqlite/index.js +16 -16
- package/dist/database/drizzle/effect-sqlite/migrator.js +15 -15
- package/dist/database/drizzle/effect-sqlite/session.js +15 -15
- package/dist/database/drizzle/index.js +18 -18
- package/dist/database/drizzle/internal/drizzle-utils.js +2 -2
- package/dist/database/drizzle/sqlite-core/effect/count.js +2 -2
- package/dist/database/drizzle/sqlite-core/effect/db.js +10 -10
- package/dist/database/drizzle/sqlite-core/effect/delete.js +3 -3
- package/dist/database/drizzle/sqlite-core/effect/index.js +23 -23
- package/dist/database/drizzle/sqlite-core/effect/insert.js +3 -3
- package/dist/database/drizzle/sqlite-core/effect/query.js +2 -2
- package/dist/database/drizzle/sqlite-core/effect/raw.js +2 -2
- package/dist/database/drizzle/sqlite-core/effect/select.js +3 -3
- package/dist/database/drizzle/sqlite-core/effect/session.js +14 -14
- package/dist/database/drizzle/sqlite-core/effect/update.js +3 -3
- package/dist/database/drizzle/up-migrations/effect-sqlite.js +4 -4
- package/dist/database/drizzle/up-migrations/sqlite.js +3 -3
- package/dist/database/drizzle/up-migrations/utils.js +2 -2
- package/dist/database/drizzle.js +19 -19
- package/dist/database/migration/20260127222353_familiar_lady_ursula.js +2 -2
- package/dist/database/migration/20260211171708_add_project_commands.js +2 -2
- package/dist/database/migration/20260213144116_wakeful_the_professor.js +2 -2
- package/dist/database/migration/20260225215848_workspace.js +2 -2
- package/dist/database/migration/20260227213759_add_session_workspace_id.js +2 -2
- package/dist/database/migration/20260228203230_blue_harpoon.js +2 -2
- package/dist/database/migration/20260303231226_add_workspace_fields.js +2 -2
- package/dist/database/migration/20260309230000_move_org_to_state.js +2 -2
- package/dist/database/migration/20260312043431_session_message_cursor.js +2 -2
- package/dist/database/migration/20260323234822_events.js +2 -2
- package/dist/database/migration/20260410174513_workspace-name.js +2 -2
- package/dist/database/migration/20260413175956_chief_energizer.js +2 -2
- package/dist/database/migration/20260423070820_add_icon_url_override.js +2 -2
- package/dist/database/migration/20260427172553_slow_nightmare.js +2 -2
- package/dist/database/migration/20260428004200_add_session_path.js +2 -2
- package/dist/database/migration/20260501142318_next_venus.js +2 -2
- package/dist/database/migration/20260504145000_add_sync_owner.js +2 -2
- package/dist/database/migration/20260507164347_add_workspace_time.js +2 -2
- package/dist/database/migration/20260510033149_session_usage.js +2 -2
- package/dist/database/migration/20260511000411_data_migration_state.js +2 -2
- package/dist/database/migration/20260511173437_session-metadata.js +2 -2
- package/dist/database/migration/20260601010001_normalize_storage_paths.js +2 -2
- package/dist/database/migration/20260601202201_amazing_prowler.js +2 -2
- package/dist/database/migration/20260602002951_lowly_union_jack.js +2 -2
- package/dist/database/migration/20260602182828_add_project_directories.js +2 -2
- package/dist/database/migration/20260603001617_session_message_projection_indexes.js +2 -2
- package/dist/database/migration/20260603040000_session_message_projection_order.js +2 -2
- package/dist/database/migration/20260603141458_session_input_inbox.js +2 -2
- package/dist/database/migration/20260603160727_jittery_ezekiel_stane.js +2 -2
- package/dist/database/migration/20260604172448_event_sourced_session_input.js +2 -2
- package/dist/database/migration/20260605003541_add_session_context_snapshot.js +2 -2
- package/dist/database/migration/20260605042240_add_context_epoch_agent.js +2 -2
- package/dist/database/migration/20260611035744_credential.js +2 -2
- package/dist/database/migration/20260611192811_lush_chimera.js +2 -2
- package/dist/database/migration/20260612174303_project_dir_strategy.js +2 -2
- package/dist/database/migration/20260622142730_simplify_session_context_epoch.js +2 -2
- package/dist/database/migration/20260622170816_reset_v2_session_state.js +2 -2
- package/dist/database/migration/20260622202450_simplify_session_input.js +2 -2
- package/dist/database/migration/20260804233008_loose_psylocke.js +2 -2
- package/dist/database/migration/20260805200742_import_legacy_credentials.js +2 -2
- package/dist/database/migration/20260808023530_workspace_domain.js +2 -2
- package/dist/database/migration/20260811161259_execution_claim_attempts.js +2 -2
- package/dist/database/migration/20260812181746_session_inbox.js +2 -2
- package/dist/database/migration/20260812213948_worktree.js +7 -0
- package/dist/database/migration.gen.js +46 -45
- package/dist/database/migration.js +48 -47
- package/dist/database/path.js +3 -3
- package/dist/database/schema.gen.js +2 -2
- package/dist/database/schema.sql.js +2 -2
- package/dist/database/sqlite.bun.js +2 -2
- package/dist/database/sqlite.js +2 -2
- package/dist/database/sqlite.node.js +2 -2
- package/dist/database/sqlite.workerd.js +2 -2
- package/dist/database/v1-migration.bun.js +80 -79
- package/dist/database/v1-migration.js +2 -2
- package/dist/database/v1-migration.noop.js +1 -1
- package/dist/effect/app-node-builder.js +315 -311
- package/dist/effect/app-node-platform.js +2 -2
- package/dist/effect/keyed-mutex.js +2 -2
- package/dist/environment/driver.js +1 -1
- package/dist/environment/environment.js +88 -87
- package/dist/environment/exec-defaults.js +3 -3
- package/dist/environment/files.js +2 -2
- package/dist/environment/index.js +88 -87
- package/dist/environment/local.js +3 -3
- package/dist/environment/memory.js +3 -3
- package/dist/environment/unavailable.js +1 -1
- package/dist/event/sql.js +2 -2
- package/dist/event-logger.js +70 -69
- package/dist/file-mutation.js +89 -88
- package/dist/file.js +2 -2
- package/dist/filesystem/fff.bun.js +2 -2
- package/dist/filesystem/fff.js +2 -2
- package/dist/filesystem/fff.node.js +2 -2
- package/dist/filesystem/fff.workerd.js +2 -2
- package/dist/filesystem/ignore.js +1 -1
- package/dist/filesystem/location-watcher.js +111 -110
- package/dist/filesystem/protected.js +2 -2
- package/dist/filesystem/search.js +93 -92
- package/dist/filesystem/watcher-binding.js +2 -2
- package/dist/filesystem/watcher.js +4 -4
- package/dist/filesystem.js +93 -92
- package/dist/form.js +71 -70
- package/dist/formatter/builtins.js +3 -3
- package/dist/formatter.js +113 -112
- package/dist/generate.js +85 -84
- package/dist/git.js +5 -5
- package/dist/github-copilot/chat/convert-to-openai-compatible-chat-messages.js +2 -2
- package/dist/github-copilot/chat/get-response-metadata.js +2 -2
- package/dist/github-copilot/chat/map-openai-compatible-finish-reason.js +2 -2
- package/dist/github-copilot/chat/openai-compatible-chat-language-model.js +8 -8
- package/dist/github-copilot/chat/openai-compatible-chat-options.js +2 -2
- package/dist/github-copilot/chat/openai-compatible-prepare-tools.js +2 -2
- package/dist/github-copilot/copilot-provider.js +19 -19
- package/dist/github-copilot/models.js +4 -4
- package/dist/github-copilot/openai-compatible-error.js +2 -2
- package/dist/github-copilot/responses/convert-to-openai-responses-input.js +3 -3
- package/dist/github-copilot/responses/map-openai-responses-finish-reason.js +2 -2
- package/dist/github-copilot/responses/openai-error.js +2 -2
- package/dist/github-copilot/responses/openai-responses-language-model.js +12 -12
- package/dist/github-copilot/responses/openai-responses-prepare-tools.js +7 -7
- package/dist/github-copilot/responses/tool/code-interpreter.js +2 -2
- package/dist/github-copilot/responses/tool/file-search.js +2 -2
- package/dist/github-copilot/responses/tool/image-generation.js +2 -2
- package/dist/github-copilot/responses/tool/local-shell.js +2 -2
- package/dist/github-copilot/responses/tool/web-search-preview.js +2 -2
- package/dist/github-copilot/responses/tool/web-search.js +2 -2
- package/dist/id/id.js +2 -2
- package/dist/image/photon-wasm.bun.js +1 -1
- package/dist/image/photon-wasm.node.js +1 -1
- package/dist/image/photon-wasm.workerd.js +1 -1
- package/dist/image/photon.js +124 -123
- package/dist/image.js +124 -123
- package/dist/instruction-discovery.js +74 -73
- package/dist/instructions/builtins.js +83 -82
- package/dist/instructions/index.js +2 -2
- package/dist/integration/connection.js +2 -2
- package/dist/integration.js +77 -76
- package/dist/job.js +4 -4
- package/dist/kv/sql.js +3 -3
- package/dist/kv.js +70 -69
- package/dist/location-mutation.js +81 -80
- package/dist/location-service-map.js +81 -80
- package/dist/location-services.js +315 -311
- package/dist/location.js +80 -79
- package/dist/mcp/client.js +90 -89
- package/dist/mcp/index.js +127 -126
- package/dist/mcp/instructions.js +155 -154
- package/dist/mcp/oauth.js +3 -3
- package/dist/mcp/stdio.js +89 -88
- package/dist/mime.js +2 -2
- package/dist/model-resolver.js +83 -82
- package/dist/model.js +3 -3
- package/dist/models-dev.js +77 -76
- package/dist/oauth/page.js +2 -2
- package/dist/permission/saved.js +81 -80
- package/dist/permission/sql.js +6 -6
- package/dist/permission.js +101 -100
- package/dist/plugin/agent.js +102 -101
- package/dist/plugin/command.js +81 -80
- package/dist/plugin/hooks.js +3 -3
- package/dist/plugin/host.js +186 -185
- package/dist/plugin/internal.js +273 -271
- package/dist/plugin/models-dev.js +78 -77
- package/dist/plugin/plan.js +74 -73
- package/dist/plugin/promise.js +146 -145
- package/dist/plugin/provider/alibaba.js +3 -3
- package/dist/plugin/provider/amazon-bedrock.js +3 -3
- package/dist/plugin/provider/anthropic.js +3 -3
- package/dist/plugin/provider/azure.js +118 -117
- package/dist/plugin/provider/cerebras.js +3 -3
- package/dist/plugin/provider/cloudflare-ai-gateway.js +119 -118
- package/dist/plugin/provider/cloudflare-workers-ai.js +119 -118
- package/dist/plugin/provider/cohere.js +3 -3
- package/dist/plugin/provider/configured.js +116 -115
- package/dist/plugin/provider/deepinfra.js +3 -3
- package/dist/plugin/provider/dynamic.js +2 -2
- package/dist/plugin/provider/factory.js +2 -2
- package/dist/plugin/provider/gateway.js +3 -3
- package/dist/plugin/provider/github-copilot.js +84 -83
- package/dist/plugin/provider/gitlab.js +4 -4
- package/dist/plugin/provider/google-vertex.js +3 -3
- package/dist/plugin/provider/groq.js +3 -3
- package/dist/plugin/provider/kilo.js +3 -3
- package/dist/plugin/provider/llmgateway.js +79 -78
- package/dist/plugin/provider/mistral.js +3 -3
- package/dist/plugin/provider/nvidia.js +3 -3
- package/dist/plugin/provider/openai-compatible.js +2 -2
- package/dist/plugin/provider/openai.js +81 -80
- package/dist/plugin/provider/opencode.js +95 -94
- package/dist/plugin/provider/openrouter.js +4 -4
- package/dist/plugin/provider/perplexity.js +3 -3
- package/dist/plugin/provider/sap-ai-core.js +3 -3
- package/dist/plugin/provider/snowflake-cortex.js +3 -3
- package/dist/plugin/provider/togetherai.js +3 -3
- package/dist/plugin/provider/venice.js +3 -3
- package/dist/plugin/provider/vercel.js +3 -3
- package/dist/plugin/provider/xai.js +79 -78
- package/dist/plugin/provider/zenmux.js +3 -3
- package/dist/plugin/provider.js +154 -153
- package/dist/plugin/runtime.js +177 -176
- package/dist/plugin/sdk.js +71 -70
- package/dist/plugin/skill.js +132 -131
- package/dist/plugin/supervisor.js +278 -276
- package/dist/plugin/system-prompt.js +2 -2
- package/dist/plugin/variant.js +4 -4
- package/dist/plugin/warming.js +112 -111
- package/dist/plugin/websearch/exa.js +4 -4
- package/dist/plugin/websearch/firecrawl.js +5 -5
- package/dist/plugin/websearch/index.js +8 -8
- package/dist/plugin/websearch/mcp.js +3 -3
- package/dist/plugin/websearch/parallel.js +5 -5
- package/dist/plugin.js +187 -186
- package/dist/project/schema.js +3 -9
- package/dist/project/sql.js +5 -5
- package/dist/project.js +79 -84
- package/dist/provider.js +2 -2
- package/dist/pty/protocol.js +1 -1
- package/dist/pty/pty.bun.js +1 -1
- package/dist/pty/pty.node.js +1 -1
- package/dist/pty/pty.workerd.js +1 -1
- package/dist/pty/schema.js +2 -2
- package/dist/pty/ticket.js +72 -71
- package/dist/pty.js +114 -113
- package/dist/question.js +72 -71
- package/dist/reference/instructions.js +79 -78
- package/dist/reference.js +77 -76
- package/dist/repository-cache.js +7 -7
- package/dist/repository.js +2 -2
- package/dist/ripgrep/binary.js +3 -3
- package/dist/ripgrep.js +91 -90
- package/dist/schema.js +2 -2
- package/dist/session/compaction.js +148 -147
- package/dist/session/context.js +286 -284
- package/dist/session/error.js +4 -4
- package/dist/session/event.js +2 -2
- package/dist/session/execution/restart.js +117 -116
- package/dist/session/execution.js +117 -116
- package/dist/session/generate-node.js +292 -290
- package/dist/session/generate.js +2 -2
- package/dist/session/history.js +79 -78
- package/dist/session/inbox.js +79 -78
- package/dist/session/info.js +89 -88
- package/dist/session/instruction-entry.js +75 -74
- package/dist/session/instruction-state.js +10 -10
- package/dist/session/instructions.js +98 -97
- package/dist/session/message-updater.js +4 -4
- package/dist/session/message.js +2 -2
- package/dist/session/model-headers.js +4 -4
- package/dist/session/model-http.js +4 -4
- package/dist/session/model-request.js +294 -292
- package/dist/session/projector.js +91 -90
- package/dist/session/prompt-cache-diagnostics.js +2 -2
- package/dist/session/prompt-cache-key.js +3 -3
- package/dist/session/revert.js +116 -115
- package/dist/session/run-coordinator.js +2 -2
- package/dist/session/runner/index.js +86 -85
- package/dist/session/runner/llm.js +302 -300
- package/dist/session/runner/max-steps.js +2 -2
- package/dist/session/runner/model.js +85 -84
- package/dist/session/runner/publish-llm-event.js +4 -4
- package/dist/session/runner/retry.js +74 -73
- package/dist/session/runner/to-llm-message.js +2 -2
- package/dist/session/schema.js +2 -2
- package/dist/session/sql.js +6 -6
- package/dist/session/store.js +97 -96
- package/dist/session/title.js +114 -113
- package/dist/session/to-session-error.js +113 -112
- package/dist/session/transfer.js +181 -180
- package/dist/session/usage.js +2 -2
- package/dist/session.js +176 -175
- package/dist/shell/parse.js +4 -4
- package/dist/shell/select.js +3 -3
- package/dist/shell.js +123 -122
- package/dist/skill/discovery.js +3 -3
- package/dist/skill/instructions.js +103 -102
- package/dist/skill.js +102 -101
- package/dist/snapshot.js +111 -110
- package/dist/state.js +2 -2
- package/dist/tool/html-markdown.js +9 -0
- package/dist/tool/http-body.js +2 -2
- package/dist/tool/mcp.js +154 -153
- package/dist/tool/plugin/edit.js +141 -140
- package/dist/tool/plugin/file-diff.js +2 -2
- package/dist/tool/plugin/glob.js +113 -112
- package/dist/tool/plugin/grep.js +113 -112
- package/dist/tool/plugin/patch.js +140 -139
- package/dist/tool/plugin/question.js +104 -103
- package/dist/tool/plugin/read.js +116 -115
- package/dist/tool/plugin/shell.js +181 -180
- package/dist/tool/plugin/skill.js +103 -102
- package/dist/tool/plugin/subagent.js +178 -177
- package/dist/tool/plugin/webfetch.js +106 -103
- package/dist/tool/plugin/websearch.js +106 -105
- package/dist/tool/plugin/write.js +141 -140
- package/dist/tool/read-filesystem.js +95 -94
- package/dist/tool/runtime.js +2 -2
- package/dist/tool-output.js +112 -111
- package/dist/tool.js +145 -144
- package/dist/types/database/migration/20260812213948_worktree.d.ts +3 -0
- package/dist/types/location-service-map.d.ts +2 -2
- package/dist/types/location-services.d.ts +1 -2
- package/dist/types/permission.d.ts +10 -8
- package/dist/types/project/schema.d.ts +0 -16
- package/dist/types/project/sql.d.ts +1 -0
- package/dist/types/project.d.ts +0 -17
- package/dist/types/shell/parse.d.ts +17 -1
- package/dist/types/tool/html-markdown.d.ts +2 -0
- package/dist/types/tool/plugin/webfetch.d.ts +2 -1
- package/dist/types/worktree/directory.d.ts +9 -0
- package/dist/types/worktree/git.d.ts +22 -0
- package/dist/types/worktree/sql.d.ts +71 -0
- package/dist/types/worktree.d.ts +310 -0
- package/dist/util/array.js +1 -1
- package/dist/util/binary.js +1 -1
- package/dist/util/encode.js +1 -1
- package/dist/util/error.js +2 -2
- package/dist/util/identifier.js +1 -1
- package/dist/util/iife.js +2 -2
- package/dist/util/lazy.js +2 -2
- package/dist/util/path.js +1 -1
- package/dist/util/process-lock-ffi.bun.js +1 -1
- package/dist/util/process-lock-ffi.node.js +1 -1
- package/dist/util/process-lock-ffi.workerd.js +1 -1
- package/dist/util/process-lock.js +1 -1
- package/dist/util/retry.js +1 -1
- package/dist/util/slug.js +2 -2
- package/dist/util/token.js +2 -2
- package/dist/util/which.js +2 -2
- package/dist/util/wildcard.js +2 -2
- package/dist/v1/config/agent.js +4 -4
- package/dist/v1/config/attachment.js +3 -3
- package/dist/v1/config/command.js +2 -2
- package/dist/v1/config/config.js +15 -15
- package/dist/v1/config/error.js +3 -3
- package/dist/v1/config/formatter.js +2 -2
- package/dist/v1/config/layout.js +2 -2
- package/dist/v1/config/lsp.js +2 -2
- package/dist/v1/config/mcp.js +3 -3
- package/dist/v1/config/migrate.js +19 -19
- package/dist/v1/config/permission.js +2 -2
- package/dist/v1/config/plugin.js +2 -2
- package/dist/v1/config/provider-options.js +2 -2
- package/dist/v1/config/provider.js +3 -3
- package/dist/v1/config/server.js +3 -3
- package/dist/v1/config/skills.js +2 -2
- package/dist/v1/permission.js +1 -1
- package/dist/vcs/git.js +3 -3
- package/dist/vcs/hg.js +3 -3
- package/dist/vcs/patch.js +2 -2
- package/dist/vcs.js +84 -83
- package/dist/websearch.js +75 -74
- package/dist/wellknown/plugin.js +75 -74
- package/dist/wellknown.js +74 -73
- package/dist/workspace/driver.js +2 -2
- package/dist/workspace/sql.js +2 -2
- package/dist/workspace.js +71 -70
- package/dist/worktree/directory.js +12 -0
- package/dist/worktree/git.js +14 -0
- package/dist/worktree/sql.js +11 -0
- package/dist/worktree.js +130 -0
- package/package.json +8 -18
- package/dist/chunks/file-0tymthn6.js +0 -239
- package/dist/chunks/file-7mpw7j43.js +0 -287
- package/dist/chunks/file-j5dc019g.js +0 -77
- package/dist/project/copy-strategies.js +0 -86
- package/dist/project/copy.js +0 -120
- package/dist/project/directories.js +0 -89
- package/dist/shell/parser-wasm.bun.js +0 -10
- package/dist/shell/parser-wasm.node.js +0 -13
- package/dist/shell/parser-wasm.workerd.js +0 -7
- package/dist/types/project/copy-strategies.d.ts +0 -24
- package/dist/types/project/copy.d.ts +0 -96
- package/dist/types/project/directories.d.ts +0 -49
- package/dist/types/shell/parser-wasm.bun.d.ts +0 -5
- package/dist/types/shell/parser-wasm.node.d.ts +0 -5
- package/dist/types/shell/parser-wasm.workerd.d.ts +0 -5
- /package/dist/chunks/{file-0cgt0xh2.js → location-mutation-0cgt0xh2.js} +0 -0
- /package/dist/chunks/{file-0f48qthw.js → location-mutation-0f48qthw.js} +0 -0
- /package/dist/chunks/{file-0zz82cjq.js → location-mutation-0zz82cjq.js} +0 -0
- /package/dist/chunks/{file-1fb7bmpf.js → location-mutation-1fb7bmpf.js} +0 -0
- /package/dist/chunks/{file-1wcz8fvj.js → location-mutation-1wcz8fvj.js} +0 -0
- /package/dist/chunks/{file-2qdx6zz3.js → location-mutation-2qdx6zz3.js} +0 -0
- /package/dist/chunks/{file-3c4nztf9.js → location-mutation-3c4nztf9.js} +0 -0
- /package/dist/chunks/{file-3g3rpp2x.js → location-mutation-3g3rpp2x.js} +0 -0
- /package/dist/chunks/{file-3q6gbwmd.js → location-mutation-3q6gbwmd.js} +0 -0
- /package/dist/chunks/{file-3w3ybtfd.js → location-mutation-3w3ybtfd.js} +0 -0
- /package/dist/chunks/{file-47ty4mvs.js → location-mutation-47ty4mvs.js} +0 -0
- /package/dist/chunks/{file-4b2tz2m9.js → location-mutation-4b2tz2m9.js} +0 -0
- /package/dist/chunks/{file-5a5ch9ts.js → location-mutation-5a5ch9ts.js} +0 -0
- /package/dist/chunks/{file-5va1yh78.js → location-mutation-5va1yh78.js} +0 -0
- /package/dist/chunks/{file-69qrqpw0.js → location-mutation-69qrqpw0.js} +0 -0
- /package/dist/chunks/{file-6jtjggv5.js → location-mutation-6jtjggv5.js} +0 -0
- /package/dist/chunks/{file-6yt963b8.js → location-mutation-6yt963b8.js} +0 -0
- /package/dist/chunks/{file-7n9qwqk4.js → location-mutation-7n9qwqk4.js} +0 -0
- /package/dist/chunks/{file-8m0qaa0v.js → location-mutation-8m0qaa0v.js} +0 -0
- /package/dist/chunks/{file-8nn8kqcn.js → location-mutation-8nn8kqcn.js} +0 -0
- /package/dist/chunks/{file-8sj3ajy5.js → location-mutation-8sj3ajy5.js} +0 -0
- /package/dist/chunks/{file-8w9tzfz1.js → location-mutation-8w9tzfz1.js} +0 -0
- /package/dist/chunks/{file-906y0b6d.js → location-mutation-906y0b6d.js} +0 -0
- /package/dist/chunks/{file-9dct5xhx.js → location-mutation-9dct5xhx.js} +0 -0
- /package/dist/chunks/{file-9sdtsapf.js → location-mutation-9sdtsapf.js} +0 -0
- /package/dist/chunks/{file-a02svayp.js → location-mutation-a02svayp.js} +0 -0
- /package/dist/chunks/{file-a83yvq99.js → location-mutation-a83yvq99.js} +0 -0
- /package/dist/chunks/{file-ayevdmef.js → location-mutation-ayevdmef.js} +0 -0
- /package/dist/chunks/{file-b02txbh8.js → location-mutation-b02txbh8.js} +0 -0
- /package/dist/chunks/{file-bbqs2y60.js → location-mutation-bbqs2y60.js} +0 -0
- /package/dist/chunks/{file-brsh5f65.js → location-mutation-brsh5f65.js} +0 -0
- /package/dist/chunks/{file-bxdhjb3y.js → location-mutation-bxdhjb3y.js} +0 -0
- /package/dist/chunks/{file-c77ad0vh.js → location-mutation-c77ad0vh.js} +0 -0
- /package/dist/chunks/{file-cm67rqy2.js → location-mutation-cm67rqy2.js} +0 -0
- /package/dist/chunks/{file-d6s8p2vk.js → location-mutation-d6s8p2vk.js} +0 -0
- /package/dist/chunks/{file-dbah77c1.js → location-mutation-dbah77c1.js} +0 -0
- /package/dist/chunks/{file-df3v2q6j.js → location-mutation-df3v2q6j.js} +0 -0
- /package/dist/chunks/{file-dhcq6c44.js → location-mutation-dhcq6c44.js} +0 -0
- /package/dist/chunks/{file-dht5baf0.js → location-mutation-dht5baf0.js} +0 -0
- /package/dist/chunks/{file-dkmkay92.js → location-mutation-dkmkay92.js} +0 -0
- /package/dist/chunks/{file-dppgrtwb.js → location-mutation-dppgrtwb.js} +0 -0
- /package/dist/chunks/{file-ehj9csmv.js → location-mutation-ehj9csmv.js} +0 -0
- /package/dist/chunks/{file-emmqknsm.js → location-mutation-emmqknsm.js} +0 -0
- /package/dist/chunks/{file-ezs3tagn.js → location-mutation-ezs3tagn.js} +0 -0
- /package/dist/chunks/{file-f4cp4g4a.js → location-mutation-f4cp4g4a.js} +0 -0
- /package/dist/chunks/{file-f84sxdqn.js → location-mutation-f84sxdqn.js} +0 -0
- /package/dist/chunks/{file-faypg4r1.js → location-mutation-faypg4r1.js} +0 -0
- /package/dist/chunks/{file-g7k9te92.js → location-mutation-g7k9te92.js} +0 -0
- /package/dist/chunks/{file-gd5xeqc2.js → location-mutation-gd5xeqc2.js} +0 -0
- /package/dist/chunks/{file-ghm4673n.js → location-mutation-ghm4673n.js} +0 -0
- /package/dist/chunks/{file-ghwjy7my.js → location-mutation-ghwjy7my.js} +0 -0
- /package/dist/chunks/{file-gy500k2r.js → location-mutation-gy500k2r.js} +0 -0
- /package/dist/chunks/{file-hzeg9cfr.js → location-mutation-hzeg9cfr.js} +0 -0
- /package/dist/chunks/{file-j07kk359.js → location-mutation-j07kk359.js} +0 -0
- /package/dist/chunks/{file-jve7t217.js → location-mutation-jve7t217.js} +0 -0
- /package/dist/chunks/{file-kpdbz7gn.js → location-mutation-kpdbz7gn.js} +0 -0
- /package/dist/chunks/{file-kxy11nzk.js → location-mutation-kxy11nzk.js} +0 -0
- /package/dist/chunks/{file-kyyqvx4s.js → location-mutation-kyyqvx4s.js} +0 -0
- /package/dist/chunks/{file-m8cbvarh.js → location-mutation-m8cbvarh.js} +0 -0
- /package/dist/chunks/{file-ma07p6tt.js → location-mutation-ma07p6tt.js} +0 -0
- /package/dist/chunks/{file-ma60vzgv.js → location-mutation-ma60vzgv.js} +0 -0
- /package/dist/chunks/{file-n3m50c2t.js → location-mutation-n3m50c2t.js} +0 -0
- /package/dist/chunks/{file-nkm1m8dz.js → location-mutation-nkm1m8dz.js} +0 -0
- /package/dist/chunks/{file-nsc0c3zb.js → location-mutation-nsc0c3zb.js} +0 -0
- /package/dist/chunks/{file-qaarhjrp.js → location-mutation-qaarhjrp.js} +0 -0
- /package/dist/chunks/{file-qc167nrn.js → location-mutation-qc167nrn.js} +0 -0
- /package/dist/chunks/{file-qp95y4jb.js → location-mutation-qp95y4jb.js} +0 -0
- /package/dist/chunks/{file-r8f4w671.js → location-mutation-r8f4w671.js} +0 -0
- /package/dist/chunks/{file-rdfev9jy.js → location-mutation-rdfev9jy.js} +0 -0
- /package/dist/chunks/{file-rvfvac9x.js → location-mutation-rvfvac9x.js} +0 -0
- /package/dist/chunks/{file-s7whb9gt.js → location-mutation-s7whb9gt.js} +0 -0
- /package/dist/chunks/{file-se76j685.js → location-mutation-se76j685.js} +0 -0
- /package/dist/chunks/{file-sem2g21k.js → location-mutation-sem2g21k.js} +0 -0
- /package/dist/chunks/{file-tmb1f636.js → location-mutation-tmb1f636.js} +0 -0
- /package/dist/chunks/{file-ttxf0gsy.js → location-mutation-ttxf0gsy.js} +0 -0
- /package/dist/chunks/{file-tvmhrvfj.js → location-mutation-tvmhrvfj.js} +0 -0
- /package/dist/chunks/{file-v2adqbbe.js → location-mutation-v2adqbbe.js} +0 -0
- /package/dist/chunks/{file-wj4sxzqa.js → location-mutation-wj4sxzqa.js} +0 -0
- /package/dist/chunks/{file-wwntjmk1.js → location-mutation-wwntjmk1.js} +0 -0
- /package/dist/chunks/{file-wx89ywv3.js → location-mutation-wx89ywv3.js} +0 -0
- /package/dist/chunks/{file-wyqjaaa5.js → location-mutation-wyqjaaa5.js} +0 -0
- /package/dist/chunks/{file-x4q807cx.js → location-mutation-x4q807cx.js} +0 -0
- /package/dist/chunks/{file-yrqrg4vp.js → location-mutation-yrqrg4vp.js} +0 -0
- /package/dist/chunks/{file-z47nswr2.js → location-mutation-z47nswr2.js} +0 -0
- /package/dist/chunks/{file-zsf8rs93.js → location-mutation-zsf8rs93.js} +0 -0
|
@@ -0,0 +1,1022 @@
|
|
|
1
|
+
import {
|
|
2
|
+
exports_select
|
|
3
|
+
} from "./location-mutation-04kwjb53.js";
|
|
4
|
+
import {
|
|
5
|
+
__export
|
|
6
|
+
} from "./location-mutation-rvfvac9x.js";
|
|
7
|
+
|
|
8
|
+
// src/shell/parse.ts
|
|
9
|
+
var exports_parse = {};
|
|
10
|
+
__export(exports_parse, {
|
|
11
|
+
scan: () => scan2,
|
|
12
|
+
ShellParse: () => exports_parse
|
|
13
|
+
});
|
|
14
|
+
import { Effect } from "effect";
|
|
15
|
+
|
|
16
|
+
// ../shell-scan/src/index.ts
|
|
17
|
+
var exports_src = {};
|
|
18
|
+
__export(exports_src, {
|
|
19
|
+
scanPowerShell: () => scanPowerShell,
|
|
20
|
+
scan: () => scan,
|
|
21
|
+
ShellScan: () => exports_src
|
|
22
|
+
});
|
|
23
|
+
var BASH_COMPOUND_KEYWORDS = new Set([
|
|
24
|
+
"if",
|
|
25
|
+
"then",
|
|
26
|
+
"elif",
|
|
27
|
+
"else",
|
|
28
|
+
"fi",
|
|
29
|
+
"for",
|
|
30
|
+
"while",
|
|
31
|
+
"until",
|
|
32
|
+
"case",
|
|
33
|
+
"select",
|
|
34
|
+
"function",
|
|
35
|
+
"do",
|
|
36
|
+
"done",
|
|
37
|
+
"coproc"
|
|
38
|
+
]);
|
|
39
|
+
var POWERSHELL_LOCATIONS = new Set(["set-location", "cd", "chdir", "sl", "push-location"]);
|
|
40
|
+
var POWERSHELL_ALIASES = {
|
|
41
|
+
"%": "foreach-object",
|
|
42
|
+
"?": "where-object",
|
|
43
|
+
ac: "add-content",
|
|
44
|
+
asnp: "add-pssnapin",
|
|
45
|
+
cli: "clear-item",
|
|
46
|
+
clc: "clear-content",
|
|
47
|
+
copy: "copy-item",
|
|
48
|
+
cp: "copy-item",
|
|
49
|
+
cpi: "copy-item",
|
|
50
|
+
del: "remove-item",
|
|
51
|
+
erase: "remove-item",
|
|
52
|
+
etsn: "enter-pssession",
|
|
53
|
+
foreach: "foreach-object",
|
|
54
|
+
icm: "invoke-command",
|
|
55
|
+
ihy: "invoke-history",
|
|
56
|
+
ii: "invoke-item",
|
|
57
|
+
ipal: "import-alias",
|
|
58
|
+
ipmo: "import-module",
|
|
59
|
+
ipsn: "import-pssession",
|
|
60
|
+
mi: "move-item",
|
|
61
|
+
move: "move-item",
|
|
62
|
+
mv: "move-item",
|
|
63
|
+
nal: "new-alias",
|
|
64
|
+
ni: "new-item",
|
|
65
|
+
nmo: "new-module",
|
|
66
|
+
r: "invoke-history",
|
|
67
|
+
rd: "remove-item",
|
|
68
|
+
ren: "rename-item",
|
|
69
|
+
ri: "remove-item",
|
|
70
|
+
rm: "remove-item",
|
|
71
|
+
rmdir: "remove-item",
|
|
72
|
+
rni: "rename-item",
|
|
73
|
+
rmo: "remove-module",
|
|
74
|
+
rsnp: "remove-pssnapin",
|
|
75
|
+
sajb: "start-job",
|
|
76
|
+
sal: "set-alias",
|
|
77
|
+
saps: "start-process",
|
|
78
|
+
sbp: "set-psbreakpoint",
|
|
79
|
+
sc: "set-content",
|
|
80
|
+
si: "set-item",
|
|
81
|
+
start: "start-process",
|
|
82
|
+
pushd: "push-location",
|
|
83
|
+
trcm: "trace-command",
|
|
84
|
+
where: "where-object"
|
|
85
|
+
};
|
|
86
|
+
var MAX_BASH_INPUT_LENGTH = 64 * 1024;
|
|
87
|
+
var MAX_SUBSTITUTION_DEPTH = 32;
|
|
88
|
+
function scan(input) {
|
|
89
|
+
return scanBash(input, 0);
|
|
90
|
+
}
|
|
91
|
+
function scanBash(input, depth) {
|
|
92
|
+
if (input.length > MAX_BASH_INPUT_LENGTH)
|
|
93
|
+
return { kind: "opaque", reason: "invalid-structure" };
|
|
94
|
+
const group = bashLeadingGroup(input);
|
|
95
|
+
if (group) {
|
|
96
|
+
if (depth >= MAX_SUBSTITUTION_DEPTH)
|
|
97
|
+
return { kind: "opaque", reason: "invalid-structure" };
|
|
98
|
+
const nested = scanBash(group.source, depth + 1);
|
|
99
|
+
if (nested.kind === "opaque")
|
|
100
|
+
return nested;
|
|
101
|
+
const suffix = input.slice(group.end + 1).trim();
|
|
102
|
+
if (!suffix)
|
|
103
|
+
return nested;
|
|
104
|
+
const separator = /^(?:&&|\|\||\|&|[;&|])/.exec(suffix)?.[0];
|
|
105
|
+
const remaining = separator ? suffix.slice(separator.length).trim() : suffix;
|
|
106
|
+
if (separator && !remaining)
|
|
107
|
+
return nested;
|
|
108
|
+
const prefixed = separator ? remaining : /^[<>]/.test(remaining) ? `: ${remaining}` : undefined;
|
|
109
|
+
if (!prefixed)
|
|
110
|
+
return { kind: "opaque", reason: "compound-command" };
|
|
111
|
+
const rest = scanBash(prefixed, depth + 1);
|
|
112
|
+
if (rest.kind === "opaque")
|
|
113
|
+
return rest;
|
|
114
|
+
return {
|
|
115
|
+
kind: "scanned",
|
|
116
|
+
commands: nested.commands.concat(rest.commands.filter((command) => command.words[0] !== ":"))
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const commands = [];
|
|
120
|
+
const nestedCommands = [];
|
|
121
|
+
const words = [];
|
|
122
|
+
const assignmentWords = [];
|
|
123
|
+
let word = "";
|
|
124
|
+
let wordStarted = false;
|
|
125
|
+
let assignmentWord = false;
|
|
126
|
+
let assignmentHeadUnsafe = false;
|
|
127
|
+
let segment = 0;
|
|
128
|
+
let quote;
|
|
129
|
+
let dynamicWord = false;
|
|
130
|
+
let compound = false;
|
|
131
|
+
let invalidRedirect = false;
|
|
132
|
+
let invalidStructure = false;
|
|
133
|
+
let separated = false;
|
|
134
|
+
let comment;
|
|
135
|
+
let heredoc = false;
|
|
136
|
+
let redirectTarget = false;
|
|
137
|
+
let hasRedirect = false;
|
|
138
|
+
let terminalBackground = false;
|
|
139
|
+
const finishWord = () => {
|
|
140
|
+
if (!wordStarted)
|
|
141
|
+
return;
|
|
142
|
+
if (!redirectTarget) {
|
|
143
|
+
words.push(word);
|
|
144
|
+
assignmentWords.push(assignmentWord);
|
|
145
|
+
}
|
|
146
|
+
redirectTarget = false;
|
|
147
|
+
word = "";
|
|
148
|
+
wordStarted = false;
|
|
149
|
+
assignmentWord = false;
|
|
150
|
+
assignmentHeadUnsafe = false;
|
|
151
|
+
};
|
|
152
|
+
const finishCommand = (end, boundary = false) => {
|
|
153
|
+
finishWord();
|
|
154
|
+
const resource = input.slice(segment, end).trim();
|
|
155
|
+
const name = assignmentWords.findIndex((assignment) => !assignment);
|
|
156
|
+
if (name >= 0 && /[*?[]/.test(words[name]))
|
|
157
|
+
compound = true;
|
|
158
|
+
if (resource && name >= 0)
|
|
159
|
+
commands.push({
|
|
160
|
+
resource,
|
|
161
|
+
words: words.slice(name)
|
|
162
|
+
});
|
|
163
|
+
else if (!(assignmentWords.length > 0 && assignmentWords.every(Boolean)) && (hasRedirect || boundary || separated))
|
|
164
|
+
invalidStructure = true;
|
|
165
|
+
words.length = 0;
|
|
166
|
+
assignmentWords.length = 0;
|
|
167
|
+
separated = true;
|
|
168
|
+
hasRedirect = false;
|
|
169
|
+
};
|
|
170
|
+
for (let index = 0;index < input.length; index++) {
|
|
171
|
+
const char = input[index];
|
|
172
|
+
if (quote === "single") {
|
|
173
|
+
wordStarted = true;
|
|
174
|
+
if (char === "'")
|
|
175
|
+
quote = undefined;
|
|
176
|
+
else
|
|
177
|
+
word += char;
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (quote === "double") {
|
|
181
|
+
wordStarted = true;
|
|
182
|
+
if (char === '"')
|
|
183
|
+
quote = undefined;
|
|
184
|
+
else if (char === "\\" && index + 1 < input.length)
|
|
185
|
+
word += input[++index];
|
|
186
|
+
else if (char === "$" && input[index + 1] === "(" || char === "`") {
|
|
187
|
+
const substitution = bashSubstitution(input, index);
|
|
188
|
+
if (!substitution || depth >= MAX_SUBSTITUTION_DEPTH)
|
|
189
|
+
return { kind: "opaque", reason: "command-substitution" };
|
|
190
|
+
const result = scanBash(substitution.source, depth + 1);
|
|
191
|
+
if (result.kind === "opaque")
|
|
192
|
+
return result;
|
|
193
|
+
nestedCommands.push(...result.commands);
|
|
194
|
+
word += input.slice(index, substitution.end + 1);
|
|
195
|
+
index = substitution.end;
|
|
196
|
+
} else {
|
|
197
|
+
if (char === "$" && /^\$\{[^}:@]+@P\}/.test(input.slice(index)))
|
|
198
|
+
return { kind: "opaque", reason: "dynamic-execution" };
|
|
199
|
+
if (char === "$" && /^\$\{\([^)]*e[^)]*\)/.test(input.slice(index)))
|
|
200
|
+
return { kind: "opaque", reason: "dynamic-execution" };
|
|
201
|
+
if (char === "$")
|
|
202
|
+
dynamicWord = true;
|
|
203
|
+
word += char;
|
|
204
|
+
}
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (char === "'") {
|
|
208
|
+
quote = "single";
|
|
209
|
+
wordStarted = true;
|
|
210
|
+
if (!assignmentWord)
|
|
211
|
+
assignmentHeadUnsafe = true;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (char === '"') {
|
|
215
|
+
quote = "double";
|
|
216
|
+
wordStarted = true;
|
|
217
|
+
if (!assignmentWord)
|
|
218
|
+
assignmentHeadUnsafe = true;
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (char === "\\") {
|
|
222
|
+
if (index + 1 >= input.length)
|
|
223
|
+
return { kind: "opaque", reason: "unterminated-escape" };
|
|
224
|
+
wordStarted = true;
|
|
225
|
+
if (input[index + 1] === `
|
|
226
|
+
`)
|
|
227
|
+
index++;
|
|
228
|
+
else {
|
|
229
|
+
if (!assignmentWord)
|
|
230
|
+
assignmentHeadUnsafe = true;
|
|
231
|
+
word += input[++index];
|
|
232
|
+
}
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
if (char === "$" && input[index + 1] === "(" || char === "`") {
|
|
236
|
+
const substitution = bashSubstitution(input, index);
|
|
237
|
+
if (!substitution || depth >= MAX_SUBSTITUTION_DEPTH)
|
|
238
|
+
return { kind: "opaque", reason: "command-substitution" };
|
|
239
|
+
const result = scanBash(substitution.source, depth + 1);
|
|
240
|
+
if (result.kind === "opaque")
|
|
241
|
+
return result;
|
|
242
|
+
nestedCommands.push(...result.commands);
|
|
243
|
+
wordStarted = true;
|
|
244
|
+
word += input.slice(index, substitution.end + 1);
|
|
245
|
+
index = substitution.end;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if ((char === "<" || char === ">") && input[index + 1] === "(") {
|
|
249
|
+
const substitution = bashParenthesized(input, index + 1);
|
|
250
|
+
if (!substitution || depth >= MAX_SUBSTITUTION_DEPTH)
|
|
251
|
+
return { kind: "opaque", reason: "command-substitution" };
|
|
252
|
+
const result = scanBash(substitution.source, depth + 1);
|
|
253
|
+
if (result.kind === "opaque")
|
|
254
|
+
return result;
|
|
255
|
+
nestedCommands.push(...result.commands);
|
|
256
|
+
wordStarted = true;
|
|
257
|
+
word += input.slice(index, substitution.end + 1);
|
|
258
|
+
index = substitution.end;
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
if (char === "$" && input[index + 1] === "{" && /^\$\{[^}:@]+@P\}/.test(input.slice(index)))
|
|
262
|
+
return { kind: "opaque", reason: "dynamic-execution" };
|
|
263
|
+
if (char === "$" && /^\$\{\([^)]*e[^)]*\)/.test(input.slice(index)))
|
|
264
|
+
return { kind: "opaque", reason: "dynamic-execution" };
|
|
265
|
+
if (char === "$" && input[index + 1] === "[")
|
|
266
|
+
return { kind: "opaque", reason: "dynamic-execution" };
|
|
267
|
+
if (char === "<" && input[index + 1] === "<")
|
|
268
|
+
heredoc = true;
|
|
269
|
+
if (char === "#" && !wordStarted) {
|
|
270
|
+
finishCommand(index);
|
|
271
|
+
comment = index;
|
|
272
|
+
const newline = input.indexOf(`
|
|
273
|
+
`, index);
|
|
274
|
+
if (newline === -1)
|
|
275
|
+
break;
|
|
276
|
+
index = newline;
|
|
277
|
+
segment = newline + 1;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
const redirect = /^(?:&>>?|<<<|<<-?|<>|<&|>&|>\||>>|>|<)/.exec(input.slice(index))?.[0];
|
|
281
|
+
if (redirect) {
|
|
282
|
+
hasRedirect = true;
|
|
283
|
+
if (redirectTarget)
|
|
284
|
+
invalidRedirect = true;
|
|
285
|
+
if (wordStarted && /^\d+$/.test(word)) {
|
|
286
|
+
word = "";
|
|
287
|
+
wordStarted = false;
|
|
288
|
+
} else
|
|
289
|
+
finishWord();
|
|
290
|
+
redirectTarget = true;
|
|
291
|
+
index += redirect.length - 1;
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if ("()".includes(char) || char === "!" && !wordStarted)
|
|
295
|
+
compound = true;
|
|
296
|
+
if (/\s/.test(char) && char !== `
|
|
297
|
+
`) {
|
|
298
|
+
finishWord();
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
const next = input[index + 1];
|
|
302
|
+
const separator = char === "&" && next === "&" || char === "|" && (next === "|" || next === "&") ? char + next : char === ";" || char === "|" || char === "&" || char === `
|
|
303
|
+
` ? char : undefined;
|
|
304
|
+
if (separator) {
|
|
305
|
+
finishCommand(index, true);
|
|
306
|
+
if (redirectTarget)
|
|
307
|
+
invalidRedirect = true;
|
|
308
|
+
terminalBackground = separator === "&" || separator === ";" || separator === `
|
|
309
|
+
`;
|
|
310
|
+
index += separator.length - 1;
|
|
311
|
+
segment = index + 1;
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
terminalBackground = false;
|
|
315
|
+
wordStarted = true;
|
|
316
|
+
if (char === "$")
|
|
317
|
+
dynamicWord = true;
|
|
318
|
+
if (char === "=" && !assignmentHeadUnsafe && /^[A-Za-z_][A-Za-z0-9_]*\+?$/.test(word))
|
|
319
|
+
assignmentWord = true;
|
|
320
|
+
word += char;
|
|
321
|
+
}
|
|
322
|
+
if (quote)
|
|
323
|
+
return { kind: "opaque", reason: "unterminated-quote" };
|
|
324
|
+
if (heredoc)
|
|
325
|
+
return { kind: "opaque", reason: "heredoc" };
|
|
326
|
+
if (!terminalBackground && (comment === undefined || input.includes(`
|
|
327
|
+
`, comment)))
|
|
328
|
+
finishCommand(input.length);
|
|
329
|
+
if (redirectTarget)
|
|
330
|
+
invalidRedirect = true;
|
|
331
|
+
if (separated && !terminalBackground && comment === undefined && !input.slice(segment).trim())
|
|
332
|
+
invalidStructure = true;
|
|
333
|
+
if (invalidStructure)
|
|
334
|
+
return { kind: "opaque", reason: "invalid-structure" };
|
|
335
|
+
if (invalidRedirect)
|
|
336
|
+
return { kind: "opaque", reason: "invalid-redirect" };
|
|
337
|
+
const conditional = bashConditionalCommands(commands);
|
|
338
|
+
if (conditional)
|
|
339
|
+
commands.splice(0, commands.length, ...conditional);
|
|
340
|
+
if (compound || commands.some((command) => BASH_COMPOUND_KEYWORDS.has(command.words[0] ?? "")))
|
|
341
|
+
return { kind: "opaque", reason: "compound-command" };
|
|
342
|
+
if (commands.some((command) => /[$`]/.test(command.words[0] ?? "")) || dynamicWord && commands[0]?.words[0]?.includes("$"))
|
|
343
|
+
return { kind: "opaque", reason: "dynamic-command-name" };
|
|
344
|
+
if (commands.some((command) => command.words[0]?.startsWith("=")))
|
|
345
|
+
return { kind: "opaque", reason: "dynamic-command-name" };
|
|
346
|
+
return { kind: "scanned", commands: commands.concat(nestedCommands) };
|
|
347
|
+
}
|
|
348
|
+
function bashConditionalCommands(commands) {
|
|
349
|
+
if (commands[0]?.words[0] !== "if" || commands.at(-1)?.words[0] !== "fi")
|
|
350
|
+
return;
|
|
351
|
+
const keywords = new Set(["if", "then", "elif", "else", "fi"]);
|
|
352
|
+
if (commands.some((command) => BASH_COMPOUND_KEYWORDS.has(command.words[0] ?? "") && !keywords.has(command.words[0])))
|
|
353
|
+
return;
|
|
354
|
+
const normalized = [];
|
|
355
|
+
let phase = "condition";
|
|
356
|
+
let hasCommand = false;
|
|
357
|
+
let sawElse = false;
|
|
358
|
+
for (const [index, command] of commands.entries()) {
|
|
359
|
+
const keyword = command.words[0];
|
|
360
|
+
if (!keywords.has(keyword ?? "")) {
|
|
361
|
+
normalized.push(command);
|
|
362
|
+
hasCommand = true;
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
const offset = command.resource.indexOf(keyword) + keyword.length;
|
|
366
|
+
const inline = command.words.length > 1 ? { resource: command.resource.slice(offset).trim(), words: command.words.slice(1) } : undefined;
|
|
367
|
+
if (index === 0) {
|
|
368
|
+
if (inline)
|
|
369
|
+
normalized.push(inline);
|
|
370
|
+
hasCommand = Boolean(inline);
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
if (keyword === "then") {
|
|
374
|
+
if (phase !== "condition" || !hasCommand)
|
|
375
|
+
return;
|
|
376
|
+
phase = "body";
|
|
377
|
+
hasCommand = Boolean(inline);
|
|
378
|
+
}
|
|
379
|
+
if (keyword === "elif") {
|
|
380
|
+
if (phase !== "body" || !hasCommand || sawElse)
|
|
381
|
+
return;
|
|
382
|
+
phase = "condition";
|
|
383
|
+
hasCommand = Boolean(inline);
|
|
384
|
+
}
|
|
385
|
+
if (keyword === "else") {
|
|
386
|
+
if (phase !== "body" || !hasCommand || sawElse)
|
|
387
|
+
return;
|
|
388
|
+
phase = "else";
|
|
389
|
+
sawElse = true;
|
|
390
|
+
hasCommand = Boolean(inline);
|
|
391
|
+
}
|
|
392
|
+
if (keyword === "fi") {
|
|
393
|
+
if (index !== commands.length - 1 || phase === "condition" || !hasCommand || inline)
|
|
394
|
+
return;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (inline)
|
|
398
|
+
normalized.push(inline);
|
|
399
|
+
}
|
|
400
|
+
return normalized;
|
|
401
|
+
}
|
|
402
|
+
function bashLeadingGroup(input) {
|
|
403
|
+
const start = input.search(/\S/);
|
|
404
|
+
if (start < 0)
|
|
405
|
+
return;
|
|
406
|
+
if (input[start] === "{") {
|
|
407
|
+
const group = bashBraced(input, start);
|
|
408
|
+
if (!group)
|
|
409
|
+
return;
|
|
410
|
+
const source = group.source.trim();
|
|
411
|
+
if (!source.endsWith(";"))
|
|
412
|
+
return;
|
|
413
|
+
return { source: source.slice(0, -1), end: group.end };
|
|
414
|
+
}
|
|
415
|
+
if (input[start] !== "(")
|
|
416
|
+
return;
|
|
417
|
+
return bashParenthesized(input, start);
|
|
418
|
+
}
|
|
419
|
+
function bashBraced(input, start) {
|
|
420
|
+
let quote;
|
|
421
|
+
let level = 1;
|
|
422
|
+
for (let index = start + 1;index < input.length; index++) {
|
|
423
|
+
const char = input[index];
|
|
424
|
+
if (quote === "single") {
|
|
425
|
+
if (char === "'")
|
|
426
|
+
quote = undefined;
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
if (char === "\\") {
|
|
430
|
+
index++;
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
if (char === "'") {
|
|
434
|
+
quote = "single";
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
if (char === '"') {
|
|
438
|
+
quote = quote === "double" ? undefined : "double";
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
if (char === "{" && quote !== "double")
|
|
442
|
+
level++;
|
|
443
|
+
if (char !== "}" || quote === "double" || --level)
|
|
444
|
+
continue;
|
|
445
|
+
return { source: input.slice(start + 1, index), end: index };
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function bashParenthesized(input, start) {
|
|
449
|
+
let quote;
|
|
450
|
+
let level = 1;
|
|
451
|
+
for (let index = start + 1;index < input.length; index++) {
|
|
452
|
+
const char = input[index];
|
|
453
|
+
if (quote === "single") {
|
|
454
|
+
if (char === "'")
|
|
455
|
+
quote = undefined;
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
if (char === "\\") {
|
|
459
|
+
index++;
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
if (char === "'") {
|
|
463
|
+
quote = "single";
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
if (char === '"') {
|
|
467
|
+
quote = quote === "double" ? undefined : "double";
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
if (char === "(" && quote !== "double")
|
|
471
|
+
level++;
|
|
472
|
+
if (char !== ")" || quote === "double" || --level)
|
|
473
|
+
continue;
|
|
474
|
+
return { source: input.slice(start + 1, index), end: index };
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function bashSubstitution(input, start) {
|
|
478
|
+
if (input[start] === "`") {
|
|
479
|
+
for (let index = start + 1;index < input.length; index++) {
|
|
480
|
+
if (input[index] === "\\")
|
|
481
|
+
index++;
|
|
482
|
+
else if (input[index] === "`")
|
|
483
|
+
return { source: input.slice(start + 1, index).replaceAll("\\`", "`"), end: index };
|
|
484
|
+
}
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (input.slice(start, start + 3) === "$((")
|
|
488
|
+
return;
|
|
489
|
+
let quote;
|
|
490
|
+
let level = 1;
|
|
491
|
+
for (let index = start + 2;index < input.length; index++) {
|
|
492
|
+
const char = input[index];
|
|
493
|
+
if (quote === "single") {
|
|
494
|
+
if (char === "'")
|
|
495
|
+
quote = undefined;
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
if (char === "\\") {
|
|
499
|
+
index++;
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
if (char === "'") {
|
|
503
|
+
quote = "single";
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
if (quote !== "double" && char === "#" && (index === start + 2 || /[\s;&|()]/.test(input[index - 1] ?? "")))
|
|
507
|
+
return;
|
|
508
|
+
if (char === '"') {
|
|
509
|
+
quote = quote === "double" ? undefined : "double";
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
if (char === "`" && quote !== "double") {
|
|
513
|
+
const nested = bashSubstitution(input, index);
|
|
514
|
+
if (!nested)
|
|
515
|
+
return;
|
|
516
|
+
index = nested.end;
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
if (quote === "double") {
|
|
520
|
+
if (char === "$" && input[index + 1] === "(") {
|
|
521
|
+
level++;
|
|
522
|
+
index++;
|
|
523
|
+
} else if (char === ")" && level > 1)
|
|
524
|
+
level--;
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
if (char === "(")
|
|
528
|
+
level++;
|
|
529
|
+
if (char !== ")" || --level)
|
|
530
|
+
continue;
|
|
531
|
+
return { source: input.slice(start + 2, index), end: index };
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function scanPowerShell(input) {
|
|
535
|
+
return scanPowerShellNested(input, 0);
|
|
536
|
+
}
|
|
537
|
+
function scanPowerShellNested(input, depth) {
|
|
538
|
+
if (input.length > MAX_BASH_INPUT_LENGTH || depth >= MAX_SUBSTITUTION_DEPTH)
|
|
539
|
+
return { kind: "opaque", reason: "invalid-structure" };
|
|
540
|
+
const commands = [];
|
|
541
|
+
const nestedCommands = [];
|
|
542
|
+
const words = [];
|
|
543
|
+
let segment = 0;
|
|
544
|
+
let word = "";
|
|
545
|
+
let started = false;
|
|
546
|
+
let quote;
|
|
547
|
+
let dynamic = false;
|
|
548
|
+
let invalid = false;
|
|
549
|
+
let redirectTarget = false;
|
|
550
|
+
let comment = false;
|
|
551
|
+
let separated = false;
|
|
552
|
+
let dangling = false;
|
|
553
|
+
let dynamicDirectory = false;
|
|
554
|
+
const finishWord = () => {
|
|
555
|
+
if (!started)
|
|
556
|
+
return;
|
|
557
|
+
if (!redirectTarget)
|
|
558
|
+
words.push(word);
|
|
559
|
+
redirectTarget = false;
|
|
560
|
+
word = "";
|
|
561
|
+
started = false;
|
|
562
|
+
};
|
|
563
|
+
const finishCommand = (end, boundary = false) => {
|
|
564
|
+
finishWord();
|
|
565
|
+
const resource = input.slice(segment, end).trim();
|
|
566
|
+
if (resource)
|
|
567
|
+
commands.push({ resource, words: [...words] });
|
|
568
|
+
else if (boundary && separated)
|
|
569
|
+
invalid = true;
|
|
570
|
+
words.length = 0;
|
|
571
|
+
separated ||= Boolean(resource);
|
|
572
|
+
};
|
|
573
|
+
for (let index = 0;index < input.length; index++) {
|
|
574
|
+
const char = input[index];
|
|
575
|
+
if (quote) {
|
|
576
|
+
started = true;
|
|
577
|
+
if (quote === "single" && char === "'" && input[index + 1] === "'") {
|
|
578
|
+
word += "'";
|
|
579
|
+
index++;
|
|
580
|
+
} else if (quote === "single" && char === "'" || quote === "double" && char === '"')
|
|
581
|
+
quote = undefined;
|
|
582
|
+
else if (char === "`" && index + 1 < input.length)
|
|
583
|
+
word += input[++index];
|
|
584
|
+
else {
|
|
585
|
+
if (quote === "double" && char === "$" && input[index + 1] === "(")
|
|
586
|
+
dynamic = true;
|
|
587
|
+
word += char;
|
|
588
|
+
}
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
if (char === "'" || char === '"') {
|
|
592
|
+
quote = char === "'" ? "single" : "double";
|
|
593
|
+
started = true;
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
if (char === "`" && index + 1 < input.length) {
|
|
597
|
+
if (words.length === 0)
|
|
598
|
+
dynamic = true;
|
|
599
|
+
started = true;
|
|
600
|
+
if (input[index + 1] === "\r" && input[index + 2] === `
|
|
601
|
+
`)
|
|
602
|
+
index += 2;
|
|
603
|
+
else if (input[index + 1] === "\r" || input[index + 1] === `
|
|
604
|
+
`)
|
|
605
|
+
index++;
|
|
606
|
+
else
|
|
607
|
+
word += input[++index];
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
if (char === "`")
|
|
611
|
+
return { kind: "opaque", reason: "unterminated-escape" };
|
|
612
|
+
if (char === "<" && input[index + 1] === "#")
|
|
613
|
+
return { kind: "opaque", reason: "dynamic-execution" };
|
|
614
|
+
if (char === "#" && !started) {
|
|
615
|
+
if (/^#requires\b/i.test(input.slice(index)))
|
|
616
|
+
return { kind: "opaque", reason: "dynamic-execution" };
|
|
617
|
+
finishCommand(index);
|
|
618
|
+
comment = true;
|
|
619
|
+
const endings = [input.indexOf(`
|
|
620
|
+
`, index), input.indexOf("\r", index)].filter((ending) => ending >= 0);
|
|
621
|
+
const newline = endings.length > 0 ? Math.min(...endings) : -1;
|
|
622
|
+
if (newline === -1)
|
|
623
|
+
break;
|
|
624
|
+
comment = false;
|
|
625
|
+
index = input[newline] === "\r" && input[newline + 1] === `
|
|
626
|
+
` ? newline + 1 : newline;
|
|
627
|
+
segment = newline + 1;
|
|
628
|
+
continue;
|
|
629
|
+
}
|
|
630
|
+
const redirect = powerShellRedirect(input, index);
|
|
631
|
+
if (redirect) {
|
|
632
|
+
finishWord();
|
|
633
|
+
redirectTarget = !redirect.includes("&");
|
|
634
|
+
index += redirect.length - 1;
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
if (char === "{" && !started) {
|
|
638
|
+
const block = powerShellBlock(input, index);
|
|
639
|
+
if (!block)
|
|
640
|
+
return { kind: "opaque", reason: "invalid-structure" };
|
|
641
|
+
const result = scanPowerShellNested(block.source, depth + 1);
|
|
642
|
+
if (result.kind === "opaque")
|
|
643
|
+
return result;
|
|
644
|
+
nestedCommands.push(...result.commands);
|
|
645
|
+
started = true;
|
|
646
|
+
word += input.slice(index, block.end + 1);
|
|
647
|
+
index = block.end;
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
if (char === "}")
|
|
651
|
+
return { kind: "opaque", reason: "invalid-structure" };
|
|
652
|
+
if ((char === "&" || char === ".") && !started && words.length === 0 && (/\s/.test(input[index + 1] ?? "") || !input[index + 1]))
|
|
653
|
+
continue;
|
|
654
|
+
if ("@()".includes(char))
|
|
655
|
+
dynamic = true;
|
|
656
|
+
if (/\s/.test(char) && char !== `
|
|
657
|
+
` && char !== "\r") {
|
|
658
|
+
finishWord();
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
const next = input[index + 1];
|
|
662
|
+
const separator = char === "\r" && next === `
|
|
663
|
+
` ? char + next : char === "&" && next === "&" || char === "|" && next === "|" ? char + next : char === ";" || char === "|" || char === "&" || char === `
|
|
664
|
+
` || char === "\r" ? char : undefined;
|
|
665
|
+
if (separator) {
|
|
666
|
+
finishCommand(index, true);
|
|
667
|
+
if (redirectTarget)
|
|
668
|
+
invalid = true;
|
|
669
|
+
dangling = ![";", "&", `
|
|
670
|
+
`, "\r", `\r
|
|
671
|
+
`].includes(separator);
|
|
672
|
+
index += separator.length - 1;
|
|
673
|
+
segment = index + 1;
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
started = true;
|
|
677
|
+
dangling = false;
|
|
678
|
+
word += char;
|
|
679
|
+
}
|
|
680
|
+
if (quote)
|
|
681
|
+
return { kind: "opaque", reason: "unterminated-quote" };
|
|
682
|
+
if (!comment)
|
|
683
|
+
finishCommand(input.length);
|
|
684
|
+
if (redirectTarget || invalid || dangling)
|
|
685
|
+
return { kind: "opaque", reason: "invalid-structure" };
|
|
686
|
+
if (dynamic || commands.some((command) => {
|
|
687
|
+
const head = command.words[0] ?? "";
|
|
688
|
+
if (head.includes("\\") && !/^[A-Za-z]:\\/.test(head))
|
|
689
|
+
return true;
|
|
690
|
+
const rawName = shellCommandName(head);
|
|
691
|
+
const name = POWERSHELL_ALIASES[rawName] ?? rawName;
|
|
692
|
+
if (head.includes("$") || head.includes("@"))
|
|
693
|
+
return true;
|
|
694
|
+
if (["return", "throw", "exit", "break", "continue"].includes(name) && command.words.length > 1)
|
|
695
|
+
return true;
|
|
696
|
+
if (POWERSHELL_LOCATIONS.has(name ?? ""))
|
|
697
|
+
return dynamicDirectory = command.words.some((word2, index) => index > 0 && (word2.includes("(") || word2.includes("$") && !knownPowerShellDirectory(word2))) || command.words.some((word2, index) => index > 0 && /^[A-Za-z]+:/.test(word2) && !/^[A-Za-z]:[\\/]/.test(word2));
|
|
698
|
+
return false;
|
|
699
|
+
}))
|
|
700
|
+
return { kind: "opaque", reason: dynamicDirectory ? "dynamic-directory" : "dynamic-execution" };
|
|
701
|
+
return { kind: "scanned", commands: commands.concat(nestedCommands) };
|
|
702
|
+
}
|
|
703
|
+
function powerShellBlock(input, start) {
|
|
704
|
+
let quote;
|
|
705
|
+
let level = 1;
|
|
706
|
+
for (let index = start + 1;index < input.length; index++) {
|
|
707
|
+
const char = input[index];
|
|
708
|
+
if (quote === "single") {
|
|
709
|
+
if (char === "'" && input[index + 1] === "'")
|
|
710
|
+
index++;
|
|
711
|
+
else if (char === "'")
|
|
712
|
+
quote = undefined;
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
if (char === "`") {
|
|
716
|
+
index++;
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
if (char === "#" && quote !== "double") {
|
|
720
|
+
const newline = input.indexOf(`
|
|
721
|
+
`, index);
|
|
722
|
+
if (newline < 0)
|
|
723
|
+
return;
|
|
724
|
+
index = newline;
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
if (char === "<" && input[index + 1] === "#" && quote !== "double") {
|
|
728
|
+
const end = input.indexOf("#>", index + 2);
|
|
729
|
+
if (end < 0)
|
|
730
|
+
return;
|
|
731
|
+
index = end + 1;
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
if (char === "'") {
|
|
735
|
+
quote = "single";
|
|
736
|
+
continue;
|
|
737
|
+
}
|
|
738
|
+
if (char === '"') {
|
|
739
|
+
quote = quote === "double" ? undefined : "double";
|
|
740
|
+
continue;
|
|
741
|
+
}
|
|
742
|
+
if (char === "{" && quote !== "double")
|
|
743
|
+
level++;
|
|
744
|
+
if (char !== "}" || quote === "double" || --level)
|
|
745
|
+
continue;
|
|
746
|
+
return { source: input.slice(start + 1, index), end: index };
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
function shellCommandName(word) {
|
|
750
|
+
const value = (word ?? "").toLowerCase();
|
|
751
|
+
return value.slice(Math.max(value.lastIndexOf("/"), value.lastIndexOf("\\")) + 1);
|
|
752
|
+
}
|
|
753
|
+
function knownPowerShellDirectory(word) {
|
|
754
|
+
const variable = /^(?:\$(?:PWD|HOME|PSHOME)|\$env:[A-Za-z_][A-Za-z0-9_]*|\$\{env:[^}]+\})(?:[\\/]|$)/i.exec(word);
|
|
755
|
+
return Boolean(variable) && !word.slice(variable?.[0].length).includes("$");
|
|
756
|
+
}
|
|
757
|
+
function powerShellRedirect(input, index) {
|
|
758
|
+
let cursor = index;
|
|
759
|
+
if (input[cursor] === "*")
|
|
760
|
+
cursor++;
|
|
761
|
+
else
|
|
762
|
+
while (/\d/.test(input[cursor] ?? ""))
|
|
763
|
+
cursor++;
|
|
764
|
+
if (input[cursor] !== ">" && input[cursor] !== "<")
|
|
765
|
+
return;
|
|
766
|
+
cursor++;
|
|
767
|
+
if (input[cursor] === ">")
|
|
768
|
+
cursor++;
|
|
769
|
+
if (input[cursor] === "&") {
|
|
770
|
+
cursor++;
|
|
771
|
+
while (/\d/.test(input[cursor] ?? ""))
|
|
772
|
+
cursor++;
|
|
773
|
+
}
|
|
774
|
+
return input.slice(index, cursor);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// src/shell/parse.ts
|
|
778
|
+
import os from "os";
|
|
779
|
+
import path from "path";
|
|
780
|
+
var CWD = new Set(["cd", "chdir", "popd", "pushd", "push-location", "set-location", "sl"]);
|
|
781
|
+
var POWERSHELL_PATH_FLAGS = new Set(["-literalpath", "-path"]);
|
|
782
|
+
var ARITY = {
|
|
783
|
+
cat: 1,
|
|
784
|
+
cd: 1,
|
|
785
|
+
chmod: 1,
|
|
786
|
+
chown: 1,
|
|
787
|
+
cp: 1,
|
|
788
|
+
echo: 1,
|
|
789
|
+
env: 1,
|
|
790
|
+
export: 1,
|
|
791
|
+
grep: 1,
|
|
792
|
+
kill: 1,
|
|
793
|
+
killall: 1,
|
|
794
|
+
ln: 1,
|
|
795
|
+
ls: 1,
|
|
796
|
+
mkdir: 1,
|
|
797
|
+
mv: 1,
|
|
798
|
+
ps: 1,
|
|
799
|
+
pwd: 1,
|
|
800
|
+
rm: 1,
|
|
801
|
+
rmdir: 1,
|
|
802
|
+
sleep: 1,
|
|
803
|
+
source: 1,
|
|
804
|
+
tail: 1,
|
|
805
|
+
touch: 1,
|
|
806
|
+
unset: 1,
|
|
807
|
+
which: 1,
|
|
808
|
+
aws: 3,
|
|
809
|
+
az: 3,
|
|
810
|
+
bazel: 2,
|
|
811
|
+
brew: 2,
|
|
812
|
+
bun: 2,
|
|
813
|
+
"bun run": 3,
|
|
814
|
+
"bun x": 3,
|
|
815
|
+
cargo: 2,
|
|
816
|
+
"cargo add": 3,
|
|
817
|
+
"cargo run": 3,
|
|
818
|
+
cdk: 2,
|
|
819
|
+
cf: 2,
|
|
820
|
+
cmake: 2,
|
|
821
|
+
composer: 2,
|
|
822
|
+
consul: 2,
|
|
823
|
+
"consul kv": 3,
|
|
824
|
+
crictl: 2,
|
|
825
|
+
deno: 2,
|
|
826
|
+
"deno task": 3,
|
|
827
|
+
doctl: 3,
|
|
828
|
+
docker: 2,
|
|
829
|
+
"docker builder": 3,
|
|
830
|
+
"docker compose": 3,
|
|
831
|
+
"docker container": 3,
|
|
832
|
+
"docker image": 3,
|
|
833
|
+
"docker network": 3,
|
|
834
|
+
"docker volume": 3,
|
|
835
|
+
eksctl: 2,
|
|
836
|
+
"eksctl create": 3,
|
|
837
|
+
firebase: 2,
|
|
838
|
+
flyctl: 2,
|
|
839
|
+
gcloud: 3,
|
|
840
|
+
gh: 3,
|
|
841
|
+
git: 2,
|
|
842
|
+
"git config": 3,
|
|
843
|
+
"git remote": 3,
|
|
844
|
+
"git stash": 3,
|
|
845
|
+
go: 2,
|
|
846
|
+
gradle: 2,
|
|
847
|
+
helm: 2,
|
|
848
|
+
heroku: 2,
|
|
849
|
+
hugo: 2,
|
|
850
|
+
ip: 2,
|
|
851
|
+
"ip addr": 3,
|
|
852
|
+
"ip link": 3,
|
|
853
|
+
"ip netns": 3,
|
|
854
|
+
"ip route": 3,
|
|
855
|
+
kind: 2,
|
|
856
|
+
"kind create": 3,
|
|
857
|
+
kubectl: 2,
|
|
858
|
+
"kubectl kustomize": 3,
|
|
859
|
+
"kubectl rollout": 3,
|
|
860
|
+
kustomize: 2,
|
|
861
|
+
make: 2,
|
|
862
|
+
mc: 2,
|
|
863
|
+
"mc admin": 3,
|
|
864
|
+
minikube: 2,
|
|
865
|
+
mongosh: 2,
|
|
866
|
+
mysql: 2,
|
|
867
|
+
mvn: 2,
|
|
868
|
+
ng: 2,
|
|
869
|
+
npm: 2,
|
|
870
|
+
"npm exec": 3,
|
|
871
|
+
"npm init": 3,
|
|
872
|
+
"npm run": 3,
|
|
873
|
+
"npm view": 3,
|
|
874
|
+
npx: 2,
|
|
875
|
+
nvm: 2,
|
|
876
|
+
nx: 2,
|
|
877
|
+
openssl: 2,
|
|
878
|
+
"openssl req": 3,
|
|
879
|
+
"openssl x509": 3,
|
|
880
|
+
pip: 2,
|
|
881
|
+
pipenv: 2,
|
|
882
|
+
pnpm: 2,
|
|
883
|
+
"pnpm dlx": 3,
|
|
884
|
+
"pnpm exec": 3,
|
|
885
|
+
"pnpm run": 3,
|
|
886
|
+
poetry: 2,
|
|
887
|
+
podman: 2,
|
|
888
|
+
"podman container": 3,
|
|
889
|
+
"podman image": 3,
|
|
890
|
+
psql: 2,
|
|
891
|
+
pulumi: 2,
|
|
892
|
+
"pulumi stack": 3,
|
|
893
|
+
python: 2,
|
|
894
|
+
pyenv: 2,
|
|
895
|
+
rake: 2,
|
|
896
|
+
rbenv: 2,
|
|
897
|
+
"redis-cli": 2,
|
|
898
|
+
rustup: 2,
|
|
899
|
+
serverless: 2,
|
|
900
|
+
sfdx: 3,
|
|
901
|
+
skaffold: 2,
|
|
902
|
+
sls: 2,
|
|
903
|
+
sst: 2,
|
|
904
|
+
swift: 2,
|
|
905
|
+
systemctl: 2,
|
|
906
|
+
terraform: 2,
|
|
907
|
+
"terraform workspace": 3,
|
|
908
|
+
tmux: 2,
|
|
909
|
+
turbo: 2,
|
|
910
|
+
ufw: 2,
|
|
911
|
+
vault: 2,
|
|
912
|
+
"vault auth": 3,
|
|
913
|
+
"vault kv": 3,
|
|
914
|
+
vercel: 2,
|
|
915
|
+
volta: 2,
|
|
916
|
+
wp: 2,
|
|
917
|
+
yarn: 2,
|
|
918
|
+
"yarn dlx": 3,
|
|
919
|
+
"yarn run": 3
|
|
920
|
+
};
|
|
921
|
+
var scan2 = Effect.fn("ShellParse.scan")(function* (command, shell, cwd) {
|
|
922
|
+
return scanCommands(command, cwd, shell, exports_select.ps(shell));
|
|
923
|
+
});
|
|
924
|
+
function scanCommands(command, cwd, shell, powershell) {
|
|
925
|
+
const result = powershell ? exports_src.scanPowerShell(command) : exports_src.scan(command);
|
|
926
|
+
if (result.kind === "opaque")
|
|
927
|
+
return {
|
|
928
|
+
commands: [{ resource: command, save: command }],
|
|
929
|
+
directories: [],
|
|
930
|
+
opaque: true,
|
|
931
|
+
directoryUnknown: true
|
|
932
|
+
};
|
|
933
|
+
if (result.commands.some((item) => {
|
|
934
|
+
const name = powershell ? item.words[0]?.toLowerCase() : item.words[0];
|
|
935
|
+
if (!name || !CWD.has(name) || name === "popd" || name === "pop-location")
|
|
936
|
+
return false;
|
|
937
|
+
return directoryArgs(item.words, powershell, cwd, shell).length === 0;
|
|
938
|
+
}))
|
|
939
|
+
return { commands: [{ resource: command }], directories: [], opaque: true, directoryUnknown: true };
|
|
940
|
+
return result.commands.reduce((output, item) => {
|
|
941
|
+
const name = powershell ? item.words[0]?.toLowerCase() : item.words[0];
|
|
942
|
+
if (!name)
|
|
943
|
+
return output;
|
|
944
|
+
if (CWD.has(name)) {
|
|
945
|
+
output.directories.push(...directoryArgs(item.words, powershell, cwd, shell));
|
|
946
|
+
return output;
|
|
947
|
+
}
|
|
948
|
+
output.commands.push({ resource: item.resource, save: `${prefix(item.words).join(" ")} *` });
|
|
949
|
+
return output;
|
|
950
|
+
}, {
|
|
951
|
+
commands: [],
|
|
952
|
+
directories: [],
|
|
953
|
+
opaque: false
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
function directoryArgs(command, powershell, cwd, shell) {
|
|
957
|
+
if (!powershell) {
|
|
958
|
+
const values = command.slice(1).filter((part) => !part.startsWith("-")).map((part) => directoryArgument(part, powershell, cwd, shell)).filter((part) => part !== undefined);
|
|
959
|
+
if (command[0] === "cd" && (values.length !== 1 || !path.isAbsolute(values[0]) && Boolean(process.env.CDPATH)))
|
|
960
|
+
return [];
|
|
961
|
+
return values;
|
|
962
|
+
}
|
|
963
|
+
const directories = [];
|
|
964
|
+
let expectsPath = false;
|
|
965
|
+
for (const part of command.slice(1)) {
|
|
966
|
+
if (expectsPath) {
|
|
967
|
+
const value2 = directoryArgument(part, powershell, cwd, shell);
|
|
968
|
+
if (value2)
|
|
969
|
+
directories.push(value2);
|
|
970
|
+
expectsPath = false;
|
|
971
|
+
continue;
|
|
972
|
+
}
|
|
973
|
+
if (part.startsWith("-")) {
|
|
974
|
+
expectsPath = POWERSHELL_PATH_FLAGS.has(part.toLowerCase());
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
const value = directoryArgument(part, powershell, cwd, shell);
|
|
978
|
+
if (value)
|
|
979
|
+
directories.push(value);
|
|
980
|
+
}
|
|
981
|
+
return directories;
|
|
982
|
+
}
|
|
983
|
+
function directoryArgument(value, powershell, cwd, shell) {
|
|
984
|
+
const quote = value[0];
|
|
985
|
+
const text = (quote === '"' || quote === "'") && value.at(-1) === quote ? value.slice(1, -1) : value;
|
|
986
|
+
if (!powershell)
|
|
987
|
+
return expandKnownDirectory(text);
|
|
988
|
+
return expandKnownDirectory(text.replace(/\$\{env:([^}]+)\}/gi, (_, key) => environment(key) ?? "").replace(/\$env:([A-Za-z_][A-Za-z0-9_]*)/gi, (_, key) => environment(key) ?? "").replace(/\$(HOME|PWD|PSHOME)(?=$|[\\/])/gi, (_, key) => {
|
|
989
|
+
if (key.toUpperCase() === "HOME")
|
|
990
|
+
return os.homedir();
|
|
991
|
+
if (key.toUpperCase() === "PWD")
|
|
992
|
+
return cwd;
|
|
993
|
+
return path.dirname(shell);
|
|
994
|
+
}));
|
|
995
|
+
}
|
|
996
|
+
function expandKnownDirectory(value) {
|
|
997
|
+
if (value.includes("$") || value.includes("`") || value.startsWith("("))
|
|
998
|
+
return;
|
|
999
|
+
if (value === "~")
|
|
1000
|
+
return os.homedir();
|
|
1001
|
+
if (value.startsWith("~/") || value.startsWith("~\\"))
|
|
1002
|
+
return path.join(os.homedir(), value.slice(2));
|
|
1003
|
+
if (value.startsWith("~"))
|
|
1004
|
+
return;
|
|
1005
|
+
return value;
|
|
1006
|
+
}
|
|
1007
|
+
function environment(key) {
|
|
1008
|
+
if (process.platform !== "win32")
|
|
1009
|
+
return process.env[key];
|
|
1010
|
+
const name = Object.keys(process.env).find((item) => item.toLowerCase() === key.toLowerCase());
|
|
1011
|
+
return name ? process.env[name] : undefined;
|
|
1012
|
+
}
|
|
1013
|
+
function prefix(tokens) {
|
|
1014
|
+
for (let length = tokens.length;length > 0; length--) {
|
|
1015
|
+
const arity = ARITY[tokens.slice(0, length).join(" ")];
|
|
1016
|
+
if (arity !== undefined)
|
|
1017
|
+
return tokens.slice(0, arity);
|
|
1018
|
+
}
|
|
1019
|
+
return tokens.slice(0, 1);
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
export { scan2 as scan, exports_parse };
|