rush-ai 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/chunk-7H2T3KCJ.js +870 -0
- package/dist/chunk-7H2T3KCJ.js.map +1 -0
- package/dist/chunk-ISJJIX7U.js +148 -0
- package/dist/chunk-ISJJIX7U.js.map +1 -0
- package/dist/client-2GSYT7IS.js +10 -0
- package/dist/client-2GSYT7IS.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3496 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-assets/SKILL.md +89 -0
- package/dist/plugin-assets/commands/commands.test.ts +140 -0
- package/dist/plugin-assets/commands/rush-agent.md +18 -0
- package/dist/plugin-assets/commands/rush-files.md +19 -0
- package/dist/plugin-assets/commands/rush-task.md +15 -0
- package/dist/plugin-assets/rules/rush-agent.md +24 -0
- package/dist/server-PVZOTJZA.js +499 -0
- package/dist/server-PVZOTJZA.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kanyun Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# rush-ai
|
|
2
|
+
|
|
3
|
+
Rush CLI — Command-line interface for the Rush AI platform.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm --filter rush-ai build
|
|
9
|
+
pnpm --filter rush-ai test
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Testing Strategy
|
|
13
|
+
|
|
14
|
+
rush-ai 采用三层测试策略,在不同阶段用最合适的方式验证代码正确性。
|
|
15
|
+
|
|
16
|
+
### L1: 单元测试(本地,秒级反馈)
|
|
17
|
+
|
|
18
|
+
验证 CLI 自身逻辑,完全不依赖外部服务。
|
|
19
|
+
|
|
20
|
+
**覆盖范围:**
|
|
21
|
+
|
|
22
|
+
- 命令解析(commander 参数、flag、子命令路由)
|
|
23
|
+
- 输出格式化(table / `--json` / `--stream`)
|
|
24
|
+
- 配置管理(`~/.rush/` 读写、token 存取)
|
|
25
|
+
- 错误处理(未认证提示、网络错误、API 错误码映射)
|
|
26
|
+
- stdin 管道输入解析
|
|
27
|
+
|
|
28
|
+
**技术方案:** vitest,mock HTTP 层(`lib/client.ts`),不启动任何服务。
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm --filter rush-ai test
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### L2: 本地联调测试(本地,秒级反馈)
|
|
35
|
+
|
|
36
|
+
CLI 对本地运行的 Agent 服务做真实调用,验证请求/响应链路。
|
|
37
|
+
|
|
38
|
+
**前置条件:**
|
|
39
|
+
|
|
40
|
+
- `pnpm dev:agent` 运行在 `localhost:4000`(需 `.env.local` 配好凭证)
|
|
41
|
+
- 或 `pnpm dev` 同时启动 web + agent
|
|
42
|
+
|
|
43
|
+
**覆盖范围:**
|
|
44
|
+
|
|
45
|
+
- auth 认证流程
|
|
46
|
+
- `agent list` / `agent info` 真实返回
|
|
47
|
+
- `task run` 端到端执行(CLI → API → LLM → 结果)
|
|
48
|
+
- `task create` + `task status` + `task result` 异步链路
|
|
49
|
+
- SSE 流式输出(`task watch`)
|
|
50
|
+
|
|
51
|
+
**技术方案:** vitest e2e 配置,测试前检查 `localhost` health,不可用则 skip。
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 需要先启动 agent
|
|
55
|
+
pnpm dev:agent &
|
|
56
|
+
|
|
57
|
+
pnpm --filter rush-ai test:e2e
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### L3: 冒烟测试(CI / 手动,分钟级)
|
|
61
|
+
|
|
62
|
+
对真实环境做最终确认,验证完整 CLI 链路:`auth → agent list → task run → task result → task files → task list`。
|
|
63
|
+
|
|
64
|
+
**触发时机:**
|
|
65
|
+
|
|
66
|
+
- PR 合入后,CI 构建部署完成
|
|
67
|
+
- 手动触发,指定目标环境
|
|
68
|
+
|
|
69
|
+
**覆盖范围:**
|
|
70
|
+
|
|
71
|
+
- 核心 happy path 全链路验证
|
|
72
|
+
- 网络 / 鉴权 / 代理等环境相关的集成验证
|
|
73
|
+
- production build 模式下的 API 行为
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
RUSH_API_BASE_URL=https://rush-test.zhenguanyu.com \
|
|
77
|
+
RUSH_AUTH_TOKEN=$CI_TEST_TOKEN \
|
|
78
|
+
pnpm --filter rush-ai test:smoke
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Scripts
|
|
82
|
+
|
|
83
|
+
| Script | Description |
|
|
84
|
+
|--------|-------------|
|
|
85
|
+
| `test` | L1 单元测试 |
|
|
86
|
+
| `test:e2e` | L2 本地联调测试 |
|
|
87
|
+
| `test:smoke` | L3 冒烟测试 |
|
|
88
|
+
| `test:all` | L1 + L2 |
|
|
89
|
+
| `test:watch` | 单元测试 watch 模式 |
|
|
90
|
+
| `typecheck` | TypeScript 类型检查 |
|
|
91
|
+
| `build` | 构建 |
|
|
92
|
+
|
|
93
|
+
## Environment Variables
|
|
94
|
+
|
|
95
|
+
| Variable | Description | Default |
|
|
96
|
+
|----------|-------------|---------|
|
|
97
|
+
| `RUSH_API_BASE_URL` | API 目标地址 | `http://localhost:3000` |
|
|
98
|
+
| `RUSH_AUTH_TOKEN` | 认证 token(跳过 CAS 交互登录) | — |
|
|
99
|
+
| `RUSH_TEST_AGENT` | E2E 测试用的 Agent 名称 | `rush` |
|
|
100
|
+
|
|
101
|
+
## Development Verification Flow
|
|
102
|
+
|
|
103
|
+
每完成一个命令实现:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pnpm --filter rush-ai typecheck # 类型检查
|
|
107
|
+
pnpm --filter rush-ai test # L1 单元测试
|
|
108
|
+
pnpm --filter rush-ai build # 确保能构建
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
涉及 API 交互改动时(需先启动 dev:agent):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pnpm --filter rush-ai test:e2e # L2 本地联调
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
PR 合入后(CI 自动或手动):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pnpm --filter rush-ai test:smoke # L3 部署冒烟
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Project Structure
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
packages/rush-ai/
|
|
127
|
+
├── src/
|
|
128
|
+
│ ├── commands/ # CLI commands (agent, auth, mcp, plugin, task)
|
|
129
|
+
│ ├── e2e/ # E2E & smoke test files
|
|
130
|
+
│ ├── output/ # Output formatting (table, json, stream)
|
|
131
|
+
│ └── util/ # Shared utilities (client, config, auth, errors)
|
|
132
|
+
├── vitest.config.ts # L1 unit test config
|
|
133
|
+
├── vitest.e2e.config.ts # L2 e2e test config
|
|
134
|
+
├── vitest.smoke.config.ts # L3 smoke test config
|
|
135
|
+
└── package.json
|
|
136
|
+
```
|