@devries-cameron20 / composio-1 / commits / 8ff9068a8
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.

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

# Description `docs/scripts/generate-api-index.ts` iterates every tag declared in `spec.tags` (both v3.1 and v3.0 OpenAPI specs) and writes an `index.mdx` per tag. The old code did: ```ts if (ops31.length === 0 && ops3.length === 0) continue; ``` When a tag is renamed in Apollo (recent example: `Webhooks` → `Webhook Endpoints` + `Webhook Subscriptions`), the orphan tag is still listed in `spec.tags` but no operation references it anymore. The script's `continue` silently skips it. The previously-committed `webhooks/index.mdx` (generated when those operations were still tagged `Webhooks`) is left untouched on disk — and since git doesn't surface "files we didn't change," the auto-update PR never includes the deletion either. Result: a phantom **Webhooks** category survives in the rendered docs alongside the new split categories, with broken `href`s pointing at non-existent operation pages. **Symptom:** [PR #3377 (auto-update-data)](https://github.com/ComposioHQ/composio/pull/3377/files) added `webhook-endpoints/index.mdx` and `webhook-subscriptions/index.mdx` but did not delete `webhooks/index.mdx`, even though Apollo's openapi.json no longer routes any operation to the `Webhooks` tag. ## What this changes Replace the silent `continue` with an `rmSync` of any stale `index.mdx` for that tag in both: - `content/reference/api-reference/<slug>/index.mdx` - `content/reference/v3/api-reference/<slug>/index.mdx` The next scheduled `docs-update-data` run will pick up the orphan tag(s) and surface the deletion(s) in the auto-PR — no manual `git rm` needed. This is a minimal targeted fix (3-line behavior change at the exact spot that already detects "tag is empty"). No new manifest files, no full-directory wipes, no infra changes. Existing tags with operations behave identically. ## Caveat Only fixes the **fully orphan** tag case (zero ops in both v3.1 and v3.0). The asymmetric case — tag has ops in one spec but not the other — would still leave a stale file behind, since the per-spec write guards on lines 98 and 136 don't have matching delete branches. Not in scope for this PR; leaving as a follow-up if it ever happens. # How did I test this PR Sanity-ran `bun scripts/generate-api-index.ts` against the current `next` openapi specs and confirmed all existing tag pages regenerate identically (no spurious deletions, no diffs in `git status`). End-to-end verification of the cleanup path against the post-retag specs from PR #3377 left to reviewer — feed the PR-3377 `openapi.json` + `openapi-v3.json` into `public/`, run the script, expect `content/reference/api-reference/webhooks/index.mdx` and `content/reference/v3/api-reference/webhooks/index.mdx` to be removed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Anshu Garg committed May 11, 2026 at 12:02 UTC 8ff9068a8cfaea918e906ca6dcc52e686dabc59c

No changes.