github-workflow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitHub Workflow (Task → Environment Setup → Fix → PR)
GitHub 工作流(任务 → 环境准备 → 修复 → PR)
Goal
目标
Standard flow from "task link or description" to "create PR (no merge)". Task source is any data source: first determine the query method via global config or find-skills, write to global config after confirmation, then use it directly next time.
Output: Branch created, written, PR link targeting (origin only).
TODO.mddev实现从「任务链接或描述」到「创建PR(不合并)」的标准流程。任务源支持任意数据源:首先通过全局配置或find-skills确定查询方法,确认后写入全局配置,下次可直接使用。
输出结果:已创建分支、已写入、指向分支的PR链接(仅针对origin)。
TODO.mddevPrerequisites
前置条件
This workflow depends on GitHub PR creation (Step 4). Ensure one of the following before or when the user first runs the workflow:
- GitHub skill is available in the user’s skills directory (e.g. or your agent’s equivalent). The user can install it via:
~/.agents/skills/github/- (or your environment’s skill discovery), then install the suggested skill.
npx skills add hairyf/skills --skill github-cli -g
- CLI is installed and authenticated:
gh- Install: GitHub CLI
- Then run:
gh auth login
When to check: At the start of the workflow (e.g. after the user provides the task), optionally run . If it fails or the user has no GitHub skill, prompt: "To create the PR in Step 4, the GitHub skill or CLI is required. Install the GitHub skill (see Prerequisites above) or install and log in with . You can continue with Steps 1–3 now and set this up before Step 4." Then continue; if Step 4 is reached and is still missing, use the edge case handling below.
gh auth statusghgh auth logingh本工作流依赖GitHub PR创建功能(步骤4)。在用户首次运行工作流之前或之时,需确保满足以下任一条件:
- GitHub skill已存在于用户的技能目录中(例如 或你的Agent对应的目录)。用户可通过以下方式安装:
~/.agents/skills/github/- (或你的环境对应的技能发现命令),然后安装推荐的技能。
npx skills add hairyf/skills --skill github-cli -g
- CLI已安装并完成认证:
gh- 安装地址:GitHub CLI
- 然后运行:
gh auth login
检查时机:在工作流开始时(例如用户提供任务后),可选择运行。如果认证失败或用户未安装GitHub skill,提示用户:“要完成步骤4的PR创建,需使用GitHub skill或 CLI。请安装GitHub skill(参见上述前置条件)或安装并通过完成登录。你可以先继续执行步骤1-3,在步骤4之前完成配置。” 之后继续流程;如果到步骤4时仍未配置 CLI,使用下方的边缘情况处理方案。
gh auth statusghgh auth loginghGlobal Data Source Config (Persistent)
全局数据源配置(持久化)
- Path: (user-level, applies across projects)
~/.bonfire/source.json - Purpose: Once the user confirms a data source's query method, write it here; for the same type of input next time, use it directly and skip find-skills.
Example config (ClickUp):
json
{
"dataSourceType": "clickup",
"description": "ClickUp task link",
"matchPatterns": ["clickup.com/t/", "app.clickup.com"],
"taskIdPlaceholder": "<task_id>",
"commands": {
"get": "node ~/.bonfire/skills/clickup/query.mjs get <task_id> --subtasks",
"comments": "node ~/.bonfire/skills/clickup/query.mjs comments <task_id>"
},
"envCheck": "~/.bonfire/skills/clickup/.env"
}- : If input URL or text contains any of these, treat as match and run commands from this config.
matchPatterns - /
commands.get: Replacecommands.commentswith the ID parsed from input, then execute.task_id - : Optional; if present, check that the .env at this path is configured; if not, prompt the user.
envCheck
- 路径:(用户级配置,适用于所有项目)
~/.bonfire/source.json - 用途:用户确认数据源的查询方法后,将其写入该文件;下次遇到同类型输入时,直接使用该配置,跳过find-skills步骤。
配置示例(ClickUp):
json
{
"dataSourceType": "clickup",
"description": "ClickUp task link",
"matchPatterns": ["clickup.com/t/", "app.clickup.com"],
"taskIdPlaceholder": "<task_id>",
"commands": {
"get": "node ~/.bonfire/skills/clickup/query.mjs get <task_id> --subtasks",
"comments": "node ~/.bonfire/skills/clickup/query.mjs comments <task_id>"
},
"envCheck": "~/.bonfire/skills/clickup/.env"
}- :如果输入的URL或文本包含其中任意一项,则匹配该配置并执行对应的命令。
matchPatterns - /
commands.get:将commands.comments替换为从输入中解析出的ID,然后执行命令。task_id - :可选配置;如果存在,检查该路径下的.env文件是否已配置;若未配置,提示用户完成配置。
envCheck
Step 1: Get Task Content from Link or Description
步骤1:从链接或描述中获取任务内容
1.1 Check Global Config
1.1 检查全局配置
- Read .
~/.bonfire/source.json - If it exists and current input (URL or pasted text) matches any :
matchPatterns- Parse task ID from input (common: last path segment of URL or ).
t/<id> - Use ,
commands.get(replacecommands.commentswith parsed value) to fetch task title, description, status, comments, etc.task_id - Skip 1.2 (do not run find-skills), go to 1.3 output.
- Parse task ID from input (common: last path segment of URL or
- 读取文件。
~/.bonfire/source.json - 如果配置存在,且当前输入(URL或粘贴的文本)匹配任意项:
matchPatterns- 从输入中解析任务ID(通常为URL的最后一个路径段或部分)。
t/<id> - 使用、
commands.get(将commands.comments替换为解析出的ID)获取任务标题、描述、状态、评论等信息。task_id - 跳过1.2步骤(不运行find-skills),直接进入1.3步骤的输出环节。
- 从输入中解析任务ID(通常为URL的最后一个路径段或
1.2 Not Configured or No Match: Discover Data Source (find-skills)
1.2 未配置或无匹配项:发现数据源(find-skills)
-
Analyze input: Is it a URL or plain text?
- URL: Infer type from domain/path (e.g. clickup, jira, notion, linear, asana).
- Plain text: Infer from keywords (e.g. "ClickUp task", "Jira requirement").
-
Find skill: Use find-skills to find how to "query tasks from this data source":
- Run:
npx skills find <type or keyword>
e.g.,npx skills find clickup,npx skills find jira task.npx skills find task management - If a matching skill exists (e.g. ~/.bonfire/skills/clickup/), prefer SKILL.md or scripts to confirm get-task / get-comments commands.
- Run:
-
Present options: List the found skills or command usage (including install and usage) briefly; ask the user to confirm which method to use for "task title, description, comments".
-
After confirmation, save to global:
- Fill ,
dataSourceType,matchPatterns, optionalcommandsusing the structure above.envCheck - Write to .
~/.bonfire/source.json - Tell the user: "Data source config saved; next time for the same type of task it will be used directly and find-skills will be skipped."
- Fill
-
Run the confirmed method once to get task info.
-
分析输入:判断输入是URL还是纯文本?
- URL:从域名/路径推断类型(例如ClickUp、Jira、Notion、Linear、Asana)。
- 纯文本:从关键词推断类型(例如“ClickUp任务”、“Jira需求”)。
-
查找技能:使用find-skills查找“从该数据源查询任务”的方法:
- 运行命令:
npx skills find <type or keyword>
示例:、npx skills find clickup、npx skills find jira task。npx skills find task management - 如果找到匹配的技能(例如~/.bonfire/skills/clickup/),优先查看SKILL.md或脚本确认get-task / get-comments命令。
- 运行命令:
-
展示选项:简要列出找到的技能或命令用法(包括安装和使用方法);询问用户确认使用哪种方法获取“任务标题、描述、评论”。
-
确认后保存到全局配置:
- 按照上述配置结构填写、
dataSourceType、matchPatterns、可选的commands。envCheck - 将配置写入。
~/.bonfire/source.json - 告知用户:“数据源配置已保存;下次遇到同类型任务时将直接使用该配置,跳过find-skills步骤。”
- 按照上述配置结构填写
-
运行确认后的方法,获取任务信息。
1.3 Output
1.3 输出结果
- Task title, status, project/list (if any), issue description (body + comment summary).
- kebab-case short description for branch name (from title or ask user to supply).
Fallback: If .env is not configured or find-skills has no usable result, prompt the user to provide "task title, description, and short description for branch"; you can still proceed to Step 2 (branch and TODO.md can use pasted or later-filled content).
- 任务标题、状态、项目/列表(如有)、问题描述(正文+评论摘要)。
- 用于分支名称的短横线命名法(kebab-case)简短描述(从任务标题生成,或询问用户提供)。
备选方案:如果.env文件未配置或find-skills未找到可用结果,提示用户提供“任务标题、描述以及用于分支的简短描述”;仍可继续执行步骤2(分支和TODO.md可使用粘贴的内容或后续补充的内容)。
Step 2: Prepare Environment (Create Branch, Write TODO.md)
步骤2:准备环境(创建分支、编写TODO.md)
- Branch:
- →
git checkout dev→git pull origin dev(orgit checkout -b fix/<short-desc-kebab-case>depending on task type).feature/...
- TODO.md: Create at project root with this structure:
TODO.md
markdown
undefined- 分支操作:
- →
git checkout dev→git pull origin dev(或根据任务类型使用git checkout -b fix/<short-desc-kebab-case>前缀)。feature/...
- TODO.md:在项目根目录创建,结构如下:
TODO.md
markdown
undefinedTask: <task title>
Task: <task title>
Task link: <user-provided link or "see description">
Status: <current status>
Project: <project/list name, if any>
Task link: <user-provided link or "see description">
Status: <current status>
Project: <project/list name, if any>
Problem description
Problem description
<task description and comments>
<task description and comments>
Todo
Todo
- Analyze root cause
- Locate relevant code files
- Plan fix
- Implement fix
- Run checks (typecheck/test/lint)
- Commit
- Analyze root cause
- Locate relevant code files
- Plan fix
- Implement fix
- Run checks (typecheck/test/lint)
- Commit
Related files
Related files
<fill after analysis>
<fill after analysis>
Approach
Approach
- Search for relevant keywords
- Check API calls and type definitions
- Inspect related components and pages
- Understand data flow and display logic
- **Optional**: Update `.bonfire/index.md` with current branch and "Next Session Priorities".
---- Search for relevant keywords
- Check API calls and type definitions
- Inspect related components and pages
- Understand data flow and display logic
- **可选操作**:更新`.bonfire/index.md`,记录当前分支和“下次会话优先级”。
---Step 3: Wait for User to Finish Fixes
步骤3:等待用户完成修复
Agent does not change business code; the user completes the fix, self-test, and commit. After the user says "fix done", proceed to Step 4.
Agent不会修改业务代码;用户需完成修复、自测并提交代码。当用户表示“修复完成”后,进入步骤4。
Step 4: Create PR with GitHub Skill (Origin Only)
步骤4:使用GitHub Skill创建PR(仅针对Origin)
- Precondition: Confirm current branch has the fix commits and will be pushed to origin.
- Actions:
- (push to origin only).
git push -u origin <branch> - (do not pass
gh pr create --base dev --head <branch> --title "<title>" --body "<body with task link etc>"; use current repo = origin).--repo
- Constraint: Do not use or any other remote for the PR. If
--repo <other-org/repo>is read-only or archived, output an error and suggest updatingoriginor creating the PR manually on the repo’s web UI.origin - End: Output the PR link; do not merge.
- 前置检查:确认当前分支已包含修复提交,且将推送到origin。
- 操作步骤:
- (仅推送到origin)。
git push -u origin <branch> - (不要传递
gh pr create --base dev --head <branch> --title "<title>" --body "<body with task link etc>"参数;使用当前仓库=origin)。--repo
- 约束条件:不要使用或其他远程仓库创建PR。如果
--repo <other-org/repo>是只读或已归档,输出错误信息并建议用户更新origin或在仓库的Web界面手动创建PR。origin - 结束:输出PR链接;不要执行合并操作。
Edge Cases
边缘情况处理
| Case | Handling |
|---|---|
| No global config and find-skills has no result | Ask user to provide task title, description, and short branch description; still create branch and TODO.md. |
| Data source .env not set or token invalid | Prompt to configure (e.g. .env at |
| Suggest checking network and |
Branch | Ask whether to continue on existing branch or use a new name (e.g. |
| Do not add another remote; report error and suggest updating |
| User asks for PR before saying "fix done" | If there are new commits and user explicitly requests, run Step 4; otherwise remind to finish fix and commit first. |
| See Prerequisites. Prompt to install the GitHub skill or run |
| 场景 | 处理方案 |
|---|---|
| 无全局配置且find-skills未找到结果 | 询问用户提供任务标题、描述以及用于分支的简短描述;仍可创建分支和TODO.md。 |
| 数据源.env文件未配置或令牌无效 | 提示用户完成配置(例如 |
| 建议用户检查网络和 |
分支 | 询问用户是否继续使用现有分支或使用新名称(例如 |
| 不要添加其他远程仓库;报告错误并建议用户更新 |
| 用户在表示“修复完成”前要求创建PR | 如果存在新提交且用户明确要求,执行步骤4;否则提醒用户先完成修复并提交代码。 |
| 参见前置条件部分。提示用户安装GitHub skill或运行 |
Reference
参考资料
- Full spec and decision table: github-workflow-spec.md
- Task data source example: project ClickUp skill (
~/.bonfire/skills/clickup/SKILL.md)query.mjs get/comments - PR tool: (
~/.agents/skills/github/SKILL.mdCLI)gh - Discover more data source skills: use find-skills ()
npx skills find <keyword>
- 完整规范和决策表:github-workflow-spec.md
- 任务数据源示例:项目ClickUp skill (
~/.bonfire/skills/clickup/SKILL.md)query.mjs get/comments - PR工具:(
~/.agents/skills/github/SKILL.mdCLI)gh - 发现更多数据源技能:使用find-skills()
npx skills find <keyword>