jules
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJules Task Delegation
Jules任务委托
Delegate coding tasks to Google's Jules AI agent on GitHub repositories.
将编码任务委托给GitHub仓库上的Google Jules AI agent。
Setup (Run Before First Command)
初始化(首次执行命令前运行)
1. Install CLI
1. 安装CLI
bash
which jules || npm install -g @google/julesbash
which jules || npm install -g @google/jules2. Check Auth
2. 检查授权
bash
jules remote list --repoIf fails → tell user to run (or for headless)
jules login--no-launch-browserbash
jules remote list --repo如果失败→告知用户运行(无头环境使用)
jules login--no-launch-browser3. Auto-Detect Repo
3. 自动检测仓库
bash
git remote get-url origin 2>/dev/null | sed -E 's#.*(github\.com)[/:]([^/]+/[^/.]+)(\.git)?#\2#'If not GitHub or not in git repo → ask user for
--repo owner/repobash
git remote get-url origin 2>/dev/null | sed -E 's#.*(github\.com)[/:]([^/]+/[^/.]+)(\.git)?#\2#'如果不是GitHub仓库或不在git仓库中→询问用户提供
--repo owner/repo4. Verify Repo Connected
4. 验证仓库已连接
Check repo is in . If not → direct to https://jules.google.com
jules remote list --repo检查仓库是否在的结果中。如果没有→引导至https://jules.google.com
jules remote list --repoCommands
命令
Create Tasks
创建任务
bash
jules new "Fix auth bug" # Auto-detected repo
jules new --repo owner/repo "Add unit tests" # Specific repo
jules new --repo owner/repo --parallel 3 "Implement X" # Parallel sessions
cat task.md | jules new --repo owner/repo # From stdinbash
jules new "Fix auth bug" # 自动检测仓库
jules new --repo owner/repo "Add unit tests" # 指定仓库
jules new --repo owner/repo --parallel 3 "Implement X" # 并行会话
cat task.md | jules new --repo owner/repo # 从标准输入读取Monitor
监控
bash
jules remote list --session # All sessions
jules remote list --repo # Connected reposbash
jules remote list --session # 所有会话
jules remote list --repo # 已连接的仓库Retrieve Results
获取结果
bash
jules remote pull --session <id> # View diff
jules remote pull --session <id> --apply # Apply locally
jules teleport <id> # Clone + applybash
jules remote pull --session <id> # 查看差异
jules remote pull --session <id> --apply # 本地应用
jules teleport <id> # 克隆并应用Latest Session Shortcut
最新会话快捷方式
bash
LATEST=$(jules remote list --session 2>/dev/null | awk 'NR==2 {print $1}')
jules remote pull --session $LATESTbash
LATEST=$(jules remote list --session 2>/dev/null | awk 'NR==2 {print $1}')
jules remote pull --session $LATESTSmart Context Injection
智能上下文注入
Enrich prompts with current context for better results:
bash
BRANCH=$(git branch --show-current)
RECENT_FILES=$(git diff --name-only HEAD~3 2>/dev/null | head -10 | tr '\n' ', ')
RECENT_COMMITS=$(git log --oneline -5 | tr '\n' '; ')
STAGED=$(git diff --cached --name-only | tr '\n' ', ')Use when creating tasks:
bash
jules new --repo owner/repo "Fix the bug in auth module. Context: branch=$BRANCH, recently modified: $RECENT_FILES"为指令添加当前上下文以获得更好的结果:
bash
BRANCH=$(git branch --show-current)
RECENT_FILES=$(git diff --name-only HEAD~3 2>/dev/null | head -10 | tr '\n' ', ')
RECENT_COMMITS=$(git log --oneline -5 | tr '\n' '; ')
STAGED=$(git diff --cached --name-only | tr '\n' ', ')创建任务时使用:
bash
jules new --repo owner/repo "Fix the bug in auth module. Context: branch=$BRANCH, recently modified: $RECENT_FILES"Template Prompts
模板指令
Quick commands for common tasks:
适用于常见任务的快捷命令:
Add Tests
添加测试
bash
FILES=$(git diff --name-only HEAD~3 2>/dev/null | grep -E '\.(js|ts|py|go|java)$' | head -5 | tr '\n' ', ')
jules new "Add unit tests for recently modified files: $FILES. Include edge cases and mocks where needed."bash
FILES=$(git diff --name-only HEAD~3 2>/dev/null | grep -E '\.(js|ts|py|go|java)$' | head -5 | tr '\n' ', ')
jules new "为最近修改的文件添加单元测试:$FILES。必要时包含边界情况和模拟数据。"Add Documentation
添加文档
bash
FILES=$(git diff --name-only HEAD~3 2>/dev/null | grep -E '\.(js|ts|py|go|java)$' | head -5 | tr '\n' ', ')
jules new "Add documentation comments to: $FILES. Include function descriptions, parameters, return values, and examples."bash
FILES=$(git diff --name-only HEAD~3 2>/dev/null | grep -E '\.(js|ts|py|go|java)$' | head -5 | tr '\n' ', ')
jules new "为以下文件添加文档注释:$FILES。包含函数描述、参数、返回值和示例。"Fix Lint Errors
修复代码检查错误
bash
jules new "Fix all linting errors in the codebase. Run the linter, identify issues, and fix them while maintaining code functionality."bash
jules new "修复代码库中所有的代码检查错误。运行代码检查工具,识别问题并修复,同时保持代码功能正常。"Review PR
审核PR
bash
PR_NUM=123
PR_INFO=$(gh pr view $PR_NUM --json title,body,files --jq '"\(.title)\n\(.body)\nFiles: \(.files[].path)"')
jules new "Review this PR for bugs, security issues, and improvements: $PR_INFO"bash
PR_NUM=123
PR_INFO=$(gh pr view $PR_NUM --json title,body,files --jq '"\(.title)\n\(.body)\nFiles: \(.files[].path)"')
jules new "审核此PR,检查bug、安全问题和可改进点:$PR_INFO"Git Integration (Apply + Commit)
Git集成(应用并提交)
After Jules completes, apply changes to a new branch:
bash
SESSION_ID="<id>"
TASK_DESC="<brief description>"Jules完成任务后,将更改应用到新分支:
bash
SESSION_ID="<id>"
TASK_DESC="<brief description>"Create branch, apply, commit
创建分支、应用更改、提交
git checkout -b "jules/$SESSION_ID"
jules remote pull --session "$SESSION_ID" --apply
git add -A
git commit -m "feat: $TASK_DESC
Jules session: $SESSION_ID"
git checkout -b "jules/$SESSION_ID"
jules remote pull --session "$SESSION_ID" --apply
git add -A
git commit -m "feat: $TASK_DESC
Jules session: $SESSION_ID"
Optional: push and create PR
可选:推送并创建PR
git push -u origin "jules/$SESSION_ID"
gh pr create --title "$TASK_DESC" --body "Automated changes from Jules session $SESSION_ID"
undefinedgit push -u origin "jules/$SESSION_ID"
gh pr create --title "$TASK_DESC" --body "Automated changes from Jules session $SESSION_ID"
undefinedPoll Until Complete
轮询直至完成
Wait for session to finish:
bash
SESSION_ID="<id>"
while true; do
STATUS=$(jules remote list --session 2>/dev/null | grep "$SESSION_ID" | awk '{print $NF}')
case "$STATUS" in
Completed)
echo "Done!"
jules remote pull --session "$SESSION_ID"
break ;;
Failed)
echo "Failed. Check: https://jules.google.com/session/$SESSION_ID"
break ;;
*User*)
echo "Needs input: https://jules.google.com/session/$SESSION_ID"
break ;;
*)
echo "Status: $STATUS - waiting 30s..."
sleep 30 ;;
esac
done等待会话完成:
bash
SESSION_ID="<id>"
while true; do
STATUS=$(jules remote list --session 2>/dev/null | grep "$SESSION_ID" | awk '{print $NF}')
case "$STATUS" in
Completed)
echo "Done!"
jules remote pull --session "$SESSION_ID"
break ;;
Failed)
echo "失败。查看:https://jules.google.com/session/$SESSION_ID"
break ;;
*User*)
echo "需要输入:https://jules.google.com/session/$SESSION_ID"
break ;;
*)
echo "状态:$STATUS - 等待30秒..."
sleep 30 ;;
esac
doneAGENTS.md Template
AGENTS.md模板
Create in repo root to improve Jules results:
markdown
undefined在仓库根目录创建此文件以提升Jules的处理效果:
markdown
undefinedAGENTS.md
AGENTS.md
Project Overview
项目概述
[Brief description]
[简要描述]
Tech Stack
技术栈
- Language: [TypeScript/Python/Go/etc.]
- Framework: [React/FastAPI/Gin/etc.]
- Testing: [Jest/pytest/go test/etc.]
- 语言:[TypeScript/Python/Go等]
- 框架:[React/FastAPI/Gin等]
- 测试:[Jest/pytest/go test等]
Code Conventions
代码规范
- [Linter/formatter used]
- [Naming conventions]
- [File organization]
- [使用的代码检查/格式化工具]
- [命名规范]
- [文件组织结构]
Testing Requirements
测试要求
- Unit tests for new features
- Integration tests for APIs
- Coverage target: [X]%
- 新功能需添加单元测试
- API需添加集成测试
- 覆盖率目标:[X]%
Build & Deploy
构建与部署
- Build:
[command] - Test:
[command]
undefined- 构建:
[命令] - 测试:
[命令]
undefinedSession States
会话状态
| Status | Action |
|---|---|
| Planning / In Progress | Wait |
| Awaiting User F | Respond at web UI |
| Completed | Pull results |
| Failed | Check web UI |
| 状态 | 操作 |
|---|---|
| 规划中/进行中 | 等待 |
| 等待用户输入 | 在网页端响应 |
| 已完成 | 获取结果 |
| 失败 | 查看网页端 |
Notes
注意事项
- No CLI reply → Use web UI for Jules questions
- No CLI cancel → Use web UI to cancel
- GitHub only → GitLab/Bitbucket not supported
- AGENTS.md → Jules reads from repo root for context
- CLI无回复 → 请在网页端处理Jules的问题
- CLI无法取消 → 请在网页端取消任务
- 仅支持GitHub → 不支持GitLab/Bitbucket
- AGENTS.md → Jules会读取仓库根目录的此文件以获取上下文信息