@devries-cameron20 / composio-1 / commits / 2e22ba8dc
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.

fix(cli): fix syntax errors in 'composio py generate'

jkomyno committed Oct 28, 2025 at 00:21 UTC 2e22ba8dc7daca068aa3d3ff9750c096af4cadf3
4 files changed +203 -203
ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
+1 -1
@@ -46,7 +46,7 @@ export function generatePythonTypeStubs({ outputOpt }: GetCmdParams<typeof _pyCm
46 yield* fs.makeDirectory(outputDir, { recursive: true });
47
48 // Fetch data from Composio API
49 - yield* Console.log('Fetching latest data from Composio API...');
49 + yield* Console.log('Fetching latest data from Composio API. This may take a while...');
50
51 const triggerTypesAsEnums = yield* Effect.logDebug('Fetching trigger types...').pipe(
52 Effect.flatMap(() => client.getTriggerTypesAsEnums())
ts/packages/cli/src/generation/python/generate-toolkit-sources.ts
+2 -2
@@ -15,7 +15,7 @@
15 *
16 * class triggers:
17 * NEW_GMAIL_MESSAGE = {
18 - * config: {
18 + * 'config': {
19 * # ...
20 * },
21 * description: "Triggers when a new message is received in Gmail.",
@@ -79,7 +79,7 @@ function jsToPython(value: unknown, indent = 0): string {
79 }
80
81 const formattedEntries = entries.map(([key, val]) => {
82 - const formattedKey = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key) ? key : JSON.stringify(key);
82 + const formattedKey = JSON.stringify(key);
83 const formattedValue = jsToPython(val, indent + 2);
84 return `${spacePad} ${formattedKey}: ${formattedValue}`;
85 });
ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts
+100 -100
@@ -131,141 +131,141 @@ describe('CLI: composio py generate', () => {
131
132 class triggers:
133 NEW_GMAIL_MESSAGE = {
134 - config: {
135 - properties: {
136 - interval: {
137 - default: 1,
138 - description: "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
139 - title: "Interval",
140 - type: "number"
134 + "config": {
135 + "properties": {
136 + "interval": {
137 + "default": 1,
138 + "description": "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
139 + "title": "Interval",
140 + "type": "number"
141 },
142 - labelIds: {
143 - default: "INBOX",
144 - description: "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
145 - examples: ["INBOX", "UNREAD", "STARRED"],
146 - title: "Labelids",
147 - type: "string"
142 + "labelIds": {
143 + "default": "INBOX",
144 + "description": "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
145 + "examples": ["INBOX", "UNREAD", "STARRED"],
146 + "title": "Labelids",
147 + "type": "string"
148 },
149 - query: {
150 - default: "",
151 - description: "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:email@domain.com), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
152 - examples: ["label:inbox OR label:sent", "from:example@gmail.com is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
153 - title: "Query",
154 - type: "string"
149 + "query": {
150 + "default": "",
151 + "description": "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:email@domain.com), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
152 + "examples": ["label:inbox OR label:sent", "from:example@gmail.com is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
153 + "title": "Query",
154 + "type": "string"
155 },
156 - userId: {
157 - default: "me",
158 - description: "The user's email address or 'me' for the authenticated user.",
159 - examples: ["me"],
160 - title: "Userid",
161 - type: "string"
156 + "userId": {
157 + "default": "me",
158 + "description": "The user's email address or 'me' for the authenticated user.",
159 + "examples": ["me"],
160 + "title": "Userid",
161 + "type": "string"
162 }
163 },
164 - title: "NewMessageConfig",
165 - type: "object"
164 + "title": "NewMessageConfig",
165 + "type": "object"
166 },
167 - description: "Triggers when a new message is received in Gmail.",
168 - instructions: "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
169 - name: "New Gmail Message Received Trigger",
170 - payload: {
171 - properties: {
172 - attachment_list: {
173 - anyOf: [{
174 - items: {},
175 - type: "array"
167 + "description": "Triggers when a new message is received in Gmail.",
168 + "instructions": "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
169 + "name": "New Gmail Message Received Trigger",
170 + "payload": {
171 + "properties": {
172 + "attachment_list": {
173 + "anyOf": [{
174 + "items": {},
175 + "type": "array"
176 }, {
177 - type: "null"
177 + "type": "null"
178 }],
179 - default: None,
180 - description: "The list of attachments in the message",
181 - title: "Attachment List"
179 + "default": None,
180 + "description": "The list of attachments in the message",
181 + "title": "Attachment List"
182 },
183 - message_id: {
184 - anyOf: [{
185 - type: "string"
183 + "message_id": {
184 + "anyOf": [{
185 + "type": "string"
186 }, {
187 - type: "null"
187 + "type": "null"
188 }],
189 - default: None,
190 - description: "The message ID of the message",
191 - title: "Message ID"
189 + "default": None,
190 + "description": "The message ID of the message",
191 + "title": "Message ID"
192 },
193 - message_text: {
194 - anyOf: [{
195 - type: "string"
193 + "message_text": {
194 + "anyOf": [{
195 + "type": "string"
196 }, {
197 - type: "null"
197 + "type": "null"
198 }],
199 - default: None,
200 - description: "The text of the message",
201 - title: "Message Text"
199 + "default": None,
200 + "description": "The text of the message",
201 + "title": "Message Text"
202 },
203 - message_timestamp: {
204 - anyOf: [{
205 - type: "string"
203 + "message_timestamp": {
204 + "anyOf": [{
205 + "type": "string"
206 }, {
207 - type: "null"
207 + "type": "null"
208 }],
209 - default: None,
210 - description: "The timestamp of the message",
211 - title: "Message Timestamp"
209 + "default": None,
210 + "description": "The timestamp of the message",
211 + "title": "Message Timestamp"
212 },
213 - payload: {
214 - anyOf: [{
215 - type: "object"
213 + "payload": {
214 + "anyOf": [{
215 + "type": "object"
216 }, {
217 - type: "null"
217 + "type": "null"
218 }],
219 - default: None,
220 - description: "The payload of the message",
221 - title: "Payload"
219 + "default": None,
220 + "description": "The payload of the message",
221 + "title": "Payload"
222 },
223 - sender: {
224 - anyOf: [{
225 - type: "string"
223 + "sender": {
224 + "anyOf": [{
225 + "type": "string"
226 }, {
227 - type: "null"
227 + "type": "null"
228 }],
229 - default: None,
230 - description: "The sender of the message",
231 - title: "Sender"
229 + "default": None,
230 + "description": "The sender of the message",
231 + "title": "Sender"
232 },
233 - subject: {
234 - anyOf: [{
235 - type: "string"
233 + "subject": {
234 + "anyOf": [{
235 + "type": "string"
236 }, {
237 - type: "null"
237 + "type": "null"
238 }],
239 - default: None,
240 - description: "The subject of the message",
241 - title: "Subject"
239 + "default": None,
240 + "description": "The subject of the message",
241 + "title": "Subject"
242 },
243 - thread_id: {
244 - anyOf: [{
245 - type: "string"
243 + "thread_id": {
244 + "anyOf": [{
245 + "type": "string"
246 }, {
247 - type: "null"
247 + "type": "null"
248 }],
249 - default: None,
250 - description: "The thread ID of the message",
251 - title: "Thread ID"
249 + "default": None,
250 + "description": "The thread ID of the message",
251 + "title": "Thread ID"
252 },
253 - to: {
254 - anyOf: [{
255 - type: "string"
253 + "to": {
254 + "anyOf": [{
255 + "type": "string"
256 }, {
257 - type: "null"
257 + "type": "null"
258 }],
259 - default: None,
260 - description: "The recipient of the message",
261 - title: "To"
259 + "default": None,
260 + "description": "The recipient of the message",
261 + "title": "To"
262 }
263 },
264 - title: "NewMessagePayload",
265 - type: "object"
264 + "title": "NewMessagePayload",
265 + "type": "object"
266 },
267 - slug: "GMAIL_NEW_GMAIL_MESSAGE",
268 - type: "poll"
267 + "slug": "GMAIL_NEW_GMAIL_MESSAGE",
268 + "type": "poll"
269 }
270 "
271 `);
ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
+100 -100
@@ -95,141 +95,141 @@ describe('generatePythonToolkitSources', () => {
95
96 class triggers:
97 NEW_GMAIL_MESSAGE = {
98 - config: {
99 - properties: {
100 - interval: {
101 - default: 1,
102 - description: "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
103 - title: "Interval",
104 - type: "number"
98 + "config": {
99 + "properties": {
100 + "interval": {
101 + "default": 1,
102 + "description": "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
103 + "title": "Interval",
104 + "type": "number"
105 },
106 - labelIds: {
107 - default: "INBOX",
108 - description: "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
109 - examples: ["INBOX", "UNREAD", "STARRED"],
110 - title: "Labelids",
111 - type: "string"
106 + "labelIds": {
107 + "default": "INBOX",
108 + "description": "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
109 + "examples": ["INBOX", "UNREAD", "STARRED"],
110 + "title": "Labelids",
111 + "type": "string"
112 },
113 - query: {
114 - default: "",
115 - description: "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:email@domain.com), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
116 - examples: ["label:inbox OR label:sent", "from:example@gmail.com is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
117 - title: "Query",
118 - type: "string"
113 + "query": {
114 + "default": "",
115 + "description": "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:email@domain.com), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
116 + "examples": ["label:inbox OR label:sent", "from:example@gmail.com is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
117 + "title": "Query",
118 + "type": "string"
119 },
120 - userId: {
121 - default: "me",
122 - description: "The user's email address or 'me' for the authenticated user.",
123 - examples: ["me"],
124 - title: "Userid",
125 - type: "string"
120 + "userId": {
121 + "default": "me",
122 + "description": "The user's email address or 'me' for the authenticated user.",
123 + "examples": ["me"],
124 + "title": "Userid",
125 + "type": "string"
126 }
127 },
128 - title: "NewMessageConfig",
129 - type: "object"
128 + "title": "NewMessageConfig",
129 + "type": "object"
130 },
131 - description: "Triggers when a new message is received in Gmail.",
132 - instructions: "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
133 - name: "New Gmail Message Received Trigger",
134 - payload: {
135 - properties: {
136 - attachment_list: {
137 - anyOf: [{
138 - items: {},
139 - type: "array"
131 + "description": "Triggers when a new message is received in Gmail.",
132 + "instructions": "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
133 + "name": "New Gmail Message Received Trigger",
134 + "payload": {
135 + "properties": {
136 + "attachment_list": {
137 + "anyOf": [{
138 + "items": {},
139 + "type": "array"
140 }, {
141 - type: "null"
141 + "type": "null"
142 }],
143 - default: None,
144 - description: "The list of attachments in the message",
145 - title: "Attachment List"
143 + "default": None,
144 + "description": "The list of attachments in the message",
145 + "title": "Attachment List"
146 },
147 - message_id: {
148 - anyOf: [{
149 - type: "string"
147 + "message_id": {
148 + "anyOf": [{
149 + "type": "string"
150 }, {
151 - type: "null"
151 + "type": "null"
152 }],
153 - default: None,
154 - description: "The message ID of the message",
155 - title: "Message ID"
153 + "default": None,
154 + "description": "The message ID of the message",
155 + "title": "Message ID"
156 },
157 - message_text: {
158 - anyOf: [{
159 - type: "string"
157 + "message_text": {
158 + "anyOf": [{
159 + "type": "string"
160 }, {
161 - type: "null"
161 + "type": "null"
162 }],
163 - default: None,
164 - description: "The text of the message",
165 - title: "Message Text"
163 + "default": None,
164 + "description": "The text of the message",
165 + "title": "Message Text"
166 },
167 - message_timestamp: {
168 - anyOf: [{
169 - type: "string"
167 + "message_timestamp": {
168 + "anyOf": [{
169 + "type": "string"
170 }, {
171 - type: "null"
171 + "type": "null"
172 }],
173 - default: None,
174 - description: "The timestamp of the message",
175 - title: "Message Timestamp"
173 + "default": None,
174 + "description": "The timestamp of the message",
175 + "title": "Message Timestamp"
176 },
177 - payload: {
178 - anyOf: [{
179 - type: "object"
177 + "payload": {
178 + "anyOf": [{
179 + "type": "object"
180 }, {
181 - type: "null"
181 + "type": "null"
182 }],
183 - default: None,
184 - description: "The payload of the message",
185 - title: "Payload"
183 + "default": None,
184 + "description": "The payload of the message",
185 + "title": "Payload"
186 },
187 - sender: {
188 - anyOf: [{
189 - type: "string"
187 + "sender": {
188 + "anyOf": [{
189 + "type": "string"
190 }, {
191 - type: "null"
191 + "type": "null"
192 }],
193 - default: None,
194 - description: "The sender of the message",
195 - title: "Sender"
193 + "default": None,
194 + "description": "The sender of the message",
195 + "title": "Sender"
196 },
197 - subject: {
198 - anyOf: [{
199 - type: "string"
197 + "subject": {
198 + "anyOf": [{
199 + "type": "string"
200 }, {
201 - type: "null"
201 + "type": "null"
202 }],
203 - default: None,
204 - description: "The subject of the message",
205 - title: "Subject"
203 + "default": None,
204 + "description": "The subject of the message",
205 + "title": "Subject"
206 },
207 - thread_id: {
208 - anyOf: [{
209 - type: "string"
207 + "thread_id": {
208 + "anyOf": [{
209 + "type": "string"
210 }, {
211 - type: "null"
211 + "type": "null"
212 }],
213 - default: None,
214 - description: "The thread ID of the message",
215 - title: "Thread ID"
213 + "default": None,
214 + "description": "The thread ID of the message",
215 + "title": "Thread ID"
216 },
217 - to: {
218 - anyOf: [{
219 - type: "string"
217 + "to": {
218 + "anyOf": [{
219 + "type": "string"
220 }, {
221 - type: "null"
221 + "type": "null"
222 }],
223 - default: None,
224 - description: "The recipient of the message",
225 - title: "To"
223 + "default": None,
224 + "description": "The recipient of the message",
225 + "title": "To"
226 }
227 },
228 - title: "NewMessagePayload",
229 - type: "object"
228 + "title": "NewMessagePayload",
229 + "type": "object"
230 },
231 - slug: "GMAIL_NEW_GMAIL_MESSAGE",
232 - type: "poll"
231 + "slug": "GMAIL_NEW_GMAIL_MESSAGE",
232 + "type": "poll"
233 }
234 "
235 `);