Files
hose-use/CLAUDE.md
T
gitea 1672d14d0b feat: add agent update command and ekb commands tree
- ekb agent update: patch-style update, only overrides provided fields
- ekb commands [group]: rich tree view of full command hierarchy
- api/agent.py: add save_agent()
- CLAUDE.md/README.md: simplify to layered structure
2026-04-06 00:37:20 +08:00

63 lines
2.1 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),三个字段:`accesstoken`、`corpid`、`staffid`。
**获取方式**:登录快报 → F12 → 任意 API 请求 → 复制请求头。
认证信息存储在 `~/.config/ekb-cli/config.json`,支持多企业切换。
## 项目结构
```
src/ekb_cli/
├── api/ # API 调用封装,每个业务域一个文件
└── commands/ # CLI 命令,按业务域分子目录
├── auth.py # ekb auth
└── agent/ # ekb agent(list / get / update / logs)
```
> 新增命令:在 commands/ 对应目录添加文件,注册到 __init__.py;同步在 api/ 添加封装函数。
## 枚举常量(Agent)
- **mode**:`0`=全自动,`1`=半自动(有 samplingRate 0-100),`2`=辅助
- **state**:`0`=启用,`1`=禁用
- **rule.level**:`"严重"` / `"一般"`
## 已知 API 路径
```
GET/POST /api/engine/hab/agent/list
GET/POST /api/engine/hab/agent/detail
POST /api/engine/hab/agent/save
GET /api/engine/hab/agent/rule/list
POST /api/engine/hab/agent/rule/save
```
> 详细请求/响应结构参考 api/agent.py 和 Chrome DevTools 网络请求记录。
## 开发环境
- Python 3.12,uv 管理;依赖:typer、httpx、rich
- 运行:`uv run ekb <command>`
## 工作规范
- 每完成一个功能模块就 commit 一次
- 新增命令/API 同步更新本文件的「已知 API 路径」部分
## 开发环境
- Python 3.12,uv 管理
- 依赖:typer(CLI)、httpx(HTTP)、rich(终端输出)
- 运行:`uv run ekb <command>`
## 工作规范
- 每完成一个功能模块就 commit 一次,不攒着提交
- 每新增命令或 API,同步更新本文件的「已知 API」部分
- 每个命令文件顶部保持 docstring 说明用途