@devries-cameron20 / composio Mirror · read-only / commits / 9c004932d
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, 23:15 UTC

feat: make generate work properly inside node modules (#1682)

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

Rahul Tarak committed Jun 24, 2025 at 13:08 UTC 9c004932d3b8fc8afa82edd47448c93bc7ccc31b
46 files changed +1682 -598
pnpm-lock.yaml
+80 -80
@@ -521,14 +521,14 @@ importers:
521 specifier: workspace:*
522 version: link:../ts-builders
523 '@effect/cli':
524 - specifier: ^0.63.11
525 - version: 0.63.11(@effect/platform@0.84.11(effect@3.16.8))(@effect/printer-ansi@0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8))(@effect/printer@0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
524 + specifier: ^0.64.2
525 + version: 0.64.2(@effect/platform@0.85.2(effect@3.16.8))(@effect/printer-ansi@0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8))(@effect/printer@0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
526 '@effect/platform-bun':
527 - specifier: ^0.69.16
528 - version: 0.69.16(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
527 + specifier: ^0.70.4
528 + version: 0.70.5(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
529 '@effect/platform-node-shared':
530 - specifier: ^0.40.2
531 - version: 0.40.4(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
530 + specifier: ^0.40.4
531 + version: 0.40.4(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
532 chalk:
533 specifier: ^5.4.1
534 version: 5.4.1
@@ -537,7 +537,7 @@ importers:
537 version: 3.16.8
538 effect-errors:
539 specifier: ^1.10.11
540 - version: 1.10.11(cf59ec752dcdeadb070feeecd266ef4f)
540 + version: 1.10.11(aee16c6ba0d05f0cbe9c66fcd0455e75)
541 indent-string:
542 specifier: ^5.0.0
543 version: 5.0.0
@@ -552,8 +552,8 @@ importers:
552 specifier: ^0.3.2
553 version: 0.3.2
554 '@effect/platform':
555 - specifier: ^0.84.11
556 - version: 0.84.11(effect@3.16.8)
555 + specifier: ^0.85.2
556 + version: 0.85.2(effect@3.16.8)
557 '@effect/vitest':
558 specifier: ^0.23.8
559 version: 0.23.8(effect@3.16.8)(vitest@3.2.4)
@@ -1152,13 +1152,13 @@ packages:
1152 '@dprint/typescript@0.91.8':
1153 resolution: {integrity: sha512-tuKn4leCPItox1O4uunHcQF0QllDCvPWklnNQIh2PiWWVtRAGltJJnM4Cwj5AciplosD1Hiz7vAY3ew3crLb3A==}
1154
1155 - '@effect/cli@0.63.11':
1156 - resolution: {integrity: sha512-e95XKrCLHFKQor1hRWD5a1nh34cMNWfhaZrRc5iqI2sWUTQumV8rUUDAPMNHFzPC0tIrdO42wrOUhIgJs7i2iA==}
1155 + '@effect/cli@0.64.2':
1156 + resolution: {integrity: sha512-j+HsbpyglfVwNFVgFNxb7EDVDvvGJgWqDqvN1B+idfHMl9D+3qB1P3pou/40yKj8J3dpOR87OBSSVIDrKc97mg==}
1157 peerDependencies:
1158 - '@effect/platform': ^0.84.11
1159 - '@effect/printer': ^0.44.7
1160 - '@effect/printer-ansi': ^0.44.7
1161 - effect: ^3.16.7
1158 + '@effect/platform': ^0.85.2
1159 + '@effect/printer': ^0.44.8
1160 + '@effect/printer-ansi': ^0.44.8
1161 + effect: ^3.16.8
1162
1163 '@effect/cluster@0.39.4':
1164 resolution: {integrity: sha512-gHR3m/GAd5gQ2YXKJ4BX//fY1zjqRvZbKjxHuZ7+8KSvtaQbYelGDf/+DJ21nHusDL6hFJkMRSFaR7J2JYImHw==}
@@ -1185,23 +1185,14 @@ packages:
1185 lmdb:
1186 optional: true
1187
1188 - '@effect/platform-bun@0.69.16':
1189 - resolution: {integrity: sha512-5Mocp+ZfCZ4xw1kI5OmoTAzLKtHht8NisEwD66rc8wium+2elFxFsuiM2kGM3TYz9jC3vwkEXf1SXgecBLWz4A==}
1190 - peerDependencies:
1191 - '@effect/cluster': ^0.38.16
1192 - '@effect/platform': ^0.84.11
1193 - '@effect/rpc': ^0.61.15
1194 - '@effect/sql': ^0.37.12
1195 - effect: ^3.16.7
1196 -
1197 - '@effect/platform-node-shared@0.39.16':
1198 - resolution: {integrity: sha512-aJ7jVm9V+SEeNumRmHb+TxD0C38uv/1LLfBHB2Qg+xb5UjnZhak8SzwolAgSKkMNDFpAAdF2AlxZ1tO/HfhCiw==}
1188 + '@effect/platform-bun@0.70.5':
1189 + resolution: {integrity: sha512-3nvR+RFo0apkwL1HgbuyVCDFqTtgkubiHSN8T0zC+nYJWvghR75VaU2ajbDLECUltpef53g5iNisnXpwUC92bQ==}
1190 peerDependencies:
1200 - '@effect/cluster': ^0.38.16
1201 - '@effect/platform': ^0.84.11
1202 - '@effect/rpc': ^0.61.15
1203 - '@effect/sql': ^0.37.12
1204 - effect: ^3.16.7
1191 + '@effect/cluster': ^0.39.5
1192 + '@effect/platform': ^0.85.2
1193 + '@effect/rpc': ^0.62.4
1194 + '@effect/sql': ^0.38.2
1195 + effect: ^3.16.8
1196
1197 '@effect/platform-node-shared@0.40.4':
1198 resolution: {integrity: sha512-EfnRTSHKs33OTfKN9pF+G2AyxMXm/+4rKrGM8yEw56Ij6QV5dq2g28yi0eOH7BytvilnreVmcbAec7M77EArgg==}
@@ -1212,6 +1203,15 @@ packages:
1203 '@effect/sql': ^0.38.2
1204 effect: ^3.16.8
1205
1206 + '@effect/platform-node-shared@0.40.5':
1207 + resolution: {integrity: sha512-Ru86IQ0E3tZNgO6UiWXBWNj4qZOgMT10z4fGF7Y4XwaB6lASWaFmCsDAkfYSqsmoesbtWvPQXbJkOr2QHYeU0Q==}
1208 + peerDependencies:
1209 + '@effect/cluster': ^0.39.5
1210 + '@effect/platform': ^0.85.2
1211 + '@effect/rpc': ^0.62.4
1212 + '@effect/sql': ^0.38.2
1213 + effect: ^3.16.8
1214 +
1215 '@effect/platform-node@0.86.4':
1216 resolution: {integrity: sha512-AImYc+Tg/EF0miKKgORgQEEZ1a6PpdqkH2ZU4wt0ChmWi1XFa1WF/NYzK5qRrtfSKF+ug6Vd/5/psWvZNJTdyw==}
1217 peerDependencies:
@@ -1221,10 +1221,10 @@ packages:
1221 '@effect/sql': ^0.38.2
1222 effect: ^3.16.8
1223
1224 - '@effect/platform@0.84.11':
1225 - resolution: {integrity: sha512-u3eURhaF38e8jqq/JC2NW9EDHUFVDETD/JLEFtFi7N6RnAUF90qaC8sRcoK5xe8UAo3/fJDQ+sEfDqYonUa30w==}
1224 + '@effect/platform@0.85.2':
1225 + resolution: {integrity: sha512-zIRixbQeO6QniR0k2mwR7DmR2HO1w6+qQlzQ5nb8lyPyPgd1gV9wo/9yBeB6zRC+CGnxiUiYsRMamclVISuxLw==}
1226 peerDependencies:
1227 - effect: ^3.16.7
1227 + effect: ^3.16.8
1228
1229 '@effect/printer-ansi@0.44.8':
1230 resolution: {integrity: sha512-HFatTgDyPgXc0Kbw2BH0nUht0ViAPukggIHuxGDm1EN0G7uKX9qXHLkFaQ7HGhotNOuf2hC6AXaKkzWOhxWp1A==}
@@ -6906,9 +6906,9 @@ snapshots:
6906
6907 '@dprint/typescript@0.91.8': {}
6908
6909 - '@effect/cli@0.63.11(@effect/platform@0.84.11(effect@3.16.8))(@effect/printer-ansi@0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8))(@effect/printer@0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6909 + '@effect/cli@0.64.2(@effect/platform@0.85.2(effect@3.16.8))(@effect/printer-ansi@0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8))(@effect/printer@0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6910 dependencies:
6911 - '@effect/platform': 0.84.11(effect@3.16.8)
6911 + '@effect/platform': 0.85.2(effect@3.16.8)
6912 '@effect/printer': 0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8)
6913 '@effect/printer-ansi': 0.44.8(@effect/typeclass@0.35.8(effect@3.16.8))(effect@3.16.8)
6914 effect: 3.16.8
@@ -6916,12 +6916,12 @@ snapshots:
6916 toml: 3.0.0
6917 yaml: 2.8.0
6918
6919 - '@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6919 + '@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6920 dependencies:
6921 - '@effect/platform': 0.84.11(effect@3.16.8)
6922 - '@effect/rpc': 0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6923 - '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6924 - '@effect/workflow': 0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6921 + '@effect/platform': 0.85.2(effect@3.16.8)
6922 + '@effect/rpc': 0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6923 + '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6924 + '@effect/workflow': 0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6925 effect: 3.16.8
6926
6927 '@effect/eslint-plugin@0.3.2':
@@ -6930,31 +6930,31 @@ snapshots:
6930 '@dprint/typescript': 0.91.8
6931 prettier-linter-helpers: 1.0.0
6932
6933 - '@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)':
6933 + '@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)':
6934 dependencies:
6935 - '@effect/platform': 0.84.11(effect@3.16.8)
6935 + '@effect/platform': 0.85.2(effect@3.16.8)
6936 effect: 3.16.8
6937 uuid: 11.1.0
6938
6939 - '@effect/platform-bun@0.69.16(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6939 + '@effect/platform-bun@0.70.5(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6940 dependencies:
6941 - '@effect/cluster': 0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6942 - '@effect/platform': 0.84.11(effect@3.16.8)
6943 - '@effect/platform-node-shared': 0.39.16(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6944 - '@effect/rpc': 0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6945 - '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6941 + '@effect/cluster': 0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6942 + '@effect/platform': 0.85.2(effect@3.16.8)
6943 + '@effect/platform-node-shared': 0.40.5(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6944 + '@effect/rpc': 0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6945 + '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6946 effect: 3.16.8
6947 multipasta: 0.2.5
6948 transitivePeerDependencies:
6949 - bufferutil
6950 - utf-8-validate
6951
6952 - '@effect/platform-node-shared@0.39.16(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6952 + '@effect/platform-node-shared@0.40.4(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6953 dependencies:
6954 - '@effect/cluster': 0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6955 - '@effect/platform': 0.84.11(effect@3.16.8)
6956 - '@effect/rpc': 0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6957 - '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6954 + '@effect/cluster': 0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6955 + '@effect/platform': 0.85.2(effect@3.16.8)
6956 + '@effect/rpc': 0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6957 + '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6958 '@parcel/watcher': 2.5.1
6959 effect: 3.16.8
6960 multipasta: 0.2.5
@@ -6963,12 +6963,12 @@ snapshots:
6963 - bufferutil
6964 - utf-8-validate
6965
6966 - '@effect/platform-node-shared@0.40.4(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6966 + '@effect/platform-node-shared@0.40.5(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6967 dependencies:
6968 - '@effect/cluster': 0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6969 - '@effect/platform': 0.84.11(effect@3.16.8)
6970 - '@effect/rpc': 0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6971 - '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6968 + '@effect/cluster': 0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6969 + '@effect/platform': 0.85.2(effect@3.16.8)
6970 + '@effect/rpc': 0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6971 + '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6972 '@parcel/watcher': 2.5.1
6973 effect: 3.16.8
6974 multipasta: 0.2.5
@@ -6977,13 +6977,13 @@ snapshots:
6977 - bufferutil
6978 - utf-8-validate
6979
6980 - '@effect/platform-node@0.86.4(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6980 + '@effect/platform-node@0.86.4(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
6981 dependencies:
6982 - '@effect/cluster': 0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6983 - '@effect/platform': 0.84.11(effect@3.16.8)
6984 - '@effect/platform-node-shared': 0.40.4(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6985 - '@effect/rpc': 0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6986 - '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
6982 + '@effect/cluster': 0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6983 + '@effect/platform': 0.85.2(effect@3.16.8)
6984 + '@effect/platform-node-shared': 0.40.4(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
6985 + '@effect/rpc': 0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6986 + '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
6987 effect: 3.16.8
6988 mime: 3.0.0
6989 undici: 7.10.0
@@ -6992,7 +6992,7 @@ snapshots:
6992 - bufferutil
6993 - utf-8-validate
6994
6995 - '@effect/platform@0.84.11(effect@3.16.8)':
6995 + '@effect/platform@0.85.2(effect@3.16.8)':
6996 dependencies:
6997 effect: 3.16.8
6998 find-my-way-ts: 0.1.5
@@ -7010,15 +7010,15 @@ snapshots:
7010 '@effect/typeclass': 0.35.8(effect@3.16.8)
7011 effect: 3.16.8
7012
7013 - '@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)':
7013 + '@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)':
7014 dependencies:
7015 - '@effect/platform': 0.84.11(effect@3.16.8)
7015 + '@effect/platform': 0.85.2(effect@3.16.8)
7016 effect: 3.16.8
7017
7018 - '@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)':
7018 + '@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)':
7019 dependencies:
7020 - '@effect/experimental': 0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
7021 - '@effect/platform': 0.84.11(effect@3.16.8)
7020 + '@effect/experimental': 0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
7021 + '@effect/platform': 0.85.2(effect@3.16.8)
7022 '@opentelemetry/semantic-conventions': 1.34.0
7023 effect: 3.16.8
7024 uuid: 11.1.0
@@ -7032,10 +7032,10 @@ snapshots:
7032 effect: 3.16.8
7033 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)
7034
7035 - '@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
7035 + '@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)':
7036 dependencies:
7037 - '@effect/platform': 0.84.11(effect@3.16.8)
7038 - '@effect/rpc': 0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
7037 + '@effect/platform': 0.85.2(effect@3.16.8)
7038 + '@effect/rpc': 0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
7039 effect: 3.16.8
7040
7041 '@emnapi/runtime@1.4.3':
@@ -9832,13 +9832,13 @@ snapshots:
9832
9833 ee-first@1.1.1: {}
9834
9835 - effect-errors@1.10.11(cf59ec752dcdeadb070feeecd266ef4f):
9835 + effect-errors@1.10.11(aee16c6ba0d05f0cbe9c66fcd0455e75):
9836 dependencies:
9837 - '@effect/cluster': 0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
9838 - '@effect/platform': 0.84.11(effect@3.16.8)
9839 - '@effect/platform-node': 0.86.4(@effect/cluster@0.39.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
9840 - '@effect/rpc': 0.62.4(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
9841 - '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8)
9837 + '@effect/cluster': 0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
9838 + '@effect/platform': 0.85.2(effect@3.16.8)
9839 + '@effect/platform-node': 0.86.4(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
9840 + '@effect/rpc': 0.62.4(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
9841 + '@effect/sql': 0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.85.2(effect@3.16.8))(effect@3.16.8)
9842 comment-json: 4.2.5
9843 effect: 3.16.8
9844 picocolors: 1.1.1
ts/packages/cli/package.json
+4 -4
@@ -40,7 +40,7 @@
40 "packageManager": "pnpm@10.8.0",
41 "devDependencies": {
42 "@effect/eslint-plugin": "^0.3.2",
43 - "@effect/platform": "^0.84.11",
43 + "@effect/platform": "^0.85.2",
44 "@effect/vitest": "^0.23.8",
45 "@types/bun": "^1.2.16",
46 "@types/semver": "^7.7.0",
@@ -54,9 +54,9 @@
54 "@composio/client": "0.1.0-alpha.17",
55 "@composio/core": "workspace:*",
56 "@composio/ts-builders": "workspace:*",
57 - "@effect/cli": "^0.63.11",
58 - "@effect/platform-bun": "^0.69.16",
59 - "@effect/platform-node-shared": "^0.40.2",
57 + "@effect/cli": "^0.64.2",
58 + "@effect/platform-bun": "^0.70.4",
59 + "@effect/platform-node-shared": "^0.40.4",
60 "chalk": "^5.4.1",
61 "effect": "^3.16.8",
62 "effect-errors": "^1.10.11",
ts/packages/cli/src/bin.ts
+3
@@ -14,6 +14,7 @@ import {
14 } from 'src/services/composio-clients';
15 import { NodeProcess } from 'src/services/node-process';
16 import { EnvLangDetector } from './services/env-lang-detector';
17 +import { JsPackageManagerDetector } from './services/js-package-manager-detector';
18
19 /**
20 * Concrete Effect layer compositions for the Composio CLI runtime.
@@ -42,6 +43,7 @@ const layers = Layer.mergeAll(
43 ComposioSessionRepository.Default.pipe(Layer.provide(UserConfigProviderLiveFromFs)),
44 ComposioToolkitsRepository.Default.pipe(Layer.provide(UserConfigProviderLiveFromFs)),
45 EnvLangDetector.Default,
46 + JsPackageManagerDetector.Default,
47 BunContext.layer,
48 BunFileSystem.layer
49 );
@@ -65,6 +67,7 @@ if (require.main === module) {
67 runWithArgs.pipe(
68 Effect.provide(layers),
69 Effect.provide(BunContext.layer),
70 + Effect.scoped,
71 Effect.withSpan('composio-cli', {
72 attributes: {
73 name: constants.APP_NAME,
ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
+59 -26
@@ -1,12 +1,13 @@
1 -import path from 'node:path';
1 import { Command, Options } from '@effect/cli';
3 -import { Console, Effect, Option } from 'effect';
2 +import { pipe, Console, Effect, Option } from 'effect';
3 import { FileSystem } from '@effect/platform';
4 import { ComposioToolkitsRepository } from 'src/services/composio-clients';
5 import type { GetCmdParams } from 'src/type-utils';
6 import { NodeProcess } from 'src/services/node-process';
7 import { createToolkitIndex } from 'src/generation/create-toolkit-index';
9 -import { generatePythonToolkitSources } from 'src/generation/python/generate-toolkit-sources';
8 +import { pyFindComposioCoreGenerated } from 'src/effects/find-composio-core-generated';
9 +import { BANNER } from 'src/generation/constants';
10 +import { generatePythonSources } from 'src/generation/python/generate';
11
12 export const outputOpt = Options.optional(
13 Options.directory('output-dir', {
@@ -14,9 +15,7 @@ export const outputOpt = Options.optional(
15 })
16 ).pipe(
17 Options.withAlias('o'),
17 - Options.withDescription(
18 - 'Output directory for the generated Python type stubs (default: `./.generated/composio-py`)'
19 - )
18 + Options.withDescription('Output directory for the generated Python type stubs')
19 );
20
21 const _pyCmd$Generate = Command.make('generate', { outputOpt }).pipe(
@@ -29,37 +28,71 @@ export function generatePythonTypeStubs({ outputOpt }: GetCmdParams<typeof _pyCm
28 return Effect.gen(function* () {
29 const process = yield* NodeProcess;
30 const cwd = process.cwd;
32 -
31 const fs = yield* FileSystem.FileSystem;
32 + const client = yield* ComposioToolkitsRepository;
33
35 - const output = outputOpt.pipe(
36 - Option.getOrElse(() => path.join(cwd, '.generated', 'composio-py'))
37 - );
38 - yield* fs.makeDirectory(output, { recursive: true });
34 + // Determine the actual output directory
35 + const outputDir = yield* outputOpt.pipe(
36 + Option.match({
37 + // If no output directory is specified, use the default
38 + onNone: () => pyFindComposioCoreGenerated(cwd),
39
40 - yield* Console.log('Fetching latest data from Composio API...');
41 - const client = yield* ComposioToolkitsRepository;
40 + // If an output directory is specified, validate and create it
41 + onSome: outputDir =>
42 + pipe(
43 + Effect.succeed(outputDir),
44 + Effect.tap(fs.makeDirectory(outputDir, { recursive: true }))
45 + ),
46 + })
47 + );
48
43 - yield* Effect.logDebug('Fetching toolkits...');
44 - const toolkits = yield* client.getToolkits();
49 + yield* Effect.log(`Writing type stubs to ${outputDir}...`);
50
46 - yield* Effect.logDebug('Fetching tools...');
47 - const tools = yield* client.getTools();
51 + // Fetch data from Composio API
52 + yield* Console.log('Fetching latest data from Composio API...');
53
49 - yield* Effect.logDebug('Fetching trigger types...');
50 - const triggerTypes = yield* client.getTriggerTypes();
54 + const [toolkits, tools, triggerTypes] = yield* Effect.all(
55 + [
56 + Effect.logDebug('Fetching toolkits...').pipe(Effect.flatMap(() => client.getToolkits())),
57 + Effect.logDebug('Fetching tools...').pipe(Effect.flatMap(() => client.getTools())),
58 + Effect.logDebug('Fetching trigger types...').pipe(
59 + Effect.flatMap(() => client.getTriggerTypes())
60 + ),
61 + ],
62 + { concurrency: 'unbounded' }
63 + );
64
65 const index = createToolkitIndex({ toolkits, tools, triggerTypes });
53 - const sourceFiles = generatePythonToolkitSources(index).map(
54 - ([filename, content]) => [path.join(output, filename), content] as const
55 - );
66
57 - yield* Console.log(`Writing type stubs to ${output}...`);
67 + // Generate Python sources
68 + const sources = generatePythonSources({
69 + banner: BANNER,
70 + outputDir,
71 + })(index);
72
59 - yield* Effect.all(
60 - sourceFiles.map(([filePath, content]) => fs.writeFileString(filePath, content))
73 + // Write all generated files
74 + yield* pipe(
75 + Effect.all(
76 + sources.map(([filePath, content]) =>
77 + fs
78 + .writeFileString(filePath, content)
79 + .pipe(Effect.mapError(error => new Error(`Failed to write file ${filePath}: ${error}`)))
80 + ),
81 + { concurrency: 1 }
82 + ),
83 + Effect.mapError(error => new Error(`Failed to write generated files: ${error}`))
84 );
85
63 - return yield* Console.log('✅ Type stubs generated successfully.');
86 + yield* Option.isNone(outputOpt)
87 + ? Console.log(
88 + '✅ Type stubs generated successfully.\n' +
89 + 'You can now import generated types via `from composio.<toolkit_name> import <TOOLKIT_NAME>`.\n'
90 + )
91 + : Console.log(
92 + `✅ Type stubs generated successfully.\n` +
93 + `Generated files are available at: ${outputDir}`
94 + );
95 +
96 + return outputDir;
97 });
98 }
ts/packages/cli/src/commands/ts/commands/ts.generate.cmd.ts
+128 -28
@@ -1,12 +1,31 @@
1 +/**
2 + * The `composio ts generate` command can be configured as follows:
3 + * - `--compact`: Emit a single module file
4 + * - `--transpiled`: Emit not just the TypeScript files, but also the transpiled JavaScript files
5 + * - `--output-dir`: Output directory for the generated TypeScript type stubs.
6 + *
7 + * Invariants:
8 + * - The `--output-dir` cannot refer to a path inside `node_modules`
9 + * - If `--output-dir` is not specified, the command will use `findComposioCoreGeneratedPath` to locate the `@composio/core` package
10 + * and write to it inside `node_modules`
11 + * - The absence of `--output-dir` implies that, by default, `--transpiled` is set to true
12 + * - If `--output-dir` is specified, `--transpiled` is, by default, set to false
13 + * - If `--transpiled` evaluates to true, the sources generated by `generateTypeScriptSources` need to be transpiled to ESM JavaScript too,
14 + * and stored along with the generated TypeScript files. CJS is not supported.
15 + */
16 +
17 import path from 'node:path';
18 import { Command, Options } from '@effect/cli';
3 -import { Console, Effect, Option } from 'effect';
19 +import { Console, Effect, Option, pipe } from 'effect';
20 import { FileSystem } from '@effect/platform';
21 import { ComposioToolkitsRepository } from 'src/services/composio-clients';
22 import { NodeProcess } from 'src/services/node-process';
23 import { createToolkitIndex } from 'src/generation/create-toolkit-index';
24 import type { GetCmdParams } from 'src/type-utils';
25 import { generateTypeScriptSources } from 'src/generation/typescript/generate';
26 +import { jsFindComposioCoreGenerated } from 'src/effects/find-composio-core-generated';
27 +import { transpileTypeScriptSources } from 'src/generation/typescript/transpile';
28 +import { BANNER } from 'src/generation/constants';
29
30 export const outputOpt = Options.optional(
31 Options.directory('output-dir', {
@@ -14,62 +33,143 @@ export const outputOpt = Options.optional(
33 })
34 ).pipe(
35 Options.withAlias('o'),
17 - Options.withDescription(
18 - 'Output directory for the generated Python type stubs (default: `./.generated/composio-py`)'
19 - )
36 + Options.withDescription('Output directory for the generated TypeScript type stubs.')
37 );
38
22 -export const singleFile = Options.boolean('single-file').pipe(
39 +export const compact = Options.boolean('compact').pipe(
40 Options.withDefault(false),
41 Options.withDescription('Emit a single TypeScript file')
42 );
43
27 -const _tsCmd$Generate = Command.make('generate', { outputOpt, singleFile }).pipe(
28 - Command.withDescription('Updates the local type stubs with the latest app data.')
44 +export const transpiled = Options.boolean('transpiled').pipe(
45 + Options.withDefault(false),
46 + Options.withDescription('Whether to emit transpiled JavaScript alongside TypeScript files')
47 );
48
49 +const _tsCmd$Generate = Command.make('generate', {
50 + outputOpt,
51 + compact,
52 + transpiled: transpiled,
53 +}).pipe(Command.withDescription('Updates the local type stubs with the latest app data.'));
54 +
55 +/**
56 + * Validates that the output directory is not inside node_modules
57 + */
58 +function validateOutputDir(outputDir: string): Effect.Effect<string, Error, FileSystem.FileSystem> {
59 + return Effect.gen(function* () {
60 + const normalizedPath = path.normalize(outputDir);
61 +
62 + if (normalizedPath.includes('node_modules')) {
63 + return yield* Effect.fail(
64 + new Error(
65 + 'Output directory cannot be inside node_modules. Please specify a different directory.'
66 + )
67 + );
68 + }
69 +
70 + return outputDir;
71 + });
72 +}
73 +
74 export const tsCmd$Generate = _tsCmd$Generate.pipe(
32 - Command.withHandler(generateTypescriptTypeStubs)
75 + Command.withHandler(params => {
76 + // Determine if we should compile based on the rules:
77 + // - If --output-dir is specified, default transpiled to false unless overridden
78 + // - If no --output-dir, default transpiled to true unless overridden
79 + const shouldCompile = params.transpiled || !Option.isSome(params.outputOpt);
80 +
81 + return generateTypescriptTypeStubs({
82 + ...params,
83 + compact: params.compact,
84 + transpiled: shouldCompile,
85 + });
86 + })
87 );
88
89 export function generateTypescriptTypeStubs({
90 outputOpt,
37 - singleFile,
38 -}: GetCmdParams<typeof _tsCmd$Generate>) {
91 + compact,
92 + transpiled = false,
93 +}: GetCmdParams<typeof _tsCmd$Generate> & { transpiled?: boolean }) {
94 return Effect.gen(function* () {
95 + const fs = yield* FileSystem.FileSystem;
96 const process = yield* NodeProcess;
97 const cwd = process.cwd;
98 + const client = yield* ComposioToolkitsRepository;
99
43 - const fs = yield* FileSystem.FileSystem;
100 + // Determine the actual output directory
101 + const outputDir = yield* outputOpt.pipe(
102 + Option.match({
103 + // If no output directory is specified, use the default
104 + onNone: () => jsFindComposioCoreGenerated(cwd),
105
45 - const outputDir = outputOpt.pipe(
46 - Option.getOrElse(() => path.join(cwd, '.generated', 'composio-ts'))
106 + // If an output directory is specified, validate and create it
107 + onSome: outputDir =>
108 + validateOutputDir(outputDir).pipe(
109 + Effect.tap(fs.makeDirectory(outputDir, { recursive: true }))
110 + ),
111 + })
112 );
48 - yield* fs.makeDirectory(outputDir, { recursive: true });
49 -
50 - yield* Console.log('Fetching latest data from Composio API...');
51 - const client = yield* ComposioToolkitsRepository;
113
53 - yield* Effect.logDebug('Fetching toolkits...');
54 - const toolkits = yield* client.getToolkits();
114 + yield* Effect.log(`Writing type stubs to ${outputDir}...`);
115
56 - yield* Effect.logDebug('Fetching tools...');
57 - const tools = yield* client.getTools();
116 + // Fetch data from Composio API
117 + yield* Console.log('Fetching latest data from Composio API...');
118
59 - yield* Effect.logDebug('Fetching trigger types...');
60 - const triggerTypes = yield* client.getTriggerTypes();
119 + const [toolkits, tools, triggerTypes] = yield* Effect.all(
120 + [
121 + Effect.logDebug('Fetching toolkits...').pipe(Effect.flatMap(() => client.getToolkits())),
122 + Effect.logDebug('Fetching tools...').pipe(Effect.flatMap(() => client.getTools())),
123 + Effect.logDebug('Fetching trigger types...').pipe(
124 + Effect.flatMap(() => client.getTriggerTypes())
125 + ),
126 + ],
127 + { concurrency: 'unbounded' }
128 + );
129
130 const index = createToolkitIndex({ toolkits, tools, triggerTypes });
131 +
132 + // Generate TypeScript sources
133 const sources = generateTypeScriptSources({
64 - banner: 'Auto-generated by Composio CLI. Do not modify manually.',
65 - emitSingleFile: singleFile,
134 outputDir,
135 + emitSingleFile: Boolean(compact), // Ensure boolean type
136 + banner: BANNER,
137 + importExtension: 'js',
138 })(index);
139
69 - yield* Console.log(`Writing type stubs to ${outputDir}...`);
140 + // Write all generated files
141 + yield* pipe(
142 + Effect.all(
143 + sources.map(([filePath, content]) =>
144 + fs
145 + .writeFileString(filePath, content)
146 + .pipe(Effect.mapError(error => new Error(`Failed to write file ${filePath}: ${error}`)))
147 + ),
148 + { concurrency: 'unbounded' }
149 + ),
150 + Effect.mapError(error => new Error(`Failed to write generated files: ${error}`))
151 + );
152 +
153 + // Compile TypeScript to JavaScript if needed
154 + if (transpiled) {
155 + yield* pipe(
156 + transpileTypeScriptSources({ sources, outputDir }),
157 + Effect.catchAll(error =>
158 + Effect.logWarning(`Failed to compile TypeScript files: ${error.message}`)
159 + )
160 + );
161 + }
162
71 - yield* Effect.all(sources.map(([filePath, content]) => fs.writeFileString(filePath, content)));
163 + yield* Option.isNone(outputOpt)
164 + ? Console.log(
165 + '✅ Type stubs generated successfully.\n' +
166 + 'You can now import generated types via `import { composio } from "@composio/core/generated"`'
167 + )
168 + : Console.log(
169 + `✅ Type stubs generated successfully.\n` +
170 + `Generated files are available at: ${outputDir}`
171 + );
172
73 - return yield* Console.log('✅ Type stubs generated successfully.');
173 + return outputDir;
174 });
175 }
ts/packages/cli/src/effects/find-composio-core-generated.ts new
+130
@@ -0,0 +1,130 @@
1 +import path from 'node:path';
2 +import { Command, FileSystem } from '@effect/platform';
3 +import { Data, Effect, Match, Option } from 'effect';
4 +import {
5 + JsPackageManagerDetector,
6 + type PackageManager,
7 +} from 'src/services/js-package-manager-detector';
8 +
9 +export class ComposioCorePkgNotFound extends Data.TaggedError('error/ComposioCorePkgNotFound')<{
10 + readonly message: string;
11 + readonly cause: string;
12 + readonly fix?: string;
13 +}> {}
14 +
15 +export function pyFindComposioCoreGenerated(cwd: string) {
16 + return Effect.gen(function* () {
17 + /**
18 + * Returns a `ComposioCorePkgNotFound` error with the given message and cause.
19 + * It lazily identifies the package manager used by the user to tell them how to install `@composio/core`.
20 + */
21 + const onError = (message: string) => (e: Error | string) =>
22 + Effect.gen(function* () {
23 + yield* Effect.logDebug('Identifying JS package manager...');
24 + const pkgManagerDetector = yield* JsPackageManagerDetector;
25 + const pkgManager = yield* pkgManagerDetector.detectJsPackageManager(cwd).pipe(
26 + Effect.andThen(pkgManager => pkgManager),
27 + Effect.tapError(e => Effect.logError(e)),
28 + Effect.catchAll(() => Effect.succeed('npm' as PackageManager))
29 + );
30 +
31 + yield* Effect.logDebug({ pkgManager });
32 +
33 + const installCmd = `uv pip install`;
34 +
35 + const fix = `Install \`composio-core\` with \`${installCmd} composio-core\`, or specify an output directory using \`--output-dir\``;
36 +
37 + return yield* Effect.fail(
38 + new ComposioCorePkgNotFound({
39 + cause: e instanceof Error ? e.message : e,
40 + fix,
41 + message,
42 + })
43 + );
44 + }) satisfies Effect.Effect<never, ComposioCorePkgNotFound, JsPackageManagerDetector>;
45 +
46 + // Try to find `composio-core` in the current `uv` environment
47 + // Try to find `composio-core` in the current `uv` environment
48 + const [cmd, ...args] = [
49 + 'uv',
50 + 'run',
51 + '--active',
52 + 'python',
53 + '-c',
54 + 'import composio; print(composio.__file__)',
55 + ];
56 +
57 + const stdout = yield* Command.make(cmd, ...args).pipe(
58 + Command.string,
59 + Effect.catchAll(e => onError('Failed to locate composio-core in uv environment')(e))
60 + );
61 +
62 + yield* Effect.logDebug({ stdout, cmd: [cmd, ...args].join(' ') });
63 +
64 + const composioCorePath = path.dirname(stdout);
65 + yield* Effect.logDebug({ composioCorePath });
66 +
67 + return composioCorePath;
68 + }) satisfies Effect.Effect<string, ComposioCorePkgNotFound, unknown>;
69 +}
70 +
71 +/**
72 + * Returns the path to `@composio/core/generated` inside the user's project, if it exists.
73 + * The search is scoped to the given current working directory.
74 + */
75 +export function jsFindComposioCoreGenerated(cwd: string) {
76 + return Effect.gen(function* () {
77 + /**
78 + * Returns a `ComposioCorePkgNotFound` error with the given message and cause.
79 + * It lazily identifies the package manager used by the user to tell them how to install `@composio/core`.
80 + */
81 + const onError = (message: string) => (e: Error | string) =>
82 + Effect.gen(function* () {
83 + yield* Effect.logDebug('Identifying JS package manager...');
84 + const pkgManagerDetector = yield* JsPackageManagerDetector;
85 + const pkgManager = yield* pkgManagerDetector.detectJsPackageManager(cwd).pipe(
86 + Effect.andThen(pkgManager => pkgManager),
87 + Effect.tapError(e => Effect.logError(e)),
88 + Effect.catchAll(() => Effect.succeed('npm' as PackageManager))
89 + );
90 +
91 + yield* Effect.logDebug({ pkgManager });
92 +
93 + const installCmd = Match.value(pkgManager).pipe(
94 + Match.when('pnpm', () => 'pnpm add'),
95 + Match.when('bun', () => 'bun add'),
96 + Match.when('yarn', () => 'yarn add'),
97 + Match.when('npm', () => 'npm install -S'),
98 + Match.exhaustive
99 + );
100 +
101 + const fix = `Install @composio/core with \`${installCmd} @composio/core\`, or specify an output directory using \`--output-dir\``;
102 +
103 + return yield* Effect.fail(
104 + new ComposioCorePkgNotFound({
105 + cause: e instanceof Error ? e.message : e,
106 + fix,
107 + message,
108 + })
109 + );
110 + }) satisfies Effect.Effect<never, ComposioCorePkgNotFound, JsPackageManagerDetector>;
111 +
112 + const fs = yield* FileSystem.FileSystem;
113 +
114 + // First, try to find @composio/core in node_modules
115 + const nodeModulesPath = path.join(cwd, 'node_modules', '@composio', 'core');
116 + const nodeModulesExists = yield* fs
117 + .exists(nodeModulesPath)
118 + .pipe(
119 + Effect.catchAll(e =>
120 + Effect.flip(onError('@composio/core not readable in `node_modules`')(e))
121 + )
122 + );
123 +
124 + if (nodeModulesExists) {
125 + return path.join(nodeModulesPath, 'generated');
126 + }
127 +
128 + return yield* onError('@composio/core not found')('@composio/core not installed');
129 + }) satisfies Effect.Effect<string, ComposioCorePkgNotFound, unknown>;
130 +}
ts/packages/cli/src/generation/constants.ts new
+1
@@ -0,0 +1 @@
1 +export const BANNER = 'Auto-generated by Composio CLI. Do not modify manually.';
ts/packages/cli/src/generation/python/generate-toolkit-sources.ts
+36 -31
@@ -20,49 +20,53 @@
20
21 import { pipe, Record } from 'effect';
22 import type { ToolkitName } from 'src/models/toolkits';
23 -import type { ToolkitIndex, ToolkitIndexData } from '../create-toolkit-index';
24 -
25 -type SourceFile = [filename: string, content: string];
23 +import type { ToolkitIndex, ToolkitIndexData } from 'src/generation/create-toolkit-index';
24 +import type { SourceFile } from 'src/generation/types';
25
26 /**
27 * Generates a list of Python source files that should be written to disk by the caller.
28 */
30 -export function generatePythonToolkitSources(index: ToolkitIndex): Array<SourceFile> {
31 - return pipe(index, Record.mapEntries(generatePythonToolkitSource), Record.toEntries);
29 +export function generatePythonToolkitSources(banner: string) {
30 + return (index: ToolkitIndex): Array<SourceFile> => {
31 + const toolkitSources = pipe(
32 + index,
33 + Record.mapEntries(generatePythonToolkitSource(banner)),
34 + Record.toEntries
35 + );
36 +
37 + return toolkitSources;
38 + };
39 }
40
34 -function generatePythonToolkitSource(
35 - toolkit: ToolkitIndexData,
36 - toolkitName: ToolkitName
37 -): SourceFile {
38 - const filename = `${toolkit.slug}.py`;
41 +function generatePythonToolkitSource(banner: string) {
42 + return (toolkit: ToolkitIndexData, toolkitName: ToolkitName): SourceFile => {
43 + const filename = `${toolkit.slug}.py`;
44
40 - const toolsEntries = (spacing: number) => {
41 - const spacePad = ' '.repeat(spacing);
45 + const toolsEntries = (spacing: number) => {
46 + const spacePad = ' '.repeat(spacing);
47
43 - if (Record.size(toolkit.tools) > 0) {
44 - return Object.entries(toolkit.tools)
45 - .map(([toolName, toolValue]) => `${spacePad}${toolName} = "${toolValue}"`)
46 - .join('\n');
47 - }
48 + if (Record.size(toolkit.tools) > 0) {
49 + return Object.entries(toolkit.tools)
50 + .map(([toolName, toolValue]) => `${spacePad}${toolName} = "${toolValue}"`)
51 + .join('\n');
52 + }
53
49 - return `${spacePad}pass`;
50 - };
54 + return `${spacePad}pass`;
55 + };
56
52 - const triggerTypesEntries = (spacing: number) => {
53 - const spacePad = ' '.repeat(spacing);
57 + const triggerTypesEntries = (spacing: number) => {
58 + const spacePad = ' '.repeat(spacing);
59
55 - if (Record.size(toolkit.triggerTypes) > 0) {
56 - return Object.entries(toolkit.triggerTypes)
57 - .map(([triggerName, triggerValue]) => `${spacePad}${triggerName} = "${triggerValue}"`)
58 - .join('\n');
59 - }
60 + if (Record.size(toolkit.triggerTypes) > 0) {
61 + return Object.entries(toolkit.triggerTypes)
62 + .map(([triggerName, triggerValue]) => `${spacePad}${triggerName} = "${triggerValue}"`)
63 + .join('\n');
64 + }
65
61 - return `${spacePad}pass`;
62 - };
66 + return `${spacePad}pass`;
67 + };
68
64 - const filesource = `# Auto-generated by Composio CLI via \`composio py generate\`.
65 -# Do not modify manually.
69 + const filesource = `# ${banner}.
70
71 class ${toolkitName}:
72 """Map of Composio's ${toolkitName} toolkit."""
@@ -76,5 +80,6 @@ ${toolsEntries(8)}
80 ${triggerTypesEntries(8)}
81 `;
82
79 - return [filename, filesource];
83 + return [filename, filesource];
84 + };
85 }
ts/packages/cli/src/generation/python/generate.ts new
+21
@@ -0,0 +1,21 @@
1 +import path from 'node:path';
2 +import type { ToolkitIndex } from 'src/generation/create-toolkit-index';
3 +import type { SourceFile } from 'src/generation/types';
4 +import { generatePythonToolkitSources } from './generate-toolkit-sources';
5 +
6 +type GeneratePythonSourcesParams = {
7 + banner: string;
8 + outputDir: string;
9 +};
10 +
11 +export function generatePythonSources(params: GeneratePythonSourcesParams) {
12 + return (index: ToolkitIndex): Array<SourceFile> => {
13 + const toolkiteSources = generatePythonToolkitSources(params.banner)(index);
14 +
15 + return [
16 + ...toolkiteSources.map(
17 + ([filename, content]) => [path.join(params.outputDir, filename), content] as const
18 + ),
19 + ] as const;
20 + };
21 +}
ts/packages/cli/src/generation/types.ts new
+1
@@ -0,0 +1 @@
1 +export type SourceFile = readonly [filename: string, content: string];
ts/packages/cli/src/generation/typescript/generate-index-source.ts
+8 -5
@@ -25,14 +25,15 @@
25
26 import * as ts from '@composio/ts-builders';
27 import { pipe, Record, Array as Arr } from 'effect';
28 -import type { ToolkitIndex } from '../create-toolkit-index';
28 +import type { ToolkitIndex } from 'src/generation/create-toolkit-index';
29
30 -type generateTypeScriptIndexMapSourceParams = {
30 +type GenerateTypeScriptIndexMapSourceParams = {
31 banner: string;
32 emitSingleFile: boolean;
33 + importExtension: 'ts' | 'js';
34 };
35
35 -export function generateIndexSource(params: generateTypeScriptIndexMapSourceParams) {
36 +export function generateIndexSource(params: GenerateTypeScriptIndexMapSourceParams) {
37 return (index: ToolkitIndex) => {
38 const indexMap = generateTypeScriptIndexMapSource(params)(index);
39 const toolkitUnionType = generateToolkitUnionType(index);
@@ -57,7 +58,7 @@ ${toolsByToolkitType}
58 /**
59 * Generates a list of Python source files that should be written to disk by the caller.
60 */
60 -export function generateTypeScriptIndexMapSource(params: generateTypeScriptIndexMapSourceParams) {
61 +export function generateTypeScriptIndexMapSource(params: GenerateTypeScriptIndexMapSourceParams) {
62 return (index: ToolkitIndex): string => {
63 const indexMapEntries = pipe(
64 index,
@@ -74,7 +75,9 @@ export function generateTypeScriptIndexMapSource(params: generateTypeScriptIndex
75 break;
76 }
77
77 - indexMapFile.addImport(ts.moduleImport(`./${value.slug}.ts`).named(toolkitName));
78 + indexMapFile.addImport(
79 + ts.moduleImport(`./${value.slug}.${params.importExtension}`).named(toolkitName)
80 + );
81 }
82
83 indexMapFile.add(
ts/packages/cli/src/generation/typescript/generate-toolkit-sources.ts
+6 -13
@@ -26,24 +26,17 @@
26 import * as ts from '@composio/ts-builders';
27 import { pipe, Record } from 'effect';
28 import type { ToolkitName } from 'src/models/toolkits';
29 -import type { ToolkitIndex, ToolkitIndexData } from '../create-toolkit-index';
30 -
31 -type SourceFile = [filename: string, content: string];
32 -
33 -type GenerateTypeScriptToolkitSourcesInput = {
34 - banner: string;
35 - emitSingleFile: boolean;
36 - outputDir: string;
37 -};
29 +import type { ToolkitIndex, ToolkitIndexData } from 'src/generation/create-toolkit-index';
30 +import type { SourceFile } from 'src/generation/types';
31
32 /**
40 - * Generates a list of Python source files that should be written to disk by the caller.
33 + * Generates a list of TypeScript source files that should be written to disk by the caller.
34 */
42 -export function generateTypeScriptToolkitSources(params: GenerateTypeScriptToolkitSourcesInput) {
35 +export function generateTypeScriptToolkitSources(banner: string) {
36 return (index: ToolkitIndex): Array<SourceFile> => {
37 const toolkitSources = pipe(
38 index,
46 - Record.mapEntries(generateTypeScriptToolkitSource(params)),
39 + Record.mapEntries(generateTypeScriptToolkitSource(banner)),
40 Record.toEntries
41 );
42
@@ -51,7 +44,7 @@ export function generateTypeScriptToolkitSources(params: GenerateTypeScriptToolk
44 };
45 }
46
54 -function generateTypeScriptToolkitSource(_params: GenerateTypeScriptToolkitSourcesInput) {
47 +function generateTypeScriptToolkitSource(_banner: string) {
48 return (
49 { slug, tools, triggerTypes }: ToolkitIndexData,
50 toolkitName: ToolkitName
ts/packages/cli/src/generation/typescript/generate.ts
+5 -2
@@ -4,15 +4,18 @@ import type { ToolkitIndex } from 'src/generation/create-toolkit-index';
4 import { generateTypeScriptToolkitSources } from './generate-toolkit-sources';
5 import { generateIndexSource } from './generate-index-source';
6
7 +type SourceFile = readonly [filename: string, content: string];
8 +
9 type GenerateTypeScriptSourcesParams = {
10 banner: string;
11 emitSingleFile: boolean;
12 outputDir: string;
13 + importExtension: 'ts' | 'js';
14 };
15
16 export function generateTypeScriptSources(params: GenerateTypeScriptSourcesParams) {
14 - return (index: ToolkitIndex): Array<readonly [string, string]> => {
15 - const toolkiteSources = generateTypeScriptToolkitSources(params)(index);
17 + return (index: ToolkitIndex): Array<SourceFile> => {
18 + const toolkiteSources = generateTypeScriptToolkitSources(params.banner)(index);
19
20 const indexSource = generateIndexSource(params)(index);
21 const indexFilename = path.join(params.outputDir, 'index.ts');
ts/packages/cli/src/generation/typescript/transpile.ts new
+90
@@ -0,0 +1,90 @@
1 +import ts from 'typescript';
2 +import { Effect, Data } from 'effect';
3 +
4 +export class TypeScriptTranspileError extends Data.TaggedError('error/TypeScriptTranspileError')<{
5 + readonly message: string;
6 + readonly cause: string;
7 +}> {}
8 +
9 +type TranspileTypeScriptFilesParams = {
10 + sources: (readonly [filePath: string, content: string])[];
11 + outputDir: string;
12 +};
13 +
14 +/**
15 + * Compiles TypeScript files to JavaScript using the TypeScript compiler.
16 + * TODO: unify with `test/__utils__/typescript-compiler.ts`.
17 + */
18 +export function transpileTypeScriptSources({ sources, outputDir }: TranspileTypeScriptFilesParams) {
19 + return Effect.gen(function* () {
20 + const compilerOptions = {
21 + target: ts.ScriptTarget.ES2022,
22 + module: ts.ModuleKind.NodeNext,
23 + moduleResolution: ts.ModuleResolutionKind.NodeNext,
24 + esModuleInterop: true,
25 + skipLibCheck: true,
26 + outDir: outputDir,
27 + rootDir: outputDir,
28 + declaration: true,
29 + emitDeclarationOnly: false,
30 + noEmitOnError: true,
31 + } satisfies ts.CompilerOptions;
32 +
33 + const virtualFileMap = new Map(
34 + sources.map(
35 + ([filename, code]) =>
36 + [
37 + filename,
38 + ts.createSourceFile(filename, code, compilerOptions.target, true, ts.ScriptKind.TS),
39 + ] as const
40 + )
41 + );
42 + const virtualFileNames = Array.from(virtualFileMap.keys());
43 + const tsFiles = sources.map(([filePath, _]) => filePath);
44 +
45 + if (tsFiles.length === 0) {
46 + return yield* Effect.void;
47 + }
48 +
49 + const tsHost = ts.createCompilerHost(compilerOptions);
50 + const ogGetSourceFile = tsHost.getSourceFile;
51 + tsHost.getSourceFile = (filename, languageVersion, onError, shouldCreateNewSourceFile) => {
52 + if (virtualFileMap.has(filename)) {
53 + return virtualFileMap.get(filename);
54 + }
55 +
56 + return ogGetSourceFile(filename, languageVersion, onError, shouldCreateNewSourceFile);
57 + };
58 +
59 + const program = ts.createProgram(virtualFileNames, compilerOptions, tsHost);
60 + const emitResult = program.emit();
61 +
62 + // Check for syntax or semantic errors
63 + const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
64 +
65 + if (diagnostics.length > 0) {
66 + const formatDiagnostic = (diagnostic: ts.Diagnostic): string => {
67 + if (diagnostic.file && diagnostic.start !== undefined) {
68 + const { line, character } = ts.getLineAndCharacterOfPosition(
69 + diagnostic.file,
70 + diagnostic.start
71 + );
72 + const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
73 + return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
74 + } else {
75 + return ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
76 + }
77 + };
78 +
79 + const errorMessages = diagnostics.map(d => formatDiagnostic(d)).join('\n');
80 + return yield* Effect.fail(
81 + new TypeScriptTranspileError({
82 + message: `TypeScript compilation failed`,
83 + cause: errorMessages,
84 + })
85 + );
86 + }
87 +
88 + return yield* Effect.void;
89 + });
90 +}
ts/packages/cli/src/models/toolkits.ts
+1 -1
@@ -3,7 +3,7 @@ import { JSONTransformSchema } from './utils/json-transform-schema';
3
4 export const Toolkit = Schema.Struct({
5 name: Schema.String, // "Gmail"
6 - slug: Schema.String, // "gmail"
6 + slug: Schema.Trim.pipe(Schema.nonEmptyString()), // "gmail"
7 auth_schemes: Schema.Array(Schema.String), // [ "OAUTH2", "BEARER_TOKEN" ]
8 composio_managed_auth_schemes: Schema.Array(Schema.String), // [ "OAUTH2" ]
9 is_local_toolkit: Schema.Boolean,
ts/packages/cli/src/services/composio-clients.ts
+6
@@ -155,6 +155,12 @@ export class ComposioToolkitsRepository extends Effect.Service<ComposioToolkitsR
155
156 return {
157 getToolkits: () =>
158 + // Effect.succeed([
159 + // {
160 + // slug: 'gmail',
161 + // name: 'GMAIL',
162 + // } as unknown as Toolkit,
163 + // ]),
164 client.toolkits.list().pipe(
165 Effect.map(response => response.items),
166 Effect.flatMap(toolkits =>
ts/packages/cli/src/services/env-lang-detector.ts
+3 -1
@@ -13,7 +13,9 @@ export class EnvLangDetector extends Effect.Service<EnvLangDetector>()('services
13 const fs = yield* FileSystem.FileSystem;
14
15 return {
16 - detectEnvLanguage: (cwd: string) =>
16 + detectEnvLanguage: (
17 + cwd: string
18 + ): Effect.Effect<'TypeScript' | 'Python', EnvLangDetectorError, never> =>
19 Effect.gen(function* () {
20 const files = yield* pipe(
21 fs.readDirectory(cwd),
ts/packages/cli/src/services/js-package-manager-detector.ts new
+156
@@ -0,0 +1,156 @@
1 +import { BunFileSystem } from '@effect/platform-bun';
2 +import { Data, Effect, Option, Schema, pipe } from 'effect';
3 +import { FileSystem } from '@effect/platform';
4 +import * as path from 'path';
5 +
6 +const toError = (e: unknown): Error => (e instanceof Error ? e : new Error(String(e)));
7 +
8 +/**
9 + * Error thrown when a package manager detection fails.
10 + */
11 +export class JsPackageManagerError extends Data.TaggedError('services/JsPackageManagerError')<{
12 + readonly cause: Error;
13 + readonly message: string;
14 +}> {}
15 +
16 +/**
17 + * Valid JavaScript package manager names recognised by Composio.
18 + */
19 +export type PackageManager = 'pnpm' | 'bun' | 'yarn' | 'npm';
20 +
21 +const LOCK_FILES: Record<PackageManager, string> = {
22 + pnpm: 'pnpm-lock.yaml',
23 + bun: 'bun.lockb',
24 + yarn: 'yarn.lock',
25 + npm: 'package-lock.json',
26 +};
27 +
28 +const PM_PREFERENCE: PackageManager[] = ['pnpm', 'bun', 'yarn', 'npm'];
29 +
30 +// Service that attempts to detect the package manager of the project in the current working directory.
31 +export class JsPackageManagerDetector extends Effect.Service<JsPackageManagerDetector>()(
32 + 'services/JsPackageManagerDetector',
33 + {
34 + accessors: true,
35 + effect: Effect.gen(function* () {
36 + yield* Effect.logDebug('[JsPackageManagerDetector] Identifying JS package manager...');
37 +
38 + const fs = yield* FileSystem.FileSystem;
39 +
40 + const parsePackageManager = (pm: string): Option.Option<PackageManager> => {
41 + if (pm.startsWith('pnpm@')) return Option.some('pnpm');
42 + if (pm.startsWith('bun@')) return Option.some('bun');
43 + if (pm.startsWith('yarn@')) return Option.some('yarn');
44 + if (pm.startsWith('npm@')) return Option.some('npm');
45 + return Option.none();
46 + };
47 +
48 + const PackageJsonSchema = Schema.Struct({
49 + packageManager: Schema.optional(Schema.String),
50 + }).annotations({ identifier: 'package.json' });
51 +
52 + const detectFromPackageJson = (
53 + cwd: string
54 + ): Effect.Effect<Option.Option<PackageManager>, JsPackageManagerError> =>
55 + Effect.gen(function* () {
56 + const contentEffect = pipe(
57 + fs.readFileString(path.join(cwd, 'package.json')),
58 + Effect.catchTag('SystemError', e =>
59 + Effect.fail(
60 + new JsPackageManagerError({ cause: e, message: 'Failed to read package.json' })
61 + )
62 + )
63 + );
64 +
65 + const content = yield* Effect.option(contentEffect);
66 +
67 + if (Option.isNone(content)) {
68 + return Option.none();
69 + }
70 +
71 + const json = yield* Effect.try({
72 + try: () => JSON.parse(content.value) as unknown,
73 + catch: e =>
74 + new JsPackageManagerError({
75 + cause: toError(e),
76 + message: 'Failed to parse package.json',
77 + }),
78 + });
79 +
80 + const decoded = yield* pipe(
81 + Schema.decodeUnknown(PackageJsonSchema)(json),
82 + Effect.mapError(
83 + e =>
84 + new JsPackageManagerError({
85 + cause: toError(e),
86 + message: 'Failed to decode package.json',
87 + })
88 + )
89 + );
90 +
91 + return Option.fromNullable(decoded.packageManager).pipe(
92 + Option.flatMap(parsePackageManager)
93 + );
94 + });
95 +
96 + const detectRecursive = (
97 + cwd: string
98 + ): Effect.Effect<Option.Option<PackageManager>, JsPackageManagerError> =>
99 + Effect.gen(function* () {
100 + const fromPackageJson = yield* detectFromPackageJson(cwd);
101 + if (Option.isSome(fromPackageJson)) {
102 + return fromPackageJson;
103 + }
104 +
105 + const parentDir = path.dirname(cwd);
106 + if (parentDir === cwd) {
107 + return Option.none();
108 + }
109 +
110 + return yield* detectRecursive(parentDir);
111 + });
112 +
113 + const detectJsPackageManager = (
114 + cwd: string
115 + ): Effect.Effect<PackageManager, JsPackageManagerError> =>
116 + Effect.gen(function* () {
117 + const files = yield* pipe(
118 + fs.readDirectory(cwd),
119 + Effect.mapError(
120 + e =>
121 + new JsPackageManagerError({
122 + cause: toError(e),
123 + message: `Failed to read directory ${cwd}`,
124 + })
125 + )
126 + );
127 +
128 + const fileNames = files.map(f => f.toLowerCase());
129 +
130 + for (const pm of PM_PREFERENCE) {
131 + if (fileNames.includes(LOCK_FILES[pm])) {
132 + return pm;
133 + }
134 + }
135 +
136 + const result = yield* detectRecursive(cwd);
137 +
138 + if (Option.isSome(result)) {
139 + return result.value;
140 + }
141 +
142 + return yield* Effect.fail(
143 + new JsPackageManagerError({
144 + cause: new Error('Recursive lookup exhausted'),
145 + message: 'Failed to detect package manager',
146 + })
147 + );
148 + });
149 +
150 + return {
151 + detectJsPackageManager,
152 + };
153 + }),
154 + dependencies: [BunFileSystem.layer],
155 + }
156 +) {}
ts/packages/cli/test/__fixtures__/python-project-with-composio-core/.python-version new
+1
@@ -0,0 +1 @@
1 +3.12
ts/packages/cli/test/__fixtures__/python-project-with-composio-core/main.py new
+6
@@ -0,0 +1,6 @@
1 +def main():
2 + print("Hello from python-project-with-composio-core!")
3 +
4 +
5 +if __name__ == "__main__":
6 + main()
ts/packages/cli/test/__fixtures__/python-project-with-composio-core/pyproject.toml new
+7
@@ -0,0 +1,7 @@
1 +[project]
2 +name = "python-project-with-composio-core"
3 +version = "0.1.0"
4 +description = "Add your description here"
5 +readme = "README.md"
6 +requires-python = ">=3.12, <4"
7 +dependencies = []
ts/packages/cli/test/__fixtures__/python-project-with-composio-core/requirements.txt new
+1
@@ -0,0 +1 @@
1 +composio_core
ts/packages/cli/test/__fixtures__/python-project-with-composio-core/setup.sh new
+13
@@ -0,0 +1,13 @@
1 +#!/bin/bash
2 +
3 +set -e -o pipefail
4 +
5 +# uv init
6 +
7 +uv venv
8 +source .venv/bin/activate
9 +uv pip install --requirements requirements.txt;
10 +
11 +uv run --active python -c "import composio; print (composio.__file__)"
12 +
13 +# deactivate
ts/packages/cli/test/__fixtures__/typescript-project-with-composio-core/bun.lock new
+18
@@ -0,0 +1,18 @@
1 +{
2 + "lockfileVersion": 1,
3 + "workspaces": {
4 + "": {
5 + "dependencies": {
6 + "@composio/core": "link:../../../../core",
7 + },
8 + "devDependencies": {
9 + "typescript": "^5.8.3",
10 + },
11 + },
12 + },
13 + "packages": {
14 + "@composio/core": ["@composio/core@link:../../../../core", {}],
15 +
16 + "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
17 + }
18 +}
ts/packages/cli/test/__fixtures__/typescript-project-with-composio-core/package.json new
+9
@@ -0,0 +1,9 @@
1 +{
2 + "type": "module",
3 + "devDependencies": {
4 + "typescript": "^5.8.3"
5 + },
6 + "dependencies": {
7 + "@composio/core": "link:../../../../core"
8 + }
9 +}
ts/packages/cli/test/__fixtures__/typescript-project-with-composio-core/pnpm-lock.yaml new
+28
@@ -0,0 +1,28 @@
1 +lockfileVersion: '9.0'
2 +
3 +settings:
4 + autoInstallPeers: true
5 + excludeLinksFromLockfile: false
6 +
7 +importers:
8 +
9 + .:
10 + dependencies:
11 + '@composio/core':
12 + specifier: link:../../../../core
13 + version: link:../../../../core
14 + devDependencies:
15 + typescript:
16 + specifier: ^5.8.3
17 + version: 5.8.3
18 +
19 +packages:
20 +
21 + typescript@5.8.3:
22 + resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==}
23 + engines: {node: '>=14.17'}
24 + hasBin: true
25 +
26 +snapshots:
27 +
28 + typescript@5.8.3: {}
ts/packages/cli/test/__fixtures__/typescript-project-with-composio-core/src/index.js new
+4
@@ -0,0 +1,4 @@
1 +import { composio } from '@composio/core/generated';
2 +
3 +console.log('Test: Using generated Composio types');
4 +console.log(composio.GMAIL.tools.CREATE_EMAIL_DRAFT);
ts/packages/cli/test/__fixtures__/typescript-project-with-composio-core/tsconfig.json new
+20
@@ -0,0 +1,20 @@
1 +{
2 + "compilerOptions": {
3 + "target": "ESNext",
4 + "module": "ESNext",
5 + "declaration": true,
6 + "outDir": "./dist",
7 + "rootDir": "./src",
8 + "paths": {
9 + "src/*": ["./src/*"],
10 + "test/*": ["./test/*"]
11 + },
12 + "strict": true,
13 + "esModuleInterop": true,
14 + "moduleResolution": "node",
15 + "skipLibCheck": true,
16 + "resolveJsonModule": true
17 + },
18 + "include": ["src"],
19 + "exclude": ["**/dist", "**/node_modules", "test/__fixtures__/**"]
20 +}
ts/packages/cli/test/__utils__/index.ts
+1 -1
@@ -2,6 +2,6 @@ import pkg from '../../package.json' with { type: 'json' };
2
3 export * as MockConsole from './services/mock-console';
4 export * as MockTerminal from './services/mock-terminal';
5 -export { TestLayer as TestLive, runEffect } from './services/test-layer';
5 +export { TestLayer as TestLive } from './services/test-layer';
6 export { cli } from './cli';
7 export { pkg };
ts/packages/cli/test/__utils__/services/mock-console.ts
+11 -1
@@ -4,6 +4,7 @@ import * as Array from 'effect/Array';
4 import * as Console from 'effect/Console';
5 import * as Context from 'effect/Context';
6 import * as Effect from 'effect/Effect';
7 +import * as Layer from 'effect/Layer';
8 import * as Ref from 'effect/Ref';
9
10 export interface MockConsole extends Console.Console {
@@ -49,8 +50,11 @@ export const make = Effect.gen(function* () {
50 return Ref.update(lines, Array.appendAll(args));
51 };
52
53 + const clear: MockConsole['clear'] = Ref.update(lines, Array.empty);
54 +
55 return MockConsole.of({
56 [Console.TypeId]: Console.TypeId,
57 + clear,
58 getLines,
59 log,
60 info,
@@ -58,7 +62,6 @@ export const make = Effect.gen(function* () {
62 error,
63 unsafe: globalThis.console,
64 assert: () => Effect.void,
61 - clear: Effect.void,
65 count: () => Effect.void,
66 countReset: () => Effect.void,
67 debug: () => Effect.void,
@@ -74,6 +77,13 @@ export const make = Effect.gen(function* () {
77 });
78 });
79
80 +export const effect = Effect.gen(function* () {
81 + yield* Effect.addFinalizer(() => Console.clear);
82 + return yield* make;
83 +});
84 +
85 +export const layer = Layer.scoped(MockConsole, effect);
86 +
87 export const getLines = (
88 params?: Partial<{
89 readonly stripAnsi?: boolean;
ts/packages/cli/test/__utils__/services/test-layer.ts
+9 -7
@@ -14,6 +14,7 @@ import {
14 ComposioToolkitsRepository,
15 } from 'src/services/composio-clients';
16 import { EnvLangDetector } from 'src/services/env-lang-detector';
17 +import { JsPackageManagerDetector } from 'src/services/js-package-manager-detector';
18 import type { Tools } from 'src/models/tools';
19 import type { TriggerTypes } from 'src/models/trigger-types';
20
@@ -72,15 +73,16 @@ export const TestLayer = (input?: TestLiveInput) =>
73 });
74 const NodeProcessTest = Layer.succeed(NodeProcess, nodeProcessTest);
75
75 - const MockConsoleTestLive = yield* MockConsole.make;
76 + const _console = yield* MockConsole.effect;
77
78 const layers = Layer.mergeAll(
78 - Console.setConsole(MockConsoleTestLive),
79 + Console.setConsole(_console),
80 NodeProcessTest,
81 CliConfigLive,
82 ComposioSessionRepositoryTest,
83 ComposioToolkitsRepositoryTest,
84 EnvLangDetector.Default,
85 + JsPackageManagerDetector.Default,
86 BunFileSystem.layer,
87 BunContext.layer,
88 MockTerminal.layer,
@@ -88,13 +90,13 @@ export const TestLayer = (input?: TestLiveInput) =>
90 );
91
92 return layers;
91 - }).pipe(Logger.withMinimumLogLevel(LogLevel.Info), Layer.unwrapEffect);
93 + }).pipe(Logger.withMinimumLogLevel(LogLevel.Info), Effect.scoped, Layer.unwrapEffect);
94
95 // Run @effect/vitest suite with TestLive layer
94 -export const runEffect =
95 - (input?: TestLiveInput) =>
96 - <E, A>(self: Effect.Effect<A, E, CliApp.CliApp.Environment>): Promise<A> =>
97 - Effect.provide(self, TestLayer(input)).pipe(Effect.runPromise);
96 +// export const runEffect =
97 +// (input?: TestLiveInput) =>
98 +// <E, A>(self: Effect.Effect<A, E, CliApp.CliApp.Environment>): Promise<A> =>
99 +// Effect.provide(self, TestLayer(input)).pipe(Effect.scoped, Effect.runPromise);
100
101 function setupFixtureFolder({ fixture, tempDir }: { fixture?: string; tempDir: string }) {
102 return Effect.gen(function* () {
ts/packages/cli/test/__utils__/typescript-compiler.ts
+39
@@ -1,5 +1,9 @@
1 +import path from 'node:path';
2 import { describe, it, expect } from 'vitest';
3 +import { Effect, Stream, String } from 'effect';
4 +import { Command } from '@effect/platform';
5 import ts from 'typescript';
6 +import { cwd } from 'node:process';
7
8 interface AssertTypeScriptIsValidInput {
9 files: {
@@ -59,6 +63,41 @@ export function assertTypeScriptIsValid({ files }: AssertTypeScriptIsValidInput)
63 expect(diagnostics).toEqual([]);
64 }
65
66 +type AssertTranspiledTypeScriptIsValidInput = {
67 + cwd: string;
68 + testSourceCodePath: string;
69 +};
70 +
71 +export function assertTranspiledTypeScriptIsValid({
72 + cwd,
73 + testSourceCodePath,
74 +}: AssertTranspiledTypeScriptIsValidInput) {
75 + return Effect.gen(function* () {
76 + const installCmd = Command.make('node', testSourceCodePath);
77 + const [exitCode, stdout, stderr] = yield* installCmd.pipe(
78 + Command.workingDirectory(cwd),
79 + Command.start,
80 + Effect.andThen(process =>
81 + Effect.all(
82 + [
83 + // Wait for exit code
84 + process.exitCode,
85 + // Get stdout as lines
86 + process.stdout.pipe(Stream.decodeText(), Stream.runFold(String.empty, String.concat)),
87 + // Get stderr as lines
88 + process.stderr.pipe(Stream.decodeText(), Stream.runFold(String.empty, String.concat)),
89 + ],
90 + { concurrency: 3 }
91 + )
92 + )
93 + );
94 +
95 + expect(exitCode).toBe(0);
96 + expect(stderr).toBe('');
97 + return stdout;
98 + });
99 +}
100 +
101 if (import.meta.vitest) {
102 describe('assertTypeScriptIsValid', () => {
103 it('[Given] valid TypeScript code [Then] no errors are found', () => {
ts/packages/cli/test/__utils__/vitest.global-setup.ts new
+190
@@ -0,0 +1,190 @@
1 +import { BunFileSystem, BunContext } from '@effect/platform-bun';
2 +import { Command, FileSystem } from '@effect/platform';
3 +import { Effect, Option, Logger, LogLevel } from 'effect';
4 +import path from 'node:path';
5 +
6 +const __dirname = path.resolve(path.dirname(new URL(import.meta.url).pathname));
7 +
8 +/**
9 + * Sets up TypeScript fixtures by simulating `@composio/core` package installation via `pnpm`.
10 + * For all fixture folders containing a `package.json` with `@composio/core` in `dependencies` / `devDependencies`,
11 + * installs the package by copying the built files from dist to node_modules.
12 + */
13 +function setupFixturesTypeScript(fixturePaths: string[]) {
14 + return Effect.gen(function* () {
15 + const fs = yield* FileSystem.FileSystem;
16 +
17 + yield* Effect.all(
18 + fixturePaths.map(fixturePath => {
19 + const fixtureDirName = path.basename(fixturePath);
20 + return Effect.gen(function* () {
21 + // Check if package.json exists and contains @composio/core
22 + const packageJsonPath = path.join(fixturePath, 'package.json');
23 + const packageJsonExists = yield* fs.exists(packageJsonPath);
24 +
25 + if (!packageJsonExists) {
26 + yield* Effect.logDebug(`Skipping ${fixtureDirName}: no package.json found`);
27 + return;
28 + }
29 +
30 + // Read and parse package.json
31 + const packageJsonContent = yield* fs.readFileString(packageJsonPath);
32 + const packageJson = JSON.parse(packageJsonContent);
33 +
34 + // Check if @composio/core is in dependencies or devDependencies
35 + const hasComposioCore =
36 + (packageJson.dependencies && packageJson.dependencies['@composio/core']) ||
37 + (packageJson.devDependencies && packageJson.devDependencies['@composio/core']);
38 +
39 + if (!hasComposioCore) {
40 + yield* Effect.logDebug(
41 + `Skipping ${fixtureDirName}: no @composio/core dependency found`
42 + );
43 + return;
44 + }
45 +
46 + yield* Effect.logDebug(`Setting up @composio/core for fixture: ${fixtureDirName}`);
47 +
48 + // Clean up existing node_modules/@composio/core
49 + const nodeModulesDir = path.join(fixturePath, 'node_modules');
50 + yield* fs.remove(nodeModulesDir, { recursive: true, force: true });
51 +
52 + const installCmd = Command.make('pnpm', 'install', '--ignore-workspace');
53 + const exitCode = yield* installCmd.pipe(
54 + Command.workingDirectory(fixturePath),
55 + Command.stdout('inherit'),
56 + Command.stderr('inherit'),
57 + Command.exitCode
58 + );
59 +
60 + if (exitCode !== 0) {
61 + yield* Effect.logError(
62 + `Failed to install @composio/core for fixture: ${fixtureDirName}`
63 + );
64 + return;
65 + }
66 +
67 + yield* Effect.logDebug(
68 + `Successfully set up @composio/core for fixture: ${fixtureDirName}`
69 + );
70 + }).pipe(
71 + Effect.catchAll(error =>
72 + Effect.logError(`Failed to setup fixture ${fixtureDirName}: ${error}`)
73 + )
74 + );
75 + }),
76 + { concurrency: 4 }
77 + );
78 + });
79 +}
80 +
81 +/**
82 + * Sets up Python fixtures by simulating `composio_core` package installation via `uv pip`.
83 + * For all fixture folders containing a `requirements.txt` it sets up `uv venv` and installs
84 + * the required packages from the Internet.
85 + */
86 +function setupFixturesPython(fixturePaths: string[]) {
87 + return Effect.gen(function* () {
88 + const fs = yield* FileSystem.FileSystem;
89 +
90 + yield* Effect.all(
91 + fixturePaths.map(fixturePath => {
92 + const fixtureDirName = path.basename(fixturePath);
93 + return Effect.gen(function* () {
94 + // Check if requirements.txt exists
95 + const requirementsPath = path.join(fixturePath, 'requirements.txt');
96 + const requirementsExists = yield* fs.exists(requirementsPath);
97 +
98 + if (!requirementsExists) {
99 + yield* Effect.logDebug(`Skipping ${fixtureDirName}: no requirements.txt found`);
100 + return;
101 + }
102 +
103 + // Read and parse requirements.txt
104 + const requirementsContent = yield* fs.readFileString(requirementsPath);
105 + const requirementsTxt = requirementsContent.split('\n');
106 +
107 + // Check if @composio/core is in dependencies or devDependencies
108 + const hasComposioCore = requirementsTxt.includes('composio_core');
109 +
110 + if (!hasComposioCore) {
111 + yield* Effect.logDebug(
112 + `Skipping ${fixtureDirName}: no \`composio_core\` dependency found`
113 + );
114 + return;
115 + }
116 +
117 + const setupShPath = path.join(fixturePath, 'setup.sh');
118 + const setupShExists = yield* fs.exists(setupShPath);
119 +
120 + if (!setupShExists) {
121 + yield* Effect.logDebug(`Skipping ${fixtureDirName}: no setup.sh found`);
122 + return;
123 + }
124 +
125 + yield* Effect.logDebug(`Setting up \`uv\` for fixture: ${fixtureDirName}`);
126 +
127 + const installCmd = Command.make(setupShPath);
128 + const exitCode = yield* installCmd.pipe(
129 + Command.workingDirectory(fixturePath),
130 + Command.runInShell(true),
131 + Command.stdout('inherit'),
132 + Command.stderr('inherit'),
133 + Command.exitCode
134 + );
135 +
136 + if (exitCode !== 0) {
137 + yield* Effect.logError(
138 + `Failed to install @composio/core for fixture: ${fixtureDirName}`
139 + );
140 + return;
141 + }
142 +
143 + yield* Effect.logDebug(
144 + `Successfully set up @composio/core for fixture: ${fixtureDirName}`
145 + );
146 + }).pipe(
147 + Effect.catchAll(error =>
148 + Effect.logError(`Failed to setup fixture ${fixtureDirName}: ${error}`)
149 + )
150 + );
151 + }),
152 + { concurrency: 4 }
153 + );
154 + });
155 +}
156 +
157 +export async function setup() {
158 + const program = Effect.gen(function* () {
159 + // Path to the fixtures directory.
160 + // Note: we're using `__dirname` because `import.meta.resolve` is not yet available in Vitest.
161 + // See: https://github.com/vitest-dev/vitest/pull/5188.
162 + const fixturesDir = path.resolve(__dirname, '../__fixtures__');
163 + yield* Effect.logDebug(`Setting up TypeScript fixtures in ${fixturesDir}`);
164 +
165 + const fs = yield* FileSystem.FileSystem;
166 +
167 + // Get all fixture directories
168 + const fixtureEntries = yield* fs.readDirectory(fixturesDir);
169 +
170 + // Filter to only directories by checking each entry
171 + const fixtureDirNames: string[] = yield* Effect.all(
172 + fixtureEntries.map(entryName =>
173 + Effect.gen(function* () {
174 + const entryPath = path.join(fixturesDir, entryName);
175 + const stat = yield* fs.stat(entryPath);
176 + return stat.type === 'Directory' ? Option.some(entryPath) : Option.none<string>();
177 + }).pipe(Effect.catchAll(() => Effect.succeed(Option.none<string>())))
178 + )
179 + ).pipe(Effect.map(Option.all), Effect.map(Option.getOrElse(() => [] as string[])));
180 +
181 + yield* setupFixturesPython(fixtureDirNames);
182 + yield* setupFixturesTypeScript(fixtureDirNames);
183 + }).pipe(
184 + Effect.provide(BunFileSystem.layer),
185 + Effect.provide(BunContext.layer),
186 + Effect.provide(Logger.minimumLogLevel(LogLevel.Debug))
187 + );
188 +
189 + await Effect.runPromise(program);
190 +}
ts/packages/cli/test/src/commands/$default.cmd.test.ts
+37 -30
@@ -1,25 +1,28 @@
1 import { describe, expect, layer } from '@effect/vitest';
2 -import { Effect, Fiber } from 'effect';
2 +import { Effect } from 'effect';
3 import { ValidationError, HelpDoc } from '@effect/cli';
4 import { cli, pkg, TestLive, MockConsole } from 'test/__utils__';
5 import { sanitize } from 'test/__utils__/sanitize';
6
7 describe('CLI: composio', () => {
8 layer(TestLive())(it => {
9 - it.effect.skip('[Given] unknown argument [Then] print error message', () =>
9 + it.scoped('[Given] unknown argument [Then] print error message', () =>
10 Effect.gen(function* () {
11 const args = ['--bar'];
12 - const fiber = yield* Effect.fork(cli(args));
13 - yield* Fiber.join(fiber);
12
15 - const result = yield* Effect.flip(fiber);
13 + const result = yield* cli(args).pipe(Effect.catchAll(e => Effect.succeed(e)));
14 +
15 expect(result).toEqual(
17 - ValidationError.invalidValue(HelpDoc.p("Received unknown argument: '--bar'"))
16 + ValidationError.commandMismatch(
17 + HelpDoc.p("Invalid subcommand for composio - use 'version'")
18 + )
19 );
20 })
21 );
22 + });
23
22 - it.effect('[Given] --help flag [Then] prints help message', () =>
24 + layer(TestLive())(it => {
25 + it.scoped('[Given] --help flag [Then] prints help message', () =>
26 Effect.gen(function* () {
27 const args = ['--help'];
28 yield* cli(args);
@@ -55,27 +58,29 @@ describe('CLI: composio', () => {
58
59 COMMANDS
60
58 - - version Display your account information.
61 + - version Display your account information.
62
60 - - whoami Display your account information.
63 + - whoami Display your account information.
64
62 - - login Log in to the Composio SDK.
65 + - login Log in to the Composio SDK.
66
64 - - generate [(-o, --output-dir directory)] Updates the local type stubs with the latest app data, automatically detecting the language of the project in the current working directory (TypeScript | Python).
67 + - generate [(-o, --output-dir directory)] Updates the local type stubs with the latest app data, automatically detecting the language of the project in the current working directory (TypeScript | Python).
68
66 - - py Handle Python projects.
69 + - py Handle Python projects.
70
68 - - py generate [(-o, --output-dir directory)] Updates the local type stubs with the latest app data.
71 + - py generate [(-o, --output-dir directory)] Updates the local type stubs with the latest app data.
72
70 - - ts Handle TypeScript projects.
73 + - ts Handle TypeScript projects.
74
72 - - ts generate [(-o, --output-dir directory)] [--single-file] Updates the local type stubs with the latest app data.
75 + - ts generate [(-o, --output-dir directory)] [--compact] [--transpiled] Updates the local type stubs with the latest app data.
76 "
77 `);
78 })
79 );
80 + });
81
78 - it.effect("[Given] --version flag [Then] prints composio's version from package.json", () =>
82 + layer(TestLive())(it => {
83 + it.scoped("[Given] --version flag [Then] prints composio's version from package.json", () =>
84 Effect.gen(function* () {
85 const args = ['--version'];
86 yield* cli(args);
@@ -84,19 +89,21 @@ describe('CLI: composio', () => {
89 expect(output).toContain(pkg.version);
90 })
91 );
87 -
88 - // it.effect('[Pressing] CTRL+C [Then] quit wizard mode', () =>
89 - // Effect.gen(function* () {
90 - // const args = ['--wizard'];
91 -
92 - // const fiber = yield* Effect.fork(cli(args));
93 - // yield* MockTerminal.inputKey('c', { ctrl: true });
94 - // yield* Fiber.join(fiber);
95 -
96 - // const lines = yield* MockConsole.getLines();
97 - // const output = lines.join('\n');
98 - // expect(output).toContain('Quitting wizard mode...');
99 - // })
100 - // );
92 });
93 +
94 + // layer(TestLive())(it => {
95 + // it.scoped('[Pressing] CTRL+C [Then] quit wizard mode', () =>
96 + // Effect.gen(function* () {
97 + // const args = ['--wizard'];
98 +
99 + // const fiber = yield* Effect.fork(cli(args));
100 + // yield* MockTerminal.inputKey('c', { ctrl: true });
101 + // yield* Fiber.join(fiber);
102 +
103 + // const lines = yield* MockConsole.getLines();
104 + // const output = lines.join('\n');
105 + // expect(output).toContain('Quitting wizard mode...');
106 + // })
107 + // );
108 + // });
109 });
ts/packages/cli/test/src/commands/generate.cmd.test.ts
+11 -4
@@ -1,5 +1,6 @@
1 import { describe, expect, layer } from '@effect/vitest';
2 import { Effect } from 'effect';
3 +import { NodeProcess } from 'src/services/node-process';
4 import { cli, TestLive, MockConsole } from 'test/__utils__';
5
6 describe('CLI: composio generate', () => {
@@ -8,9 +9,12 @@ describe('CLI: composio generate', () => {
9 fixture: 'python-project',
10 })
11 )(it => {
11 - it.effect('[Given] a valid Python project in cwd [Then] it detects its language', () =>
12 + it.scoped('[Given] a valid Python project in cwd [Then] it detects its language', () =>
13 Effect.gen(function* () {
13 - const args = ['generate'];
14 + const process = yield* NodeProcess;
15 + const cwd = process.cwd;
16 +
17 + const args = ['generate', '--output-dir', cwd];
18 yield* cli(args);
19 const lines = yield* MockConsole.getLines();
20 const output = lines.join('\n');
@@ -24,9 +28,12 @@ describe('CLI: composio generate', () => {
28 fixture: 'typescript-project',
29 })
30 )(it => {
27 - it.effect('[Given] a valid TypeScript project in cwd [Then] it detects its language', () =>
31 + it.scoped('[Given] a valid TypeScript project in cwd [Then] it detects its language', () =>
32 Effect.gen(function* () {
29 - const args = ['generate'];
33 + const process = yield* NodeProcess;
34 + const cwd = process.cwd;
35 +
36 + const args = ['generate', '--output-dir', cwd];
37 yield* cli(args);
38 const lines = yield* MockConsole.getLines();
39 const output = lines.join('\n');
ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts
+25 -101
@@ -24,25 +24,30 @@ describe('CLI: composio py generate', () => {
24
25 layer(
26 TestLive({
27 - fixture: 'python-project',
27 + fixture: 'python-project-with-composio-core',
28 toolkitsData: appClientData,
29 })
30 )(it => {
31 describe('[Given] valid fetched app data', () => {
32 - it.effect(
33 - '[Given] no arguments [Then] it generates type stubs relative to the cache directory',
32 + it.scoped.skip(
33 + '[Given] no arguments [Then] it generates type stubs relative the `composio` module if detectable by uv',
34 () =>
35 Effect.gen(function* () {
36 const process = yield* NodeProcess;
37 const cwd = process.cwd;
38 const fs = yield* FileSystem.FileSystem;
39
40 - vi.stubEnv('COMPOSIO_CACHE_DIR', cwd);
41 -
40 const args = ['py', 'generate'];
41 yield* cli(args);
42
45 - const outputDir = path.join(cwd, '.generated', 'composio-py');
43 + const outputDir = path.join(
44 + cwd,
45 + '.venv',
46 + 'lib',
47 + 'python3.12',
48 + 'site-packages',
49 + 'composio'
50 + );
51
52 const gmailSourceCode = yield* fs.readFileString(path.join(outputDir, 'gmail.py'));
53 const slackSourceCode = yield* fs.readFileString(path.join(outputDir, 'slack.py'));
@@ -84,27 +89,23 @@ describe('CLI: composio py generate', () => {
89 })
90 );
91
87 - it.effect(
92 + it.scoped(
93 '[Given] --output-dir [Then] it generates type stubs relative to the given output directory',
89 - () =>
90 - Effect.gen(function* () {
91 - const process = yield* NodeProcess;
92 - const cwd = process.cwd;
93 - const fs = yield* FileSystem.FileSystem;
94 -
95 - const outputDirArg = path.join('.generated', 'composio-py');
94 + Effect.fn(function* () {
95 + const process = yield* NodeProcess;
96 + const cwd = process.cwd;
97 + const fs = yield* FileSystem.FileSystem;
98
97 - const args = ['py', 'generate', '--output-dir', outputDirArg];
98 - yield* cli(args);
99 + const outputDir = path.join(cwd, '.generated', 'composio-py');
100
100 - const outputDir = path.join(cwd, outputDirArg);
101 + const args = ['py', 'generate', '--output-dir', outputDir];
102 + yield* cli(args);
103
102 - const gmailSourceCode = yield* fs.readFileString(path.join(outputDir, 'gmail.py'));
103 - const slackSourceCode = yield* fs.readFileString(path.join(outputDir, 'slack.py'));
104 + const gmailSourceCode = yield* fs.readFileString(path.join(outputDir, 'gmail.py'));
105 + const slackSourceCode = yield* fs.readFileString(path.join(outputDir, 'slack.py'));
106
105 - expect(gmailSourceCode).toMatchInlineSnapshot(`
106 - "# Auto-generated by Composio CLI via \`composio py generate\`.
107 - # Do not modify manually.
107 + expect(gmailSourceCode).toMatchInlineSnapshot(`
108 + "# Auto-generated by Composio CLI. Do not modify manually..
109
110 class GMAIL:
111 """Map of Composio's GMAIL toolkit."""
@@ -120,9 +121,8 @@ describe('CLI: composio py generate', () => {
121 NEW_GMAIL_MESSAGE = "GMAIL_NEW_GMAIL_MESSAGE"
122 "
123 `);
123 - expect(slackSourceCode).toMatchInlineSnapshot(`
124 - "# Auto-generated by Composio CLI via \`composio py generate\`.
125 - # Do not modify manually.
124 + expect(slackSourceCode).toMatchInlineSnapshot(`
125 + "# Auto-generated by Composio CLI. Do not modify manually..
126
127 class SLACK:
128 """Map of Composio's SLACK toolkit."""
@@ -136,82 +136,6 @@ describe('CLI: composio py generate', () => {
136 pass
137 "
138 `);
139 - })
140 - );
141 -
142 - it.effect('[Given] --single-file [Then] it generates type stubs in a single file', () =>
143 - Effect.gen(function* () {
144 - const process = yield* NodeProcess;
145 - const cwd = process.cwd;
146 - const fs = yield* FileSystem.FileSystem;
147 -
148 - vi.stubEnv('COMPOSIO_CACHE_DIR', cwd);
149 -
150 - const args = ['ts', 'generate', '--single-file'];
151 - yield* cli(args);
152 -
153 - const outputDir = path.join(cwd, '.generated', 'composio-ts');
154 -
155 - expect(yield* fs.exists(path.join(outputDir, 'index.ts'))).toBe(true);
156 -
157 - const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));
158 -
159 - expect(indexSourceCode).toMatchInlineSnapshot(`
160 - "/**
161 - * Auto-generated by Composio CLI. Do not modify manually.
162 - */
163 -
164 - /**
165 - * Map of Composio's GMAIL toolkit.
166 - */
167 - export const GMAIL = {
168 - slug: "gmail",
169 - tools: {
170 - CREATE_EMAIL_DRAFT: "GMAIL_CREATE_EMAIL_DRAFT",
171 - DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",
172 - FETCH_EMAILS: "GMAIL_FETCH_EMAILS",
173 - },
174 - triggerTypes: {
175 - NEW_GMAIL_MESSAGE: "GMAIL_NEW_GMAIL_MESSAGE",
176 - },
177 - }
178 -
179 - /**
180 - * Map of Composio's SLACK toolkit.
181 - */
182 - export const SLACK = {
183 - slug: "slack",
184 - tools: {},
185 - triggerTypes: {},
186 - }
187 -
188 - /**
189 - * Map of Composio toolkits to actions.
190 - */
191 - export const composio = {
192 - GMAIL: GMAIL,
193 - SLACK: SLACK,
194 - }
195 -
196 - /**
197 - * Type declarations
198 - */
199 -
200 - /**
201 - * Union of all available toolkits.
202 - */
203 - export type Toolkit =
204 - | "GMAIL"
205 - | "SLACK"
206 -
207 - /**
208 - * Given a toolkit, returns the tools available for that toolkit.
209 - */
210 - export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
211 -
212 -
213 - "
214 - `);
139 })
140 );
141 });
ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
+385 -246
@@ -1,11 +1,15 @@
1 import path from 'node:path';
2 -import { describe, expect, layer, vi } from '@effect/vitest';
3 -import { Effect } from 'effect';
4 -import { FileSystem } from '@effect/platform';
2 +import { describe, expect, layer } from '@effect/vitest';
3 +import { Effect, Stream, String } from 'effect';
4 +import { Command, FileSystem } from '@effect/platform';
5 import { cli, TestLive } from 'test/__utils__';
6 import { makeTestToolkits } from 'test/__utils__/models/toolkits';
7 import { NodeProcess } from 'src/services/node-process';
8 -import { assertTypeScriptIsValid } from 'test/__utils__/typescript-compiler';
8 +import {
9 + assertTranspiledTypeScriptIsValid,
10 + assertTypeScriptIsValid,
11 +} from 'test/__utils__/typescript-compiler';
12 +import { ComposioCorePkgNotFound } from 'src/effects/find-composio-core-generated';
13
14 describe('CLI: composio ts generate', () => {
15 const appClientData = {
@@ -23,278 +27,413 @@ describe('CLI: composio ts generate', () => {
27 triggerTypes: ['GMAIL_NEW_GMAIL_MESSAGE'],
28 };
29
26 - layer(
27 - TestLive({
28 - fixture: 'typescript-project',
29 - toolkitsData: appClientData,
30 - })
31 - )(it => {
32 - describe('[Given] valid fetched app data', () => {
33 - it.effect(
34 - '[Given] no arguments [Then] it generates type stubs relative to the cache directory',
35 - () =>
30 + describe('[Given] valid fetched app data', () => {
31 + layer(
32 + TestLive({
33 + fixture: 'typescript-project-with-composio-core',
34 + toolkitsData: appClientData,
35 + })
36 + )(it => {
37 + describe('[Given] `@composio/core` already installed', () => {
38 + it.scoped(
39 + '[Given] no args [Then] it generates types + JS in `node_modules/@composio/core/generated`',
40 + () =>
41 + Effect.gen(function* () {
42 + const process = yield* NodeProcess;
43 + const cwd = process.cwd;
44 + const fs = yield* FileSystem.FileSystem;
45 +
46 + // Create the @composio/core/generated directory structure as if installed
47 + const nodeModulesDir = path.join(cwd, 'node_modules', '@composio', 'core');
48 + const generatedDir = path.join(nodeModulesDir, 'generated');
49 + yield* fs.makeDirectory(nodeModulesDir, { recursive: true });
50 + yield* fs.makeDirectory(generatedDir, { recursive: true });
51 +
52 + const outputDir = path.join(cwd, 'node_modules', '@composio', 'core', 'generated');
53 + const args = ['ts', 'generate'];
54 + yield* cli(args);
55 +
56 + const gmailSourceCode = yield* fs.readFileString(path.join(outputDir, 'gmail.ts'));
57 + const slackSourceCode = yield* fs.readFileString(path.join(outputDir, 'slack.ts'));
58 + const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));
59 +
60 + expect(gmailSourceCode).toMatchInlineSnapshot(`
61 + "/**
62 + * Map of Composio's GMAIL toolkit.
63 + */
64 + export const GMAIL = {
65 + slug: "gmail",
66 + tools: {
67 + CREATE_EMAIL_DRAFT: "GMAIL_CREATE_EMAIL_DRAFT",
68 + DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",
69 + FETCH_EMAILS: "GMAIL_FETCH_EMAILS",
70 + },
71 + triggerTypes: {
72 + NEW_GMAIL_MESSAGE: "GMAIL_NEW_GMAIL_MESSAGE",
73 + },
74 + }
75 + "
76 + `);
77 + expect(slackSourceCode).toMatchInlineSnapshot(`
78 + "/**
79 + * Map of Composio's SLACK toolkit.
80 + */
81 + export const SLACK = {
82 + slug: "slack",
83 + tools: {},
84 + triggerTypes: {},
85 + }
86 + "
87 + `);
88 + expect(indexSourceCode).toMatchInlineSnapshot(`
89 + "/**
90 + * Auto-generated by Composio CLI. Do not modify manually.
91 + */
92 +
93 + import { GMAIL } from "./gmail.js"
94 + import { SLACK } from "./slack.js"
95 +
96 + /**
97 + * Map of Composio toolkits to actions.
98 + */
99 + export const composio = {
100 + GMAIL: GMAIL,
101 + SLACK: SLACK,
102 + }
103 +
104 + /**
105 + * Type declarations
106 + */
107 +
108 + /**
109 + * Union of all available toolkits.
110 + */
111 + export type Toolkit =
112 + | "GMAIL"
113 + | "SLACK"
114 +
115 + /**
116 + * Given a toolkit, returns the tools available for that toolkit.
117 + */
118 + export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
119 +
120 + "
121 + `);
122 +
123 + assertTypeScriptIsValid({ files: { './gmail.ts': gmailSourceCode } });
124 + assertTypeScriptIsValid({ files: { './slack.ts': slackSourceCode } });
125 + assertTypeScriptIsValid({
126 + files: {
127 + './index.ts': indexSourceCode,
128 + './gmail.ts': gmailSourceCode,
129 + './slack.ts': slackSourceCode,
130 + },
131 + });
132 +
133 + const testSourceCodePath = path.join(cwd, 'src', 'index.js');
134 + const testSourceCode = yield* fs.readFileString(testSourceCodePath);
135 + expect(testSourceCode).toMatchInlineSnapshot(`
136 + "import { composio } from '@composio/core/generated';
137 +
138 + console.log('Test: Using generated Composio types');
139 + console.log(composio.GMAIL.tools.CREATE_EMAIL_DRAFT);
140 + "
141 + `);
142 +
143 + const stdout = yield* assertTranspiledTypeScriptIsValid({ cwd, testSourceCodePath });
144 + expect(stdout).toMatchInlineSnapshot(`
145 + "Test: Using generated Composio types
146 + GMAIL_CREATE_EMAIL_DRAFT
147 + "
148 + `);
149 + })
150 + );
151 +
152 + it.scoped(
153 + '[Given] --output-dir [Then] it generates type stubs relative to the given output directory',
154 + () =>
155 + Effect.gen(function* () {
156 + const process = yield* NodeProcess;
157 + const cwd = process.cwd;
158 + const fs = yield* FileSystem.FileSystem;
159 +
160 + const outputDir = path.join(cwd, '.generated', 'composio-ts');
161 +
162 + const args = ['ts', 'generate', '--output-dir', outputDir];
163 + yield* cli(args);
164 +
165 + const gmailSourceCode = yield* fs.readFileString(path.join(outputDir, 'gmail.ts'));
166 + const slackSourceCode = yield* fs.readFileString(path.join(outputDir, 'slack.ts'));
167 + const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));
168 +
169 + expect(gmailSourceCode).toMatchInlineSnapshot(`
170 + "/**
171 + * Map of Composio's GMAIL toolkit.
172 + */
173 + export const GMAIL = {
174 + slug: "gmail",
175 + tools: {
176 + CREATE_EMAIL_DRAFT: "GMAIL_CREATE_EMAIL_DRAFT",
177 + DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",
178 + FETCH_EMAILS: "GMAIL_FETCH_EMAILS",
179 + },
180 + triggerTypes: {
181 + NEW_GMAIL_MESSAGE: "GMAIL_NEW_GMAIL_MESSAGE",
182 + },
183 + }
184 + "
185 + `);
186 + expect(slackSourceCode).toMatchInlineSnapshot(`
187 + "/**
188 + * Map of Composio's SLACK toolkit.
189 + */
190 + export const SLACK = {
191 + slug: "slack",
192 + tools: {},
193 + triggerTypes: {},
194 + }
195 + "
196 + `);
197 + expect(indexSourceCode).toMatchInlineSnapshot(`
198 + "/**
199 + * Auto-generated by Composio CLI. Do not modify manually.
200 + */
201 +
202 + import { GMAIL } from "./gmail.js"
203 + import { SLACK } from "./slack.js"
204 +
205 + /**
206 + * Map of Composio toolkits to actions.
207 + */
208 + export const composio = {
209 + GMAIL: GMAIL,
210 + SLACK: SLACK,
211 + }
212 +
213 + /**
214 + * Type declarations
215 + */
216 +
217 + /**
218 + * Union of all available toolkits.
219 + */
220 + export type Toolkit =
221 + | "GMAIL"
222 + | "SLACK"
223 +
224 + /**
225 + * Given a toolkit, returns the tools available for that toolkit.
226 + */
227 + export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
228 +
229 + "
230 + `);
231 +
232 + assertTypeScriptIsValid({ files: { './gmail.ts': gmailSourceCode } });
233 + assertTypeScriptIsValid({ files: { './slack.ts': slackSourceCode } });
234 + assertTypeScriptIsValid({
235 + files: {
236 + './index.ts': indexSourceCode,
237 + './gmail.ts': gmailSourceCode,
238 + './slack.ts': slackSourceCode,
239 + },
240 + });
241 + })
242 + );
243 +
244 + it.scoped('[Given] --compact [Then] it generates type stubs in a single file', () =>
245 Effect.gen(function* () {
246 const process = yield* NodeProcess;
247 const cwd = process.cwd;
248 const fs = yield* FileSystem.FileSystem;
249 + const outputDir = path.join(cwd, 'generated-single');
250
41 - vi.stubEnv('COMPOSIO_CACHE_DIR', cwd);
42 -
43 - const args = ['ts', 'generate'];
251 + const args = ['ts', 'generate', '--compact', '--output-dir', outputDir];
252 yield* cli(args);
253
46 - const outputDir = path.join(cwd, '.generated', 'composio-ts');
254 + // Check if the output directory contains the expected files
255 + const files = yield* fs.readDirectory(outputDir);
256 + const fileNames = files.map(file => path.basename(file));
257
48 - const gmailSourceCode = yield* fs.readFileString(path.join(outputDir, 'gmail.ts'));
49 - const slackSourceCode = yield* fs.readFileString(path.join(outputDir, 'slack.ts'));
50 - const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));
258 + // Should only have index.ts and no other .ts files
259 + const tsFiles = fileNames.filter(name => name.endsWith('.ts'));
260 + expect(tsFiles).toContain('index.ts');
261 + expect(tsFiles.length).toBe(1);
262
52 - expect(gmailSourceCode).toMatchInlineSnapshot(`
53 - "/**
54 - * Map of Composio's GMAIL toolkit.
55 - */
56 - export const GMAIL = {
57 - slug: "gmail",
58 - tools: {
59 - CREATE_EMAIL_DRAFT: "GMAIL_CREATE_EMAIL_DRAFT",
60 - DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",
61 - FETCH_EMAILS: "GMAIL_FETCH_EMAILS",
62 - },
63 - triggerTypes: {
64 - NEW_GMAIL_MESSAGE: "GMAIL_NEW_GMAIL_MESSAGE",
65 - },
66 - }
67 - "
68 - `);
69 - expect(slackSourceCode).toMatchInlineSnapshot(`
70 - "/**
71 - * Map of Composio's SLACK toolkit.
72 - */
73 - export const SLACK = {
74 - slug: "slack",
75 - tools: {},
76 - triggerTypes: {},
77 - }
78 - "
79 - `);
80 - expect(indexSourceCode).toMatchInlineSnapshot(`
81 - "/**
82 - * Auto-generated by Composio CLI. Do not modify manually.
83 - */
84 -
85 - import { GMAIL } from "./gmail.ts"
86 - import { SLACK } from "./slack.ts"
87 -
88 - /**
89 - * Map of Composio toolkits to actions.
90 - */
91 - export const composio = {
92 - GMAIL: GMAIL,
93 - SLACK: SLACK,
94 - }
95 -
96 - /**
97 - * Type declarations
98 - */
99 -
100 - /**
101 - * Union of all available toolkits.
102 - */
103 - export type Toolkit =
104 - | "GMAIL"
105 - | "SLACK"
106 -
107 - /**
108 - * Given a toolkit, returns the tools available for that toolkit.
109 - */
110 - export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
111 -
112 - "
113 - `);
114 -
115 - assertTypeScriptIsValid({ files: { './gmail.ts': gmailSourceCode } });
116 - assertTypeScriptIsValid({ files: { './slack.ts': slackSourceCode } });
117 - assertTypeScriptIsValid({
118 - files: {
119 - './index.ts': indexSourceCode,
120 - './gmail.ts': gmailSourceCode,
121 - './slack.ts': slackSourceCode,
122 - },
123 - });
263 + // Verify the file content
264 + const content = yield* fs.readFileString(path.join(outputDir, 'index.ts'));
265 + expect(content).toContain('Auto-generated by Composio CLI');
266 + expect(content).toContain('export const GMAIL');
267 + expect(content).toContain('export const SLACK');
268 })
125 - );
269 + );
270
127 - it.effect(
128 - '[Given] --output-dir [Then] it generates type stubs relative to the given output directory',
129 - () =>
271 + it.scoped('[Given] --transpiled [Then] it generates both .ts and .js files', () =>
272 Effect.gen(function* () {
273 const process = yield* NodeProcess;
274 const cwd = process.cwd;
275 const fs = yield* FileSystem.FileSystem;
276 + const outputDir = path.join(cwd, 'generated-compiled');
277
135 - const outputDirArg = path.join('.generated', 'composio-ts');
136 -
137 - const args = ['ts', 'generate', '--output-dir', outputDirArg];
278 + const args = ['ts', 'generate', '--transpiled', '--output-dir', outputDir];
279 yield* cli(args);
280
140 - const outputDir = path.join(cwd, outputDirArg);
281 + // Check if the output directory contains both .ts and .js files
282 + const files = yield* fs.readDirectory(outputDir);
283 + const fileNames = files.map(file => path.basename(file));
284
142 - const gmailSourceCode = yield* fs.readFileString(path.join(outputDir, 'gmail.ts'));
143 - const slackSourceCode = yield* fs.readFileString(path.join(outputDir, 'slack.ts'));
144 - const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));
285 + // Should have both .ts and .js files
286 + const tsFiles = fileNames.filter(name => name.endsWith('.ts'));
287 + const jsFiles = fileNames.filter(name => name.endsWith('.js'));
288 + const dtsFiles = fileNames.filter(name => name.endsWith('.d.ts'));
289
146 - expect(gmailSourceCode).toMatchInlineSnapshot(`
147 - "/**
148 - * Map of Composio's GMAIL toolkit.
149 - */
150 - export const GMAIL = {
151 - slug: "gmail",
152 - tools: {
153 - CREATE_EMAIL_DRAFT: "GMAIL_CREATE_EMAIL_DRAFT",
154 - DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",
155 - FETCH_EMAILS: "GMAIL_FETCH_EMAILS",
156 - },
157 - triggerTypes: {
158 - NEW_GMAIL_MESSAGE: "GMAIL_NEW_GMAIL_MESSAGE",
159 - },
160 - }
161 - "
162 - `);
163 - expect(slackSourceCode).toMatchInlineSnapshot(`
164 - "/**
165 - * Map of Composio's SLACK toolkit.
166 - */
167 - export const SLACK = {
168 - slug: "slack",
169 - tools: {},
170 - triggerTypes: {},
171 - }
172 - "
173 - `);
174 - expect(indexSourceCode).toMatchInlineSnapshot(`
175 - "/**
176 - * Auto-generated by Composio CLI. Do not modify manually.
177 - */
178 -
179 - import { GMAIL } from "./gmail.ts"
180 - import { SLACK } from "./slack.ts"
181 -
182 - /**
183 - * Map of Composio toolkits to actions.
184 - */
185 - export const composio = {
186 - GMAIL: GMAIL,
187 - SLACK: SLACK,
188 - }
290 + expect(tsFiles.length).toBeGreaterThan(0);
291 + expect(jsFiles.length).toBeGreaterThan(0);
292 + expect(dtsFiles.length).toBeGreaterThan(0);
293
190 - /**
191 - * Type declarations
192 - */
193 -
194 - /**
195 - * Union of all available toolkits.
196 - */
197 - export type Toolkit =
198 - | "GMAIL"
199 - | "SLACK"
200 -
201 - /**
202 - * Given a toolkit, returns the tools available for that toolkit.
203 - */
204 - export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
205 -
206 - "
207 - `);
208 -
209 - assertTypeScriptIsValid({ files: { './gmail.ts': gmailSourceCode } });
210 - assertTypeScriptIsValid({ files: { './slack.ts': slackSourceCode } });
211 - assertTypeScriptIsValid({
212 - files: {
213 - './index.ts': indexSourceCode,
214 - './gmail.ts': gmailSourceCode,
215 - './slack.ts': slackSourceCode,
216 - },
217 - });
218 - })
219 - );
220 -
221 - it.effect('[Given] --single-file [Then] it generates type stubs in a single file', () =>
222 - Effect.gen(function* () {
223 - const process = yield* NodeProcess;
224 - const cwd = process.cwd;
225 - const fs = yield* FileSystem.FileSystem;
226 -
227 - vi.stubEnv('COMPOSIO_CACHE_DIR', cwd);
228 -
229 - const args = ['ts', 'generate', '--single-file'];
230 - yield* cli(args);
231 -
232 - const outputDir = path.join(cwd, '.generated', 'composio-ts');
233 -
234 - expect(yield* fs.exists(path.join(outputDir, 'index.ts'))).toBe(true);
235 -
236 - const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));
237 -
238 - expect(indexSourceCode).toMatchInlineSnapshot(`
239 - "/**
240 - * Auto-generated by Composio CLI. Do not modify manually.
241 - */
242 -
243 - /**
244 - * Map of Composio's GMAIL toolkit.
245 - */
246 - export const GMAIL = {
247 - slug: "gmail",
248 - tools: {
249 - CREATE_EMAIL_DRAFT: "GMAIL_CREATE_EMAIL_DRAFT",
250 - DELETE_MESSAGE: "GMAIL_DELETE_MESSAGE",
251 - FETCH_EMAILS: "GMAIL_FETCH_EMAILS",
252 - },
253 - triggerTypes: {
254 - NEW_GMAIL_MESSAGE: "GMAIL_NEW_GMAIL_MESSAGE",
255 - },
294 + // Verify the files are valid TypeScript
295 + for (const file of tsFiles) {
296 + const filePath = path.join(outputDir, file);
297 + assertTypeScriptIsValid({ files: { './index.ts': filePath } });
298 }
299 + })
300 + );
301
258 - /**
259 - * Map of Composio's SLACK toolkit.
260 - */
261 - export const SLACK = {
262 - slug: "slack",
263 - tools: {},
264 - triggerTypes: {},
265 - }
302 + it.scoped('[Given] no `--output-dir` [Then] it compiles by default', () =>
303 + Effect.gen(function* () {
304 + const process = yield* NodeProcess;
305 + const cwd = process.cwd;
306 + const fs = yield* FileSystem.FileSystem;
307
267 - /**
268 - * Map of Composio toolkits to actions.
269 - */
270 - export const composio = {
271 - GMAIL: GMAIL,
272 - SLACK: SLACK,
273 - }
308 + // Set up @composio/core/generated directory
309 + const nodeModulesDir = path.join(cwd, 'node_modules', '@composio', 'core');
310 + const generatedDir = path.join(nodeModulesDir, 'generated');
311 + yield* fs.makeDirectory(nodeModulesDir, { recursive: true });
312 + yield* fs.makeDirectory(generatedDir, { recursive: true });
313 +
314 + const args = ['ts', 'generate'];
315 + yield* cli(args);
316 +
317 + // Check if the output directory contains both .ts and .js files
318 + const files = yield* fs.readDirectory(generatedDir);
319 + const fileNames = files.map(file => path.basename(file));
320 +
321 + // Should have both .ts and .js files since compiled is true by default for @composio/core/generated
322 + const tsFiles = fileNames.filter(name => name.endsWith('.ts'));
323 + const jsFiles = fileNames.filter(name => name.endsWith('.js'));
324 + const dtsFiles = fileNames.filter(name => name.endsWith('.d.ts'));
325
275 - /**
276 - * Type declarations
277 - */
326 + expect(tsFiles.length).toBeGreaterThan(0);
327 + expect(jsFiles.length).toBeGreaterThan(0);
328 + expect(dtsFiles.length).toBeGreaterThan(0);
329 + })
330 + );
331 +
332 + it.scoped(
333 + '[Given] `--output-dir` with no `--transpiled` [Then] it does not generate .js files',
334 + () =>
335 + Effect.gen(function* () {
336 + const process = yield* NodeProcess;
337 + const cwd = process.cwd;
338 + const fs = yield* FileSystem.FileSystem;
339 + const outputDir = path.join(cwd, 'generated-no-compile');
340 +
341 + const args = ['ts', 'generate', '--output-dir', outputDir];
342 + yield* cli(args);
343 +
344 + // Check if the output directory contains only .ts files
345 + const files = yield* fs.readDirectory(outputDir);
346 + const fileNames = files.map(file => path.basename(file));
347 +
348 + // Should have .ts files but no .js files
349 + const tsFiles = fileNames.filter(name => name.endsWith('.ts'));
350 + const jsFiles = fileNames.filter(name => name.endsWith('.js'));
351 +
352 + expect(tsFiles.length).toBeGreaterThan(0);
353 + expect(jsFiles.length).toBe(0);
354 + })
355 + );
356 +
357 + it.scoped('[Given] `--compact` [Then] it generates in the correct location', () =>
358 + Effect.gen(function* () {
359 + const process = yield* NodeProcess;
360 + const cwd = process.cwd;
361 + const fs = yield* FileSystem.FileSystem;
362
279 - /**
280 - * Union of all available toolkits.
281 - */
282 - export type Toolkit =
283 - | "GMAIL"
284 - | "SLACK"
285 -
286 - /**
287 - * Given a toolkit, returns the tools available for that toolkit.
288 - */
289 - export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
363 + // Run the command
364 + const args = ['ts', 'generate', '--compact'];
365 + yield* cli(args);
366
367 + // Verify the output
368 + const outputDir = path.join(cwd, '.generated', 'composio-ts');
369 + const fileExists = yield* fs.exists(path.join(outputDir, 'index.ts'));
370 + expect(fileExists).toBe(true);
371
292 - "
293 - `);
372 + const indexSourceCode = yield* fs.readFileString(path.join(outputDir, 'index.ts'));
373 + expect(indexSourceCode).toMatchInlineSnapshot(`
374 + "/**
375 + * Auto-generated by Composio CLI. Do not modify manually.
376 + */
377 +
378 + import { GMAIL } from "./gmail.js"
379 + import { SLACK } from "./slack.js"
380 +
381 + /**
382 + * Map of Composio toolkits to actions.
383 + */
384 + export const composio = {
385 + GMAIL: GMAIL,
386 + SLACK: SLACK,
387 + }
388 +
389 + /**
390 + * Type declarations
391 + */
392 +
393 + /**
394 + * Union of all available toolkits.
395 + */
396 + export type Toolkit =
397 + | "GMAIL"
398 + | "SLACK"
399 +
400 + /**
401 + * Given a toolkit, returns the tools available for that toolkit.
402 + */
403 + export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
404 +
405 + "
406 + `);
407 +
408 + assertTypeScriptIsValid({ files: { './index.ts': indexSourceCode } });
409 + })
410 + );
411 + });
412 + });
413
295 - assertTypeScriptIsValid({ files: { './index.ts': indexSourceCode } });
414 + describe('[Given] `@composio/core` not installed', () => {
415 + layer(
416 + TestLive({
417 + fixture: 'typescript-project',
418 + toolkitsData: appClientData,
419 })
297 - );
420 + )(it => {
421 + it.scoped('[Given] no custom output dir [Then] [Then] it raises an error', () =>
422 + Effect.gen(function* () {
423 + const args = ['ts', 'generate'];
424 +
425 + const result = yield* cli(args).pipe(Effect.catchAll(e => Effect.succeed(e)));
426 +
427 + expect(result).toEqual(
428 + new ComposioCorePkgNotFound({
429 + message: '@composio/core not found',
430 + cause: '@composio/core not installed',
431 + fix: 'Install @composio/core with `npm install -S @composio/core`, or specify an output directory using `--output-dir`',
432 + })
433 + );
434 + })
435 + );
436 + });
437 });
438 });
439 });
ts/packages/cli/test/src/commands/version.test.ts
+2 -2
@@ -4,7 +4,7 @@ import { cli, pkg, TestLive, MockConsole } from 'test/__utils__';
4
5 describe('CLI: composio', () => {
6 layer(TestLive())(it => {
7 - it.effect("[Given] no arguments [Then] prints composio's version from package.json", () =>
7 + it.scoped("[Given] no arguments [Then] prints composio's version from package.json", () =>
8 Effect.gen(function* () {
9 const args = ['version'];
10 yield* cli(args);
@@ -14,7 +14,7 @@ describe('CLI: composio', () => {
14 })
15 );
16
17 - it.effect('[Given] DEBUG_OVERRIDE_VERSION env var [Then] prints overridden version', () =>
17 + it.scoped('[Given] DEBUG_OVERRIDE_VERSION env var [Then] prints overridden version', () =>
18 Effect.gen(function* () {
19 const expectedVersion = '1.2.3-test';
20 vi.stubEnv('DEBUG_OVERRIDE_VERSION', expectedVersion);
ts/packages/cli/test/src/commands/whoami.cmd.test.ts
+1 -1
@@ -11,7 +11,7 @@ describe('CLI: composio whoami', () => {
11 );
12
13 layer(TestLive().pipe(Layer.provide(Layer.setConfigProvider(mockConfigProvider))))(it => {
14 - it.effect('[Given] `COMPOSIO_API_KEY` env var [Then] prints it in stdout', () =>
14 + it.scoped('[Given] `COMPOSIO_API_KEY` env var [Then] prints it in stdout', () =>
15 Effect.gen(function* () {
16 const args = ['whoami'];
17 yield* cli(args);
ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
+7 -9
@@ -1,6 +1,7 @@
1 import { describe, expect, it } from 'vitest';
2 import { generatePythonToolkitSources } from 'src/generation/python/generate-toolkit-sources';
3 import { createToolkitIndex } from 'src/generation/create-toolkit-index';
4 +import { BANNER } from 'src/generation/constants';
5 import { makeTestToolkits } from 'test/__utils__/models/toolkits';
6
7 describe('generatePythonToolkitSources', () => {
@@ -11,7 +12,7 @@ describe('generatePythonToolkitSources', () => {
12 triggerTypes: [],
13 });
14
14 - const sources = generatePythonToolkitSources(index);
15 + const sources = generatePythonToolkitSources(BANNER)(index);
16
17 expect(sources).toEqual([]);
18 });
@@ -30,13 +31,12 @@ describe('generatePythonToolkitSources', () => {
31 triggerTypes: [],
32 });
33
33 - const sources = generatePythonToolkitSources(index);
34 + const sources = generatePythonToolkitSources(BANNER)(index);
35 expect(sources).toHaveLength(1);
36 expect(sources[0]).toHaveLength(2);
37 expect(sources[0][0]).toBe('slack.py');
38 expect(sources[0][1]).toMatchInlineSnapshot(`
38 - "# Auto-generated by Composio CLI via \`composio py generate\`.
39 - # Do not modify manually.
39 + "# Auto-generated by Composio CLI. Do not modify manually..
40
41 class SLACK:
42 """Map of Composio's SLACK toolkit."""
@@ -70,14 +70,13 @@ describe('generatePythonToolkitSources', () => {
70 triggerTypes: ['GMAIL_NEW_GMAIL_MESSAGE'],
71 });
72
73 - const sources = generatePythonToolkitSources(index);
73 + const sources = generatePythonToolkitSources(BANNER)(index);
74 expect(sources).toHaveLength(2);
75
76 expect(sources[0]).toHaveLength(2);
77 expect(sources[0][0]).toBe('gmail.py');
78 expect(sources[0][1]).toMatchInlineSnapshot(`
79 - "# Auto-generated by Composio CLI via \`composio py generate\`.
80 - # Do not modify manually.
79 + "# Auto-generated by Composio CLI. Do not modify manually..
80
81 class GMAIL:
82 """Map of Composio's GMAIL toolkit."""
@@ -97,8 +96,7 @@ describe('generatePythonToolkitSources', () => {
96 expect(sources[1]).toHaveLength(2);
97 expect(sources[1][0]).toBe('slack.py');
98 expect(sources[1][1]).toMatchInlineSnapshot(`
100 - "# Auto-generated by Composio CLI via \`composio py generate\`.
101 - # Do not modify manually.
99 + "# Auto-generated by Composio CLI. Do not modify manually..
100
101 class SLACK:
102 """Map of Composio's SLACK toolkit."""
ts/packages/cli/test/src/generation/typescript/generate-index-source.test.ts
+3 -3
@@ -223,7 +223,7 @@ describe('generateTypeScriptToolkitSources', () => {
223 * Some banner that will appear in a comment
224 */
225
226 - import { SLACK } from "./slack.ts"
226 + import { SLACK } from "./slack.undefined"
227
228 /**
229 * Map of Composio toolkits to actions.
@@ -277,8 +277,8 @@ describe('generateTypeScriptToolkitSources', () => {
277 * Some banner that will appear in a comment
278 */
279
280 - import { GMAIL } from "./gmail.ts"
281 - import { SLACK } from "./slack.ts"
280 + import { GMAIL } from "./gmail.undefined"
281 + import { SLACK } from "./slack.undefined"
282
283 /**
284 * Map of Composio toolkits to actions.
ts/packages/cli/test/src/generation/typescript/generate.test.ts
+2 -1
@@ -10,7 +10,8 @@ describe('generateTypeScriptSources', () => {
10 const _params = {
11 outputDir: '<cwd>',
12 emitSingleFile: false,
13 - };
13 + importExtension: 'ts',
14 + } as const satisfies Omit<Parameters<typeof generateTypeScriptSources>[0], 'banner'>;
15
16 describe('with banner', () => {
17 const params = {
ts/packages/cli/test/src/services/js-package-manager-detector.test.ts new
+106
@@ -0,0 +1,106 @@
1 +import { describe, expect, layer } from '@effect/vitest';
2 +import { BunFileSystem } from '@effect/platform-bun';
3 +import { FileSystem } from '@effect/platform';
4 +import { Effect, Layer } from 'effect';
5 +import * as tempy from 'tempy';
6 +import { JsPackageManagerDetector } from 'src/services/js-package-manager-detector';
7 +import * as path from 'path';
8 +
9 +describe('JsPackageManagerDetector', () => {
10 + const testLayer = Layer.provideMerge(JsPackageManagerDetector.Default, BunFileSystem.layer);
11 +
12 + layer(testLayer)(it => {
13 + it.scoped('should detect pnpm from lock file', () =>
14 + Effect.gen(function* () {
15 + const fs = yield* FileSystem.FileSystem;
16 + const detector = yield* JsPackageManagerDetector;
17 + const cwd = tempy.temporaryDirectory();
18 +
19 + yield* fs.writeFileString(path.join(cwd, 'pnpm-lock.yaml'), '');
20 +
21 + const result = yield* detector.detectJsPackageManager(cwd);
22 +
23 + expect(result).toEqual('pnpm');
24 + })
25 + );
26 +
27 + it.scoped('should detect bun from lock file', () =>
28 + Effect.gen(function* () {
29 + const fs = yield* FileSystem.FileSystem;
30 + const detector = yield* JsPackageManagerDetector;
31 + const cwd = tempy.temporaryDirectory();
32 +
33 + yield* fs.writeFileString(path.join(cwd, 'bun.lockb'), '');
34 +
35 + const result = yield* detector.detectJsPackageManager(cwd);
36 +
37 + expect(result).toEqual('bun');
38 + })
39 + );
40 +
41 + it.scoped('should detect yarn from lock file', () =>
42 + Effect.gen(function* () {
43 + const fs = yield* FileSystem.FileSystem;
44 + const detector = yield* JsPackageManagerDetector;
45 + const cwd = tempy.temporaryDirectory();
46 +
47 + yield* fs.writeFileString(path.join(cwd, 'yarn.lock'), '');
48 +
49 + const result = yield* detector.detectJsPackageManager(cwd);
50 +
51 + expect(result).toEqual('yarn');
52 + })
53 + );
54 +
55 + it.scoped('should detect npm from lock file', () =>
56 + Effect.gen(function* () {
57 + const fs = yield* FileSystem.FileSystem;
58 + const detector = yield* JsPackageManagerDetector;
59 + const cwd = tempy.temporaryDirectory();
60 +
61 + yield* fs.writeFileString(path.join(cwd, 'package-lock.json'), '');
62 +
63 + const result = yield* detector.detectJsPackageManager(cwd);
64 +
65 + expect(result).toEqual('npm');
66 + })
67 + );
68 +
69 + it.scoped('should detect from package.json if no lock file is present', () =>
70 + Effect.gen(function* () {
71 + const fs = yield* FileSystem.FileSystem;
72 + const detector = yield* JsPackageManagerDetector;
73 + const cwd = tempy.temporaryDirectory();
74 +
75 + yield* fs.writeFileString(
76 + path.join(cwd, 'package.json'),
77 + JSON.stringify({ packageManager: 'pnpm@8.6.0' })
78 + );
79 +
80 + const result = yield* detector.detectJsPackageManager(cwd);
81 +
82 + expect(result).toEqual('pnpm');
83 + })
84 + );
85 +
86 + it.scoped('should detect recursively from parent directory', () =>
87 + Effect.gen(function* () {
88 + const fs = yield* FileSystem.FileSystem;
89 + const detector = yield* JsPackageManagerDetector;
90 + const rootDir = tempy.temporaryDirectory();
91 +
92 + yield* fs.writeFileString(
93 + path.join(rootDir, 'package.json'),
94 + JSON.stringify({ packageManager: 'pnpm@10.8.0' })
95 + );
96 +
97 + const subDir = path.join(rootDir, 'subdir');
98 + yield* fs.makeDirectory(subDir);
99 +
100 + const result = yield* detector.detectJsPackageManager(subDir);
101 +
102 + expect(result).toEqual('pnpm');
103 + })
104 + );
105 + });
106 +});
ts/packages/cli/vitest.config.ts
+1
@@ -16,5 +16,6 @@ export default defineConfig({
16 tsconfig: './tsconfig.test.json',
17 },
18 includeSource: ['src/**/*.ts', 'test/**/*.ts'],
19 + globalSetup: './test/__utils__/vitest.global-setup.ts',
20 },
21 });
ts/packages/core/.gitignore new
+1
@@ -0,0 +1 @@
1 +generated/
ts/packages/core/package.json
+6 -1
@@ -14,11 +14,16 @@
14 "import": "./dist/index.js",
15 "types": "./dist/index.d.ts",
16 "require": "./dist/index.cjs"
17 + },
18 + "./generated": {
19 + "import": "./generated/index.js",
20 + "types": "./generated/index.d.ts"
21 }
22 },
23 "files": [
24 "README.md",
21 - "dist"
25 + "dist",
26 + "generated"
27 ],
28 "scripts": {
29 "clean": "git clean -xdf node_modules",