close-codescan
Skill87 starsChanged 19 days agoMITView on GitHub
关闭 Code Scanning 告警并记录理由。 当某条 Code Scanning 告警已处理或需按理由关闭时使用。
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ModelEngine-Group/fit-frameworktheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ModelEngine-Group/fit-framework★ 2.1ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- analyze-taskSkill
- archive-tasksSkill
- block-taskSkill
- cancel-taskSkill
- check-taskSkill
- close-dependabotSkill
- code-taskSkill
- commitSkill
- complete-manual-validationSkill
- complete-taskSkill
- create-prSkill
- create-release-noteSkill
- create-taskSkill
- entropy-checkSkill
- import-codescanSkill
- import-dependabotSkill
- import-issueSkill
- init-labelsSkill
- init-milestonesSkill
- plan-taskSkill
- post-releaseSkill
- refine-titleSkill
- releaseSkill
- restore-taskSkill
- review-analysisSkill
- review-codeSkill
- review-planSkill
- review-prSkill
- run-manual-validationSkill
- test-integrationSkill
- testSkill
- update-agent-infraSkill
- upgrade-dependencySkill
- watch-prSkill
The file
Files
关闭 Code Scanning 告警
--agent取值见.agents/rules/task-management.md「合作者 token 规范」。
关闭指定的 Code Scanning(CodeQL)告警并记录合理的关闭理由。
任务入参短号别名
如果
{task-id}入参匹配^[#]?[0-9]+$(裸数字或带#前缀),先读取.agents/rules/task-short-id.md的「SKILL 入参解析」段执行解析;后续命令视{task-id}为解析后的全长TASK-YYYYMMDD-HHMMSS形式。
步骤开始:本地生命周期边界
安全告警 API 仍由本技能处理;若存在关联任务,步骤 7 只声明一个本地 lifecycle intent,由核心统一提交基础元数据、日志、归档目录和短号。
执行流程
1. 获取告警信息
执行前先读取 .agents/rules/security-alerts.md,然后运行 agent-infra-internal platform-security read --kind code-scanning --number {alert-number},解析其 JSON 结果获取告警详情。
验证告警处于 open 状态。如果已被关闭/修复,告知用户并退出。
2. 展示告警详情
Code Scanning 告警 #{alert-number}
严重程度:{security_severity_level}
规则:{rule.id} - {rule.description}
扫描工具:{tool.name}
位置:{location.path}:{location.start_line}
消息:{message}3. 询问关闭理由
提示用户选择理由:
- 误报 (False Positive) - CodeQL 规则误判;代码不存在此安全问题
- 不会修复 (Won't Fix) - 已知问题但基于架构或业务原因不予修复
- 测试代码 (Used in Tests) - 仅在测试代码中出现,不影响生产环境安全
- 取消 - 不关闭告警
4. 要求详细说明
如果用户选择关闭(非取消),要求提供详细说明:
- 最少 20 个字符
- 必须清楚说明为什么可以安全关闭该告警
- 如果是误报,说明为什么代码不存在该安全问题
- 如果是不修复,说明技术或业务原因
5. 最终确认
即将关闭 Code Scanning 告警 #{alert-number}:
规则:{rule.id}
位置:{location.path}:{location.start_line}
原因:{选择的理由}
说明:{用户的说明}
确认?(y/N)6. 执行关闭
将用户说明写入 {comment-file},然后运行 agent-infra-internal platform-security dismiss --kind code-scanning --number {alert-number} --reason {api-reason} --comment-file {comment-file}。解析 JSON 结果,仅当关闭状态为 applied 或 no-op 时继续。
API reason 映射(按 Code Scanning API):
- 误报 ->
false positive - 不会修复 ->
won't fix - 测试代码 ->
used in tests
7. 记录到任务(如存在)
如果有关联任务(搜索 codescan_alert_number: <alert-number>):
agent-infra-internal task-lifecycle {task-id} close-codescan --agent {standard-agent-token} \
--alert-number {alert-number} --reason "{reason}"仅 status=applied|no-op 视为本地归档完成。若 API 已关闭但 lifecycle 返回 failed,必须明确报告“远端已关闭、本地待恢复”,展示 recovery steps,并以同一 intent 重试;不得手工更新 task.md、移动目录或释放短号。
8. 告知用户
渲染下一步前先读取
.agents/rules/next-step-output.md,仅为已选场景调用统一 helper,并将 stdout 填入{next-step-commands}。
可选沙箱清理提示(门控渲染):仅当同时满足 (1)
.agents/.airc.json存在sandbox字段、(2) 第 7 步按告警号定位到了关联任务、(3) 该任务 task.md 的branch存在且不是main/master、(4) 任务状态与沙箱 workspace identity 已交叉校验且无冲突时,才渲染清理提示。状态和 identity 决定命令:仅completed+task-bound使用完整{task-id};仅在明确核对为branch-only时使用{branch};active不渲染自动清理命令;blocked/archive只渲染人工核对提示,不渲染命令。状态或 identity 缺失、冲突时整段省略;关闭告警本身不能推断任务已完成。该块独立于「下一步」语义。
使用 agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref} 生成本场景的 {next-step-commands}。
Code Scanning 告警 #{alert-number} 已关闭。
规则:{rule.id}
位置:{location.path}:{location.start_line}
原因:{reason}
说明:{explanation}
查看:{html_url}
注意:如有需要,可在 平台上重新打开。
可选:清理本任务的沙箱
(仅在关联任务为 `completed` 且 identity 为 `task-bound` 时,使用完整任务 ID:)
ai sandbox rm {task-id}
(仅在明确核对 identity 为 `branch-only` 时,使用分支名:)
ai sandbox rm {branch}
下一步 - 完成并归档任务(如有关联任务):
{next-step-commands}注意事项
- 谨慎处理高严重程度告警:Critical/High 告警需要充分分析。建议先执行 import-codescan + analyze-task。
- 真实的理由:关闭记录保存在平台中,可能会被审计。
- 定期复查:已关闭的告警应定期复查。
- 优先修复:关闭应作为最后手段。
错误处理
- 告警未找到:提示 "Code Scanning alert #{number} not found"
- 已关闭:提示 "Alert #{number} is already {state}"
- 权限错误:提示 "No permission to modify alerts"
- 用户取消:提示 "Cancellation acknowledged"
安全责任边界:关闭前必须保留准确的处置理由、影响说明和所需确认。不得为追求继续执行而推断风险已消失、代替授权人确认,或绕过平台要求的安全确认;其他可独立完成的本地整理仍可继续。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

