build: uv 工具链、检查命令与提交前检查

- pyproject:Python 3.12、ruff、pyright strict、pytest(live/gpu 标记)、import-linter;
  首条导入契约:cadx 不导入 torch、sam2(design 0001 第 7 条)
- Makefile:sync/fmt/test/check
- pre-commit:gitleaks、拦截 data/runs/reference/reference-pdf/models 与 .env、ruff format
- 空包 cadx 与一项导入测试,让 make check 能跑通

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 23:42:36 -04:00
commit 5eb38df22d
13 changed files with 566 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.1
hooks:
- id: gitleaks
- repo: local
hooks:
# AGENTS.md 硬性约束 1、3:即使 git add -f 也不能提交本地材料。
- id: local-only-paths
name: data/、runs/、reference/、models/ 和 .env 不进提交
language: fail
entry: "禁止提交本地材料:"
files: '^(data|runs|reference|reference-pdf|models)(/|$)|(^|/)\.env(\.[^/]+)?$'
exclude: '^\.env\.example$'
types_or: [file, symlink]
# 使用 uv.lock 中的同一版本,不另装一份 ruff。
- id: ruff-format
name: ruff format --check
language: system
entry: uv run --frozen ruff format --check --force-exclude
types_or: [python, pyi]