Files
hose-use/CLAUDE.md
T
gitea 3c4ad6256a feat: 完善认证机制并实现 agent list
- 认证方式从 Cookie 改为 accesstoken+corpid+staffid Header(基于真实请求分析)
- agent list 基于真实 API 响应结构完善(data.items, state/mode 字段)
- 新增 CLAUDE.md:项目上下文、认证说明、已知 API 文档
- 补充 README.md:安装和使用说明
2026-04-06 00:06:02 +08:00

76 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ekb-cli 项目上下文(CLAUDE.md)
## 项目目标
为快报(ekuaibao)企业费控 SaaS 开发命令行工具,替代图形界面完成智能审核等配置操作。
## 目标网站
- 地址:`https://app.ekuaibao.com/web/app.html`
- 当前调试企业 corpId:`ID01ofWoOC1wiX`
- 当前页面:`#/ai-agents`(智能伙伴 / 智能审核)
## 认证机制
快报 API 使用自定义 Header 认证(**不是** Cookie),三个字段必须同时携带:
| Header | 示例值 | 说明 |
|---|---|---|
| `accesstoken` | `rbvOhATmi9zoXbWDuDwcQw` | 登录 token |
| `corpid` | `ID01ofWoOC1wiX` | 企业 ID |
| `staffid` | `ID01ofWoOC1wiX:ID01KsDgHaH5nN` | 员工 ID(格式:corpId:staffId) |
**获取方式**:登录快报 → F12 → 任意 API 请求 → 复制请求头中这三个字段。
认证信息存储在 `~/.config/ekb-cli/config.json`,支持多企业切换。
## 项目结构
```
src/ekb_cli/
├── __init__.py # 主入口,注册子命令
├── config.py # 多企业配置存储(~/.config/ekb-cli/config.json)
├── api.py # EkbClient HTTP 基类,自动附带认证 Header
└── commands/
├── auth.py # ekb auth add/list/use/remove/whoami
└── agent.py # ekb agent list(智能审核 Agent)
```
## 已知 API
### 智能审核 Agent
```
GET /api/engine/hab/agent/list?page=1&size=1000&corpId=...
```
响应结构:
```json
{
"code": 200,
"data": {
"items": [
{
"id": "1978711116974841858",
"name": "华北-西瓜智能体",
"state": 0, // 0=启用, 1=禁用
"mode": 2, // 2=自动
"description": "",
"agreeTerms": "...",
"rejectTerms": "...",
"exemptTerms": "...",
"reviewTerms": "...",
"agentFlowRelations": [],
"createTime": "2025-10-16 14:34:28",
"updateTime": "2025-10-16 14:34:33"
}
],
"totalItems": 1
}
}
```
## 开发环境
- Python 3.12,uv 管理
- 依赖:typer(CLI)、httpx(HTTP)、rich(终端输出)
- 运行:`uv run ekb <command>`
## 工作规范
- 每完成一个功能模块就 commit 一次,不攒着提交
- 每新增命令或 API,同步更新本文件的「已知 API」部分
- 每个命令文件顶部保持 docstring 说明用途