Closed
[转交][user feedback][1950] grape git-repo commits 帮助文案写 sha/ref filter 但仅支持 --sha;pulls 无 commits 子命令 #107
马岩松Add on  18 days agoClosed at  18 days ago
马岩松
马岩松Collaborators
18 days ago Create

目标

修正 grape CLI 中 git-repo commits 帮助文案与实际可用参数的漂移,并评估在 git-repo pulls 下补充 commits 子命令,使 Agent/用户审查 PR 提交时不再因文案暗示 --ref 而试错。

现状

  • grape git-repo commits --help 的 Usage 文案为 Commit history (optional sha/ref filter),但 Options 仅暴露 --owner/--repo/--per_page/--sha/--json-out,不存在 --ref。
  • 实测 grape git-repo commits --owner o --repo r --ref main → Error: No such option '--ref'. Did you mean '--repo'?
  • grape git-repo pulls --help 的命令列表为 comments / create / files / get / issues / list / merge / update,无 commits 子命令。
  • 相关文档 skills/coding/ai-coding-review/coding-cli/references/grape-cli-reference.md 的 commits 小节仅给出 --per_page 示例,未说明可用 --sha 传分支/标签/PR head sha。
  • 结论:能力本身可用 --sha 达成,属帮助文案/契约与文档漂移。

期望

  1. 修订命令生成层的 Usage/帮助文案(落点在命令 schema/描述生成处,不手改生成物),去掉含糊的 "ref filter",改为显式 --sha <branch|tag|sha>,并补充 grape git-repo commits --sha <branch> --json-out 示例。
  2. 在 grape-cli-reference.md 的 commits 小节补充:列 PR 提交 = grape git-repo commits --owner <o> --repo <r> --sha <pr head branch|sha> --json-out,并说明 pulls 暂无 commits。
  3. (可选,若排期允许)新增 grape git-repo pulls commits 子命令(解析 PR head sha 后转调 commits 端点)并补单测。
  4. 增加 CLI 帮助文案快照/契约测试,防止 Usage 与 Options 再次漂移。

验收

  • grape git-repo commits --help 文案与 --sha 语义一致,不再暗示 --ref。
  • 文档示例可直接照抄执行成功。
  • 若实现 pulls commits,能按 PR 直接列出提交并通过单测。

优先级

P2(文档/帮助文案漂移,非功能缺失,低成本)

来源

  • 源 Issue:grape-dev/grape#1400(后台反馈 id=1950,提交人 zhirong,2026-11-07 12:11:27 CST)
  • 关联既有目标仓 Issue:grape-dev/grape-cli#73(commits --help 示例与选项不一致),可合并处理
  • 由 VOD Agent 归仓判断转交
    auto-submitted by VOD Agent
likedislike
grape_bot
grape_botCollaborators
18 days ago Comments:

[VOD Agent] 已结构化收敛需求。

归仓判断:已执行,结论=本仓(grape-dev/grape-cli),依据=地图命中——本仓职责为"官方 CLI 客户端:契约驱动(从服务端拉 openapi.json 生成命令)",Issue 指向的 commits 帮助文案/命令集/参数属于本仓契约生成层;源 Issue grape-dev/grape#1400 已由前序 VOD 转交至本仓,归属与本仓职责一致。

目标

修正 git-repo commits 帮助文案与实际可用参数的漂移,并评估在 git-repo pulls 下补充 commits 子命令,使 Agent/用户审查 PR 提交时不再因文案暗示 --ref 而试错。

现状(本仓 0.3.3 / 契约 v2.2.0 实测复核,反馈事实成立)

  • grape git-repo commits --help 描述行仍为 Commit history (optional sha/ref filter);Options 仅 --owner / --repo / --per_page / --sha / --json-out。
  • 实测 --ref main → Error: No such option '--ref'. Did you mean '--repo'?
  • grape git-repo pulls --help 命令集为 comments / create / files / get / issues / list / merge / update,确无 commits。
  • 能力本身可用 --sha <branch|tag|commit sha> 达成,属帮助文案、契约描述与文档三方漂移,非功能缺失。

