@devries-cameron20 / composio Mirror · read-only / commits / ca658f1c5
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 21, 21:00 UTC

docs(scripts): clean up stale api-reference index.mdx for orphan tags

generate-api-index.ts iterates every tag in spec.tags but used to `continue` silently when a tag had zero operations in both v3.1 and v3.0 specs. After a tag rename (e.g. Webhooks → Webhook Endpoints + Webhook Subscriptions), the old tag dir still has an index.mdx from a prior run that points at the old operationIds. The auto-update PR never includes a deletion for it, so the phantom category lingers in the docs. Replace the silent skip with an rmSync of any stale index.mdx for that tag in both content/reference/api-reference/ and content/reference/v3/api-reference/. Next auto-update run picks up the orphan and removes it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Anshu Garg committed May 8, 2026 at 22:53 UTC ca658f1c522d1a1f2c6b189faa6a1740b6a1481d
1 file changed +17 -3
docs/scripts/generate-api-index.ts
+17 -3
@@ -6,7 +6,7 @@
6 * Run: bun scripts/generate-api-index.ts
7 */
8
9 -import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
9 +import { readFileSync, writeFileSync, mkdirSync, existsSync, rmSync } from 'fs';
10 import { join } from 'path';
11
12 interface OpenAPIOperation {
@@ -89,9 +89,23 @@ function generateIndexPages() {
89 for (const tagName of allTags) {
90 const ops31 = v31Ops[tagName] || [];
91 const ops3 = v3Ops[tagName] || [];
92 - if (ops31.length === 0 && ops3.length === 0) continue;
93 -
92 const tagSlug = slugify(tagName);
93 +
94 + // Tag declared in spec.tags but no operations reference it — clean up any stale index.mdx from a prior run.
95 + if (ops31.length === 0 && ops3.length === 0) {
96 + for (const baseDir of [
97 + join(process.cwd(), 'content/reference/api-reference'),
98 + join(process.cwd(), 'content/reference/v3/api-reference'),
99 + ]) {
100 + const stale = join(baseDir, tagSlug, 'index.mdx');
101 + if (existsSync(stale)) {
102 + rmSync(stale);
103 + console.log(`Removed stale: ${stale}`);
104 + }
105 + }
106 + continue;
107 + }
108 +
109 const tagDescription = tagDescriptions[tagName] || `${tagName} API endpoints`;
110
111 // Only generate v3.1 index page if the tag has v3.1 operations