@fitlab-ai/agent-infra 0.4.1 → 0.4.3

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.
Files changed (142) hide show
  1. package/README.md +44 -44
  2. package/README.zh-CN.md +44 -44
  3. package/lib/defaults.json +7 -9
  4. package/lib/init.js +1 -0
  5. package/lib/update.js +13 -1
  6. package/package.json +3 -3
  7. package/templates/.agents/QUICKSTART.md +7 -7
  8. package/templates/.agents/QUICKSTART.zh-CN.md +13 -13
  9. package/templates/.agents/README.md +31 -18
  10. package/templates/.agents/README.zh-CN.md +33 -20
  11. package/templates/.agents/rules/issue-sync.md +185 -0
  12. package/templates/.agents/rules/issue-sync.zh-CN.md +185 -0
  13. package/templates/.agents/scripts/validate-artifact.js +1280 -0
  14. package/templates/.agents/skills/analyze-task/SKILL.md +24 -1
  15. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +24 -1
  16. package/templates/.agents/skills/analyze-task/config/verify.json +41 -0
  17. package/templates/.agents/skills/archive-tasks/SKILL.md +40 -0
  18. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +40 -0
  19. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +403 -0
  20. package/templates/.agents/skills/block-task/SKILL.md +25 -37
  21. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +25 -37
  22. package/templates/.agents/skills/block-task/config/verify.json +28 -0
  23. package/templates/.agents/skills/close-codescan/SKILL.md +7 -0
  24. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +7 -0
  25. package/templates/.agents/skills/close-dependabot/SKILL.md +7 -0
  26. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +7 -0
  27. package/templates/.agents/skills/commit/SKILL.md +17 -0
  28. package/templates/.agents/skills/commit/SKILL.zh-CN.md +17 -0
  29. package/templates/.agents/skills/commit/config/verify.json +22 -0
  30. package/templates/.agents/skills/commit/reference/task-status-update.md +3 -3
  31. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +3 -3
  32. package/templates/.agents/skills/complete-task/SKILL.md +24 -10
  33. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +24 -10
  34. package/templates/.agents/skills/complete-task/config/verify.json +30 -0
  35. package/templates/.agents/skills/create-issue/SKILL.md +41 -5
  36. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +41 -5
  37. package/templates/.agents/skills/create-issue/config/verify.json +27 -0
  38. package/templates/.agents/skills/create-issue/reference/label-and-type.md +10 -11
  39. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +10 -11
  40. package/templates/.agents/skills/create-pr/SKILL.md +59 -16
  41. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +59 -16
  42. package/templates/.agents/skills/create-pr/config/verify.json +26 -0
  43. package/templates/.agents/skills/create-pr/reference/branch-strategy.md +3 -3
  44. package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +3 -3
  45. package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.md +6 -6
  46. package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.zh-CN.md +10 -10
  47. package/templates/.agents/skills/create-pr/reference/pr-body-template.md +15 -6
  48. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +15 -6
  49. package/templates/.agents/skills/create-task/SKILL.md +25 -3
  50. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +25 -3
  51. package/templates/.agents/skills/create-task/config/verify.json +24 -0
  52. package/templates/.agents/skills/implement-task/SKILL.md +44 -8
  53. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +44 -8
  54. package/templates/.agents/skills/implement-task/config/verify.json +41 -0
  55. package/templates/.agents/skills/implement-task/reference/branch-management.md +48 -0
  56. package/templates/.agents/skills/implement-task/reference/branch-management.zh-CN.md +49 -0
  57. package/templates/.agents/skills/implement-task/reference/output-template.md +20 -0
  58. package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +20 -0
  59. package/templates/.agents/skills/import-codescan/SKILL.md +18 -7
  60. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +18 -7
  61. package/templates/.agents/skills/import-codescan/config/verify.json +24 -0
  62. package/templates/.agents/skills/import-dependabot/SKILL.md +18 -7
  63. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +18 -7
  64. package/templates/.agents/skills/import-dependabot/config/verify.json +24 -0
  65. package/templates/.agents/skills/import-issue/SKILL.md +19 -1
  66. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +19 -1
  67. package/templates/.agents/skills/import-issue/config/verify.json +27 -0
  68. package/templates/.agents/skills/init-labels/SKILL.md +40 -10
  69. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +40 -10
  70. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +1 -22
  71. package/templates/.agents/skills/init-milestones/SKILL.md +13 -0
  72. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +13 -0
  73. package/templates/.agents/skills/plan-task/SKILL.md +29 -75
  74. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +29 -75
  75. package/templates/.agents/skills/plan-task/config/verify.json +42 -0
  76. package/templates/.agents/skills/refine-task/SKILL.md +51 -4
  77. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +51 -4
  78. package/templates/.agents/skills/refine-task/config/verify.json +37 -0
  79. package/templates/.agents/skills/refine-title/SKILL.md +10 -2
  80. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +10 -2
  81. package/templates/.agents/skills/restore-task/SKILL.md +159 -0
  82. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +159 -0
  83. package/templates/.agents/skills/restore-task/config/verify.json +24 -0
  84. package/templates/.agents/skills/review-task/SKILL.md +25 -1
  85. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +25 -1
  86. package/templates/.agents/skills/review-task/config/verify.json +40 -0
  87. package/templates/.agents/skills/update-agent-infra/SKILL.md +11 -0
  88. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +11 -0
  89. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +8 -10
  90. package/templates/.claude/commands/archive-tasks.md +9 -0
  91. package/templates/.claude/commands/archive-tasks.zh-CN.md +9 -0
  92. package/templates/.claude/commands/create-pr.md +1 -1
  93. package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
  94. package/templates/.claude/commands/restore-task.md +9 -0
  95. package/templates/.claude/commands/restore-task.zh-CN.md +9 -0
  96. package/templates/.gemini/commands/_project_/archive-tasks.toml +10 -0
  97. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +10 -0
  98. package/templates/.gemini/commands/_project_/restore-task.toml +8 -0
  99. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +8 -0
  100. package/templates/.github/workflows/status-label.yml +82 -0
  101. package/templates/.opencode/commands/archive-tasks.md +11 -0
  102. package/templates/.opencode/commands/archive-tasks.zh-CN.md +11 -0
  103. package/templates/.opencode/commands/restore-task.md +11 -0
  104. package/templates/.opencode/commands/restore-task.zh-CN.md +11 -0
  105. package/templates/.agents/skills/sync-issue/SKILL.md +0 -91
  106. package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +0 -91
  107. package/templates/.agents/skills/sync-issue/reference/comment-publish.md +0 -88
  108. package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +0 -88
  109. package/templates/.agents/skills/sync-issue/reference/delivery-detection.md +0 -42
  110. package/templates/.agents/skills/sync-issue/reference/delivery-detection.zh-CN.md +0 -42
  111. package/templates/.agents/skills/sync-issue/reference/label-sync.md +0 -63
  112. package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +0 -63
  113. package/templates/.agents/skills/sync-issue/reference/milestone-sync.md +0 -37
  114. package/templates/.agents/skills/sync-issue/reference/milestone-sync.zh-CN.md +0 -37
  115. package/templates/.agents/skills/sync-pr/SKILL.md +0 -72
  116. package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +0 -72
  117. package/templates/.agents/skills/sync-pr/reference/delivery-detection.md +0 -54
  118. package/templates/.agents/skills/sync-pr/reference/delivery-detection.zh-CN.md +0 -54
  119. package/templates/.claude/CLAUDE.md +0 -138
  120. package/templates/.claude/CLAUDE.zh-CN.md +0 -138
  121. package/templates/.claude/commands/sync-issue.md +0 -8
  122. package/templates/.claude/commands/sync-issue.zh-CN.md +0 -8
  123. package/templates/.claude/commands/sync-pr.md +0 -8
  124. package/templates/.claude/commands/sync-pr.zh-CN.md +0 -8
  125. package/templates/.claude/project-rules.md +0 -65
  126. package/templates/.claude/project-rules.zh-CN.md +0 -65
  127. package/templates/.codex/README.md +0 -38
  128. package/templates/.codex/README.zh-CN.md +0 -37
  129. package/templates/.gemini/commands/_project_/sync-issue.toml +0 -8
  130. package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +0 -8
  131. package/templates/.gemini/commands/_project_/sync-pr.toml +0 -8
  132. package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +0 -8
  133. package/templates/.opencode/COMMAND_STYLE_GUIDE.md +0 -232
  134. package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +0 -232
  135. package/templates/.opencode/README.md +0 -76
  136. package/templates/.opencode/README.zh-CN.md +0 -77
  137. package/templates/.opencode/commands/sync-issue.md +0 -11
  138. package/templates/.opencode/commands/sync-issue.zh-CN.md +0 -11
  139. package/templates/.opencode/commands/sync-pr.md +0 -11
  140. package/templates/.opencode/commands/sync-pr.zh-CN.md +0 -11
  141. package/templates/AGENTS.md +0 -112
  142. package/templates/AGENTS.zh-CN.md +0 -112