期望行为

  1. 在命令 schema / 描述生成处(不手改生成物)修正 Usage 描述,去掉含糊的 "ref filter",改为显式 --sha <branch|tag|sha>,并补充 grape git-repo commits --sha <branch> --json-out 示例。
  2. 文档同步:coding-cli/references/grape-cli-reference.md 的 commits 小节补"列 PR 提交 = grape git-repo commits --owner <o> --repo <r> --sha <pr head branch|sha> --json-out",并说明 pulls 暂无 commits。该文档位于 grape-dev/grape-skills 仓(skills/coding/ai-coding-review/coding-cli/references/),需在 grape-skills 侧同步提交,本仓 Issue 只承接命令层改动。
  3. (可选)新增 grape git-repo pulls commits 子命令(解析 PR head sha 后转调 commits 端点)并补单测。
  4. 增加帮助文案快照 / 契约测试,防止 Usage 与 Options 再次漂移。

验收标准

优先级

P2(帮助文案/文档漂移,非功能缺失,有 --sha 替代路径)

关联

  • 本仓 #73(commits --help 示例写 --ref main 与选项不一致,open):与本 Issue 同属一个文案漂移根因,建议合并处理或明确主单
  • 源 Issue:grape-dev/grape#1400(后台反馈 id=1950)

下一步:已交办 issue 阶段,由 Issue Agent 做 spec 设计、与 #73 的合并判定、打标签与排期。


auto-submitted by VOD Agent

likedislike
grape_botgrape_botCollaborators
18 days ago Modify description of issue
grape_botgrape_botCollaborators
18 days ago Assign grape_bot as responsible person
grape_botgrape_botCollaborators
18 days ago Added label: bugP2spec-readytriagedusability
grape_bot
grape_botCollaborators
18 days ago Comments:

[issue agent] ✅ 深度可开发性分析完成,评级:ready

四维结论:需求完整性 complete(含复现命令、报错原文、版本环境、预期/实际)|技术可行性 feasible(文案来源已定位到契约与 examples 两处)|依赖就绪性 ready|范围确定性 clear。

一、根因分层(0.3.3 + 契约 v2.2.0 实测复核)

  1. 描述行漂移的源头在服务端契约:Commit history (optional sha/ref filter) 是服务端 openapi 中 GET /api/git-repo/{owner}/{repo}/commits 的 summary 字段原文;同一 operation 的 parameters 只有 owner/repo/per_page/sha。CLI 由契约生成 help,不手写该行,因此「文案写 ref、选项无 ref」属服务端 schema 描述超前于实现,不是本仓渲染缺陷。
  2. Examples 行的源头在本仓数据文件:src/data/examples.json 的 gitrepo_commits 在 main 上为 --owner o --repo r --json-out(自洽、无 --ref)。--ref main 示例由 PR #14(feat/issue-1807,open)引入,而 PR #14 的 ref 参数只写进了本仓内置快照 src/data/openapi.json,服务端契约并未发布 ref。因此执行 grape refresh 拉到远端 2.2.0 后,--ref 选项消失而示例仍宣传 --ref,即出现「示例有、选项无」。这也解释了 #73 在不同环境得出相反结论:结论取决于该环境安装的是内置快照还是 refresh 后的远端契约。
  3. pulls 无 commits 子命令:属实,命令集为 comments/create/files/get/issues/list/merge/update。

二、与 #73 合并判定

  • 主单:#107。它覆盖描述行、Examples、文档同步、防漂移测试四项;#73 仅覆盖「示例与选项不一致」,是 #107 的子集,且其可复现性依赖构建来源(内置快照 vs 远端契约)。
  • 处理:#73 并入本单并关闭为重复,后续修复与验收统一以 #107 为准,避免两处分别验收再次分叉。

三、排期与分诊

  • 优先级:P2(有 --sha 替代路径,不阻塞主流程)。
  • 里程碑:仓库当前没有里程碑(open/closed/all 均返回空),无法挂载;建议维护者创建 P2 里程碑后归入,或直接进入 P2 队列。
  • 标签:bug + usability + P2 + spec-ready + triaged;负责人:机器人。
  • 当前开发流水线未配置 coding Agent,本次未发起 A2A 交办;待该环节配置确认后即可按下方 Spec 启动开发。

📋 Spec Document 见下一条评论。

likedislike
grape_bot
grape_botCollaborators
18 days ago Comments:

[issue agent] 📋 Spec Document

Spec: Issue #107 — commits 帮助文案/示例与选项漂移修正 + 防漂移测试

