Skip to content

Commit c803431

Browse files
authored
Merge pull request #43 from lufftw/feat/local-mindmap-auto-generation
feat: add optional local CI/CD automation and unified documentation build workflow
2 parents 7d176bf + 805a3df commit c803431

26 files changed

+3522
-1758
lines changed

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Pre-commit configuration for NeetCode project
2+
# Install: pip install pre-commit
3+
# Setup: pre-commit install
4+
5+
repos:
6+
# Custom local hook for AI mind map generation
7+
- repo: local
8+
hooks:
9+
- id: generate-ai-mindmaps
10+
name: Generate AI Mind Maps
11+
entry: python tools/hooks/generate_ai_mindmaps_hook.py
12+
language: system
13+
files: |
14+
^ontology/
15+
^meta/problems/
16+
^tools/generate_mindmaps\.py$
17+
pass_filenames: false
18+
stages: [pre-commit]
19+
verbose: true
20+
always_run: false
21+
22+

README.md

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ AEO/GEO: A scalable Python framework with knowledge graph-driven learning, AI-po
2929

3030
---
3131

32-
**Topics:** `knowledge-graph` `ai-powered` `mind-map` `pattern-recognition` `leetcode` `neetcode-150` `blind-75` `stress-testing` `algorithm-engineering` `performance-benchmarking` `data-driven-testing` `random-test-generation` `judge-function` `algorithm-debugging` `competitive-programming` `python` `vscode-integration` `test-automation` `coding-interview`
32+
**Topics:** `knowledge-graph` `ai-powered` `mind-map` `pattern-recognition` `leetcode` `neetcode-150` `blind-75` `stress-testing` `algorithm-engineering` `performance-benchmarking` `data-driven-testing` `random-test-generation` `judge-function` `algorithm-debugging` `competitive-programming` `python` `vscode-integration` `test-automation` `pre-commit` `local-automation` `coding-interview`
3333

3434
---
3535

@@ -209,7 +209,7 @@ source leetcode/bin/activate
209209
pip install -r requirements.txt
210210

211211
# Make scripts executable
212-
chmod +x run_tests.sh run_case.sh new_problem.sh
212+
chmod +x scripts/run_tests.sh scripts/run_case.sh scripts/new_problem.sh
213213
```
214214

215215
</details>
@@ -218,10 +218,10 @@ chmod +x run_tests.sh run_case.sh new_problem.sh
218218

219219
```bash
220220
# Windows
221-
new_problem.bat 0001_two_sum
221+
scripts\new_problem.bat 0001_two_sum
222222

223223
# Linux/macOS
224-
./new_problem.sh 0001_two_sum
224+
./scripts/new_problem.sh 0001_two_sum
225225
```
226226

227227
This creates:
@@ -233,10 +233,10 @@ This creates:
233233

234234
```bash
235235
# Windows
236-
run_tests.bat 0001_two_sum
236+
scripts\run_tests.bat 0001_two_sum
237237

238238
# Linux/macOS
239-
./run_tests.sh 0001_two_sum
239+
./scripts/run_tests.sh 0001_two_sum
240240
```
241241

242242
### 4. Debug in VS Code
@@ -374,6 +374,29 @@ python tools/generate_mindmaps_ai.py --topic dynamic_programming
374374
# language = ["en", "zh-TW"]
375375
```
376376

