$ show MisterBooo/LeetCodeAnimation
LeetCodeAnimation is a documentation and indexing repository that catalogs 256 LeetCode algorithm problems with animated explanations, multi-language reference solutions (Java, C++, Python), and structured metadata. The actual content lives on the companion site algomooc.com; this GitHub repo serves as a versioned public index, historical asset archive, and synchronization layer. The architecture is a static site generator pipeline: a Node.js sync script (tools/scripts/sync-algomooc-index.js) reads the website's study_index.js, compares it against docs/data/manifest.json, and regenerates manifest.json, leetcode-animation-index.md, index-by-topic.md, and sync-log.md. A separate build-readme.js injects problem counts into the README and produces stats.json for dynamic badges. The Python anima CLI (tools/anima.py) scaffolds new problem directories with template Markdown. GitHub Actions CI validates manifest integrity and checks staleness of generated files on every push/PR. The codebase is well-structured with clear separation between generated artifacts and hand-maintained content, enforced through LCA-AUTOGEN markers in the README. The 256 problems span arrays, linked lists, trees, DP, graphs, and more, each with articles, animations (GIF/MP4), and reference code.
The LLM identified 7 files worth highlighting for reuse:
Core sync engine that reads the website's study_index.js (window.WS_PROBLEMS), diffs it against the current manifest.json, and regenerates manifest.json, leetcode-animation-index.md, index-by-topic.md, and sync-log.md. Handles add/remove/change detection, maps problem IDs to existing repo directories, locates GIF previews via filesystem scan, and supports --check, --check-generated, and --log flags. Fully idempotent and safe to re-run. Extractable to any project needing a two-way index sync between a CMS and a Git repo.
Reads manifest.json, computes difficulty counts, and injects stats into README.md and docs/README-En.md between LCA-AUTOGEN markers. Also writes stats.json for dynamic Shields.io badges. Supports --write (inject) and --check (CI staleness gate, exits 1 if stale). The injection pattern — replacing only content between START/END markers while leaving everything else untouched — is a clean separation of concerns that prevents script/human conflicts. Reusable for any project needing script-managed numeric badges in Markdown.
Zero-dependency JSON validator for docs/data/manifest.json. Checks schema correctness (leetcodeId, sourcePid pattern, slug kebab-case, difficulty enum, status enum, non-empty topicsZh, valid siteUrl format), uniqueness of IDs and slugs, sourcePid-to-id consistency, and filesystem existence of repoPath and gifPath. Produces clear error/warning output with item labels. Extractable as a standalone manifest validation tool for any structured content pipeline.
Advisory tool that compares the website's study_index.js against the current manifest, shows added/removed/changed items, checks git status of website-side files, and suggests an appropriate commit message. Does not write anything — purely read-only review. Supports --site-root and --source flags. Useful as a pre-sync review step in any content pipeline where a CMS feeds a Git repo.
Formal JSON Schema (draft-07) defining the manifest item structure: leetcodeId (positive int), sourcePid (lcN pattern), slug (kebab-case), titleZh, difficulty (easy/medium/hard), categoryZh, topicsZh (non-empty string array), status (site-animation/repo-only/planned), nullable repoPath and gifPath, and siteUrl. Serves as both documentation and a validation contract. Could be used by validate-manifest.js (currently does manual validation) or external schema validators.
Defines ProblemInfo (id, title with title_slug method producing zero-padded kebab-case directory names) and Solution (problem reference with path helpers for Animation/, Article/, Code/ subdirectories and doc_path). Clean dataclass design with a factory method Solution.create() that scaffolds the directory tree. The title_slug format (e.g., '0001-Two-Sum') is the convention linking manifest entries to filesystem paths. Reusable as a lightweight content scaffolding library.
GitHub Actions workflow that runs on push and PR to validate the manifest (validate-manifest.js) and check that all generated files are up to date (sync --check-generated). Two-step CI: schema validation first, then staleness detection. This ensures no commit lands with an invalid manifest or stale indexes. Minimal and fast — uses Node.js 20 with no external dependencies.