Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

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

Sushmithamalleshc14896e2b32c
diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md
index 462770529..d3465fce2 100644
--- a/docs/CLAUDE.md
+++ b/docs/CLAUDE.md
@@ -39,6 +39,7 @@ CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**
3. **Toolkits data**: `public/data/toolkits.json` must exist - errors are thrown, not silently ignored
4. **Root directory on Vercel**: Set to `docs` with "Include files outside root directory" DISABLED
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.
+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.
## Twoslash - TypeScript Code Block Type Checking
@@ -50,6 +51,7 @@ CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**
- **Default on**: All TypeScript blocks are validated. No annotation needed.
- **Build-time validation**: Type errors fail the build.
- **CI enforcement**: `.github/workflows/docs-typescript-check.yml` runs on PRs to docs/
+- **Disabled in dev**: Twoslash is disabled during `bun dev` to prevent heap memory issues. It only runs during `bun run build` / CI.
### Exclusions
- **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.
diff --git a/docs/app/(home)/docs/[[...slug]]/page.tsx b/docs/app/(home)/docs/[[...slug]]/page.tsx
index cee3f56ab..31754a65b 100644
--- a/docs/app/(home)/docs/[[...slug]]/page.tsx
+++ b/docs/app/(home)/docs/[[...slug]]/page.tsx
@@ -1,7 +1,6 @@
import { getPageImage, source } from '@/lib/source';
import {
DocsBody,
- DocsDescription,
DocsPage,
DocsTitle,
} from 'fumadocs-ui/layouts/docs/page';
@@ -9,7 +8,7 @@ import { notFound } from 'next/navigation';
import { getMDXComponents } from '@/mdx-components';
import type { Metadata } from 'next';
import { createRelativeLink } from 'fumadocs-ui/mdx';
-import { CopyPage } from '@/components/copy-page';
+import { PageActions } from '@/components/page-actions';
export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
const params = await props.params;
@@ -22,12 +21,8 @@ export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
return (
<DocsPage toc={data.toc} full={data.full} footer={{ enabled: false }} tableOfContentPopover={{ enabled: false }}>
- <div className="flex items-center justify-between mb-2">
- <div className="flex-1" />
- <CopyPage path={page.url} />
- </div>
<DocsTitle>{data.title}</DocsTitle>
- <DocsDescription className="mb-6">{data.description}</DocsDescription>
+ <PageActions path={page.url} />
<DocsBody>
<MDX
components={getMDXComponents({
diff --git a/docs/components/copy-page.tsx b/docs/components/copy-page.tsx
deleted file mode 100644
index 32a9f0322..000000000
--- a/docs/components/copy-page.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-'use client';
-
-import { useState } from 'react';
-import { Copy, Check, Loader2 } from 'lucide-react';
-
-interface CopyPageProps {
- /** The URL path to fetch markdown from (e.g., /docs/quickstart) */
- path: string;
-}
-
-/**
- * Button that copies the current page's markdown content to clipboard.
- * Fetches from the .md endpoint for clean, AI-friendly content.
- */
-export function CopyPage({ path }: CopyPageProps) {
- const [state, setState] = useState<'idle' | 'loading' | 'copied'>('idle');
-
- const handleCopy = async () => {
- setState('loading');
-
- try {
- const response = await fetch(`${path}.md`);
- if (!response.ok) throw new Error('Failed to fetch');
-
- const markdown = await response.text();
- await navigator.clipboard.writeText(markdown);
-
- setState('copied');
- setTimeout(() => setState('idle'), 2000);
- } catch {
- setState('idle');
- }
- };
-
- return (
- <button
- onClick={handleCopy}
- disabled={state === 'loading'}
- 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"
- aria-label="Copy page as markdown"
- >
- {state === 'loading' ? (
- <Loader2 className="w-4 h-4 animate-spin" aria-hidden="true" />
- ) : state === 'copied' ? (
- <Check className="w-4 h-4 text-green-500" aria-hidden="true" />
- ) : (
- <Copy className="w-4 h-4" aria-hidden="true" />
- )}
- {state === 'copied' ? 'Copied!' : 'Copy markdown'}
- </button>
- );
-}
diff --git a/docs/components/page-actions.tsx b/docs/components/page-actions.tsx
new file mode 100644
index 000000000..77e878ad7
--- /dev/null
+++ b/docs/components/page-actions.tsx
@@ -0,0 +1,69 @@
+'use client';
+
+import { useState } from 'react';
+import { Copy, Check, Loader2, ExternalLink } from 'lucide-react';
+
+interface PageActionsProps {
+ path: string;
+}
+
+/**
+ * Actions for the current page: copy markdown, open as markdown.
+ * Provides AI-friendly access to documentation content.
+ */
+export function PageActions({ path }: PageActionsProps) {
+ const [copyState, setCopyState] = useState<'idle' | 'loading' | 'copied'>('idle');
+
+ const handleCopy = async () => {
+ setCopyState('loading');
+
+ try {
+ const response = await fetch(`${path}.md`);
+ if (!response.ok) throw new Error('Failed to fetch');
+
+ const markdown = await response.text();
+ await navigator.clipboard.writeText(markdown);
+
+ setCopyState('copied');
+ setTimeout(() => setCopyState('idle'), 2000);
+ } catch {
+ setCopyState('idle');
+ }
+ };
+
+ const handleOpen = () => {
+ window.open(`${path}.md`, '_blank');
+ };
+
+ return (
+ <div className="flex items-center gap-4 mt-2 mb-6">
+ <button
+ onClick={handleCopy}
+ disabled={copyState === 'loading'}
+ 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"
+ aria-label="Copy page as markdown"
+ >
+ {copyState === 'loading' ? (
+ <Loader2 className="w-4 h-4 animate-spin" aria-hidden="true" />
+ ) : copyState === 'copied' ? (
+ <Check className="w-4 h-4 text-green-500" aria-hidden="true" />
+ ) : (
+ <Copy className="w-4 h-4" aria-hidden="true" />
+ )}
+ {copyState === 'copied' ? 'Copied!' : 'Copy page'}
+ </button>
+
+ <span className="text-fd-muted-foreground/50" aria-hidden="true">·</span>
+
+ <a
+ href={`${path}.md`}
+ target="_blank"
+ rel="noopener noreferrer"
+ 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"
+ >
+ <ExternalLink className="w-4 h-4" aria-hidden="true" />
+ View as markdown
+ </a>
+ </div>
+ );
+}
diff --git a/docs/source.config.ts b/docs/source.config.ts
index 76d99d0bf..0c357ad20 100644
--- a/docs/source.config.ts
+++ b/docs/source.config.ts
@@ -99,14 +99,18 @@ export default defineConfig({
light: 'github-light',
dark: 'github-dark',
},
- transformers: [
- transformerTwoslash({
- explicitTrigger: false, // All TypeScript blocks are validated
- typesCache: createFileSystemTypesCache({
- dir: '.next/cache/twoslash', // Inside .next/cache so Vercel persists it
- }),
- }),
- ],
+ // Twoslash disabled in dev (heap memory issues), enabled in build/CI
+ transformers:
+ process.env.NODE_ENV === 'production'
+ ? [
+ transformerTwoslash({
+ explicitTrigger: false,
+ typesCache: createFileSystemTypesCache({
+ dir: '.next/cache/twoslash',
+ }),
+ }),
+ ]
+ : [],
},
},
});