@fitlab-ai/agent-infra 0.4.2 → 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 (122) hide show
  1. package/README.md +24 -34
  2. package/README.zh-CN.md +24 -34
  3. package/lib/defaults.json +4 -0
  4. package/lib/init.js +1 -0
  5. package/lib/update.js +13 -1
  6. package/package.json +3 -3
  7. package/templates/.agents/README.md +16 -2
  8. package/templates/.agents/README.zh-CN.md +16 -2
  9. package/templates/.agents/rules/issue-sync.md +185 -0
  10. package/templates/.agents/rules/issue-sync.zh-CN.md +185 -0
  11. package/templates/.agents/scripts/validate-artifact.js +1280 -0
  12. package/templates/.agents/skills/analyze-task/SKILL.md +24 -1
  13. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +24 -1
  14. package/templates/.agents/skills/analyze-task/config/verify.json +41 -0
  15. package/templates/.agents/skills/archive-tasks/SKILL.md +40 -0
  16. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +40 -0
  17. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +403 -0
  18. package/templates/.agents/skills/block-task/SKILL.md +25 -37
  19. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +25 -37
  20. package/templates/.agents/skills/block-task/config/verify.json +28 -0
  21. package/templates/.agents/skills/close-codescan/SKILL.md +7 -0
  22. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +7 -0
  23. package/templates/.agents/skills/close-dependabot/SKILL.md +7 -0
  24. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +7 -0
  25. package/templates/.agents/skills/commit/SKILL.md +17 -0
  26. package/templates/.agents/skills/commit/SKILL.zh-CN.md +17 -0
  27. package/templates/.agents/skills/commit/config/verify.json +22 -0
  28. package/templates/.agents/skills/complete-task/SKILL.md +24 -10
  29. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +24 -10
  30. package/templates/.agents/skills/complete-task/config/verify.json +30 -0
  31. package/templates/.agents/skills/create-issue/SKILL.md +41 -5
  32. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +41 -5
  33. package/templates/.agents/skills/create-issue/config/verify.json +27 -0
  34. package/templates/.agents/skills/create-issue/reference/label-and-type.md +10 -11
  35. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +10 -11
  36. package/templates/.agents/skills/create-pr/SKILL.md +43 -9
  37. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +43 -9
  38. package/templates/.agents/skills/create-pr/config/verify.json +26 -0
  39. package/templates/.agents/skills/create-pr/reference/branch-strategy.md +3 -3
  40. package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +3 -3
  41. package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.md +6 -6
  42. package/templates/.agents/skills/{sync-pr → create-pr}/reference/comment-publish.zh-CN.md +6 -6
  43. package/templates/.agents/skills/create-pr/reference/pr-body-template.md +15 -6
  44. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +15 -6
  45. package/templates/.agents/skills/create-task/SKILL.md +25 -3
  46. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +25 -3
  47. package/templates/.agents/skills/create-task/config/verify.json +24 -0
  48. package/templates/.agents/skills/implement-task/SKILL.md +43 -8
  49. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +43 -8
  50. package/templates/.agents/skills/implement-task/config/verify.json +41 -0
  51. package/templates/.agents/skills/implement-task/reference/branch-management.md +48 -0
  52. package/templates/.agents/skills/implement-task/reference/branch-management.zh-CN.md +49 -0
  53. package/templates/.agents/skills/implement-task/reference/output-template.md +20 -0
  54. package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +20 -0
  55. package/templates/.agents/skills/import-codescan/SKILL.md +18 -7
  56. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +18 -7
  57. package/templates/.agents/skills/import-codescan/config/verify.json +24 -0
  58. package/templates/.agents/skills/import-dependabot/SKILL.md +18 -7
  59. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +18 -7
  60. package/templates/.agents/skills/import-dependabot/config/verify.json +24 -0
  61. package/templates/.agents/skills/import-issue/SKILL.md +18 -1
  62. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +18 -1
  63. package/templates/.agents/skills/import-issue/config/verify.json +27 -0
  64. package/templates/.agents/skills/init-labels/SKILL.md +40 -10
  65. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +40 -10
  66. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +1 -22
  67. package/templates/.agents/skills/init-milestones/SKILL.md +13 -0
  68. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +13 -0
  69. package/templates/.agents/skills/plan-task/SKILL.md +29 -75
  70. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +29 -75
  71. package/templates/.agents/skills/plan-task/config/verify.json +42 -0
  72. package/templates/.agents/skills/refine-task/SKILL.md +47 -2
  73. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +47 -2
  74. package/templates/.agents/skills/refine-task/config/verify.json +37 -0
  75. package/templates/.agents/skills/refine-title/SKILL.md +10 -2
  76. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +10 -2
  77. package/templates/.agents/skills/restore-task/SKILL.md +159 -0
  78. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +159 -0
  79. package/templates/.agents/skills/restore-task/config/verify.json +24 -0
  80. package/templates/.agents/skills/review-task/SKILL.md +25 -1
  81. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +25 -1
  82. package/templates/.agents/skills/review-task/config/verify.json +40 -0
  83. package/templates/.agents/skills/update-agent-infra/SKILL.md +11 -0
  84. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +11 -0
  85. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +5 -1
  86. package/templates/.claude/commands/archive-tasks.md +9 -0
  87. package/templates/.claude/commands/archive-tasks.zh-CN.md +9 -0
  88. package/templates/.claude/commands/restore-task.md +9 -0
  89. package/templates/.claude/commands/restore-task.zh-CN.md +9 -0
  90. package/templates/.gemini/commands/_project_/archive-tasks.toml +10 -0
  91. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +10 -0
  92. package/templates/.gemini/commands/_project_/restore-task.toml +8 -0
  93. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +8 -0
  94. package/templates/.github/workflows/status-label.yml +82 -0
  95. package/templates/.opencode/commands/archive-tasks.md +11 -0
  96. package/templates/.opencode/commands/archive-tasks.zh-CN.md +11 -0
  97. package/templates/.opencode/commands/restore-task.md +11 -0
  98. package/templates/.opencode/commands/restore-task.zh-CN.md +11 -0
  99. package/templates/.agents/skills/sync-issue/SKILL.md +0 -93
  100. package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +0 -93
  101. package/templates/.agents/skills/sync-issue/reference/comment-publish.md +0 -84
  102. package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +0 -84
  103. package/templates/.agents/skills/sync-issue/reference/label-sync.md +0 -62
  104. package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +0 -62
  105. package/templates/.agents/skills/sync-issue/reference/milestone-sync.md +0 -37
  106. package/templates/.agents/skills/sync-issue/reference/milestone-sync.zh-CN.md +0 -37
  107. package/templates/.agents/skills/sync-pr/SKILL.md +0 -87
  108. package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +0 -87
  109. package/templates/.agents/skills/sync-pr/reference/delivery-detection.md +0 -54
  110. package/templates/.agents/skills/sync-pr/reference/delivery-detection.zh-CN.md +0 -54
  111. package/templates/.claude/commands/sync-issue.md +0 -8
  112. package/templates/.claude/commands/sync-issue.zh-CN.md +0 -8
  113. package/templates/.claude/commands/sync-pr.md +0 -8
  114. package/templates/.claude/commands/sync-pr.zh-CN.md +0 -8
  115. package/templates/.gemini/commands/_project_/sync-issue.toml +0 -8
  116. package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +0 -8
  117. package/templates/.gemini/commands/_project_/sync-pr.toml +0 -8
  118. package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +0 -8
  119. package/templates/.opencode/commands/sync-issue.md +0 -11
  120. package/templates/.opencode/commands/sync-issue.zh-CN.md +0 -11
  121. package/templates/.opencode/commands/sync-pr.md +0 -11
  122. package/templates/.opencode/commands/sync-pr.zh-CN.md +0 -11
