Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

code-worker

面向 Cursor Agent / 自动化改代码场景的工作镜像:预装 Node、Git、GitHub CLI、Cursor CLI(agent)和 graphify,可在容器内直接 clone、改代码、开 PR。

基础镜像:node:24
默认工作目录:/workspace

预装工具

工具 说明
Node.js 24 / npm 前端与 JS 项目运行时
git 版本控制
gh GitHub CLI(PR / Issue / API)
openssh-client git@github.com SSH 远程
jq 处理 gh JSON 输出
Python 3 / uv Python CLI 安装
graphify 代码知识图谱(已执行 graphify cursor install
Cursor CLI (agent) 无头 Agent,读 CURSOR_API_KEY

拉取镜像

推送到 master 后由 GitHub Actions 构建并发布到 GHCR:

docker pull ghcr.io/kne-union/code-worker:latest

标签:

  • latest — 最新 master
  • <short-sha> — 对应 commit

快速使用

docker run --rm -it \
  -e GH_TOKEN \
  -e CURSOR_API_KEY \
  -e GIT_AUTHOR_NAME="Your Name" \
  -e GIT_AUTHOR_EMAIL="you@example.com" \
  -v "$PWD:/workspace" \
  ghcr.io/kne-union/code-worker:latest

环境变量

变量 用途
GH_TOKEN gh 鉴权;HTTPS git 也可配合该 token
CURSOR_API_KEY Cursor Agent 鉴权(agent 会自动读取)
GIT_AUTHOR_NAME / GIT_AUTHOR_EMAIL 容器内 commit 身份

也可用 SSH(代替或补充 GH_TOKEN):

docker run --rm -it \
  -v ~/.ssh:/root/.ssh:ro \
  -v "$PWD:/workspace" \
  -e CURSOR_API_KEY \
  ghcr.io/kne-union/code-worker:latest

容器内常见操作

gh repo clone owner/repo
cd repo
graphify update .
agent -p "fix the failing tests"
gh pr create --title "..." --body "..."

本地构建

docker build -t code-worker:dev .
docker run --rm -it -v "$PWD:/workspace" code-worker:dev

说明

  • 不要把 token / SSH 私钥写进镜像,运行时通过 -e 或挂载注入。
  • GH_TOKEN 至少需要目标仓库的 Contents / Pull requests 等权限(按实际操作勾选)。
  • Cursor Agent 需要网络访问 Cursor API;受限网络或代理环境可能影响登录与索引。

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages