@fitlab-ai/agent-infra 0.3.0
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/License.txt +21 -0
- package/README.md +170 -0
- package/README.zh-CN.md +170 -0
- package/bin/cli.js +65 -0
- package/lib/defaults.json +45 -0
- package/lib/init.js +203 -0
- package/lib/log.js +27 -0
- package/lib/paths.js +48 -0
- package/lib/prompt.js +70 -0
- package/lib/render.js +99 -0
- package/lib/update.js +161 -0
- package/lib/version.js +7 -0
- package/package.json +48 -0
- package/templates/.agent-workspace/README.md +26 -0
- package/templates/.agent-workspace/README.zh-CN.md +26 -0
- package/templates/.agents/QUICKSTART.md +166 -0
- package/templates/.agents/QUICKSTART.zh-CN.md +166 -0
- package/templates/.agents/README.md +134 -0
- package/templates/.agents/README.zh-CN.md +134 -0
- package/templates/.agents/skills/analyze-task/SKILL.md +169 -0
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +169 -0
- package/templates/.agents/skills/block-task/SKILL.md +164 -0
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +163 -0
- package/templates/.agents/skills/check-task/SKILL.md +122 -0
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +122 -0
- package/templates/.agents/skills/close-codescan/SKILL.md +122 -0
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +122 -0
- package/templates/.agents/skills/close-dependabot/SKILL.md +130 -0
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +130 -0
- package/templates/.agents/skills/commit/SKILL.md +218 -0
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +217 -0
- package/templates/.agents/skills/complete-task/SKILL.md +139 -0
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +137 -0
- package/templates/.agents/skills/create-pr/SKILL.md +126 -0
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +125 -0
- package/templates/.agents/skills/create-release-note/SKILL.md +167 -0
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +166 -0
- package/templates/.agents/skills/create-task/SKILL.md +143 -0
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +143 -0
- package/templates/.agents/skills/implement-task/SKILL.md +229 -0
- package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +227 -0
- package/templates/.agents/skills/import-codescan/SKILL.md +103 -0
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +103 -0
- package/templates/.agents/skills/import-dependabot/SKILL.md +107 -0
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +107 -0
- package/templates/.agents/skills/import-issue/SKILL.md +119 -0
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +119 -0
- package/templates/.agents/skills/init-labels/SKILL.md +74 -0
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +74 -0
- package/templates/.agents/skills/init-labels/scripts/init-labels.sh +111 -0
- package/templates/.agents/skills/init-milestones/SKILL.md +74 -0
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +74 -0
- package/templates/.agents/skills/init-milestones/scripts/init-milestones.sh +169 -0
- package/templates/.agents/skills/plan-task/SKILL.md +225 -0
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +225 -0
- package/templates/.agents/skills/refine-task/SKILL.md +200 -0
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +200 -0
- package/templates/.agents/skills/refine-title/SKILL.md +84 -0
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +83 -0
- package/templates/.agents/skills/release/SKILL.md +142 -0
- package/templates/.agents/skills/release/SKILL.zh-CN.md +141 -0
- package/templates/.agents/skills/release/scripts/manage-milestones.sh +80 -0
- package/templates/.agents/skills/review-task/SKILL.md +276 -0
- package/templates/.agents/skills/review-task/SKILL.zh-CN.md +276 -0
- package/templates/.agents/skills/sync-issue/SKILL.md +569 -0
- package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +569 -0
- package/templates/.agents/skills/sync-pr/SKILL.md +142 -0
- package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +142 -0
- package/templates/.agents/skills/test/SKILL.md +61 -0
- package/templates/.agents/skills/test/SKILL.zh-CN.md +61 -0
- package/templates/.agents/skills/test-integration/SKILL.md +70 -0
- package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +69 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.md +136 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +124 -0
- package/templates/.agents/skills/update-agent-infra/scripts/package.json +3 -0
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +469 -0
- package/templates/.agents/skills/upgrade-dependency/SKILL.md +88 -0
- package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +87 -0
- package/templates/.agents/templates/handoff.md +60 -0
- package/templates/.agents/templates/handoff.zh-CN.md +60 -0
- package/templates/.agents/templates/review-report.md +67 -0
- package/templates/.agents/templates/review-report.zh-CN.md +67 -0
- package/templates/.agents/templates/task.md +65 -0
- package/templates/.agents/templates/task.zh-CN.md +65 -0
- package/templates/.agents/workflows/bug-fix.yaml +149 -0
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +149 -0
- package/templates/.agents/workflows/code-review.yaml +60 -0
- package/templates/.agents/workflows/code-review.zh-CN.yaml +60 -0
- package/templates/.agents/workflows/feature-development.yaml +150 -0
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +150 -0
- package/templates/.agents/workflows/refactoring.yaml +154 -0
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +154 -0
- package/templates/.claude/CLAUDE.md +163 -0
- package/templates/.claude/CLAUDE.zh-CN.md +163 -0
- package/templates/.claude/commands/analyze-task.md +8 -0
- package/templates/.claude/commands/analyze-task.zh-CN.md +8 -0
- package/templates/.claude/commands/block-task.md +8 -0
- package/templates/.claude/commands/block-task.zh-CN.md +8 -0
- package/templates/.claude/commands/check-task.md +8 -0
- package/templates/.claude/commands/check-task.zh-CN.md +8 -0
- package/templates/.claude/commands/close-codescan.md +8 -0
- package/templates/.claude/commands/close-codescan.zh-CN.md +8 -0
- package/templates/.claude/commands/close-dependabot.md +8 -0
- package/templates/.claude/commands/close-dependabot.zh-CN.md +8 -0
- package/templates/.claude/commands/commit.md +7 -0
- package/templates/.claude/commands/commit.zh-CN.md +7 -0
- package/templates/.claude/commands/complete-task.md +8 -0
- package/templates/.claude/commands/complete-task.zh-CN.md +8 -0
- package/templates/.claude/commands/create-pr.md +8 -0
- package/templates/.claude/commands/create-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/create-release-note.md +8 -0
- package/templates/.claude/commands/create-release-note.zh-CN.md +8 -0
- package/templates/.claude/commands/create-task.md +8 -0
- package/templates/.claude/commands/create-task.zh-CN.md +8 -0
- package/templates/.claude/commands/implement-task.md +8 -0
- package/templates/.claude/commands/implement-task.zh-CN.md +8 -0
- package/templates/.claude/commands/import-codescan.md +8 -0
- package/templates/.claude/commands/import-codescan.zh-CN.md +8 -0
- package/templates/.claude/commands/import-dependabot.md +8 -0
- package/templates/.claude/commands/import-dependabot.zh-CN.md +8 -0
- package/templates/.claude/commands/import-issue.md +8 -0
- package/templates/.claude/commands/import-issue.zh-CN.md +8 -0
- package/templates/.claude/commands/init-labels.md +7 -0
- package/templates/.claude/commands/init-labels.zh-CN.md +7 -0
- package/templates/.claude/commands/init-milestones.md +8 -0
- package/templates/.claude/commands/init-milestones.zh-CN.md +8 -0
- package/templates/.claude/commands/plan-task.md +8 -0
- package/templates/.claude/commands/plan-task.zh-CN.md +8 -0
- package/templates/.claude/commands/refine-task.md +8 -0
- package/templates/.claude/commands/refine-task.zh-CN.md +8 -0
- package/templates/.claude/commands/refine-title.md +8 -0
- package/templates/.claude/commands/refine-title.zh-CN.md +8 -0
- package/templates/.claude/commands/release.md +8 -0
- package/templates/.claude/commands/release.zh-CN.md +8 -0
- package/templates/.claude/commands/review-task.md +8 -0
- package/templates/.claude/commands/review-task.zh-CN.md +8 -0
- package/templates/.claude/commands/sync-issue.md +8 -0
- package/templates/.claude/commands/sync-issue.zh-CN.md +8 -0
- package/templates/.claude/commands/sync-pr.md +8 -0
- package/templates/.claude/commands/sync-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/test-integration.md +7 -0
- package/templates/.claude/commands/test-integration.zh-CN.md +7 -0
- package/templates/.claude/commands/test.md +7 -0
- package/templates/.claude/commands/test.zh-CN.md +7 -0
- package/templates/.claude/commands/update-agent-infra.md +7 -0
- package/templates/.claude/commands/update-agent-infra.zh-CN.md +7 -0
- package/templates/.claude/commands/upgrade-dependency.md +8 -0
- package/templates/.claude/commands/upgrade-dependency.zh-CN.md +8 -0
- package/templates/.claude/project-rules.md +65 -0
- package/templates/.claude/project-rules.zh-CN.md +65 -0
- package/templates/.claude/settings.json +20 -0
- package/templates/.codex/README.md +38 -0
- package/templates/.codex/README.zh-CN.md +37 -0
- package/templates/.editorconfig +15 -0
- package/templates/.gemini/commands/_project_/analyze-task.toml +8 -0
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/block-task.toml +8 -0
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/check-task.toml +8 -0
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/close-codescan.toml +8 -0
- package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/close-dependabot.toml +8 -0
- package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/commit.toml +6 -0
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/complete-task.toml +8 -0
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-pr.toml +8 -0
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-release-note.toml +8 -0
- package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/create-task.toml +8 -0
- package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/implement-task.toml +8 -0
- package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-codescan.toml +8 -0
- package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-dependabot.toml +8 -0
- package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/import-issue.toml +8 -0
- package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-milestones.toml +10 -0
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +10 -0
- package/templates/.gemini/commands/_project_/plan-task.toml +8 -0
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-task.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-title.toml +8 -0
- package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/release.toml +8 -0
- package/templates/.gemini/commands/_project_/release.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-task.toml +8 -0
- package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-issue.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-pr.toml +8 -0
- package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/test-integration.toml +6 -0
- package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/test.toml +6 -0
- package/templates/.gemini/commands/_project_/test.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/update-agent-infra.toml +6 -0
- package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +6 -0
- package/templates/.gemini/commands/_project_/upgrade-dependency.toml +8 -0
- package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +8 -0
- package/templates/.gemini/settings.json +3 -0
- package/templates/.github/ISSUE_TEMPLATE/01_bug_report.yml +149 -0
- package/templates/.github/ISSUE_TEMPLATE/02_question.yml +101 -0
- package/templates/.github/ISSUE_TEMPLATE/03_feature_request.yml +131 -0
- package/templates/.github/ISSUE_TEMPLATE/04_documentation.yml +165 -0
- package/templates/.github/ISSUE_TEMPLATE/05_other.yml +147 -0
- package/templates/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/templates/.github/PULL_REQUEST_TEMPLATE.md +123 -0
- package/templates/.github/dependabot.yml +17 -0
- package/templates/.github/hooks/check-utf8-encoding.sh +25 -0
- package/templates/.github/release.yml +27 -0
- package/templates/.github/workflows/pr-title-check.yml +42 -0
- package/templates/.mailmap +4 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.md +232 -0
- package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +232 -0
- package/templates/.opencode/README.md +76 -0
- package/templates/.opencode/README.zh-CN.md +77 -0
- package/templates/.opencode/commands/analyze-task.md +11 -0
- package/templates/.opencode/commands/analyze-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/block-task.md +11 -0
- package/templates/.opencode/commands/block-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/check-task.md +11 -0
- package/templates/.opencode/commands/check-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/close-codescan.md +11 -0
- package/templates/.opencode/commands/close-codescan.zh-CN.md +11 -0
- package/templates/.opencode/commands/close-dependabot.md +11 -0
- package/templates/.opencode/commands/close-dependabot.zh-CN.md +11 -0
- package/templates/.opencode/commands/commit.md +9 -0
- package/templates/.opencode/commands/commit.zh-CN.md +9 -0
- package/templates/.opencode/commands/complete-task.md +11 -0
- package/templates/.opencode/commands/complete-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-pr.md +11 -0
- package/templates/.opencode/commands/create-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-release-note.md +11 -0
- package/templates/.opencode/commands/create-release-note.zh-CN.md +11 -0
- package/templates/.opencode/commands/create-task.md +11 -0
- package/templates/.opencode/commands/create-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/implement-task.md +11 -0
- package/templates/.opencode/commands/implement-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-codescan.md +11 -0
- package/templates/.opencode/commands/import-codescan.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-dependabot.md +11 -0
- package/templates/.opencode/commands/import-dependabot.zh-CN.md +11 -0
- package/templates/.opencode/commands/import-issue.md +11 -0
- package/templates/.opencode/commands/import-issue.zh-CN.md +11 -0
- package/templates/.opencode/commands/init-labels.md +9 -0
- package/templates/.opencode/commands/init-labels.zh-CN.md +9 -0
- package/templates/.opencode/commands/init-milestones.md +11 -0
- package/templates/.opencode/commands/init-milestones.zh-CN.md +11 -0
- package/templates/.opencode/commands/plan-task.md +11 -0
- package/templates/.opencode/commands/plan-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/refine-task.md +11 -0
- package/templates/.opencode/commands/refine-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/refine-title.md +11 -0
- package/templates/.opencode/commands/refine-title.zh-CN.md +11 -0
- package/templates/.opencode/commands/release.md +11 -0
- package/templates/.opencode/commands/release.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-task.md +11 -0
- package/templates/.opencode/commands/review-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/sync-issue.md +11 -0
- package/templates/.opencode/commands/sync-issue.zh-CN.md +11 -0
- package/templates/.opencode/commands/sync-pr.md +11 -0
- package/templates/.opencode/commands/sync-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/test-integration.md +9 -0
- package/templates/.opencode/commands/test-integration.zh-CN.md +9 -0
- package/templates/.opencode/commands/test.md +9 -0
- package/templates/.opencode/commands/test.zh-CN.md +9 -0
- package/templates/.opencode/commands/update-agent-infra.md +9 -0
- package/templates/.opencode/commands/update-agent-infra.zh-CN.md +9 -0
- package/templates/.opencode/commands/upgrade-dependency.md +11 -0
- package/templates/.opencode/commands/upgrade-dependency.zh-CN.md +11 -0
- package/templates/AGENTS.md +91 -0
- package/templates/AGENTS.zh-CN.md +91 -0
- package/templates/CONTRIBUTING.md +126 -0
- package/templates/CONTRIBUTING.zh-CN.md +124 -0
- package/templates/SECURITY.md +131 -0
- package/templates/SECURITY.zh-CN.md +131 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync-pr
|
|
3
|
+
description: >
|
|
4
|
+
将任务处理进度同步到对应的 Pull Request 评论。
|
|
5
|
+
当用户要求同步进度到 PR 时触发。参数:task-id。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 同步进度到 PR
|
|
9
|
+
|
|
10
|
+
将任务处理进度同步到关联的 Pull Request。参数:task-id。
|
|
11
|
+
|
|
12
|
+
## 执行流程
|
|
13
|
+
|
|
14
|
+
### 1. 验证任务存在
|
|
15
|
+
|
|
16
|
+
按优先顺序搜索任务:
|
|
17
|
+
- `.agent-workspace/active/{task-id}/task.md`
|
|
18
|
+
- `.agent-workspace/completed/{task-id}/task.md`
|
|
19
|
+
- `.agent-workspace/blocked/{task-id}/task.md`
|
|
20
|
+
|
|
21
|
+
注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
|
|
22
|
+
|
|
23
|
+
### 2. 读取任务信息
|
|
24
|
+
|
|
25
|
+
从 task.md 中提取:
|
|
26
|
+
- `pr_number`(必需 —— 如果缺失,提示用户)
|
|
27
|
+
- 任务标题、描述、状态
|
|
28
|
+
- `current_step`、`created_at`、`updated_at`
|
|
29
|
+
- `issue_number`(如适用)
|
|
30
|
+
|
|
31
|
+
### 3. 读取上下文文件
|
|
32
|
+
|
|
33
|
+
检查并读取(如存在):
|
|
34
|
+
- 最高轮次的 `analysis.md` / `analysis-r{N}.md` - 需求分析
|
|
35
|
+
- 最高轮次的 `plan.md` / `plan-r{N}.md` - 技术方案
|
|
36
|
+
- `implementation.md`、`implementation-r{N}.md` - 实现报告
|
|
37
|
+
- `refinement.md`、`refinement-r{N}.md` - 修复报告
|
|
38
|
+
- `review.md`、`review-r{N}.md` - 审查报告
|
|
39
|
+
|
|
40
|
+
### 4. 生成进度摘要
|
|
41
|
+
|
|
42
|
+
生成面向**代码审查者**的清晰进度摘要:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## 开发进度更新
|
|
46
|
+
|
|
47
|
+
**任务 ID**:{task-id}
|
|
48
|
+
**更新时间**:{当前时间}
|
|
49
|
+
**状态**:{状态描述}
|
|
50
|
+
|
|
51
|
+
### 已完成步骤
|
|
52
|
+
|
|
53
|
+
- [x] 需求分析 - {完成时间}
|
|
54
|
+
- {1-2 个关键要点}
|
|
55
|
+
- [x] 技术设计 - {完成时间}
|
|
56
|
+
- {关键决策}
|
|
57
|
+
- [x] 实现 - {完成时间}
|
|
58
|
+
- 修改文件数:{数量}
|
|
59
|
+
- 新增测试数:{数量}
|
|
60
|
+
- [ ] 代码审查(进行中)
|
|
61
|
+
- [ ] 最终合并
|
|
62
|
+
|
|
63
|
+
### 当前进度
|
|
64
|
+
|
|
65
|
+
{当前步骤的详细描述}
|
|
66
|
+
|
|
67
|
+
### 下一步
|
|
68
|
+
|
|
69
|
+
{接下来需要做什么}
|
|
70
|
+
|
|
71
|
+
### 技术亮点
|
|
72
|
+
|
|
73
|
+
{供审查者参考的关键技术决策和实现细节}
|
|
74
|
+
|
|
75
|
+
### 相关文档
|
|
76
|
+
|
|
77
|
+
- 任务:`.agent-workspace/{status}/{task-id}/task.md`
|
|
78
|
+
- 分析:`.agent-workspace/{status}/{task-id}/{analysis-artifact}`
|
|
79
|
+
- 方案:`.agent-workspace/{status}/{task-id}/{plan-artifact}`
|
|
80
|
+
- 实现:`.agent-workspace/{status}/{task-id}/{implementation-artifact}`
|
|
81
|
+
- 修复:`.agent-workspace/{status}/{task-id}/{refinement-artifact}`(如存在)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
*由 AI 自动生成 - [任务管理](.agents/README.md)*
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**摘要原则**:
|
|
88
|
+
- **面向审查者**:突出技术决策和实现细节
|
|
89
|
+
- **简洁**:每个阶段仅提取关键要点
|
|
90
|
+
- **逻辑清晰**:按时间顺序呈现进度
|
|
91
|
+
- **便于审查**:解释关键变更的原因
|
|
92
|
+
|
|
93
|
+
### 5. 发布到 PR
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
gh pr comment {pr-number} --body "$(cat <<'EOF'
|
|
97
|
+
{生成的摘要}
|
|
98
|
+
EOF
|
|
99
|
+
)"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 6. 更新任务状态
|
|
103
|
+
|
|
104
|
+
获取当前时间:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
date "+%Y-%m-%d %H:%M:%S"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
在 task.md 中添加或更新 `last_synced_to_pr_at` 字段为 `{当前时间}`。
|
|
111
|
+
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
112
|
+
```
|
|
113
|
+
- {yyyy-MM-dd HH:mm:ss} — **Sync to PR** by {agent} — Progress synced to PR #{pr-number}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 7. 告知用户
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
进度已同步到 PR #{pr-number}。
|
|
120
|
+
|
|
121
|
+
已同步内容:
|
|
122
|
+
- 已完成步骤:{数量}
|
|
123
|
+
- 当前状态:{状态}
|
|
124
|
+
- 下一步:{描述}
|
|
125
|
+
|
|
126
|
+
查看:https://github.com/{owner}/{repo}/pull/{pr-number}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 注意事项
|
|
130
|
+
|
|
131
|
+
1. **需要 PR 编号**:任务的 task.md 中必须有 `pr_number`。如果缺失,提示用户。
|
|
132
|
+
2. **受众**:`sync-pr` 技能面向代码审查者;`sync-issue` 技能面向利益相关者。关注点不同。
|
|
133
|
+
3. **同步时机**:在完成重要阶段后同步,而不是每个小变更后都同步。
|
|
134
|
+
4. **避免刷屏**:不要同步过于频繁 —— 合并更新内容。
|
|
135
|
+
|
|
136
|
+
## 错误处理
|
|
137
|
+
|
|
138
|
+
- 任务未找到:提示 "Task {task-id} not found"
|
|
139
|
+
- 缺少 PR 编号:提示 "Task has no pr_number field"
|
|
140
|
+
- PR 未找到:提示 "PR #{number} not found"
|
|
141
|
+
- PR 已关闭:提示 "PR #{number} is already closed"
|
|
142
|
+
- gh 认证失败:提示 "Please check GitHub CLI authentication"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test
|
|
3
|
+
description: >
|
|
4
|
+
Execute the project's full test workflow (compilation check + unit tests).
|
|
5
|
+
Triggered when the user requests running tests or verifying code quality.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Run Tests
|
|
9
|
+
|
|
10
|
+
Execute the project's full test workflow including compilation checks and unit tests.
|
|
11
|
+
|
|
12
|
+
<!-- TODO: Replace the commands below with your project's actual commands -->
|
|
13
|
+
|
|
14
|
+
## 1. Compilation / Type Check
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# TODO: Replace with your project's compilation command
|
|
18
|
+
# npx tsc --noEmit (TypeScript)
|
|
19
|
+
# mvn compile (Maven)
|
|
20
|
+
# go build ./... (Go)
|
|
21
|
+
# make build (generic)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Confirm no compilation errors.
|
|
25
|
+
|
|
26
|
+
## 2. Run All Unit Tests
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# TODO: Replace with your project's test command
|
|
30
|
+
# npm test (Node.js)
|
|
31
|
+
# mvn test (Maven)
|
|
32
|
+
# pytest (Python)
|
|
33
|
+
# go test ./... (Go)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 3. Output Results
|
|
37
|
+
|
|
38
|
+
Report test result summary:
|
|
39
|
+
- Total tests run
|
|
40
|
+
- Passing count
|
|
41
|
+
- Failing count (with details for each failure)
|
|
42
|
+
- Test coverage (if configured)
|
|
43
|
+
|
|
44
|
+
## Failure Handling
|
|
45
|
+
|
|
46
|
+
If tests fail:
|
|
47
|
+
- Output failure details and suggested fix direction
|
|
48
|
+
- Do NOT auto-fix code - wait for user decision
|
|
49
|
+
|
|
50
|
+
## Next Steps
|
|
51
|
+
|
|
52
|
+
After tests pass, suggest committing the changes:
|
|
53
|
+
|
|
54
|
+
> **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Next step - commit changes:
|
|
58
|
+
- Claude Code / OpenCode: /commit
|
|
59
|
+
- Gemini CLI: /{{project}}:commit
|
|
60
|
+
- Codex CLI: $commit
|
|
61
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test
|
|
3
|
+
description: >
|
|
4
|
+
执行项目完整测试流程(编译检查 + 单元测试)。
|
|
5
|
+
当用户要求运行测试或验证代码质量时触发。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 执行测试
|
|
9
|
+
|
|
10
|
+
执行项目的完整测试流程,包括编译检查和单元测试。
|
|
11
|
+
|
|
12
|
+
<!-- TODO: 将以下命令替换为你的项目实际命令 -->
|
|
13
|
+
|
|
14
|
+
## 1. 编译 / 类型检查
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# TODO: 替换为你的项目编译命令
|
|
18
|
+
# npx tsc --noEmit (TypeScript)
|
|
19
|
+
# mvn compile (Maven)
|
|
20
|
+
# go build ./... (Go)
|
|
21
|
+
# make build (通用)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
确认无编译错误。
|
|
25
|
+
|
|
26
|
+
## 2. 运行所有单元测试
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# TODO: 替换为你的项目测试命令
|
|
30
|
+
# npm test (Node.js)
|
|
31
|
+
# mvn test (Maven)
|
|
32
|
+
# pytest (Python)
|
|
33
|
+
# go test ./... (Go)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 3. 输出结果
|
|
37
|
+
|
|
38
|
+
报告测试结果摘要:
|
|
39
|
+
- 运行的总测试数
|
|
40
|
+
- 通过数量
|
|
41
|
+
- 失败数量(包含每个失败的详情)
|
|
42
|
+
- 测试覆盖率(如已配置)
|
|
43
|
+
|
|
44
|
+
## 失败处理
|
|
45
|
+
|
|
46
|
+
如果测试失败:
|
|
47
|
+
- 输出失败详情和建议的修复方向
|
|
48
|
+
- 不要自动修复代码 —— 等待用户决定
|
|
49
|
+
|
|
50
|
+
## 后续步骤
|
|
51
|
+
|
|
52
|
+
测试通过后,建议提交变更:
|
|
53
|
+
|
|
54
|
+
> **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
下一步 - 提交代码:
|
|
58
|
+
- Claude Code / OpenCode:/commit
|
|
59
|
+
- Gemini CLI:/{{project}}:commit
|
|
60
|
+
- Codex CLI:$commit
|
|
61
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-integration
|
|
3
|
+
description: >
|
|
4
|
+
Execute the project's integration test workflow.
|
|
5
|
+
Triggered when the user requests running integration tests
|
|
6
|
+
or end-to-end verification.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Run Integration Tests
|
|
10
|
+
|
|
11
|
+
Execute the project's integration test workflow for end-to-end verification.
|
|
12
|
+
|
|
13
|
+
<!-- TODO: Replace the commands below with your project's actual commands -->
|
|
14
|
+
|
|
15
|
+
## 1. Verify Build Artifacts
|
|
16
|
+
|
|
17
|
+
Ensure the project has been built before running integration tests.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# TODO: Replace with your project's build verification
|
|
21
|
+
# ls build/ (check build output exists)
|
|
22
|
+
# npm run build (Node.js)
|
|
23
|
+
# mvn package -DskipTests (Maven)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If build artifacts don't exist, prompt user to run the test skill first.
|
|
27
|
+
|
|
28
|
+
## 2. Run Integration Tests
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# TODO: Replace with your project's integration test command
|
|
32
|
+
# npm run test:integration (Node.js)
|
|
33
|
+
# mvn verify (Maven)
|
|
34
|
+
# pytest tests/integration/ (Python)
|
|
35
|
+
# go test -tags=integration ./... (Go)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 3. Output Results
|
|
39
|
+
|
|
40
|
+
Report results:
|
|
41
|
+
- Tests run / passed / failed
|
|
42
|
+
- Environment issues (if any)
|
|
43
|
+
- Failure details (if any)
|
|
44
|
+
|
|
45
|
+
## Failure Handling
|
|
46
|
+
|
|
47
|
+
If tests fail:
|
|
48
|
+
- Output failure details
|
|
49
|
+
- Check for environment issues (ports in use, services not running, etc.)
|
|
50
|
+
- Do NOT auto-fix - wait for user decision
|
|
51
|
+
|
|
52
|
+
## Next Steps
|
|
53
|
+
|
|
54
|
+
After tests pass, suggest committing the changes:
|
|
55
|
+
|
|
56
|
+
> **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Next step - commit changes:
|
|
60
|
+
- Claude Code / OpenCode: /commit
|
|
61
|
+
- Gemini CLI: /{{project}}:commit
|
|
62
|
+
- Codex CLI: $commit
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Notes
|
|
66
|
+
|
|
67
|
+
1. **Prerequisites**: Usually requires a successful build first (run the test skill)
|
|
68
|
+
2. **Environment**: Integration tests may require external services (databases, APIs, etc.)
|
|
69
|
+
3. **Timeouts**: Integration tests typically take longer; be patient
|
|
70
|
+
4. **Cleanup**: Ensure test environment is cleaned up after tests complete
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-integration
|
|
3
|
+
description: >
|
|
4
|
+
执行项目集成测试流程。
|
|
5
|
+
当用户要求运行集成测试或端到端验证时触发。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 运行集成测试
|
|
9
|
+
|
|
10
|
+
执行项目的集成测试流程,进行端到端验证。
|
|
11
|
+
|
|
12
|
+
<!-- TODO: 将以下命令替换为你的项目实际命令 -->
|
|
13
|
+
|
|
14
|
+
## 1. 验证构建产物
|
|
15
|
+
|
|
16
|
+
在运行集成测试前确保项目已构建。
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# TODO: 替换为你的项目构建验证命令
|
|
20
|
+
# ls build/ (检查构建输出是否存在)
|
|
21
|
+
# npm run build (Node.js)
|
|
22
|
+
# mvn package -DskipTests (Maven)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
如果构建产物不存在,提示用户先执行 test 技能。
|
|
26
|
+
|
|
27
|
+
## 2. 运行集成测试
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# TODO: 替换为你的项目集成测试命令
|
|
31
|
+
# npm run test:integration (Node.js)
|
|
32
|
+
# mvn verify (Maven)
|
|
33
|
+
# pytest tests/integration/ (Python)
|
|
34
|
+
# go test -tags=integration ./... (Go)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 3. 输出结果
|
|
38
|
+
|
|
39
|
+
报告结果:
|
|
40
|
+
- 运行/通过/失败的测试数
|
|
41
|
+
- 环境问题(如有)
|
|
42
|
+
- 失败详情(如有)
|
|
43
|
+
|
|
44
|
+
## 失败处理
|
|
45
|
+
|
|
46
|
+
如果测试失败:
|
|
47
|
+
- 输出失败详情
|
|
48
|
+
- 检查环境问题(端口占用、服务未运行等)
|
|
49
|
+
- 不要自动修复 —— 等待用户决定
|
|
50
|
+
|
|
51
|
+
## 后续步骤
|
|
52
|
+
|
|
53
|
+
测试通过后,建议提交变更:
|
|
54
|
+
|
|
55
|
+
> **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
下一步 - 提交代码:
|
|
59
|
+
- Claude Code / OpenCode:/commit
|
|
60
|
+
- Gemini CLI:/{{project}}:commit
|
|
61
|
+
- Codex CLI:$commit
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 注意事项
|
|
65
|
+
|
|
66
|
+
1. **前置条件**:通常需要先成功构建(执行 test 技能)
|
|
67
|
+
2. **环境**:集成测试可能需要外部服务(数据库、API 等)
|
|
68
|
+
3. **超时**:集成测试通常耗时较长;请耐心等待
|
|
69
|
+
4. **清理**:确保测试完成后清理测试环境
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: update-agent-infra
|
|
3
|
+
description: >
|
|
4
|
+
Update the current project's AI collaboration infrastructure
|
|
5
|
+
and project governance to match the latest agent-infra
|
|
6
|
+
templates. Intelligently merges template changes while
|
|
7
|
+
preserving project-specific customizations.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Update Project
|
|
11
|
+
|
|
12
|
+
## Execution constraints
|
|
13
|
+
|
|
14
|
+
1. **Script-driven deterministic steps**: managed / ejected file processing,
|
|
15
|
+
registry sync, and config updates are ALL handled by `sync-templates.js`.
|
|
16
|
+
Never process these files manually one by one.
|
|
17
|
+
The script guarantees atomicity and idempotency.
|
|
18
|
+
|
|
19
|
+
2. **No subagent delegation**: Phase B (merged file intelligent merging) MUST
|
|
20
|
+
be executed directly in the main conversation. Never delegate to subagents.
|
|
21
|
+
Subagents have limited context and frequently misjudge file content equality.
|
|
22
|
+
|
|
23
|
+
## Phase A: Run sync script (deterministic)
|
|
24
|
+
|
|
25
|
+
Execute the following command to handle all deterministic steps at once:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
node .agents/skills/update-agent-infra/scripts/sync-templates.js
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The script reads `.airc.json` (including `templateSource`, default `templates/`) and automatically performs:
|
|
32
|
+
- git pull to fetch latest templates
|
|
33
|
+
- File registry sync (`defaults.json` → `.airc.json`)
|
|
34
|
+
- All managed files (language selection → exclude merged/ejected → placeholder rendering → overwrite)
|
|
35
|
+
- Ejected files (create only on first install)
|
|
36
|
+
- `.airc.json` update (`templateVersion`, file lists)
|
|
37
|
+
|
|
38
|
+
The script outputs JSON to stdout. Parse and record the report.
|
|
39
|
+
|
|
40
|
+
**Key fields**:
|
|
41
|
+
- `error`: error message (if non-empty, stop and report)
|
|
42
|
+
- `templateVersion`: current template source version
|
|
43
|
+
- `templateRoot`: absolute path to the template file root directory
|
|
44
|
+
- `managed.written` / `managed.created`: updated / newly created managed files
|
|
45
|
+
- `merged.pending`: list of merged files for AI to process
|
|
46
|
+
- Each item has `target` (project-relative path) and `template` (template-root-relative path)
|
|
47
|
+
- `registryAdded`: newly added file registry entries
|
|
48
|
+
- `selfUpdate`: whether this is a self-update scenario
|
|
49
|
+
- `configUpdated`: whether `.airc.json` was updated
|
|
50
|
+
|
|
51
|
+
## Phase B: Process merged files (AI intelligent merge)
|
|
52
|
+
|
|
53
|
+
Process each item in the report's `merged.pending` list:
|
|
54
|
+
|
|
55
|
+
1. Read the template file from `<templateRoot>/<template>`
|
|
56
|
+
2. Render placeholders: replace double-brace `project` and `org` placeholders with actual values from .airc.json
|
|
57
|
+
3. Read the current local file (`<project-root>/<target>`)
|
|
58
|
+
|
|
59
|
+
**If the local file does not exist** (first-time setup), write the rendered
|
|
60
|
+
template directly and skip merge.
|
|
61
|
+
|
|
62
|
+
If the local file exists, execute the following merge algorithm:
|
|
63
|
+
|
|
64
|
+
### B.1 Use template as the base
|
|
65
|
+
|
|
66
|
+
Use the rendered new template as the output base. The template represents
|
|
67
|
+
best practices; its structure and content are authoritative.
|
|
68
|
+
|
|
69
|
+
### B.2 Extract deltas from local file
|
|
70
|
+
|
|
71
|
+
Scan the local file for content that goes beyond the template (user deltas):
|
|
72
|
+
- **Filled TODOs**: Template TODO placeholders replaced with actual content
|
|
73
|
+
- **Added sections**: Content in local file that does not exist in template
|
|
74
|
+
- **Extended content**: Supplementary details added to existing template sections
|
|
75
|
+
|
|
76
|
+
### B.3 Merge deltas into template
|
|
77
|
+
|
|
78
|
+
Insert extracted deltas into appropriate positions in the new template:
|
|
79
|
+
- Filled TODOs → replace the corresponding TODO placeholder
|
|
80
|
+
- Added sections → insert at the most relevant location
|
|
81
|
+
- Extended content → merge into the corresponding section
|
|
82
|
+
|
|
83
|
+
### B.4 Full read-through
|
|
84
|
+
|
|
85
|
+
Review the merged file for logical completeness. Verify:
|
|
86
|
+
- Deltas are placed correctly
|
|
87
|
+
- No duplicate content
|
|
88
|
+
- Document structure is coherent
|
|
89
|
+
|
|
90
|
+
### B.5 Conflict handling
|
|
91
|
+
|
|
92
|
+
When user-modified content conflicts with new template content:
|
|
93
|
+
- Keep the template version (template authority principle)
|
|
94
|
+
- Flag the conflict in the report so the user can confirm
|
|
95
|
+
|
|
96
|
+
### B.6 Remaining TODOs
|
|
97
|
+
|
|
98
|
+
After merge, if template TODOs remain unfilled by local file content,
|
|
99
|
+
flag them in the report for the user.
|
|
100
|
+
|
|
101
|
+
## Phase C: Verify and output report
|
|
102
|
+
|
|
103
|
+
**Direction check**: Spot-check with `git diff` that the change direction
|
|
104
|
+
is correct (correct: new template content → local; wrong: reverting rendered
|
|
105
|
+
content back to placeholders). If wrong-direction changes are found,
|
|
106
|
+
pause and investigate.
|
|
107
|
+
|
|
108
|
+
### Self-update detection
|
|
109
|
+
|
|
110
|
+
Check whether `git diff` includes changes to
|
|
111
|
+
`.agents/skills/update-agent-infra/SKILL.md`.
|
|
112
|
+
If this file was modified during the current update, append the following
|
|
113
|
+
warning to the end of the report:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
⚠ The update-agent-infra skill itself was updated.
|
|
117
|
+
Please run /update-agent-infra again to ensure all new logic takes effect.
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> **Rationale**: The current execution used the old skill logic; the new version
|
|
121
|
+
> may contain additional processing steps. Running again ensures the new logic
|
|
122
|
+
> is fully applied.
|
|
123
|
+
> Alternatively, users can run `ai update` before executing the skill to
|
|
124
|
+
> pre-update the seed files and avoid the need for a second run.
|
|
125
|
+
|
|
126
|
+
### Output report
|
|
127
|
+
|
|
128
|
+
Based on the script report and merged results, output a complete update report including:
|
|
129
|
+
- Template version change
|
|
130
|
+
- File registry additions
|
|
131
|
+
- Managed file change details (updated, created, skipped merged files)
|
|
132
|
+
- Merged file results (conflicts, remaining TODOs)
|
|
133
|
+
- Ejected file processing
|
|
134
|
+
- Self-update detection result
|
|
135
|
+
|
|
136
|
+
Output the report, then **STOP** — do not make other changes to the project.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: update-agent-infra
|
|
3
|
+
description: >
|
|
4
|
+
更新当前项目的 AI 协作基础设施和项目治理配置,使其与最新的 agent-infra 模板保持一致。
|
|
5
|
+
智能合并模板变更,同时保留项目特定的定制内容。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 更新项目
|
|
9
|
+
|
|
10
|
+
## 执行约束
|
|
11
|
+
|
|
12
|
+
1. **确定性步骤脚本化**:managed / ejected 文件处理、注册表同步、配置更新
|
|
13
|
+
全部由 `sync-templates.js` 脚本执行,不得逐文件手工处理。
|
|
14
|
+
脚本保证原子性和幂等性。
|
|
15
|
+
|
|
16
|
+
2. **禁止委托子代理**:阶段 B(merged 文件智能合并)必须在主会话中直接执行,
|
|
17
|
+
不得委托给子代理。子代理上下文有限,容易误判文件内容。
|
|
18
|
+
|
|
19
|
+
## 阶段 A:运行同步脚本(确定性)
|
|
20
|
+
|
|
21
|
+
执行以下命令,一次性处理所有确定性步骤:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
node .agents/skills/update-agent-infra/scripts/sync-templates.js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
脚本读取 `.airc.json`(含 `templateSource`,默认 `templates/`),自动完成:
|
|
28
|
+
- git pull 拉取最新模板
|
|
29
|
+
- 同步文件注册表(`defaults.json` → `.airc.json`)
|
|
30
|
+
- 处理所有 managed 文件(语言选择 → 排除 merged/ejected → 占位符渲染 → 覆盖写入)
|
|
31
|
+
- 处理 ejected 文件(仅首次安装时创建)
|
|
32
|
+
- 更新 `.airc.json`(`templateVersion`、文件列表)
|
|
33
|
+
|
|
34
|
+
脚本输出 JSON 到 stdout,解析并记录报告内容。
|
|
35
|
+
|
|
36
|
+
**关键字段**:
|
|
37
|
+
- `error`:错误信息(如非空则停止并报告)
|
|
38
|
+
- `templateVersion`:模板源当前版本
|
|
39
|
+
- `templateRoot`:模板文件根目录绝对路径
|
|
40
|
+
- `managed.written` / `managed.created`:已更新/新建的 managed 文件
|
|
41
|
+
- `merged.pending`:需要 AI 处理的 merged 文件列表
|
|
42
|
+
- 每项包含 `target`(项目中的目标路径)和 `template`(模板根目录下的相对路径)
|
|
43
|
+
- `registryAdded`:新增的文件注册条目
|
|
44
|
+
- `selfUpdate`:是否为自更新模式
|
|
45
|
+
- `configUpdated`:`.airc.json` 是否已更新
|
|
46
|
+
|
|
47
|
+
## 阶段 B:处理 merged 文件(AI 智能合并)
|
|
48
|
+
|
|
49
|
+
根据报告中 `merged.pending` 列表,逐个文件处理。对于每个条目:
|
|
50
|
+
|
|
51
|
+
1. 从 `<templateRoot>/<template>` 读取模板文件
|
|
52
|
+
2. 渲染占位符:将双花括号包裹的 `project` 和 `org` 占位符替换为 .airc.json 中的实际值
|
|
53
|
+
3. 读取本地当前文件(`<项目根>/<target>`)
|
|
54
|
+
|
|
55
|
+
**如果本地文件不存在**(首次安装),直接写入渲染后的模板,跳过合并。
|
|
56
|
+
|
|
57
|
+
如果本地文件存在,执行以下合并算法:
|
|
58
|
+
|
|
59
|
+
### B.1 以模板为基底
|
|
60
|
+
|
|
61
|
+
使用渲染后的新模板作为输出的基底。模板代表最佳实践,其结构和内容具有权威性。
|
|
62
|
+
|
|
63
|
+
### B.2 从本地文件萃取增量
|
|
64
|
+
|
|
65
|
+
扫描本地文件,找出比模板内容"多"的部分(用户增量):
|
|
66
|
+
- **已填充的 TODO**:模板中的 TODO 占位符在本地文件中被替换为实际内容
|
|
67
|
+
- **新增段落/章节**:本地文件中存在但模板中不存在的内容
|
|
68
|
+
- **扩展内容**:对模板现有内容的补充说明
|
|
69
|
+
|
|
70
|
+
### B.3 合入新模板
|
|
71
|
+
|
|
72
|
+
将萃取的增量合入新模板的适当位置:
|
|
73
|
+
- 已填充的 TODO → 替换对应的 TODO 占位符
|
|
74
|
+
- 新增段落 → 插入最相关的位置
|
|
75
|
+
- 扩展内容 → 合入对应章节
|
|
76
|
+
|
|
77
|
+
### B.4 通读验证
|
|
78
|
+
|
|
79
|
+
整体检查合并后文件的逻辑完整性,确保:
|
|
80
|
+
- 增量合入位置正确
|
|
81
|
+
- 无重复内容
|
|
82
|
+
- 文档结构连贯
|
|
83
|
+
|
|
84
|
+
### B.5 冲突处理
|
|
85
|
+
|
|
86
|
+
当本地文件修改过的内容与模板新内容冲突时:
|
|
87
|
+
- 保留模板版本(模板权威性原则)
|
|
88
|
+
- 在报告中提示用户该冲突,以便用户确认
|
|
89
|
+
|
|
90
|
+
### B.6 残余 TODO 提示
|
|
91
|
+
|
|
92
|
+
合并完成后,如果仍有模板 TODO 未被本地文件的内容填充,在报告中提示用户。
|
|
93
|
+
|
|
94
|
+
## 阶段 C:验证与输出报告
|
|
95
|
+
|
|
96
|
+
**方向检查**:用 `git diff` 抽查变更方向是否正确。
|
|
97
|
+
正确方向:模板新内容 → 本地;错误方向:将已渲染内容退化回占位符。
|
|
98
|
+
如果发现错误方向的变更,暂停并排查原因。
|
|
99
|
+
|
|
100
|
+
### 自身更新检测
|
|
101
|
+
|
|
102
|
+
检查 `git diff` 中是否包含 `.agents/skills/update-agent-infra/SKILL.md` 的变更。
|
|
103
|
+
如果该文件在本次更新中被修改,在报告末尾输出以下警告:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
⚠ update-agent-infra 技能自身已更新。
|
|
107
|
+
建议再次执行 /update-agent-infra 以确保所有新逻辑生效。
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> **原因**:本次执行使用的是旧版技能逻辑,新版技能可能包含额外的处理步骤。
|
|
111
|
+
> 再次执行可确保新逻辑完整应用。
|
|
112
|
+
> 用户也可以在执行前先运行 `ai update` 来预先更新技能文件,避免需要两次执行。
|
|
113
|
+
|
|
114
|
+
### 输出报告
|
|
115
|
+
|
|
116
|
+
基于脚本报告和 merged 合并结果,输出完整的更新报告,包括:
|
|
117
|
+
- 模板版本变更
|
|
118
|
+
- 文件注册表新增条目
|
|
119
|
+
- managed 文件变更明细(已更新、新建、跳过的 merged 文件)
|
|
120
|
+
- merged 文件合并结果(冲突、残余 TODO)
|
|
121
|
+
- ejected 文件处理
|
|
122
|
+
- 自身更新检测结果
|
|
123
|
+
|
|
124
|
+
输出报告后**停止**,不要对项目做其他更改。
|