@devries-cameron20 / composio Mirror · read-only / commits / caf085fce
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, 04:30 UTC

docs: extract Steps code properly for prompt copy, improve prompt text

- PromptBanner now extracts code blocks from sibling Steps with proper fenced markdown formatting instead of dumping raw innerText - Update prompt intro line to clarify code examples are appended below Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmitha Mallesh committed Mar 6, 2026 at 23:46 UTC caf085fce6f529da6195ef5e3c49999d9008ada9
2 files changed +53 -8
docs/components/quickstart/prompt-banner.tsx
+47 -2
@@ -11,9 +11,54 @@ export function PromptBanner({ children }: PromptBannerProps) {
11 const [copied, setCopied] = useState(false);
12 const contentRef = useRef<HTMLDivElement>(null);
13
14 + const extractSteps = (stepsEl: Element): string => {
15 + const parts: string[] = [];
16 + const steps = stepsEl.querySelectorAll('.fd-step');
17 +
18 + steps.forEach((step) => {
19 + // Step title
20 + const title = step.querySelector('h3, h4, [class*="StepTitle"]');
21 + if (title) parts.push(`### ${title.textContent?.trim()}`);
22 +
23 + // Code blocks — preserve as fenced code
24 + const codeBlocks = step.querySelectorAll('pre code');
25 + codeBlocks.forEach((code) => {
26 + // Try to detect language from class (e.g. "language-python")
27 + const langClass = Array.from(code.classList).find(c => c.startsWith('language-'));
28 + const lang = langClass?.replace('language-', '') ?? '';
29 + parts.push(`\`\`\`${lang}\n${code.textContent?.trim()}\n\`\`\``);
30 + });
31 +
32 + // Callouts / prose text (skip if it's just whitespace)
33 + const paragraphs = step.querySelectorAll(':scope > p, :scope > div:not(:has(pre)) > p');
34 + paragraphs.forEach((p) => {
35 + const text = p.textContent?.trim();
36 + if (text) parts.push(text);
37 + });
38 + });
39 +
40 + return parts.join('\n\n');
41 + };
42 +
43 const handleCopy = () => {
15 - const text = contentRef.current?.innerText ?? '';
16 - navigator.clipboard.writeText(text);
44 + const promptMeta = contentRef.current?.innerText ?? '';
45 +
46 + // Walk siblings after the banner to find the .fd-steps element
47 + let sibling = contentRef.current?.closest('.not-prose')?.nextElementSibling;
48 + let stepsText = '';
49 + while (sibling) {
50 + if (sibling.classList.contains('fd-steps')) {
51 + stepsText = extractSteps(sibling);
52 + break;
53 + }
54 + sibling = sibling.nextElementSibling;
55 + }
56 +
57 + const fullPrompt = stepsText
58 + ? `${promptMeta}\n\n## Code from tutorial\n\n${stepsText}`
59 + : promptMeta;
60 +
61 + navigator.clipboard.writeText(fullPrompt);
62 setCopied(true);
63 setTimeout(() => setCopied(false), 2000);
64 };
docs/content/docs/quickstart.mdx
+6 -6
@@ -18,7 +18,7 @@ Build your first AI agent with Composio Tools. You'll create a [session](/docs/u
18
19 Give your OpenAI Agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio. Composio handles authentication, tool discovery, and execution. You create a **session** for a user, get tools from that session, and pass them to your Agent.
20
21 -Use the install commands and code examples from this page as reference.
21 +The complete code examples from the official tutorial are included below.
22
23 **Key concepts**
24
@@ -201,7 +201,7 @@ readline.close();
201
202 Give your OpenAI Agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio's hosted MCP server. No provider package needed — you connect directly to Composio's MCP endpoint. Composio handles authentication, tool discovery, and execution. You create a **session** for a user and pass the MCP connection to your Agent.
203
204 -Use the install commands and code examples from this page as reference.
204 +The complete code examples from the official tutorial are included below.
205
206 **Key concepts**
207
@@ -405,7 +405,7 @@ readline.close();
405
406 Give your Claude agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio. Composio handles authentication, tool discovery, and execution. You create a **session** for a user, get tools, wrap them in an SDK MCP server, and pass that server to ClaudeAgentOptions.
407
408 -Use the install commands and code examples from this page as reference.
408 +The complete code examples from the official tutorial are included below.
409
410 **Key concepts**
411
@@ -617,7 +617,7 @@ readline.close();
617
618 Give your Claude agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio's hosted MCP server. No provider package needed — you connect directly to Composio's MCP endpoint. Composio handles authentication, tool discovery, and execution. You create a **session** for a user and pass the MCP connection to ClaudeAgentOptions.
619
620 -Use the install commands and code examples from this page as reference.
620 +The complete code examples from the official tutorial are included below.
621
622 **Key concepts**
623
@@ -846,7 +846,7 @@ readline.close();
846
847 Give your Vercel AI agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio. Composio handles authentication, tool discovery, and execution. You create a **session** for a user, get tools from that session, and pass them to `streamText` or `generateText`. TypeScript only.
848
849 -Use the install commands and code examples from this page as reference.
849 +The complete code examples from the official tutorial are included below.
850
851 **Key concepts**
852
@@ -989,7 +989,7 @@ readline.close();
989
990 Give your Vercel AI agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio's hosted MCP server. No provider package needed — you connect directly to Composio's MCP endpoint using `@ai-sdk/mcp`. Composio handles authentication, tool discovery, and execution. TypeScript only.
991
992 -Use the install commands and code examples from this page as reference.
992 +The complete code examples from the official tutorial are included below.
993
994 **Key concepts**
995