Skip to content

Commit 127013b

Browse files
CodeCasterXclaudecodex
authored
feat(templates): stage Issue field writes, verify at create-pr (#358)
- Require AI-inferred priority/effort at create-task; write start_date at analyze and target_date at plan; sync non-empty fields via issue-fields Flow A at analyze/plan/complete (idempotent, best-effort) - Enable verify_issue_fields in the create-pr gate as the single drift checkpoint (hard fail with diagnostic; skip on fetch failure) - Add structural tests: create-pr verify_issue_fields=true plus deploy/ template parity for create-pr verify.json and analyze/plan/complete SKILL Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Codex <noreply@openai.com>
1 parent bb84724 commit 127013b

16 files changed

Lines changed: 48 additions & 9 deletions

File tree

.agents/skills/analyze-task/SKILL.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ description: "分析任务并输出需求分析文档"
4949

5050
### 4. 执行需求分析
5151

52+
开始分析前:若 frontmatter 的 `start_date` 为空,立即写入当日日期(命令 `date +%F`,格式 `YYYY-MM-DD`);已有值则保留。写入前先读取 `.agents/rules/version-stamp.md`,并同步刷新 `updated_at` / `agent_infra_version`
53+
5254
遵循 `.agents/workflows/feature-development.yaml` 中的 `analysis` 步骤:
5355

5456
**必要任务**(仅分析,不编写业务代码):
@@ -126,6 +128,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
126128
- 按 issue-sync.md 设置 `status: pending-design-work`
127129
- 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
128130
- 发布 `{analysis-artifact}` 评论
131+
- 读取 `.agents/rules/issue-fields.md`,按流程 A 把 `task.md` 中所有非空的 Issue 字段(`priority`/`effort`/`start_date`/`target_date`)同步到 Issue(幂等;`has_push=false` 或取数/写入失败时跳过,不阻断)
129132

130133
### 7. 完成校验
131134

.agents/skills/complete-task/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ ls .agents/workspace/completed/{task-id}/task.md
9898
- 按 issue-sync.md 的需求复选框同步步骤,兜底同步 `## 需求` 中已勾选的条目到 Issue body
9999
- 不要设置 `status:` label — Issue 关闭后 status label 会被自动清除
100100
- 最后创建或更新 `.agents/rules/issue-sync.md` 中定义的 summary 评论标记对应的 summary 评论
101+
- 读取 `.agents/rules/issue-fields.md`,按流程 A 把 `task.md` 中所有非空的 Issue 字段(`priority`/`effort`/`start_date`/`target_date`)同步到 Issue(幂等;`has_push=false` 或取数/写入失败时跳过,不阻断)
101102

102103
### 7. 完成校验
103104

.agents/skills/create-pr/config/verify.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"verify_in_labels_match_pr": true,
2525
"verify_pr_type_label": true,
2626
"verify_pr_assignee": true,
27+
"verify_issue_fields": true,
2728
"verify_milestone": true,
2829
"expected_pr_comment_marker_key": "prSummary"
2930
}

