Files
daniel 519fdf0950 perf: split components.json to cut dashboard browser payload
The dashboard is on Cloudflare Pages with a 24h edge cache already in
place, but every island still downloaded the full ~1.9MB index (327KB
gz) — even the sidebars/plugins/collection pages that only need per-type
counts. This splits the index into purpose-built artifacts so the
browser fetches only what each surface needs.

Generator (scripts/generate_components_json.py):
- Decouple the docs and dashboard index writes (they were a byte copy).
  docs/components.json keeps `security` (the legacy site renders it);
  the dashboard index drops both `content` and `security` (unused there)
  → ~13% smaller.
- Emit dashboard/public/counts.json (per-type counts, ~150 bytes),
  components/{type}.json (per-type slices), and search-index.json
  (flat name/description/category/type/path for global search).

Dashboard islands:
- ComponentGrid loads only the active type via fetchComponentsByType,
  re-fetching on type switch (per-type in-memory cache).
- SearchModal (Cmd+K) uses the lighter search-index.json.
- Sidebar + plugins index/detail + collection pages fetch counts.json
  instead of the full index just to read array lengths.
- data.ts gains fetchComponentsByType/fetchSearchIndex (additive);
  fetchComponents() stays for the SSR detail page and Discord bot.

Fix: SendToRepoModal read `match.content` off an index that no longer
carries content, so "Send to repo" produced empty PRs / threw "No
component content found". buildFileMap now pulls each item's content via
fetchComponentContent (the per-component files), which also removes its
full-index fetch.

_headers: cache/CORS blocks for counts.json, components/*, search-index.json.

Payload (gzip on-the-wire): sidebars/plugins/collection 327KB → ~124B;
grid default type (agents) 327KB → 145KB; Cmd+K 327KB → 260KB.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-04 16:20:24 -04:00

1 line
5.4 KiB
JSON

[{"name": "angular-app", "id": "angular-app", "type": "template", "subtype": "framework", "category": "frameworks", "language": "javascript-typescript", "description": "Angular-App with Javascript-Typescript", "files": [".claude/commands/components.md", ".claude/commands/services.md"], "installCommand": "npx claude-code-templates@latest --template=angular-app --yes", "downloads": 0}, {"name": "common", "id": "common", "type": "template", "subtype": "language", "category": "languages", "description": "Common project template", "files": [".mcp.json", ".claude/commands/git-workflow.md", ".claude/commands/project-setup.md", "README.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=common --yes", "downloads": 0}, {"name": "django-app", "id": "django-app", "type": "template", "subtype": "framework", "category": "frameworks", "language": "python", "description": "Django-App with Python", "files": [".claude/commands/django-model.md", ".claude/commands/admin.md", ".claude/commands/views.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=django-app --yes", "downloads": 0}, {"name": "fastapi-app", "id": "fastapi-app", "type": "template", "subtype": "framework", "category": "frameworks", "language": "python", "description": "Fastapi-App with Python", "files": [".claude/commands/testing.md", ".claude/commands/deployment.md", ".claude/commands/auth.md", ".claude/commands/api-endpoints.md", ".claude/commands/database.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=fastapi-app --yes", "downloads": 0}, {"name": "flask-app", "id": "flask-app", "type": "template", "subtype": "framework", "category": "frameworks", "language": "python", "description": "Flask-App with Python", "files": [".claude/commands/flask-route.md", ".claude/commands/testing.md", ".claude/commands/deployment.md", ".claude/commands/app-factory.md", ".claude/commands/blueprint.md", ".claude/commands/database.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=flask-app --yes", "downloads": 0}, {"name": "go", "id": "go", "type": "template", "subtype": "language", "category": "languages", "description": "Go project template", "files": [".mcp.json", "README.md"], "installCommand": "npx claude-code-templates@latest --template=go --yes", "downloads": 0}, {"name": "javascript-typescript", "id": "javascript-typescript", "type": "template", "subtype": "language", "category": "languages", "description": "Javascript-Typescript project template", "files": [".mcp.json", ".claude/settings.json", ".claude/commands/debug.md", ".claude/commands/api-endpoint.md", ".claude/commands/typescript-migrate.md", ".claude/commands/lint.md", ".claude/commands/npm-scripts.md", ".claude/commands/refactor.md", ".claude/commands/test.md", "README.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=javascript-typescript --yes", "downloads": 0}, {"name": "node-api", "id": "node-api", "type": "template", "subtype": "framework", "category": "frameworks", "language": "javascript-typescript", "description": "Node-Api with Javascript-Typescript", "files": [".claude/commands/api-endpoint.md", ".claude/commands/middleware.md", ".claude/commands/route.md", ".claude/commands/database.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=node-api --yes", "downloads": 0}, {"name": "python", "id": "python", "type": "template", "subtype": "language", "category": "languages", "description": "Python project template", "files": [".mcp.json", ".claude/settings.json", ".claude/commands/lint.md", ".claude/commands/test.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=python --yes", "downloads": 0}, {"name": "rails-app", "id": "rails-app", "type": "template", "subtype": "framework", "category": "frameworks", "language": "ruby", "description": "Rails-App with Ruby", "files": [".claude/commands/authentication.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=rails-app --yes", "downloads": 0}, {"name": "react-app", "id": "react-app", "type": "template", "subtype": "framework", "category": "frameworks", "language": "javascript-typescript", "description": "React-App with Javascript-Typescript", "files": [".claude/commands/state-management.md", ".claude/commands/component.md", ".claude/commands/hooks.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=react-app --yes", "downloads": 0}, {"name": "ruby", "id": "ruby", "type": "template", "subtype": "language", "category": "languages", "description": "Ruby project template", "files": [".mcp.json", ".claude/settings.json", ".claude/commands/model.md", ".claude/commands/test.md", "CLAUDE.md"], "installCommand": "npx claude-code-templates@latest --template=ruby --yes", "downloads": 0}, {"name": "rust", "id": "rust", "type": "template", "subtype": "language", "category": "languages", "description": "Rust project template", "files": [".mcp.json", "README.md"], "installCommand": "npx claude-code-templates@latest --template=rust --yes", "downloads": 0}, {"name": "vue-app", "id": "vue-app", "type": "template", "subtype": "framework", "category": "frameworks", "language": "javascript-typescript", "description": "Vue-App with Javascript-Typescript", "files": [".claude/commands/components.md", ".claude/commands/composables.md"], "installCommand": "npx claude-code-templates@latest --template=vue-app --yes", "downloads": 0}]