@@ -0,0 +1,82 @@
1
+ name: Status Label Automation
2
+
3
+ on:
4
+ issues:
5
+ types: [closed, reopened]
6
+ pull_request_target:
7
+ types: [closed]
8
+
9
+ permissions:
10
+ issues: write
11
+ pull-requests: read
12
+
13
+ jobs:
14
+ manage-status-labels:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Remove status labels on issue close
18
+ if: github.event_name == 'issues' && github.event.action == 'closed'
19
+ env:
20
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21
+ ISSUE_NUMBER: ${{ github.event.issue.number }}
22
+ run: |
23
+ gh issue view "$ISSUE_NUMBER" \
24
+ --repo "$GITHUB_REPOSITORY" \
25
+ --json labels --jq '.labels[].name | select(startswith("status:"))' \
26
+ 2>/dev/null \
27
+ | while IFS= read -r label; do
28
+ [ -z "$label" ] && continue
29
+ gh issue edit "$ISSUE_NUMBER" \
30
+ --repo "$GITHUB_REPOSITORY" \
31
+ --remove-label "$label"
32
+ done || true
33
+
34
+ - name: Add triage label on issue reopen
35
+ if: github.event_name == 'issues' && github.event.action == 'reopened'
36
+ env:
37
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
+ ISSUE_NUMBER: ${{ github.event.issue.number }}
39
+ run: |
40
+ gh issue view "$ISSUE_NUMBER" \
41
+ --repo "$GITHUB_REPOSITORY" \
42
+ --json labels --jq '.labels[].name | select(startswith("status:"))' \
43
+ 2>/dev/null \
44
+ | while IFS= read -r label; do
45
+ [ -z "$label" ] && continue
46
+ gh issue edit "$ISSUE_NUMBER" \
47
+ --repo "$GITHUB_REPOSITORY" \
48
+ --remove-label "$label"
49
+ done || true
50
+ gh issue edit "$ISSUE_NUMBER" \
51
+ --repo "$GITHUB_REPOSITORY" \
52
+ --add-label "status: waiting-for-triage"
53
+
54
+ - name: Clean status labels on PR merge
55
+ if: >-
56
+ github.event_name == 'pull_request_target' &&
57
+ github.event.action == 'closed' &&
58
+ github.event.pull_request.merged == true
59
+ env:
60
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61
+ PR_BODY: ${{ github.event.pull_request.body }}
62
+ run: |
63
+ issue_numbers=$(printf '%s' "${PR_BODY:-}" \
64
+ | grep -ioE '(closes|fixes|resolves)\s+#[0-9]+' \
65
+ | grep -oE '[0-9]+' || true)
66
+ for issue_number in $issue_numbers; do
67
+ state=$(gh issue view "$issue_number" \
68
+ --repo "$GITHUB_REPOSITORY" \
69
+ --json state --jq '.state')
70
+ if [ "$state" = "CLOSED" ]; then
71
+ gh issue view "$issue_number" \
72
+ --repo "$GITHUB_REPOSITORY" \
73
+ --json labels --jq '.labels[].name | select(startswith("status:"))' \
74
+ 2>/dev/null \
75
+ | while IFS= read -r label; do
76
+ [ -z "$label" ] && continue
77
+ gh issue edit "$issue_number" \
78
+ --repo "$GITHUB_REPOSITORY" \
79
+ --remove-label "$label"
80
+ done || true
81
+ fi
82
+ done
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "Archive completed tasks into a date-organized workspace directory"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ Archive completed tasks: $ARGUMENTS
8
+
9
+ Read and execute the archive-tasks skill from `.agents/skills/archive-tasks/SKILL.md`.
10
+
11
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "归档已完成任务到按日期组织的目录"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ 归档已完成任务:$ARGUMENTS
8
+
9
+ 读取并执行 `.agents/skills/archive-tasks/SKILL.md` 中的 archive-tasks 技能。
10
+
11
+ 严格按照技能中定义的所有步骤执行。
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "Restore local task files from GitHub Issue comments"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ Restore task from Issue: $ARGUMENTS
8
+
9
+ Read and execute the restore-task skill from `.agents/skills/restore-task/SKILL.md`.
10
+
11
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "从 GitHub Issue 评论还原本地任务文件"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ 从 Issue 还原任务:$ARGUMENTS
8
+
9
+ 读取并执行 `.agents/skills/restore-task/SKILL.md` 中的 restore-task 技能。
10
+
11
+ 严格按照技能中定义的所有步骤执行。
@@ -1,93 +0,0 @@
1
- ---
2
- name: sync-issue
3
- description: "Sync task progress to a GitHub Issue"
4
- ---
5
-
6
- # Sync Progress to Issue
7
-
8
- Sync the task state, summary comment, and published artifacts to the related GitHub Issue.
9
-
10
- ## Execution Flow
11
-
12
- ### 1. Parse the Argument
13
-
14
- Accept either `task-id` or issue number input. For issue-number input, resolve the task with:
15
-
16
- ```bash
17
- grep -rl "^issue_number: {issue-number}$" \
18
- .agents/workspace/active/ \
19
- .agents/workspace/blocked/ \
20
- .agents/workspace/completed/ \
21
- 2>/dev/null | head -1
22
- ```
23
-
24
- If no task matches, output `No task found associated with Issue #{issue-number}`.
25
-
26
- ### 2. Verify the Task Exists
27
-
28
- Search active, blocked, and completed task directories and lock onto the matching task folder before continuing.
29
-
30
- ### 3. Read Task Information
31
-
32
- Extract `issue_number`, `type`, task title, status, `current_step`, and timestamp fields from task.md.
33
-
34
- ### 4. Read Context Files
35
-
36
- Read the highest-round `analysis.md` / `analysis-r{N}.md`, `plan.md` / `plan-r{N}.md`, and the current implementation, refinement, and review artifacts that still exist.
37
-
38
- ### 5. Sync Labels and Issue Type
39
-
40
- > Label initialization, `status:` replacement rules, `in:` label discovery, and the `issue-types` mapping logic live in `reference/label-sync.md`. Read `reference/label-sync.md` before editing Issue metadata.
41
-
42
- ### 6. Sync Development Linking
43
-
44
- If `pr_number` exists, make sure the PR body contains one of:
45
- - `Closes #{issue-number}`
46
- - `Fixes #{issue-number}`
47
- - `Resolves #{issue-number}`
48
-
49
- ### 7. Sync the Milestone
50
-
51
- > Milestone inheritance, line-branch inference, and `General Backlog` fallback rules live in `reference/milestone-sync.md`. Read `reference/milestone-sync.md` before editing the Issue milestone.
52
-
53
- ### 8. Sync Requirement Checkboxes
54
-
55
- Extract checked `- [x]` items from the `## Requirements` section of task.md; if none exist, skip this step.
56
- Read the current Issue body with `gh issue view {issue-number} --json body --jq '.body'`.
57
- Match by checkbox text and replace only `- [ ] {text}` with `- [x] {text}` in the Issue body; keep existing `- [x]` items, unmatched items, and non-requirement checkboxes unchanged.
58
- Only when the body actually changes, update the full body with `gh api` PATCH and build the request payload with `cat <<'EOF'` heredoc.
59
-
60
- ### 9. Publish Context Artifacts
61
-
62
- > Existing-comment discovery, hidden markers, the artifact timeline, and summary comment ordering live in `reference/comment-publish.md`. Read `reference/comment-publish.md` before publishing Issue comments.
63
-
64
- > **Shell Safety Rules** (read before publishing comments):
65
- > 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.
66
- > 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 and the Step 8 Issue body update with `cat <<'EOF'` heredocs or `printf '%s\n'`.
67
-
68
- ### 10. Update Task Status
69
-
70
- Get the current time:
71
-
72
- ```bash
73
- date "+%Y-%m-%d %H:%M:%S"
74
- ```
75
-
76
- Update `last_synced_at` in task.md and append the Sync to Issue Activity Log entry.
77
-
78
- ### 11. Inform User
79
-
80
- Summarize synced labels, milestone, development linkage, published comments, and include the Issue URL.
81
-
82
- ## Notes
83
-
84
- - The hidden comment marker format must stay `<!-- sync-issue:{task-id}:{file-stem} -->`
85
- - Build the artifact timeline from Activity Log order, not a fixed `analysis -> plan -> implementation -> review -> summary` sequence
86
- - Follow the Step 9 shell safety rules when publishing comments or updating the Issue body: do not rely on command substitution inside quoted heredocs, and do not use `echo` for HTML comment markers
87
-
88
- ## Error Handling
89
-
90
- - Task not found: `Task {task-id} not found`
91
- - Missing `issue_number`: `Task has no issue_number field`
92
- - GitHub CLI auth failed: `Please check GitHub CLI authentication`
93
- - Issue not found: `Issue #{number} not found`
@@ -1,93 +0,0 @@
1
- ---
2
- name: sync-issue
3
- description: "将任务进度同步到 GitHub Issue"
4
- ---
5
-
6
- # 同步进度到 Issue
7
-
8
- 把任务状态、摘要评论和产物发布时间线同步到关联的 GitHub Issue。
9
-
10
- ## 执行流程
11
-
12
- ### 1. 解析参数
13
-
14
- 同时接受 `task-id` 和 issue number。对于 issue number,使用下面的命令反查任务:
15
-
16
- ```bash
17
- grep -rl "^issue_number: {issue-number}$" \
18
- .agents/workspace/active/ \
19
- .agents/workspace/blocked/ \
20
- .agents/workspace/completed/ \
21
- 2>/dev/null | head -1
22
- ```
23
-
24
- 如果没有匹配任务,输出 `No task found associated with Issue #{issue-number}`。
25
-
26
- ### 2. 验证任务存在
27
-
28
- 按 active、blocked、completed 的顺序定位匹配任务目录,再继续后续步骤。
29
-
30
- ### 3. 读取任务信息
31
-
32
- 从 task.md 提取 `issue_number`、`type`、标题、状态、`current_step` 和时间戳字段。
33
-
34
- ### 4. 读取上下文文件
35
-
36
- 读取最高轮次的 `analysis.md` / `analysis-r{N}.md`、`plan.md` / `plan-r{N}.md`,以及仍然存在的实现、修复、审查产物。
37
-
38
- ### 5. 同步 Labels 和 Issue Type
39
-
40
- > label 初始化、`status:` 替换规则、`in:` label 发现,以及 `issue-types` 映射逻辑见 `reference/label-sync.md`。编辑 Issue 元数据前先读取 `reference/label-sync.md`。
41
-
42
- ### 6. 同步 Development 关联
43
-
44
- 如果存在 `pr_number`,确保 PR 正文包含以下任一项:
45
- - `Closes #{issue-number}`
46
- - `Fixes #{issue-number}`
47
- - `Resolves #{issue-number}`
48
-
49
- ### 7. 同步里程碑
50
-
51
- > milestone 继承、版本分支推断和 `General Backlog` 回退规则见 `reference/milestone-sync.md`。编辑 Issue milestone 前先读取 `reference/milestone-sync.md`。
52
-
53
- ### 8. 同步需求复选框
54
-
55
- 从 task.md 的 `## 需求` 段落提取已勾选的 `- [x]` 项;如果没有,跳过。
56
- 读取 Issue 当前正文:`gh issue view {issue-number} --json body --jq '.body'`。
57
- 按复选框文本匹配,将 Issue body 中对应的 `- [ ] {text}` 单向替换为 `- [x] {text}`;已有 `- [x]`、未匹配项和非需求复选框保持不变。
58
- 只有在正文实际变化时,才使用 `gh api` PATCH 更新完整 body,并用 `cat <<'EOF'` heredoc 构造请求内容。
59
-
60
- ### 9. 发布上下文产物
61
-
62
- > 已有评论探测、隐藏标记、产物时间线和 summary 评论顺序见 `reference/comment-publish.md`。发布 Issue 评论前先读取 `reference/comment-publish.md`。
63
-
64
- > **Shell 安全规则**(发布评论前必读):
65
- > 1. `{comment-body}` 必须替换为**实际的内联文本**。先用 Read 工具读取文件,再将全文粘贴到 heredoc body 中。**禁止**在 `<<'EOF'` 内部使用 `$(cat ...)`、`$(< ...)`、`$(...)`、`${...}`。带引号 heredoc 会阻止所有命令替换和变量展开,它们会被当作字面文本输出。
66
- > 2. 构造含 `<!-- -->` 的字符串时,**禁止使用 `echo`**。bash/zsh 中 `echo` 会将 `!` 转义为 `\!`,导致隐藏标识可见。所有评论内容以及步骤 8 的 Issue body 更新都统一使用 `cat <<'EOF'` heredoc 或 `printf '%s\n'` 构造。
67
-
68
- ### 10. 更新任务状态
69
-
70
- 获取当前时间:
71
-
72
- ```bash
73
- date "+%Y-%m-%d %H:%M:%S"
74
- ```
75
-
76
- 更新 task.md 中的 `last_synced_at`,并追加 Sync to Issue 的 Activity Log。
77
-
78
- ### 11. 告知用户
79
-
80
- 汇总已同步的 labels、milestone、development 关联、已发布评论,并给出 Issue URL。
81
-
82
- ## 注意事项
83
-
84
- - 隐藏评论标记必须保持为 `<!-- sync-issue:{task-id}:{file-stem} -->`
85
- - 产物时间线按 Activity Log 顺序构建,而不是固定的 `analysis -> plan -> implementation -> review -> summary`
86
- - 发布评论和更新 Issue body 时遵守步骤 9 的 Shell 安全规则,不要在带引号 heredoc 中依赖命令替换,也不要用 `echo` 构造 HTML 注释标记
87
-
88
- ## 错误处理
89
-
90
- - 任务未找到:`Task {task-id} not found`
91
- - 缺少 `issue_number`:`Task has no issue_number field`
92
- - GitHub CLI 认证失败:`Please check GitHub CLI authentication`
93
- - Issue 不存在:`Issue #{number} not found`
@@ -1,84 +0,0 @@
1
- # Comment Publication
2
-
3
- Read this file before creating or updating Issue comments.
4
-
5
- ## Fetch Existing Comments and Build the Published Artifact Set
6
-
7
- Use hidden markers like:
8
-
9
- ```html
10
- <!-- sync-issue:{task-id}:{file-stem} -->
11
- ```
12
-
13
- Artifact extraction rules:
14
- - extract artifact filenames from Activity Log with `/→\s+(\S+\.md)\s*$/`
15
- - drop the `.md` suffix to get `{file-stem}`
16
- - build the artifact timeline in Activity Log order
17
- - append `summary` as the fixed final artifact
18
-
19
- Build the artifact timeline in Activity Log order. Only include artifacts whose files still exist.
20
- Typical artifact filenames include `implementation-r*.md` and `review-r*.md`.
21
-
22
- Published-set detection:
23
-
24
- ```bash
25
- grep -qF "<!-- sync-issue:{task-id}:{file-stem} -->" "$comments_jsonl"
26
- ```
27
-
28
- Interpretation:
29
- - match found -> the artifact is already published
30
- - no match -> the artifact can be created now
31
-
32
- Define `has_unpublished_artifacts` before publishing comments: whether any non-`summary` artifact in the timeline is still unpublished. Keep that flag fixed while processing this sync pass.
33
-
34
- Recommended title mapping:
35
-
36
- | file-stem | title |
37
- |---|---|
38
- | `analysis` | `Requirements Analysis` |
39
- | `analysis-r{N}` | `Requirements Analysis (Round {N})` |
40
- | `plan` | `Technical Plan` |
41
- | `plan-r{N}` | `Technical Plan (Round {N})` |
42
- | `implementation` | `Implementation Report (Round 1)` |
43
- | `implementation-r{N}` | `Implementation Report (Round {N})` |
44
- | `refinement` | `Refinement Report (Round 1)` |
45
- | `refinement-r{N}` | `Refinement Report (Round {N})` |
46
- | `review` | `Review Report (Round 1)` |
47
- | `review-r{N}` | `Review Report (Round {N})` |
48
- | `summary` | `Delivery Summary` |
49
-
50
- ## Publish Context Files One by One in Timeline Order
51
-
52
- Keep `summary` last. Do not collapse multiple rounds into one comment.
53
-
54
- Unified comment format:
55
-
56
- ```markdown
57
- <!-- sync-issue:{task-id}:{file-stem} -->
58
- ## {artifact-title}
59
-
60
- {artifact original body or summary body}
61
-
62
- ---
63
- *Generated by AI · Internal tracking: {task-id}*
64
- ```
65
-
66
- Summary handling rules:
67
- - if `summary` does not exist, create it
68
- - if `summary` exists and `has_unpublished_artifacts=true`, delete the old `summary` and recreate it at the end
69
- - if `summary` exists, `has_unpublished_artifacts=false`, and the content changed, patch the existing comment in place
70
- - if `summary` exists, `has_unpublished_artifacts=false`, and the content is unchanged, do nothing
71
-
72
- Zero-operation rule:
73
- - if all artifacts are already synced and `summary` content is unchanged, publish nothing and report `All artifacts are already synced; no new content`
74
-
75
- When updating an existing summary comment, use:
76
-
77
- ```bash
78
- gh api "repos/$repo/issues/comments/{summary_comment_id}" -X PATCH -f body="$(cat <<'EOF'
79
- {comment-body}
80
- EOF
81
- )"
82
- ```
83
-
84
- Do not fall back to a fixed `analysis -> plan -> implementation -> review -> summary` order.
@@ -1,84 +0,0 @@
1
- # 评论发布规则
2
-
3
- 在创建或更新 Issue 评论之前先读取本文件。
4
-
5
- ## 拉取已有评论并构建已发布产物集合
6
-
7
- 使用如下隐藏标记:
8
-
9
- ```html
10
- <!-- sync-issue:{task-id}:{file-stem} -->
11
- ```
12
-
13
- 产物提取规则:
14
- - 用 `/→\s+(\S+\.md)\s*$/` 从 Activity Log 中提取产物文件名
15
- - 去掉 `.md` 后缀得到 `{file-stem}`
16
- - 按 Activity Log 顺序构建产物时间线
17
- - 固定把 `summary` 追加到最后
18
-
19
- 产物时间线必须按 Activity Log 顺序构建。只包含任务目录中仍然存在的产物文件。
20
- 常见产物文件名包括 `implementation-r*.md` 和 `review-r*.md`。
21
-
22
- 已发布集合检测:
23
-
24
- ```bash
25
- grep -qF "<!-- sync-issue:{task-id}:{file-stem} -->" "$comments_jsonl"
26
- ```
27
-
28
- 含义:
29
- - 找到匹配 -> 该产物已经发布过
30
- - 没有匹配 -> 该产物本轮可以创建
31
-
32
- 在开始发布评论前,先定义 `has_unpublished_artifacts`:即时间线中是否还存在任何未发布的非 `summary` 产物。该标志在本轮同步过程中保持不变。
33
-
34
- 推荐标题映射:
35
-
36
- | file-stem | title |
37
- |---|---|
38
- | `analysis` | `需求分析` |
39
- | `analysis-r{N}` | `需求分析(Round {N})` |
40
- | `plan` | `技术方案` |
41
- | `plan-r{N}` | `技术方案(Round {N})` |
42
- | `implementation` | `实现报告(Round 1)` |
43
- | `implementation-r{N}` | `实现报告(Round {N})` |
44
- | `refinement` | `修复报告(Round 1)` |
45
- | `refinement-r{N}` | `修复报告(Round {N})` |
46
- | `review` | `审查报告(Round 1)` |
47
- | `review-r{N}` | `审查报告(Round {N})` |
48
- | `summary` | `交付摘要` |
49
-
50
- ## 按时间线顺序逐个发布上下文产物
51
-
52
- 始终把 `summary` 放在最后。不要把多个轮次折叠成一条评论。
53
-
54
- 统一评论格式:
55
-
56
- ```markdown
57
- <!-- sync-issue:{task-id}:{file-stem} -->
58
- ## {artifact-title}
59
-
60
- {artifact original body or summary body}
61
-
62
- ---
63
- *由 AI 自动生成 · 内部追踪:{task-id}*
64
- ```
65
-
66
- `summary` 处理规则:
67
- - 如果 `summary` 不存在,就创建它
68
- - 如果 `summary` 已存在且 `has_unpublished_artifacts=true`,删除旧的 `summary`,并在最后重新创建
69
- - 如果 `summary` 已存在、`has_unpublished_artifacts=false`,且内容发生变化,则原地 patch 该评论
70
- - 如果 `summary` 已存在、`has_unpublished_artifacts=false`,且内容没有变化,则不做任何操作
71
-
72
- 零操作规则:
73
- - 如果所有产物都已同步,且 `summary` 内容未变化,则不要发布任何内容,并报告 `所有产物已同步,无新内容`
74
-
75
- 更新已有 `summary` 评论时,使用:
76
-
77
- ```bash
78
- gh api "repos/$repo/issues/comments/{summary_comment_id}" -X PATCH -f body="$(cat <<'EOF'
79
- {comment-body}
80
- EOF
81
- )"
82
- ```
83
-
84
- 不要回退到固定的 `analysis -> plan -> implementation -> review -> summary` 顺序。
@@ -1,62 +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
- | Issue is closed (`state = CLOSED`) | add no new `status:` label |
28
- | task lives under `completed/` | add no new `status:` label |
29
- | task lives under `blocked/` | add `status: blocked` |
30
- | `current_step` ∈ {`requirement-analysis`, `technical-design`} | add `status: pending-design-work` |
31
- | `current_step` ∈ {`implementation`, `code-review`, `refinement`} | add `status: in-progress` |
32
-
33
- `in:` label workflow:
34
-
35
- ```bash
36
- gh label list --search "in: {module}" --limit 10 --json name --jq '.[].name'
37
- gh issue edit {issue-number} --add-label "in: {module}"
38
- ```
39
-
40
- `in:` label flow:
41
- 1. extract changed file paths from implementation artifacts first; fall back to analysis artifacts only when implementation artifacts do not exist
42
- 2. take the first path segment as `{module}`
43
- 3. de-duplicate all inferred modules
44
- 4. check whether each exact `in: {module}` label exists before adding it
45
- 5. add matching labels only; never remove existing `in:` labels
46
-
47
- Issue Type workflow:
48
-
49
- ```bash
50
- gh api "orgs/$owner/issue-types" --jq '.[].name'
51
- gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{name}"
52
- ```
53
-
54
- Issue Type mapping:
55
-
56
- | task.md type | GitHub Issue Type |
57
- |---|---|
58
- | `bug`, `bugfix` | `Bug` |
59
- | `feature`, `enhancement` | `Feature` |
60
- | `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring`, and all other values | `Task` |
61
-
62
- If Issue Types are unavailable, record `Issue Type: skipped (not enabled)` and continue.
@@ -1,62 +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
- | Issue 已关闭(`state = CLOSED`) | 不新增 `status:` label |
28
- | 任务位于 `completed/` 目录下 | 不新增 `status:` label |
29
- | 任务位于 `blocked/` 目录下 | 添加 `status: blocked` |
30
- | `current_step` ∈ {`requirement-analysis`, `technical-design`} | 添加 `status: pending-design-work` |
31
- | `current_step` ∈ {`implementation`, `code-review`, `refinement`} | 添加 `status: in-progress` |
32
-
33
- `in:` label 工作流:
34
-
35
- ```bash
36
- gh label list --search "in: {module}" --limit 10 --json name --jq '.[].name'
37
- gh issue edit {issue-number} --add-label "in: {module}"
38
- ```
39
-
40
- `in:` label 流程:
41
- 1. 优先从实现产物中提取改动文件路径;只有在不存在实现产物时,才回退到分析产物
42
- 2. 取路径的第一级目录作为 `{module}`
43
- 3. 对推断出的所有模块去重
44
- 4. 仅在对应的精确 `in: {module}` label 存在时才添加
45
- 5. 只添加匹配的 label;绝不移除已有的 `in:` label
46
-
47
- Issue 类型工作流:
48
-
49
- ```bash
50
- gh api "orgs/$owner/issue-types" --jq '.[].name'
51
- gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{name}"
52
- ```
53
-
54
- Issue 类型映射:
55
-
56
- | task.md 类型 | GitHub Issue 类型 |
57
- |---|---|
58
- | `bug`, `bugfix` | `Bug` |
59
- | `feature`, `enhancement` | `Feature` |
60
- | `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring` 以及其他所有值 | `Task` |
61
-
62
- 如果 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
- ```