| name | git-precommit |
| description | Orchestrate pre-commit workflow including Memory Bank sync, README/CHANGELOG/ROADMAP updates, and MCP tool count sync. Triggers: GIT, gc, push, commit, ๆไบค, ๆบๅ commit, ่ฆๆไบคไบ, git commit, pre-commit, ๆจ้. |
Git ๆไบคๅๅทฅไฝๆต๏ผ็ทจๆๅจ๏ผ
ๆ่ฟฐ
ๅ่ชฟๅคๅ Skills ๅฎๆ Git ๆไบคๅ็ๆๆๆบๅๅทฅไฝใ
ๆฌๅฐๆกๅๆไฝฟ็จ pre-commit framework ่ชๅๅท่ก็จๅผ็ขผๅ่ณชๆชขๆฅ๏ผไปฅๅ AI orchestrator ่็ๆๆชๅๆญฅใ
๐ ่ชๆผๅๅพช็ฐ (Self-Evolution Cycle)
ๆฌๅฐๆก็ๅ่ณชๅฎ้ๆฏไธๅ่ชๆๆผๅ็้่ฟด็ณป็ตฑ๏ผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ่ชๆผๅๅพช็ฐ (Self-Evolution Cycle) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โ Instructions (copilot-instructions.md) โ
โ โ ๅฎ็พฉ่ฆ็ฏใๅผๅฐ AI ไฝฟ็จ Skills โ
โ โผ โ
โ โก Skills (SKILL.md ๆชๆก) โ
โ โ ็ขบไฟๅปบๆงๅฎๆดใๅตๅปบๆฐ Hook โ
โ โผ โ
โ โข Hooks (.pre-commit-config.yaml + scripts/hooks/) โ
โ โ ่ชๅๅท่กๆชขๆฅใ่ชๅไฟฎๆญฃ โ
โ โผ โ
โ โฃ Validate (check_evolution_cycle.py) โ
โ โ ้ฉ่ญ โ โกโข ็ไธ่ดๆง โ
โ โผ โ
โ โค Feedback โ ๆดๆฐ Instructions & Skills โ
โ โ ่็้ฉ่ญๅคฑๆใ่ฃ้ฝๆๆชใๆดๆฐๅฅไปถ็ๆฌ โ
โ โโโโโโ ๅๅฐ โ ๏ผๅพช็ฐๅฎๆ๏ผ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ๅพช็ฐ่งธ็ผๆๆฉ
| ไบไปถ | ่งธ็ผๅไฝ |
|---|
| ๆฐๅข Hook | Skill ๅตๅปบ hook โ evolution-cycle ้ฉ่ญๆๆชๅ instruction ๆฏๅฆๅๆญฅ |
| ไฟฎๆน Instruction | evolution-cycle ้ฉ่ญ skill/hook ๆฏๅฆไปไธ่ด |
pre-commit autoupdate | ๅฅไปถ็ๆฌๆดๆฐ โ ่ชๅๆผๅ |
| ้ฉ่ญๅคฑๆ | ๅ ฑๅไธไธ่ด่๏ผๅผทๅถไฟฎๅพฉๅพๆ่ฝ commit |
ๆถๆง๏ผ้ๅฑค้ฒ่ญท + ่ชๆผๅ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Git Commit ้ฒ่ญทๆถๆง โ
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 1: ่ชๅๅ โ Layer 2: AI ็ทจๆๅจ โ
โ (pre-commit hooks) โ (agent orchestrator) โ
โโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
ruff + ruff-formatโ โ
Memory Bank ๅๆญฅ โ
โ โ
bandit security โ โ
CHANGELOG ๆดๆฐ โ
โ โ
vulture deadcode โ โ
ROADMAP ๆดๆฐ โ
โ โ
deptry deps โ โ
README ๆดๆฐ โ
โ โ
file-hygiene โ โ
ๆถๆงๆๆชๆชขๆฅ โ
โ โ
commit-size-guardโ โ
Commit ่จๆฏๅปบ่ญฐ โ
โ โ
file-hygiene โ โ
โ โ
commit-size-guardโ โ
โ โ
async-test-checkerโ โ
โ โ
tool-count-sync โ โ
โ โ
skills-frontmatterโ โ
โ โ
evolution-cycle โ โ
โ โ
future-annotationsโ โ
โ โ
no-print-in-src โ โ
โ โ
ddd-layer-importsโ โ
โ โ
no-type-ignore-bareโ โ
โ โ
docstring-tools โ โ
โ โ
no-env-inner-layersโ โ
โ โ
source-counts-guardโ โ
โ โ
todo-scanner โ โ
โ โ
instruction-driftโ โ
โ โ
yaml/toml/json โ โ
โ โ
no large files โ โ
โ โ
no debug stmts โ โ
โ โ
no private keys โ โ
โ โ
BOM / symlinks โ โ
โ โ
case conflicts โ โ
โ โ
Windows names โ โ
โ โ
mixed line endingโ โ
โ โ
no-commit-to-branchโ โ
โ โ
name-tests-test โ โ
โ โโ Pre-push โโโโโโโโ โ โ
โ โ
mypy (pre-push) โ โ
โ โ
semgrep (pre-push)โ โ
โ โ
pytest (pre-push) โ โ
โโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ง ่ชๅไฟฎๅพฉ๏ผ โ ๐ง ่ชๅไฟฎๅพฉ๏ผ โ
โ trailing whitespace โ tool-count-sync (auto-stage) โ
โ end-of-file newline โ โ
โ ruff --fix โ โ
โ ruff format โ โ
โ future-annotations โ โ
โโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
้็ผ่
่จญๅฎ (ไธๆฌกๆง)
uv sync
uv run pre-commit install
uv run pre-commit install --hook-type pre-push
Hook ่ชๅๆผๅ (Auto-Evolution)
ๅฅไปถ็ๆฌๆดๆฐ
uv run pre-commit autoupdate
uv run pre-commit run --all-files
ๅพช็ฐไธ่ดๆง้ฉ่ญ
uv run python scripts/hooks/check_evolution_cycle.py
ๆญค่
ณๆฌ้ฉ่ญ๏ผ
- ๆๆ hook ID ้ฝๅจ instruction ๅ skill ไธญ่ขซๆๆชๅ
- ๆๆ hook ๅผ็จ็่
ณๆฌๆชๆก้ฝๅญๅจ
- CONTRIBUTING.md ็ hook ่กจๆ ผ่ .pre-commit-config.yaml ไธ่ด
- pyproject.toml ็ addopts ๅผทๅถๅคๆ ธ
- Skill ๆๆชๅผ็จไบๆญฃ็ขบ็ hook ๅบ็ค่จญๆฝ
ๆฐๅข Hook ็ๅฎๆดๆต็จ
็ถ้่ฆๆฐๅขไธๅ hook ๆ๏ผๅฟ
้ ๅฎๆๆดๅๅพช็ฐ๏ผ
- ๅตๅปบ hook ่
ณๆฌ โ
scripts/hooks/<name>.py
- ่จปๅๅฐ .pre-commit-config.yaml โ ๅ ๅ
ฅ hook ๅฎ็พฉ
- ๆดๆฐ copilot-instructions.md โ Pre-commit Hooks ๅๅก
- ๆดๆฐๆฌ SKILL.md โ ๆถๆงๅ Layer 1 ๅ่กจ
- ๆดๆฐ CONTRIBUTING.md โ hooks ่กจๆ ผ
- ๅท่ก้ฉ่ญ โ
uv run python scripts/hooks/check_evolution_cycle.py
- ็ขบ่ช้้ โ evolution-cycle hook ่ชๅๅจไธๆฌก commit ๆๆชขๆฅ
โ ๏ธ ๅฆๆๅชๅไบๆญฅ้ฉ 1-2 ่ๆฒๆ 3-5๏ผevolution-cycle hook ๆๅจ commit ๆๅ ฑ้ฏใ
๐ก ๅปบ่ญฐๆฏๆๅท่กไธๆฌก autoupdate๏ผ่ชๅๅๅพๆๆฐ็ ruff ่ฆๅใๅฎๅ
จๆงๆชขๆฅ็ญใ
่งธ็ผๆขไปถ
- ใๆบๅ commitใใ่ฆๆไบคไบใใgit commitใ
ๆณ่ฆไพๆ
- ๆฒๆณ๏ผCONSTITUTION.md ็ฌฌไธ็ซ
- ๅญๆณ๏ผ.github/bylaws/git-workflow.md
AI ็ทจๆๅจๅท่กๆต็จ
็ถ AI agent ่ขซ่ฆๆฑใๆบๅ commitใๆ๏ผๅท่กไปฅไธ้กๅคๆญฅ้ฉ๏ผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Pre-Commit Orchestrator โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 1: memory-sync [ๅฟ
่ฆ] Memory Bank ๅๆญฅ โ
โ Step 2: pre-commit-run [ๅฟ
่ฆ] ๅท่กๆๆ hooks โ
โ Step 3: readme-update [ๅฏ้ธ] README ๆดๆฐ โ
โ Step 4: changelog-update[ๅฏ้ธ] CHANGELOG ๆดๆฐ โ
โ Step 5: roadmap-update [ๅฏ้ธ] ROADMAP ๆดๆฐ โ
โ Step 6: arch-check [ๆขไปถ] ๆถๆงๆๆชๆชขๆฅ โ
โ Step 7: commit-prepare [ๆ็ต] ๆบๅๆไบค โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Step 2 ๆๅท่ก uv run pre-commit run --all-files๏ผๆถต่ ruffใfile hygieneใtool docs sync ็ญๆๆ่ชๅๅๆชขๆฅใmypy ๅ semgrep ๅทฒ็งป่ณ pre-push ้ๆฎตไปฅ้ฒ OOMใ
ๅฟ
่ฆๆญฅ้ฉ๏ผMCP ๅทฅๅ
ทๆธ้ๅๆญฅ
็ฑ pre-commit hook tool-count-sync ่ชๅ่็ใไนๅฏๆๅๅท่ก๏ผ
uv run python scripts/count_mcp_tools.py --update-docs
ๆญค่
ณๆฌๆ่ชๅๆดๆฐ๏ผ
README.md - ๅทฅๅ
ทๆธ้
README.zh-TW.md - ๅทฅๅ
ทๆธ้
.github/copilot-instructions.md - ๅทฅๅ
ทๆธ้ + ๅฎๆดๅ่กจ
src/.../TOOLS_INDEX.md - ๅฎๆดๅทฅๅ
ท็ดขๅผ
ๅๆธ
| ๅๆธ | ่ชชๆ | ้ ่จญ |
|---|
--skip-readme | ่ทณ้ README ๆดๆฐ | false |
--skip-changelog | ่ทณ้ CHANGELOG ๆดๆฐ | false |
--skip-roadmap | ่ทณ้ ROADMAP ๆดๆฐ | false |
--skip-hooks | ่ทณ้ pre-commit hooks | false |
--dry-run | ๅช้ ่ฆฝไธไฟฎๆน | false |
--quick | ๅชๅท่กๅฟ
่ฆๆญฅ้ฉ (memory-sync + hooks) | false |
ไฝฟ็จ็ฏไพ
ใๆบๅ commitใ # ๅฎๆดๆต็จ
ใๅฟซ้ commitใ # ็ญๅ --quick
ใcommit --skip-readmeใ # ่ทณ้ README
่ทณ้็นๅฎ Hook
SKIP=mypy git commit -m "quick fix"
git commit --no-verify -m "emergency"
่ผธๅบๆ ผๅผ
๐ Git Pre-Commit ๅทฅไฝๆต
[1/7] Memory Bank ๅๆญฅ โ
โโ progress.md: ๆดๆฐ 2 ้
โโ activeContext.md: ๅทฒๆดๆฐ
[2/7] Pre-commit Hooks โ
โโ ruff lint: passed (auto-fixed 3 issues)
โโ ruff format: passed
โโ mypy: passed
โโ file hygiene: passed
โโ tool docs sync: passed (2 files updated)
[3/7] README ๆดๆฐ โ
โโ ๆฐๅขๅ่ฝ่ชชๆ
[4/7] CHANGELOG ๆดๆฐ โ
โโ ๆทปๅ v0.2.0 ๆข็ฎ
[5/7] ROADMAP ๆดๆฐ โญ๏ธ (็ก่ฎๆด)
[6/7] ๆถๆงๆๆช โญ๏ธ (็ก็ตๆงๆง่ฎๆด)
[7/7] Commit ๆบๅ โ
โโ ๅปบ่ญฐ่จๆฏ๏ผfeat: ๆฐๅข็จๆถ่ช่ญๆจก็ต
๐ Staged files:
- src/auth/...
- docs/...
ๆบๅๅฅฝไบ๏ผ็ขบ่ชๆไบค๏ผ
Hook ่จญๅฎๆชๆก
| ๆชๆก | ็จ้ |
|---|
.pre-commit-config.yaml | pre-commit hooks ๅฎ็พฉ |
pyproject.toml [tool.ruff] | ruff lint + format ่ฆๅ |
pyproject.toml [tool.mypy] | mypy type check ่ฆๅ |
pyproject.toml [tool.pytest] addopts | ๅผทๅถๅคๆ ธๆธฌ่ฉฆ |
pyproject.toml [tool.bandit] | bandit ๅฎๅ
จๆๆ่ฆๅ |
pyproject.toml [tool.deptry] | deptry ไพ่ณด่ก็่ฆๅ |
vulture_whitelist.py | vulture ๆญป็ขผๆๆ็ฝๅๅฎ |
scripts/hooks/check_file_hygiene.py | ๆชๆก่ก็ๆชขๆฅ |
scripts/hooks/check_tool_sync.py | MCP ๅทฅๅ
ทๆๆชๅๆญฅ |
scripts/hooks/check_skills_frontmatter.py | .claude/skills YAML frontmatter ้ฉ่ญ |
scripts/hooks/check_evolution_cycle.py | ่ชๆผๅๅพช็ฐไธ่ดๆง้ฉ่ญ |
scripts/hooks/check_commit_size.py | Commit ๆชๆกๆธ้ๅถ (โค30) |
scripts/hooks/check_future_annotations.py | future annotations ๅผทๅถ |
scripts/hooks/check_no_print.py | ็ฆๆญข src/ ไฝฟ็จ print() |
scripts/hooks/check_ddd_layers.py | DDD ๅฑค็ดไพ่ณดๆชขๆฅ |
scripts/hooks/check_type_ignore.py | ็ฆๆญข่ฃธ type: ignore |
scripts/hooks/check_docstring_tools.py | MCP tool docstring ๆชขๆฅ |
scripts/hooks/check_env_config.py | ็ฆๆญขๅ
งๅฑคไฝฟ็จ os.environ |
scripts/hooks/check_source_counts.py | ็ขบไฟๆฏไพๆบ API ๅๅณ้้กฏ็คบ |
scripts/hooks/check_todo_scanner.py | TODO/FIXME ๆๆ |
scripts/hooks/check_instruction_drift.py | ๅทฅๅ
ท docstring ่ฎๆดๅตๆธฌ |
scripts/check_async_tests.py | async/sync ๆธฌ่ฉฆไธ่ดๆง |
Unicode Mojibake Hook
unicode-mojibake uses scripts/hooks/check_unicode_mojibake.py to block newly staged corrupted emoji/UTF-8 artifacts while allowing valid emoji.