Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
chore(cli): rename barrel object created by "composio ts generate" to "Toolkits"
jkomyno committed
Jun 25, 2025 at 03:10 UTC
9a5fdb95edde2ad9c1a6641e69883e8150ad24d9
6 files changed
+44
-32
ts/packages/cli/src/generation/typescript/generate-index-source.ts
+8
-4
@@ -27,6 +27,8 @@ import * as ts from '@composio/ts-builders';
27
import { pipe, Record, Array as Arr } from 'effect';
28
import type { ToolkitIndex } from 'src/generation/create-toolkit-index';
29
30
+const BARREL_OBJECT_NAME = 'Toolkits';
31
+
32
type GenerateTypeScriptIndexMapSourceParams = {
33
banner: string;
34
emitSingleFile: boolean;
@@ -83,7 +85,9 @@ export function generateTypeScriptIndexMapSource(params: GenerateTypeScriptIndex
85
indexMapFile.add(
86
ts
87
.moduleExport(
86
- ts.constDeclaration('composio').setValue(ts.objectValue().addMultiple(indexMapEntries))
88
+ ts
89
+ .constDeclaration(BARREL_OBJECT_NAME)
90
+ .setValue(ts.objectValue().addMultiple(indexMapEntries))
91
)
92
.setDocComment(ts.docComment('Map of Composio toolkits to actions.'))
93
);
@@ -130,12 +134,12 @@ export function generateToolsByToolkitType(): string {
134
ts
135
.typeDeclaration(
136
'ToolsByToolkit',
133
- ts.typeOfType(ts.keyType(ts.namedType('composio'), ts.namedType('Toolkit')))
137
+ ts.typeOfType(ts.keyType(ts.namedType(BARREL_OBJECT_NAME), ts.namedType('$Toolkit')))
138
)
139
.addGenericParameter(
140
ts
137
- .genericParameter('Toolkit')
138
- .extends(ts.keyOfType(ts.typeOfType(ts.namedType('composio'))))
141
+ .genericParameter('$Toolkit')
142
+ .extends(ts.keyOfType(ts.typeOfType(ts.namedType(BARREL_OBJECT_NAME))))
143
)
144
)
145
.setDocComment(doc)
ts/packages/cli/test/__fixtures__/python-project-with-composio-core/uv.lock
new
+8
@@ -0,0 +1,8 @@
1
+version = 1
2
+revision = 2
3
+requires-python = ">=3.12, <4"
4
+
5
+[[package]]
6
+name = "python-project-with-composio-core"
7
+version = "0.1.0"
8
+source = { virtual = "." }
ts/packages/cli/test/__fixtures__/typescript-project-with-composio-core/src/index.js
+2
-2
@@ -1,4 +1,4 @@
1
-import { composio } from '@composio/core/generated';
1
+import { Toolkits } from '@composio/core/generated';
2
3
console.log('Test: Using generated Composio types');
4
-console.log(composio.GMAIL.tools.CREATE_EMAIL_DRAFT);
4
+console.log(Toolkits.GMAIL.tools.CREATE_EMAIL_DRAFT);
ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
+8
-8
@@ -96,7 +96,7 @@ describe('CLI: composio ts generate', () => {
96
/**
97
* Map of Composio toolkits to actions.
98
*/
99
- export const composio = {
99
+ export const Toolkits = {
100
GMAIL: GMAIL,
101
SLACK: SLACK,
102
}
@@ -115,7 +115,7 @@ describe('CLI: composio ts generate', () => {
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]
118
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
119
120
"
121
`);
@@ -133,10 +133,10 @@ describe('CLI: composio ts generate', () => {
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';
136
+ "import { Toolkits } from '@composio/core/generated';
137
138
console.log('Test: Using generated Composio types');
139
- console.log(composio.GMAIL.tools.CREATE_EMAIL_DRAFT);
139
+ console.log(Toolkits.GMAIL.tools.CREATE_EMAIL_DRAFT);
140
"
141
`);
142
@@ -205,7 +205,7 @@ describe('CLI: composio ts generate', () => {
205
/**
206
* Map of Composio toolkits to actions.
207
*/
208
- export const composio = {
208
+ export const Toolkits = {
209
GMAIL: GMAIL,
210
SLACK: SLACK,
211
}
@@ -224,7 +224,7 @@ describe('CLI: composio ts generate', () => {
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]
227
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
228
229
"
230
`);
@@ -381,7 +381,7 @@ describe('CLI: composio ts generate', () => {
381
/**
382
* Map of Composio toolkits to actions.
383
*/
384
- export const composio = {
384
+ export const Toolkits = {
385
GMAIL: GMAIL,
386
SLACK: SLACK,
387
}
@@ -400,7 +400,7 @@ describe('CLI: composio ts generate', () => {
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]
403
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
404
405
"
406
`);
ts/packages/cli/test/src/generation/typescript/generate-index-source.test.ts
+12
-12
@@ -31,7 +31,7 @@ describe('generateTypeScriptToolkitSources', () => {
31
"/**
32
* Map of Composio toolkits to actions.
33
*/
34
- export const composio = {}
34
+ export const Toolkits = {}
35
36
/**
37
* Type declarations
@@ -45,7 +45,7 @@ describe('generateTypeScriptToolkitSources', () => {
45
/**
46
* Given a toolkit, returns the tools available for that toolkit.
47
*/
48
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
48
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
49
50
"
51
`);
@@ -74,7 +74,7 @@ describe('generateTypeScriptToolkitSources', () => {
74
"/**
75
* Map of Composio toolkits to actions.
76
*/
77
- export const composio = {
77
+ export const Toolkits = {
78
SLACK: SLACK,
79
}
80
@@ -91,7 +91,7 @@ describe('generateTypeScriptToolkitSources', () => {
91
/**
92
* Given a toolkit, returns the tools available for that toolkit.
93
*/
94
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
94
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
95
96
"
97
`);
@@ -122,7 +122,7 @@ describe('generateTypeScriptToolkitSources', () => {
122
"/**
123
* Map of Composio toolkits to actions.
124
*/
125
- export const composio = {
125
+ export const Toolkits = {
126
GMAIL: GMAIL,
127
SLACK: SLACK,
128
}
@@ -141,7 +141,7 @@ describe('generateTypeScriptToolkitSources', () => {
141
/**
142
* Given a toolkit, returns the tools available for that toolkit.
143
*/
144
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
144
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
145
146
"
147
`);
@@ -179,7 +179,7 @@ describe('generateTypeScriptToolkitSources', () => {
179
/**
180
* Map of Composio toolkits to actions.
181
*/
182
- export const composio = {}
182
+ export const Toolkits = {}
183
184
/**
185
* Type declarations
@@ -193,7 +193,7 @@ describe('generateTypeScriptToolkitSources', () => {
193
/**
194
* Given a toolkit, returns the tools available for that toolkit.
195
*/
196
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
196
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
197
198
"
199
`);
@@ -228,7 +228,7 @@ describe('generateTypeScriptToolkitSources', () => {
228
/**
229
* Map of Composio toolkits to actions.
230
*/
231
- export const composio = {
231
+ export const Toolkits = {
232
SLACK: SLACK,
233
}
234
@@ -245,7 +245,7 @@ describe('generateTypeScriptToolkitSources', () => {
245
/**
246
* Given a toolkit, returns the tools available for that toolkit.
247
*/
248
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
248
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
249
250
"
251
`);
@@ -283,7 +283,7 @@ describe('generateTypeScriptToolkitSources', () => {
283
/**
284
* Map of Composio toolkits to actions.
285
*/
286
- export const composio = {
286
+ export const Toolkits = {
287
GMAIL: GMAIL,
288
SLACK: SLACK,
289
}
@@ -302,7 +302,7 @@ describe('generateTypeScriptToolkitSources', () => {
302
/**
303
* Given a toolkit, returns the tools available for that toolkit.
304
*/
305
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
305
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
306
307
"
308
`);
ts/packages/cli/test/src/generation/typescript/generate.test.ts
+6
-6
@@ -40,7 +40,7 @@ describe('generateTypeScriptSources', () => {
40
/**
41
* Map of Composio toolkits to actions.
42
*/
43
- export const composio = {}
43
+ export const Toolkits = {}
44
45
/**
46
* Type declarations
@@ -54,7 +54,7 @@ describe('generateTypeScriptSources', () => {
54
/**
55
* Given a toolkit, returns the tools available for that toolkit.
56
*/
57
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
57
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
58
59
"
60
`);
@@ -105,7 +105,7 @@ describe('generateTypeScriptSources', () => {
105
/**
106
* Map of Composio toolkits to actions.
107
*/
108
- export const composio = {
108
+ export const Toolkits = {
109
SLACK: SLACK,
110
}
111
@@ -122,7 +122,7 @@ describe('generateTypeScriptSources', () => {
122
/**
123
* Given a toolkit, returns the tools available for that toolkit.
124
*/
125
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
125
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
126
127
"
128
`);
@@ -175,7 +175,7 @@ describe('generateTypeScriptSources', () => {
175
/**
176
* Map of Composio toolkits to actions.
177
*/
178
- export const composio = {
178
+ export const Toolkits = {
179
SLACK: SLACK,
180
}
181
@@ -192,7 +192,7 @@ describe('generateTypeScriptSources', () => {
192
/**
193
* Given a toolkit, returns the tools available for that toolkit.
194
*/
195
- export type ToolsByToolkit<Toolkit extends keyof (typeof composio)> = typeof composio[Toolkit]
195
+ export type ToolsByToolkit<$Toolkit extends keyof (typeof Toolkits)> = typeof Toolkits[$Toolkit]
196
197
"
198
`);