fix: 修复6个bug并接入CodeStable工作流

Bug修复:
- GetWorkList 使用了错误的 RecordType (RecordStudy→RecordWork)
- AllRecord handler 返回错误的分页信息 (page硬编码1, pageSize用RecordsCount)
- CourseParse creditNode nil panic (加nil检查)
- WebSocket CheckOrigin 安全漏洞 (release模式限制为同源)
- math/rand 可预测 (替换为 crypto/rand)
- GetDiscussList 未实现 (补全实现, 移除重复路由)

其他:
- 接入 CodeStable 工作流体系 (codestable/ 骨架 + AGENTS.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 19:55:57 +08:00
parent 83ee4bb5ea
commit 2a6732ffe7
23 changed files with 1561 additions and 23 deletions

26
AGENTS.md Normal file
View File

@@ -0,0 +1,26 @@
# AGENTS.md
本文件是 AI 协作的项目级硬约束入口。所有 CodeStable 子工作流默认遵守本文件的所有规则。
## 代码规范
- Go 语言项目,遵循标准 Go 项目布局cmd / internal / pkg
- 使用 Taskfile 管理构建流程,不直接调用 go build
- 前端代码在 web/frontend/ 下,通过 git submodule 管理
- API 路由定义在 internal/router/handler 在 internal/handler/
## 禁止事项
- 不要修改 go.mod / go.sum 中的依赖,除非明确要求
- 不要直接修改 web/frontend/ 下的前端代码(它是 submodule
- 不要跳过 Taskfile 直接运行构建命令
## 已知坑
- 前端 submodule 需要用 `task fe:sync` 同步,不能只 git pull
- 调试功能需要手动开启,环境变量 CKWK_DEBUG_ENABLED=true 可默认开启
- 代理和跳过 SSL 校验只在设置页开启调试后才生效
## UI 验证要求
- 涉及前端视觉/交互的改动,必须在浏览器里人工验证