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

feat(docs): add page actions and fix dev memory issue

- Replace CopyPage with PageActions component (copy + view as markdown) - Disable twoslash in dev mode to prevent heap memory issues - Document twoslash dev/prod behavior in CLAUDE.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 19, 2026 at 14:56 UTC c14896e2b32c2e70a1eed28820e2c9feafa9f2d4
5 files changed +85 -67
docs/CLAUDE.md
+2
@@ -39,6 +39,7 @@ CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**
39 3. **Toolkits data**: `public/data/toolkits.json` must exist - errors are thrown, not silently ignored
40 4. **Root directory on Vercel**: Set to `docs` with "Include files outside root directory" DISABLED
41 5. **Mobile nav**: Always test CSS changes on mobile. Fumadocs uses different nav patterns (dropdown on mobile, horizontal on desktop). Avoid absolute positioning or pseudo-elements that assume horizontal layout.
42 +6. **Twoslash in dev**: Twoslash is disabled in `bun dev` due to heap memory issues (loads full TypeScript compiler). Type checking only runs during `bun run build`. Run build locally to catch type errors before pushing.
43
44 ## Twoslash - TypeScript Code Block Type Checking
45
@@ -50,6 +51,7 @@ CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**
51 - **Default on**: All TypeScript blocks are validated. No annotation needed.
52 - **Build-time validation**: Type errors fail the build.
53 - **CI enforcement**: `.github/workflows/docs-typescript-check.yml` runs on PRs to docs/
54 +- **Disabled in dev**: Twoslash is disabled during `bun dev` to prevent heap memory issues. It only runs during `bun run build` / CI.
55
56 ### Exclusions
57 - **Reference docs** (`/content/reference/`): Excluded from Twoslash via collection-level `mdxOptions` in `source.config.ts`. These are auto-generated and don't need type checking.
docs/app/(home)/docs/[[...slug]]/page.tsx
+2 -7
@@ -1,7 +1,6 @@
1 import { getPageImage, source } from '@/lib/source';
2 import {
3 DocsBody,
4 - DocsDescription,
4 DocsPage,
5 DocsTitle,
6 } from 'fumadocs-ui/layouts/docs/page';
@@ -9,7 +8,7 @@ import { notFound } from 'next/navigation';
8 import { getMDXComponents } from '@/mdx-components';
9 import type { Metadata } from 'next';
10 import { createRelativeLink } from 'fumadocs-ui/mdx';
12 -import { CopyPage } from '@/components/copy-page';
11 +import { PageActions } from '@/components/page-actions';
12
13 export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
14 const params = await props.params;
@@ -22,12 +21,8 @@ export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
21
22 return (
23 <DocsPage toc={data.toc} full={data.full} footer={{ enabled: false }} tableOfContentPopover={{ enabled: false }}>
25 - <div className="flex items-center justify-between mb-2">
26 - <div className="flex-1" />
27 - <CopyPage path={page.url} />
28 - </div>
24 <DocsTitle>{data.title}</DocsTitle>
30 - <DocsDescription className="mb-6">{data.description}</DocsDescription>
25 + <PageActions path={page.url} />
26 <DocsBody>
27 <MDX
28 components={getMDXComponents({
docs/components/copy-page.tsx deleted
-52
@@ -1,52 +0,0 @@
1 -'use client';
2 -
3 -import { useState } from 'react';
4 -import { Copy, Check, Loader2 } from 'lucide-react';
5 -
6 -interface CopyPageProps {
7 - /** The URL path to fetch markdown from (e.g., /docs/quickstart) */
8 - path: string;
9 -}
10 -
11 -/**
12 - * Button that copies the current page's markdown content to clipboard.
13 - * Fetches from the .md endpoint for clean, AI-friendly content.
14 - */
15 -export function CopyPage({ path }: CopyPageProps) {
16 - const [state, setState] = useState<'idle' | 'loading' | 'copied'>('idle');
17 -
18 - const handleCopy = async () => {
19 - setState('loading');
20 -
21 - try {
22 - const response = await fetch(`${path}.md`);
23 - if (!response.ok) throw new Error('Failed to fetch');
24 -
25 - const markdown = await response.text();
26 - await navigator.clipboard.writeText(markdown);
27 -
28 - setState('copied');
29 - setTimeout(() => setState('idle'), 2000);
30 - } catch {
31 - setState('idle');
32 - }
33 - };
34 -
35 - return (
36 - <button
37 - onClick={handleCopy}
38 - disabled={state === 'loading'}
39 - className="inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-orange-500 focus-visible:ring-offset-2 disabled:opacity-50"
40 - aria-label="Copy page as markdown"
41 - >
42 - {state === 'loading' ? (
43 - <Loader2 className="w-4 h-4 animate-spin" aria-hidden="true" />
44 - ) : state === 'copied' ? (
45 - <Check className="w-4 h-4 text-green-500" aria-hidden="true" />
46 - ) : (
47 - <Copy className="w-4 h-4" aria-hidden="true" />
48 - )}
49 - {state === 'copied' ? 'Copied!' : 'Copy markdown'}
50 - </button>
51 - );
52 -}
docs/components/page-actions.tsx new
+69
@@ -0,0 +1,69 @@
1 +'use client';
2 +
3 +import { useState } from 'react';
4 +import { Copy, Check, Loader2, ExternalLink } from 'lucide-react';
5 +
6 +interface PageActionsProps {
7 + path: string;
8 +}
9 +
10 +/**
11 + * Actions for the current page: copy markdown, open as markdown.
12 + * Provides AI-friendly access to documentation content.
13 + */
14 +export function PageActions({ path }: PageActionsProps) {
15 + const [copyState, setCopyState] = useState<'idle' | 'loading' | 'copied'>('idle');
16 +
17 + const handleCopy = async () => {
18 + setCopyState('loading');
19 +
20 + try {
21 + const response = await fetch(`${path}.md`);
22 + if (!response.ok) throw new Error('Failed to fetch');
23 +
24 + const markdown = await response.text();
25 + await navigator.clipboard.writeText(markdown);
26 +
27 + setCopyState('copied');
28 + setTimeout(() => setCopyState('idle'), 2000);
29 + } catch {
30 + setCopyState('idle');
31 + }
32 + };
33 +
34 + const handleOpen = () => {
35 + window.open(`${path}.md`, '_blank');
36 + };
37 +
38 + return (
39 + <div className="flex items-center gap-4 mt-2 mb-6">
40 + <button
41 + onClick={handleCopy}
42 + disabled={copyState === 'loading'}
43 + className="inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring disabled:opacity-50"
44 + aria-label="Copy page as markdown"
45 + >
46 + {copyState === 'loading' ? (
47 + <Loader2 className="w-4 h-4 animate-spin" aria-hidden="true" />
48 + ) : copyState === 'copied' ? (
49 + <Check className="w-4 h-4 text-green-500" aria-hidden="true" />
50 + ) : (
51 + <Copy className="w-4 h-4" aria-hidden="true" />
52 + )}
53 + {copyState === 'copied' ? 'Copied!' : 'Copy page'}
54 + </button>
55 +
56 + <span className="text-fd-muted-foreground/50" aria-hidden="true">·</span>
57 +
58 + <a
59 + href={`${path}.md`}
60 + target="_blank"
61 + rel="noopener noreferrer"
62 + className="inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring"
63 + >
64 + <ExternalLink className="w-4 h-4" aria-hidden="true" />
65 + View as markdown
66 + </a>
67 + </div>
68 + );
69 +}
docs/source.config.ts
+12 -8
@@ -99,14 +99,18 @@ export default defineConfig({
99 light: 'github-light',
100 dark: 'github-dark',
101 },
102 - transformers: [
103 - transformerTwoslash({
104 - explicitTrigger: false, // All TypeScript blocks are validated
105 - typesCache: createFileSystemTypesCache({
106 - dir: '.next/cache/twoslash', // Inside .next/cache so Vercel persists it
107 - }),
108 - }),
109 - ],
102 + // Twoslash disabled in dev (heap memory issues), enabled in build/CI
103 + transformers:
104 + process.env.NODE_ENV === 'production'
105 + ? [
106 + transformerTwoslash({
107 + explicitTrigger: false,
108 + typesCache: createFileSystemTypesCache({
109 + dir: '.next/cache/twoslash',
110 + }),
111 + }),
112 + ]
113 + : [],
114 },
115 },
116 });