Skip to content

feat(review): 分级反馈 — 支持 warning 级别和结构化 JSON 输出 #61

@Svtter

Description

@Svtter

背景

当前 review action 的 prompt 只区分两个级别:阻塞项(blocking)和建议项(suggestion)。实际使用中,很多 review 意见处于"应该修但不阻塞合并"的中间地带,缺少 warning 级别导致:

  1. 要么升级为阻塞项(误杀,拖慢合并)
  2. 要么降级为建议项(被忽略,问题堆积)

目标

将 review 输出从二级(阻塞/建议)升级为三级

级别 中文标签 行为 示例
🔴 blocking 阻塞项 必须修复才能合并 空指针、安全漏洞、逻辑错误
🟡 warning 警告项 不阻塞但强烈建议修复 潜在性能问题、不够健壮的错误处理、可读性差
🟢 suggestion 建议项 纯改进建议 命名优化、代码风格、重构机会

方案

1. Prompt 升级

在默认 prompt 中加入 warning 级别定义和决策规则:

  • 不可合并 — 存在阻塞项
  • 有条件合并 — 无阻塞项但有警告项
  • 可合并 — 无阻塞项,警告项和建议项可选处理

输出格式增加 warning_items 字段。

2. 结构化 JSON 输出(可选)

当前输出是纯文本格式(中文标题分段),解析依赖正则。考虑支持 JSON 输出模式:

{
  "decision": "有条件合并",
  "summary": "...",
  "blocking_items": [],
  "warning_items": ["..."],
  "suggestion_items": ["..."]
}

通过新增 input output-format(默认 text,可选 json)控制。

3. Action 新增 inputs

input 类型 默认值 说明
output-format string text textjson,控制 reviewer 输出格式
pass-level string strict strict(警告也视为不通过)/ standard(仅阻塞项不通过)

4. pass-level 策略

  • strict:decision 必须是"可合并"才算通过(有警告项 = 有条件合并 = 不通过)
  • standard:decision 为"可合并"或"有条件合并"都算通过(仅阻塞项阻止合并)

这样使用者可以根据项目阶段灵活调整严格程度。

兼容性

  • 默认 output-format: text + pass-level: strict,行为与现有完全一致
  • 纯文本格式向后兼容,只在 prompt 中增加 warning 段落
  • JSON 格式为 opt-in,下游 CI 可按需解析

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions