完成差旅发票录入流程

This commit is contained in:
wandering
2026-06-11 19:22:34 +08:00
parent cf567c22f2
commit 10115214aa
50 changed files with 3033 additions and 2756 deletions

17
.agents/skills/README.md Normal file
View File

@@ -0,0 +1,17 @@
---
last_reviewed: 2026-06-11
---
# .agents/skills — Cursor Agent 技能目录
存放 Cursor Agent 可调用的自动化技能定义。
## 技能清单
| 技能 | 说明 |
|------|------|
| `pre-commit-check/` | 提交前代码质量检查:运行 ruff lint/format、mypy 类型检查、deptry 依赖审计,自动修复可修复问题 |
## 使用方式
Agent 在用户请求提交代码或检查代码质量时自动触发对应技能,无需手动调用。

View File

@@ -0,0 +1,68 @@
---
name: pre-commit-check
description: >-
Run pre-commit code quality checks (ruff lint/format, mypy type check, deptry dependency audit)
and fix any issues before committing. Use when the user wants to commit code, asks to check code
quality, or mentions pre-commit validation. Also use when preparing code for submission or
when the user says "check before commit" or "run checks".
---
# Pre-Commit Code Quality Check
## Workflow
Run all checks in parallel first, then fix any issues iteratively:
```
Step 1: Run checks (parallel)
- uv run ruff check .
- uv run ruff format --check .
- uv run mypy src/
- uv run deptry .
Step 2: If any check fails, fix issues
- ruff check --fix . (auto-fix lint issues)
- ruff format . (auto-format)
- Fix type annotation errors manually
Step 3: Re-run all checks to confirm
Step 4: Report results with table
```
## Common Fixes
| Error | Fix |
|-------|-----|
| `UP038` | Replace `isinstance(e, (X, Y))` with `isinstance(e, X \| Y)` |
| `no-untyped-def` | Add return type annotation (`-> None` for void functions) |
| `I001` | Run `uv run ruff check --fix .` |
| `no-any-return` | Use `cast(Type, expression)` from `typing` |
| `type-arg` missing | Add type arguments: `dict[str, Any]` instead of `dict` |
| `unused-ignore` | Remove stale `# type: ignore` comments |
## Type Annotation Rules
- Functions that modify data in-place and return nothing: `-> None`
- Functions that call untyped external APIs: add `-> Any` return type
- Dicts that hold mixed types (str + float): use `dict[str, Any]`
- Import `Any` from `typing` when needed
- Import `cast` from `typing` when `no-any-return` triggers
## Verification Report
After all checks pass, report:
| 检查项 | 状态 |
|--------|------|
| `ruff check .` | ✅ |
| `ruff format --check .` | ✅ |
| `mypy src/` | ✅ |
| `deptry .` | ✅ |
## Notes
- All commands use `uv run` prefix (project virtual environment)
- `mypy` has `strict = true` in `pyproject.toml` - expect strict type checking
- `ignore_missing_imports = true` is set, so missing third-party stubs are OK
- If `tests.*` override shows "unused section" note, it's normal (no tests dir yet)
- Never skip a check - all four must pass before committing