feat(T-003): 建立日志与运行产物目录策略

- src/paths.py: 集中管理 logs/、artifacts/ 路径与产物命名
  (artifacts/<task_id>/<时间戳>_<step>.png|.xml),_safe 安全化防路径穿越,
  运行时自动创建且被 .gitignore 忽略。
- src/logging_config.py: 统一日志格式(含 task_id/step),控制台 + logs/app.log,
  缺上下文时由 filter 补默认值,setup 幂等;约定不记录敏感信息。
- src/main.py: 启动时初始化运行目录与日志。
- 运行方式统一为 python -m src.main(绝对导入下的唯一干净入口),
  同步替换 00/03/05/current-state 文档命令与 dev.bat。
- 文档:04 §七 补 paths.py 与产物命名规则;tasks/progress/current-state 更新。

验证:compileall OK;unittest Ran 17 tests OK;python -m src.main exit=0,logs/app.log 写入正常。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
chengma
2026-06-24 17:32:28 +08:00
co-authored by Claude Opus 4.8
parent 41bc666322
commit b1e38ffd7a
13 changed files with 246 additions and 25 deletions
+2 -2
View File
@@ -38,7 +38,7 @@
| 创建虚拟环境 | `python -m venv .venv` |
| 激活虚拟环境 | `.venv\Scripts\Activate.ps1` |
| 安装依赖 | `pip install -r requirements.txt` |
| 本地运行 | `python src/main.py` |
| 本地运行 | `python -m src.main` |
| 测试 | `python -m unittest discover -s tests -t .` |
| 语法检查 | `python -m compileall src` |
| 打包(待 T-402) | `pyinstaller app.spec` |
@@ -49,7 +49,7 @@ Windows PowerShell:
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python src/main.py
python -m src.main
python -m unittest discover -s tests -t .
```