@fitlab-ai/agent-infra 0.5.8 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +237 -5
- package/README.zh-CN.md +213 -5
- package/bin/cli.js +2 -2
- package/lib/init.js +18 -4
- package/lib/sandbox/commands/create.js +467 -240
- package/lib/sandbox/commands/enter.js +59 -26
- package/lib/sandbox/commands/ls.js +37 -6
- package/lib/sandbox/commands/rebuild.js +31 -15
- package/lib/sandbox/commands/refresh.js +119 -0
- package/lib/sandbox/commands/rm.js +59 -11
- package/lib/sandbox/commands/vm.js +56 -6
- package/lib/sandbox/config.js +9 -5
- package/lib/sandbox/constants.js +18 -3
- package/lib/sandbox/credentials.js +520 -0
- package/lib/sandbox/dotfiles.js +189 -0
- package/lib/sandbox/engine.js +135 -157
- package/lib/sandbox/engines/colima.js +79 -0
- package/lib/sandbox/engines/docker-desktop.js +34 -0
- package/lib/sandbox/engines/index.js +27 -0
- package/lib/sandbox/engines/native.js +112 -0
- package/lib/sandbox/engines/orbstack.js +76 -0
- package/lib/sandbox/engines/selinux.js +60 -0
- package/lib/sandbox/engines/wsl2-paths.js +59 -0
- package/lib/sandbox/engines/wsl2.js +72 -0
- package/lib/sandbox/index.js +10 -1
- package/lib/sandbox/runtimes/ai-tools.dockerfile +14 -1
- package/lib/sandbox/runtimes/base.dockerfile +125 -3
- package/lib/sandbox/shell.js +53 -2
- package/lib/sandbox/tools.js +5 -5
- package/package.json +8 -4
- package/templates/.agents/rules/create-issue.en.md +5 -0
- package/templates/.agents/rules/create-issue.github.en.md +176 -0
- package/templates/.agents/rules/create-issue.github.zh-CN.md +176 -0
- package/templates/.agents/rules/create-issue.zh-CN.md +5 -0
- package/templates/.agents/rules/issue-pr-commands.github.en.md +29 -0
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +29 -0
- package/templates/.agents/rules/issue-sync.github.en.md +1 -1
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +1 -1
- package/templates/.agents/rules/milestone-inference.github.en.md +2 -2
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +2 -2
- package/templates/.agents/scripts/{platform-adapters/find-existing-task.github.js → find-existing-task.js} +22 -79
- package/templates/.agents/scripts/platform-adapters/platform-sync.github.js +72 -42
- package/templates/.agents/skills/create-task/SKILL.en.md +69 -11
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +70 -12
- package/templates/.agents/skills/create-task/config/verify.json +6 -1
- package/templates/.agents/skills/implement-task/reference/implementation-rules.en.md +7 -12
- package/templates/.agents/skills/implement-task/reference/implementation-rules.zh-CN.md +7 -12
- package/templates/.agents/skills/import-issue/SKILL.en.md +7 -9
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +7 -9
- package/templates/.agents/skills/refine-task/reference/fix-workflow.en.md +2 -2
- package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +2 -2
- package/templates/.agents/skills/test/SKILL.en.md +45 -6
- package/templates/.agents/skills/test/SKILL.zh-CN.md +45 -6
- package/templates/.agents/scripts/platform-adapters/find-existing-task.js +0 -5
- package/templates/.agents/skills/create-issue/SKILL.en.md +0 -118
- package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +0 -118
- package/templates/.agents/skills/create-issue/config/verify.json +0 -30
- package/templates/.agents/skills/create-issue/reference/label-and-type.en.md +0 -71
- package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +0 -71
- package/templates/.agents/skills/create-issue/reference/template-matching.en.md +0 -17
- package/templates/.agents/skills/create-issue/reference/template-matching.zh-CN.md +0 -17
- package/templates/.claude/commands/create-issue.en.md +0 -8
- package/templates/.claude/commands/create-issue.zh-CN.md +0 -8
- package/templates/.gemini/commands/_project_/create-issue.en.toml +0 -8
- package/templates/.gemini/commands/_project_/create-issue.zh-CN.toml +0 -8
- package/templates/.opencode/commands/create-issue.en.md +0 -11
- package/templates/.opencode/commands/create-issue.zh-CN.md +0 -11
|
@@ -16,31 +16,26 @@
|
|
|
16
16
|
**实现原则**:
|
|
17
17
|
1. **严格遵循方案**:不要偏离技术方案
|
|
18
18
|
2. **按步骤推进**:按计划顺序执行
|
|
19
|
-
3.
|
|
19
|
+
3. **持续测试**:实现过程中持续运行 **smoke 子集**(参见 `test` skill)
|
|
20
20
|
4. **保持简单**:不要加入未计划的功能
|
|
21
21
|
|
|
22
22
|
## 运行测试验证
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
实现过程中:
|
|
25
|
+
- **内循环**:每次修改后运行项目测试的 **smoke 子集**(参见 `test` skill),快速反馈
|
|
26
|
+
- **写实现报告前**:运行 **core 子集**做最终验证,确保进入审查的代码已通过完整的核心测试
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
# 参考 .agents/skills/test/SKILL.md 中的项目测试命令
|
|
28
|
-
# 常见模式:
|
|
29
|
-
# npm test (Node.js)
|
|
30
|
-
# mvn test (Maven)
|
|
31
|
-
# pytest (Python)
|
|
32
|
-
# go test ./... (Go)
|
|
33
|
-
```
|
|
28
|
+
> 项目特定命令请参考 `test` skill;不存在分层 script 的下游项目回退到完整项目测试命令。
|
|
34
29
|
|
|
35
30
|
如果测试失败:
|
|
36
31
|
- 先分析失败原因,并优先修复由本次实现引入的问题
|
|
37
|
-
-
|
|
32
|
+
- 每次修复后重新运行至少 smoke 子集,进入下一轮再升级到 core
|
|
38
33
|
- 只有当失败由外部阻塞、环境缺失或当前任务内无法澄清的需求问题导致时,才允许在不生成实现产物的情况下停止
|
|
39
34
|
|
|
40
35
|
双分支失败处理:
|
|
41
36
|
1. 本次实现引入的失败:
|
|
42
37
|
- 修复由本次实现引入的代码、测试、文档或 fixture 问题
|
|
43
|
-
-
|
|
38
|
+
- 每次修复后重新运行测试(smoke 用于本次修复验证,core 用于本轮整体验证)
|
|
44
39
|
- 持续处理直到所有必需测试通过
|
|
45
40
|
2. 外部阻塞:
|
|
46
41
|
- 确认失败来自缺失环境、无关的上游损坏,或任务范围外的需求不明确
|
|
@@ -28,17 +28,15 @@ Use the Issue title as-is for the task title (preserve the Issue's original lang
|
|
|
28
28
|
- If found, ask the user whether to re-import or continue with the existing task
|
|
29
29
|
- If not found, continue to 2.2
|
|
30
30
|
|
|
31
|
-
2.2
|
|
31
|
+
2.2 Use the "historical task comment scan" command in `.agents/rules/issue-pr-commands.md` to scan Issue comments for sync markers and look for a recoverable historical task ID.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
This command depends on `$upstream_repo` being set in step 1.
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
node .agents/scripts/platform-adapters/find-existing-task.js --issue <issue-number> --repo "$upstream_repo" --format json
|
|
37
|
-
```
|
|
35
|
+
Exit code handling for the whole pipeline:
|
|
38
36
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
37
|
+
- Exit 0 + output `found=false`: create a new task through the normal import flow
|
|
38
|
+
- Exit 0 + output `found=true`: reuse `task_id`
|
|
39
|
+
- Non-zero exit (platform API, authentication, JSON parsing, or any pipeline segment failure): treat it as platform API degradation; show stderr to the user, then continue with the new-task import flow without blocking
|
|
42
40
|
|
|
43
41
|
### 3. Create the Task Directory and File
|
|
44
42
|
|
|
@@ -108,7 +106,7 @@ If task.md contains a valid `issue_number`, use the Issue update command from `.
|
|
|
108
106
|
|
|
109
107
|
If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
|
|
110
108
|
- Read `.agents/rules/issue-sync.md` before syncing, and complete upstream repository detection plus permission detection
|
|
111
|
-
- Check the Issue's current milestone; if it is unset, read `.agents/rules/milestone-inference.md` and infer plus set the milestone using "
|
|
109
|
+
- Check the Issue's current milestone; if it is unset, read `.agents/rules/milestone-inference.md` and infer plus set the milestone using "Phase 1: `create-task` (when the platform rule creates an Issue)". If `has_triage=false` or the inference is uncertain, skip and continue
|
|
112
110
|
- After every scenario, task comment sync is mandatory: create or update the task comment marker defined in `.agents/rules/issue-sync.md` so the remote `:task` comment exists and matches the local `task.md` content (follow the task.md comment sync rule in issue-sync.md)
|
|
113
111
|
|
|
114
112
|
### 7. Verification Gate
|
|
@@ -28,17 +28,15 @@ description: "从 Issue 导入并创建任务"
|
|
|
28
28
|
- 如果找到,询问用户是重新导入还是继续使用现有任务
|
|
29
29
|
- 如果未找到,继续执行 2.2
|
|
30
30
|
|
|
31
|
-
2.2
|
|
31
|
+
2.2 按 `.agents/rules/issue-pr-commands.md` 的“历史任务评论扫描”命令扫描 Issue 评论中的同步标记,查找可恢复的历史任务 ID。
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
该命令依赖步骤 1 已设置的 `$upstream_repo`。
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
node .agents/scripts/platform-adapters/find-existing-task.js --issue <issue-number> --repo "$upstream_repo" --format json
|
|
37
|
-
```
|
|
35
|
+
退出码处理(pipeline 整体):
|
|
38
36
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
37
|
+
- 退出 0 + 输出 `found=false`:按新 Issue 导入流程创建新任务
|
|
38
|
+
- 退出 0 + 输出 `found=true`:复用 `task_id`
|
|
39
|
+
- 退出非 0(平台 API、认证、JSON 解析或任一段管道异常):视为 platform API 降级,向用户展示 stderr 后按新 Issue 导入流程继续,不阻塞导入
|
|
42
40
|
|
|
43
41
|
### 3. 创建任务目录和文件
|
|
44
42
|
|
|
@@ -108,7 +106,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
|
|
|
108
106
|
|
|
109
107
|
如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
|
|
110
108
|
- 执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测
|
|
111
|
-
- 检查 Issue 当前 milestone;如果未设置,先读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 1:`create-
|
|
109
|
+
- 检查 Issue 当前 milestone;如果未设置,先读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 1:`create-task`(平台规则创建 Issue 时)」规则推断并设置 milestone;如果 `has_triage=false` 或推断不确定,跳过并继续
|
|
112
110
|
- 所有场景结束后,必须执行一次 task 留言同步,创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记,确保远端 `:task` 评论存在且内容与本地 `task.md` 一致(按 issue-sync.md 的 task.md 评论同步规则)
|
|
113
111
|
|
|
114
112
|
### 7. 完成校验
|
|
@@ -26,11 +26,11 @@ For each fix:
|
|
|
26
26
|
1. read the affected files
|
|
27
27
|
2. apply the smallest necessary change
|
|
28
28
|
3. verify the change addresses the review feedback
|
|
29
|
-
4. run the
|
|
29
|
+
4. run the project's **smoke subset** for immediate feedback (see the `test` skill)
|
|
30
30
|
|
|
31
31
|
## Run Test Verification
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Before writing the refinement report, run the project's **core subset** as final verification and confirm that all required tests still pass. If the project does not have layered scripts, fall back to the full project test command.
|
|
34
34
|
|
|
35
35
|
## Choose the Next-Step Branch
|
|
36
36
|
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
1. 读取受影响文件
|
|
27
27
|
2. 施加最小必要改动
|
|
28
28
|
3. 验证改动确实解决了审查反馈
|
|
29
|
-
4.
|
|
29
|
+
4. 运行项目测试的 **smoke 子集**做即时反馈(参见 `test` skill)
|
|
30
30
|
|
|
31
31
|
## 运行测试验证
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
写 refinement 报告前,运行项目测试的 **core 子集**做最终验证,确保所有必需测试仍然通过。如果项目没有分层 script,回退到完整项目测试命令。
|
|
34
34
|
|
|
35
35
|
## 选择下一步分支
|
|
36
36
|
|
|
@@ -21,16 +21,55 @@ Execute the project's full test workflow including compilation checks and unit t
|
|
|
21
21
|
|
|
22
22
|
Confirm no compilation errors.
|
|
23
23
|
|
|
24
|
-
## 2. Run
|
|
24
|
+
## 2. Run Unit Tests by Layer
|
|
25
|
+
|
|
26
|
+
This project uses three test layers as an optional optimization; if the test suite is small, all layers may map to the same full test command.
|
|
27
|
+
|
|
28
|
+
### smoke (target <5s)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# TODO: Replace with this project's smoke subset command
|
|
32
|
+
# npm run test:smoke (Node.js)
|
|
33
|
+
# pytest -m "not slow" (Python)
|
|
34
|
+
# go test -short ./... (Go)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use for:
|
|
38
|
+
- implement-task / refine-task inner loops
|
|
39
|
+
- save-and-run / frequent feedback
|
|
40
|
+
- project structure, configuration, and template contract checks
|
|
41
|
+
|
|
42
|
+
### core (target <15s)
|
|
25
43
|
|
|
26
44
|
```bash
|
|
27
|
-
# TODO: Replace with
|
|
28
|
-
# npm test
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
# go test ./... (Go)
|
|
45
|
+
# TODO: Replace with this project's core subset command
|
|
46
|
+
# npm run test:core (Node.js)
|
|
47
|
+
# pytest -m "not contract" (Python)
|
|
48
|
+
# go test ./... (Go)
|
|
32
49
|
```
|
|
33
50
|
|
|
51
|
+
Use for:
|
|
52
|
+
- pre-commit hook (automatic)
|
|
53
|
+
- final verification before writing implementation.md / refinement.md
|
|
54
|
+
- local gate before pushing a PR
|
|
55
|
+
|
|
56
|
+
### full (complete test suite)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# TODO: Replace with this project's full test command
|
|
60
|
+
# npm test (Node.js)
|
|
61
|
+
# mvn test (Maven)
|
|
62
|
+
# pytest (Python)
|
|
63
|
+
# go test ./... (Go)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Use for:
|
|
67
|
+
- before release / tag
|
|
68
|
+
- CI
|
|
69
|
+
- final gate before merging to main
|
|
70
|
+
|
|
71
|
+
If the project is not layered yet, smoke / core / full may all map to the same full test command; layering is a feedback-speed optimization, not a prerequisite for using the collaboration workflow.
|
|
72
|
+
|
|
34
73
|
## 3. Output Results
|
|
35
74
|
|
|
36
75
|
Report test result summary:
|
|
@@ -21,16 +21,55 @@ description: "执行项目完整测试流程"
|
|
|
21
21
|
|
|
22
22
|
确认无编译错误。
|
|
23
23
|
|
|
24
|
-
## 2.
|
|
24
|
+
## 2. 运行单元测试(按层级选择)
|
|
25
|
+
|
|
26
|
+
本项目把测试分为三层(可选优化);如果项目测试规模较小,可以全部映射到同一个完整测试命令。
|
|
27
|
+
|
|
28
|
+
### smoke(目标 <5s)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# TODO: 替换为本项目的 smoke 子集命令
|
|
32
|
+
# npm run test:smoke (Node.js)
|
|
33
|
+
# pytest -m "not slow" (Python)
|
|
34
|
+
# go test -short ./... (Go)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
适用场景:
|
|
38
|
+
- implement-task / refine-task 内循环
|
|
39
|
+
- 保存即跑 / 频繁反馈
|
|
40
|
+
- 仅断言项目结构、配置、模板契约
|
|
41
|
+
|
|
42
|
+
### core(目标 <15s)
|
|
25
43
|
|
|
26
44
|
```bash
|
|
27
|
-
# TODO:
|
|
28
|
-
# npm test
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
# go test ./... (Go)
|
|
45
|
+
# TODO: 替换为本项目的 core 子集命令
|
|
46
|
+
# npm run test:core (Node.js)
|
|
47
|
+
# pytest -m "not contract" (Python)
|
|
48
|
+
# go test ./... (Go)
|
|
32
49
|
```
|
|
33
50
|
|
|
51
|
+
适用场景:
|
|
52
|
+
- pre-commit hook(自动调用)
|
|
53
|
+
- 写 implementation.md / refinement.md 报告前的最终验证
|
|
54
|
+
- 推送 PR 前的本地把关
|
|
55
|
+
|
|
56
|
+
### full(完整测试)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# TODO: 替换为本项目的完整测试命令
|
|
60
|
+
# npm test (Node.js)
|
|
61
|
+
# mvn test (Maven)
|
|
62
|
+
# pytest (Python)
|
|
63
|
+
# go test ./... (Go)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
适用场景:
|
|
67
|
+
- release / tag 前
|
|
68
|
+
- CI
|
|
69
|
+
- main 合并前的最终把关
|
|
70
|
+
|
|
71
|
+
如果项目暂不分层,smoke / core / full 可以全部映射到同一个完整测试命令;分层是反馈速度优化项,不是使用协作工作流的前置条件。
|
|
72
|
+
|
|
34
73
|
## 3. 输出结果
|
|
35
74
|
|
|
36
75
|
报告测试结果摘要:
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-issue
|
|
3
|
-
description: "Create an Issue from a task file"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Create Issue
|
|
7
|
-
|
|
8
|
-
Create the base Issue from `task.md` and write `issue_number` back to the task.
|
|
9
|
-
|
|
10
|
-
## Boundary / Critical Rules
|
|
11
|
-
|
|
12
|
-
- Build the Issue title and body from `task.md` only
|
|
13
|
-
- Issue title format: `type(scope): description` - map `type` from task.md (`feature` -> `feat`, `bugfix` -> `fix`, `refactor` -> `refactor`, `docs` -> `docs`, `chore` -> `chore`), infer scope from the affected module (omit it if unclear), and use the task title from task.md verbatim for the description (do not translate or rewrite)
|
|
14
|
-
- Do not read `analysis.md`, `plan.md`, `implementation.md`, or review artifacts
|
|
15
|
-
- The only durable outputs are the Issue and the `issue_number` update in task.md
|
|
16
|
-
- After executing this skill, you **must** immediately update task.md
|
|
17
|
-
|
|
18
|
-
## Steps
|
|
19
|
-
|
|
20
|
-
### 1. Verify Prerequisites
|
|
21
|
-
|
|
22
|
-
Check:
|
|
23
|
-
- `.agents/workspace/active/{task-id}/task.md`
|
|
24
|
-
- read `.agents/rules/issue-pr-commands.md` first, then follow its prerequisite steps to complete authentication and code-hosting platform detection
|
|
25
|
-
|
|
26
|
-
If `issue_number` already exists and is not empty or `N/A`, confirm with the user before creating a replacement Issue.
|
|
27
|
-
|
|
28
|
-
### 2. Extract Task Information
|
|
29
|
-
|
|
30
|
-
Extract the title, `## Description`, `## Requirements`, `type`, and `milestone` from task.md. Build the Issue title by mapping task.md `type` to a Conventional Commits type, inferring scope, and formatting it as `cc_type(scope): task_title` or `cc_type: task_title` when scope is unclear. If task.md does not provide an explicit `milestone` field, infer it by following "Phase 1: `create-issue`" in `.agents/rules/milestone-inference.md`.
|
|
31
|
-
|
|
32
|
-
### 3. Build Issue Content
|
|
33
|
-
|
|
34
|
-
Detect Issue templates through `.agents/rules/issue-pr-commands.md` and decide whether to use a matched template path or the fallback path.
|
|
35
|
-
|
|
36
|
-
> Template detection, field mapping for `textarea`, `input`, `dropdown`, and `checkboxes`, and the fallback body rules live in `reference/template-matching.md`. Read `reference/template-matching.md` before building the body.
|
|
37
|
-
|
|
38
|
-
> Label filtering, Issue Type fallback, `issue-types` API handling, `milestone` logic, `--milestone`, and `in:` label rules live in `reference/label-and-type.md`. Read `reference/label-and-type.md` before creating the Issue.
|
|
39
|
-
|
|
40
|
-
### 4. Create the Issue
|
|
41
|
-
|
|
42
|
-
Create and enrich the Issue by following the "Create Issue" and "Set the Issue Type" sections in `.agents/rules/issue-pr-commands.md`. Omit label arguments when nothing valid remains.
|
|
43
|
-
|
|
44
|
-
Handle labels, milestone, Issue Type, and assignee behavior by following the permission-degradation rules in `.agents/rules/issue-pr-commands.md` and `.agents/rules/issue-sync.md`.
|
|
45
|
-
|
|
46
|
-
### 5. Update Task Status
|
|
47
|
-
|
|
48
|
-
Get the current time:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
date "+%Y-%m-%d %H:%M:%S%:z"
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Write back `issue_number`, update `updated_at`, and append the Create Issue Activity Log entry.
|
|
55
|
-
|
|
56
|
-
### 5.1 Backfill Existing Artifacts
|
|
57
|
-
|
|
58
|
-
If artifact files already exist in the task directory, backfill them in this order:
|
|
59
|
-
|
|
60
|
-
1. `task.md` -> the task comment marker defined in `.agents/rules/issue-sync.md` (idempotent create or update)
|
|
61
|
-
2. Backfill existing `analysis*.md`, `plan*.md`, `implementation*.md`, `review*.md`, and `refinement*.md` files in filename order
|
|
62
|
-
|
|
63
|
-
Every backfill action must follow the raw publishing, task.md sync, and chunking rules in `.agents/rules/issue-sync.md`.
|
|
64
|
-
|
|
65
|
-
### 6. Verification Gate
|
|
66
|
-
|
|
67
|
-
Run the verification gate to confirm the task artifact and sync state are valid:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
node .agents/scripts/validate-artifact.js gate create-issue .agents/workspace/active/{task-id} --format text
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Handle the result as follows:
|
|
74
|
-
- exit code 0 (all checks passed) -> continue to the "Inform User" step
|
|
75
|
-
- exit code 1 (validation failed) -> fix the reported issues and run the gate again
|
|
76
|
-
- exit code 2 (network blocked) -> stop and tell the user that human intervention is required
|
|
77
|
-
|
|
78
|
-
Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
|
|
79
|
-
|
|
80
|
-
### 7. Inform User
|
|
81
|
-
|
|
82
|
-
> Execute this step only after the verification gate passes.
|
|
83
|
-
|
|
84
|
-
> **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent. If `.agents/.airc.json` configures custom TUIs (via `customTUIs`), read each tool's `name` and `invoke`, then add the matching command line in the same format (`${skillName}` becomes the skill name and `${projectName}` becomes the project name).
|
|
85
|
-
|
|
86
|
-
Show the Issue number, URL, labels, Issue Type, milestone result, confirm that `issue_number` was written back, and include the next-step commands in every TUI format:
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
Next step - run requirements analysis:
|
|
90
|
-
- Claude Code / OpenCode: /analyze-task {task-id}
|
|
91
|
-
- Gemini CLI: /{{project}}:analyze-task {task-id}
|
|
92
|
-
- Codex CLI: $analyze-task {task-id}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Completion Checklist
|
|
96
|
-
|
|
97
|
-
- [ ] Created the Issue
|
|
98
|
-
- [ ] Used `task.md` as the only content source
|
|
99
|
-
- [ ] Recorded `issue_number` in task.md
|
|
100
|
-
- [ ] Updated `updated_at` and appended the Activity Log entry
|
|
101
|
-
- [ ] Included all TUI formats, including any custom TUIs, for the next-step commands
|
|
102
|
-
|
|
103
|
-
## STOP
|
|
104
|
-
|
|
105
|
-
Stop after the checklist. Do not start detailed progress sync here.
|
|
106
|
-
|
|
107
|
-
## Notes
|
|
108
|
-
|
|
109
|
-
- `create-issue` creates the base Issue; later status, comments, and checkboxes are maintained by workflow skills and platform automation
|
|
110
|
-
- If no valid labels survive filtering, create the Issue without labels instead of failing
|
|
111
|
-
- If Issue Type or milestone setup fails, continue and record the fallback outcome
|
|
112
|
-
|
|
113
|
-
## Error Handling
|
|
114
|
-
|
|
115
|
-
- Task not found: `Task {task-id} not found`
|
|
116
|
-
- the platform CLI unavailable or unauthenticated
|
|
117
|
-
- Empty description in task.md
|
|
118
|
-
- Issue creation failure
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-issue
|
|
3
|
-
description: "从任务文件创建 Issue"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 创建 Issue
|
|
7
|
-
|
|
8
|
-
仅从 `task.md` 创建基础 Issue,并把 `issue_number` 回写到任务文件。
|
|
9
|
-
|
|
10
|
-
## 行为边界 / 关键规则
|
|
11
|
-
|
|
12
|
-
- Issue 标题和正文只能来自 `task.md`
|
|
13
|
-
- Issue 标题格式为 `type(scope): 描述`——type 从 task.md 的 `type` 字段映射(feature→feat, bugfix→fix, refactor→refactor, docs→docs, chore→chore),scope 从受影响模块推断(无法确定时省略),描述使用 task.md 中的任务标题原文(不要翻译或改写)
|
|
14
|
-
- 不要读取 `analysis.md`、`plan.md`、`implementation.md` 或审查产物
|
|
15
|
-
- 持久产物只有 Issue 本身,以及 task.md 中的 `issue_number` 更新
|
|
16
|
-
- 执行本技能后,你**必须**立即更新 task.md
|
|
17
|
-
|
|
18
|
-
## 执行步骤
|
|
19
|
-
|
|
20
|
-
### 1. 验证前置条件
|
|
21
|
-
|
|
22
|
-
检查:
|
|
23
|
-
- `.agents/workspace/active/{task-id}/task.md`
|
|
24
|
-
- 执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的前置步骤完成认证和代码托管平台检测
|
|
25
|
-
|
|
26
|
-
如果 `issue_number` 已存在且既不为空也不为 `N/A`,创建前必须先与用户确认。
|
|
27
|
-
|
|
28
|
-
### 2. 提取任务信息
|
|
29
|
-
|
|
30
|
-
从 task.md 提取标题、`## Description`、`## Requirements`、`type` 和 `milestone`。构造 Issue 标题:将 task.md 的 `type` 映射为 Conventional Commits type,推断 scope,拼接为 `cc_type(scope): task_title` 或 `cc_type: task_title`(scope 不确定时省略)。如果 task.md 没有显式 `milestone` 字段,按 `.agents/rules/milestone-inference.md` 的「阶段 1:`create-issue`」推断。
|
|
31
|
-
|
|
32
|
-
### 3. 构建 Issue 内容
|
|
33
|
-
|
|
34
|
-
通过 `.agents/rules/issue-pr-commands.md` 检测 Issue 模板,决定使用模板路径还是 fallback 路径。
|
|
35
|
-
|
|
36
|
-
> 模板识别、`textarea`、`input`、`dropdown`、`checkboxes` 字段映射,以及 fallback 正文规则见 `reference/template-matching.md`。构建正文前先读取 `reference/template-matching.md`。
|
|
37
|
-
|
|
38
|
-
> `labels:` 过滤、Issue Type fallback、`issue-types` API、`milestone` 逻辑、`--milestone` 和 `in:` label 规则见 `reference/label-and-type.md`。创建 Issue 前先读取 `reference/label-and-type.md`。
|
|
39
|
-
|
|
40
|
-
### 4. 创建 Issue
|
|
41
|
-
|
|
42
|
-
按 `.agents/rules/issue-pr-commands.md` 中的 “创建 Issue” 与 “Issue Type 设置” 规则创建并补充 Issue;如果没有有效 label,就省略 label 参数。
|
|
43
|
-
|
|
44
|
-
Label、milestone、Issue Type 和 assignee 的具体处理方式,都按 `.agents/rules/issue-pr-commands.md` 与 `.agents/rules/issue-sync.md` 中的权限降级规则执行。
|
|
45
|
-
|
|
46
|
-
### 5. 更新任务状态
|
|
47
|
-
|
|
48
|
-
获取当前时间:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
date "+%Y-%m-%d %H:%M:%S%:z"
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
回写 `issue_number`,更新 `updated_at`,并追加 Create Issue 的 Activity Log。
|
|
55
|
-
|
|
56
|
-
### 5.1 补发已有产物
|
|
57
|
-
|
|
58
|
-
如果任务目录中已存在产物文件,按以下顺序补发:
|
|
59
|
-
|
|
60
|
-
1. `task.md` → `.agents/rules/issue-sync.md` 中定义的 task 评论标记(幂等创建或更新)
|
|
61
|
-
2. 按文件名排序补发已存在的 `analysis*.md`、`plan*.md`、`implementation*.md`、`review*.md`、`refinement*.md`
|
|
62
|
-
|
|
63
|
-
所有补发动作都必须遵循 `.agents/rules/issue-sync.md` 的原文发布、task.md 同步和分片规则。
|
|
64
|
-
|
|
65
|
-
### 6. 完成校验
|
|
66
|
-
|
|
67
|
-
运行完成校验,确认任务产物和同步状态符合规范:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
node .agents/scripts/validate-artifact.js gate create-issue .agents/workspace/active/{task-id} --format text
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
处理结果:
|
|
74
|
-
- 退出码 0(全部通过)-> 继续到「告知用户」步骤
|
|
75
|
-
- 退出码 1(校验失败)-> 根据输出修复问题后重新运行校验
|
|
76
|
-
- 退出码 2(网络中断)-> 停止执行并告知用户需要人工介入
|
|
77
|
-
|
|
78
|
-
将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
|
|
79
|
-
|
|
80
|
-
### 7. 告知用户
|
|
81
|
-
|
|
82
|
-
> 仅在校验通过后执行本步骤。
|
|
83
|
-
|
|
84
|
-
> **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。如果 `.agents/.airc.json` 中配置了自定义 TUI(`customTUIs`),读取每个工具的 `name` 和 `invoke`,按同样格式补充对应命令行(`${skillName}` 替换为技能名,`${projectName}` 替换为项目名)。
|
|
85
|
-
|
|
86
|
-
展示 Issue 编号、URL、labels、Issue Type、milestone 结果,确认 `issue_number` 已回写,并完整输出所有 TUI 里的下一步命令:
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
下一步 - 执行需求分析:
|
|
90
|
-
- Claude Code / OpenCode:/analyze-task {task-id}
|
|
91
|
-
- Gemini CLI:/agent-infra:analyze-task {task-id}
|
|
92
|
-
- Codex CLI:$analyze-task {task-id}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## 完成检查清单
|
|
96
|
-
|
|
97
|
-
- [ ] 已创建 Issue
|
|
98
|
-
- [ ] 已仅使用 `task.md` 作为内容来源
|
|
99
|
-
- [ ] 已在 task.md 中记录 `issue_number`
|
|
100
|
-
- [ ] 已更新 `updated_at` 并追加 Activity Log
|
|
101
|
-
- [ ] 已输出所有 TUI 格式的下一步命令(含自定义 TUI)
|
|
102
|
-
|
|
103
|
-
## 停止
|
|
104
|
-
|
|
105
|
-
完成检查清单后立即停止。不要在本技能里继续做详细进度同步。
|
|
106
|
-
|
|
107
|
-
## 注意事项
|
|
108
|
-
|
|
109
|
-
- `create-issue` 只负责创建基础 Issue;后续状态、评论和复选框由工作流技能与 platform automation 维护
|
|
110
|
-
- 如果过滤后没有有效 label,允许不带 label 创建 Issue
|
|
111
|
-
- 如果 Issue Type 或 milestone 设置失败,继续执行并记录结果
|
|
112
|
-
|
|
113
|
-
## 错误处理
|
|
114
|
-
|
|
115
|
-
- 任务未找到:`Task {task-id} not found`
|
|
116
|
-
- the platform CLI 不可用或未认证
|
|
117
|
-
- task.md 的描述为空
|
|
118
|
-
- 创建 Issue 失败
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"skill": "create-issue",
|
|
3
|
-
"checks": {
|
|
4
|
-
"task-meta": {
|
|
5
|
-
"required_fields": [
|
|
6
|
-
"id",
|
|
7
|
-
"type",
|
|
8
|
-
"workflow",
|
|
9
|
-
"status",
|
|
10
|
-
"created_at",
|
|
11
|
-
"updated_at",
|
|
12
|
-
"current_step",
|
|
13
|
-
"assigned_to"
|
|
14
|
-
],
|
|
15
|
-
"require_issue_number": true
|
|
16
|
-
},
|
|
17
|
-
"activity-log": {
|
|
18
|
-
"expected_action_pattern": "Create Issue",
|
|
19
|
-
"freshness_minutes": 30
|
|
20
|
-
},
|
|
21
|
-
"platform-sync": {
|
|
22
|
-
"when": "issue_number_exists",
|
|
23
|
-
"issue_must_exist": true,
|
|
24
|
-
"verify_task_comment_content": true,
|
|
25
|
-
"verify_issue_type": true,
|
|
26
|
-
"verify_milestone": true,
|
|
27
|
-
"expected_status_label_key": "waitingForTriage"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# Labels, Issue Type, and Milestone Rules
|
|
2
|
-
|
|
3
|
-
Read this file before applying labels, Issue Type, milestone, or `in:` labels.
|
|
4
|
-
|
|
5
|
-
## Default Body Format (Fallback)
|
|
6
|
-
|
|
7
|
-
Recommended fallback:
|
|
8
|
-
|
|
9
|
-
```markdown
|
|
10
|
-
## Description
|
|
11
|
-
|
|
12
|
-
{task-description}
|
|
13
|
-
|
|
14
|
-
## Requirements
|
|
15
|
-
|
|
16
|
-
- [ ] {requirement-1}
|
|
17
|
-
- [ ] {requirement-2}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Map task types to labels and Issue Types, but keep only labels that actually exist.
|
|
21
|
-
|
|
22
|
-
Fallback label mapping:
|
|
23
|
-
|
|
24
|
-
| task.md type | label |
|
|
25
|
-
|---|---|
|
|
26
|
-
| `bug`, `bugfix` | `type: bug` |
|
|
27
|
-
| `feature` | `type: feature` |
|
|
28
|
-
| `enhancement` | `type: enhancement` |
|
|
29
|
-
| `docs`, `documentation` | `type: documentation` |
|
|
30
|
-
| `dependency-upgrade` | `type: dependency-upgrade` |
|
|
31
|
-
| `task`, `chore` | `type: task` |
|
|
32
|
-
| `refactor`, `refactoring` | `type: enhancement` |
|
|
33
|
-
| other values | skip |
|
|
34
|
-
|
|
35
|
-
Issue Type fallback mapping:
|
|
36
|
-
|
|
37
|
-
| task.md type | Issue Type |
|
|
38
|
-
|---|---|
|
|
39
|
-
| `bug`, `bugfix` | `Bug` |
|
|
40
|
-
| `feature`, `enhancement` | `Feature` |
|
|
41
|
-
| `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring`, and all other values | `Task` |
|
|
42
|
-
|
|
43
|
-
## Create the Issue
|
|
44
|
-
|
|
45
|
-
Before creating the Issue, read `.agents/rules/issue-pr-commands.md` and use its "Create an Issue" command template.
|
|
46
|
-
|
|
47
|
-
Before calling the creation command, follow `.agents/rules/issue-sync.md` / `.agents/rules/issue-pr-commands.md` to complete the prerequisite authentication and code-hosting platform detection steps.
|
|
48
|
-
|
|
49
|
-
If no valid labels remain, omit label arguments.
|
|
50
|
-
|
|
51
|
-
For milestone inference, read `.agents/rules/milestone-inference.md` and follow "Phase 1: `create-issue`" before creating the Issue.
|
|
52
|
-
|
|
53
|
-
Issue Type setup follows the matching commands in `.agents/rules/issue-pr-commands.md`.
|
|
54
|
-
|
|
55
|
-
- handle direct writes for labels, milestones, `in:` labels, and Issue Type by following the permission-degradation rules in `.agents/rules/issue-pr-commands.md` and `.agents/rules/issue-sync.md`
|
|
56
|
-
- when those rules say to skip a direct write, continue without failing Issue creation
|
|
57
|
-
|
|
58
|
-
`in:` labels (coarse selection):
|
|
59
|
-
|
|
60
|
-
Prepare label edit arguments by following the Issue update command in `.agents/rules/issue-pr-commands.md`.
|
|
61
|
-
|
|
62
|
-
Use the returned labels to do semantic matching against the task.md title and description:
|
|
63
|
-
- add a label when the task **explicitly mentions** a module (for example, "fix CLI argument parsing" -> `in: cli`)
|
|
64
|
-
- add a label when the task **strongly implies** a module
|
|
65
|
-
- skip the label when the mapping is ambiguous or uncertain
|
|
66
|
-
|
|
67
|
-
Principle: prefer missing labels over wrong labels. Coarse selection does not need to be perfect because implement-task / create-pr will refine `in:` labels from actual changed files later.
|
|
68
|
-
|
|
69
|
-
Handle relevant `in:` labels by following the permission-degradation rules in `.agents/rules/issue-sync.md`. Do not fail Issue creation when `in:` labels are unavailable, irrelevant, or skipped by those rules.
|
|
70
|
-
|
|
71
|
-
Skip unavailable labels, Issue Types, or milestones without failing the Issue creation flow.
|