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): validate toolkit Markdown routes and keep Compliance in docs
Brendan O'Leary committed
Nov 13, 2026 at 15:35 UTC
d295faf7b0e81ad4cf944259754157f5c5efe96d
4 files changed
+38
-3
docs/lib/product-page-tree.ts
+6
-1
@@ -39,7 +39,12 @@ function resolveSidebarItem(tree: Root, item: ProductSidebarItem): Node {
39
if (first.type !== 'page') {
40
throw new Error(`Product sidebar group has no first page: ${item.label}`);
41
}
42
- return { type: 'folder', name: item.label, index: first, children };
42
+ return {
43
+ type: 'folder',
44
+ name: item.label,
45
+ index: first.url.startsWith('/docs/') ? first : undefined,
46
+ children,
47
+ };
48
}
49
50
const sourceNode =
docs/scripts/validate-links.ts
+7
-2
@@ -112,10 +112,15 @@ async function buildPopulateEntries(src: AnySource) {
112
113
const toolkitSlugsSchema = z.array(z.object({ slug: z.string() }));
114
115
-async function getDynamicToolkitEntries() {
115
+export async function getDynamicToolkitEntries() {
116
const raw = await readFile('public/data/toolkits.json', 'utf-8');
117
const toolkits = toolkitSlugsSchema.parse(JSON.parse(raw));
118
- return toolkits.map(t => ({ value: { slug: [t.slug] }, hashes: [] as string[] }));
118
+ return toolkits.flatMap(t =>
119
+ ['', '.md', '.mdx'].map(suffix => ({
120
+ value: { slug: [`${t.slug}${suffix}`] },
121
+ hashes: [] as string[],
122
+ })),
123
+ );
124
}
125
126
export async function getKnowledgeToolkitRouteEntries() {
docs/tests/static/product-navigation.test.ts
+1
@@ -203,6 +203,7 @@ describe('Docs product navigation', () => {
203
expect(securityPages.slice(1).map(node => node.type)).toEqual(['folder', 'folder', 'folder']);
204
const compliance = securityPages[1];
205
if (compliance.type !== 'folder') throw new Error('Compliance group missing');
206
+ expect(compliance.index).toBeUndefined();
207
expect(compliance.children).toContainEqual(expect.objectContaining({
208
type: 'page', url: 'https://trust.composio.dev', external: true,
209
}));
docs/tests/static/validate-links.test.ts
+24
@@ -1,8 +1,32 @@
1
import { describe, expect, test } from 'bun:test';
2
+import { scanURLs, validateFiles } from 'next-validate-link';
3
import { getKnowledgeToolkitSummaries } from '@/lib/knowledge/catalog';
4
import * as linkValidation from '../../scripts/validate-links';
5
6
describe('link validation', () => {
7
+ test('accepts known toolkit HTML and Markdown routes while rejecting unknown toolkits', async () => {
8
+ const scanned = await scanURLs({
9
+ preset: 'next',
10
+ populate: {
11
+ '(home)/toolkits/[[...slug]]': await linkValidation.getDynamicToolkitEntries(),
12
+ },
13
+ });
14
+ const errors = await validateFiles([{
15
+ path: 'toolkit-links.mdx',
16
+ url: '/kb/guide/toolkits-gmail',
17
+ content: [
18
+ '[Gmail](/toolkits/gmail)',
19
+ '[Gmail Markdown](/toolkits/gmail.md)',
20
+ '[Gmail MDX](/toolkits/gmail.mdx)',
21
+ '[Unknown toolkit](/toolkits/not-a-real-toolkit.md)',
22
+ ].join('\n'),
23
+ }], { scanned, checkRelativePaths: 'as-url', checkExternal: false });
24
+
25
+ expect(errors.flatMap(file => file.errors.map(error => error.url))).toEqual([
26
+ '/toolkits/not-a-real-toolkit.md',
27
+ ]);
28
+ });
29
+
30
test('strips BOM and CRLF YAML provenance without removing body links', () => {
31
const fixture = '\uFEFF---\r\nsources: [{"sourcePath":"kb/toolkits/example/public.md","sourceHeading":"Example"}]\r\n---\r\nRead [the guide](/kb/guide/example).\r\n';
32
const withoutFrontmatter = (linkValidation as {