.agents/skills/create-task/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,16 @@ created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
7878
updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
7979
agent_infra_version: {agent_infra_version}
8080
created_by: human
81-
priority: # 可选;Urgent | High | Medium | Low
82-
effort: # 可选;High | Medium | Low
81+
priority: # 必填;由 AI 从标题/描述推断;Urgent | High | Medium | Low
82+
effort: # 必填;由 AI 从标题/描述推断;High | Medium | Low
8383
start_date: # 可选;YYYY-MM-DD
8484
target_date: # 可选;YYYY-MM-DD
8585
current_step: requirement-analysis
8686
assigned_to: {当前 AI 代理}
8787
```
8888
8989
注意:`created_by` 为 `human`,因为任务来源于用户的描述。
90-
可选 Issue 字段元数据在创建任务时可留空;不要臆测日期。
90+
priority / effort 必填:由 AI 从任务标题与描述推断后填入(候选值见 `.agents/rules/issue-fields.md`;中文输入按本地化映射规范化)。start_date / target_date 创建时保持留空,由 analyze-task / plan-task 阶段填入;不要臆测日期。
9191

9292
### 3. 更新任务状态
9393

.agents/skills/plan-task/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
9191
- `assigned_to`:{当前 AI 代理}
9292
- `updated_at`:{当前时间}
9393
- `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
94+
-`target_date` 为空,基于工作量评估写入预估完成日(`YYYY-MM-DD`);无法合理预估时保持留空、不阻塞;已有值则保留
9495
- 记录本轮方案产物:`{plan-artifact}`(Round `{plan-round}`
9596
- 如任务模板包含 `## 设计` 段落,更新为指向 `{plan-artifact}` 的链接
9697
- 在工作流进度中标记 technical-design 为已完成,并注明实际轮次(如果任务模板支持)
@@ -104,6 +105,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
104105
- 按 issue-sync.md 设置 `status: pending-design-work`
105106
- 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
106107
- 发布 `{plan-artifact}` 评论
108+
- 读取 `.agents/rules/issue-fields.md`,按流程 A 把 `task.md` 中所有非空的 Issue 字段(`priority`/`effort`/`start_date`/`target_date`)同步到 Issue(幂等;`has_push=false` 或取数/写入失败时跳过,不阻断)
107109

108110
### 8. 完成校验
109111

templates/.agents/skills/analyze-task/SKILL.en.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ If `task.md` contains these source fields, also read the corresponding source in
4949

5050
### 4. Perform Requirements Analysis
5151

52+
Before analysis begins: if `start_date` in the frontmatter is empty, write today's date immediately (command: `date +%F`, format `YYYY-MM-DD`); keep any existing value. Before writing, read `.agents/rules/version-stamp.md` and refresh `updated_at` / `agent_infra_version` at the same time.
53+
5254
Follow the `analysis` step in `.agents/workflows/feature-development.yaml`:
5355

5456
**Required tasks** (analysis only, no business code changes):
@@ -126,6 +128,7 @@ If task.md contains a valid `issue_number`, perform these sync actions (skip and
126128
- Set `status: pending-design-work` by following issue-sync.md
127129
- Create or update the task comment marker defined in `.agents/rules/issue-sync.md` (follow the task.md comment sync rule in issue-sync.md)
128130
- Publish the `{analysis-artifact}` comment
131+
- Read `.agents/rules/issue-fields.md` and follow Flow A to sync every non-empty Issue field (`priority`/`effort`/`start_date`/`target_date`) from `task.md` to the Issue (idempotent; skip without blocking when `has_push=false` or the fetch/write fails)
129132

130133
### 7. Verification Gate
131134

templates/.agents/skills/analyze-task/SKILL.zh-CN.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ description: "分析任务并输出需求分析文档"
4949

5050
### 4. 执行需求分析
5151

52+
开始分析前:若 frontmatter 的 `start_date` 为空,立即写入当日日期(命令 `date +%F`,格式 `YYYY-MM-DD`);已有值则保留。写入前先读取 `.agents/rules/version-stamp.md`,并同步刷新 `updated_at` / `agent_infra_version`
53+
5254
遵循 `.agents/workflows/feature-development.yaml` 中的 `analysis` 步骤:
5355

5456
**必要任务**(仅分析,不编写业务代码):
@@ -126,6 +128,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
126128
- 按 issue-sync.md 设置 `status: pending-design-work`
127129
- 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
128130
- 发布 `{analysis-artifact}` 评论
131+
- 读取 `.agents/rules/issue-fields.md`,按流程 A 把 `task.md` 中所有非空的 Issue 字段(`priority`/`effort`/`start_date`/`target_date`)同步到 Issue(幂等;`has_push=false` 或取数/写入失败时跳过,不阻断)
129132

130133
### 7. 完成校验
131134

templates/.agents/skills/complete-task/SKILL.en.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ If a valid `issue_number` exists:
9898
- Backfill checked `## Requirements` items to the Issue body by following the requirements-checkbox sync steps in issue-sync.md
9999
- Do not set any `status:` label — status labels are automatically cleared when the Issue is closed
100100
- Finally create or update the summary comment marked with the summary marker defined in `.agents/rules/issue-sync.md`
101+
- Read `.agents/rules/issue-fields.md` and follow Flow A to sync every non-empty Issue field (`priority`/`effort`/`start_date`/`target_date`) from `task.md` to the Issue (idempotent; skip without blocking when `has_push=false` or the fetch/write fails)
101102

102103
### 7. Verification Gate
103104

templates/.agents/skills/complete-task/SKILL.zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ ls .agents/workspace/completed/{task-id}/task.md
9898
- 按 issue-sync.md 的需求复选框同步步骤,兜底同步 `## 需求` 中已勾选的条目到 Issue body
9999
- 不要设置 `status:` label — Issue 关闭后 status label 会被自动清除
100100
- 最后创建或更新 `.agents/rules/issue-sync.md` 中定义的 summary 评论标记对应的 summary 评论
101+
- 读取 `.agents/rules/issue-fields.md`,按流程 A 把 `task.md` 中所有非空的 Issue 字段(`priority`/`effort`/`start_date`/`target_date`)同步到 Issue(幂等;`has_push=false` 或取数/写入失败时跳过,不阻断)
101102

102103
### 7. 完成校验
103104

templates/.agents/skills/create-pr/config/verify.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"verify_in_labels_match_pr": true,
2525
"verify_pr_type_label": true,
2626
"verify_pr_assignee": true,
27+
"verify_issue_fields": true,
2728
"verify_milestone": true,
2829
"expected_pr_comment_marker_key": "prSummary"
2930
}

0 commit comments

Comments
 (0)