Generated by Issue Agent | Developability: ready | 2026-11-07 | 开发基准分支:main

Objective

  • 目标:让 grape git-repo commits --help 的 summary/description/Examples 与实际 Options 完全自洽,照抄示例即可成功;新增快照测试防止再次漂移;同步文档说明「列 PR 提交 = --sha <head branch|sha>」。
  • 用户:使用 grape CLI 的 Agent(coding/review 流程)与开发者;现状会按 help 提示试错 --ref,多耗一轮。
  • 成功标准:help 不出现不可用参数;示例中每个选项都在 Options 中;CI 能拦截同类回归。

Scope

In Scope

  1. src/data/examples.json:gitrepo_commits 示例补充 --sha main(当前无 sha 演示),保证可照抄。
  2. PR #14 合入门槛:--ref 只允许在服务端契约发布 ref 参数后出现在 Options/Examples。当前内置快照有 ref、远端契约无 ref,合入即制造刷新后漂移;合入前 examples 不得含 --ref,合入前需服务端先发布契约。
  3. 新增测试 test/test_help_snapshot.py:
    • ① 遍历所有 leaf 命令,Examples 中出现的每个 --xxx 必须存在于该命令 Options;
    • ② help 头部 summary 中以 a/b filter 列举的参数名、以及 description 中的 --xxx 字样,均须能解析到 Options;
    • ③ 分别以内置快照与refresh 后远端契约为输入断言,防止 bundled/remote 双源分叉。
  4. 文档同步(跨仓 grape-dev/grape-skills):skills/coding/ai-coding-review/coding-cli/references/grape-cli-reference.md 的 commits 小节补 --sha <branch|tag|sha> 用法与「列 PR 提交」示例,并注明 pulls 暂无 commits。

Out of Scope

  • 服务端 summary 文案修改本身:本仓不手改契约生成物,由 grape-dev/grape 修改 commits 路由 summary(未发版 ref 时写 optional sha filter,ref 发版后写 sha/ref)并发布契约版本,CLI 执行 grape refresh 后自动收敛。
  • pulls commits 子命令:本单不做(P2 可选诉求,--sha <PR head branch|sha> 已可达成),建议单独 issue 评估。
  • --ref 功能实现本身:由 PR #14 承载。

Technical Approach

  1. examples 数据修正:改 src/data/examples.json,help 由 registry 读取渲染,无逻辑改动。
  2. 测试实现:复用现有契约快照与 help 渲染入口遍历命令树;对 Examples 做 shell 分词取 -- 前缀 token,与 Options 集合比对。
  3. 契约回归断言:以 refresh 后的远端契约参数集为基线,比对 summary 文本中列举的参数,覆盖「刷新后漂移」场景。
  4. 文档 PR 在 grape-skills 仓独立提交,引用本 Issue 编号。

关键设计决策

决策 选项 选择 理由
文案口径 A 等 --ref 发布 / B 先按 --sha 收敛 B 契约 v2.2.0 无 ref,help 不得预告未发版参数
summary 修复位置 本仓覆盖表 / 服务端 schema 服务端 契约驱动,禁止手改生成物,避免二次漂移
pulls commits 本单做 / 另开 另开 P2 可选诉求,避免范围膨胀

Affected Modules

模块 改动类型 说明
src/data/examples.json 修改 gitrepo_commits 示例改为含 --sha main
test/test_help_snapshot.py 新增 Examples⊂Options、summary⊂parameters、双源契约断言
PR #14(feat/issue-1807) 约束 合入前移除/挂起 --ref 示例,待服务端契约发布

依赖关系:examples.json → registry help 渲染 → test 断言;测试同时依赖内置快照与刷新后的远端契约。

Acceptance Criteria

Risks & Mitigations

Risk Impact Mitigation
服务端 summary 排期滞后 Med 测试先以红灯跟踪 summary⊂parameters,服务端契约发布后转绿
PR #14 与服务端契约不同步 High 合入门槛写入 PR 描述;refresh 后测试必须绿
示例占位符不可执行 Low 使用真实默认分支 main,并注明可替换为任意分支/tag/sha

Open Questions

  • 无。(服务端 summary 修改需在 grape-dev/grape 建对应 issue 跟踪,属跨仓协调项)
likedislike
grape_botgrape_botCollaborators
18 days ago Close issue