rush-ai 0.6.0 → 0.7.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/AGENTS.md +37 -0
- package/dist/index.js +222 -43
- package/dist/index.js.map +1 -1
- package/dist/plugin-assets/SKILL.md +66 -59
- package/dist/skills/README.md +48 -0
- package/dist/skills/agent-shelf.md +102 -0
- package/dist/skills/hand-off.md +163 -0
- package/package.json +3 -1
- package/skills/README.md +48 -0
- package/skills/agent-shelf.md +102 -0
- package/skills/hand-off.md +163 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rush-task
|
|
3
|
-
description: "
|
|
4
|
-
version: 0.
|
|
3
|
+
description: "Create and track tasks on the Rush platform from an IDE (Cursor, Claude Code, etc). Use this when the user wants a Rush agent to build / generate / analyze something — hand off the context you already have, then watch it run."
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
author: kanyun
|
|
6
6
|
tags:
|
|
7
7
|
- rush
|
|
@@ -10,80 +10,87 @@ tags:
|
|
|
10
10
|
argument-hint: <prompt>
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
# Rush Task —
|
|
13
|
+
# Rush Task — hand off work to a Rush agent
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Use this skill when the user is talking to you and the next step belongs on the Rush platform. You already have full context from the conversation; don't make them restate it.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Primary path: `rush-ai` CLI
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
- MCP server "rush" 已连接(tools 列表中有 `rush_*` 开头的工具)
|
|
21
|
-
- 如果 MCP 工具不可用,提示用户运行 `rush-ai plugin doctor` 诊断问题
|
|
19
|
+
The CLI is the primary interface — it works in any shell, needs no per-IDE setup, and is always in sync with the platform.
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
### Prerequisites
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
- `rush-ai` is on PATH, or you can run it via `npx rush-ai`. If neither is true, ask the user to install with `npm i -g rush-ai` (or just use `npx`).
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
### Canonical flow
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
```bash
|
|
28
|
+
# 1. Confirm auth — this MUST be the first step.
|
|
29
|
+
npx rush-ai auth status --json
|
|
30
|
+
# If the response says not authenticated: STOP. Print to the user:
|
|
31
|
+
# "Rush 还没登录。请在终端里跑 `npx rush-ai auth login`(会打开浏览器),登录成功后告诉我一声。"
|
|
32
|
+
# Do NOT run auth login yourself — it needs a browser / CAS.
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
# 2. (Optional) Browse the agent shelf. Start narrow, widen only if needed.
|
|
35
|
+
npx rush-ai agent list --default --json # just the built-in defaults
|
|
36
|
+
npx rush-ai agent list --search "人力" --json # fuzzy-filter by name / desc
|
|
37
|
+
npx rush-ai agent list --all --json # full catalog (can be long)
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
- 如果没有可用 Agent,告知用户当前无可用 Agent,建议联系管理员配置
|
|
39
|
+
# 3. Create the task. Use --json whenever you need to parse the result.
|
|
40
|
+
npx rush-ai task create -a <agent> -p "<prompt synthesized from context>" --json
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
# 4. Poll status until it reaches a terminal state
|
|
43
|
+
# (completed / failed / cancelled). Poll every ~15–30s.
|
|
44
|
+
npx rush-ai task status <id> --json
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
# 5. Iterate on the same task — don't create a new one for tweaks.
|
|
47
|
+
npx rush-ai task send <id> -p "<follow-up>" --json
|
|
42
48
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
# 6. If the user wants live output, stream instead of polling.
|
|
50
|
+
npx rush-ai task watch <id>
|
|
51
|
+
```
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
1. 调用 `rush_task_create` 创建异步任务
|
|
49
|
-
2. 调用 `rush_task_watch` 跟踪进度(默认超时 5 分钟)
|
|
50
|
-
3. 向用户实时展示进度信息
|
|
51
|
-
- 适用场景:用户要求"生成"、"创建"、"分析"、"重构"
|
|
53
|
+
### Which agent to pass to `-a`?
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
55
|
+
| Situation | Agent |
|
|
56
|
+
|---|---|
|
|
57
|
+
| The user wants a live website / landing page / marketing page — anything that ends with a shareable preview URL | `web-builder` (returns `previewUrl` + `gitRepoUrl` on completion) |
|
|
58
|
+
| General-purpose task (chat, analysis, generation) | `rush` (the platform default) |
|
|
59
|
+
| The user explicitly named a specialist agent | that agent's name verbatim (confirm with `agent list --search`) |
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
When in doubt, run `agent list --all --json` and pick by name / description. Never invent an agent name.
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
- 如果任务失败,展示错误信息并建议:
|
|
62
|
-
- 修改 prompt 重试
|
|
63
|
-
- 检查 Agent 是否支持该类型任务
|
|
64
|
-
- 如果有输出文件,调用 `rush_task_files` 列出并展示:
|
|
65
|
-
- 代码文件(code):展示文件路径和内容摘要
|
|
66
|
-
- 图片文件(image):展示 URL 供用户查看
|
|
67
|
-
- 文档文件(document):展示内容
|
|
63
|
+
### What to give the user
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
- One-liner confirmation right after `task create`: task id + "running on Rush, I'll watch it".
|
|
66
|
+
- When `task status` returns `completed`:
|
|
67
|
+
- For `web-builder`: present `previewUrl` (primary) and `gitRepoUrl`.
|
|
68
|
+
- For other agents: present `result`.
|
|
69
|
+
- If `status == failed`: surface `error` verbatim, ask whether to retry via `task send` or abort. Do not silently retry.
|
|
70
70
|
|
|
71
|
-
-
|
|
72
|
-
- 继续操作时创建新任务,在 prompt 中引用之前的 task_id 提供上下文
|
|
73
|
-
- 用户可以随时用 `rush_task_cancel` 取消运行中的任务
|
|
74
|
-
- 用 `rush_task_list` 查看历史任务
|
|
71
|
+
### Anti-patterns (don't do these)
|
|
75
72
|
|
|
76
|
-
|
|
73
|
+
- ❌ Re-prompting the user for requirements they already stated in-thread.
|
|
74
|
+
- ❌ Creating a new task for every tweak — always prefer `task send <id>`.
|
|
75
|
+
- ❌ Running `auth login` yourself (it needs a browser).
|
|
76
|
+
- ❌ Ignoring `--json` when you need to parse the result — the table view is for humans.
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
|
85
|
-
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
78
|
+
For the complete playbook, run `npx rush-ai skill hand-off`. For sub-agent / workflow composition, run `npx rush-ai skill agent-shelf`.
|
|
79
|
+
|
|
80
|
+
## Optional path: MCP tools
|
|
81
|
+
|
|
82
|
+
If the Rush MCP server is installed and the IDE exposes its tools (`rush_task_create`, `rush_task_status`, ...), you can use them instead of shelling out. The MCP path is functionally equivalent to the CLI path; use whichever is available. Mapping:
|
|
83
|
+
|
|
84
|
+
| CLI command | MCP tool |
|
|
85
|
+
|-------------|----------|
|
|
86
|
+
| `rush-ai agent list` | `rush_agent_list` |
|
|
87
|
+
| `rush-ai agent info <name>` | `rush_agent_info` |
|
|
88
|
+
| `rush-ai task create` | `rush_task_create` (async) / `rush_task_run` (short/sync) |
|
|
89
|
+
| `rush-ai task status <id>` | `rush_task_status` |
|
|
90
|
+
| `rush-ai task result <id>` | `rush_task_result` |
|
|
91
|
+
| `rush-ai task watch <id>` | `rush_task_watch` |
|
|
92
|
+
| `rush-ai task list` | `rush_task_list` |
|
|
93
|
+
| `rush-ai task files <id>` | `rush_task_files` |
|
|
94
|
+
| `rush-ai task cancel <id>` | `rush_task_cancel` |
|
|
95
|
+
|
|
96
|
+
If MCP tools aren't present — the common case — **just use the CLI**. Don't wait on MCP; don't try to configure it mid-conversation.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Rush-ai skills for AI agents
|
|
2
|
+
|
|
3
|
+
`rush-ai` is a CLI for the Rush platform. If you are an AI agent (Cursor, Claude Code, a local sub-agent) reading this, these guides tell you when and how to invoke `rush-ai` on behalf of the user.
|
|
4
|
+
|
|
5
|
+
## When to use rush-ai
|
|
6
|
+
|
|
7
|
+
Pick the guide that matches the situation:
|
|
8
|
+
|
|
9
|
+
- **You are in the middle of a conversation with the user (inside an IDE) and part of the work belongs on Rush.**
|
|
10
|
+
→ Read [`hand-off.md`](./hand-off.md). Typical trigger: "build me a landing page", "turn this sketch into a site", "generate the docs site".
|
|
11
|
+
|
|
12
|
+
- **You are composing a workflow and need a specialist agent as one of the steps.**
|
|
13
|
+
→ Read [`agent-shelf.md`](./agent-shelf.md). Typical trigger: a workflow node that needs domain expertise you don't have (HR analytics, observability Q&A, physics reasoning, etc).
|
|
14
|
+
|
|
15
|
+
Still unsure? Run `npx rush-ai agent list` first — seeing the available agents usually makes the decision obvious.
|
|
16
|
+
|
|
17
|
+
## Cheat sheet
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Discover
|
|
21
|
+
npx rush-ai agent list --default # just the built-in defaults (web-builder, rush, skill-publisher, ...)
|
|
22
|
+
npx rush-ai agent list --search "人力" # fuzzy-filter the full shelf
|
|
23
|
+
npx rush-ai agent list --all # everything (can be long)
|
|
24
|
+
npx rush-ai agent info <agent> # inspect one agent's skills / MCP servers
|
|
25
|
+
|
|
26
|
+
# Hand off
|
|
27
|
+
npx rush-ai task create -a <agent> -p "<prompt>" # create a task
|
|
28
|
+
npx rush-ai task status <task-id> # check status (includes preview / git URLs when ready)
|
|
29
|
+
npx rush-ai task send <task-id> -p "<follow-up>" # iterate on a running task
|
|
30
|
+
npx rush-ai task watch <task-id> # stream execution (SSE)
|
|
31
|
+
|
|
32
|
+
# Defaults
|
|
33
|
+
-a rush # general-purpose agent; this is the CLI default, so `-a` can be omitted when you want `rush`
|
|
34
|
+
-a web-builder # site/landing-page builder; returns previewUrl + gitRepoUrl
|
|
35
|
+
-a <other> # any other agent name from `agent list` — confirm it exists first
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`--json` on any command gives machine-readable output; use it when you need to parse the result.
|
|
39
|
+
|
|
40
|
+
## Prerequisites the agent should enforce
|
|
41
|
+
|
|
42
|
+
Before creating a task, make sure the user is authenticated:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx rush-ai auth status
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If not authenticated, tell the user to run `npx rush-ai auth login` in their terminal (the command is interactive and requires a browser — you cannot complete it on their behalf).
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Skill: Call a Rush agent as your sub-agent
|
|
2
|
+
|
|
3
|
+
Use this skill when you are composing a workflow — your own, or one the user described — and a step calls for domain expertise you don't have. Rush hosts a shelf of specialist agents. You can invoke any of them with one `rush-ai task create` call and feed the result back into your workflow.
|
|
4
|
+
|
|
5
|
+
## When this skill applies
|
|
6
|
+
|
|
7
|
+
Triggers:
|
|
8
|
+
|
|
9
|
+
- The user's instructions name a specialist by role ("use the HR analytics expert", "ask the physics reasoning agent", "let the observability agent check it").
|
|
10
|
+
- You're drafting a multi-step plan and one node is outside your competence (e.g. "analyze RUM data", "write a physics problem set", "summarize an HR report").
|
|
11
|
+
- The user asks "what can Rush do that I can't?" — that's a prompt to show the shelf.
|
|
12
|
+
|
|
13
|
+
Do NOT use this skill when:
|
|
14
|
+
|
|
15
|
+
- The task fits the default general-purpose agent (`rush`) — that's a hand-off, not a sub-agent call. See `hand-off.md`.
|
|
16
|
+
- The task needs a live web artifact — use `web-builder` via `hand-off.md`.
|
|
17
|
+
|
|
18
|
+
## Playbook
|
|
19
|
+
|
|
20
|
+
### 1. Discover — don't guess
|
|
21
|
+
|
|
22
|
+
Always start by listing the shelf, unless the user already named a specific agent. Use the right scope for the question at hand:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Just the built-in defaults — useful when you're looking for the general fallback
|
|
26
|
+
npx rush-ai agent list --default --json
|
|
27
|
+
|
|
28
|
+
# Fuzzy-filter when the user hinted at a domain
|
|
29
|
+
npx rush-ai agent list --search "人力" --json
|
|
30
|
+
|
|
31
|
+
# Full catalog — use sparingly, can be hundreds of entries
|
|
32
|
+
npx rush-ai agent list --all --json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Pick the best match by name + description. If multiple are plausible, inspect one:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx rush-ai agent info <agent-name> --json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If nothing fits, tell the user what's available and ask how to proceed — don't force-fit a wrong agent.
|
|
42
|
+
|
|
43
|
+
### 2. Call it as a node in your workflow
|
|
44
|
+
|
|
45
|
+
Treat the agent call like a pure function: input prompt, output task result. Compose your own prompt with the context the agent needs (not the whole conversation — just the inputs for this step).
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx rush-ai task create -a <agent-name> \
|
|
49
|
+
-p "<focused prompt — inputs + expected output format>" \
|
|
50
|
+
--json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For a workflow node you need synchronously, poll:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx rush-ai task status <id> --json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
When `status == completed`, the response has the output. For agents that produce structured results, request `--json` and parse it.
|
|
60
|
+
|
|
61
|
+
### 3. Feed the result back into your workflow
|
|
62
|
+
|
|
63
|
+
The sub-agent's output is just another piece of context for the next step of your plan. Incorporate it into the next action the way you would any tool result.
|
|
64
|
+
|
|
65
|
+
If the output is unsatisfactory, either:
|
|
66
|
+
|
|
67
|
+
- refine via `task send <id> -p "<clarification>"` (same sub-agent, same context), or
|
|
68
|
+
- fall back to your plan B (try a different agent, or escalate to the user).
|
|
69
|
+
|
|
70
|
+
## Example
|
|
71
|
+
|
|
72
|
+
User: "帮我分析一下 Q1 的部门人效,然后根据结论写一段给 CEO 的周会汇报。"
|
|
73
|
+
|
|
74
|
+
Your plan:
|
|
75
|
+
|
|
76
|
+
1. Call a data-analysis sub-agent on Rush to do the number-crunching.
|
|
77
|
+
2. Use the analysis output to draft the exec-summary locally.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Step 1 — find the HR analytics specialist (--json returns { agents, pagination })
|
|
81
|
+
npx rush-ai agent list --search "人力" --json | jq '.agents[] | {name, description}'
|
|
82
|
+
# → matches "人力资源分析专家"
|
|
83
|
+
|
|
84
|
+
# Step 2 — call it as a sub-agent node
|
|
85
|
+
npx rush-ai task create -a 人力资源分析专家 \
|
|
86
|
+
-p "分析 Q1 各部门人效趋势,输出 3 条关键结论。" \
|
|
87
|
+
--json
|
|
88
|
+
# → {"id": "t_abc", "status": "pending"}
|
|
89
|
+
|
|
90
|
+
# Step 3 — wait for the node to finish
|
|
91
|
+
npx rush-ai task status t_abc --json
|
|
92
|
+
# → {"status": "completed", "result": "..."}
|
|
93
|
+
|
|
94
|
+
# Step 4 — you take the result and draft the exec summary locally.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Anti-patterns
|
|
98
|
+
|
|
99
|
+
- ❌ Inventing an agent name. If `agent list` doesn't show it, it doesn't exist — tell the user.
|
|
100
|
+
- ❌ Passing the entire original conversation as the sub-agent's prompt. Give it only the inputs it needs.
|
|
101
|
+
- ❌ Using `web-builder` for non-website work. It's specialized for producing deployable sites.
|
|
102
|
+
- ❌ Abandoning the workflow if the sub-agent call fails. Surface the error, offer a fallback.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Skill: Hand off the task to Rush
|
|
2
|
+
|
|
3
|
+
Use this skill when the user is talking to you inside an IDE (Cursor, Claude Code, or similar) and the next step belongs on the Rush platform. You already have full context from the conversation — `rush-ai` exists so you can relay that context to Rush's cloud agents without making the user summarize it again.
|
|
4
|
+
|
|
5
|
+
## When this skill applies
|
|
6
|
+
|
|
7
|
+
Triggers (not exhaustive — use judgement):
|
|
8
|
+
|
|
9
|
+
- "Build me a landing page / product site / marketing page."
|
|
10
|
+
- "Turn this spec / sketch / Figma link into a site."
|
|
11
|
+
- "Spin up a demo site for X."
|
|
12
|
+
- Any time the conversation points at producing a running web artifact the user will want to **share a link** for.
|
|
13
|
+
|
|
14
|
+
Do NOT use this skill for:
|
|
15
|
+
|
|
16
|
+
- Small local edits the user wants you to apply directly in the current repo.
|
|
17
|
+
- Questions about Rush itself ("what is rush-ai", "how do I log in") — answer those from docs instead of creating a task.
|
|
18
|
+
|
|
19
|
+
## Decision: which agent?
|
|
20
|
+
|
|
21
|
+
| Situation | Agent to pass to `-a` |
|
|
22
|
+
|---|---|
|
|
23
|
+
| Build a website, landing page, marketing page, or anything that should render as a live preview URL | `web-builder` |
|
|
24
|
+
| General-purpose conversation / analysis / generation the user would have asked a chat agent for | `rush` (the platform default) |
|
|
25
|
+
| User named a specific specialist agent (e.g. "use the HR analytics agent") | that agent name verbatim |
|
|
26
|
+
|
|
27
|
+
If you are unsure, start with `npx rush-ai agent list --default` — that shows just the built-in defaults (`web-builder`, `rush`, `skill-publisher`, ...), which is usually all you need for a hand-off. Widen with `--search <keyword>` or `--all` only when the user clearly asked for a specialist. When in doubt between `rush` and `web-builder`, ask the user — but if the output is going to be a URL, default to `web-builder`.
|
|
28
|
+
|
|
29
|
+
## Playbook
|
|
30
|
+
|
|
31
|
+
### 1. Verify auth (once per session)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx rush-ai auth status --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The response includes a boolean `authenticated` (or equivalent) plus an auth method. **Read it before you do anything else.** There are only two cases — no third case, no "maybe":
|
|
38
|
+
|
|
39
|
+
- **Authenticated** → proceed to step 2.
|
|
40
|
+
- **Not authenticated** → STOP. Print this exact message to the user and wait:
|
|
41
|
+
|
|
42
|
+
> Rush 还没登录。请在终端里跑 `npx rush-ai auth login`(会打开浏览器完成 CAS 登录),登录成功后告诉我一声。
|
|
43
|
+
|
|
44
|
+
Do NOT run `auth login` yourself — it opens a browser and waits for human interaction.
|
|
45
|
+
Do NOT invent workarounds (don't try API keys, don't edit `~/.rush/auth.json`).
|
|
46
|
+
Do NOT fall through to `task create` anyway — it will return 401 and confuse the user.
|
|
47
|
+
|
|
48
|
+
When the user returns, re-run `auth status --json` to confirm before continuing.
|
|
49
|
+
|
|
50
|
+
### 2. Create the task, carrying the context you already have
|
|
51
|
+
|
|
52
|
+
Write the prompt from the conversation. Do **not** ask the user to restate requirements you already know. Include any constraints they have already mentioned (brand, style, pages, copy).
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx rush-ai task create \
|
|
56
|
+
-a web-builder \
|
|
57
|
+
-p "<prompt synthesized from the conversation>" \
|
|
58
|
+
--json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The JSON response contains `id`. Keep it; you'll need it for every follow-up.
|
|
62
|
+
|
|
63
|
+
### 3. Report the handoff to the user
|
|
64
|
+
|
|
65
|
+
Tell the user, in one line:
|
|
66
|
+
|
|
67
|
+
- the task id
|
|
68
|
+
- that it's running on Rush
|
|
69
|
+
- how they can watch (either "I'll poll for you" or "open the Rush web UI")
|
|
70
|
+
|
|
71
|
+
Don't dump the full JSON unless they ask.
|
|
72
|
+
|
|
73
|
+
### 4. Poll status until ready
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx rush-ai task status <id> --json | jq -r '.status'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Terminal states: `completed`, `failed`, `cancelled`. Poll every ~15–30s; don't hammer it.
|
|
80
|
+
|
|
81
|
+
**Pipe directly** — don't round-trip the JSON through a shell variable:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# good — JSON stays as raw bytes, no shell re-interpretation
|
|
85
|
+
npx rush-ai task status <id> --json | jq -r '.status'
|
|
86
|
+
|
|
87
|
+
# bad — zsh's builtin `echo` re-interprets \n as a real newline;
|
|
88
|
+
# jq then rejects the result with "control characters must be escaped".
|
|
89
|
+
# (bash's echo usually doesn't, but behavior is shell-dependent.)
|
|
90
|
+
STATUS=$(npx rush-ai task status <id> --json)
|
|
91
|
+
echo "$STATUS" | jq . # ← breaks in zsh once the JSON contains \n
|
|
92
|
+
|
|
93
|
+
# acceptable alternatives when you really need the variable:
|
|
94
|
+
printf '%s' "$STATUS" | jq . # portable — printf never re-interprets escapes
|
|
95
|
+
jq . <<< "$STATUS" # here-string — does not re-interpret backslash escapes
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
When `status == completed`, the response contains (for `web-builder`):
|
|
99
|
+
|
|
100
|
+
- `previewUrl` — shareable live preview (e.g. `https://<id>-preview.rush.zhenguanyu.com/`)
|
|
101
|
+
- `gitRepoUrl` — cloneable repo (e.g. `https://gitlab-ee.zhenguanyu.com/rush/online/<id>`)
|
|
102
|
+
|
|
103
|
+
Present both to the user. The preview URL is the primary artifact they care about.
|
|
104
|
+
|
|
105
|
+
### 5. Iterate via `task send`, not by creating new tasks
|
|
106
|
+
|
|
107
|
+
If the user says "change the button color" / "add a testimonials section" / "make the hero bigger", **do not create a new task** — send a follow-up to the existing one:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx rush-ai task send <id> -p "<the change they asked for>" --json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The preview URL stays the same; it will refresh after the send completes. Poll `task status <id>` again.
|
|
114
|
+
|
|
115
|
+
Only create a fresh task if the user explicitly starts a new, unrelated project.
|
|
116
|
+
|
|
117
|
+
### 6. Failure handling
|
|
118
|
+
|
|
119
|
+
If `status == failed`, the response has an `error` field. Surface it to the user verbatim and ask whether to:
|
|
120
|
+
|
|
121
|
+
1. retry with a revised prompt via `task send`,
|
|
122
|
+
2. cancel and start over, or
|
|
123
|
+
3. dig in themselves (give them the task id so they can look it up).
|
|
124
|
+
|
|
125
|
+
Do not silently retry.
|
|
126
|
+
|
|
127
|
+
## Example end-to-end
|
|
128
|
+
|
|
129
|
+
User (in Cursor): "帮我做个公司官网首页,风格大气专业。"
|
|
130
|
+
|
|
131
|
+
Your actions:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# 1. check auth (assume ok)
|
|
135
|
+
npx rush-ai auth status --json
|
|
136
|
+
|
|
137
|
+
# 2. create (prompt synthesized from the prior conversation — brand, tone, pages)
|
|
138
|
+
npx rush-ai task create -a web-builder \
|
|
139
|
+
-p "做一个公司官网首页,包含导航、Hero、核心特性、客户评价和底部联系信息,风格大气专业。" \
|
|
140
|
+
--json
|
|
141
|
+
# → {"id": "lodig8oknq0r", "status": "pending", ...}
|
|
142
|
+
|
|
143
|
+
# 3. tell the user
|
|
144
|
+
# "已经派到 Rush 的 web-builder,任务 id lodig8oknq0r,我帮你盯着。"
|
|
145
|
+
|
|
146
|
+
# 4. poll
|
|
147
|
+
npx rush-ai task status lodig8oknq0r --json
|
|
148
|
+
# ...wait...
|
|
149
|
+
# → {"status": "completed", "previewUrl": "https://lodig8oknq0r-preview.rush.zhenguanyu.com/", "gitRepoUrl": "..."}
|
|
150
|
+
|
|
151
|
+
# 5. present
|
|
152
|
+
# "跑完了:
|
|
153
|
+
# 预览: https://lodig8oknq0r-preview.rush.zhenguanyu.com/
|
|
154
|
+
# 代码: https://gitlab-ee.zhenguanyu.com/rush/online/lodig8oknq0r
|
|
155
|
+
# 要改哪儿继续说,我走 task send 不新起任务。"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Anti-patterns
|
|
159
|
+
|
|
160
|
+
- ❌ Asking the user to re-describe requirements they already told you in-thread.
|
|
161
|
+
- ❌ Creating a new task for every tweak — use `task send`.
|
|
162
|
+
- ❌ Hiding the task id from the user (they may want to reopen the Rush UI later).
|
|
163
|
+
- ❌ Running `task watch` when all you need is final status — it streams verbosely, use `task status` for quick polls.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rush-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Rush CLI - Command-line interface for the Rush AI platform",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
+
"skills",
|
|
18
19
|
"README.md",
|
|
20
|
+
"AGENTS.md",
|
|
19
21
|
"LICENSE"
|
|
20
22
|
],
|
|
21
23
|
"publishConfig": {
|
package/skills/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Rush-ai skills for AI agents
|
|
2
|
+
|
|
3
|
+
`rush-ai` is a CLI for the Rush platform. If you are an AI agent (Cursor, Claude Code, a local sub-agent) reading this, these guides tell you when and how to invoke `rush-ai` on behalf of the user.
|
|
4
|
+
|
|
5
|
+
## When to use rush-ai
|
|
6
|
+
|
|
7
|
+
Pick the guide that matches the situation:
|
|
8
|
+
|
|
9
|
+
- **You are in the middle of a conversation with the user (inside an IDE) and part of the work belongs on Rush.**
|
|
10
|
+
→ Read [`hand-off.md`](./hand-off.md). Typical trigger: "build me a landing page", "turn this sketch into a site", "generate the docs site".
|
|
11
|
+
|
|
12
|
+
- **You are composing a workflow and need a specialist agent as one of the steps.**
|
|
13
|
+
→ Read [`agent-shelf.md`](./agent-shelf.md). Typical trigger: a workflow node that needs domain expertise you don't have (HR analytics, observability Q&A, physics reasoning, etc).
|
|
14
|
+
|
|
15
|
+
Still unsure? Run `npx rush-ai agent list` first — seeing the available agents usually makes the decision obvious.
|
|
16
|
+
|
|
17
|
+
## Cheat sheet
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Discover
|
|
21
|
+
npx rush-ai agent list --default # just the built-in defaults (web-builder, rush, skill-publisher, ...)
|
|
22
|
+
npx rush-ai agent list --search "人力" # fuzzy-filter the full shelf
|
|
23
|
+
npx rush-ai agent list --all # everything (can be long)
|
|
24
|
+
npx rush-ai agent info <agent> # inspect one agent's skills / MCP servers
|
|
25
|
+
|
|
26
|
+
# Hand off
|
|
27
|
+
npx rush-ai task create -a <agent> -p "<prompt>" # create a task
|
|
28
|
+
npx rush-ai task status <task-id> # check status (includes preview / git URLs when ready)
|
|
29
|
+
npx rush-ai task send <task-id> -p "<follow-up>" # iterate on a running task
|
|
30
|
+
npx rush-ai task watch <task-id> # stream execution (SSE)
|
|
31
|
+
|
|
32
|
+
# Defaults
|
|
33
|
+
-a rush # general-purpose agent; this is the CLI default, so `-a` can be omitted when you want `rush`
|
|
34
|
+
-a web-builder # site/landing-page builder; returns previewUrl + gitRepoUrl
|
|
35
|
+
-a <other> # any other agent name from `agent list` — confirm it exists first
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`--json` on any command gives machine-readable output; use it when you need to parse the result.
|
|
39
|
+
|
|
40
|
+
## Prerequisites the agent should enforce
|
|
41
|
+
|
|
42
|
+
Before creating a task, make sure the user is authenticated:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx rush-ai auth status
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If not authenticated, tell the user to run `npx rush-ai auth login` in their terminal (the command is interactive and requires a browser — you cannot complete it on their behalf).
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Skill: Call a Rush agent as your sub-agent
|
|
2
|
+
|
|
3
|
+
Use this skill when you are composing a workflow — your own, or one the user described — and a step calls for domain expertise you don't have. Rush hosts a shelf of specialist agents. You can invoke any of them with one `rush-ai task create` call and feed the result back into your workflow.
|
|
4
|
+
|
|
5
|
+
## When this skill applies
|
|
6
|
+
|
|
7
|
+
Triggers:
|
|
8
|
+
|
|
9
|
+
- The user's instructions name a specialist by role ("use the HR analytics expert", "ask the physics reasoning agent", "let the observability agent check it").
|
|
10
|
+
- You're drafting a multi-step plan and one node is outside your competence (e.g. "analyze RUM data", "write a physics problem set", "summarize an HR report").
|
|
11
|
+
- The user asks "what can Rush do that I can't?" — that's a prompt to show the shelf.
|
|
12
|
+
|
|
13
|
+
Do NOT use this skill when:
|
|
14
|
+
|
|
15
|
+
- The task fits the default general-purpose agent (`rush`) — that's a hand-off, not a sub-agent call. See `hand-off.md`.
|
|
16
|
+
- The task needs a live web artifact — use `web-builder` via `hand-off.md`.
|
|
17
|
+
|
|
18
|
+
## Playbook
|
|
19
|
+
|
|
20
|
+
### 1. Discover — don't guess
|
|
21
|
+
|
|
22
|
+
Always start by listing the shelf, unless the user already named a specific agent. Use the right scope for the question at hand:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Just the built-in defaults — useful when you're looking for the general fallback
|
|
26
|
+
npx rush-ai agent list --default --json
|
|
27
|
+
|
|
28
|
+
# Fuzzy-filter when the user hinted at a domain
|
|
29
|
+
npx rush-ai agent list --search "人力" --json
|
|
30
|
+
|
|
31
|
+
# Full catalog — use sparingly, can be hundreds of entries
|
|
32
|
+
npx rush-ai agent list --all --json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Pick the best match by name + description. If multiple are plausible, inspect one:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx rush-ai agent info <agent-name> --json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If nothing fits, tell the user what's available and ask how to proceed — don't force-fit a wrong agent.
|
|
42
|
+
|
|
43
|
+
### 2. Call it as a node in your workflow
|
|
44
|
+
|
|
45
|
+
Treat the agent call like a pure function: input prompt, output task result. Compose your own prompt with the context the agent needs (not the whole conversation — just the inputs for this step).
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx rush-ai task create -a <agent-name> \
|
|
49
|
+
-p "<focused prompt — inputs + expected output format>" \
|
|
50
|
+
--json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For a workflow node you need synchronously, poll:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx rush-ai task status <id> --json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
When `status == completed`, the response has the output. For agents that produce structured results, request `--json` and parse it.
|
|
60
|
+
|
|
61
|
+
### 3. Feed the result back into your workflow
|
|
62
|
+
|
|
63
|
+
The sub-agent's output is just another piece of context for the next step of your plan. Incorporate it into the next action the way you would any tool result.
|
|
64
|
+
|
|
65
|
+
If the output is unsatisfactory, either:
|
|
66
|
+
|
|
67
|
+
- refine via `task send <id> -p "<clarification>"` (same sub-agent, same context), or
|
|
68
|
+
- fall back to your plan B (try a different agent, or escalate to the user).
|
|
69
|
+
|
|
70
|
+
## Example
|
|
71
|
+
|
|
72
|
+
User: "帮我分析一下 Q1 的部门人效,然后根据结论写一段给 CEO 的周会汇报。"
|
|
73
|
+
|
|
74
|
+
Your plan:
|
|
75
|
+
|
|
76
|
+
1. Call a data-analysis sub-agent on Rush to do the number-crunching.
|
|
77
|
+
2. Use the analysis output to draft the exec-summary locally.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Step 1 — find the HR analytics specialist (--json returns { agents, pagination })
|
|
81
|
+
npx rush-ai agent list --search "人力" --json | jq '.agents[] | {name, description}'
|
|
82
|
+
# → matches "人力资源分析专家"
|
|
83
|
+
|
|
84
|
+
# Step 2 — call it as a sub-agent node
|
|
85
|
+
npx rush-ai task create -a 人力资源分析专家 \
|
|
86
|
+
-p "分析 Q1 各部门人效趋势,输出 3 条关键结论。" \
|
|
87
|
+
--json
|
|
88
|
+
# → {"id": "t_abc", "status": "pending"}
|
|
89
|
+
|
|
90
|
+
# Step 3 — wait for the node to finish
|
|
91
|
+
npx rush-ai task status t_abc --json
|
|
92
|
+
# → {"status": "completed", "result": "..."}
|
|
93
|
+
|
|
94
|
+
# Step 4 — you take the result and draft the exec summary locally.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Anti-patterns
|
|
98
|
+
|
|
99
|
+
- ❌ Inventing an agent name. If `agent list` doesn't show it, it doesn't exist — tell the user.
|
|
100
|
+
- ❌ Passing the entire original conversation as the sub-agent's prompt. Give it only the inputs it needs.
|
|
101
|
+
- ❌ Using `web-builder` for non-website work. It's specialized for producing deployable sites.
|
|
102
|
+
- ❌ Abandoning the workflow if the sub-agent call fails. Surface the error, offer a fallback.
|