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

revert: remove CLASS_CUSTOM_USAGE from generator script

Hardcoded usage examples in the generator are brittle. The MDX file fixes stand on their own; the generator shouldn't have custom overrides. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmitha Mallesh committed Mar 11, 2026 at 00:28 UTC a26fc76757186bba656db38710a488d5e611062e
1 file changed +11 -50
ts/packages/core/scripts/generate-docs.ts
+11 -50
@@ -31,35 +31,6 @@ const INTERNAL_CLASSES = new Set([
31 // Classes that users instantiate directly (show constructor)
32 const USER_INSTANTIATED_CLASSES = new Set(['Composio']);
33
34 -// Custom usage examples for classes that aren't top-level composio.* properties
35 -const CLASS_CUSTOM_USAGE: Record<string, { intro: string; code: string }> = {
36 - RemoteFile: {
37 - intro:
38 - '`RemoteFile` is returned by session file operations such as `session.files.download()` and `session.files.upload()`:',
39 - code: `const composio = new Composio({ apiKey: 'your-api-key' });
40 -const session = await composio.toolRouter.use('session_123');
41 -const file = await session.files.download('/output/report.pdf');
42 -// file is a RemoteFile instance
43 -const content = await file.text();`,
44 - },
45 - ToolRouterSession: {
46 - intro: 'Obtain a session via `composio.toolRouter`:',
47 - code: `const composio = new Composio({ apiKey: 'your-api-key' });
48 -
49 -// Use an existing session
50 -const session = await composio.toolRouter.use('session_123');
51 -
52 -// Or create a new session
53 -const session = await composio.toolRouter.create('user_123', { toolkits: ['github'] });`,
54 - },
55 - ToolRouterSessionFilesMount: {
56 - intro: 'Access via the `files` property on a session:',
57 - code: `const composio = new Composio({ apiKey: 'your-api-key' });
58 -const session = await composio.toolRouter.use('session_123');
59 -const { items } = await session.files.list({ path: '/' });`,
60 - },
61 -};
62 -
34 // Discover model files automatically
35 async function discoverModelFiles(): Promise<string[]> {
36 const files = await readdir(MODELS_DIR);
@@ -570,27 +541,17 @@ function generateClassMdx(classDoc: ClassDoc): string {
541 lines.push('## Usage');
542 lines.push('');
543
573 - const customUsage = CLASS_CUSTOM_USAGE[classDoc.name];
574 - if (customUsage) {
575 - lines.push(customUsage.intro);
576 - lines.push('');
577 - lines.push('```typescript');
578 - lines.push(customUsage.code);
579 - lines.push('```');
580 - } else {
581 - // Default: show as top-level composio.* property
582 - // Handle acronyms (e.g., "MCP" -> "mcp") vs PascalCase (e.g., "AuthConfigs" -> "authConfigs")
583 - const accessorName =
584 - classDoc.name === classDoc.name.toUpperCase()
585 - ? classDoc.name.toLowerCase()
586 - : classDoc.name.charAt(0).toLowerCase() + classDoc.name.slice(1);
587 - lines.push(`Access this class through the \`composio.${accessorName}\` property:`);
588 - lines.push('');
589 - lines.push('```typescript');
590 - lines.push(`const composio = new Composio({ apiKey: 'your-api-key' });`);
591 - lines.push(`const result = await composio.${accessorName}.list();`);
592 - lines.push('```');
593 - }
544 + // Handle acronyms (e.g., "MCP" -> "mcp") vs PascalCase (e.g., "AuthConfigs" -> "authConfigs")
545 + const accessorName =
546 + classDoc.name === classDoc.name.toUpperCase()
547 + ? classDoc.name.toLowerCase()
548 + : classDoc.name.charAt(0).toLowerCase() + classDoc.name.slice(1);
549 + lines.push(`Access this class through the \`composio.${accessorName}\` property:`);
550 + lines.push('');
551 + lines.push('```typescript');
552 + lines.push(`const composio = new Composio({ apiKey: 'your-api-key' });`);
553 + lines.push(`const result = await composio.${accessorName}.list();`);
554 + lines.push('```');
555 lines.push('');
556 }
557