@@ -1,42 +0,0 @@
1
- # Delivery Detection
2
-
3
- Read this file before deciding whether the task is completed, in PR stage, or still in development.
4
-
5
- ## Detect Delivery Status
6
-
7
- Resolve repository coordinates first:
8
-
9
- ```bash
10
- repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
11
- owner="${repo%%/*}"
12
- repo_url="https://github.com/$repo"
13
- ```
14
-
15
- Delivery checks:
16
- - extract the last commit hash from `**Commit** by` in Activity Log
17
- - inspect protected branches with `git branch -a --contains {commit-hash} 2>/dev/null`
18
- - inspect PR state with `gh pr view {pr-number} --json state,mergedAt`
19
-
20
- Protected branch matching rules:
21
- - output contains `main` or `master` -> treat as protected mainline
22
- - output matches `{major}.{minor}.x` -> treat as a protected release line
23
- - otherwise -> not on a protected branch
24
-
25
- Scenario decision matrix:
26
-
27
- | Condition | Scenario |
28
- |---|---|
29
- | commit is already on a protected branch | Scenario A: Completed |
30
- | PR exists and its state is `OPEN` or `MERGED` | Scenario B: PR stage |
31
- | all other cases | Scenario C: In development |
32
-
33
- Scenario priority:
34
- - Scenario A: Completed
35
- - Scenario B: PR stage
36
- - Scenario C: In development
37
-
38
- Priority rule: `Scenario A > Scenario B > Scenario C`. Even if a PR exists, once the commit is on `main`, `master`, or `{major}.{minor}.x`, report the task as completed.
39
-
40
- Absolute links must use:
41
- - `https://github.com/{owner}/{repo}/commit/{commit-hash}`
42
- - `https://github.com/{owner}/{repo}/pull/{pr-number}`
@@ -1,42 +0,0 @@
1
- # 交付状态探测
2
-
3
- 在判断任务是已完成、处于 PR 阶段还是仍在开发中之前先读取本文件。
4
-
5
- ## 探测交付状态
6
-
7
- 先解析仓库坐标:
8
-
9
- ```bash
10
- repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
11
- owner="${repo%%/*}"
12
- repo_url="https://github.com/$repo"
13
- ```
14
-
15
- 交付状态检查:
16
- - 从 Activity Log 中的 `**Commit** by` 提取最后一个 commit hash
17
- - 用 `git branch -a --contains {commit-hash} 2>/dev/null` 检查受保护分支
18
- - 用 `gh pr view {pr-number} --json state,mergedAt` 检查 PR 状态
19
-
20
- 受保护分支匹配规则:
21
- - 输出包含 `main` 或 `master` -> 视为受保护主线分支
22
- - 输出匹配 `{major}.{minor}.x` -> 视为受保护版本线分支
23
- - 其他情况 -> 不在受保护分支上
24
-
25
- 场景判断矩阵:
26
-
27
- | 条件 | 场景 |
28
- |---|---|
29
- | commit 已经位于受保护分支上 | 场景 A:已完成 |
30
- | 存在 PR,且其状态为 `OPEN` 或 `MERGED` | 场景 B:PR 阶段 |
31
- | 其他所有情况 | 场景 C:开发中 |
32
-
33
- 场景优先级:
34
- - 场景 A:已完成
35
- - 场景 B:PR 阶段
36
- - 场景 C:开发中
37
-
38
- 优先级规则:`场景 A > 场景 B > 场景 C`。即使存在 PR,只要 commit 已经位于 `main`、`master` 或 `{major}.{minor}.x` 上,就应将任务报告为已完成。
39
-
40
- 绝对链接必须使用:
41
- - `https://github.com/{owner}/{repo}/commit/{commit-hash}`
42
- - `https://github.com/{owner}/{repo}/pull/{pr-number}`
@@ -1,63 +0,0 @@
1
- # Label and Issue Type Sync
2
-
3
- Read this file before editing `status:`, `in:`, or Issue Type metadata.
4
-
5
- ## Sync Labels and Issue Type
6
-
7
- Initialize labels when needed:
8
-
9
- ```bash
10
- gh label list --search "type:" --limit 1 --json name --jq 'length'
11
- ```
12
-
13
- If the result is `0`, run `init-labels` and retry this step.
14
-
15
- Status label workflow:
16
-
17
- ```bash
18
- gh issue view {issue-number} --json labels --jq '.labels[].name | select(startswith("status:"))'
19
- gh issue edit {issue-number} --remove-label "{status-label}"
20
- gh issue edit {issue-number} --add-label "{status-label}"
21
- ```
22
-
23
- Status decision table:
24
-
25
- | Condition | Action |
26
- |---|---|
27
- | task lives under `blocked/` | add `status: blocked` |
28
- | Scenario A: completed | add no new `status:` label |
29
- | Scenario B: PR is `MERGED` | add no new `status:` label |
30
- | Scenario B: PR is `OPEN` | add `status: in-progress` |
31
- | Scenario C + `current_step` ∈ {`requirement-analysis`, `technical-design`} | add `status: pending-design-work` |
32
- | Scenario C + `current_step` ∈ {`implementation`, `code-review`, `refinement`} | add `status: in-progress` |
33
-
34
- `in:` label workflow:
35
-
36
- ```bash
37
- gh label list --search "in: {module}" --limit 10 --json name --jq '.[].name'
38
- gh issue edit {issue-number} --add-label "in: {module}"
39
- ```
40
-
41
- `in:` label flow:
42
- 1. extract changed file paths from implementation artifacts first; fall back to analysis artifacts only when implementation artifacts do not exist
43
- 2. take the first path segment as `{module}`
44
- 3. de-duplicate all inferred modules
45
- 4. check whether each exact `in: {module}` label exists before adding it
46
- 5. add matching labels only; never remove existing `in:` labels
47
-
48
- Issue Type workflow:
49
-
50
- ```bash
51
- gh api "orgs/$owner/issue-types" --jq '.[].name'
52
- gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{name}"
53
- ```
54
-
55
- Issue Type mapping:
56
-
57
- | task.md type | GitHub Issue Type |
58
- |---|---|
59
- | `bug`, `bugfix` | `Bug` |
60
- | `feature`, `enhancement` | `Feature` |
61
- | `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring`, and all other values | `Task` |
62
-
63
- If Issue Types are unavailable, record `Issue Type: skipped (not enabled)` and continue.
@@ -1,63 +0,0 @@
1
- # Label 和 Issue 类型同步
2
-
3
- 在编辑 `status:`、`in:` 或 Issue 类型元数据之前先读取本文件。
4
-
5
- ## 同步 Label 和 Issue 类型
6
-
7
- 必要时先初始化 label:
8
-
9
- ```bash
10
- gh label list --search "type:" --limit 1 --json name --jq 'length'
11
- ```
12
-
13
- 如果结果是 `0`,先执行 `init-labels`,然后重新执行本步骤。
14
-
15
- `status:` label 工作流:
16
-
17
- ```bash
18
- gh issue view {issue-number} --json labels --jq '.labels[].name | select(startswith("status:"))'
19
- gh issue edit {issue-number} --remove-label "{status-label}"
20
- gh issue edit {issue-number} --add-label "{status-label}"
21
- ```
22
-
23
- `status:` 判断表:
24
-
25
- | 条件 | 操作 |
26
- |---|---|
27
- | 任务位于 `blocked/` 目录下 | 添加 `status: blocked` |
28
- | 场景 A:已完成 | 不新增 `status:` label |
29
- | 场景 B:PR 状态为 `MERGED` | 不新增 `status:` label |
30
- | 场景 B:PR 状态为 `OPEN` | 添加 `status: in-progress` |
31
- | 场景 C + `current_step` ∈ {`requirement-analysis`, `technical-design`} | 添加 `status: pending-design-work` |
32
- | 场景 C + `current_step` ∈ {`implementation`, `code-review`, `refinement`} | 添加 `status: in-progress` |
33
-
34
- `in:` label 工作流:
35
-
36
- ```bash
37
- gh label list --search "in: {module}" --limit 10 --json name --jq '.[].name'
38
- gh issue edit {issue-number} --add-label "in: {module}"
39
- ```
40
-
41
- `in:` label 流程:
42
- 1. 优先从实现产物中提取改动文件路径;只有在不存在实现产物时,才回退到分析产物
43
- 2. 取路径的第一级目录作为 `{module}`
44
- 3. 对推断出的所有模块去重
45
- 4. 仅在对应的精确 `in: {module}` label 存在时才添加
46
- 5. 只添加匹配的 label;绝不移除已有的 `in:` label
47
-
48
- Issue 类型工作流:
49
-
50
- ```bash
51
- gh api "orgs/$owner/issue-types" --jq '.[].name'
52
- gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{name}"
53
- ```
54
-
55
- Issue 类型映射:
56
-
57
- | task.md 类型 | GitHub Issue 类型 |
58
- |---|---|
59
- | `bug`, `bugfix` | `Bug` |
60
- | `feature`, `enhancement` | `Feature` |
61
- | `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring` 以及其他所有值 | `Task` |
62
-
63
- 如果 Issue 类型不可用,记录 `Issue Type: skipped (not enabled)`,然后继续执行。
@@ -1,37 +0,0 @@
1
- # Milestone Sync
2
-
3
- Read this file before selecting or editing the Issue milestone.
4
-
5
- ## Sync the Milestone
6
-
7
- Milestone priority:
8
- 1. existing Issue milestone
9
- 2. explicit `milestone` field in task.md
10
- 3. inferred version line from the current branch
11
- 4. `General Backlog`
12
-
13
- Inference scenarios when `task.md` does not set `milestone` explicitly:
14
- 1. detect the current branch with `git branch --show-current`
15
- 2. Scenario A: if the current branch matches `{major}.{minor}.x`, use that exact line milestone
16
- 3. Scenario B: if the current branch is `main` or `master`, inspect existing `{major}.{minor}.x` branches
17
- 4. Scenario B result: when a highest existing line `X.Y.x` exists, target `(X+1).0.x`
18
- 5. Scenario C: if no branch rule yields a version line, inspect the latest `vX.Y.Z` tag and fall back to `X.Y.x`
19
- 6. Scenario C fallback: if no branch or tag rule yields a version line, fall back to `General Backlog`
20
-
21
- Fallback and assignment logic:
22
- 1. preserve an existing Issue milestone when one is already set
23
- 2. otherwise prefer an explicit `milestone` field from `task.md`
24
- 3. otherwise apply the branch/tag scenario inference above
25
- 4. if the inferred target milestone does not exist, downgrade to `General Backlog`
26
- 5. if `General Backlog` also does not exist, record `Milestone: skipped (not found)` and stop milestone sync
27
- 6. once a milestone title is resolved, assign it and record either `{target} (assigned)` or `General Backlog (fallback)`
28
-
29
- Useful commands:
30
-
31
- ```bash
32
- gh issue view {issue-number} --json milestone
33
- git branch --show-current
34
- git branch -a | grep -oE '[0-9]+\.[0-9]+\.x'
35
- git tag --list 'v*' --sort=-v:refname | head -1
36
- gh issue edit {issue-number} --milestone "{milestone-title}"
37
- ```
@@ -1,37 +0,0 @@
1
- # 里程碑同步
2
-
3
- 在选择或编辑 Issue 里程碑之前先读取本文件。
4
-
5
- ## 同步里程碑
6
-
7
- 里程碑优先级:
8
- 1. Issue 当前已有的里程碑
9
- 2. task.md 中显式设置的 `milestone` 字段
10
- 3. 从当前分支推断出的版本线里程碑
11
- 4. `General Backlog`
12
-
13
- 当 task.md 没有显式设置 `milestone` 时,按以下场景推断:
14
- 1. 用 `git branch --show-current` 检测当前分支
15
- 2. 场景 A:如果当前分支匹配 `{major}.{minor}.x`,直接使用该版本线里程碑
16
- 3. 场景 B:如果当前分支是 `main` 或 `master`,检查现有的 `{major}.{minor}.x` 分支
17
- 4. 场景 B 结果:当存在最高版本线 `X.Y.x` 时,目标使用 `(X+1).0.x`
18
- 5. 场景 C:如果分支规则无法得出版本线,则检查最新的 `vX.Y.Z` tag,并回退到 `X.Y.x`
19
- 6. 场景 C 回退:如果分支和 tag 规则都无法得出版本线,则回退到 `General Backlog`
20
-
21
- 回退与赋值逻辑:
22
- 1. 如果 Issue 已经有里程碑,优先保留
23
- 2. 否则优先使用 task.md 中显式设置的 `milestone`
24
- 3. 否则应用上面的分支 / tag 场景推断规则
25
- 4. 如果推断出的目标里程碑不存在,则降级为 `General Backlog`
26
- 5. 如果 `General Backlog` 也不存在,则记录 `Milestone: skipped (not found)`,并停止 milestone 同步
27
- 6. 一旦解析出里程碑标题,就执行赋值,并记录 `{target} (assigned)` 或 `General Backlog (fallback)`
28
-
29
- 常用命令:
30
-
31
- ```bash
32
- gh issue view {issue-number} --json milestone
33
- git branch --show-current
34
- git branch -a | grep -oE '[0-9]+\.[0-9]+\.x'
35
- git tag --list 'v*' --sort=-v:refname | head -1
36
- gh issue edit {issue-number} --milestone "{milestone-title}"
37
- ```
@@ -1,72 +0,0 @@
1
- ---
2
- name: sync-pr
3
- description: "Sync task progress to a Pull Request"
4
- ---
5
-
6
- # Sync Progress to PR
7
-
8
- Sync PR metadata and keep one reviewer-facing summary comment up to date.
9
-
10
- ## Execution Flow
11
-
12
- ### 1. Verify the Task Exists
13
-
14
- Check `.agents/workspace/active/{task-id}/task.md` and stop if the task does not exist.
15
-
16
- ### 2. Read Task Information
17
-
18
- Extract `pr_number`, `issue_number`, task title, type, and the latest timestamps from task.md.
19
-
20
- ### 3. Read Context Files
21
-
22
- Read the latest plan, implementation, review, and refinement artifacts that will inform PR metadata and the reviewer summary.
23
-
24
- ### 4. Resolve Repository Coordinates and Label Readiness
25
-
26
- Resolve `repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"` and verify whether `type:` labels have been initialized.
27
-
28
- ### 5. Sync Metadata
29
-
30
- Sync the mapped type label, relevant `in:` labels, and milestone onto the PR.
31
-
32
- > PR-state safeguards, milestone inference, and metadata skip rules for closed or merged PRs live in `reference/delivery-detection.md`. Read `reference/delivery-detection.md` before editing PR metadata.
33
-
34
- ### 6. Sync Development Linking
35
-
36
- If `issue_number` exists, ensure the PR body contains `Closes #{issue-number}` or an equivalent closing keyword.
37
-
38
- ### 7. Publish the Reviewer Summary
39
-
40
- > Hidden markers, idempotent summary comment updates, review-history formatting, and comment create/update rules live in `reference/comment-publish.md`. Read `reference/comment-publish.md` before publishing the summary.
41
-
42
- > **Shell Safety Rules** (read before publishing comments):
43
- > 1. `{comment-body}` must be replaced with **actual inline text**. Read the file with the Read tool first, then paste the full content into the heredoc body. **Do NOT** use `$(cat ...)`, `$(< ...)`, `$(...)`, or `${...}` inside `<<'EOF'`. Quoted heredocs suppress all command substitution and variable expansion, so those expressions will be output as literal text.
44
- > 2. When constructing strings that contain `<!-- -->`, **do NOT use `echo`**. In bash/zsh, `echo` escapes `!` as `\!`, which makes hidden markers visible. Build all comment content with `cat <<'EOF'` heredocs or `printf '%s\n'`.
45
-
46
- ### 8. Update Task Status
47
-
48
- Get the current time:
49
-
50
- ```bash
51
- date "+%Y-%m-%d %H:%M:%S"
52
- ```
53
-
54
- Update `last_synced_to_pr_at` and append the Sync to PR Activity Log entry.
55
-
56
- ### 9. Inform the User
57
-
58
- Report the synchronized labels, milestone, development status, summary result, and PR URL.
59
-
60
- ## Notes
61
-
62
- - The hidden summary marker must stay `<!-- sync-pr:{task-id}:summary -->`
63
- - Keep exactly one summary comment for reviewers
64
- - If the PR is already closed or merged, report `PR #{number} is closed/merged, metadata sync skipped`
65
- - Follow the Step 7 shell safety rules when publishing comments: do not rely on command substitution inside quoted heredocs, and do not use `echo` for HTML comment markers
66
-
67
- ## Error Handling
68
-
69
- - Task not found: `Task {task-id} not found`
70
- - Missing PR number: `Task has no pr_number field`
71
- - PR not found: `PR #{number} not found`
72
- - GitHub CLI auth failed: `Please check GitHub CLI authentication`
@@ -1,72 +0,0 @@
1
- ---
2
- name: sync-pr
3
- description: "将任务进度同步到 Pull Request"
4
- ---
5
-
6
- # 同步进度到 PR
7
-
8
- 同步 PR 元数据,并维护一条面向 reviewer 的摘要评论。
9
-
10
- ## 执行流程
11
-
12
- ### 1. 验证任务存在
13
-
14
- 检查 `.agents/workspace/active/{task-id}/task.md`;如果任务不存在则立即停止。
15
-
16
- ### 2. 读取任务信息
17
-
18
- 从 task.md 提取 `pr_number`、`issue_number`、任务标题、type 和最新时间戳。
19
-
20
- ### 3. 读取上下文文件
21
-
22
- 读取最新的方案、实现、审查和修复产物,用于生成 PR 元数据和 reviewer 摘要。
23
-
24
- ### 4. 解析仓库坐标并检查 label 就绪状态
25
-
26
- 先解析 `repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"`,再确认 `type:` labels 是否已经初始化。
27
-
28
- ### 5. 同步元数据
29
-
30
- 把映射后的 type label、相关 `in:` labels 和 milestone 同步到 PR 上。
31
-
32
- > PR 状态保护、milestone 推断,以及 PR 已关闭/已合并时的跳过规则见 `reference/delivery-detection.md`。编辑 PR 元数据前先读取 `reference/delivery-detection.md`。
33
-
34
- ### 6. 同步 Development 关联
35
-
36
- 如果存在 `issue_number`,确保 PR 正文包含 `Closes #{issue-number}` 或等价的关闭关键字。
37
-
38
- ### 7. 发布 reviewer 摘要
39
-
40
- > 隐藏标记、幂等 summary 评论更新、review history 格式,以及评论创建/更新规则见 `reference/comment-publish.md`。发布摘要前先读取 `reference/comment-publish.md`。
41
-
42
- > **Shell 安全规则**(发布评论前必读):
43
- > 1. `{comment-body}` 必须替换为**实际的内联文本**。先用 Read 工具读取文件,再将全文粘贴到 heredoc body 中。**禁止**在 `<<'EOF'` 内部使用 `$(cat ...)`、`$(< ...)`、`$(...)`、`${...}`。带引号 heredoc 会阻止所有命令替换和变量展开,它们会被当作字面文本输出。
44
- > 2. 构造含 `<!-- -->` 的字符串时,**禁止使用 `echo`**。bash/zsh 中 `echo` 会将 `!` 转义为 `\!`,导致隐藏标识可见。所有评论内容统一使用 `cat <<'EOF'` heredoc 或 `printf '%s\n'` 构造。
45
-
46
- ### 8. 更新任务状态
47
-
48
- 获取当前时间:
49
-
50
- ```bash
51
- date "+%Y-%m-%d %H:%M:%S"
52
- ```
53
-
54
- 更新 `last_synced_to_pr_at`,并追加 Sync to PR 的 Activity Log。
55
-
56
- ### 9. 告知用户
57
-
58
- 汇总已同步的 labels、milestone、development 状态、summary 结果以及 PR URL。
59
-
60
- ## 注意事项
61
-
62
- - 隐藏 summary 标记必须保持 `<!-- sync-pr:{task-id}:summary -->`
63
- - 面向 reviewer 只保留一条摘要评论
64
- - 如果 PR 已关闭或已合并,必须报告 `PR #{number} is closed/merged, metadata sync skipped`
65
- - 发布摘要时遵守步骤 7 的 Shell 安全规则,不要在带引号 heredoc 中依赖命令替换,也不要用 `echo` 构造 HTML 注释标记
66
-
67
- ## 错误处理
68
-
69
- - 任务未找到:`Task {task-id} not found`
70
- - 缺少 PR 编号:`Task has no pr_number field`
71
- - PR 不存在:`PR #{number} not found`
72
- - GitHub CLI 认证失败:`Please check GitHub CLI authentication`
@@ -1,54 +0,0 @@
1
- # PR Metadata Guards
2
-
3
- Read this file before inferring milestones or deciding whether metadata sync should be skipped.
4
-
5
- Initialize label state first:
6
-
7
- ```bash
8
- gh label list --search "type:" --limit 1 --json name --jq 'length'
9
- ```
10
-
11
- If the result is `0`, run `init-labels` before retrying metadata sync.
12
-
13
- Type label examples:
14
- - `bug`, `bugfix` -> `type: bug`
15
- - `refactor`, `refactoring` -> `type: enhancement`
16
-
17
- ## Sync the Milestone
18
-
19
- Milestone priority:
20
- 1. current PR milestone
21
- 2. explicit `milestone` in task.md
22
- 3. milestone inherited from the Issue
23
- 4. inferred release line
24
- 5. `General Backlog`
25
-
26
- Milestone inference algorithm:
27
- 1. if the current branch matches `{major}.{minor}.x`, use that exact release line
28
- 2. if the current branch is `main` or `master`, inspect existing `{major}.{minor}.x` branches and target `(X+1).0.x`
29
- 3. if no release line branch exists, inspect the latest `vX.Y.Z` tag and fall back to `X.Y.x`
30
- 4. if none of the above resolve, fall back to `General Backlog`
31
-
32
- Execution order:
33
- 1. preserve an existing PR milestone when present
34
- 2. otherwise prefer explicit `milestone` in task.md
35
- 3. otherwise inherit the Issue milestone if it exists
36
- 4. otherwise apply the branch/tag inference above
37
- 5. if the target milestone is unavailable, fall back to `General Backlog`
38
- 6. if even `General Backlog` is unavailable, record `Milestone: skipped (not found)`
39
-
40
- Useful commands:
41
-
42
- ```bash
43
- gh pr view {pr-number} --json milestone
44
- gh issue view {issue-number} --json labels,milestone
45
- git branch --show-current
46
- git branch -a | grep -oE '[0-9]+\.[0-9]+\.x' | sort -V | tail -1
47
- git tag --list 'v*' --sort=-v:refname | head -1
48
- gh pr edit {pr-number} --add-label "{type-label}"
49
- gh pr edit {pr-number} --add-label "in: {module}"
50
- gh pr edit {pr-number} --milestone "{milestone-title}"
51
- ```
52
-
53
- If the PR is closed or merged, stop metadata sync and report:
54
- `PR #{number} is closed/merged, metadata sync skipped`
@@ -1,54 +0,0 @@
1
- # PR 元数据保护规则
2
-
3
- 在推断 milestone 或决定是否跳过元数据同步之前先读取本文件。
4
-
5
- 先初始化 label 状态:
6
-
7
- ```bash
8
- gh label list --search "type:" --limit 1 --json name --jq 'length'
9
- ```
10
-
11
- 如果结果是 `0`,先执行 `init-labels`,再重试元数据同步。
12
-
13
- Type label 示例:
14
- - `bug`, `bugfix` -> `type: bug`
15
- - `refactor`, `refactoring` -> `type: enhancement`
16
-
17
- ## 同步 Milestone
18
-
19
- Milestone 优先级:
20
- 1. PR 当前已有的 milestone
21
- 2. task.md 中显式设置的 `milestone`
22
- 3. 从 Issue 继承的 milestone
23
- 4. 推断得到的 release line
24
- 5. `General Backlog`
25
-
26
- Milestone 推断算法:
27
- 1. 如果当前分支匹配 `{major}.{minor}.x`,直接使用该 release line
28
- 2. 如果当前分支是 `main` 或 `master`,检查现有的 `{major}.{minor}.x` 分支,并目标设为 `(X+1).0.x`
29
- 3. 如果不存在 release line 分支,则检查最新的 `vX.Y.Z` tag,并回退到 `X.Y.x`
30
- 4. 如果以上都无法得出结果,则回退到 `General Backlog`
31
-
32
- 执行顺序:
33
- 1. 如果 PR 已经设置 milestone,优先保留
34
- 2. 否则优先使用 task.md 中显式设置的 `milestone`
35
- 3. 否则继承已有的 Issue milestone
36
- 4. 否则应用上面的分支 / tag 推断规则
37
- 5. 如果目标 milestone 不可用,则回退到 `General Backlog`
38
- 6. 如果连 `General Backlog` 都不可用,则记录 `Milestone: skipped (not found)`
39
-
40
- 常用命令:
41
-
42
- ```bash
43
- gh pr view {pr-number} --json milestone
44
- gh issue view {issue-number} --json labels,milestone
45
- git branch --show-current
46
- git branch -a | grep -oE '[0-9]+\.[0-9]+\.x' | sort -V | tail -1
47
- git tag --list 'v*' --sort=-v:refname | head -1
48
- gh pr edit {pr-number} --add-label "{type-label}"
49
- gh pr edit {pr-number} --add-label "in: {module}"
50
- gh pr edit {pr-number} --milestone "{milestone-title}"
51
- ```
52
-
53
- 如果 PR 已关闭或已合并,停止元数据同步,并报告:
54
- `PR #{number} is closed/merged, metadata sync skipped`
@@ -1,138 +0,0 @@
1
- # Project - Claude Code Instructions
2
-
3
- This repository uses agent-infra for multi-AI collaboration infrastructure.
4
-
5
- ## Quick Commands
6
-
7
- <!-- TODO: Add your project's build commands here -->
8
- ```bash
9
- # Install dependencies
10
- # TODO: your install command
11
-
12
- # Build
13
- # TODO: your build command
14
-
15
- # Run tests
16
- # TODO: your test command
17
-
18
- # Lint
19
- # TODO: your lint command
20
- ```
21
-
22
- ## Project Structure
23
-
24
- <!-- TODO: Add your project's directory structure here -->
25
-
26
- ## Coding Standards
27
-
28
- <!-- TODO: Add your project's coding standards here -->
29
-
30
- ### Copyright Header Update
31
- When modifying any file with a copyright header, update the year:
32
- 1. Run `date +%Y` to get the current year (never hardcode)
33
- 2. Update format: `2024-2025` -> `2024-2026` (assuming current year is 2026)
34
-
35
- ### Branch Naming
36
- Use project prefix: `{{project}}-feature-xxx`, `{{project}}-bugfix-yyy`
37
-
38
- ## Testing
39
-
40
- <!-- TODO: Add your project's test framework and commands here -->
41
-
42
- ## Commit & PR Conventions
43
-
44
- ### Commit Message Format (Conventional Commits)
45
- ```
46
- <type>(<scope>): <subject>
47
- ```
48
- - **type**: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`
49
- - **scope**: module name (optional)
50
- - **subject**: English, imperative mood, max 50 characters
51
-
52
- ### Claude commit signature
53
- ```
54
- Co-Authored-By: Claude <noreply@anthropic.com>
55
- ```
56
-
57
- ### PR Checklist
58
- - [ ] Tests pass
59
- - [ ] Lint passes
60
- - [ ] Build succeeds
61
- - [ ] Public APIs documented
62
- - [ ] Copyright headers updated
63
-
64
- ## Claude-Specific Rules
65
-
66
- ### Critical Rules
67
- 1. **No auto-commit**: Never execute `git commit`/`git add` automatically. Remind user to use `/commit`
68
- 2. **Copyright year update**: Run `date +%Y`, use Edit tool to update
69
- 3. **Task status management**: Update `task.md` fields after each command
70
-
71
- ### Important Rules
72
- 4. **Task semantic recognition**: Auto-detect user intent (e.g., "analyze issue 207" -> `/import-issue 207`; "analyze task TASK-20260306-143022" -> `/analyze-task TASK-20260306-143022`)
73
- 5. **PR conventions**: Add generation marker when creating PRs
74
-
75
- **Detailed rules**: `.claude/project-rules.md`
76
-
77
- ## Tool Usage
78
-
79
- | Operation | Recommended | Avoid |
80
- |-----------|-------------|-------|
81
- | File search | `Glob` | `find`, `ls` |
82
- | Content search | `Grep` | `grep`, `rg` |
83
- | Read files | `Read` | `cat`, `head`, `tail` |
84
- | Edit files | `Edit` | `sed`, `awk` |
85
- | Create files | `Write` | `echo >`, `cat <<EOF` |
86
-
87
- **Bash only for**: Git operations, build/test, system info
88
-
89
- ## Slash Commands
90
-
91
- Available commands are auto-discovered from `.claude/commands/`. Type `/` in the prompt to see the full list with descriptions.
92
-
93
- For task workflow, the typical sequence is:
94
- `/create-task` -> `/analyze-task` -> `/plan-task` -> `/implement-task` -> `/review-task` -> `/complete-task`
95
-
96
- ## Language Conventions
97
-
98
- | Context | Language |
99
- |---------|----------|
100
- | Code identifiers, docs | English |
101
- | Git commit messages | English (Conventional Commits) |
102
- | Project documentation | English (primary) + Chinese translation |
103
- | AI responses | Follow user's input language |
104
-
105
- ## Multi-AI Collaboration
106
-
107
- This project supports Claude Code, Codex, Gemini CLI, OpenCode.
108
-
109
- - `.agents/` - Shared collaboration config
110
- - `.agents/workspace/` - Task workspace (git-ignored)
111
-
112
- **Collaboration guide**: `.agents/README.md`
113
-
114
- ## Skill Authoring Conventions
115
-
116
- When writing or updating `.agents/skills/*/SKILL.md` files and their templates, keep step numbering consistent:
117
-
118
- 1. Use consecutive integers for top-level steps: `1.`, `2.`, `3.`.
119
- 2. Use nested numbering only for child actions that belong to a parent step: `1.1`, `1.2`, `2.1`.
120
- 3. Use `a`, `b`, and `c` markers for subordinate options, conditional branches, or parallel possibilities within the same step; use them only for in-step expansion, not for naming standalone decision paths or output templates.
121
- 4. Do not use intermediate numbers such as `1.5` or `2.5`; if a new standalone step is needed, renumber the following top-level steps.
122
- 5. When renumbering, update every in-document step reference so the instructions remain accurate.
123
- 6. Extract long bash scripts into a sibling `scripts/` directory; the SKILL.md should contain only a single-line invocation (e.g., `bash .agents/skills/<skill>/scripts/<script>.sh`) and a brief summary of the script's responsibilities.
124
- 7. In SKILL.md files and their `reference/` templates, when a standalone conditional flow, decision path, or output template needs a label, use "Scenario" naming (for example, use "Scenario A").
125
-
126
- ### SKILL.md Size Control
127
-
128
- - Keep the SKILL.md body within about 500 tokens (roughly 80 lines / 2KB).
129
- - Move content beyond that threshold into a sibling `reference/` directory.
130
- - Use explicit navigation in the skeleton, such as: `Read reference/xxx.md before executing this step.`
131
- - Keep scripts in `scripts/` and execute them instead of inlining long bash blocks.
132
-
133
- <!-- Canonical source: .agents/README.md - keep in sync -->
134
-
135
- ## Security
136
-
137
- - Do not commit: `.env`, credentials, keys
138
- - Security issues: follow `SECURITY.md`