cnb-codebuddy-remote
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "cnb-codebuddy-remote" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c852e711d7c55cb8644283a3f9335dc4ec06072c396d2325c349c80ec0ebfe23. Verify the upstream source and version against https://skillhub.cn/skills/user_f12a44b7/self-dev-cnb-codebuddy-remote before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
CNB CodeBuddy Remote: Remotely control the CodeBuddy CLI (tcb ai) in the CNB cloud-native development environment via SSH. Intended for performing code development, file operations, project builds, and similar tasks inside the CNB cloud environment. Example trigger phrases: “remote CodeBuddy,” “CNB cloud-native development,” “tcb ai remote,” “CodeBuddy SSH,” “cloud-native AI.”
Introduction source: third_party · user_f12a44b7 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Limits and differences
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: cnb-codebuddy-remote
slug: self-dev-cnb-codebuddy-remote
version: 1.0.0
displayName: "Self Dev Cnb Codebuddy Remote"
description: 通过 SSH 远程操控 CNB 云原生开发环境中的 CodeBuddy CLI(tcb ai),实现远程指挥 AI 编程。适用于需要在 CNB 云开发环境中执行代码开发、文件操作、项目构建等任务的场景。触发词:"远程 CodeBuddy"、"CNB 云原生开发"、"tcb ai 远程"、"CodeBuddy SSH"、"云原生 AI"。CNB CodeBuddy 远程操控
通过 SSH + PTY 远程控制 CNB 云原生环境中的 CodeBuddy CLI,实现非交互式任务下发和结果回收。
前置条件
- CNB 云原生环境已创建,可通过 SSH 访问
- CodeBuddy 已登录(OAuth 中国站扫码,token 持久化)
- 本地机器有 SSH access 和 expect 工具
环境信息模板
每个 CNB 云原生环境需要记录:
SSH_HOST=<环境ID>@cnb.space
WORK_DIR=/workspace
WEBIDE=https://cnb-<env-id>.cnb.space
工作流程
阶段一:环境准备(首次)
1. SSH 连接验证
ssh -o ConnectTimeout=10 -o ServerAliveInterval=5 -o ServerAliveCountMax=12 <SSH_HOST> 'echo OK'
2. 检查 CodeBuddy 状态
ssh <SSH_HOST> 'which codebuddy; codebuddy --version'
ssh <SSH_HOST> 'tcb ai --config'
3. CodeBuddy 登录(如未登录)
必须走中国站 OAuth,CLI 硬编码认证目标为 codebuddy.ai,API KEY 方案不可行(cn 站 key 全部 401)。
推荐方式:用户在 WebIDE 手动登录
- 打开 WebIDE,在终端运行
tcb ai -a codebuddy - 选「Log in via Chinese Site」
- 扫描
copilot.tencent.com/login?platform=CLI&state=<uuid>二维码 - 登录成功后 token 自动持久化到
~/.codebuddy/
自动登录脚本(需用户配合扫码):
expect << 'EOF'
set timeout 180
spawn tcb ai -a codebuddy
expect -re {Do you trust}
send "\r"
expect -re {Enter to confirm}
send "\r"
expect -re {copilot.tencent.com/login}
# 提取 URL 通知用户扫码,等待回调
expect eof
EOF
4. 信任工作目录
首次启动 CodeBuddy 会询问是否信任目录,选「Trust folder and all subdirectories」。
阶段二:远程任务下发(日常使用)
方法 A:PTY 交互(推荐,实时可控)
步骤:
-
启动 CodeBuddy(PTY 模式保持连接):
ssh -o ConnectTimeout=10 -o ServerAliveInterval=5 -o ServerAliveCountMax=12 -t <SSH_HOST> 'cd <WORK_DIR> && tcb ai' -
等待启动完成(约 15-20 秒),确认看到
GLM-5.1和? for shortcuts -
用
process write发送指令文本(纯文本,不含回车):process write sessionId="<id>" data="read README.md and summarize it" -
用
process send-keys发送回车(必须用 hex,不能用 write 发 \r):process send-keys sessionId="<id>" hex=["0d"] -
等待 CodeBuddy 处理(状态变化:
waiting for model→streaming→mixing→ 完成)- 简单文本回复:10-20 秒
- 需要执行命令的:20-60 秒
- 看到状态栏从
streaming · ↓ N tokens恢复到 idle 表示完成
-
如遇工具确认提示(
Do you want to proceed?),自动选 "Yes, and don't ask again":process send-keys sessionId="<id>" hex=["1b","5b","42"] # Down arrow # 等待 0.3 秒 process send-keys sessionId="<id>" hex=["0d"] # Enter -
读取结果:从 session log 中提取,清除 ANSI 码后即为纯文本
关键交互对照表:
| 操作 | hex 值 | 说明 |
|---|---|---|
| 回车(Enter) | ["0d"] |
提交 prompt / 确认选项 |
| 下箭头(Down) | ["1b","5b","42"] |
切换选项 |
| 上箭头(Up) | ["1b","5b","41"] |
切换选项 |
| Tab | ["09"] |
切换模式/选项 |
| Escape | ["1b"] |
取消/退出 |
状态栏含义:
| 状态 | 含义 | 等待时间 |
|---|---|---|
waiting for model |
排队/冷启动 | 5-15 秒 |
Thinking on |
模型推理中 | 5-15 秒 |
streaming · ↓ N tokens |
正在输出 | 持续 |
mixing |
整合工具调用结果 | 5-20 秒 |
swiping |
生成回复 | 5-15 秒 |
| 空闲(无状态) | 完成,可发下一条 | - |
方法 B:expect 脚本(无人值守)
使用 scripts/cb-remote.sh:
scp scripts/cb-remote.sh <SSH_HOST>:/tmp/cb-remote.sh
ssh <SSH_HOST> 'bash /tmp/cb-remote.sh "你的指令" [超时秒数]'
方法 C:nohup 后台(长时间任务)
ssh <SSH_HOST> 'cd <WORK_DIR> && nohup expect /tmp/cb.exp "指令" > /tmp/cb-output.txt 2>&1 &'
# 稍后读取
ssh <SSH_HOST> 'cat /tmp/cb-output.txt | sed "s/\x1b\[[0-9;]*[a-zA-Z]//g" | tail -30'
阶段三:结果回收
- PTY 模式:从 session log 提取,token 计数(↓ N tokens)表示输出量
- expect/nohup:SSH 读取输出文件
- ANSI 清理:
sed "s/\x1b\[[0-9;]*[a-zA-Z]//g; s/]8;;[^]]*]//g"
故障排查
| 症状 | 原因 | 解决 |
|---|---|---|
| 401 认证错误 | token 过期 | WebIDE 重新登录 |
| SSH 2分钟断连 | keepalive 不足 | 加 -o ServerAliveInterval=5 -o ServerAliveCountMax=12 |
| 回车变成文字 | write 发送 \r | 用 send-keys hex ["0d"] |
| Thinking 无响应 | prompt 没真正发送 | 确认用 hex 发回车 |
| 信任目录卡住 | expect 没处理 | 脚本加 exp_continue |
| API KEY 401 | CLI 硬编码 codebuddy.ai | 必须走 OAuth |
| waiting for model 久 | 排队/冷启动 | 等 10-15 秒 |
| 多个 tcb 进程 | WebIDE 残留 | pkill -f tcb 清理 |
| 首次 prompt 自动触发 | 历史残留 | 等 idle 后再发 |
注意事项
- 一次只能一个 CodeBuddy session,多实例会冲突
- SSH 有超时,keepalive 必须 5 秒一次
- CodeBuddy 基于 ink 框架,键盘事件必须用 hex 精确控制
- 必须走中国站(codebuddy.cn/copilot.tencent.com)
- CNB AI Chat API 不可替代:只做聊天补全,不能执行 shell
- Token 持久化:OAuth 登录后 token 存在
~/.codebuddy/,重启环境不丢失
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供通过 SSH 远程操控 CNB 云原生开发环境中 CodeBuddy CLI 的能力,解决远程 AI 编程指挥的明确需求
- 适用于代码开发、文件操作、项目构建等任务,具有明确的实用价值
Highlights
- 触发词覆盖合理,包括"远程 CodeBuddy"、"CNB 云原生开发"等多个变体,边界清晰
Areas to improve
-
缺少 When to Use 章节 Reported severity: Minor
文档中未明确设置 When to Use 章节,用户可能不清楚具体使用场景
Recommendation: 建议添加 When to Use 章节,明确说明 Skill 的最佳使用时机和场景
-
文档过长 Reported severity: Minor
文档内容超过 500 行,可能影响用户阅读体验
Recommendation: 建议适当精简文档内容,或将部分内容移至附录或外部链接
Highlights
- 文档结构清晰,包含前置条件、工作流程、故障排查等完整章节
- 提供了详细的步骤划分和端到端示例,frontmatter 完整
Areas to improve
-
引用文件内容不完整 Reported severity: Major
文档中提到了 scripts/cb-remote.sh 和 cb.exp 脚本,但未提供这些脚本的具体内容,用户无法直接使用
Recommendation: 建议提供 scripts/cb-remote.sh 和 cb.exp 脚本的完整内容,或提供获取这些脚本的方法
Highlights
- 提供了多种执行方法(PTY 交互、expect 脚本、nohup 后台),工具来源明确
- 参数说明详细,覆盖了主要异常情况并给出了具体的解决方案
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Invoke commands or scripts
Read the script and arguments first. Use ordinary privileges and a scoped directory; confirm installation or execution in your host tool.
Mentioned in main document · lines 140 -
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 16, 48, 166, 178
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- cnb-
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.