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.
@@ -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.