CNB 平台技能集合,支持 CodeBuddy,通过 npx skills 安装。
npx skills add https://cnb.cool/cnb/skills/cnb-skill.git --agent codebuddy -y
npx skills add https://cnb.cool/cnb/skills/cnb-skill.git --list
npx skills add https://cnb.cool/cnb/skills/cnb-skill.git --skill cnb-api --agent codebuddy -y
使用 skills 需先安装 cnb-cli,支持以下方式:
# 一键安装最新版(macOS / Linux)
curl -fsSL https://cnb.cool/cnb/skills/cnb-skill/-/git/raw/main/install.sh | sh
# 一键安装指定版本(macOS / Linux)
curl -fsSL https://cnb.cool/cnb/skills/cnb-skill/-/git/raw/main/install.sh | sh -s 1.5.3
# 一键安装最新版(Windows PowerShell)
irm https://cnb.cool/cnb/skills/cnb-skill/-/git/raw/main/install.ps1 | iex
# 一键安装指定版本(Windows PowerShell)
$v="1.5.3"; irm https://cnb.cool/cnb/skills/cnb-skill/-/git/raw/main/install.ps1 | iex
# npm 安装
npm install @cnbcool/cnb-cli -g
也可前往 Releases 手动下载(最新版直链:https://cnb.cool/cnb/skills/cnb-skill/-/releases/latest/download/<filename>)。
将以下内容发送给 CodeBuddy 等智能体即可自动安装:
npm install @cnbcool/cnb-cli -g
npm install skills -g
npx skills add https://cnb.cool/cnb/skills/cnb-skill.git --agent codebuddy -y --copy
CNB_TOKEN:访问凭证(必须)CNB_API_ENDPOINT:API 端点,如 https://api.cnb.cool(必须)CNB_BRANCH:默认分支(选填)cnb git-credential 可作为 Git Credential Helper,为 git clone、git pull、git push、Git LFS 等 HTTPS 操作自动提供 CNB 访问凭据。
cnb login
登录成功后,凭据会保存到 ~/.cnb/token。后续 Git 操作会自动读取该凭据;若 token 过期且存在 refresh_token,会自动刷新。
推荐只为 CNB 域名配置 helper,避免影响其他 Git 站点:
git config --global credential.https://cnb.cool.helper "!cnb git-credential"
git config --global credential.https://cnb.cool.useHttpPath true
也可以直接在 ~/.gitconfig 中加入:
[credential "https://cnb.cool"]
helper = "!cnb git-credential"
useHttpPath = true
git clone https://cnb.cool/<org>/<repo>.git
cd <repo>
git pull
git push
说明:
cnb git-credential 仅供 Git 内部调用;通常无需手动执行。CNB_TOKEN 环境变量、~/.cnb/token 登录凭据。git config --global --unset credential.https://cnb.cool.helper。