Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
docs: curate the agent routing map and separate the full index
Brendan O'Leary committed
Sep 10, 2026 at 11:21 UTC
b7891d78fe2c838707eb661c12f0081f37c3fcba
8 files changed
+294
-220
docs/app/llms-index.txt/route.ts
new
+232
@@ -0,0 +1,232 @@
1
+import {
2
+ source,
3
+ examplesSource,
4
+ referenceSource,
5
+ toolkitsSource,
6
+ knowledgeBaseSource,
7
+} from '@/lib/source';
8
+import { detectReferenceApiVersion } from '@/lib/api-version';
9
+import { TOOLKIT_COUNT_LABEL } from '@/lib/toolkit-count';
10
+import {
11
+ formatKnowledgeDiscoveryLinks,
12
+ getLocalKnowledgeDiscoveryPaths,
13
+} from '@/lib/knowledge/discovery';
14
+import type { ReactNode } from 'react';
15
+
16
+export const revalidate = false;
17
+
18
+// Fumadocs page tree node types
19
+interface PageNode {
20
+ type: 'page';
21
+ name: ReactNode;
22
+ url: string;
23
+ external?: boolean;
24
+}
25
+
26
+interface SeparatorNode {
27
+ type: 'separator';
28
+ name?: ReactNode;
29
+}
30
+
31
+interface FolderNode {
32
+ type: 'folder';
33
+ name: ReactNode;
34
+ index?: PageNode;
35
+ children: TreeNode[];
36
+}
37
+
38
+type TreeNode = PageNode | SeparatorNode | FolderNode;
39
+
40
+/** Extract plain text from a ReactNode (handles strings, numbers, skips elements). */
41
+function nodeText(name: ReactNode): string | null {
42
+ if (typeof name === 'string') return name;
43
+ if (typeof name === 'number') return String(name);
44
+ return null;
45
+}
46
+
47
+/**
48
+ * A section is legacy/deprecated when its separator heading says so (e.g.
49
+ * "Direct Tool Execution Guides (Legacy)"). We omit those sections from the
50
+ * default LLM index so code generators reach for the current session-based
51
+ * APIs, not deprecated ones.
52
+ */
53
+function isLegacySeparator(name: ReactNode): boolean {
54
+ const text = nodeText(name);
55
+ return text != null && /legacy|deprecated/i.test(text);
56
+}
57
+
58
+/**
59
+ * Walk the fumadocs page tree and generate a markdown index.
60
+ * Separators become ## headings, pages become URL entries, folders recurse.
61
+ * Legacy/deprecated sections (and everything under them) are skipped.
62
+ *
63
+ * A folder emits a heading one level deeper, and markdown headings do not
64
+ * close — so a plain page emitted after a folder reads as belonging to that
65
+ * folder. `meta.json` order is the human sidebar's order and cannot absorb
66
+ * this, so each section's direct pages are buffered and flushed ahead of its
67
+ * folders. Within pages, and within folders, `meta.json` order is preserved.
68
+ */
69
+function walkPageTree(nodes: TreeNode[], depth = 2): string {
70
+ const lines: string[] = [];
71
+ let skippingSection = false;
72
+ let sectionPages: string[] = [];
73
+ let sectionFolders: string[] = [];
74
+
75
+ function flushSection() {
76
+ lines.push(...sectionPages, ...sectionFolders);
77
+ sectionPages = [];
78
+ sectionFolders = [];
79
+ }
80
+
81
+ for (const node of nodes) {
82
+ if (node.type === 'separator') {
83
+ // A separator starts a new section; skip it and its pages when legacy.
84
+ flushSection();
85
+ skippingSection = isLegacySeparator(node.name);
86
+ if (skippingSection) continue;
87
+ const text = nodeText(node.name);
88
+ if (text) {
89
+ lines.push('', `${'#'.repeat(depth)} ${text}`, '');
90
+ }
91
+ continue;
92
+ }
93
+
94
+ if (skippingSection) continue;
95
+
96
+ switch (node.type) {
97
+ case 'page':
98
+ if (!node.external) {
99
+ sectionPages.push(formatPage({ url: node.url, data: source.getPageByHref(node.url)?.page.data }));
100
+ }
101
+ break;
102
+
103
+ case 'folder': {
104
+ // Folders are sub-sections within separator sections, so one level deeper
105
+ const text = nodeText(node.name);
106
+ if (text) {
107
+ sectionFolders.push('', `${'#'.repeat(depth + 1)} ${text}`, '');
108
+ }
109
+ // If folder has an index page, include it
110
+ if (node.index && !node.index.external) {
111
+ sectionFolders.push(formatPage({ url: node.index.url, data: source.getPageByHref(node.index.url)?.page.data }));
112
+ }
113
+ // Recurse into children
114
+ if (node.children.length > 0) {
115
+ sectionFolders.push(walkPageTree(node.children, depth + 1));
116
+ }
117
+ break;
118
+ }
119
+ }
120
+ }
121
+
122
+ flushSection();
123
+
124
+ return lines
125
+ .join('\n')
126
+ .replace(/\n{3,}/g, '\n\n')
127
+ .trim();
128
+}
129
+
130
+function formatPage(page: { url: string; data?: { title?: string; description?: string } }) {
131
+ const title = (page.data?.title ?? page.url).replace(/[\[\]\r\n]/g, ' ');
132
+ const description = page.data?.description?.replace(/[\r\n]/g, ' ');
133
+ return `- [${title}](https://docs.composio.dev${page.url}.md)${description ? `: ${description}` : ''}`;
134
+}
135
+
136
+/**
137
+ * Splits reference pages by REST version.
138
+ *
139
+ * This list is built with a flat `.map(formatPage)` that bypasses the
140
+ * `isLegacySeparator` filter the guides tree gets, so the two trees used to
141
+ * arrive interleaved under one unlabelled heading — and `/reference/v3/` is
142
+ * the only version-shaped path in the corpus, so it is the highest-precision
143
+ * match for the query most readers intend as "current Composio".
144
+ *
145
+ * Partitioned with `detectApiVersion`, not a literal path test, so moving the
146
+ * legacy tree's URL stays a one-line change in `lib/api-version.ts`.
147
+ */
148
+function partitionByApiVersion<T extends { url: string }>(pages: T[]) {
149
+ const current: T[] = [];
150
+ const legacy: T[] = [];
151
+ const versionIndependent: T[] = [];
152
+ for (const page of pages) {
153
+ const version = detectReferenceApiVersion(page.url);
154
+ if (version === '3.0') legacy.push(page);
155
+ else if (version === '3.1') current.push(page);
156
+ else versionIndependent.push(page);
157
+ }
158
+ return { current, legacy, versionIndependent };
159
+}
160
+
161
+export async function GET() {
162
+ try {
163
+ const docsTree = walkPageTree(source.pageTree.children as TreeNode[]);
164
+
165
+ const examplesPages = examplesSource.getPages();
166
+ const toolkitsPages = toolkitsSource.getPages();
167
+ const {
168
+ current: currentReferencePages,
169
+ legacy: legacyReferencePages,
170
+ versionIndependent: versionIndependentReferencePages,
171
+ } = partitionByApiVersion(referenceSource.getPages());
172
+
173
+ const legacyReferenceSection =
174
+ legacyReferencePages.length > 0
175
+ ? `
176
+## API Reference (v3.0, legacy — supported, not for new code)
177
+
178
+${legacyReferencePages.map(formatPage).join('\n')}
179
+`
180
+ : '';
181
+ const knowledgeBasePages = knowledgeBaseSource.getPages();
182
+ const knowledgeDiscoveryLinks = formatKnowledgeDiscoveryLinks(
183
+ (await getLocalKnowledgeDiscoveryPaths()).filter(
184
+ (path) => !path.startsWith('/kb/guide/'),
185
+ ),
186
+ );
187
+
188
+ const index = `# Composio Documentation
189
+
190
+> Composio powers ${TOOLKIT_COUNT_LABEL} toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
191
+
192
+For a shorter routing map, start at [llms.txt](https://docs.composio.dev/llms.txt).
193
+
194
+${docsTree}
195
+
196
+## Examples
197
+
198
+${examplesPages.map(formatPage).join('\n')}
199
+
200
+## Knowledge Base
201
+
202
+${knowledgeDiscoveryLinks}
203
+
204
+${knowledgeBasePages.map(formatPage).join('\n')}
205
+
206
+## API Reference (v3.1, current)
207
+
208
+${currentReferencePages.map(formatPage).join('\n')}
209
+${legacyReferenceSection}
210
+## SDK and product reference (version-independent)
211
+
212
+${versionIndependentReferencePages.map(formatPage).join('\n')}
213
+
214
+## Toolkits
215
+
216
+${toolkitsPages.map(formatPage).join('\n')}
217
+
218
+## Full Documentation
219
+
220
+- [Full documentation](https://docs.composio.dev/llms-full.txt): All current page bodies.
221
+`;
222
+
223
+ return new Response(index, {
224
+ headers: {
225
+ 'Content-Type': 'text/plain; charset=utf-8',
226
+ },
227
+ });
228
+ } catch (error) {
229
+ console.error('Error generating llms.txt:', error);
230
+ return new Response('Error generating documentation index', { status: 500 });
231
+ }
232
+}
docs/app/llms.txt/route.ts
+30
-211
@@ -1,230 +1,49 @@
1
-import {
2
- source,
3
- examplesSource,
4
- referenceSource,
5
- toolkitsSource,
6
- knowledgeBaseSource,
7
-} from '@/lib/source';
8
-import { detectReferenceApiVersion } from '@/lib/api-version';
1
import { TOOLKIT_COUNT_LABEL } from '@/lib/toolkit-count';
10
-import {
11
- formatKnowledgeDiscoveryLinks,
12
- getLocalKnowledgeDiscoveryPaths,
13
-} from '@/lib/knowledge/discovery';
14
-import type { ReactNode } from 'react';
2
3
export const revalidate = false;
4
18
-// Fumadocs page tree node types
19
-interface PageNode {
20
- type: 'page';
21
- name: ReactNode;
22
- url: string;
23
- external?: boolean;
24
-}
25
-
26
-interface SeparatorNode {
27
- type: 'separator';
28
- name?: ReactNode;
29
-}
30
-
31
-interface FolderNode {
32
- type: 'folder';
33
- name: ReactNode;
34
- index?: PageNode;
35
- children: TreeNode[];
36
-}
37
-
38
-type TreeNode = PageNode | SeparatorNode | FolderNode;
39
-
40
-/** Extract plain text from a ReactNode (handles strings, numbers, skips elements). */
41
-function nodeText(name: ReactNode): string | null {
42
- if (typeof name === 'string') return name;
43
- if (typeof name === 'number') return String(name);
44
- return null;
45
-}
5
+/** Curated routing map; the exhaustive catalog lives at /llms-index.txt. */
6
+export function GET() {
7
+ return new Response(`# Composio Documentation
8
47
-/**
48
- * A section is legacy/deprecated when its separator heading says so (e.g.
49
- * "Direct Tool Execution Guides (Legacy)"). We omit those sections from the
50
- * default LLM index so code generators reach for the current session-based
51
- * APIs, not deprecated ones.
52
- */
53
-function isLegacySeparator(name: ReactNode): boolean {
54
- const text = nodeText(name);
55
- return text != null && /legacy|deprecated/i.test(text);
56
-}
57
-
58
-/**
59
- * Walk the fumadocs page tree and generate a markdown index.
60
- * Separators become ## headings, pages become URL entries, folders recurse.
61
- * Legacy/deprecated sections (and everything under them) are skipped.
62
- *
63
- * A folder emits a heading one level deeper, and markdown headings do not
64
- * close — so a plain page emitted after a folder reads as belonging to that
65
- * folder. `meta.json` order is the human sidebar's order and cannot absorb
66
- * this, so each section's direct pages are buffered and flushed ahead of its
67
- * folders. Within pages, and within folders, `meta.json` order is preserved.
68
- */
69
-function walkPageTree(nodes: TreeNode[], depth = 2): string {
70
- const lines: string[] = [];
71
- let skippingSection = false;
72
- let sectionPages: string[] = [];
73
- let sectionFolders: string[] = [];
74
-
75
- function flushSection() {
76
- lines.push(...sectionPages, ...sectionFolders);
77
- sectionPages = [];
78
- sectionFolders = [];
79
- }
80
-
81
- for (const node of nodes) {
82
- if (node.type === 'separator') {
83
- // A separator starts a new section; skip it and its pages when legacy.
84
- flushSection();
85
- skippingSection = isLegacySeparator(node.name);
86
- if (skippingSection) continue;
87
- const text = nodeText(node.name);
88
- if (text) {
89
- lines.push('', `${'#'.repeat(depth)} ${text}`, '');
90
- }
91
- continue;
92
- }
9
+> Build and operate agents with authentication, tool discovery, execution, and ${TOOLKIT_COUNT_LABEL} toolkits.
10
94
- if (skippingSection) continue;
11
+Use Platform to build Composio into your application. Use For You to connect your own apps to an existing agent. Start with the current session-based SDK. REST v3.1 is current; REST v3.0 is legacy and is not the starting point for new code.
12
96
- switch (node.type) {
97
- case 'page':
98
- if (!node.external) {
99
- sectionPages.push(`- https://docs.composio.dev${node.url}.md`);
100
- }
101
- break;
13
+## Choose your path
14
103
- case 'folder': {
104
- // Folders are sub-sections within separator sections, so one level deeper
105
- const text = nodeText(node.name);
106
- if (text) {
107
- sectionFolders.push('', `${'#'.repeat(depth + 1)} ${text}`, '');
108
- }
109
- // If folder has an index page, include it
110
- if (node.index) {
111
- sectionFolders.push(`- https://docs.composio.dev${node.index.url}.md`);
112
- }
113
- // Recurse into children
114
- if (node.children.length > 0) {
115
- sectionFolders.push(walkPageTree(node.children, depth + 1));
116
- }
117
- break;
118
- }
119
- }
120
- }
15
+- [Platform or For You](https://docs.composio.dev/docs.md): Choose between building an application and using your own connected apps.
16
+- [Set up a coding agent](https://docs.composio.dev/docs/agent-setup.md): Install the Composio skill to add Composio to an existing project.
17
+- [SDK quickstart](https://docs.composio.dev/docs/quickstart.md): Install Python or TypeScript packages, create a session, and run an agent.
18
+- [Native agent plugins](https://docs.composio.dev/docs/agent-plugins.md): Use your own apps from Codex or Claude Code.
19
+- [Connect an MCP client](https://docs.composio.dev/docs/composio-connect.md): Connect an existing client to your apps over MCP.
20
122
- flushSection();
21
+## Build an application
22
124
- return lines
125
- .join('\n')
126
- .replace(/\n{3,}/g, '\n\n')
127
- .trim();
128
-}
129
-
130
-function formatPage(page: { url: string }) {
131
- return `- https://docs.composio.dev${page.url}.md`;
132
-}
133
-
134
-/**
135
- * Splits reference pages by REST version.
136
- *
137
- * This list is built with a flat `.map(formatPage)` that bypasses the
138
- * `isLegacySeparator` filter the guides tree gets, so the two trees used to
139
- * arrive interleaved under one unlabelled heading — and `/reference/v3/` is
140
- * the only version-shaped path in the corpus, so it is the highest-precision
141
- * match for the query most readers intend as "current Composio".
142
- *
143
- * Partitioned with `detectApiVersion`, not a literal path test, so moving the
144
- * legacy tree's URL stays a one-line change in `lib/api-version.ts`.
145
- */
146
-function partitionByApiVersion<T extends { url: string }>(pages: T[]) {
147
- const current: T[] = [];
148
- const legacy: T[] = [];
149
- const versionIndependent: T[] = [];
150
- for (const page of pages) {
151
- const version = detectReferenceApiVersion(page.url);
152
- if (version === '3.0') legacy.push(page);
153
- else if (version === '3.1') current.push(page);
154
- else versionIndependent.push(page);
155
- }
156
- return { current, legacy, versionIndependent };
157
-}
158
-
159
-export async function GET() {
160
- try {
161
- const docsTree = walkPageTree(source.pageTree.children as TreeNode[]);
162
-
163
- const examplesPages = examplesSource.getPages();
164
- const toolkitsPages = toolkitsSource.getPages();
165
- const {
166
- current: currentReferencePages,
167
- legacy: legacyReferencePages,
168
- versionIndependent: versionIndependentReferencePages,
169
- } = partitionByApiVersion(referenceSource.getPages());
170
-
171
- const legacyReferenceSection =
172
- legacyReferencePages.length > 0
173
- ? `
174
-## API Reference (v3.0, legacy — supported, not for new code)
175
-
176
-${legacyReferencePages.map(formatPage).join('\n')}
177
-`
178
- : '';
179
- const knowledgeBasePages = knowledgeBaseSource.getPages();
180
- const knowledgeDiscoveryLinks = formatKnowledgeDiscoveryLinks(
181
- (await getLocalKnowledgeDiscoveryPaths()).filter(
182
- (path) => !path.startsWith('/kb/guide/'),
183
- ),
184
- );
185
-
186
- const index = `# Composio Documentation
187
-
188
-> Composio powers ${TOOLKIT_COUNT_LABEL} toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
189
-
190
-> **For AI agents:** Route by intent. To build an application, start with [Quickstart](https://docs.composio.dev/docs/quickstart.md) or [Providers](https://docs.composio.dev/docs/providers.md) and use \`composio.create(user_id)\` + \`session.tools()\`. To use Composio from Codex or Claude Code without explicit MCP intent, install the [native agent plugin](https://docs.composio.dev/docs/agent-plugins.md). To connect an existing client over MCP, use [Composio Connect](https://docs.composio.dev/docs/composio-connect.md). When an application creates a session and needs MCP transport, use [Sessions via MCP](https://docs.composio.dev/docs/sessions-via-mcp.md). See any page's .md endpoint for full usage instructions.
191
-
192
-${docsTree}
193
-
194
-## Examples
195
-
196
-${examplesPages.map(formatPage).join('\n')}
197
-
198
-## Knowledge Base
199
-
200
-${knowledgeDiscoveryLinks}
201
-
202
-${knowledgeBasePages.map(formatPage).join('\n')}
23
+- [Core concepts](https://docs.composio.dev/docs/how-composio-works.md): Understand users, sessions, toolkits, and tool execution.
24
+- [Authentication](https://docs.composio.dev/docs/authentication.md): Distinguish auth configs from connected accounts and connect your application's users.
25
+- [Configure sessions](https://docs.composio.dev/docs/configuring-sessions.md): Select toolkits, auth configs, and connected accounts for a user.
26
+- [SDKs and frameworks](https://docs.composio.dev/docs/providers.md): Choose the provider for your agent framework.
27
+- [Sessions via MCP](https://docs.composio.dev/docs/sessions-via-mcp.md): Give an application-created session to an MCP-compatible framework.
28
+- [Single-toolkit MCP](https://docs.composio.dev/docs/single-toolkit-mcp.md): Build an MCP server scoped to one toolkit.
29
+- [Troubleshooting](https://docs.composio.dev/kb.md): Diagnose authentication, connection, and execution failures.
30
+- [Production rate limits](https://docs.composio.dev/reference/rate-limits.md): Plan for request limits before deployment.
31
32
## API Reference (v3.1, current)
33
206
-${currentReferencePages.map(formatPage).join('\n')}
207
-${legacyReferenceSection}
208
-## SDK and product reference (version-independent)
209
-
210
-${versionIndependentReferencePages.map(formatPage).join('\n')}
34
+- [Current REST API](https://docs.composio.dev/reference.md): Use the current base URL and browse endpoint groups.
35
212
-## Toolkits
36
+## API Reference (v3.0, legacy)
37
214
-${toolkitsPages.map(formatPage).join('\n')}
38
+- [Legacy REST API](https://docs.composio.dev/reference/v3.md): Maintain existing v3.0 integrations. Use v3.1 for new code.
39
216
-## Full Documentation
40
+## Optional
41
218
-- https://docs.composio.dev/llms-full.txt
219
-`;
42
+- [Changelog](https://docs.composio.dev/docs/changelog.md): Find dated release notes and read what changed.
43
221
- return new Response(index, {
222
- headers: {
223
- 'Content-Type': 'text/plain; charset=utf-8',
224
- },
225
- });
226
- } catch (error) {
227
- console.error('Error generating llms.txt:', error);
228
- return new Response('Error generating documentation index', { status: 500 });
229
- }
44
+- [Complete documentation index](https://docs.composio.dev/llms-index.txt): All guides, SDK references, endpoint groups, and toolkit pages, with legacy routes labeled.
45
+- [Knowledge Base](https://docs.composio.dev/kb.md): Find support answers and toolkit-specific troubleshooting.
46
+- [Examples](https://docs.composio.dev/examples.md): Browse complete application examples.
47
+- [Full documentation](https://docs.composio.dev/llms-full.txt): Load all current page bodies when individual pages are insufficient.
48
+`, { headers: { 'Content-Type': 'text/plain; charset=utf-8' } });
49
}
docs/next.config.mjs
+1
@@ -41,6 +41,7 @@ const config = {
41
'/llms.mdx/**': [...OPENAPI_SPEC_FILES],
42
'/llms-full.txt/**': [...OPENAPI_SPEC_FILES],
43
'/llms.txt/**': [...OPENAPI_SPEC_FILES],
44
+ '/llms-index.txt/**': [...OPENAPI_SPEC_FILES, './kb/**'],
45
'/kb/**': ['./kb/**'],
46
'/api/knowledge-search/**': [...OPENAPI_SPEC_FILES, './content/**', './kb/**'],
47
},
docs/tests/integration/llm-endpoints.test.ts
+2
-2
@@ -41,8 +41,8 @@ describe("LLM endpoints - API reference version labelling", () => {
41
expect(text.split("\n")).not.toContain("## API Reference");
42
});
43
44
- test("/llms.txt groups every legacy URL under the legacy heading, not interleaved", async () => {
45
- const lines = (await (await fetchPage("/llms.txt")).text()).split("\n");
44
+ test("/llms-index.txt groups every legacy URL under the legacy heading, not interleaved", async () => {
45
+ const lines = (await (await fetchPage("/llms-index.txt")).text()).split("\n");
46
47
const legacyStart = lines.findIndex(line => line.startsWith(LEGACY_HEADING_PREFIX));
48
expect(legacyStart, "no legacy reference group").toBeGreaterThan(-1);
docs/tests/static/kb-discovery.test.ts
+2
-2
@@ -56,8 +56,8 @@ describe('public KB discovery', () => {
56
expect(source('app/sitemap.ts')).toContain('getLocalKnowledgeDiscoveryPaths');
57
expect(source('scripts/validate-links.ts')).toContain('knowledgeBaseSource');
58
expect(source('scripts/validate-links.ts')).toContain('getLocalKnowledgeDiscoveryPaths');
59
- expect(source('app/llms.txt/route.ts')).toContain('knowledgeBaseSource');
60
- expect(source('app/llms.txt/route.ts')).toContain('getLocalKnowledgeDiscoveryPaths');
59
+ expect(source('app/llms-index.txt/route.ts')).toContain('knowledgeBaseSource');
60
+ expect(source('app/llms-index.txt/route.ts')).toContain('getLocalKnowledgeDiscoveryPaths');
61
expect(source('app/llms-full.txt/route.ts')).toContain('knowledgeBaseSource');
62
expect(source('app/llms-full.txt/route.ts')).toContain('getLocalKnowledgeDiscoveryPaths');
63
expect(source('app/llms.mdx/[[...slug]]/route.ts')).toContain("prefix: 'kb'");
docs/tests/static/knowledge-corpus.test.ts
+1
-1
@@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test';
2
import { readFileSync, readdirSync } from 'node:fs';
3
import { join, relative } from 'node:path';
4
import sitemap from '@/app/sitemap';
5
-import { GET as getLlmsIndex } from '@/app/llms.txt/route';
5
+import { GET as getLlmsIndex } from '@/app/llms-index.txt/route';
6
import { getAlgoliaSearchDocuments, getDocsSearchIndexes } from '@/lib/search-index';
7
import * as searchIndexModule from '@/lib/search-index';
8
import { getLocalKnowledgeDiscoveryPaths } from '@/lib/knowledge/discovery';
docs/tests/static/llms-routing.test.ts
new
+22
@@ -0,0 +1,22 @@
1
+import { expect, test } from 'bun:test';
2
+import { GET } from '../../app/llms.txt/route';
3
+import { source, referenceSource, examplesSource, knowledgeBaseSource } from '../../lib/source';
4
+
5
+test('routing map is bounded and covers the current developer decisions', async () => {
6
+ const text = await GET().text();
7
+ expect(text.length).toBeLessThan(6000);
8
+ const primary = text.split('## Optional')[0];
9
+ for (const path of ['docs', 'docs/agent-setup', 'docs/quickstart', 'docs/agent-plugins',
10
+ 'docs/authentication', 'docs/configuring-sessions', 'kb']) {
11
+ expect(primary).toContain(`https://docs.composio.dev/${path}.md`);
12
+ }
13
+ expect(text).toContain('[Complete documentation index](https://docs.composio.dev/llms-index.txt)');
14
+ expect(text).not.toMatch(/^- https?:/m);
15
+ expect(text).toContain('REST v3.0 is legacy');
16
+ const pages = new Set([source, referenceSource, examplesSource, knowledgeBaseSource]
17
+ .flatMap(collection => collection.getPages().map(page => page.url)));
18
+ pages.add('/docs/changelog');
19
+ for (const match of text.matchAll(/\]\(https:\/\/docs\.composio\.dev([^)]*)\.md\)/g)) {
20
+ expect(pages.has(match[1]), `unresolved route: ${match[1]}`).toBe(true);
21
+ }
22
+});
docs/tests/static/start-routing.test.ts
+4
-4
@@ -83,7 +83,7 @@ describe('getting-started routing policy', () => {
83
* files — has to fail something.
84
*/
85
test('emits every authentication guide into llms.txt exactly once', async () => {
86
- const { GET } = await import('../../app/llms.txt/route');
86
+ const { GET } = await import('../../app/llms-index.txt/route');
87
const llms = await (await GET()).text();
88
89
for (const url of ['/docs/authentication', ...GUIDE_URLS]) {
@@ -93,7 +93,7 @@ describe('getting-started routing policy', () => {
93
});
94
95
test('does not turn external sidebar links into documentation URLs', async () => {
96
- const { GET } = await import('../../app/llms.txt/route');
96
+ const { GET } = await import('../../app/llms-index.txt/route');
97
const llms = await (await GET()).text();
98
99
expect(llms).not.toContain('- https://docs.composio.dev/llms.txt.md');
@@ -106,11 +106,11 @@ describe('getting-started routing policy', () => {
106
* the sidebar shows it as a sibling.
107
*/
108
test('files each page under the section it belongs to', async () => {
109
- const { GET } = await import('../../app/llms.txt/route');
109
+ const { GET } = await import('../../app/llms-index.txt/route');
110
const lines = (await (await GET()).text()).split('\n');
111
112
const sectionOf = (url: string) => {
113
- const index = lines.findIndex(line => line.endsWith(`${url}.md`));
113
+ const index = lines.findIndex(line => line.includes(`${url}.md)`));
114
expect(index, `${url} missing from llms.txt`).toBeGreaterThan(-1);
115
const preceding = lines.slice(0, index);
116
return {