mirror of
https://github.com/davila7/claude-code-templates.git
synced 2026-09-19 01:30:23 +08:00
4cb7df29c5
Two bugs compounded to make `generate_components_json.py` extremely slow: 1. ProvenanceValidator.js spawned 4 `git` subprocesses per component (~3200 total across 764+ components) to get commit/author/date, each re-walking the full repo history for a single file path. Replaced with one batched `git log --name-only` walk cached per-process, plus a cached `remote.origin.url` lookup instead of re-running it per file. 2. generate_components_json.py computed `cli_tool_dir` as `Path(__file__).parent / 'cli-tool'` (-> scripts/cli-tool, which doesn't exist) instead of the repo-root cli-tool/ directory. This made every run silently fail with a misleading "npm command not found" (FileNotFoundError from the bad cwd, not a missing binary) and skip security validation entirely - every component.json ever generated by this script had 0 validated components. Verified end-to-end: security-audit alone dropped from ~20min to ~2s in isolation, and the full generate_components_json.py pipeline (now including working security validation) completes in ~6-8 minutes, dominated by Supabase download-stats pagination (~700k+ rows), which is a separate, larger optimization left for later. Regenerated docs/components.json and dashboard/public/components.json with the fixes applied.