@devries-cameron20 / composio Mirror · read-only / commits / d14bfd738
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 22:00 UTC

feat(cli): support `upgrade` command (#1774)

Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>

Alberto Schiabel committed Jul 21, 2025 at 16:19 UTC d14bfd7386df522f86f3c1f0b3456626ca97b71e
20 files changed +1842 -75
pnpm-lock.yaml
+403 -20
@@ -532,6 +532,9 @@ importers:
532 ansis:
533 specifier: ^4.1.0
534 version: 4.1.0
535 + decompress:
536 + specifier: ^4.2.1
537 + version: 4.2.1
538 effect:
539 specifier: ^3.16.16
540 version: 3.16.16
@@ -566,6 +569,9 @@ importers:
569 '@types/bun':
570 specifier: ^1.2.16
571 version: 1.2.16
572 + '@types/decompress':
573 + specifier: ^4.2.7
574 + version: 4.2.7
575 '@types/semver':
576 specifier: ^7.7.0
577 version: 7.7.0
@@ -3142,6 +3148,9 @@ packages:
3148 '@types/convict@6.1.6':
3149 resolution: {integrity: sha512-1B6jqWHWQud+7yyWAqbxnPmzlHrrOtJzZr1DhhYJ/NbpS4irfZSnq+N5Fm76J9LNRlUZvCmYxTVhhohWRvtqHw==}
3150
3151 + '@types/decompress@4.2.7':
3152 + resolution: {integrity: sha512-9z+8yjKr5Wn73Pt17/ldnmQToaFHZxK0N1GHysuk/JIPT8RIdQeoInM01wWPgypRcvb6VH1drjuFpQ4zmY437g==}
3153 +
3154 '@types/deep-eql@4.0.2':
3155 resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
3156
@@ -3465,6 +3474,10 @@ packages:
3474 resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==}
3475 engines: {node: '>=8.0.0'}
3476
3477 + available-typed-arrays@1.0.7:
3478 + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
3479 + engines: {node: '>= 0.4'}
3480 +
3481 axios@1.10.0:
3482 resolution: {integrity: sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==}
3483
@@ -3488,6 +3501,9 @@ packages:
3501 birpc@0.2.14:
3502 resolution: {integrity: sha512-37FHE8rqsYM5JEKCnXFyHpBCzvgHEExwVVTq+nUmloInU7l8ezD1TpOhKpS8oe1DTYFqEK27rFZVKG43oTqXRA==}
3503
3504 + bl@1.2.3:
3505 + resolution: {integrity: sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==}
3506 +
3507 blake3-wasm@2.1.5:
3508 resolution: {integrity: sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==}
3509
@@ -3512,9 +3528,24 @@ packages:
3528 resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
3529 engines: {node: '>=8'}
3530
3531 + buffer-alloc-unsafe@1.1.0:
3532 + resolution: {integrity: sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==}
3533 +
3534 + buffer-alloc@1.2.0:
3535 + resolution: {integrity: sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==}
3536 +
3537 + buffer-crc32@0.2.13:
3538 + resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==}
3539 +
3540 buffer-equal-constant-time@1.0.1:
3541 resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==}
3542
3543 + buffer-fill@1.0.0:
3544 + resolution: {integrity: sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==}
3545 +
3546 + buffer@5.7.1:
3547 + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
3548 +
3549 buffer@6.0.3:
3550 resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
3551
@@ -3547,6 +3578,10 @@ packages:
3578 resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
3579 engines: {node: '>= 0.4'}
3580
3581 + call-bind@1.0.8:
3582 + resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==}
3583 + engines: {node: '>= 0.4'}
3584 +
3585 call-bound@1.0.4:
3586 resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}
3587 engines: {node: '>= 0.4'}
@@ -3659,6 +3694,9 @@ packages:
3694 resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==}
3695 engines: {node: '>=18'}
3696
3697 + commander@2.20.3:
3698 + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
3699 +
3700 commander@4.1.1:
3701 resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
3702 engines: {node: '>= 6'}
@@ -3783,6 +3821,26 @@ packages:
3821 resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
3822 engines: {node: '>=0.10.0'}
3823
3824 + decompress-tar@4.1.1:
3825 + resolution: {integrity: sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==}
3826 + engines: {node: '>=4'}
3827 +
3828 + decompress-tarbz2@4.1.1:
3829 + resolution: {integrity: sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==}
3830 + engines: {node: '>=4'}
3831 +
3832 + decompress-targz@4.1.1:
3833 + resolution: {integrity: sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==}
3834 + engines: {node: '>=4'}
3835 +
3836 + decompress-unzip@4.0.1:
3837 + resolution: {integrity: sha512-1fqeluvxgnn86MOh66u8FjbtJpAFv5wgCT9Iw8rcBqQcCo5tO8eiJw7NNTrvt9n4CRBVq7CstiS922oPgyGLrw==}
3838 + engines: {node: '>=4'}
3839 +
3840 + decompress@4.2.1:
3841 + resolution: {integrity: sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==}
3842 + engines: {node: '>=4'}
3843 +
3844 deep-eql@5.0.2:
3845 resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==}
3846 engines: {node: '>=6'}
@@ -3798,6 +3856,10 @@ packages:
3856 resolution: {integrity: sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==}
3857 engines: {node: '>=18'}
3858
3859 + define-data-property@1.1.4:
3860 + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==}
3861 + engines: {node: '>= 0.4'}
3862 +
3863 define-lazy-prop@2.0.0:
3864 resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==}
3865 engines: {node: '>=8'}
@@ -4121,6 +4183,9 @@ packages:
4183 fastq@1.19.1:
4184 resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==}
4185
4186 + fd-slicer@1.1.0:
4187 + resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==}
4188 +
4189 fdir@6.4.6:
4190 resolution: {integrity: sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==}
4191 peerDependencies:
@@ -4140,6 +4205,18 @@ packages:
4205 resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==}
4206 engines: {node: '>=16.0.0'}
4207
4208 + file-type@3.9.0:
4209 + resolution: {integrity: sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==}
4210 + engines: {node: '>=0.10.0'}
4211 +
4212 + file-type@5.2.0:
4213 + resolution: {integrity: sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==}
4214 + engines: {node: '>=4'}
4215 +
4216 + file-type@6.2.0:
4217 + resolution: {integrity: sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==}
4218 + engines: {node: '>=4'}
4219 +
4220 fill-range@7.1.1:
4221 resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}
4222 engines: {node: '>=8'}
@@ -4182,6 +4259,10 @@ packages:
4259 debug:
4260 optional: true
4261
4262 + for-each@0.3.5:
4263 + resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==}
4264 + engines: {node: '>= 0.4'}
4265 +
4266 foreground-child@3.3.1:
4267 resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==}
4268 engines: {node: '>=14'}
@@ -4220,6 +4301,9 @@ packages:
4301 resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}
4302 engines: {node: '>= 0.8'}
4303
4304 + fs-constants@1.0.0:
4305 + resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
4306 +
4307 fs-extra@7.0.1:
4308 resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==}
4309 engines: {node: '>=6 <7 || >=8'}
@@ -4263,6 +4347,10 @@ packages:
4347 get-source@2.0.12:
4348 resolution: {integrity: sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==}
4349
4350 + get-stream@2.3.1:
4351 + resolution: {integrity: sha512-AUGhbbemXxrZJRD5cDvKtQxLuYaIbNtDTK8YqupCI393Q2KSTreEsLUN3ZxAWFGiKTzL6nKuzfcIvieflUX9qA==}
4352 + engines: {node: '>=0.10.0'}
4353 +
4354 get-stream@8.0.1:
4355 resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==}
4356 engines: {node: '>=16'}
@@ -4331,6 +4419,9 @@ packages:
4419 resolution: {integrity: sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==}
4420 engines: {node: '>=8'}
4421
4422 + has-property-descriptors@1.0.2:
4423 + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}
4424 +
4425 has-symbols@1.1.0:
4426 resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
4427 engines: {node: '>= 0.4'}
@@ -4475,6 +4566,10 @@ packages:
4566 resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
4567 engines: {node: '>=8'}
4568
4569 + is-callable@1.2.7:
4570 + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==}
4571 + engines: {node: '>= 0.4'}
4572 +
4573 is-core-module@2.16.1:
4574 resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==}
4575 engines: {node: '>= 0.4'}
@@ -4518,6 +4613,9 @@ packages:
4613 engines: {node: '>=14.16'}
4614 hasBin: true
4615
4616 + is-natural-number@4.0.1:
4617 + resolution: {integrity: sha512-Y4LTamMe0DDQIIAlaer9eKebAlDSV6huy+TWhJVPlzZh2o4tRP5SQWFlLn5N0To4mDD22/qdOq+veo1cSISLgQ==}
4618 +
4619 is-number@7.0.0:
4620 resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
4621 engines: {node: '>=0.12.0'}
@@ -4525,6 +4623,10 @@ packages:
4623 is-promise@4.0.0:
4624 resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}
4625
4626 + is-stream@1.1.0:
4627 + resolution: {integrity: sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==}
4628 + engines: {node: '>=0.10.0'}
4629 +
4630 is-stream@2.0.1:
4631 resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==}
4632 engines: {node: '>=8'}
@@ -4537,6 +4639,10 @@ packages:
4639 resolution: {integrity: sha512-2AT6j+gXe/1ueqbW6fLZJiIw3F8iXGJtt0yDrZaBhAZEG1raiTxKWU+IPqMCzQAXOUCKdA4UDMgacKH25XG2Cw==}
4640 engines: {node: '>=4'}
4641
4642 + is-typed-array@1.1.15:
4643 + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==}
4644 + engines: {node: '>= 0.4'}
4645 +
4646 is-what@4.1.16:
4647 resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==}
4648 engines: {node: '>=12.13'}
@@ -4553,6 +4659,12 @@ packages:
4659 resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==}
4660 engines: {node: '>=16'}
4661
4662 + isarray@1.0.0:
4663 + resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==}
4664 +
4665 + isarray@2.0.5:
4666 + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==}
4667 +
4668 isexe@2.0.0:
4669 resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
4670
@@ -4774,6 +4886,10 @@ packages:
4886 magic-string@0.30.17:
4887 resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
4888
4889 + make-dir@1.3.0:
4890 + resolution: {integrity: sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==}
4891 + engines: {node: '>=4'}
4892 +
4893 markdown-it@14.1.0:
4894 resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==}
4895 hasBin: true
@@ -5165,6 +5281,9 @@ packages:
5281 resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==}
5282 engines: {node: '>= 14.16'}
5283
5284 + pend@1.2.0:
5285 + resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==}
5286 +
5287 pg-int8@1.0.1:
5288 resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
5289 engines: {node: '>=4.0.0'}
@@ -5196,10 +5315,22 @@ packages:
5315 resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==}
5316 engines: {node: '>=0.10.0'}
5317
5318 + pify@3.0.0:
5319 + resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==}
5320 + engines: {node: '>=4'}
5321 +
5322 pify@4.0.1:
5323 resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==}
5324 engines: {node: '>=6'}
5325
5326 + pinkie-promise@2.0.1:
5327 + resolution: {integrity: sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==}
5328 + engines: {node: '>=0.10.0'}
5329 +
5330 + pinkie@2.0.4:
5331 + resolution: {integrity: sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==}
5332 + engines: {node: '>=0.10.0'}
5333 +
5334 pino-abstract-transport@2.0.0:
5335 resolution: {integrity: sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==}
5336
@@ -5225,6 +5356,10 @@ packages:
5356 pkg-types@1.3.1:
5357 resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==}
5358
5359 + possible-typed-array-names@1.1.0:
5360 + resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==}
5361 + engines: {node: '>= 0.4'}
5362 +
5363 postcss-import@15.1.0:
5364 resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==}
5365 engines: {node: '>=14.0.0'}
@@ -5325,6 +5460,9 @@ packages:
5460 printable-characters@1.0.42:
5461 resolution: {integrity: sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==}
5462
5463 + process-nextick-args@2.0.1:
5464 + resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
5465 +
5466 process-warning@5.0.0:
5467 resolution: {integrity: sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==}
5468
@@ -5416,6 +5554,9 @@ packages:
5554 resolution: {integrity: sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA==}
5555 engines: {node: '>=6'}
5556
5557 + readable-stream@2.3.8:
5558 + resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==}
5559 +
5560 readable-stream@4.7.0:
5561 resolution: {integrity: sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==}
5562 engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -5502,6 +5643,9 @@ packages:
5643 rxjs@7.8.2:
5644 resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==}
5645
5646 + safe-buffer@5.1.2:
5647 + resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
5648 +
5649 safe-buffer@5.2.1:
5650 resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
5651
@@ -5522,6 +5666,10 @@ packages:
5666 secure-json-parse@2.7.0:
5667 resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==}
5668
5669 + seek-bzip@1.0.6:
5670 + resolution: {integrity: sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==}
5671 + hasBin: true
5672 +
5673 semver@7.7.2:
5674 resolution: {integrity: sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==}
5675 engines: {node: '>=10'}
@@ -5543,6 +5691,10 @@ packages:
5691 resolution: {integrity: sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==}
5692 engines: {node: '>= 18'}
5693
5694 + set-function-length@1.2.2:
5695 + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==}
5696 + engines: {node: '>= 0.4'}
5697 +
5698 setprototypeof@1.2.0:
5699 resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
5700
@@ -5679,6 +5831,9 @@ packages:
5831 resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==}
5832 engines: {node: '>=18'}
5833
5834 + string_decoder@1.1.1:
5835 + resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}
5836 +
5837 string_decoder@1.3.0:
5838 resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
5839
@@ -5698,6 +5853,9 @@ packages:
5853 resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==}
5854 engines: {node: '>=4'}
5855
5856 + strip-dirs@2.1.0:
5857 + resolution: {integrity: sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==}
5858 +
5859 strip-final-newline@3.0.0:
5860 resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==}
5861 engines: {node: '>=12'}
@@ -5756,6 +5914,10 @@ packages:
5914 engines: {node: '>=14.0.0'}
5915 hasBin: true
5916
5917 + tar-stream@1.6.2:
5918 + resolution: {integrity: sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==}
5919 + engines: {node: '>= 0.8.0'}
5920 +
5921 temp-dir@3.0.0:
5922 resolution: {integrity: sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==}
5923 engines: {node: '>=14.16'}
@@ -5782,6 +5944,9 @@ packages:
5944 resolution: {integrity: sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==}
5945 engines: {node: '>=18'}
5946
5947 + through@2.3.8:
5948 + resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
5949 +
5950 tinybench@2.9.0:
5951 resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}
5952
@@ -5808,6 +5973,10 @@ packages:
5973 resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
5974 engines: {node: '>=0.6.0'}
5975
5976 + to-buffer@1.2.1:
5977 + resolution: {integrity: sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ==}
5978 + engines: {node: '>= 0.4'}
5979 +
5980 to-regex-range@5.0.1:
5981 resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
5982 engines: {node: '>=8.0'}
@@ -5933,6 +6102,10 @@ packages:
6102 resolution: {integrity: sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==}
6103 engines: {node: '>= 0.6'}
6104
6105 + typed-array-buffer@1.0.3:
6106 + resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==}
6107 + engines: {node: '>= 0.4'}
6108 +
6109 typedoc-plugin-markdown@4.6.4:
6110 resolution: {integrity: sha512-AnbToFS1T1H+n40QbO2+i0wE6L+55rWnj7zxnM1r781+2gmhMF2dB6dzFpaylWLQYkbg4D1Y13sYnne/6qZwdw==}
6111 engines: {node: '>= 18'}
@@ -5969,6 +6142,9 @@ packages:
6142 ufo@1.6.1:
6143 resolution: {integrity: sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==}
6144
6145 + unbzip2-stream@1.4.3:
6146 + resolution: {integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==}
6147 +
6148 undici-types@5.26.5:
6149 resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
6150
@@ -6128,6 +6304,10 @@ packages:
6304 resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==}
6305 engines: {node: '>=4'}
6306
6307 + which-typed-array@1.1.19:
6308 + resolution: {integrity: sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==}
6309 + engines: {node: '>= 0.4'}
6310 +
6311 which@2.0.2:
6312 resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
6313 engines: {node: '>= 8'}
@@ -6232,6 +6412,9 @@ packages:
6412 resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
6413 engines: {node: '>=12'}
6414
6415 + yauzl@2.10.0:
6416 + resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==}
6417 +
6418 yocto-queue@0.1.0:
6419 resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
6420 engines: {node: '>=10'}
@@ -9205,6 +9388,10 @@ snapshots:
9388 dependencies:
9389 '@types/node': 20.19.1
9390
9391 + '@types/decompress@4.2.7':
9392 + dependencies:
9393 + '@types/node': 24.0.3
9394 +
9395 '@types/deep-eql@4.0.2': {}
9396
9397 '@types/diff-match-patch@1.0.36': {}
@@ -9232,7 +9419,7 @@ snapshots:
9419
9420 '@types/mute-stream@0.0.4':
9421 dependencies:
9235 - '@types/node': 20.19.1
9422 + '@types/node': 24.0.3
9423
9424 '@types/mysql@2.15.26':
9425 dependencies:
@@ -9408,14 +9595,6 @@ snapshots:
9595 chai: 5.2.0
9596 tinyrainbow: 2.0.0
9597
9411 - '@vitest/mocker@3.2.4(vite@6.3.5(@types/node@20.19.1)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))':
9412 - dependencies:
9413 - '@vitest/spy': 3.2.4
9414 - estree-walker: 3.0.3
9415 - magic-string: 0.30.17
9416 - optionalDependencies:
9417 - vite: 6.3.5(@types/node@20.19.1)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9418 -
9598 '@vitest/mocker@3.2.4(vite@6.3.5(@types/node@22.15.32)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))':
9599 dependencies:
9600 '@vitest/spy': 3.2.4
@@ -9424,14 +9603,6 @@ snapshots:
9603 optionalDependencies:
9604 vite: 6.3.5(@types/node@22.15.32)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9605
9427 - '@vitest/mocker@3.2.4(vite@6.3.5(@types/node@24.0.3)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))':
9428 - dependencies:
9429 - '@vitest/spy': 3.2.4
9430 - estree-walker: 3.0.3
9431 - magic-string: 0.30.17
9432 - optionalDependencies:
9433 - vite: 6.3.5(@types/node@24.0.3)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9434 -
9606 '@vitest/pretty-format@3.2.4':
9607 dependencies:
9608 tinyrainbow: 2.0.0
@@ -9461,7 +9632,7 @@ snapshots:
9632 sirv: 3.0.1
9633 tinyglobby: 0.2.14
9634 tinyrainbow: 2.0.0
9464 - vitest: 3.2.4(@types/node@24.0.3)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9635 + vitest: 3.2.4(@types/node@22.15.32)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9636
9637 '@vitest/utils@3.2.4':
9638 dependencies:
@@ -9577,6 +9748,10 @@ snapshots:
9748
9749 atomic-sleep@1.0.0: {}
9750
9751 + available-typed-arrays@1.0.7:
9752 + dependencies:
9753 + possible-typed-array-names: 1.1.0
9754 +
9755 axios@1.10.0:
9756 dependencies:
9757 follow-redirects: 1.15.9
@@ -9599,6 +9774,11 @@ snapshots:
9774
9775 birpc@0.2.14: {}
9776
9777 + bl@1.2.3:
9778 + dependencies:
9779 + readable-stream: 2.3.8
9780 + safe-buffer: 5.2.1
9781 +
9782 blake3-wasm@2.1.5: {}
9783
9784 body-parser@1.20.3:
@@ -9647,8 +9827,24 @@ snapshots:
9827 dependencies:
9828 fill-range: 7.1.1
9829
9830 + buffer-alloc-unsafe@1.1.0: {}
9831 +
9832 + buffer-alloc@1.2.0:
9833 + dependencies:
9834 + buffer-alloc-unsafe: 1.1.0
9835 + buffer-fill: 1.0.0
9836 +
9837 + buffer-crc32@0.2.13: {}
9838 +
9839 buffer-equal-constant-time@1.0.1: {}
9840
9841 + buffer-fill@1.0.0: {}
9842 +
9843 + buffer@5.7.1:
9844 + dependencies:
9845 + base64-js: 1.5.1
9846 + ieee754: 1.2.1
9847 +
9848 buffer@6.0.3:
9849 dependencies:
9850 base64-js: 1.5.1
@@ -9680,6 +9876,13 @@ snapshots:
9876 es-errors: 1.3.0
9877 function-bind: 1.1.2
9878
9879 + call-bind@1.0.8:
9880 + dependencies:
9881 + call-bind-apply-helpers: 1.0.2
9882 + es-define-property: 1.0.1
9883 + get-intrinsic: 1.3.0
9884 + set-function-length: 1.2.2
9885 +
9886 call-bound@1.0.4:
9887 dependencies:
9888 call-bind-apply-helpers: 1.0.2
@@ -9802,6 +10005,8 @@ snapshots:
10005
10006 commander@13.1.0: {}
10007
10008 + commander@2.20.3: {}
10009 +
10010 commander@4.1.1: {}
10011
10012 comment-json@4.2.5:
@@ -9913,6 +10118,44 @@ snapshots:
10118
10119 decamelize@1.2.0: {}
10120
10121 + decompress-tar@4.1.1:
10122 + dependencies:
10123 + file-type: 5.2.0
10124 + is-stream: 1.1.0
10125 + tar-stream: 1.6.2
10126 +
10127 + decompress-tarbz2@4.1.1:
10128 + dependencies:
10129 + decompress-tar: 4.1.1
10130 + file-type: 6.2.0
10131 + is-stream: 1.1.0
10132 + seek-bzip: 1.0.6
10133 + unbzip2-stream: 1.4.3
10134 +
10135 + decompress-targz@4.1.1:
10136 + dependencies:
10137 + decompress-tar: 4.1.1
10138 + file-type: 5.2.0
10139 + is-stream: 1.1.0
10140 +
10141 + decompress-unzip@4.0.1:
10142 + dependencies:
10143 + file-type: 3.9.0
10144 + get-stream: 2.3.1
10145 + pify: 2.3.0
10146 + yauzl: 2.10.0
10147 +
10148 + decompress@4.2.1:
10149 + dependencies:
10150 + decompress-tar: 4.1.1
10151 + decompress-tarbz2: 4.1.1
10152 + decompress-targz: 4.1.1
10153 + decompress-unzip: 4.0.1
10154 + graceful-fs: 4.2.11
10155 + make-dir: 1.3.0
10156 + pify: 2.3.0
10157 + strip-dirs: 2.1.0
10158 +
10159 deep-eql@5.0.2: {}
10160
10161 deep-is@0.1.4: {}
@@ -9924,6 +10167,12 @@ snapshots:
10167 bundle-name: 4.1.0
10168 default-browser-id: 5.0.0
10169
10170 + define-data-property@1.1.4:
10171 + dependencies:
10172 + es-define-property: 1.0.1
10173 + es-errors: 1.3.0
10174 + gopd: 1.2.0
10175 +
10176 define-lazy-prop@2.0.0: {}
10177
10178 define-lazy-prop@3.0.0: {}
@@ -10324,6 +10573,10 @@ snapshots:
10573 dependencies:
10574 reusify: 1.1.0
10575
10576 + fd-slicer@1.1.0:
10577 + dependencies:
10578 + pend: 1.2.0
10579 +
10580 fdir@6.4.6(picomatch@4.0.2):
10581 optionalDependencies:
10582 picomatch: 4.0.2
@@ -10336,6 +10589,12 @@ snapshots:
10589 dependencies:
10590 flat-cache: 4.0.1
10591
10592 + file-type@3.9.0: {}
10593 +
10594 + file-type@5.2.0: {}
10595 +
10596 + file-type@6.2.0: {}
10597 +
10598 fill-range@7.1.1:
10599 dependencies:
10600 to-regex-range: 5.0.1
@@ -10390,6 +10649,10 @@ snapshots:
10649
10650 follow-redirects@1.15.9: {}
10651
10652 + for-each@0.3.5:
10653 + dependencies:
10654 + is-callable: 1.2.7
10655 +
10656 foreground-child@3.3.1:
10657 dependencies:
10658 cross-spawn: 7.0.6
@@ -10422,6 +10685,8 @@ snapshots:
10685
10686 fresh@2.0.0: {}
10687
10688 + fs-constants@1.0.0: {}
10689 +
10690 fs-extra@7.0.1:
10691 dependencies:
10692 graceful-fs: 4.2.11
@@ -10486,6 +10751,11 @@ snapshots:
10751 data-uri-to-buffer: 2.0.2
10752 source-map: 0.6.1
10753
10754 + get-stream@2.3.1:
10755 + dependencies:
10756 + object-assign: 4.1.1
10757 + pinkie-promise: 2.0.1
10758 +
10759 get-stream@8.0.1: {}
10760
10761 get-tsconfig@4.10.1:
@@ -10563,6 +10833,10 @@ snapshots:
10833
10834 has-own-prop@2.0.0: {}
10835
10836 + has-property-descriptors@1.0.2:
10837 + dependencies:
10838 + es-define-property: 1.0.1
10839 +
10840 has-symbols@1.1.0: {}
10841
10842 has-tostringtag@1.0.2:
@@ -10664,6 +10938,8 @@ snapshots:
10938 dependencies:
10939 binary-extensions: 2.3.0
10940
10941 + is-callable@1.2.7: {}
10942 +
10943 is-core-module@2.16.1:
10944 dependencies:
10945 hasown: 2.0.2
@@ -10692,10 +10968,14 @@ snapshots:
10968 dependencies:
10969 is-docker: 3.0.0
10970
10971 + is-natural-number@4.0.1: {}
10972 +
10973 is-number@7.0.0: {}
10974
10975 is-promise@4.0.0: {}
10976
10977 + is-stream@1.1.0: {}
10978 +
10979 is-stream@2.0.1: {}
10980
10981 is-stream@3.0.0: {}
@@ -10704,6 +10984,10 @@ snapshots:
10984 dependencies:
10985 better-path-resolve: 1.0.0
10986
10987 + is-typed-array@1.1.15:
10988 + dependencies:
10989 + which-typed-array: 1.1.19
10990 +
10991 is-what@4.1.16: {}
10992
10993 is-windows@1.0.2: {}
@@ -10716,6 +11000,10 @@ snapshots:
11000 dependencies:
11001 is-inside-container: 1.0.0
11002
11003 + isarray@1.0.0: {}
11004 +
11005 + isarray@2.0.5: {}
11006 +
11007 isexe@2.0.0: {}
11008
11009 jackspeak@3.4.3:
@@ -10921,6 +11209,10 @@ snapshots:
11209 dependencies:
11210 '@jridgewell/sourcemap-codec': 1.5.0
11211
11212 + make-dir@1.3.0:
11213 + dependencies:
11214 + pify: 3.0.0
11215 +
11216 markdown-it@14.1.0:
11217 dependencies:
11218 argparse: 2.0.1
@@ -11277,6 +11569,8 @@ snapshots:
11569
11570 pathval@2.0.0: {}
11571
11572 + pend@1.2.0: {}
11573 +
11574 pg-int8@1.0.1: {}
11575
11576 pg-protocol@1.10.1: {}
@@ -11299,8 +11593,16 @@ snapshots:
11593
11594 pify@2.3.0: {}
11595
11596 + pify@3.0.0: {}
11597 +
11598 pify@4.0.1: {}
11599
11600 + pinkie-promise@2.0.1:
11601 + dependencies:
11602 + pinkie: 2.0.4
11603 +
11604 + pinkie@2.0.4: {}
11605 +
11606 pino-abstract-transport@2.0.0:
11607 dependencies:
11608 split2: 4.2.0
@@ -11347,6 +11649,8 @@ snapshots:
11649 mlly: 1.7.4
11650 pathe: 2.0.3
11651
11652 + possible-typed-array-names@1.1.0: {}
11653 +
11654 postcss-import@15.1.0(postcss@8.5.6):
11655 dependencies:
11656 postcss: 8.5.6
@@ -11421,6 +11725,8 @@ snapshots:
11725
11726 printable-characters@1.0.42: {}
11727
11728 + process-nextick-args@2.0.1: {}
11729 +
11730 process-warning@5.0.0: {}
11731
11732 process@0.11.10: {}
@@ -11522,6 +11828,16 @@ snapshots:
11828 pify: 4.0.1
11829 strip-bom: 3.0.0
11830
11831 + readable-stream@2.3.8:
11832 + dependencies:
11833 + core-util-is: 1.0.3
11834 + inherits: 2.0.4
11835 + isarray: 1.0.0
11836 + process-nextick-args: 2.0.1
11837 + safe-buffer: 5.1.2
11838 + string_decoder: 1.1.1
11839 + util-deprecate: 1.0.2
11840 +
11841 readable-stream@4.7.0:
11842 dependencies:
11843 abort-controller: 3.0.0
@@ -11625,6 +11941,8 @@ snapshots:
11941 dependencies:
11942 tslib: 2.8.1
11943
11944 + safe-buffer@5.1.2: {}
11945 +
11946 safe-buffer@5.2.1: {}
11947
11948 safe-stable-stringify@2.5.0: {}
@@ -11640,6 +11958,10 @@ snapshots:
11958
11959 secure-json-parse@2.7.0: {}
11960
11961 + seek-bzip@1.0.6:
11962 + dependencies:
11963 + commander: 2.20.3
11964 +
11965 semver@7.7.2: {}
11966
11967 send@0.19.0:
@@ -11694,6 +12016,15 @@ snapshots:
12016 transitivePeerDependencies:
12017 - supports-color
12018
12019 + set-function-length@1.2.2:
12020 + dependencies:
12021 + define-data-property: 1.1.4
12022 + es-errors: 1.3.0
12023 + function-bind: 1.1.2
12024 + get-intrinsic: 1.3.0
12025 + gopd: 1.2.0
12026 + has-property-descriptors: 1.0.2
12027 +
12028 setprototypeof@1.2.0: {}
12029
12030 sharp@0.33.5:
@@ -11875,6 +12206,10 @@ snapshots:
12206 get-east-asian-width: 1.3.0
12207 strip-ansi: 7.1.0
12208
12209 + string_decoder@1.1.1:
12210 + dependencies:
12211 + safe-buffer: 5.1.2
12212 +
12213 string_decoder@1.3.0:
12214 dependencies:
12215 safe-buffer: 5.2.1
@@ -11891,6 +12226,10 @@ snapshots:
12226
12227 strip-bom@3.0.0: {}
12228
12229 + strip-dirs@2.1.0:
12230 + dependencies:
12231 + is-natural-number: 4.0.1
12232 +
12233 strip-final-newline@3.0.0: {}
12234
12235 strip-json-comments@3.1.1: {}
@@ -11974,6 +12313,16 @@ snapshots:
12313 transitivePeerDependencies:
12314 - ts-node
12315
12316 + tar-stream@1.6.2:
12317 + dependencies:
12318 + bl: 1.2.3
12319 + buffer-alloc: 1.2.0
12320 + end-of-stream: 1.4.5
12321 + fs-constants: 1.0.0
12322 + readable-stream: 2.3.8
12323 + to-buffer: 1.2.1
12324 + xtend: 4.0.2
12325 +
12326 temp-dir@3.0.0: {}
12327
12328 tempy@3.1.0:
@@ -11999,6 +12348,8 @@ snapshots:
12348
12349 throttleit@2.1.0: {}
12350
12351 + through@2.3.8: {}
12352 +
12353 tinybench@2.9.0: {}
12354
12355 tinyexec@0.3.2: {}
@@ -12018,6 +12369,12 @@ snapshots:
12369 dependencies:
12370 os-tmpdir: 1.0.2
12371
12372 + to-buffer@1.2.1:
12373 + dependencies:
12374 + isarray: 2.0.5
12375 + safe-buffer: 5.2.1
12376 + typed-array-buffer: 1.0.3
12377 +
12378 to-regex-range@5.0.1:
12379 dependencies:
12380 is-number: 7.0.0
@@ -12131,6 +12488,12 @@ snapshots:
12488 media-typer: 1.1.0
12489 mime-types: 3.0.1
12490
12491 + typed-array-buffer@1.0.3:
12492 + dependencies:
12493 + call-bound: 1.0.4
12494 + es-errors: 1.3.0
12495 + is-typed-array: 1.1.15
12496 +
12497 typedoc-plugin-markdown@4.6.4(typedoc@0.28.5(typescript@5.8.3)):
12498 dependencies:
12499 typedoc: 0.28.5(typescript@5.8.3)
@@ -12164,6 +12527,11 @@ snapshots:
12527
12528 ufo@1.6.1: {}
12529
12530 + unbzip2-stream@1.4.3:
12531 + dependencies:
12532 + buffer: 5.7.1
12533 + through: 2.3.8
12534 +
12535 undici-types@5.26.5: {}
12536
12537 undici-types@6.21.0: {}
@@ -12326,7 +12694,7 @@ snapshots:
12694 dependencies:
12695 '@types/chai': 5.2.2
12696 '@vitest/expect': 3.2.4
12329 - '@vitest/mocker': 3.2.4(vite@6.3.5(@types/node@20.19.1)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
12697 + '@vitest/mocker': 3.2.4(vite@6.3.5(@types/node@22.15.32)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
12698 '@vitest/pretty-format': 3.2.4
12699 '@vitest/runner': 3.2.4
12700 '@vitest/snapshot': 3.2.4
@@ -12410,7 +12778,7 @@ snapshots:
12778 dependencies:
12779 '@types/chai': 5.2.2
12780 '@vitest/expect': 3.2.4
12413 - '@vitest/mocker': 3.2.4(vite@6.3.5(@types/node@24.0.3)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
12781 + '@vitest/mocker': 3.2.4(vite@6.3.5(@types/node@22.15.32)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
12782 '@vitest/pretty-format': 3.2.4
12783 '@vitest/runner': 3.2.4
12784 '@vitest/snapshot': 3.2.4
@@ -12467,6 +12835,16 @@ snapshots:
12835
12836 which-pm-runs@1.1.0: {}
12837
12838 + which-typed-array@1.1.19:
12839 + dependencies:
12840 + available-typed-arrays: 1.0.7
12841 + call-bind: 1.0.8
12842 + call-bound: 1.0.4
12843 + for-each: 0.3.5
12844 + get-proto: 1.0.1
12845 + gopd: 1.2.0
12846 + has-tostringtag: 1.0.2
12847 +
12848 which@2.0.2:
12849 dependencies:
12850 isexe: 2.0.0
@@ -12559,6 +12937,11 @@ snapshots:
12937 y18n: 5.0.8
12938 yargs-parser: 21.1.1
12939
12940 + yauzl@2.10.0:
12941 + dependencies:
12942 + buffer-crc32: 0.2.13
12943 + fd-slicer: 1.1.0
12944 +
12945 yocto-queue@0.1.0: {}
12946
12947 yoctocolors-cjs@2.1.2: {}
ts/packages/cli/.gitignore
+1
@@ -1,2 +1,3 @@
1 .generated/
2 composio
3 +.envrc
ts/packages/cli/README.md
+42 -15
@@ -30,26 +30,38 @@ composio [--log-level all|trace|debug|info|warning|error|fatal|none]
30 | `composio version` | Display the current CLI version. | ✅ |
31 | `composio whoami` | Show the currently logged-in user/account. | ✅ It displays the local API_KEY, or shows a message if no API_KEY is found. |
32 | `composio login` | Log in to the Composio SDK. | ⏰ The session client is defined, but the authentication workflow is currently incomplete |
33 +| `composio logout` | Log out from the Composio SDK. | ✅ |
34 | `composio generate [-o, --output-dir <directory>]` | Auto-detect the project language (Python or TypeScript) and generate the latest app type stubs. | ✅ |
35 | `composio py` | Python project-specific commands. |
36 | `composio py generate [-o, --output-dir <directory>]` | Generate updated Python stubs with the latest app data. | ✅ |
37 | `composio ts` | TypeScript project-specific commands. | ✅ |
38 | `composio ts generate [-o, --output-dir <directory>] [--single-file]` | Generate updated TypeScript stubs, optionally as a single file. | ✅ |
38 -| `composio upgrade` | Self-update the Composio CLI if a new release is out. | 🛑 Not implemented yet |
39 +| `composio upgrade` | Self-update the Composio CLI if a new release is out. | ✅ yet |
40
41 ## Configuration
42
42 -The Composio CLI supports configuration via environment variables and a JSON configuration file.
43 +The Composio CLI supports configuration via environment variables.
44 +Additionally, for storing and retrieving user session context, a `user_data.json` JSON configuration file is used.
45
44 -The Composio CLI also supports a JSON configuration file. The default location is `~/.composio/user_data.json`, but you can specify a custom location using the `COMPOSIO_CACHE_DIR` environment variable.
46 +By default, this file is stored in `~/.composio`, but you can specify a custom location using the `COMPOSIO_CACHE_DIR` environment variable.
47
46 -| Environment Variable | User JSON config | Description | Default |
47 -| ---------------------- | ---------------- | ------------------------------------------------------------------ | ------- |
48 -| COMPOSIO_API_KEY | `api_key` | Your Composio API key | None |
49 -| COMPOSIO_BASE_URL | `base_url` | The base URL of the Composio backend API | None |
50 -| COMPOSIO_CACHE_DIR | `cache_dir` | The directory where the Composio CLI stores cache files | None |
51 -| COMPOSIO_LOG_LEVEL | `log_level` | The log level for the Composio CLI | None |
52 -| DEBUG_OVERRIDE_VERSION | `version` | The version to use when upgrading the Composio CLI (for debugging) | None |
48 +| Environment Variable | User JSON config | Description | Default |
49 +| ---------------------- | ---------------- | ------------------------------------------------------------------ | ----------- |
50 +| COMPOSIO_API_KEY | `api_key` | Composio backend API key | None |
51 +| COMPOSIO_BASE_URL | `base_url` | The base URL of the Composio backend API | None |
52 +| COMPOSIO_CACHE_DIR | - | The directory where the Composio CLI stores cache files | ~/.composio |
53 +| COMPOSIO_LOG_LEVEL | - | The log level for the Composio CLI | None |
54 +| DEBUG_OVERRIDE_VERSION | - | The version to use when upgrading the Composio CLI (for debugging) | None |
55 +
56 +Additionally, `composio upgrade` supports the following environment variables:
57 +
58 +| Environment Variable | Description | Default |
59 +| ---------------------------- | ------------------------------------------------------------------------------------------------------ | ---------------------- |
60 +| COMPOSIO_GITHUB_API_BASE_URL | The base URL for the GitHub API | https://api.github.com |
61 +| COMPOSIO_GITHUB_OWNER | The owner of the Composio repository on GitHub | ComposioHQ |
62 +| COMPOSIO_GITHUB_REPO | The repository name for the Composio CLI | composio |
63 +| COMPOSIO_GITHUB_TAG | The tag to use when fetching the Composio CLI binary from Github | latest |
64 +| COMPOSIO_GITHUB_ACCESS_TOKEN | The access token for the GitHub API. Useful during development to avoid getting rate-limited by Github | None |
65
66 ## Development
67
@@ -62,13 +74,13 @@ pnpm install
74 ### Build TypeScript code
75
76 ```bash
65 -pnpm build
77 +bun run build
78 ```
79
80 ### Build self-contained executable
81
82 ```bash
71 -pnpm build:bin
83 +bun build:bin
84 ```
85
86 or
@@ -77,20 +89,35 @@ or
89 bun run ./scripts/build-binary.ts
90 ```
91
92 +### Install self-contained executable
93 +
94 +```bash
95 +bun install:bin
96 +```
97 +
98 +or
99 +
100 +```bash
101 +bun run ./scripts/install-binary.ts ./dist/composio
102 +```
103 +
104 +By default, the executable will be installed in `~/.composio/composio`.
105 +You can customize the installation directory by setting the `COMPOSIO_INSTALL_DIR` environment variable.
106 +
107 ### Run interactively
108
109 ```bash
83 -pnpm cli
110 +bun cli
111 ```
112
113 For instance, to generate type stubs for a TypeScript project, you can run:
114
115 ```bash
89 -pnpm cli ts generate
116 +bun cli ts generate
117 ```
118
119 ### Test
120
121 ```bash
95 -pnpm test
122 +bun run test
123 ```
ts/packages/cli/package.json
+3
@@ -25,6 +25,7 @@
25 "clean": "git clean -xdf node_modules",
26 "cli": "bun run src/bin.ts",
27 "build:bin": "bun run ./scripts/build-binary.ts",
28 + "install:bin": "bun run ./scripts/install-binary.ts ./dist/composio",
29 "build": "tsup",
30 "bin": "./dist/composio",
31 "test": "vitest run",
@@ -44,6 +45,7 @@
45 "@effect/platform": "^0.85.2",
46 "@effect/vitest": "^0.23.8",
47 "@types/bun": "^1.2.16",
48 + "@types/decompress": "^4.2.7",
49 "@types/semver": "^7.7.0",
50 "tempy": "^3.1.0",
51 "tsup": "^8.5.0",
@@ -59,6 +61,7 @@
61 "@effect/platform-bun": "^0.70.4",
62 "@effect/platform-node-shared": "^0.40.4",
63 "ansis": "^4.1.0",
64 + "decompress": "^4.2.1",
65 "effect": "^3.16.16",
66 "effect-errors": "^1.10.11",
67 "indent-string": "^5.0.0",
ts/packages/cli/scripts/build-binary.ts
+3
@@ -15,6 +15,9 @@ import { Command } from '@effect/platform';
15 import { BunContext, BunRuntime } from '@effect/platform-bun';
16 import type { Teardown } from '@effect/platform/Runtime';
17
18 +/**
19 + * Usage: `bun scripts/build-binary.ts`
20 + */
21 export function buildBinary() {
22 return Effect.gen(function* () {
23 const cwd = process.cwd();
ts/packages/cli/scripts/install-binary.ts new
+68
@@ -0,0 +1,68 @@
1 +import process from 'node:process';
2 +import {
3 + Cause,
4 + Config,
5 + ConfigProvider,
6 + Console,
7 + Effect,
8 + Exit,
9 + Logger,
10 + Layer,
11 + LogLevel,
12 +} from 'effect';
13 +import { BunContext, BunRuntime } from '@effect/platform-bun';
14 +import type { Teardown } from '@effect/platform/Runtime';
15 +import path from 'node:path';
16 +import os from 'node:os';
17 +import { $ } from 'bun';
18 +
19 +/**
20 + * Usage: `COMPOSIO_INSTALL_DIR=<INSTALL_DIR> bun scripts/build-binary.ts <BINARY_PATH>`
21 + */
22 +export function installBinary() {
23 + return Effect.gen(function* () {
24 + const binaryPath = process.argv[2];
25 +
26 + if (!binaryPath) {
27 + return yield* Effect.logError('Missing <BINARY_PATH> argument');
28 + }
29 +
30 + const defaultInstallDir = path.join(os.homedir(), '.composio');
31 + const installDir = yield* Config.string('COMPOSIO_INSTALL_DIR').pipe(
32 + Config.withDefault(defaultInstallDir)
33 + );
34 +
35 + yield* Effect.logDebug(`Installing binary in ${installDir}`);
36 +
37 + yield* Effect.tryPromise(() => $`cp ${binaryPath} ${installDir}/composio`.quiet());
38 +
39 + yield* Console.log('Binary successfully installed in', installDir);
40 + });
41 +}
42 +
43 +export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
44 + const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
45 + const errorCode = Number(process.exitCode ?? 1);
46 + onExit(shouldFail ? errorCode : 0);
47 +};
48 +
49 +const ConfigLive = Effect.gen(function* () {
50 + const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
51 + Config.withDefault(LogLevel.Info)
52 + );
53 +
54 + return Logger.minimumLogLevel(logLevel);
55 +}).pipe(Layer.unwrapEffect, Layer.merge(Layer.setConfigProvider(ConfigProvider.fromEnv())));
56 +
57 +if (require.main === module) {
58 + installBinary().pipe(
59 + Effect.provide(ConfigLive),
60 + Effect.provide(Logger.pretty),
61 + Effect.provide(BunContext.layer),
62 + Effect.scoped,
63 + Effect.map(() => ({ message: 'Binary installed successfully.' })),
64 + BunRuntime.runMain({
65 + teardown,
66 + })
67 + );
68 +}
ts/packages/cli/src/bin.ts
+35 -26
@@ -2,6 +2,7 @@ import process from 'node:process';
2 import { Cause, Effect, Exit, Layer, Logger } from 'effect';
3 import { prettyPrint } from 'effect-errors';
4 import { CliConfig } from '@effect/cli';
5 +import { FetchHttpClient } from '@effect/platform';
6 import { BunContext, BunRuntime, BunFileSystem } from '@effect/platform-bun';
7 import type { Teardown } from '@effect/platform/Runtime';
8 import { runWithConfig } from 'src/commands';
@@ -14,9 +15,10 @@ import {
15 } from 'src/services/composio-clients';
16 import { NodeOs } from 'src/services/node-os';
17 import { NodeProcess } from 'src/services/node-process';
17 -import { EnvLangDetector } from './services/env-lang-detector';
18 -import { JsPackageManagerDetector } from './services/js-package-manager-detector';
19 -import { ComposioUserContextLive as _ComposioUserContextLive } from './services/user-context';
18 +import { EnvLangDetector } from 'src/services/env-lang-detector';
19 +import { JsPackageManagerDetector } from 'src/services/js-package-manager-detector';
20 +import { ComposioUserContextLive as _ComposioUserContextLive } from 'src/services/user-context';
21 +import { UpgradeBinary } from 'src/services/upgrade-binary';
22
23 /**
24 * Concrete Effect layer compositions for the Composio CLI runtime.
@@ -51,9 +53,16 @@ export const ComposioToolkitsRepositoryLive = Layer.provide(
53 Layer.mergeAll(BunFileSystem.layer, NodeOs.Default, ConfigLive)
54 ) satisfies RequiredLayer;
55
56 +export const UpgradeBinaryLive = Layer.provide(
57 + UpgradeBinary.Default,
58 + Layer.mergeAll(BunFileSystem.layer, FetchHttpClient.layer)
59 +) satisfies RequiredLayer;
60 +
61 const layers = Layer.mergeAll(
62 CliConfigLive.pipe(Layer.provide(ConfigLive)),
63 + NodeOs.Default,
64 NodeProcess.Default,
65 + UpgradeBinaryLive,
66 ComposioUserContextLive,
67 ComposioSessionRepositoryLive,
68 ComposioToolkitsRepositoryLive,
@@ -70,31 +79,31 @@ export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: n
79 onExit(shouldFail ? errorCode : 0);
80 };
81
82 +const runWithArgs = Effect.flatMap(runWithConfig, run => run(process.argv)) satisfies Effect.Effect<
83 + void,
84 + unknown,
85 + unknown
86 +>;
87 +
88 /**
89 * CLI entrypoint, which:
90 * - runs the Effect runtime and sets up its runtime environment
91 * - collects and displays errors
92 */
78 -if (require.main === module) {
79 - const runWithArgs = Effect.flatMap(runWithConfig, run =>
80 - run(process.argv)
81 - ) satisfies Effect.Effect<void, unknown, unknown>;
82 -
83 - runWithArgs.pipe(
84 - Effect.provide(layers),
85 - Effect.withConfigProvider(extendConfigProvider(BaseConfigProviderLive)),
86 - Effect.provide(BunContext.layer),
87 - Effect.scoped,
88 - Effect.withSpan('composio-cli', {
89 - attributes: {
90 - name: constants.APP_NAME,
91 - filename: 'src/bin.ts',
92 - },
93 - }),
94 - Effect.sandbox,
95 - Effect.catchAll(e => Effect.fail(prettyPrint(e))),
96 - BunRuntime.runMain({
97 - teardown,
98 - })
99 - );
100 -}
93 +runWithArgs.pipe(
94 + Effect.provide(layers),
95 + Effect.withConfigProvider(extendConfigProvider(BaseConfigProviderLive)),
96 + Effect.provide(BunContext.layer),
97 + Effect.scoped,
98 + Effect.withSpan('composio-cli', {
99 + attributes: {
100 + name: constants.APP_NAME,
101 + filename: 'src/bin.ts',
102 + },
103 + }),
104 + Effect.sandbox,
105 + Effect.catchAll(e => Effect.fail(prettyPrint(e))),
106 + BunRuntime.runMain({
107 + teardown,
108 + })
109 +);
ts/packages/cli/src/commands/index.ts
+11 -1
@@ -4,6 +4,7 @@ import * as constants from 'src/constants';
4 import { $defaultCmd } from './$default.cmd';
5 import { getVersion } from 'src/effects/version';
6 import { versionCmd } from './version.cmd';
7 +import { upgradeCmd } from './upgrade.cmd';
8 import { whoamiCmd } from './whoami.cmd';
9 import { loginCmd } from './login.cmd';
10 import { logoutCmd } from './logout.cmd';
@@ -12,7 +13,16 @@ import { tsCmd } from './ts/ts.cmd';
13 import { generateCmd } from './generate.cmd';
14
15 const $cmd = $defaultCmd.pipe(
15 - Command.withSubcommands([versionCmd, whoamiCmd, loginCmd, logoutCmd, generateCmd, pyCmd, tsCmd])
16 + Command.withSubcommands([
17 + versionCmd,
18 + upgradeCmd,
19 + whoamiCmd,
20 + loginCmd,
21 + logoutCmd,
22 + generateCmd,
23 + pyCmd,
24 + tsCmd,
25 + ])
26 );
27
28 export const runWithConfig = Effect.gen(function* () {
ts/packages/cli/src/commands/upgrade.cmd.ts new
+18
@@ -0,0 +1,18 @@
1 +import { Command } from '@effect/cli';
2 +import { Effect } from 'effect';
3 +import { UpgradeBinary } from 'src/services/upgrade-binary';
4 +
5 +/**
6 + * CLI command to upgrade the CLI to the latest available version.
7 + *
8 + * @example
9 + * ```bash
10 + * composio upgrade
11 + * ```
12 + */
13 +export const upgradeCmd = Command.make('upgrade', {}, () =>
14 + Effect.gen(function* () {
15 + const upgradeBinary = yield* UpgradeBinary;
16 + yield* upgradeBinary.upgrade();
17 + })
18 +).pipe(Command.withDescription('Upgrade your Composio CLI to the latest available version.'));
ts/packages/cli/src/effects/compare-semver.ts new
+40
@@ -0,0 +1,40 @@
1 +import { Data, Effect } from 'effect';
2 +import semver from 'semver';
3 +
4 +export class CompareSemverError extends Data.TaggedError('services/CompareSemverError')<{
5 + readonly cause: Error;
6 + readonly message: string;
7 +}> {}
8 +
9 +/**
10 + * Compare semantic versions. Returns the same -1, 0, 1 number expected by Array.sort's comparator function.
11 + */
12 +export const semverComparator = (
13 + version1: string,
14 + version2: string
15 +): Effect.Effect<number, CompareSemverError, never> =>
16 + Effect.gen(function* () {
17 + // Remove 'v' or `cli@` prefix if present
18 + const v1 = version1.replace(/^(v|cli@)/, '');
19 + const v2 = version2.replace(/^(v|cli@)/, '');
20 +
21 + /**
22 + * Comparison result of `semver.compare(clean1, clean2)`.
23 + *
24 + * The return value is one of:
25 + * - `-1` if `clean1` is less than `clean2`
26 + * - `0` if `clean1` is equal to `clean2`
27 + * - `1` if `clean1` is greater than `clean2`
28 + */
29 + const comparison = yield* Effect.try({
30 + try: () => semver.compare(v1, v2),
31 + catch: error =>
32 + new CompareSemverError({
33 + cause: error as Error,
34 + message: `Failed to compare versions: ${version1} vs ${version2}`,
35 + }),
36 + });
37 + yield* Effect.logDebug(`Comparing versions: ${version1} vs ${version2} -> ${comparison}`);
38 +
39 + return comparison;
40 + });
ts/packages/cli/src/effects/detect-platform.ts new
+44
@@ -0,0 +1,44 @@
1 +import { Effect, Match, Data } from 'effect';
2 +import { NodeOs } from '../services/node-os';
3 +
4 +/**
5 + * Platform and architecture detection types
6 + */
7 +export type PlatformArch = {
8 + platform: 'darwin' | 'linux';
9 + arch: 'x64' | 'aarch64';
10 +};
11 +
12 +export class UnsupportedPlatformError extends Data.TaggedError('UnsupportedPlatformError')<{
13 + readonly platform: string;
14 + readonly arch: string;
15 +}> {}
16 +
17 +/**
18 + * Detect current platform and architecture
19 + */
20 +export const detectPlatform: Effect.Effect<PlatformArch, UnsupportedPlatformError, NodeOs> =
21 + Effect.gen(function* () {
22 + const nodeOs = yield* NodeOs;
23 + const rawPlatform = nodeOs.platform;
24 + const rawArch = nodeOs.arch;
25 +
26 + const platform: NodeJS.Platform = yield* Match.value(rawPlatform).pipe(
27 + Match.when('darwin', () => Effect.succeed('darwin' as const)),
28 + Match.when('linux', () => Effect.succeed('linux' as const)),
29 + Match.orElse(() =>
30 + Effect.fail(new UnsupportedPlatformError({ platform: rawPlatform, arch: rawArch }))
31 + )
32 + );
33 +
34 + const arch = yield* Match.value(rawArch).pipe(
35 + Match.when('x64', () => Effect.succeed('x64' as const)),
36 + Match.when('arm64', () => Effect.succeed('aarch64' as const)),
37 + Match.when('aarch64', () => Effect.succeed('aarch64' as const)),
38 + Match.orElse(() =>
39 + Effect.fail(new UnsupportedPlatformError({ platform: rawPlatform, arch: rawArch }))
40 + )
41 + );
42 +
43 + return { platform, arch };
44 + });
ts/packages/cli/src/effects/github-config.ts new
+31
@@ -0,0 +1,31 @@
1 +import { Config, Option } from 'effect';
2 +
3 +type GITHUB_CONFIG = Config.Config.Wrap<{
4 + API_BASE_URL: string;
5 + OWNER: string;
6 + REPO: string;
7 + TAG: Option.Option<string>;
8 + ACCESS_TOKEN: Option.Option<string>;
9 +}>;
10 +
11 +/**
12 + * Describe every Github configuration key used at runtime.
13 + */
14 +export const GITHUB_CONFIG = {
15 + // The base URL for the GitHub API
16 + API_BASE_URL: Config.string('GITHUB_API_BASE_URL').pipe(
17 + Config.withDefault('https://api.github.com')
18 + ),
19 +
20 + // The owner of the Composio repository on GitHub
21 + OWNER: Config.string('GITHUB_OWNER').pipe(Config.withDefault('ComposioHQ')),
22 +
23 + // The repository name for the Composio CLI
24 + REPO: Config.string('GITHUB_REPO').pipe(Config.withDefault('composio')),
25 +
26 + // The tag to use as the latest release
27 + TAG: Config.option(Config.string('GITHUB_TAG')),
28 +
29 + // The access token for the GitHub API. Only useful during development to avoid getting rate-limited by Github
30 + ACCESS_TOKEN: Config.option(Config.string('GITHUB_ACCESS_TOKEN')),
31 +} satisfies GITHUB_CONFIG;
ts/packages/cli/src/services/node-os.ts
+5
@@ -5,6 +5,11 @@ import { Effect } from 'effect';
5 export class NodeOs extends Effect.Service<NodeOs>()('services/NodeOs', {
6 sync: () => ({
7 homedir: os.homedir(),
8 + platform: os.platform(),
9 + arch: os.arch(),
10 }),
11 dependencies: [],
12 }) {}
13 +
14 +export const defaultNodeOs = ({ homedir }: { homedir: string }) =>
15 + new NodeOs({ homedir, platform: os.platform(), arch: os.arch() });
ts/packages/cli/src/services/upgrade-binary.ts new
+363
@@ -0,0 +1,363 @@
1 +import { Data, Effect, Console, Config, Option } from 'effect';
2 +import { HttpClient, FileSystem } from '@effect/platform';
3 +import * as path from 'node:path';
4 +import { APP_VERSION } from '../constants';
5 +import { DEBUG_OVERRIDE_CONFIG } from 'src/effects/debug-config';
6 +import { GITHUB_CONFIG } from 'src/effects/github-config';
7 +import { detectPlatform, type PlatformArch } from 'src/effects/detect-platform';
8 +import { CompareSemverError, semverComparator } from 'src/effects/compare-semver';
9 +
10 +// Note: `node:zlib` does not support Github's zip files
11 +import decompress from 'decompress';
12 +import type { Predicate } from 'effect/Predicate';
13 +
14 +export class UpgradeBinaryError extends Data.TaggedError('services/UpgradeBinaryError')<{
15 + readonly cause: Error;
16 + readonly message: string;
17 +}> {}
18 +
19 +/**
20 + * CLI binary name constant
21 + */
22 +export const CLI_BINARY_NAME = 'composio';
23 +
24 +type GitHubRelease = {
25 + tag_name: string;
26 + assets: Array<{
27 + name: string;
28 + browser_download_url: string;
29 + }>;
30 +};
31 +
32 +// Service to manage CLI binary upgrades
33 +export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/UpgradeBinary', {
34 + accessors: true,
35 + // eslint-disable-next-line max-lines-per-function
36 + effect: Effect.gen(function* () {
37 + const httpClient = yield* HttpClient.HttpClient;
38 + const fs = yield* FileSystem.FileSystem;
39 + const githubConfig = yield* Config.all(GITHUB_CONFIG);
40 +
41 + /**
42 + * Fetch latest release from GitHub
43 + */
44 + const fetchLatestRelease = (): Effect.Effect<GitHubRelease, UpgradeBinaryError, never> =>
45 + Effect.gen(function* () {
46 + const urlSuffix = yield* githubConfig.TAG.pipe(
47 + Option.match({
48 + onNone: Effect.fn(function* () {
49 + yield* Effect.logDebug('No tag specified, using latest release');
50 + return 'latest';
51 + }),
52 + onSome: Effect.fn(function* (tag) {
53 + yield* Effect.logDebug(`Using tag: ${tag}`);
54 + return `tags/${tag}`;
55 + }),
56 + })
57 + );
58 +
59 + const url = `${githubConfig.API_BASE_URL}/repos/${githubConfig.OWNER}/${githubConfig.REPO}/releases/${urlSuffix}`;
60 + yield* Effect.logDebug(`GET ${url}`);
61 +
62 + const response = yield* Effect.gen(function* () {
63 + const resp = yield* httpClient.get(url);
64 + if (resp.status < 200 || resp.status >= 300) {
65 + return yield* Effect.fail(
66 + new UpgradeBinaryError({
67 + cause: new Error(`HTTP ${resp.status}`),
68 + message: `Failed to fetch ${urlSuffix} release from GitHub`,
69 + })
70 + );
71 + }
72 + return resp;
73 + }).pipe(
74 + Effect.catchAll(error =>
75 + Effect.fail(
76 + new UpgradeBinaryError({
77 + cause: new Error(String(error)),
78 + message: `Failed to fetch ${urlSuffix} release from GitHub`,
79 + })
80 + )
81 + )
82 + );
83 +
84 + const release = yield* Effect.gen(function* () {
85 + return yield* response.json;
86 + }).pipe(
87 + Effect.catchAll(error =>
88 + Effect.fail(
89 + new UpgradeBinaryError({
90 + cause: error as Error,
91 + message: 'Failed to parse GitHub release JSON response',
92 + })
93 + )
94 + )
95 + );
96 +
97 + return release as GitHubRelease;
98 + });
99 +
100 + /**
101 + * Check if update is available
102 + */
103 + const isUpdateAvailable = (
104 + release: GitHubRelease
105 + ): Effect.Effect<boolean, CompareSemverError | UpgradeBinaryError, never> =>
106 + Effect.gen(function* () {
107 + // Current version is older than latest
108 + const isVersionOutdated: Predicate<number> = comparison => comparison < 0;
109 + const comparison = yield* semverComparator(APP_VERSION, release.tag_name);
110 + return isVersionOutdated(comparison);
111 + });
112 +
113 + /**
114 + * Download binary for current platform
115 + */
116 + const downloadBinary = (
117 + release: GitHubRelease,
118 + platformArch: PlatformArch
119 + ): Effect.Effect<{ name: string; data: Uint8Array }, UpgradeBinaryError, never> =>
120 + Effect.gen(function* () {
121 + yield* Effect.logDebug(
122 + `Looking up binary for ${platformArch.platform}-${platformArch.arch}`
123 + );
124 +
125 + const binaryName = `${CLI_BINARY_NAME}-${platformArch.platform}-${platformArch.arch}.zip`;
126 +
127 + const asset = release.assets.find(asset => asset.name === binaryName);
128 + if (!asset) {
129 + return yield* Effect.fail(
130 + new UpgradeBinaryError({
131 + cause: new Error(`Binary not found: ${binaryName}`),
132 + message: `No binary available for ${platformArch.platform}-${platformArch.arch}`,
133 + })
134 + );
135 + }
136 +
137 + yield* Console.log(`Downloading ${asset.name}...`);
138 +
139 + const response = yield* Effect.gen(function* () {
140 + const resp = yield* httpClient.get(asset.browser_download_url);
141 + if (resp.status < 200 || resp.status >= 300) {
142 + return yield* Effect.fail(
143 + new UpgradeBinaryError({
144 + cause: new Error(`HTTP ${resp.status}`),
145 + message: `Failed to download binary: ${asset.name}`,
146 + })
147 + );
148 + }
149 + return resp;
150 + }).pipe(
151 + Effect.catchAll(error =>
152 + Effect.fail(
153 + new UpgradeBinaryError({
154 + cause: new Error(String(error)),
155 + message: `Failed to download binary: ${asset.name}`,
156 + })
157 + )
158 + )
159 + );
160 +
161 + const arrayBuffer = yield* Effect.gen(function* () {
162 + return yield* response.arrayBuffer;
163 + }).pipe(
164 + Effect.catchAll(error =>
165 + Effect.fail(
166 + new UpgradeBinaryError({
167 + cause: error as Error,
168 + message: 'Failed to read downloaded binary',
169 + })
170 + )
171 + )
172 + );
173 +
174 + return {
175 + name: binaryName,
176 + data: new Uint8Array(arrayBuffer),
177 + };
178 + });
179 +
180 + /**
181 + * Extract binary from zip archive using FileSystem
182 + */
183 + const extractBinary = (
184 + { name, data }: { name: string; data: Uint8Array },
185 + tempDir: string
186 + ): Effect.Effect<string, UpgradeBinaryError, never> =>
187 + Effect.gen(function* () {
188 + const zipPath = path.join(tempDir, name);
189 + const extractDir = path.join(tempDir, 'extract');
190 + const binaryPath = path.join(extractDir, path.parse(name).name, CLI_BINARY_NAME);
191 +
192 + yield* Effect.logDebug(`Download zip to ${extractDir}`);
193 +
194 + // Write zip file
195 + yield* fs.writeFile(zipPath, data).pipe(
196 + Effect.catchAll(error =>
197 + Effect.fail(
198 + new UpgradeBinaryError({
199 + cause: error as Error,
200 + message: 'Failed to write zip file',
201 + })
202 + )
203 + )
204 + );
205 +
206 + // Create extract directory
207 + yield* fs.makeDirectory(extractDir, { recursive: true }).pipe(
208 + Effect.catchAll(error =>
209 + Effect.fail(
210 + new UpgradeBinaryError({
211 + cause: error as Error,
212 + message: 'Failed to create extract directory',
213 + })
214 + )
215 + )
216 + );
217 +
218 + yield* Effect.tryPromise({
219 + try: async () => {
220 + await decompress(zipPath, extractDir);
221 + },
222 + catch: error =>
223 + new UpgradeBinaryError({
224 + cause: error as Error,
225 + message: 'Failed to extract zip archive',
226 + }),
227 + });
228 +
229 + // Check if binary exists
230 + const exists = yield* fs
231 + .exists(binaryPath)
232 + .pipe(Effect.catchAll(() => Effect.succeed(false)));
233 +
234 + if (!exists) {
235 + return yield* Effect.fail(
236 + new UpgradeBinaryError({
237 + cause: new Error(`Binary not found in archive: ${binaryPath}`),
238 + message: 'Extracted archive does not contain expected binary',
239 + })
240 + );
241 + }
242 +
243 + // Make executable
244 + yield* fs.chmod(binaryPath, 0o755).pipe(
245 + Effect.catchAll(error =>
246 + Effect.fail(
247 + new UpgradeBinaryError({
248 + cause: error as Error,
249 + message: 'Failed to make binary executable',
250 + })
251 + )
252 + )
253 + );
254 +
255 + return binaryPath;
256 + });
257 +
258 + /**
259 + * Get current executable path
260 + */
261 + const getCurrentExecutablePath = Effect.fn(function* () {
262 + // E.g., ~/.composio/composio
263 + const currentPath = process.execPath;
264 +
265 + const runtimesPaths = [Bun.which('bun'), Bun.which('node')] as Array<string | null>;
266 +
267 + if (runtimesPaths.includes(currentPath)) {
268 + return yield* Effect.fail(
269 + new UpgradeBinaryError({
270 + cause: new Error(`Currently using Composio CLI via Bun or Node.js runtime`),
271 + message:
272 + 'Cannot upgrade runtime binary. Please run the upgrade command from a self-contained Composio CLI binary.',
273 + })
274 + );
275 + }
276 +
277 + return currentPath;
278 + });
279 +
280 + /**
281 + * Replace current executable binary with the new target one.
282 + */
283 + const replaceBinary = (
284 + sourcePath: string,
285 + targetPath: string
286 + ): Effect.Effect<void, UpgradeBinaryError> =>
287 + Effect.gen(function* () {
288 + yield* Effect.logDebug(`Replacing binary: ${sourcePath} -> ${targetPath}`);
289 + yield* fs
290 + .copy(sourcePath, targetPath, {
291 + // Note: without `overwrite: true`, the copy operation will silently bail out
292 + overwrite: true,
293 + })
294 + .pipe(
295 + Effect.catchAll(error =>
296 + Effect.fail(
297 + new UpgradeBinaryError({
298 + cause: error as Error,
299 + message: 'Failed to replace binary',
300 + })
301 + )
302 + )
303 + );
304 + });
305 +
306 + /**
307 + * Main upgrade function
308 + */
309 + const upgrade = () =>
310 + Effect.gen(function* () {
311 + const upgradeTargetOpt = yield* DEBUG_OVERRIDE_CONFIG['UPGRADE_TARGET'];
312 + const currentPath = yield* getCurrentExecutablePath();
313 + yield* Effect.logDebug(`Current executable path: ${currentPath}`);
314 +
315 + // If local binary path is provided (for testing), use it directly
316 + if (Option.isSome(upgradeTargetOpt)) {
317 + yield* Console.log(`📦 New local version available (current: ${APP_VERSION})`);
318 + yield* replaceBinary(upgradeTargetOpt.value, currentPath);
319 + return;
320 + }
321 +
322 + yield* Console.log('Checking for updates...');
323 +
324 + const release = yield* fetchLatestRelease();
325 + const updateAvailable = yield* isUpdateAvailable(release);
326 + if (!updateAvailable) {
327 + yield* Console.log('✅ You are already running the latest version!');
328 + return;
329 + }
330 +
331 + yield* Console.log(
332 + `📦 New version available: ${release.tag_name} (current: ${APP_VERSION})`
333 + );
334 +
335 + const platformArch = yield* detectPlatform;
336 + const { name, data } = yield* downloadBinary(release, platformArch);
337 +
338 + // The temporary directory is automatically cleaned up
339 + const tmpDir = yield* fs
340 + .makeTempDirectoryScoped({ prefix: `${CLI_BINARY_NAME}-upgrade}` })
341 + .pipe(
342 + Effect.catchAll(error =>
343 + Effect.fail(
344 + new UpgradeBinaryError({
345 + cause: error as Error,
346 + message: 'Failed to create temporary directory',
347 + })
348 + )
349 + )
350 + );
351 +
352 + const extractedBinaryPath = yield* extractBinary({ name, data }, tmpDir);
353 + yield* replaceBinary(extractedBinaryPath, currentPath);
354 +
355 + yield* Console.log(`🎉 Upgrade completed! Restart your terminal to use the new version.`);
356 + });
357 +
358 + return {
359 + upgrade,
360 + } as const;
361 + }),
362 + dependencies: [],
363 +}) {}
ts/packages/cli/test/__fixtures__/typescript-project-with-composio-core/pnpm-lock.yaml
+5 -5
@@ -5,7 +5,6 @@ settings:
5 excludeLinksFromLockfile: false
6
7 importers:
8 -
8 .:
9 dependencies:
10 '@composio/core':
@@ -17,12 +16,13 @@ importers:
16 version: 5.8.3
17
18 packages:
20 -
19 typescript@5.8.3:
22 - resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==}
23 - engines: {node: '>=14.17'}
20 + resolution:
21 + {
22 + integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==,
23 + }
24 + engines: { node: '>=14.17' }
25 hasBin: true
26
27 snapshots:
27 -
28 typescript@5.8.3: {}
ts/packages/cli/test/__utils__/services/test-layer.ts
+14 -3
@@ -1,7 +1,7 @@
1 import path from 'node:path';
2 import * as tempy from 'tempy';
3 -import { CliApp } from '@effect/cli';
4 -import { FileSystem } from '@effect/platform';
3 +import { CliApp, CliConfig } from '@effect/cli';
4 +import { FetchHttpClient, FileSystem } from '@effect/platform';
5 import { BunFileSystem, BunContext, BunPath } from '@effect/platform-bun';
6 import {
7 ConfigProvider,
@@ -13,7 +13,7 @@ import {
13 LogLevel,
14 Schedule,
15 } from 'effect';
16 -import { CliConfigLive } from 'src/bin';
16 +import { ComposioCliConfig } from 'src/cli-config';
17 import * as MockConsole from './mock-console';
18 import * as MockTerminal from './mock-terminal';
19 import type { Toolkits } from 'src/models/toolkits';
@@ -27,6 +27,7 @@ import { JsPackageManagerDetector } from 'src/services/js-package-manager-detect
27 import type { Tools } from 'src/models/tools';
28 import type { TriggerTypes } from 'src/models/trigger-types';
29 import { ComposioUserContextLive } from 'src/services/user-context';
30 +import { UpgradeBinary } from 'src/services/upgrade-binary';
31 import { NodeOs } from 'src/services/node-os';
32
33 interface TestLiveInput {
@@ -99,6 +100,8 @@ export const TestLayer = (input?: TestLiveInput) =>
100 NodeOs,
101 new NodeOs({
102 homedir: cwd,
103 + arch: 'arm64',
104 + platform: 'darwin',
105 })
106 );
107
@@ -117,12 +120,20 @@ export const TestLayer = (input?: TestLiveInput) =>
120 Layer.merge(BunFileSystem.layer, NodeOsTest)
121 );
122
123 + const UpgradeBinaryTest = Layer.provide(
124 + UpgradeBinary.Default,
125 + Layer.mergeAll(BunFileSystem.layer, FetchHttpClient.layer)
126 + );
127 +
128 + const CliConfigLive = CliConfig.layer(ComposioCliConfig);
129 +
130 const _console = yield* MockConsole.effect;
131
132 const layers = Layer.mergeAll(
133 Console.setConsole(_console),
134 CliConfigLive,
135 NodeProcessTest,
136 + UpgradeBinaryTest,
137 ComposioUserContextTest,
138 ComposioSessionRepositoryTest,
139 ComposioToolkitsRepositoryTest,
ts/packages/cli/test/src/commands/$default.cmd.test.ts
+2
@@ -60,6 +60,8 @@ describe('CLI: composio', () => {
60
61 - version Display your account information.
62
63 + - upgrade Upgrade your Composio CLI to the latest available version.
64 +
65 - whoami Display your account information.
66
67 - login [--no-browser] Log in to the Composio SDK.
ts/packages/cli/test/src/effects/compare-semver.test.ts new
+368
@@ -0,0 +1,368 @@
1 +import { describe, expect, it } from '@effect/vitest';
2 +import { Effect } from 'effect';
3 +import { CompareSemverError, semverComparator } from 'src/effects/compare-semver';
4 +
5 +describe('compare-semver.ts', () => {
6 + describe('semverComparator', () => {
7 + describe('Basic Comparisons', () => {
8 + it.effect('should return -1 when first version is older', () =>
9 + Effect.gen(function* () {
10 + const result = yield* semverComparator('1.0.0', '2.0.0');
11 + expect(result).toBe(-1);
12 + })
13 + );
14 +
15 + it.effect('should return 1 when first version is newer', () =>
16 + Effect.gen(function* () {
17 + const result = yield* semverComparator('2.0.0', '1.0.0');
18 + expect(result).toBe(1);
19 + })
20 + );
21 +
22 + it.effect('should return 0 when versions are equal', () =>
23 + Effect.gen(function* () {
24 + const result = yield* semverComparator('1.0.0', '1.0.0');
25 + expect(result).toBe(0);
26 + })
27 + );
28 + });
29 +
30 + describe('Version Prefix Handling', () => {
31 + it.effect('should handle v prefix on first version', () =>
32 + Effect.gen(function* () {
33 + const result = yield* semverComparator('v1.0.0', '2.0.0');
34 + expect(result).toBe(-1);
35 + })
36 + );
37 +
38 + it.effect('should handle v prefix on second version', () =>
39 + Effect.gen(function* () {
40 + const result = yield* semverComparator('1.0.0', 'v2.0.0');
41 + expect(result).toBe(-1);
42 + })
43 + );
44 +
45 + it.effect('should handle v prefix on both versions', () =>
46 + Effect.gen(function* () {
47 + const result = yield* semverComparator('v1.0.0', 'v2.0.0');
48 + expect(result).toBe(-1);
49 + })
50 + );
51 +
52 + it.effect('should handle mixed v prefix scenarios', () =>
53 + Effect.gen(function* () {
54 + const result = yield* semverComparator('v2.0.0', '1.0.0');
55 + expect(result).toBe(1);
56 + })
57 + );
58 +
59 + it.effect('should handle equal versions with and without v prefix', () =>
60 + Effect.gen(function* () {
61 + const result = yield* semverComparator('v1.0.0', '1.0.0');
62 + expect(result).toBe(0);
63 + })
64 + );
65 + });
66 +
67 + describe('Cli Prefix Handling', () => {
68 + it.effect('should handle cli@ prefix on first version', () =>
69 + Effect.gen(function* () {
70 + const result = yield* semverComparator('cli@1.0.0', '2.0.0');
71 + expect(result).toBe(-1);
72 + })
73 + );
74 +
75 + it.effect('should handle cli@ prefix on second version', () =>
76 + Effect.gen(function* () {
77 + const result = yield* semverComparator('1.0.0', 'cli@2.0.0');
78 + expect(result).toBe(-1);
79 + })
80 + );
81 +
82 + it.effect('should handle cli@ prefix on both versions', () =>
83 + Effect.gen(function* () {
84 + const result = yield* semverComparator('cli@1.0.0', 'cli@2.0.0');
85 + expect(result).toBe(-1);
86 + })
87 + );
88 +
89 + it.effect('should handle mixed cli@ prefix scenarios', () =>
90 + Effect.gen(function* () {
91 + const result = yield* semverComparator('cli@2.0.0', '1.0.0');
92 + expect(result).toBe(1);
93 + })
94 + );
95 +
96 + it.effect('should handle equal versions with and without cli@ prefix', () =>
97 + Effect.gen(function* () {
98 + const result = yield* semverComparator('cli@1.0.0', '1.0.0');
99 + expect(result).toBe(0);
100 + })
101 + );
102 + });
103 +
104 + describe('Semantic Version Components', () => {
105 + it.effect('should compare major versions correctly', () =>
106 + Effect.gen(function* () {
107 + const result = yield* semverComparator('2.0.0', '1.9.9');
108 + expect(result).toBe(1);
109 + })
110 + );
111 +
112 + it.effect('should compare minor versions correctly', () =>
113 + Effect.gen(function* () {
114 + const result = yield* semverComparator('1.2.0', '1.1.9');
115 + expect(result).toBe(1);
116 + })
117 + );
118 +
119 + it.effect('should compare patch versions correctly', () =>
120 + Effect.gen(function* () {
121 + const result = yield* semverComparator('1.0.2', '1.0.1');
122 + expect(result).toBe(1);
123 + })
124 + );
125 + });
126 +
127 + describe('Pre-release Versions', () => {
128 + it.effect('should handle alpha versions', () =>
129 + Effect.gen(function* () {
130 + const result = yield* semverComparator('1.0.0-alpha.1', '1.0.0-alpha.2');
131 + expect(result).toBe(-1);
132 + })
133 + );
134 +
135 + it.effect('should handle beta versions', () =>
136 + Effect.gen(function* () {
137 + const result = yield* semverComparator('1.0.0-beta.2', '1.0.0-beta.1');
138 + expect(result).toBe(1);
139 + })
140 + );
141 +
142 + it.effect('should handle rc versions', () =>
143 + Effect.gen(function* () {
144 + const result = yield* semverComparator('1.0.0-rc.1', '1.0.0-rc.1');
145 + expect(result).toBe(0);
146 + })
147 + );
148 +
149 + it.effect('should prioritize release over pre-release', () =>
150 + Effect.gen(function* () {
151 + const result = yield* semverComparator('1.0.0', '1.0.0-alpha.1');
152 + expect(result).toBe(1);
153 + })
154 + );
155 +
156 + it.effect('should compare pre-release identifiers', () =>
157 + Effect.gen(function* () {
158 + const result = yield* semverComparator('1.0.0-alpha', '1.0.0-beta');
159 + expect(result).toBe(-1);
160 + })
161 + );
162 + });
163 +
164 + describe('Build Metadata', () => {
165 + it.effect('should ignore build metadata in comparison', () =>
166 + Effect.gen(function* () {
167 + const result = yield* semverComparator('1.0.0+build.1', '1.0.0+build.2');
168 + expect(result).toBe(0);
169 + })
170 + );
171 +
172 + it.effect('should compare versions with build metadata correctly', () =>
173 + Effect.gen(function* () {
174 + const result = yield* semverComparator('1.0.1+build.1', '1.0.0+build.2');
175 + expect(result).toBe(1);
176 + })
177 + );
178 +
179 + it.effect('should handle pre-release with build metadata', () =>
180 + Effect.gen(function* () {
181 + const result = yield* semverComparator('1.0.0-alpha.1+build.1', '1.0.0-alpha.2+build.2');
182 + expect(result).toBe(-1);
183 + })
184 + );
185 + });
186 +
187 + describe('Complex Version Scenarios', () => {
188 + it.effect('should handle multi-digit versions', () =>
189 + Effect.gen(function* () {
190 + const result = yield* semverComparator('10.15.20', '9.99.99');
191 + expect(result).toBe(1);
192 + })
193 + );
194 +
195 + it.effect('should accept zero-padded components', () =>
196 + Effect.gen(function* () {
197 + const result = yield* Effect.flip(semverComparator('1.01.0', '1.1.0'));
198 + expect(result).toBeInstanceOf(CompareSemverError);
199 + expect((result as CompareSemverError).message).toContain('Failed to compare versions');
200 + })
201 + );
202 +
203 + it.effect('should handle long pre-release identifiers', () =>
204 + Effect.gen(function* () {
205 + const result = yield* semverComparator(
206 + '1.0.0-alpha.very.long.identifier',
207 + '1.0.0-alpha.very.long.identifier.2'
208 + );
209 + expect(result).toBe(-1);
210 + })
211 + );
212 + });
213 +
214 + describe('Edge Cases', () => {
215 + it.effect('should handle identical versions', () =>
216 + Effect.gen(function* () {
217 + const result = yield* semverComparator('1.2.3', '1.2.3');
218 + expect(result).toBe(0);
219 + })
220 + );
221 +
222 + it.effect('should reject versions with leading zeros', () =>
223 + Effect.gen(function* () {
224 + // The semver library considers leading zeros as invalid
225 + const result = yield* Effect.flip(semverComparator('01.02.03', '1.2.3'));
226 + expect(result).toBeInstanceOf(CompareSemverError);
227 + expect(result.message).toContain('Failed to compare versions: 01.02.03 vs 1.2.3');
228 + expect(result.cause.message).toContain('Invalid Version: 01.02.03');
229 + })
230 + );
231 +
232 + it.effect('should handle minimal versions', () =>
233 + Effect.gen(function* () {
234 + const result = yield* semverComparator('0.0.1', '0.0.0');
235 + expect(result).toBe(1);
236 + })
237 + );
238 +
239 + it.effect('should handle large version numbers', () =>
240 + Effect.gen(function* () {
241 + const result = yield* semverComparator('999.999.999', '1000.0.0');
242 + expect(result).toBe(-1);
243 + })
244 + );
245 + });
246 +
247 + describe('Real-world Version Examples', () => {
248 + it.effect('should compare Node.js-style versions', () =>
249 + Effect.gen(function* () {
250 + const result = yield* semverComparator('v18.16.0', 'v20.0.0');
251 + expect(result).toBe(-1);
252 + })
253 + );
254 +
255 + it.effect('should compare npm package versions', () =>
256 + Effect.gen(function* () {
257 + const result = yield* semverComparator('3.2.1', '3.10.0');
258 + expect(result).toBe(-1);
259 + })
260 + );
261 +
262 + it.effect('should compare development versions', () =>
263 + Effect.gen(function* () {
264 + const result = yield* semverComparator('2.0.0-dev.20240101', '2.0.0-dev.20240102');
265 + expect(result).toBe(-1);
266 + })
267 + );
268 + });
269 +
270 + describe('Array.sort Compatibility', () => {
271 + it.effect('should work as Array.sort comparator for ascending order', () =>
272 + Effect.gen(function* () {
273 + const versions = ['2.0.0', '1.0.0', '3.0.0'];
274 + const comparisons: Array<{ versions: [string, string]; result: number }> = [];
275 +
276 + // Simulate Array.sort behavior
277 + for (let i = 0; i < versions.length - 1; i++) {
278 + for (let j = i + 1; j < versions.length; j++) {
279 + const result = yield* semverComparator(versions[i], versions[j]);
280 + comparisons.push({ versions: [versions[i], versions[j]], result });
281 + }
282 + }
283 +
284 + // Verify that the comparator would sort correctly
285 + const expectedOrder = ['1.0.0', '2.0.0', '3.0.0'];
286 + const actualResult = [...versions].sort((a, b) => {
287 + // Find the comparison result from our Effect calls
288 + const comparison = comparisons.find(
289 + c =>
290 + (c.versions[0] === a && c.versions[1] === b) ||
291 + (c.versions[0] === b && c.versions[1] === a)
292 + );
293 + if (!comparison) return 0;
294 + return comparison.versions[0] === a ? comparison.result : -comparison.result;
295 + });
296 +
297 + // Since we can't actually use the Effect in Array.sort, just verify
298 + // the comparison results are consistent with sort expectations
299 + expect(comparisons.length).toBe(3); // 3 comparisons for 3 elements
300 + })
301 + );
302 + });
303 +
304 + describe('Consistent Comparison Results', () => {
305 + it.effect('should be reflexive (a == a)', () =>
306 + Effect.gen(function* () {
307 + const result = yield* semverComparator('1.5.0', '1.5.0');
308 + expect(result).toBe(0);
309 + })
310 + );
311 +
312 + it.effect('should be antisymmetric (if a > b then b < a)', () =>
313 + Effect.gen(function* () {
314 + const result1 = yield* semverComparator('2.0.0', '1.0.0');
315 + const result2 = yield* semverComparator('1.0.0', '2.0.0');
316 +
317 + expect(result1).toBe(1);
318 + expect(result2).toBe(-1);
319 + expect(result1).toBe(-result2);
320 + })
321 + );
322 +
323 + it.effect('should be transitive (if a > b and b > c then a > c)', () =>
324 + Effect.gen(function* () {
325 + const result1 = yield* semverComparator('3.0.0', '2.0.0'); // Should be 1
326 + const result2 = yield* semverComparator('2.0.0', '1.0.0'); // Should be 1
327 + const result3 = yield* semverComparator('3.0.0', '1.0.0'); // Should be 1
328 +
329 + expect(result1).toBe(1);
330 + expect(result2).toBe(1);
331 + expect(result3).toBe(1);
332 + })
333 + );
334 + });
335 +
336 + describe('Invalid Version Handling', () => {
337 + // Note: These tests check how semver.compare handles invalid versions
338 + // The behavior depends on the semver library implementation
339 +
340 + it.effect('should reject empty strings', () =>
341 + Effect.gen(function* () {
342 + const result = yield* Effect.flip(semverComparator('', '1.0.0'));
343 + expect(result).toBeInstanceOf(CompareSemverError);
344 + expect(result.message).toContain('Failed to compare versions');
345 + expect(result.cause.message).toContain('Invalid Version');
346 + })
347 + );
348 +
349 + it.effect('should reject invalid version formats', () =>
350 + Effect.gen(function* () {
351 + const result = yield* Effect.flip(semverComparator('not.a.version', '1.0.0'));
352 + expect(result).toBeInstanceOf(CompareSemverError);
353 + expect(result.message).toContain('Failed to compare versions: not.a.version vs 1.0.0');
354 + expect(result.cause.message).toContain('Invalid Version: not.a.version');
355 + })
356 + );
357 +
358 + it.effect('should reject null-like strings', () =>
359 + Effect.gen(function* () {
360 + const result = yield* Effect.flip(semverComparator('null', 'undefined'));
361 + expect(result).toBeInstanceOf(CompareSemverError);
362 + expect(result.message).toContain('Failed to compare versions: null vs undefined');
363 + expect(result.cause.message).toContain('Invalid Version: null');
364 + })
365 + );
366 + });
367 + });
368 +});
ts/packages/cli/test/src/effects/detect-platform.test.ts new
+381
@@ -0,0 +1,381 @@
1 +import { describe, expect, it } from '@effect/vitest';
2 +import { Effect, Layer } from 'effect';
3 +import {
4 + detectPlatform,
5 + UnsupportedPlatformError,
6 + type PlatformArch,
7 +} from 'src/effects/detect-platform';
8 +import { NodeOs } from 'src/services/node-os';
9 +
10 +/**
11 + * Mock NodeOs service with custom platform and architecture
12 + */
13 +const createMockNodeOs = <P extends NodeJS.Platform>(platform: P, arch: string) =>
14 + Layer.succeed(
15 + NodeOs,
16 + NodeOs.make({
17 + homedir: '/mock/home',
18 + platform: platform as NodeJS.Platform,
19 + arch,
20 + })
21 + );
22 +
23 +describe('detect-platform.ts', () => {
24 + describe('detectPlatform', () => {
25 + describe('Supported Combinations', () => {
26 + it.effect('should detect darwin + x64', () =>
27 + Effect.gen(function* () {
28 + const result = yield* detectPlatform;
29 +
30 + expect(result).toEqual<PlatformArch>({
31 + platform: 'darwin',
32 + arch: 'x64',
33 + });
34 + }).pipe(Effect.provide(createMockNodeOs('darwin', 'x64')))
35 + );
36 +
37 + it.effect('should detect darwin + arm64 (mapped to aarch64)', () =>
38 + Effect.gen(function* () {
39 + const result = yield* detectPlatform;
40 +
41 + expect(result).toEqual<PlatformArch>({
42 + platform: 'darwin',
43 + arch: 'aarch64',
44 + });
45 + }).pipe(Effect.provide(createMockNodeOs('darwin', 'arm64')))
46 + );
47 +
48 + it.effect('should detect darwin + aarch64', () =>
49 + Effect.gen(function* () {
50 + const result = yield* detectPlatform;
51 +
52 + expect(result).toEqual<PlatformArch>({
53 + platform: 'darwin',
54 + arch: 'aarch64',
55 + });
56 + }).pipe(Effect.provide(createMockNodeOs('darwin', 'aarch64')))
57 + );
58 +
59 + it.effect('should detect linux + x64', () =>
60 + Effect.gen(function* () {
61 + const result = yield* detectPlatform;
62 +
63 + expect(result).toEqual<PlatformArch>({
64 + platform: 'linux',
65 + arch: 'x64',
66 + });
67 + }).pipe(Effect.provide(createMockNodeOs('linux', 'x64')))
68 + );
69 +
70 + it.effect('should detect linux + arm64 (mapped to aarch64)', () =>
71 + Effect.gen(function* () {
72 + const result = yield* detectPlatform;
73 +
74 + expect(result).toEqual<PlatformArch>({
75 + platform: 'linux',
76 + arch: 'aarch64',
77 + });
78 + }).pipe(Effect.provide(createMockNodeOs('linux', 'arm64')))
79 + );
80 +
81 + it.effect('should detect linux + aarch64', () =>
82 + Effect.gen(function* () {
83 + const result = yield* detectPlatform;
84 +
85 + expect(result).toEqual<PlatformArch>({
86 + platform: 'linux',
87 + arch: 'aarch64',
88 + });
89 + }).pipe(Effect.provide(createMockNodeOs('linux', 'aarch64')))
90 + );
91 + });
92 +
93 + describe('Unsupported Platforms', () => {
94 + const unsupportedPlatforms = [
95 + 'win32',
96 + 'freebsd',
97 + 'openbsd',
98 + 'sunos',
99 + 'aix',
100 + 'android',
101 + 'cygwin',
102 + 'netbsd',
103 + ] as const;
104 +
105 + unsupportedPlatforms.forEach(platform => {
106 + it.effect(`should fail for unsupported platform: ${platform}`, () =>
107 + Effect.gen(function* () {
108 + const result = yield* Effect.flip(detectPlatform);
109 +
110 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
111 + expect(result.platform).toBe(platform);
112 + expect(result.arch).toBe('x64');
113 + }).pipe(Effect.provide(createMockNodeOs(platform, 'x64')))
114 + );
115 + });
116 + });
117 +
118 + describe('Unsupported Architectures', () => {
119 + const unsupportedArchitectures = [
120 + 'ia32',
121 + 'mips',
122 + 'mipsel',
123 + 'ppc',
124 + 'ppc64',
125 + 's390',
126 + 's390x',
127 + 'loong64',
128 + 'riscv64',
129 + ];
130 +
131 + unsupportedArchitectures.forEach(arch => {
132 + it.effect(`should fail for unsupported architecture: ${arch} on darwin`, () =>
133 + Effect.gen(function* () {
134 + const result = yield* Effect.flip(detectPlatform);
135 +
136 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
137 + expect(result.platform).toBe('darwin');
138 + expect(result.arch).toBe(arch);
139 + }).pipe(Effect.provide(createMockNodeOs('darwin', arch)))
140 + );
141 +
142 + it.effect(`should fail for unsupported architecture: ${arch} on linux`, () =>
143 + Effect.gen(function* () {
144 + const result = yield* Effect.flip(detectPlatform);
145 +
146 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
147 + expect(result.platform).toBe('linux');
148 + expect(result.arch).toBe(arch);
149 + }).pipe(Effect.provide(createMockNodeOs('linux', arch)))
150 + );
151 + });
152 + });
153 +
154 + describe('Double Unsupported (Platform + Architecture)', () => {
155 + it.effect('should fail with both unsupported platform and architecture', () =>
156 + Effect.gen(function* () {
157 + const result = yield* Effect.flip(detectPlatform);
158 +
159 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
160 + expect(result.platform).toBe('win32');
161 + expect(result.arch).toBe('ia32');
162 + }).pipe(Effect.provide(createMockNodeOs('win32', 'ia32')))
163 + );
164 +
165 + it.effect('should fail with freebsd + mips combination', () =>
166 + Effect.gen(function* () {
167 + const result = yield* Effect.flip(detectPlatform);
168 +
169 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
170 + expect(result.platform).toBe('freebsd');
171 + expect(result.arch).toBe('mips');
172 + }).pipe(Effect.provide(createMockNodeOs('freebsd', 'mips')))
173 + );
174 + });
175 +
176 + describe('Edge Cases', () => {
177 + it.effect('should handle empty platform string', () =>
178 + Effect.gen(function* () {
179 + const result = yield* Effect.flip(detectPlatform);
180 +
181 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
182 + expect(result.platform).toBe('');
183 + expect(result.arch).toBe('x64');
184 + }).pipe(Effect.provide(createMockNodeOs('' as NodeJS.Platform, 'x64')))
185 + );
186 +
187 + it.effect('should handle empty architecture string', () =>
188 + Effect.gen(function* () {
189 + const result = yield* Effect.flip(detectPlatform);
190 +
191 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
192 + expect(result.platform).toBe('darwin');
193 + expect(result.arch).toBe('');
194 + }).pipe(Effect.provide(createMockNodeOs('darwin', '')))
195 + );
196 +
197 + it.effect('should handle both empty platform and architecture', () =>
198 + Effect.gen(function* () {
199 + const result = yield* Effect.flip(detectPlatform);
200 +
201 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
202 + expect(result.platform).toBe('');
203 + expect(result.arch).toBe('');
204 + }).pipe(Effect.provide(createMockNodeOs('' as NodeJS.Platform, '')))
205 + );
206 +
207 + it.effect('should handle null-like values as strings', () =>
208 + Effect.gen(function* () {
209 + const result = yield* Effect.flip(detectPlatform);
210 +
211 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
212 + expect(result.platform).toBe('null');
213 + expect(result.arch).toBe('undefined');
214 + }).pipe(Effect.provide(createMockNodeOs('null' as NodeJS.Platform, 'undefined')))
215 + );
216 +
217 + it.effect('should handle very long platform name', () => {
218 + const longPlatform = 'a'.repeat(1000);
219 + return Effect.gen(function* () {
220 + const result = yield* Effect.flip(detectPlatform);
221 +
222 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
223 + expect(result.platform).toBe(longPlatform);
224 + expect(result.arch).toBe('x64');
225 + }).pipe(Effect.provide(createMockNodeOs(longPlatform as NodeJS.Platform, 'x64')));
226 + });
227 +
228 + it.effect('should handle very long architecture name', () => {
229 + const longArch = 'z'.repeat(1000);
230 + return Effect.gen(function* () {
231 + const result = yield* Effect.flip(detectPlatform);
232 +
233 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
234 + expect(result.platform).toBe('darwin');
235 + expect(result.arch).toBe(longArch);
236 + }).pipe(Effect.provide(createMockNodeOs('darwin', longArch)));
237 + });
238 + });
239 +
240 + describe('Case Sensitivity', () => {
241 + it.effect('should not match Darwin (uppercase D)', () =>
242 + Effect.gen(function* () {
243 + const result = yield* Effect.flip(detectPlatform);
244 +
245 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
246 + expect(result.platform).toBe('Darwin');
247 + expect(result.arch).toBe('x64');
248 + }).pipe(Effect.provide(createMockNodeOs('Darwin' as NodeJS.Platform, 'x64')))
249 + );
250 +
251 + it.effect('should not match LINUX (uppercase)', () =>
252 + Effect.gen(function* () {
253 + const result = yield* Effect.flip(detectPlatform);
254 +
255 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
256 + expect(result.platform).toBe('LINUX');
257 + expect(result.arch).toBe('x64');
258 + }).pipe(Effect.provide(createMockNodeOs('LINUX' as NodeJS.Platform, 'x64')))
259 + );
260 +
261 + it.effect('should not match X64 (uppercase)', () =>
262 + Effect.gen(function* () {
263 + const result = yield* Effect.flip(detectPlatform);
264 +
265 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
266 + expect(result.platform).toBe('darwin');
267 + expect(result.arch).toBe('X64');
268 + }).pipe(Effect.provide(createMockNodeOs('darwin', 'X64')))
269 + );
270 +
271 + it.effect('should not match ARM64 (uppercase)', () =>
272 + Effect.gen(function* () {
273 + const result = yield* Effect.flip(detectPlatform);
274 +
275 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
276 + expect(result.platform).toBe('linux');
277 + expect(result.arch).toBe('ARM64');
278 + }).pipe(Effect.provide(createMockNodeOs('linux', 'ARM64')))
279 + );
280 + });
281 +
282 + describe('Whitespace Handling', () => {
283 + it.effect('should not match platform with leading whitespace', () =>
284 + Effect.gen(function* () {
285 + const result = yield* Effect.flip(detectPlatform);
286 +
287 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
288 + expect(result.platform).toBe(' darwin');
289 + expect(result.arch).toBe('x64');
290 + }).pipe(Effect.provide(createMockNodeOs(' darwin' as NodeJS.Platform, 'x64')))
291 + );
292 +
293 + it.effect('should not match platform with trailing whitespace', () =>
294 + Effect.gen(function* () {
295 + const result = yield* Effect.flip(detectPlatform);
296 +
297 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
298 + expect(result.platform).toBe('linux ');
299 + expect(result.arch).toBe('x64');
300 + }).pipe(Effect.provide(createMockNodeOs('linux ' as NodeJS.Platform, 'x64')))
301 + );
302 +
303 + it.effect('should not match architecture with leading whitespace', () =>
304 + Effect.gen(function* () {
305 + const result = yield* Effect.flip(detectPlatform);
306 +
307 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
308 + expect(result.platform).toBe('darwin');
309 + expect(result.arch).toBe(' x64');
310 + }).pipe(Effect.provide(createMockNodeOs('darwin', ' x64')))
311 + );
312 +
313 + it.effect('should not match architecture with trailing whitespace', () =>
314 + Effect.gen(function* () {
315 + const result = yield* Effect.flip(detectPlatform);
316 +
317 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
318 + expect(result.platform).toBe('darwin');
319 + expect(result.arch).toBe('arm64 ');
320 + }).pipe(Effect.provide(createMockNodeOs('darwin', 'arm64 ')))
321 + );
322 +
323 + it.effect('should not match with internal whitespace in platform', () =>
324 + Effect.gen(function* () {
325 + const result = yield* Effect.flip(detectPlatform);
326 +
327 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
328 + expect(result.platform).toBe('dar win');
329 + expect(result.arch).toBe('x64');
330 + }).pipe(Effect.provide(createMockNodeOs('dar win' as NodeJS.Platform, 'x64')))
331 + );
332 +
333 + it.effect('should not match with internal whitespace in architecture', () =>
334 + Effect.gen(function* () {
335 + const result = yield* Effect.flip(detectPlatform);
336 +
337 + expect(result).toBeInstanceOf(UnsupportedPlatformError);
338 + expect(result.platform).toBe('darwin');
339 + expect(result.arch).toBe('x 64');
340 + }).pipe(Effect.provide(createMockNodeOs('darwin', 'x 64')))
341 + );
342 + });
343 + });
344 +
345 + describe('UnsupportedPlatformError', () => {
346 + it('should be a proper Error instance', () => {
347 + const error = new UnsupportedPlatformError({ platform: 'test', arch: 'test' });
348 + expect(error).toBeInstanceOf(Error);
349 + expect(error).toBeInstanceOf(UnsupportedPlatformError);
350 + expect(error._tag).toBe('UnsupportedPlatformError');
351 + });
352 +
353 + it('should contain platform and arch information', () => {
354 + const error = new UnsupportedPlatformError({ platform: 'testPlatform', arch: 'testArch' });
355 + expect(error.platform).toBe('testPlatform');
356 + expect(error.arch).toBe('testArch');
357 + });
358 +
359 + it('should maintain properties for empty values', () => {
360 + const error = new UnsupportedPlatformError({ platform: '', arch: '' });
361 + expect(error.platform).toBe('');
362 + expect(error.arch).toBe('');
363 + });
364 + });
365 +
366 + describe('Type Tests', () => {
367 + it('should return correct PlatformArch type for supported combinations', () => {
368 + // This test verifies TypeScript types at runtime
369 + const testType = async (platform: string, arch: string): Promise<PlatformArch> => {
370 + return await Effect.runPromise(
371 + detectPlatform.pipe(Effect.provide(createMockNodeOs(platform as NodeJS.Platform, arch)))
372 + );
373 + };
374 +
375 + // These calls should compile without TypeScript errors
376 + expect(testType('darwin', 'x64')).resolves.toEqual({ platform: 'darwin', arch: 'x64' });
377 + expect(testType('darwin', 'arm64')).resolves.toEqual({ platform: 'darwin', arch: 'aarch64' });
378 + expect(testType('linux', 'aarch64')).resolves.toEqual({ platform: 'linux', arch: 'aarch64' });
379 + });
380 + });
381 +});
ts/packages/cli/test/src/services/user-context.test.ts
+5 -5
@@ -5,7 +5,7 @@ import { BunFileSystem } from '@effect/platform-bun';
5 import { ConfigProvider, Effect, Layer, Option, Data } from 'effect';
6 import * as tempy from 'tempy';
7 import { ComposioUserContext, ComposioUserContextLive } from 'src/services/user-context';
8 -import { NodeOs } from 'src/services/node-os';
8 +import { defaultNodeOs, NodeOs } from 'src/services/node-os';
9 import { UserData, userDataToJSON } from 'src/models/user-data';
10 import { extendConfigProvider } from 'src/services/config';
11 import path from 'node:path';
@@ -20,7 +20,7 @@ describe('ComposioUserContext', () => {
20 const cwd = tempy.temporaryDirectory();
21 const map = new Map([]) satisfies Map<string, string>;
22
23 - const NodeOsTest = Layer.succeed(NodeOs, new NodeOs({ homedir: cwd }));
23 + const NodeOsTest = Layer.succeed(NodeOs, defaultNodeOs({ homedir: cwd }));
24 const ComposioUserContextTest = Layer.provideMerge(
25 ComposioUserContextLive,
26 Layer.mergeAll(BunFileSystem.layer, NodeOsTest, withMapConfigProvider(map))
@@ -47,7 +47,7 @@ describe('ComposioUserContext', () => {
47 ['COMPOSIO_BASE_URL', 'https://test.composio.localhost'],
48 ]) satisfies Map<string, string>;
49
50 - const NodeOsTest = Layer.succeed(NodeOs, new NodeOs({ homedir: cwd }));
50 + const NodeOsTest = Layer.succeed(NodeOs, defaultNodeOs({ homedir: cwd }));
51 const ComposioUserContextTest = Layer.provideMerge(
52 ComposioUserContextLive,
53 Layer.mergeAll(BunFileSystem.layer, NodeOsTest, withMapConfigProvider(map))
@@ -74,7 +74,7 @@ describe('ComposioUserContext', () => {
74 const cwd = tempy.temporaryDirectory();
75 const map = new Map([]) satisfies Map<string, string>;
76
77 - const NodeOsTest = Layer.succeed(NodeOs, new NodeOs({ homedir: cwd }));
77 + const NodeOsTest = Layer.succeed(NodeOs, defaultNodeOs({ homedir: cwd }));
78 const ComposioUserContextTest = Layer.provideMerge(
79 ComposioUserContextLive,
80 Layer.mergeAll(BunFileSystem.layer, NodeOsTest, withMapConfigProvider(map))
@@ -103,7 +103,7 @@ describe('ComposioUserContext', () => {
103 const cwd = tempy.temporaryDirectory();
104 const map = new Map([['COMPOSIO_API_KEY', 'api_key']]) satisfies Map<string, string>;
105
106 - const NodeOsTest = Layer.succeed(NodeOs, new NodeOs({ homedir: cwd }));
106 + const NodeOsTest = Layer.succeed(NodeOs, defaultNodeOs({ homedir: cwd }));
107 const ComposioUserContextTest = Layer.provideMerge(
108 ComposioUserContextLive,
109 Layer.mergeAll(BunFileSystem.layer, NodeOsTest, withMapConfigProvider(map))