@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,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: check-task
|
|
3
|
+
description: >
|
|
4
|
+
查看任务的当前状态、工作流进度和上下文文件。这是只读操作,报告任务状态并建议
|
|
5
|
+
适当的下一步操作。当用户要求查看任务状态时触发。参数:task-id。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 查看任务状态
|
|
9
|
+
|
|
10
|
+
## 行为边界 / 关键规则
|
|
11
|
+
|
|
12
|
+
- 本技能是**只读**操作 —— 不修改任何文件
|
|
13
|
+
- 始终检查 active、blocked 和 completed 目录
|
|
14
|
+
|
|
15
|
+
## 执行步骤
|
|
16
|
+
|
|
17
|
+
### 1. 查找任务
|
|
18
|
+
|
|
19
|
+
按以下优先顺序搜索任务:
|
|
20
|
+
1. `.agent-workspace/active/{task-id}/task.md`
|
|
21
|
+
2. `.agent-workspace/blocked/{task-id}/task.md`
|
|
22
|
+
3. `.agent-workspace/completed/{task-id}/task.md`
|
|
23
|
+
|
|
24
|
+
注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
|
|
25
|
+
|
|
26
|
+
如果在任何目录中都未找到,提示 "Task {task-id} not found"。
|
|
27
|
+
|
|
28
|
+
### 2. 读取任务元数据
|
|
29
|
+
|
|
30
|
+
从 `task.md` 中提取:
|
|
31
|
+
- `id`、`title`、`type`、`status`、`workflow`
|
|
32
|
+
- `current_step`、`assigned_to`
|
|
33
|
+
- `created_at`、`updated_at`
|
|
34
|
+
- `issue_number`、`pr_number`(如适用)
|
|
35
|
+
|
|
36
|
+
### 3. 检查上下文文件
|
|
37
|
+
|
|
38
|
+
按产物类型扫描并记录以下文件的存在、轮次和状态:
|
|
39
|
+
- `analysis.md`、`analysis-r{N}.md` - 需求分析
|
|
40
|
+
- `plan.md`、`plan-r{N}.md` - 技术方案
|
|
41
|
+
- `implementation.md`、`implementation-r2.md`、... - 实现报告
|
|
42
|
+
- `refinement.md`、`refinement-r2.md`、... - 修复报告
|
|
43
|
+
- `review.md`、`review-r2.md`、... - 审查报告
|
|
44
|
+
|
|
45
|
+
对于版本化产物(`analysis`、`plan`、`implementation`、`refinement`、`review`):
|
|
46
|
+
- 扫描任务目录中的所有同类版本化文件
|
|
47
|
+
- 记录每类产物的最新轮次、最新文件路径和总轮次数
|
|
48
|
+
- 如果 `task.md` 的 Activity Log 记录了最新轮次,优先核对其与实际文件是否一致
|
|
49
|
+
|
|
50
|
+
### 4. 输出状态报告
|
|
51
|
+
|
|
52
|
+
以清晰的结构和状态指示器格式化输出:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
任务状态:{task-id}
|
|
56
|
+
=======================
|
|
57
|
+
|
|
58
|
+
基本信息:
|
|
59
|
+
- 标题:{title}
|
|
60
|
+
- 类型:{type}
|
|
61
|
+
- 状态:{status}
|
|
62
|
+
- 工作流:{workflow}
|
|
63
|
+
- 分配给:{assigned_to}
|
|
64
|
+
- 创建时间:{created_at}
|
|
65
|
+
- 更新时间:{updated_at}
|
|
66
|
+
|
|
67
|
+
工作流进度:
|
|
68
|
+
[已完成] 需求分析 analysis-r2.md (Round 2, latest)
|
|
69
|
+
[已完成] 技术设计 plan.md (Round 1)
|
|
70
|
+
[进行中] 实现 implementation.md (Round 1)
|
|
71
|
+
[待处理] 修复 refinement.md (Round 1 will be created next)
|
|
72
|
+
[待处理] 代码审查 review.md (Round 1 will be created next)
|
|
73
|
+
[待处理] 最终提交
|
|
74
|
+
|
|
75
|
+
上下文文件:
|
|
76
|
+
- analysis.md: 已存在 (Round 1)
|
|
77
|
+
- analysis-r2.md: 已存在 (Round 2, latest)
|
|
78
|
+
- plan.md: 已存在 (Round 1, latest)
|
|
79
|
+
- implementation.md: 已存在 (Round 1, latest)
|
|
80
|
+
- refinement.md: 未开始
|
|
81
|
+
- review.md: 未开始
|
|
82
|
+
|
|
83
|
+
如果存在多轮产物,显示所有轮次,并标记最新版本,例如:
|
|
84
|
+
- plan.md:已存在 (Round 1)
|
|
85
|
+
- plan-r2.md:已存在 (Round 2, latest)
|
|
86
|
+
- implementation.md:已存在 (Round 1)
|
|
87
|
+
- implementation-r2.md:已存在 (Round 2, latest)
|
|
88
|
+
- refinement.md:已存在 (Round 1)
|
|
89
|
+
- review.md:已存在 (Round 1)
|
|
90
|
+
- review-r2.md:已存在 (Round 2, latest)
|
|
91
|
+
|
|
92
|
+
下一步:
|
|
93
|
+
完成实现,然后执行代码审查
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**状态指示器**:
|
|
97
|
+
- `[done]` - 步骤已完成
|
|
98
|
+
- `[current]` - 当前进行中
|
|
99
|
+
- `[pending]` - 尚未开始
|
|
100
|
+
- `[blocked]` - 被阻塞
|
|
101
|
+
- `[skipped]` - 已跳过
|
|
102
|
+
|
|
103
|
+
### 5. 建议下一步操作
|
|
104
|
+
|
|
105
|
+
根据当前工作流状态,建议合适的下一个技能。必须展示下表中所有 TUI 列的命令格式,不要只展示当前 AI 代理对应的列:
|
|
106
|
+
|
|
107
|
+
| 当前状态 | Claude Code / OpenCode | Gemini CLI | Codex CLI |
|
|
108
|
+
|---------|----------------------|------------|-----------|
|
|
109
|
+
| 分析完成 | `/plan-task {task-id}` | `/agent-infra:plan-task {task-id}` | `$plan-task {task-id}` |
|
|
110
|
+
| 计划完成 | `/implement-task {task-id}` | `/agent-infra:implement-task {task-id}` | `$implement-task {task-id}` |
|
|
111
|
+
| 实现完成 | `/review-task {task-id}` | `/agent-infra:review-task {task-id}` | `$review-task {task-id}` |
|
|
112
|
+
| 审查通过 | `/commit` | `/agent-infra:commit` | `$commit` |
|
|
113
|
+
| 审查有问题 | `/refine-task {task-id}` | `/agent-infra:refine-task {task-id}` | `$refine-task {task-id}` |
|
|
114
|
+
| 任务被阻塞 | 解除阻塞或提供所需信息 | — | 解除阻塞或提供所需信息 |
|
|
115
|
+
| 任务已完成 | 无需操作 | — | 无需操作 |
|
|
116
|
+
|
|
117
|
+
## 注意事项
|
|
118
|
+
|
|
119
|
+
1. **只读**:本技能仅读取和报告 —— 不修改任何文件
|
|
120
|
+
2. **多目录搜索**:始终检查 active、blocked 和 completed 目录
|
|
121
|
+
3. **快速参考**:随时可以使用本技能检查任务在工作流中的位置
|
|
122
|
+
4. **版本化产物**:`analysis`、`plan`、`implementation`、`refinement`、`review` 都需要报告实际轮次,而不是只报告固定文件名
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: close-codescan
|
|
3
|
+
description: >
|
|
4
|
+
关闭 Code Scanning(CodeQL)告警并提供有据可查的理由。
|
|
5
|
+
当用户要求关闭 Code Scanning 告警时触发。参数:告警编号。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 关闭 Code Scanning 告警
|
|
9
|
+
|
|
10
|
+
关闭指定的 Code Scanning(CodeQL)告警并记录合理的关闭理由。
|
|
11
|
+
|
|
12
|
+
## 执行流程
|
|
13
|
+
|
|
14
|
+
### 1. 获取告警信息
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
gh api repos/{owner}/{repo}/code-scanning/alerts/<alert-number>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
验证告警处于 `open` 状态。如果已被关闭/修复,告知用户并退出。
|
|
21
|
+
|
|
22
|
+
### 2. 展示告警详情
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Code Scanning 告警 #{alert-number}
|
|
26
|
+
|
|
27
|
+
严重程度:{security_severity_level}
|
|
28
|
+
规则:{rule.id} - {rule.description}
|
|
29
|
+
扫描工具:{tool.name}
|
|
30
|
+
位置:{location.path}:{location.start_line}
|
|
31
|
+
消息:{message}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. 询问关闭理由
|
|
35
|
+
|
|
36
|
+
提示用户选择理由:
|
|
37
|
+
|
|
38
|
+
1. **误报 (False Positive)** - CodeQL 规则误判;代码不存在此安全问题
|
|
39
|
+
2. **不会修复 (Won't Fix)** - 已知问题但基于架构或业务原因不予修复
|
|
40
|
+
3. **测试代码 (Used in Tests)** - 仅在测试代码中出现,不影响生产环境安全
|
|
41
|
+
4. **取消** - 不关闭告警
|
|
42
|
+
|
|
43
|
+
### 4. 要求详细说明
|
|
44
|
+
|
|
45
|
+
如果用户选择关闭(非取消),要求提供详细说明:
|
|
46
|
+
- 最少 20 个字符
|
|
47
|
+
- 必须清楚说明为什么可以安全关闭该告警
|
|
48
|
+
- 如果是误报,说明为什么代码不存在该安全问题
|
|
49
|
+
- 如果是不修复,说明技术或业务原因
|
|
50
|
+
|
|
51
|
+
### 5. 最终确认
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
即将关闭 Code Scanning 告警 #{alert-number}:
|
|
55
|
+
|
|
56
|
+
规则:{rule.id}
|
|
57
|
+
位置:{location.path}:{location.start_line}
|
|
58
|
+
原因:{选择的理由}
|
|
59
|
+
说明:{用户的说明}
|
|
60
|
+
|
|
61
|
+
确认?(y/N)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 6. 执行关闭
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
gh api --method PATCH \
|
|
68
|
+
repos/{owner}/{repo}/code-scanning/alerts/<alert-number> \
|
|
69
|
+
-f state=dismissed \
|
|
70
|
+
-f dismissed_reason="{api-reason}" \
|
|
71
|
+
-f dismissed_comment="{用户的说明}"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**API reason 映射**(按 GitHub Code Scanning API):
|
|
75
|
+
- 误报 -> `false positive`
|
|
76
|
+
- 不会修复 -> `won't fix`
|
|
77
|
+
- 测试代码 -> `used in tests`
|
|
78
|
+
|
|
79
|
+
### 7. 记录到任务(如存在)
|
|
80
|
+
|
|
81
|
+
如果有关联任务(搜索 `codescan_alert_number: <alert-number>`):
|
|
82
|
+
获取当前时间:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
date "+%Y-%m-%d %H:%M:%S"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- 添加关闭记录到 task.md
|
|
89
|
+
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
90
|
+
```
|
|
91
|
+
- {yyyy-MM-dd HH:mm:ss} — **Alert Closed** by {agent} — Code Scanning alert #{alert-number} dismissed: {reason}
|
|
92
|
+
```
|
|
93
|
+
- 归档任务
|
|
94
|
+
|
|
95
|
+
### 8. 告知用户
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Code Scanning 告警 #{alert-number} 已关闭。
|
|
99
|
+
|
|
100
|
+
规则:{rule.id}
|
|
101
|
+
位置:{location.path}:{location.start_line}
|
|
102
|
+
原因:{reason}
|
|
103
|
+
说明:{explanation}
|
|
104
|
+
|
|
105
|
+
查看:{html_url}
|
|
106
|
+
|
|
107
|
+
注意:如有需要,可在 GitHub 上重新打开。
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 注意事项
|
|
111
|
+
|
|
112
|
+
1. **谨慎处理高严重程度告警**:Critical/High 告警需要充分分析。建议先执行 import-codescan + analyze-task。
|
|
113
|
+
2. **真实的理由**:关闭记录保存在 GitHub 中,可能会被审计。
|
|
114
|
+
3. **定期复查**:已关闭的告警应定期复查。
|
|
115
|
+
4. **优先修复**:关闭应作为最后手段。
|
|
116
|
+
|
|
117
|
+
## 错误处理
|
|
118
|
+
|
|
119
|
+
- 告警未找到:提示 "Code Scanning alert #{number} not found"
|
|
120
|
+
- 已关闭:提示 "Alert #{number} is already {state}"
|
|
121
|
+
- 权限错误:提示 "No permission to modify alerts"
|
|
122
|
+
- 用户取消:提示 "Cancellation acknowledged"
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: close-codescan
|
|
3
|
+
description: >
|
|
4
|
+
关闭 Code Scanning(CodeQL)告警并提供有据可查的理由。
|
|
5
|
+
当用户要求关闭 Code Scanning 告警时触发。参数:告警编号。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 关闭 Code Scanning 告警
|
|
9
|
+
|
|
10
|
+
关闭指定的 Code Scanning(CodeQL)告警并记录合理的关闭理由。
|
|
11
|
+
|
|
12
|
+
## 执行流程
|
|
13
|
+
|
|
14
|
+
### 1. 获取告警信息
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
gh api repos/{owner}/{repo}/code-scanning/alerts/<alert-number>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
验证告警处于 `open` 状态。如果已被关闭/修复,告知用户并退出。
|
|
21
|
+
|
|
22
|
+
### 2. 展示告警详情
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Code Scanning 告警 #{alert-number}
|
|
26
|
+
|
|
27
|
+
严重程度:{security_severity_level}
|
|
28
|
+
规则:{rule.id} - {rule.description}
|
|
29
|
+
扫描工具:{tool.name}
|
|
30
|
+
位置:{location.path}:{location.start_line}
|
|
31
|
+
消息:{message}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. 询问关闭理由
|
|
35
|
+
|
|
36
|
+
提示用户选择理由:
|
|
37
|
+
|
|
38
|
+
1. **误报 (False Positive)** - CodeQL 规则误判;代码不存在此安全问题
|
|
39
|
+
2. **不会修复 (Won't Fix)** - 已知问题但基于架构或业务原因不予修复
|
|
40
|
+
3. **测试代码 (Used in Tests)** - 仅在测试代码中出现,不影响生产环境安全
|
|
41
|
+
4. **取消** - 不关闭告警
|
|
42
|
+
|
|
43
|
+
### 4. 要求详细说明
|
|
44
|
+
|
|
45
|
+
如果用户选择关闭(非取消),要求提供详细说明:
|
|
46
|
+
- 最少 20 个字符
|
|
47
|
+
- 必须清楚说明为什么可以安全关闭该告警
|
|
48
|
+
- 如果是误报,说明为什么代码不存在该安全问题
|
|
49
|
+
- 如果是不修复,说明技术或业务原因
|
|
50
|
+
|
|
51
|
+
### 5. 最终确认
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
即将关闭 Code Scanning 告警 #{alert-number}:
|
|
55
|
+
|
|
56
|
+
规则:{rule.id}
|
|
57
|
+
位置:{location.path}:{location.start_line}
|
|
58
|
+
原因:{选择的理由}
|
|
59
|
+
说明:{用户的说明}
|
|
60
|
+
|
|
61
|
+
确认?(y/N)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 6. 执行关闭
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
gh api --method PATCH \
|
|
68
|
+
repos/{owner}/{repo}/code-scanning/alerts/<alert-number> \
|
|
69
|
+
-f state=dismissed \
|
|
70
|
+
-f dismissed_reason="{api-reason}" \
|
|
71
|
+
-f dismissed_comment="{用户的说明}"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**API reason 映射**(按 GitHub Code Scanning API):
|
|
75
|
+
- 误报 -> `false positive`
|
|
76
|
+
- 不会修复 -> `won't fix`
|
|
77
|
+
- 测试代码 -> `used in tests`
|
|
78
|
+
|
|
79
|
+
### 7. 记录到任务(如存在)
|
|
80
|
+
|
|
81
|
+
如果有关联任务(搜索 `codescan_alert_number: <alert-number>`):
|
|
82
|
+
获取当前时间:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
date "+%Y-%m-%d %H:%M:%S"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- 添加关闭记录到 task.md
|
|
89
|
+
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
90
|
+
```
|
|
91
|
+
- {yyyy-MM-dd HH:mm:ss} — **Alert Closed** by {agent} — Code Scanning alert #{alert-number} dismissed: {reason}
|
|
92
|
+
```
|
|
93
|
+
- 归档任务
|
|
94
|
+
|
|
95
|
+
### 8. 告知用户
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Code Scanning 告警 #{alert-number} 已关闭。
|
|
99
|
+
|
|
100
|
+
规则:{rule.id}
|
|
101
|
+
位置:{location.path}:{location.start_line}
|
|
102
|
+
原因:{reason}
|
|
103
|
+
说明:{explanation}
|
|
104
|
+
|
|
105
|
+
查看:{html_url}
|
|
106
|
+
|
|
107
|
+
注意:如有需要,可在 GitHub 上重新打开。
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 注意事项
|
|
111
|
+
|
|
112
|
+
1. **谨慎处理高严重程度告警**:Critical/High 告警需要充分分析。建议先执行 import-codescan + analyze-task。
|
|
113
|
+
2. **真实的理由**:关闭记录保存在 GitHub 中,可能会被审计。
|
|
114
|
+
3. **定期复查**:已关闭的告警应定期复查。
|
|
115
|
+
4. **优先修复**:关闭应作为最后手段。
|
|
116
|
+
|
|
117
|
+
## 错误处理
|
|
118
|
+
|
|
119
|
+
- 告警未找到:提示 "Code Scanning alert #{number} not found"
|
|
120
|
+
- 已关闭:提示 "Alert #{number} is already {state}"
|
|
121
|
+
- 权限错误:提示 "No permission to modify alerts"
|
|
122
|
+
- 用户取消:提示 "Cancellation acknowledged"
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: close-dependabot
|
|
3
|
+
description: >
|
|
4
|
+
关闭 Dependabot 安全告警并提供有据可查的理由。
|
|
5
|
+
当用户要求关闭 Dependabot 告警时触发。参数:告警编号。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 关闭 Dependabot 告警
|
|
9
|
+
|
|
10
|
+
关闭指定的 Dependabot 安全告警并记录合理的关闭理由。
|
|
11
|
+
|
|
12
|
+
## 执行流程
|
|
13
|
+
|
|
14
|
+
### 1. 获取告警信息
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
gh api repos/{owner}/{repo}/dependabot/alerts/<alert-number>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
验证告警处于 `open` 状态。如果已被关闭/修复,告知用户并退出。
|
|
21
|
+
|
|
22
|
+
### 2. 展示告警详情
|
|
23
|
+
|
|
24
|
+
向用户展示关键信息:
|
|
25
|
+
```
|
|
26
|
+
安全告警 #{alert-number}
|
|
27
|
+
|
|
28
|
+
严重程度:{severity}
|
|
29
|
+
漏洞:{summary}
|
|
30
|
+
包名:{package-name}({ecosystem})
|
|
31
|
+
当前版本:{current-version}
|
|
32
|
+
受影响版本范围:{vulnerable-version-range}
|
|
33
|
+
修复版本:{first-patched-version}
|
|
34
|
+
|
|
35
|
+
GHSA:{ghsa-id}
|
|
36
|
+
CVE:{cve-id}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. 询问关闭理由
|
|
40
|
+
|
|
41
|
+
提示用户选择理由:
|
|
42
|
+
|
|
43
|
+
1. **误报 (False Positive)** - 漏洞代码路径在本项目中未被使用
|
|
44
|
+
2. **无法利用 (Not Exploitable)** - 漏洞存在但在当前上下文中无法被利用
|
|
45
|
+
3. **已有缓解措施 (Mitigated)** - 通过其他方式缓解了风险(配置、网络隔离等)
|
|
46
|
+
4. **无修复版本 (No Fix Available)** - 无修复版本且风险可接受
|
|
47
|
+
5. **仅开发/测试依赖 (Dev/Test Dependency Only)** - 仅在开发/测试中使用,不在生产环境中
|
|
48
|
+
6. **取消** - 不关闭告警
|
|
49
|
+
|
|
50
|
+
### 4. 要求详细说明
|
|
51
|
+
|
|
52
|
+
如果用户选择关闭(非取消),要求提供详细说明:
|
|
53
|
+
- 最少 20 个字符
|
|
54
|
+
- 必须清楚说明为什么可以安全关闭该告警
|
|
55
|
+
- 应引用具体证据(代码搜索结果、配置等)
|
|
56
|
+
|
|
57
|
+
### 5. 最终确认
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
即将关闭安全告警 #{alert-number}:
|
|
61
|
+
|
|
62
|
+
告警:{summary}
|
|
63
|
+
严重程度:{severity}
|
|
64
|
+
原因:{选择的理由}
|
|
65
|
+
说明:{用户的说明}
|
|
66
|
+
|
|
67
|
+
确认?(y/N)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 6. 执行关闭
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
gh api --method PATCH \
|
|
74
|
+
repos/{owner}/{repo}/dependabot/alerts/<alert-number> \
|
|
75
|
+
-f state=dismissed \
|
|
76
|
+
-f dismissed_reason="{api-reason}" \
|
|
77
|
+
-f dismissed_comment="{用户的说明}"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**API reason 映射**:
|
|
81
|
+
- 误报 -> `not_used` 或 `inaccurate`
|
|
82
|
+
- 无法利用 -> `tolerable_risk`
|
|
83
|
+
- 已有缓解措施 -> `tolerable_risk`
|
|
84
|
+
- 无修复版本 -> `tolerable_risk`
|
|
85
|
+
- 开发/测试依赖 -> `not_used`
|
|
86
|
+
|
|
87
|
+
### 7. 记录到任务(如存在)
|
|
88
|
+
|
|
89
|
+
如果有关联任务(搜索 `security_alert_number: <alert-number>`):
|
|
90
|
+
获取当前时间:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
date "+%Y-%m-%d %H:%M:%S"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- 添加关闭记录到 task.md
|
|
97
|
+
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
98
|
+
```
|
|
99
|
+
- {yyyy-MM-dd HH:mm:ss} — **Alert Closed** by {agent} — Dependabot alert #{alert-number} dismissed: {reason}
|
|
100
|
+
```
|
|
101
|
+
- 归档任务
|
|
102
|
+
|
|
103
|
+
### 8. 告知用户
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
安全告警 #{alert-number} 已关闭。
|
|
107
|
+
|
|
108
|
+
告警:{summary}
|
|
109
|
+
严重程度:{severity}
|
|
110
|
+
原因:{reason}
|
|
111
|
+
说明:{explanation}
|
|
112
|
+
|
|
113
|
+
查看:https://github.com/{owner}/{repo}/security/dependabot/{alert-number}
|
|
114
|
+
|
|
115
|
+
注意:如有需要,可在 GitHub 上重新打开。
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## 注意事项
|
|
119
|
+
|
|
120
|
+
1. **谨慎处理高严重程度告警**:Critical/High 告警需要在关闭前进行充分分析。建议先执行 import-dependabot + analyze-task。
|
|
121
|
+
2. **真实的理由**:关闭记录保存在 GitHub 中,可能会被审计。
|
|
122
|
+
3. **定期复查**:已关闭的告警应定期复查,因为代码变更可能使关闭理由失效。
|
|
123
|
+
4. **优先修复**:关闭应作为最后手段。优先考虑升级、替换或缓解。
|
|
124
|
+
|
|
125
|
+
## 错误处理
|
|
126
|
+
|
|
127
|
+
- 告警未找到:提示 "Security alert #{number} not found"
|
|
128
|
+
- 已关闭:提示 "Alert #{number} is already {state}"
|
|
129
|
+
- 权限错误:提示 "No permission to modify alerts"
|
|
130
|
+
- 用户取消:提示 "Cancellation acknowledged"
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: close-dependabot
|
|
3
|
+
description: >
|
|
4
|
+
关闭 Dependabot 安全告警并提供有据可查的理由。
|
|
5
|
+
当用户要求关闭 Dependabot 告警时触发。参数:告警编号。
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 关闭 Dependabot 告警
|
|
9
|
+
|
|
10
|
+
关闭指定的 Dependabot 安全告警并记录合理的关闭理由。
|
|
11
|
+
|
|
12
|
+
## 执行流程
|
|
13
|
+
|
|
14
|
+
### 1. 获取告警信息
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
gh api repos/{owner}/{repo}/dependabot/alerts/<alert-number>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
验证告警处于 `open` 状态。如果已被关闭/修复,告知用户并退出。
|
|
21
|
+
|
|
22
|
+
### 2. 展示告警详情
|
|
23
|
+
|
|
24
|
+
向用户展示关键信息:
|
|
25
|
+
```
|
|
26
|
+
安全告警 #{alert-number}
|
|
27
|
+
|
|
28
|
+
严重程度:{severity}
|
|
29
|
+
漏洞:{summary}
|
|
30
|
+
包名:{package-name}({ecosystem})
|
|
31
|
+
当前版本:{current-version}
|
|
32
|
+
受影响版本范围:{vulnerable-version-range}
|
|
33
|
+
修复版本:{first-patched-version}
|
|
34
|
+
|
|
35
|
+
GHSA:{ghsa-id}
|
|
36
|
+
CVE:{cve-id}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. 询问关闭理由
|
|
40
|
+
|
|
41
|
+
提示用户选择理由:
|
|
42
|
+
|
|
43
|
+
1. **误报 (False Positive)** - 漏洞代码路径在本项目中未被使用
|
|
44
|
+
2. **无法利用 (Not Exploitable)** - 漏洞存在但在当前上下文中无法被利用
|
|
45
|
+
3. **已有缓解措施 (Mitigated)** - 通过其他方式缓解了风险(配置、网络隔离等)
|
|
46
|
+
4. **无修复版本 (No Fix Available)** - 无修复版本且风险可接受
|
|
47
|
+
5. **仅开发/测试依赖 (Dev/Test Dependency Only)** - 仅在开发/测试中使用,不在生产环境中
|
|
48
|
+
6. **取消** - 不关闭告警
|
|
49
|
+
|
|
50
|
+
### 4. 要求详细说明
|
|
51
|
+
|
|
52
|
+
如果用户选择关闭(非取消),要求提供详细说明:
|
|
53
|
+
- 最少 20 个字符
|
|
54
|
+
- 必须清楚说明为什么可以安全关闭该告警
|
|
55
|
+
- 应引用具体证据(代码搜索结果、配置等)
|
|
56
|
+
|
|
57
|
+
### 5. 最终确认
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
即将关闭安全告警 #{alert-number}:
|
|
61
|
+
|
|
62
|
+
告警:{summary}
|
|
63
|
+
严重程度:{severity}
|
|
64
|
+
原因:{选择的理由}
|
|
65
|
+
说明:{用户的说明}
|
|
66
|
+
|
|
67
|
+
确认?(y/N)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 6. 执行关闭
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
gh api --method PATCH \
|
|
74
|
+
repos/{owner}/{repo}/dependabot/alerts/<alert-number> \
|
|
75
|
+
-f state=dismissed \
|
|
76
|
+
-f dismissed_reason="{api-reason}" \
|
|
77
|
+
-f dismissed_comment="{用户的说明}"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**API reason 映射**:
|
|
81
|
+
- 误报 -> `not_used` 或 `inaccurate`
|
|
82
|
+
- 无法利用 -> `tolerable_risk`
|
|
83
|
+
- 已有缓解措施 -> `tolerable_risk`
|
|
84
|
+
- 无修复版本 -> `tolerable_risk`
|
|
85
|
+
- 开发/测试依赖 -> `not_used`
|
|
86
|
+
|
|
87
|
+
### 7. 记录到任务(如存在)
|
|
88
|
+
|
|
89
|
+
如果有关联任务(搜索 `security_alert_number: <alert-number>`):
|
|
90
|
+
获取当前时间:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
date "+%Y-%m-%d %H:%M:%S"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- 添加关闭记录到 task.md
|
|
97
|
+
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
98
|
+
```
|
|
99
|
+
- {yyyy-MM-dd HH:mm:ss} — **Alert Closed** by {agent} — Dependabot alert #{alert-number} dismissed: {reason}
|
|
100
|
+
```
|
|
101
|
+
- 归档任务
|
|
102
|
+
|
|
103
|
+
### 8. 告知用户
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
安全告警 #{alert-number} 已关闭。
|
|
107
|
+
|
|
108
|
+
告警:{summary}
|
|
109
|
+
严重程度:{severity}
|
|
110
|
+
原因:{reason}
|
|
111
|
+
说明:{explanation}
|
|
112
|
+
|
|
113
|
+
查看:https://github.com/{owner}/{repo}/security/dependabot/{alert-number}
|
|
114
|
+
|
|
115
|
+
注意:如有需要,可在 GitHub 上重新打开。
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## 注意事项
|
|
119
|
+
|
|
120
|
+
1. **谨慎处理高严重程度告警**:Critical/High 告警需要在关闭前进行充分分析。建议先执行 import-dependabot + analyze-task。
|
|
121
|
+
2. **真实的理由**:关闭记录保存在 GitHub 中,可能会被审计。
|
|
122
|
+
3. **定期复查**:已关闭的告警应定期复查,因为代码变更可能使关闭理由失效。
|
|
123
|
+
4. **优先修复**:关闭应作为最后手段。优先考虑升级、替换或缓解。
|
|
124
|
+
|
|
125
|
+
## 错误处理
|
|
126
|
+
|
|
127
|
+
- 告警未找到:提示 "Security alert #{number} not found"
|
|
128
|
+
- 已关闭:提示 "Alert #{number} is already {state}"
|
|
129
|
+
- 权限错误:提示 "No permission to modify alerts"
|
|
130
|
+
- 用户取消:提示 "Cancellation acknowledged"
|