377+
### 🔄 Automatic Generation (Local CI/CD)
378+
379+
**Auto-generate AI mind maps on commit** using pre-commit hooks:
380+
381+
```bash
382+
# Install pre-commit hooks
383+
pip install pre-commit
384+
pre-commit install
385+
```
386+
387+
When you commit changes to `ontology/`, `meta/problems/`, or `tools/generate_mindmaps.py`, the hook automatically runs AI mind map generation.
388+
389+
**Skip when needed:**
390+
```bash
391+
# Skip with commit message
392+
git commit -m "Update ontology [skip-ai]"
393+
394+
# Skip with environment variable
395+
SKIP_AI_MINDMAPS=true git commit -m "Update ontology"
396+
```
397+
398+
> 📖 See [tools/README.md](tools/README.md#-local-cicd-automation) for complete setup and usage guide.
399+
377400
### Configuration
378401

379402
Edit `tools/mindmap_ai_config.toml` to customize:
@@ -629,7 +652,7 @@ greedy 44.82ms O(kN) 3/3
629652
============================================================
630653
```
631654

632-
Create with template: `new_problem.bat 0023_merge_k_lists --multi`
655+
Create with template: `scripts\new_problem.bat 0023_merge_k_lists --multi`
633656

634657
> 📖 See [`docs/SOLUTION_CONTRACT.md` §B](docs/SOLUTION_CONTRACT.md#b-solutions-metadata-schema) for complete SOLUTIONS schema and validation rules.
635658
@@ -845,7 +868,7 @@ neetcode/
845868
├── .dev/ # 🧪 Maintainer zone (unit tests)
846869
│ ├── tests/ # Unit test suite (150+ cases)
847870
│ ├── tests_solutions/ # Solution validation tests
848-
│ ├── run_tests.bat/.sh # Run runner unit tests
871+
│ ├── scripts/run_tests.bat/.sh # Run runner unit tests
849872
│ ├── run_all_tests.bat/.sh # Run all unit tests
850873
│ ├── run_tests_solutions.bat/.sh # Run solution tests
851874
│ ├── TESTING.md # Testing documentation
@@ -858,9 +881,11 @@ neetcode/
858881
859882
├── leetcode/ # 🐍 Python virtual environment (3.11)
860883
861-
├── run_tests.bat / .sh # Run all tests for a problem
862-
├── run_case.bat / .sh # Run single test case
863-
├── new_problem.bat / .sh # Create new problem from template
884+
├── scripts/ # 🔧 Utility scripts
885+
│ ├── new_problem.bat / .sh # Create new problem from template
886+
│ ├── run_tests.bat / .sh # Run all tests for a problem
887+
│ ├── run_case.bat / .sh # Run single test case
888+
│ └── build_docs.bat / .sh # Build documentation site
864889
865890
├── requirements.txt # Python dependencies
866891
├── mkdocs.yml # MkDocs configuration
@@ -1003,13 +1028,48 @@ python tools/generate_mindmaps.py --html
10031028

10041029
Configuration: `tools/generate_mindmaps.toml`
10051030

1031+
### Build Documentation Locally
1032+
1033+
> ⚠️ **Optional Feature:** Building documentation locally is **completely optional**. Core LeetCode practice functionality works without any documentation build setup.
1034+
1035+
**Recommended Method (Simple):**
1036+
1037+
The easiest way to build documentation locally is using the manual scripts:
1038+
1039+
```bash
1040+
# Windows
1041+
scripts\build_docs.bat
1042+
1043+
# Linux/macOS
1044+
./scripts/build_docs.sh
1045+
1046+
# Build and preview locally
1047+
scripts\build_docs.bat --serve # Windows
1048+
./scripts/build_docs.sh --serve # Linux/macOS
1049+
```
1050+
1051+
📖 **See [Building Documentation Locally (Manual Method)](docs/BUILD_DOCS_MANUAL.md)** for complete guide.
1052+
1053+
**Advanced Option (Optional):**
1054+
1055+
If you want to test the exact GitHub Actions workflow locally, you can use `act`:
1056+
1057+
📖 **See [Running GitHub Actions Locally with Act](docs/ACT_LOCAL_GITHUB_ACTIONS.md)***Note: Requires Docker and act tool. Only needed if you want to test CI/CD workflows.*
1058+
10061059
### Documentation
10071060

1061+
**Core Documentation:**
10081062
- [`.dev/README.md`](https://github.com/lufftw/neetcode/blob/main/.dev/README.md) — Maintainer guide
10091063
- [`.dev/TESTING.md`](https://github.com/lufftw/neetcode/blob/main/.dev/TESTING.md) — Testing documentation
10101064
- [`docs/SOLUTION_CONTRACT.md`](docs/SOLUTION_CONTRACT.md) — Solution file specification (SOLUTIONS dict, JUDGE_FUNC)
10111065
- [`docs/GENERATOR_CONTRACT.md`](docs/GENERATOR_CONTRACT.md) — Generator file specification (generate(), edge cases, complexity)
10121066
- [`docs/ARCHITECTURE_MIGRATION.md`](docs/ARCHITECTURE_MIGRATION.md) — Polymorphic architecture migration guide
1067+
1068+
**Local Documentation Build (Optional):**
1069+
- [`docs/BUILD_DOCS_MANUAL.md`](docs/BUILD_DOCS_MANUAL.md) — ⭐ **Recommended:** Simple manual build method
1070+
- [`docs/ACT_LOCAL_GITHUB_ACTIONS.md`](docs/ACT_LOCAL_GITHUB_ACTIONS.md) — Advanced: Test CI/CD workflows locally with act (requires Docker)
1071+
1072+
**Deployment:**
10131073
- [`docs/GITHUB_PAGES_SETUP.md`](docs/GITHUB_PAGES_SETUP.md) — Deployment guide
10141074

10151075
---

README_zh-TW.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ source leetcode/bin/activate
209209
pip install -r requirements.txt
210210

211211
# 設定腳本執行權限
212-
chmod +x run_tests.sh run_case.sh new_problem.sh
212+
chmod +x scripts/run_tests.sh scripts/run_case.sh scripts/new_problem.sh
213213
```
214214

215215
</details>
@@ -218,10 +218,10 @@ chmod +x run_tests.sh run_case.sh new_problem.sh
218218

219219
```bash
220220
# Windows
221-
new_problem.bat 0001_two_sum
221+
scripts\new_problem.bat 0001_two_sum
222222

223223
# Linux/macOS
224-
./new_problem.sh 0001_two_sum
224+
./scripts/new_problem.sh 0001_two_sum
225225
```
226226

227227
這會自動建立:
@@ -233,10 +233,10 @@ new_problem.bat 0001_two_sum
233233

234234
```bash
235235
# Windows
236-
run_tests.bat 0001_two_sum
236+
scripts\run_tests.bat 0001_two_sum
237237

238238
# Linux/macOS
239-
./run_tests.sh 0001_two_sum
239+
./scripts/run_tests.sh 0001_two_sum
240240
```
241241

242242
### 4. 在 VS Code 中除錯
@@ -604,7 +604,7 @@ greedy 44.82ms O(kN) 3/3
604604
============================================================
605605
```
606606

607-
使用模板建立:`new_problem.bat 0023_merge_k_lists --multi`
607+
使用模板建立:`scripts\new_problem.bat 0023_merge_k_lists --multi`
608608

609609
> 📖 完整 SOLUTIONS schema 和驗證規則請參見 [`docs/SOLUTION_CONTRACT.md` §B](docs/SOLUTION_CONTRACT.md#b-solutions-metadata-schema)
610610
@@ -820,7 +820,7 @@ neetcode/
820820
├── .dev/ # 🧪 維護者專區(單元測試)
821821
│ ├── tests/ # 單元測試套件(150+ 案例)
822822
│ ├── tests_solutions/ # 解答驗證測試
823-
│ ├── run_tests.bat/.sh # 執行 runner 單元測試
823+
│ ├── scripts/run_tests.bat/.sh # 執行 runner 單元測試
824824
│ ├── run_all_tests.bat/.sh # 執行所有單元測試
825825
│ ├── run_tests_solutions.bat/.sh # 執行解答測試
826826
│ ├── TESTING.md # 測試文件
@@ -833,9 +833,11 @@ neetcode/
833833
834834
├── leetcode/ # 🐍 Python 虛擬環境(3.11)
835835
836-
├── run_tests.bat / .sh # 執行某題目的所有測試
837-
├── run_case.bat / .sh # 執行單一測資
838-
├── new_problem.bat / .sh # 從模板建立新題目
836+
├── scripts/ # 🔧 工具腳本
837+
│ ├── new_problem.bat / .sh # 從模板建立新題目
838+
│ ├── run_tests.bat / .sh # 執行某題目的所有測試
839+
│ ├── run_case.bat / .sh # 執行單一測資
840+
│ └── build_docs.bat / .sh # 建置文件網站
839841
840842
├── requirements.txt # Python 相依套件
841843
├── mkdocs.yml # MkDocs 配置

0 commit comments

Comments
 (0)