@devries-cameron20 / composio-1 / commits / a18698787
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(docs): preserve install commands and agent setup in Markdown

Brendan O'Leary committed Sep 10, 2026 at 11:19 UTC a18698787f0752290e208eaf0dec81360cb7a14c
12 files changed +271 -119
docs/agent-guidance/context/markdown-components.md new
+24
@@ -0,0 +1,24 @@
1 +# Custom component Markdown audit
2 +
3 +Audit for DEVREL-35, 2026-09-10. Scope: components registered in `mdx-components.tsx` and used in `content/`. The page endpoint and full corpus call `getLLMText`; local and Algolia search records call `mdxToCleanMarkdown` on authored MDX.
4 +
5 +| Content | Components | Result |
6 +| --- | --- | --- |
7 +| Package installation | `PackageInstall` | Preserve all supported package-manager commands and display comments. Node and Python manager definitions are shared with the UI. Test every authored instance. |
8 +| Coding-agent setup | `AgentSetupActions`, `AgentFirstPrompt`, `AgentSetupGrid` | Preserve the same prompts and client destinations as the UI through shared data modules. |
9 +| Versioned API details | `ApiBaseUrl`, `ApiEndpointsTable` | Existing converters preserve version-specific URLs and endpoint tables. Existing tests cover raw and processed attributes. |
10 +| Decisions and warnings | `Callout`, `Tabs`, `Tab`, `TabsContent`, `FrameworkOption`, `IntegrationTabs`, `IntegrationContent`, `ToolTypeOption`, `ConnectClientOption`, `Accordion` | Existing converters retain text, labels, and warning content. |
11 +| Step instructions and definitions | `Steps`, `Step`, `StepTitle`, `Glossary`, `GlossaryTerm` | Existing converters retain headings and content. |
12 +| Linked content | `Card`, `ProviderCard`, `TemplateCard`, `HomeSurfaces`, `AIToolsBanner` | Existing converters retain destinations or route readers to canonical setup instructions. |
13 +| Media | `Figure`, `YouTube`, `Video` | Preserve captions and source links. Video links now survive conversion. Transcription of media is outside this audit. |
14 +| Example source | `FileBuildup`, `RepoBrowser` | Existing converters expose staged source or an explicit repository-availability notice. |
15 +| Structural wrappers and icons | `Cards`, `ProviderGrid`, `TemplateGrid`, `QuickstartFlow`, `FrameworkSelector`, `ToolTypeFlow`, `ConnectFlow`, `Accordions`, `CapabilityList`, `MediaSplit`, `AppLogo`, registered Lucide icons | Wrappers have no task instructions; their child content survives. Icons are decorative. |
16 +| Visual explanations | `SessionFlow`, `TriggersFlow`, `SlackBotFlow`, `LocalWorkbenchFlow`, `LocalSandboxBoundary`, `ImessageFlow`, `WorkbenchFlow`, `AuthConfigFlow`, `WhiteLabelFlow`, `ImportConnectionFlow`, `ManageConnectionsVisual`, `ConnectionRefreshVisual`, `InChatAuthTerminal`, `ClaudeMockUI` | Diagrams illustrate the surrounding guide. The authored instructions remain the executable path. Full visual-to-text parity is a follow-up, not claimed by this fix. |
17 +| Mermaid | `Mermaid` | `getLLMText` preserves processed diagram code. Raw component diagrams in search require separate parity coverage. |
18 +| Homepage and catalogs | `DocsHero`, `HomeFeatures`, `HomeResources`, `ToolkitsLanding`, `ManagedAuthList` | Dynamic content is not fully serialized by the generic converter. Product selection survives through `HomeSurfaces`; toolkit routes have dedicated Markdown renderers, and managed-auth prose includes the API lookup. Full catalog and homepage parity remains a follow-up. |
19 +
20 +`CapabilityCard` is registered but has no authored instances at this revision. Add a Markdown representation before introducing it into task-critical content.
21 +
22 +## Remaining checks
23 +
24 +DEVREL-32 should exercise actual HTTP page output, the full corpus, search ingestion, and external retrieval against the same expected facts. Static converter tests cannot prove an external index refreshed. DEVREL-38 can use the remaining visual and catalog gaps to prioritize task-complete pages. Do not treat this audit as evidence of benchmark improvement.
docs/components/agent-first-prompt.tsx
+1 -29
@@ -3,35 +3,7 @@
3 import { Check, Copy } from 'lucide-react';
4 import { useEffect, useRef, useState } from 'react';
5
6 -type AgentFirstPromptProps = {
7 - agent:
8 - | 'claude-code'
9 - | 'cline'
10 - | 'codex'
11 - | 'cursor'
12 - | 'gemini-cli'
13 - | 'github-copilot'
14 - | 'grok'
15 - | 'openclaw'
16 - | 'opencode';
17 -};
18 -
19 -const SKILL_INSTRUCTION: Record<AgentFirstPromptProps['agent'], string> = {
20 - 'claude-code': 'Use the /composio skill to get Composio working in this codebase.',
21 - cline: 'Use the composio agent skill to get Composio working in this codebase.',
22 - codex: 'Use the $composio skill to get Composio working in this codebase.',
23 - cursor: 'Use the composio agent skill to get Composio working in this codebase.',
24 - 'gemini-cli': 'Use the composio agent skill to get Composio working in this codebase.',
25 - 'github-copilot': 'Use /composio to get Composio working in this codebase.',
26 - grok: 'Use the composio agent skill to get Composio working in this codebase.',
27 - openclaw: 'Use the composio agent skill to get Composio working in this codebase.',
28 - opencode: 'Use the composio agent skill to get Composio working in this codebase.',
29 -};
30 -
31 -const promptFor = (agent: AgentFirstPromptProps['agent']) => `${SKILL_INSTRUCTION[agent]}
32 -
33 -Help me connect an integration and make my first real tool call.
34 -When it works, show me what changed and what I can try next.`;
6 +import { promptFor, type AgentFirstPromptProps } from '@/lib/agent-prompts';
7
8 export function AgentFirstPrompt({ agent }: AgentFirstPromptProps) {
9 const [copied, setCopied] = useState(false);
docs/components/agent-setup-actions.tsx
+1 -11
@@ -6,17 +6,7 @@ import Link from 'next/link';
6 import { useEffect, useRef, useState } from 'react';
7 import { cn } from '@/lib/utils';
8
9 -const SETUP_PROMPT = `Help me add Composio to this project. First, inspect the codebase to understand its framework, agent architecture, authentication, and user or tenant identity model.
10 -
11 -Check whether the official \`composio\` Agent Skill is installed. If it is missing, install it for this project with:
12 -
13 -\`npx skills add ComposioHQ/composio --skill composio\`
14 -
15 -Then load and follow the skill. If installation requires approval, ask for it. If the host does not support skills or installation fails, use the current documentation at [https://docs.composio.dev](https://docs.composio.dev) and report that fallback.
16 -
17 -Default to Composio Platform for application codebases. Use Composio For You only when the project clearly configures a personal agent or automation for the developer’s own accounts.
18 -
19 -Based on the codebase, explain briefly where Composio would fit. Then ask what I want my users or agent to accomplish with connected apps. If the project suggests likely use cases, offer a few relevant options. If it is not clear whether I want to build Composio into the application or connect it to my coding agent, ask me before making changes.`;
9 +import { SETUP_PROMPT } from '@/lib/agent-prompts';
10
11 const AGENT_LOGOS = [
12 { src: '/images/clients/claude.svg', label: 'Claude' },
docs/components/agent-setup-grid.tsx
+1 -56
@@ -2,62 +2,7 @@ import Image from 'next/image';
2 import Link from 'next/link';
3 import { ArrowUpRight } from 'lucide-react';
4
5 -const AGENTS = [
6 - {
7 - name: 'Claude Code',
8 - icon: '/images/clients/claude.svg',
9 - href: '/docs/agent-setup/clients#claude-code',
10 - description: 'Install the skill in your project, or use the native Composio plugin for direct app actions.',
11 - },
12 - {
13 - name: 'OpenAI Codex',
14 - icon: '/images/clients/codex.png',
15 - href: '/docs/agent-setup/clients#openai-codex',
16 - description: 'Install the skill in your project, or add the native Codex plugin for direct app actions.',
17 - },
18 - {
19 - name: 'Cursor',
20 - icon: '/images/clients/cursor.svg',
21 - href: '/docs/agent-setup/clients#cursor',
22 - description: 'Add the skill to your project so Cursor can build and configure Composio integrations.',
23 - },
24 - {
25 - name: 'GitHub Copilot',
26 - icon: '/images/clients/vscode.svg',
27 - href: '/docs/agent-setup/clients#github-copilot',
28 - description: 'Give Copilot agent mode the Composio guidance it needs inside your repository.',
29 - },
30 - {
31 - name: 'Gemini CLI',
32 - icon: '/images/clients/gemini.svg',
33 - href: '/docs/agent-setup/clients#gemini-cli',
34 - description: 'Install the skill from your project directory before asking Gemini to add Composio.',
35 - },
36 - {
37 - name: 'OpenClaw',
38 - icon: '/images/clients/openclaw.svg',
39 - href: '/docs/agent-setup/clients#openclaw',
40 - description: 'Install the skill for build guidance, or connect Composio for personal app access.',
41 - },
42 - {
43 - name: 'OpenCode',
44 - icon: '/images/clients/opencode.svg',
45 - href: '/docs/agent-setup/clients#opencode',
46 - description: 'Install the skill in your project so OpenCode can build and configure Composio integrations.',
47 - },
48 - {
49 - name: 'Cline',
50 - icon: '/images/clients/cline.svg',
51 - href: '/docs/agent-setup/clients#cline',
52 - description: 'Add the skill to your repository so Cline can follow the current Composio integration path.',
53 - },
54 - {
55 - name: 'Grok Build',
56 - icon: '/images/clients/grok.svg',
57 - href: '/docs/agent-setup/clients#grok-build',
58 - description: 'Install the skill for Grok Build to add Composio and make your first tool call.',
59 - },
60 -] as const;
5 +import { AGENTS } from '@/lib/agent-setup-clients';
6
7 export function AgentSetupGrid() {
8 return (
docs/components/package-install.tsx
+3 -14
@@ -6,20 +6,9 @@ import { Check, Clipboard } from 'lucide-react';
6 import { CodeBlock, Pre } from 'fumadocs-ui/components/codeblock';
7 import { cn } from '@/lib/utils';
8
9 -const ECOSYSTEMS = {
10 - node: [
11 - { id: 'npm', install: 'npm install' },
12 - { id: 'pnpm', install: 'pnpm add' },
13 - { id: 'bun', install: 'bun add' },
14 - { id: 'yarn', install: 'yarn add' },
15 - ],
16 - python: [
17 - { id: 'uv', install: 'uv add' },
18 - { id: 'pip', install: 'pip install' },
19 - ],
20 -} as const;
9 +import { PACKAGE_MANAGERS } from '@/lib/package-install';
10
22 -type Ecosystem = keyof typeof ECOSYSTEMS;
11 +type Ecosystem = keyof typeof PACKAGE_MANAGERS;
12
13 /**
14 * Install-command code block whose copy button is a package-manager picker.
@@ -45,7 +34,7 @@ export function PackageInstall({
34 /** Which package managers to offer; defaults to node (npm/pnpm/bun/yarn) */
35 ecosystem?: Ecosystem;
36 }) {
48 - const managers = ECOSYSTEMS[ecosystem];
37 + const managers = PACKAGE_MANAGERS[ecosystem];
38 const [manager, setManager] = useState<string>(managers[0].id);
39 const [open, setOpen] = useState(false);
40 const [position, setPosition] = useState<{ top: number; left: number } | null>(null);
docs/lib/agent-prompts.ts new
+42
@@ -0,0 +1,42 @@
1 +export type AgentFirstPromptProps = {
2 + agent:
3 + | 'claude-code'
4 + | 'cline'
5 + | 'codex'
6 + | 'cursor'
7 + | 'gemini-cli'
8 + | 'github-copilot'
9 + | 'grok'
10 + | 'openclaw'
11 + | 'opencode';
12 +};
13 +
14 +const SKILL_INSTRUCTION: Record<AgentFirstPromptProps['agent'], string> = {
15 + 'claude-code': 'Use the /composio skill to get Composio working in this codebase.',
16 + cline: 'Use the composio agent skill to get Composio working in this codebase.',
17 + codex: 'Use the $composio skill to get Composio working in this codebase.',
18 + cursor: 'Use the composio agent skill to get Composio working in this codebase.',
19 + 'gemini-cli': 'Use the composio agent skill to get Composio working in this codebase.',
20 + 'github-copilot': 'Use /composio to get Composio working in this codebase.',
21 + grok: 'Use the composio agent skill to get Composio working in this codebase.',
22 + openclaw: 'Use the composio agent skill to get Composio working in this codebase.',
23 + opencode: 'Use the composio agent skill to get Composio working in this codebase.',
24 +};
25 +
26 +export const promptFor = (agent: AgentFirstPromptProps['agent']) => `${SKILL_INSTRUCTION[agent]}
27 +
28 +Help me connect an integration and make my first real tool call.
29 +When it works, show me what changed and what I can try next.`;
30 +
31 +export const SETUP_PROMPT = `Help me add Composio to this project. First, inspect the codebase to understand its framework, agent architecture, authentication, and user or tenant identity model.
32 +
33 +Check whether the official \`composio\` Agent Skill is installed. If it is missing, install it for this project with:
34 +
35 +\`npx skills add ComposioHQ/composio --skill composio\`
36 +
37 +Then load and follow the skill. If installation requires approval, ask for it. If the host does not support skills or installation fails, use the current documentation at [https://docs.composio.dev](https://docs.composio.dev) and report that fallback.
38 +
39 +Default to Composio Platform for application codebases. Use Composio For You only when the project clearly configures a personal agent or automation for the developer’s own accounts.
40 +
41 +Based on the codebase, explain briefly where Composio would fit. Then ask what I want my users or agent to accomplish with connected apps. If the project suggests likely use cases, offer a few relevant options. If it is not clear whether I want to build Composio into the application or connect it to my coding agent, ask me before making changes.`;
42 +
docs/lib/agent-setup-clients.ts new
+57
@@ -0,0 +1,57 @@
1 +export const AGENTS = [
2 + {
3 + name: 'Claude Code',
4 + icon: '/images/clients/claude.svg',
5 + href: '/docs/agent-setup/clients#claude-code',
6 + description: 'Install the skill in your project, or use the native Composio plugin for direct app actions.',
7 + },
8 + {
9 + name: 'OpenAI Codex',
10 + icon: '/images/clients/codex.png',
11 + href: '/docs/agent-setup/clients#openai-codex',
12 + description: 'Install the skill in your project, or add the native Codex plugin for direct app actions.',
13 + },
14 + {
15 + name: 'Cursor',
16 + icon: '/images/clients/cursor.svg',
17 + href: '/docs/agent-setup/clients#cursor',
18 + description: 'Add the skill to your project so Cursor can build and configure Composio integrations.',
19 + },
20 + {
21 + name: 'GitHub Copilot',
22 + icon: '/images/clients/vscode.svg',
23 + href: '/docs/agent-setup/clients#github-copilot',
24 + description: 'Give Copilot agent mode the Composio guidance it needs inside your repository.',
25 + },
26 + {
27 + name: 'Gemini CLI',
28 + icon: '/images/clients/gemini.svg',
29 + href: '/docs/agent-setup/clients#gemini-cli',
30 + description: 'Install the skill from your project directory before asking Gemini to add Composio.',
31 + },
32 + {
33 + name: 'OpenClaw',
34 + icon: '/images/clients/openclaw.svg',
35 + href: '/docs/agent-setup/clients#openclaw',
36 + description: 'Install the skill for build guidance, or connect Composio for personal app access.',
37 + },
38 + {
39 + name: 'OpenCode',
40 + icon: '/images/clients/opencode.svg',
41 + href: '/docs/agent-setup/clients#opencode',
42 + description: 'Install the skill in your project so OpenCode can build and configure Composio integrations.',
43 + },
44 + {
45 + name: 'Cline',
46 + icon: '/images/clients/cline.svg',
47 + href: '/docs/agent-setup/clients#cline',
48 + description: 'Add the skill to your repository so Cline can follow the current Composio integration path.',
49 + },
50 + {
51 + name: 'Grok Build',
52 + icon: '/images/clients/grok.svg',
53 + href: '/docs/agent-setup/clients#grok-build',
54 + description: 'Install the skill for Grok Build to add Composio and make your first tool call.',
55 + },
56 +] as const;
57 +
docs/lib/package-install.ts new
+12
@@ -0,0 +1,12 @@
1 +export const PACKAGE_MANAGERS = {
2 + node: [
3 + { id: 'npm', install: 'npm install' },
4 + { id: 'pnpm', install: 'pnpm add' },
5 + { id: 'bun', install: 'bun add' },
6 + { id: 'yarn', install: 'yarn add' },
7 + ],
8 + python: [
9 + { id: 'uv', install: 'uv add' },
10 + { id: 'pip', install: 'pip install' },
11 + ],
12 +} as const;
docs/lib/source.ts
+51
@@ -20,6 +20,10 @@ import { API_BASE_URLS, detectApiVersion, type ApiVersion } from './api-version'
20 import { apiVersionPointer } from './api-version-guidance';
21 import { apiEndpointsSchema } from './api-endpoints-table-schema';
22 import { replaceHomeNavigationMarkdown } from './home-navigation';
23 +import { PACKAGE_MANAGERS } from './package-install';
24 +import { z } from 'zod';
25 +import { promptFor, SETUP_PROMPT } from './agent-prompts';
26 +import { AGENTS } from './agent-setup-clients';
27
28 /**
29 * True if a reference URL belongs to an intentionally-hidden API tag
@@ -201,6 +205,34 @@ function decodeHtmlEntities(value: string): string {
205 .replace(/&amp;/g, '&');
206 }
207
208 +const packageInstallSchema = z.object({
209 + packages: z.string().min(1),
210 + ecosystem: z.enum(['node', 'python']).default('node'),
211 + comment: z.array(z.string()).default([]),
212 +});
213 +
214 +/** Only literal attributes are supported; MDX expressions are never evaluated. */
215 +function packageInstallToMarkdown(attributes: string): string {
216 + const quoted = (name: string) => {
217 + const match = attributes.match(new RegExp(`\\b${name}=(?:"([^"]*)"|'([^']*)')`));
218 + return match ? decodeHtmlEntities(match[1] ?? match[2]) : undefined;
219 + };
220 + const comment = quoted('comment') ?? attributes.match(/\bcomment=\{(\[[\s\S]*?\])\}/)?.[1];
221 + const comments = comment?.trim().startsWith('[')
222 + ? Array.from(comment.matchAll(/(['"])((?:\\.|(?!\1)[^\\])*)\1/g), match =>
223 + match[2].replace(/\\(['"\\])/g, '$1'),
224 + )
225 + : comment ? [comment] : [];
226 + const props = packageInstallSchema.parse({
227 + packages: quoted('packages'),
228 + ecosystem: quoted('ecosystem'),
229 + comment: comments,
230 + });
231 + return PACKAGE_MANAGERS[props.ecosystem].map(manager =>
232 + `\n**${manager.id}:**\n\n\`\`\`bash\n${manager.install} ${props.packages}${props.comment.map(line => `\n# ${line}`).join('')}\n\`\`\`\n`,
233 + ).join('\n');
234 +}
235 +
236 /**
237 * Renders an `<ApiEndpointsTable />` payload as a markdown table.
238 *
@@ -277,6 +309,25 @@ export function mdxToCleanMarkdown(content: string, url?: string): string {
309
310 result = replaceHomeNavigationMarkdown(result);
311
312 + // Keep installation commands in both raw search input and processed page Markdown.
313 + result = result.replace(/<PackageInstall\b([\s\S]*?)\/>/g, (_, attributes: string) =>
314 + packageInstallToMarkdown(attributes),
315 + );
316 + result = result.replace(/<AgentSetupActions\b[^>]*\/>/g,
317 + `\n[Agent setup](/docs/agent-setup)\n\n${SETUP_PROMPT}\n`,
318 + );
319 + result = result.replace(/<AgentSetupGrid\s*\/>/g,
320 + AGENTS.map(agent => `- [${agent.name}](${agent.href}): ${agent.description}`).join('\n'),
321 + );
322 + result = result.replace(/<AgentFirstPrompt\s+agent="([^"]+)"\s*\/>/g, (_, agent: string) => {
323 + const parsed = z.enum(['claude-code', 'cline', 'codex', 'cursor', 'gemini-cli',
324 + 'github-copilot', 'grok', 'openclaw', 'opencode']).parse(agent);
325 + return `\n\`\`\`text\n${promptFor(parsed)}\n\`\`\`\n`;
326 + });
327 + result = result.replace(/<Video\b[^>]*src="([^"]+)"[^>]*caption="([^"]+)"[^>]*\/>/g,
328 + '[Video: $2]($1)',
329 + );
330 +
331 // Convert YouTube to link
332 result = result.replace(
333 /<YouTube\s+id="([^"]+)"\s+title="([^"]+)"\s*\/>/g,
docs/tests/integration/package-install-markdown.test.ts new
+17
@@ -0,0 +1,17 @@
1 +import { expect, test } from 'bun:test';
2 +import { fetchPage } from './helpers';
3 +
4 +test('install commands and setup prompts survive HTTP Markdown and the full corpus', async () => {
5 + const cases = [
6 + ['/docs/quickstart.md', 'npm install @composio/core', 'uv add python-dotenv composio', 'Use @composio/slim'],
7 + ['/docs/providers/anthropic.md', 'npm install @composio/core @composio/anthropic', 'pip install composio composio_anthropic'],
8 + ['/docs/agent-setup/clients.md', 'Use the $composio skill', 'Use the /composio skill'],
9 + ['/llms-full.txt', 'npm install @composio/core', 'uv add python-dotenv composio', 'Use @composio/slim'],
10 + ];
11 + for (const [path, ...facts] of cases) {
12 + const response = await fetchPage(path);
13 + expect(response.status, path).toBe(200);
14 + const text = await response.text();
15 + for (const fact of facts) expect(text, `${path}: ${fact}`).toContain(fact);
16 + }
17 +});
docs/tests/static/home-navigation.test.ts
+11 -9
@@ -1,3 +1,4 @@
1 +import { SETUP_PROMPT } from '../../lib/agent-prompts';
2 import { describe, expect, test } from 'bun:test';
3
4 import {
@@ -93,8 +94,8 @@ describe('Welcome navigation', () => {
94 expect(source).toContain('/docs/agent-setup');
95 expect(source).not.toContain('ProductSelectionLink');
96 expect(source).toContain('navigator.clipboard.writeText(SETUP_PROMPT)');
96 - expect(source).toContain('npx skills add ComposioHQ/composio --skill composio');
97 - expect(source).toContain('https://docs.composio.dev');
97 + expect(SETUP_PROMPT).toContain('npx skills add ComposioHQ/composio --skill composio');
98 + expect(SETUP_PROMPT).toContain('https://docs.composio.dev');
99 expect(heroSource).toContain('<AgentSetupActions />');
100 expect(quickstartSource).toContain('<AgentSetupActions');
101 for (const logo of ['claude.svg', 'codex.png', 'cursor.svg']) {
@@ -105,7 +106,7 @@ describe('Welcome navigation', () => {
106
107 test('links every agent setup card to instructions on the Clients page', async () => {
108 const grid = await Bun.file(
108 - new URL('../../components/agent-setup-grid.tsx', import.meta.url)
109 + new URL('../../lib/agent-setup-clients.ts', import.meta.url)
110 ).text();
111 const clients = await Bun.file(
112 new URL('../../content/docs/agent-setup/clients.mdx', import.meta.url)
@@ -186,13 +187,14 @@ describe('Welcome navigation', () => {
187 const firstPrompt = await Bun.file(
188 new URL('../../components/agent-first-prompt.tsx', import.meta.url)
189 ).text();
190 + const promptSource = await Bun.file(new URL('../../lib/agent-prompts.ts', import.meta.url)).text();
191 expect(firstPrompt).toContain('navigator.clipboard.writeText(prompt)');
190 - expect(firstPrompt).toContain("'claude-code': 'Use the /composio skill");
191 - expect(firstPrompt).toContain("codex: 'Use the $composio skill");
192 - expect(firstPrompt).toContain("'github-copilot': 'Use /composio");
193 - expect(firstPrompt).toContain("cursor: 'Use the composio agent skill");
194 - expect(firstPrompt).toContain('Help me connect an integration and make my first real tool call.');
195 - expect(firstPrompt).toContain('When it works, show me what changed and what I can try next.');
192 + expect(promptSource).toContain("'claude-code': 'Use the /composio skill");
193 + expect(promptSource).toContain("codex: 'Use the $composio skill");
194 + expect(promptSource).toContain("'github-copilot': 'Use /composio");
195 + expect(promptSource).toContain("cursor: 'Use the composio agent skill");
196 + expect(promptSource).toContain('Help me connect an integration and make my first real tool call.');
197 + expect(promptSource).toContain('When it works, show me what changed and what I can try next.');
198 });
199
200 test('advertises only toolkits that exist in the catalog', async () => {
docs/tests/static/package-install-markdown.test.ts new
+51
@@ -0,0 +1,51 @@
1 +import { describe, expect, test } from 'bun:test';
2 +import { readFileSync } from 'node:fs';
3 +import { Glob } from 'bun';
4 +import { mdxToCleanMarkdown, getLLMText } from '../../lib/source';
5 +import { recordsFromMarkdownPage } from '../../lib/search-index';
6 +
7 +describe('PackageInstall Markdown', () => {
8 + test('preserves alternatives and comments in authored and processed MDX', () => {
9 + for (const input of [
10 + `<PackageInstall packages="@composio/core" comment={['Use @composio/slim instead.', 'Choose one package.']} />`,
11 + `<PackageInstall packages="@composio/core" comment="[&#x27;Use @composio/slim instead.&#x27;, &#x27;Choose one package.&#x27;]" />`,
12 + ]) {
13 + const markdown = mdxToCleanMarkdown(input);
14 + for (const command of ['npm install', 'pnpm add', 'bun add', 'yarn add']) {
15 + expect(markdown).toContain(`${command} @composio/core`);
16 + }
17 + expect(markdown).toContain('# Use @composio/slim instead.');
18 + expect(markdown).toContain('# Choose one package.');
19 + }
20 + const python = mdxToCleanMarkdown(`<PackageInstall ecosystem="python" packages="composio &#x27;ag2[openai]&#x27;" />`);
21 + expect(python).toContain("uv add composio 'ag2[openai]'");
22 + expect(python).toContain("pip install composio 'ag2[openai]'");
23 + });
24 +
25 + test('every authored installation reaches page text and search records', async () => {
26 + let checked = 0;
27 + for (const path of new Glob('content/**/*.mdx').scanSync('.')) {
28 + const raw = readFileSync(path, 'utf8');
29 + const installs = [...raw.matchAll(/<PackageInstall\b[\s\S]*?packages="([^"]+)"[\s\S]*?\/>/g)];
30 + if (!installs.length) continue;
31 + const url = '/' + path.replace(/^content\//, '').replace(/\/index\.mdx$/, '').replace(/\.mdx$/, '');
32 + const page = await getLLMText({ url, data: { title: path, getText: async () => raw } });
33 + const records = recordsFromMarkdownPage({ url, title: path, type: 'docs', markdown: raw });
34 + const search = records.map(record => record.content).join('\n');
35 + for (const install of installs) {
36 + expect(page, path).toContain(install[1]);
37 + expect(search, path).toContain(install[1]);
38 + checked++;
39 + }
40 + }
41 + expect(checked).toBeGreaterThan(40);
42 + });
43 +
44 + test('keeps agent setup instructions, client links, and video descriptions', () => {
45 + const text = mdxToCleanMarkdown(`<AgentSetupActions /><AgentSetupGrid /><AgentFirstPrompt agent="codex" /><Video src="/demo.mp4" caption="Connect your account" />`);
46 + expect(text).toContain('npx skills add ComposioHQ/composio --skill composio');
47 + expect(text).toContain('Use the $composio skill');
48 + expect(text).toContain('/docs/agent-setup/clients#openai-codex');
49 + expect(text).toContain('[Video: Connect your account](/demo.mp4)');
50 + });
51 +});