docs: 消解 AGENTS.md 规则冲突,项目契约迁入架构文档
现象:AGENTS.md 里 5 处规则互相打架——逐次询问 vs 认领/提交/升版本;不构建 vs 前端必须 build;全部提交 vs 禁 add -A;每次提交 bump 版本号,而实际 24 次提交版本仍是 0.0.8。 docs/agent_board.md 没有 Agent 列,认领规则无法落地;docs/agent_workflow.md 是 0 字节; docs/todo.md 与 docs/progress/todo.md 双账本漂移,旧文件还写 platforms/gdgxk.py。 根因:规则按「想防的事」逐条追加,没有回头消解冲突;项目契约和 Agent 行为混在同一个入口文件里。 边界: - AGENTS.md 只留行为规则;日志 / 目录 / 插件契约指向 docs/architecture.md(两节内容已并入,未丢失) - 版本号改为只在发版提交时 bump,普通提交不动 - 看板改四列表头,状态带时间戳「进行中 (MM-DD HH:mm)」,超 24h 可接管 - 删除 docs/todo.md;其中 2 条仍未修的代码问题已迁入 docs/progress/todo.md,待办按 待做 / 已知偏差 / 未验证 重排 - 不改代码、不改版本号、不打 tag 运行了什么:git status 自查(只提交这 6 个文档文件,uv.lock 是原有改动未提交);提交时 pre-commit 跑 ruff / web typecheck / commitizen 没跑什么:没跑测试、没构建、没跑 pnpm build(本次无代码改动)
This commit is contained in:
+10
-3
@@ -73,6 +73,8 @@ script/reference/ 不参与运行的参考脚本:dgjy-toolkit.user.js
|
||||
|
||||
依赖方向单向:接口 → 领域 → 基础设施。基础设施不反向 import 接口。
|
||||
|
||||
新代码的 import 一律显式(如 `from study_tool.config import JSPX`),不要再新增 `from xxx import *`;历史遗留的 star import 只保留在拆分前就存在的模块里。
|
||||
|
||||
`engine.py` 与 `routes/*` 只用 `registry.get(...)` 取平台实现,不 import 具体平台模块;
|
||||
平台实现之间只有同平台不同代际会互相 import(`course.py` → `spa.py`),依赖保持单向,避免成环。
|
||||
|
||||
@@ -212,8 +214,10 @@ from study_tool.platforms import registry
|
||||
class Channel: # notify.Channel
|
||||
id = ""
|
||||
label = ""
|
||||
|
||||
def send(self, title, content, context=None): ... # 失败抛异常
|
||||
|
||||
|
||||
NOTIFY = notify.register(DaidaiPush()) # 插件 main.py 末尾注册
|
||||
```
|
||||
|
||||
@@ -245,6 +249,9 @@ NOTIFY = notify.register(DaidaiPush()) # 插件 main.py 末尾注册
|
||||
|
||||
## 日志
|
||||
|
||||
统一入口 `runtime.log(key, msg, level="info")`,一次写三处:控制台、内存
|
||||
(`/api/log` 给前端轮询)、SQLite(`/api/log/history`)。key 用账号 id 或 `system`。
|
||||
规范见 `AGENTS.md` 的「日志规范」,不要自己 `print()`。
|
||||
所有日志只走 `runtime.log(key, msg, level="info")`:它统一写控制台、内存(`/api/log`)和 SQLite(`/api/log/history`),三处内容必须一致。
|
||||
|
||||
- 禁止在新代码里自己 `print()` 写业务日志,也不要直接调 `store.run_log_add()`;模块只负责组织 `msg`。
|
||||
- key 约定:账号相关用账号 id(页面卡片「课程日志」直接显示);全局 / 系统事件用 `"system"`(右上角「系统日志」弹窗显示)。
|
||||
- 时间戳、级别、格式都由 `runtime.log` 统一拼(`时间 [级别] 内容`),模块里不要自己加时间前缀。
|
||||
- 前端读日志统一用 `/api/log?key=&since=`(实时)+ `/api/log/history?key=&tail=`(历史兜底),不要另起一套日志接口。
|
||||
|
||||
Reference in New Issue
Block a user