mcpField
V
validator-issue

validator-issue

github.com/codagent-ai开发3063 次安装1 天前更新
代码仓库

关于 validator-issue

validator-issue 是用于收集 agent-validator 运行时证据并撰写结构化 GitHub 缺陷报告的技能。它会先展示报告草稿并征求确认;自动提交模式除外。

主要功能

  1. 01收集配置与运行日志
  2. 02撰写结构化 GitHub 问题
  3. 03展示完整报告预览
  4. 04支持自动提交模式

适用场景

  1. 01报告疑似 validator 缺陷
  2. 02为缺陷报告补充运行时信息

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/codagent-ai/agent-validator --skill validator-issue

安装后在 Claude Code 中输入/validator-issue确认已加载。

详细介绍

/validator-issue

收集运行时证据,为疑似的 agent-validator Bug 起草结构化 GitHub issue,展示完整预览,并仅在确认后提交——除非以自动提交模式调用。

第 1 步:获取 Bug 描述和模式

检查是否为自动提交模式:如果 $ARGUMENTS 以 --auto-file 开头,则将自动提交模式设为开启,并移除此前缀,将剩余文本作为 Bug 描述。自动提交模式开启时,跳过确认步骤(第 4 步)。

获取描述:

  • 如果移除任何 --auto-file 前缀后仍有非空描述,则将其作为 Bug 描述,并继续第 2 步。

  • 如果 $ARGUMENTS 为空(或移除前缀后变为空),询问用户:

    "请描述你在使用 agent-validator 时遇到的 Bug。发生了什么?你原本期望什么?你当时在尝试做什么?"

    等待用户回复后再继续。

第 2 步:收集证据

首先读取 .validator/config.yml,以确定 log_dir(如果缺少该字段或文件不存在,则默认为 validator_logs)。

收集以下证据。对于每项,注明其是否缺失——文件不存在时不要报错:

  1. 配置文件:完整读取 .validator/config.yml。
  2. 调试日志(最后 50 行):读取 <log_dir>/.debug.log 的最后 50 行。
    tail -n 50 <log_dir>/.debug.log
    
  3. 执行状态:读取 <log_dir>/.execution_state 的全部内容。

记录找到和缺失的文件。

第 3 步:起草 Issue

按以下结构起草 GitHub issue:

## Problem

<A clear, concise description of the bug. Based on the user's description.>

## Steps to Reproduce

<Step-by-step instructions to reproduce the issue. Infer from the description and evidence, or note "Not yet determined" if unclear.>

## Expected vs Actual

**Expected:** <What should have happened>

**Actual:** <What actually happened>

## Evidence

> **Before including evidence, redact sensitive values**: remove or replace tokens, API keys, email addresses, and absolute local paths that may appear in config, logs, or state. Replace them with `[REDACTED]` or a generic placeholder.

**Config (`.validator/config.yml`):**
<Paste only relevant, non-sensitive config values. Redact tokens, emails, and absolute paths. Note "File not found" if absent.>

**Debug log (last 50 lines of `<log_dir>/.debug.log`):**
<Paste minimal relevant excerpt with sensitive values redacted. Note "File not found" if absent.>

**Execution state (`<log_dir>/.execution_state`):**
<Paste only fields needed to diagnose the bug; redact sensitive values. Note "File not found" if absent.>

**Absent files:** <List any files that were not found, or "None">

选择简洁、描述性强的标题:Bug: <short summary of the problem>。

第 4 步:展示预览并确认

向用户展示完整草稿,包括标题和正文。

如果自动提交模式已开启:告知用户该 issue 将自动提交(展示标题和正文),然后直接继续第 5 步,无需询问。

否则,询问:

"这是 issue 草稿。要提交吗?(yes/no)"

  • 如果用户确认:继续第 5 步。
  • 如果用户拒绝:不创建 issue,直接退出。告知用户未提交 issue。

第 5 步:提交 Issue

将 issue 正文写入临时文件,并通过 --body-file 传递,以避免正文中的特殊字符受到 shell 插值影响:

ISSUE_TITLE=$(cat <<'TITLE_EOF'
Bug: <short summary>
TITLE_EOF
)
BODY_FILE=$(mktemp)
cat > "$BODY_FILE" << 'ISSUE_EOF'
<paste the full issue body here>
ISSUE_EOF
gh issue create --repo Codagent-AI/agent-validator --title "$ISSUE_TITLE" --body-file "$BODY_FILE"
rm -f "$BODY_FILE"

向用户报告已创建的 issue URL。

评论

支持 Markdown