refactor: 将项目上下文文件统一为 AGENTS.md
- 新增 AGENTS.md 作为主文件(原 CLAUDE.md 内容) - CLAUDE.md 改为软链接指向 AGENTS.md(供 Claude 识别) - 删除冗余的 Agent.md(无工具识别此命名) AGENTS.md 是 OpenCode 和 Cursor 的标准命名,CLAUDE.md 是 Claude 的标准命名, 通过软链接确保各工具都能正确读取项目上下文。
This commit is contained in:
1 parent
28568b80e1
commit
39122c83eb
3 files changed
+122
-123
No files matched your search
@@ -0,0 +1,121 @@
|
|||||||
|
# ekb-cli 项目上下文(CLAUDE.md)
|
||||||
|
|
||||||
|
本文件是根目录总纲,面向 AI 智能体说明项目目标、分层规则和文档索引。
|
||||||
|
子域细节不要继续堆在这里,优先引用下级文档。
|
||||||
|
|
||||||
|
## 文件定位
|
||||||
|
|
||||||
|
- 面向业务人员的使用说明:见 [README.md](./README.md)
|
||||||
|
- 面向智能体的根规则:以本文件为准
|
||||||
|
- 面向通用 Agent 的入口别名:见 [Agent.md](./Agent.md)
|
||||||
|
- 具体子域细节:进入对应目录下的 `README*.md`
|
||||||
|
|
||||||
|
## 项目目标
|
||||||
|
|
||||||
|
为快报(ekuaibao)企业费控 SaaS 提供一套命令行工具和 HTTP API Server:
|
||||||
|
|
||||||
|
- CLI:给人直接用
|
||||||
|
- Server:给脚本、服务或 AI Agent 结构化调用
|
||||||
|
|
||||||
|
目标站点:
|
||||||
|
|
||||||
|
- `https://app.ekuaibao.com/web/app.html`
|
||||||
|
|
||||||
|
## 认证机制
|
||||||
|
|
||||||
|
快报主站使用三 Header 认证,不依赖 Cookie:
|
||||||
|
|
||||||
|
- `accesstoken`
|
||||||
|
- `corpid`
|
||||||
|
- `staffid`
|
||||||
|
|
||||||
|
认证信息保存在:
|
||||||
|
|
||||||
|
- `~/.config/ekb-cli/config.json`
|
||||||
|
|
||||||
|
SealAI 子域使用独立 Bearer JWT,详细流程不要写在这里,见:
|
||||||
|
|
||||||
|
- [src/ekb_cli/commands/sealai/README.sealai.md](./src/ekb_cli/commands/sealai/README.sealai.md)
|
||||||
|
- [src/ekb_cli/services/sealai/README.sealai.md](./src/ekb_cli/services/sealai/README.sealai.md)
|
||||||
|
- [src/ekb_cli/api/sealai/README.sealai.md](./src/ekb_cli/api/sealai/README.sealai.md)
|
||||||
|
|
||||||
|
## 架构总览
|
||||||
|
|
||||||
|
```text
|
||||||
|
调用方
|
||||||
|
├── commands/ CLI 表现层
|
||||||
|
├── server/ HTTP 表现层
|
||||||
|
└── services/ 业务逻辑层
|
||||||
|
└── api/ 传输层
|
||||||
|
```
|
||||||
|
|
||||||
|
核心原则:
|
||||||
|
|
||||||
|
- `commands/` 和 `server/` 都是薄壳,只做 IO 适配
|
||||||
|
- 业务编排统一放在 `services/`
|
||||||
|
- `api/` 只负责 HTTP 请求和模型校验
|
||||||
|
- `errors.py` 负责统一异常语义
|
||||||
|
- `config.py` 负责本地认证配置读写
|
||||||
|
|
||||||
|
## 文档索引
|
||||||
|
|
||||||
|
根目录只保留总纲和入口,具体内容下钻到对应层级:
|
||||||
|
|
||||||
|
- 命令层总说明:[src/ekb_cli/commands/README.commands.md](./src/ekb_cli/commands/README.commands.md)
|
||||||
|
- 业务层总说明:[src/ekb_cli/services/README.services.md](./src/ekb_cli/services/README.services.md)
|
||||||
|
- Server 总说明:[src/ekb_cli/server/README.server.md](./src/ekb_cli/server/README.server.md)
|
||||||
|
- API 总说明:[src/ekb_cli/api/README.api.md](./src/ekb_cli/api/README.api.md)
|
||||||
|
|
||||||
|
常用子域入口:
|
||||||
|
|
||||||
|
- Agent 说明:[src/ekb_cli/commands/agent/README.agent.md](./src/ekb_cli/commands/agent/README.agent.md)
|
||||||
|
- Rule 说明:[src/ekb_cli/commands/agent/README.rule.md](./src/ekb_cli/commands/agent/README.rule.md)
|
||||||
|
- SealAI 命令说明:[src/ekb_cli/commands/sealai/README.sealai.md](./src/ekb_cli/commands/sealai/README.sealai.md)
|
||||||
|
|
||||||
|
## 开发与修改规则
|
||||||
|
|
||||||
|
新增或调整功能时,优先遵循下面这条链路:
|
||||||
|
|
||||||
|
1. 先明确 `services/` 的业务边界
|
||||||
|
2. 再实现 `api/` 或复用现有传输层
|
||||||
|
3. 再接入 `commands/` 和 `server/`
|
||||||
|
4. 最后更新对应层级文档,而不是把细节补到根目录
|
||||||
|
|
||||||
|
同步更新顺序:
|
||||||
|
|
||||||
|
1. `services/`
|
||||||
|
2. `commands/` 或 `server/`
|
||||||
|
3. 对应目录下的 `README*.md`
|
||||||
|
4. 只有在总纲真的变化时,才更新本文件
|
||||||
|
|
||||||
|
## 分层导入约束
|
||||||
|
|
||||||
|
以下导入关系严格禁止:
|
||||||
|
|
||||||
|
| 禁止方向 | 说明 |
|
||||||
|
|---|---|
|
||||||
|
| `commands/* -> api/*` | CLI 表现层不得直接调用传输层 |
|
||||||
|
| `server/* -> api/*`(业务函数) | HTTP 路由不得直接调用 API 域函数 |
|
||||||
|
|
||||||
|
正确路径:
|
||||||
|
|
||||||
|
- `commands/* -> services/* -> api/*`
|
||||||
|
- `server/* -> services/* -> api/*`
|
||||||
|
|
||||||
|
例外:
|
||||||
|
|
||||||
|
- `server/deps.py` 可以作为基础设施层使用 `api.get_client`
|
||||||
|
|
||||||
|
## 异常规则
|
||||||
|
|
||||||
|
- `services/` 层只抛 `EkbError` 子类
|
||||||
|
- CLI 入口统一负责终端错误输出
|
||||||
|
- Server 入口统一负责 HTTP 状态码映射
|
||||||
|
- 路由和命令文件里不要重复做局部异常体系
|
||||||
|
|
||||||
|
## 文档规则
|
||||||
|
|
||||||
|
- 根目录文档只保留入口信息和引用关系
|
||||||
|
- 目录细节写进对应目录的 `README.{dirname}.md`
|
||||||
|
- 文件细节写进对应文件旁的说明文档
|
||||||
|
- 子域的 API 路径、枚举值、字段语义不要继续回填到根目录
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
本项目的智能体工作规范统一参考 [CLAUDE.md](./CLAUDE.md)。
|
|
||||||
如果 `Agent.md` 与 `CLAUDE.md` 存在差异,一律以 `CLAUDE.md` 为准。
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
# ekb-cli 项目上下文(CLAUDE.md)
|
|
||||||
|
|
||||||
本文件是根目录总纲,面向 AI 智能体说明项目目标、分层规则和文档索引。
|
|
||||||
子域细节不要继续堆在这里,优先引用下级文档。
|
|
||||||
|
|
||||||
## 文件定位
|
|
||||||
|
|
||||||
- 面向业务人员的使用说明:见 [README.md](./README.md)
|
|
||||||
- 面向智能体的根规则:以本文件为准
|
|
||||||
- 面向通用 Agent 的入口别名:见 [Agent.md](./Agent.md)
|
|
||||||
- 具体子域细节:进入对应目录下的 `README*.md`
|
|
||||||
|
|
||||||
## 项目目标
|
|
||||||
|
|
||||||
为快报(ekuaibao)企业费控 SaaS 提供一套命令行工具和 HTTP API Server:
|
|
||||||
|
|
||||||
- CLI:给人直接用
|
|
||||||
- Server:给脚本、服务或 AI Agent 结构化调用
|
|
||||||
|
|
||||||
目标站点:
|
|
||||||
|
|
||||||
- `https://app.ekuaibao.com/web/app.html`
|
|
||||||
|
|
||||||
## 认证机制
|
|
||||||
|
|
||||||
快报主站使用三 Header 认证,不依赖 Cookie:
|
|
||||||
|
|
||||||
- `accesstoken`
|
|
||||||
- `corpid`
|
|
||||||
- `staffid`
|
|
||||||
|
|
||||||
认证信息保存在:
|
|
||||||
|
|
||||||
- `~/.config/ekb-cli/config.json`
|
|
||||||
|
|
||||||
SealAI 子域使用独立 Bearer JWT,详细流程不要写在这里,见:
|
|
||||||
|
|
||||||
- [src/ekb_cli/commands/sealai/README.sealai.md](./src/ekb_cli/commands/sealai/README.sealai.md)
|
|
||||||
- [src/ekb_cli/services/sealai/README.sealai.md](./src/ekb_cli/services/sealai/README.sealai.md)
|
|
||||||
- [src/ekb_cli/api/sealai/README.sealai.md](./src/ekb_cli/api/sealai/README.sealai.md)
|
|
||||||
|
|
||||||
## 架构总览
|
|
||||||
|
|
||||||
```text
|
|
||||||
调用方
|
|
||||||
├── commands/ CLI 表现层
|
|
||||||
├── server/ HTTP 表现层
|
|
||||||
└── services/ 业务逻辑层
|
|
||||||
└── api/ 传输层
|
|
||||||
```
|
|
||||||
|
|
||||||
核心原则:
|
|
||||||
|
|
||||||
- `commands/` 和 `server/` 都是薄壳,只做 IO 适配
|
|
||||||
- 业务编排统一放在 `services/`
|
|
||||||
- `api/` 只负责 HTTP 请求和模型校验
|
|
||||||
- `errors.py` 负责统一异常语义
|
|
||||||
- `config.py` 负责本地认证配置读写
|
|
||||||
|
|
||||||
## 文档索引
|
|
||||||
|
|
||||||
根目录只保留总纲和入口,具体内容下钻到对应层级:
|
|
||||||
|
|
||||||
- 命令层总说明:[src/ekb_cli/commands/README.commands.md](./src/ekb_cli/commands/README.commands.md)
|
|
||||||
- 业务层总说明:[src/ekb_cli/services/README.services.md](./src/ekb_cli/services/README.services.md)
|
|
||||||
- Server 总说明:[src/ekb_cli/server/README.server.md](./src/ekb_cli/server/README.server.md)
|
|
||||||
- API 总说明:[src/ekb_cli/api/README.api.md](./src/ekb_cli/api/README.api.md)
|
|
||||||
|
|
||||||
常用子域入口:
|
|
||||||
|
|
||||||
- Agent 说明:[src/ekb_cli/commands/agent/README.agent.md](./src/ekb_cli/commands/agent/README.agent.md)
|
|
||||||
- Rule 说明:[src/ekb_cli/commands/agent/README.rule.md](./src/ekb_cli/commands/agent/README.rule.md)
|
|
||||||
- SealAI 命令说明:[src/ekb_cli/commands/sealai/README.sealai.md](./src/ekb_cli/commands/sealai/README.sealai.md)
|
|
||||||
|
|
||||||
## 开发与修改规则
|
|
||||||
|
|
||||||
新增或调整功能时,优先遵循下面这条链路:
|
|
||||||
|
|
||||||
1. 先明确 `services/` 的业务边界
|
|
||||||
2. 再实现 `api/` 或复用现有传输层
|
|
||||||
3. 再接入 `commands/` 和 `server/`
|
|
||||||
4. 最后更新对应层级文档,而不是把细节补到根目录
|
|
||||||
|
|
||||||
同步更新顺序:
|
|
||||||
|
|
||||||
1. `services/`
|
|
||||||
2. `commands/` 或 `server/`
|
|
||||||
3. 对应目录下的 `README*.md`
|
|
||||||
4. 只有在总纲真的变化时,才更新本文件
|
|
||||||
|
|
||||||
## 分层导入约束
|
|
||||||
|
|
||||||
以下导入关系严格禁止:
|
|
||||||
|
|
||||||
| 禁止方向 | 说明 |
|
|
||||||
|---|---|
|
|
||||||
| `commands/* -> api/*` | CLI 表现层不得直接调用传输层 |
|
|
||||||
| `server/* -> api/*`(业务函数) | HTTP 路由不得直接调用 API 域函数 |
|
|
||||||
|
|
||||||
正确路径:
|
|
||||||
|
|
||||||
- `commands/* -> services/* -> api/*`
|
|
||||||
- `server/* -> services/* -> api/*`
|
|
||||||
|
|
||||||
例外:
|
|
||||||
|
|
||||||
- `server/deps.py` 可以作为基础设施层使用 `api.get_client`
|
|
||||||
|
|
||||||
## 异常规则
|
|
||||||
|
|
||||||
- `services/` 层只抛 `EkbError` 子类
|
|
||||||
- CLI 入口统一负责终端错误输出
|
|
||||||
- Server 入口统一负责 HTTP 状态码映射
|
|
||||||
- 路由和命令文件里不要重复做局部异常体系
|
|
||||||
|
|
||||||
## 文档规则
|
|
||||||
|
|
||||||
- 根目录文档只保留入口信息和引用关系
|
|
||||||
- 目录细节写进对应目录的 `README.{dirname}.md`
|
|
||||||
- 文件细节写进对应文件旁的说明文档
|
|
||||||
- 子域的 API 路径、枚举值、字段语义不要继续回填到根目录
|
|
||||||
Reference in new issue
Block a user