ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

plannotator PR 评论标注(Phase 2)实战解析:从时间线「Annotate」按钮到 Agent 反馈导出

plannotator PR 评论标注(Phase 2)实战解析:从时间线「Annotate」按钮到 Agent 反馈导出 【免费下载链接】plannotatorAnnotate and review coding agent plans and code diffs visually, share with your team, send feedback to agents with one click.项目地址https://gitcode.com/gh_mirrors/pl/plannotator点击查看免费下载导读本文基于 plannotator 仓库中的 Phase 2 意图文档与规格文档intent-comment-annotation-phase2-20260630-193500.md、comment-annotation-phase2-20260630-193000.md完整讲解如何在 PR 评论时间线的每一张卡片上增加「Annotate」动作让评审者把批注挂到整条评论上、在批注侧栏中统一管理并在发送反馈时把完整引用的评论原文 评审者笔记一并交付给 coding agent。读完本文你将掌握该功能的存储模型、UI 接线方式、侧栏分组逻辑、Ask AI 复用机制以及专属导出格式化器的设计取舍并能在仓库源码中逐一定位其实现。背景与目标为什么评论必须可被「标注」在 plannotator 的评审工作流中代码 diff 与 PR 描述已经可以挂批注Phase 1但PR 评论时间线comments timeline是只读的。评审者常常需要对某条具体评论表态——「这才是真正的问题」「我不同意理由如下」——并希望把这些意见折进最终发给 agent 的反馈里而不必离开评审界面。这里存在一个与代码批注的本质差异代码 diffagent 自己能读仓库所以 diff 批注无需把代码原文随反馈携带PR 评论agent 看不到 GitHub 上的讨论因此笔记必须把评论本身引用进来否则反馈对 agent 而言是脱离上下文的。正是这个差异直接决定了 Phase 2 的存储结构、导出格式与复用策略参见 intent 文档 的 Why 段落以及 types.ts 中的类型注释The comment body travels with it so the agent — which cant see PR discussion — receives the full context on export.。决策锁定按钮驱动而非选区驱动规格文档锁定了六条关键决策adr/specs/comment-annotation-phase2-20260630-193000.md的 Decisions 章节按钮而非文本选区——评论通常很短整条评论即标注单位按钮避免了「选区与卡片点击/折叠」的交互冲突也无需把裁剪版渲染器迁移成标注可用annotation-ready的形态。所有卡片共享同一条 hover 动作行——按钮加在PRCommentLinkActions中这条行已同时被评论/评审卡片与线程卡片复用一处改动即可覆盖全部卡片类型线程以整体为标注单位动作行挂在线程第一条评论上。文案必须是「Annotate」而不是「Comment」/「Reply」——该按钮永远不会发布到 GitHub它是 agent 反馈「Comment」会让人误以为是在回复帖子。侧栏呈现新增「PR comments」分组——作者 短评论摘录 你的笔记紧凑展示完整评论在屏幕上可见。Agent 导出作者 完整评论正文 你的笔记理由见上文背景。Ask AI 复用文件无关file-less的选区式 asktext为评论正文、label 为 PR comment——与 PR 描述标注的机制完全相同。Preflight 纠偏exportMessageAnnotations 为什么被弃用Phase 2 规格在 preflight 阶段对照代码验证后发现了一个关键纠偏Spec 的 Preflight correction 章节exportMessageAnnotations是错误的导出途径不会使用。原因是MessageAnnotationEntry与exportMessageAnnotations对应 parser.ts:755-812规格原文引用是专门为标注 assistant AI 消息设计的它们期望消息内部存在文本锚定的annotations: Annotation[]并硬编码了 Message Feedback / assistant message / Message excerpt 等措辞——用它将 PR 评论标注导出会向 agent 传达错误的来源语义。因此实现采用存储一个简单的新类型CommentAnnotation { id, commentId, commentAuthor, commentBody, text, createdAt }无文本锚定、无块结构。导出一个专属的小型格式化器exportCommentAnnotations(anns)输出固定模板# PR Comment Feedback ## Comment by author quoted comment body (fenced/quoted) your note这一决策取代了 ADR 004 Decision 7 中「用exportMessageAnnotations导出评论」的假设——ADR 曾假定该函数适用preflight 证明它不适用。存储模型与状态接线App.tsxCommentAnnotation 类型类型定义在共享层 packages/ui/types.ts#L281-L290export interface CommentAnnotation { id: string; commentId: string; // the timeline entry id (matches>export function buildProseFeedback( descriptionAnnotations: Annotation[], commentAnnotations: CommentAnnotation[], descriptionBody: string | undefined, ): string { const parts: string[] []; // 1) PR description notes需有 descriptionBody // 2) PR comment notes → exportCommentAnnotations(regularComments) // 3) artifact 锚点笔记 → exportArtifactAnnotations(...) return parts.join(\n\n); }该函数同时被「agent 反馈feedbackMarkdown」与「GitHub 评审正文种子」共用保证两条输出路径永不分叉源码注释Shared by the agent feedback (feedbackMarkdown) and the GitHub review body seed, so the two never drift.。exportCommentAnnotationsexportFeedback.ts:442-454的核心行为空数组返回不产生空分组每组以# PR Comment Feedback开头每条笔记渲染为## Comment by {commentAuthor}随后将commentBody按行前缀转成引用块最后附上笔记正文若commentBody为空则跳过引用块。App.tsx 中 L3798 以buildProseFeedback(visibleDescriptionAnnotations, visibleCommentAnnotations, prContext?.body)构建 prose 反馈段再并入最终feedbackMarkdown。复用地图与新增面规格文档的 Reuse map 完整罗列了「零到一」的复用策略需求复用评论输入框 Ask AICommentPopoveronAskAI/askAIContext选区上的 Ask AIaskAI({ scope: { kind: selection, label, text } })侧栏分组与卡片镜像renderDescriptionAnnotationCard与分组块上下文注入镜像描述标注的 store 字段动作行PRCommentLinkActions仅新增一个按钮全新面只有三处CommentAnnotation类型、exportCommentAnnotations格式化器、以及 Tab 内的弹层状态无高亮器——因为是按钮驱动而非选区驱动这也是相对 Phase 1 的一个简化点见规格 Risks 1评论 DOM 中没有 web-highlighter 标记因此不存在标记持久化风险。验证清单Verification规格文档给出了可操作的验收标准可作为实现后的回归用例悬停任意卡片评论 / 评审 / 线程→ 动作行出现「Annotate」→ 点击 → 锚定按钮的评论框打开提交 → 卡片出现在侧栏「PR comments」分组作者 摘录 笔记计数与「Send Feedback」同步反映从侧栏删除即移除框内 Ask AI 在 AI 标签页作答发送的反馈中包含「PR Comment Feedback」章节携带完整引用的评论与笔记非 PR 评审与描述标注流程不受影响。风险与边界Risks无标记持久化风险按钮驱动、无选区高亮比 Phase 1 更简单跨面板聚焦限制侧栏选中仅在 Overview 面板打开时聚焦评论v1 已接受弹层锚点稳定性弹层打开期间评论卡片可能折叠/滚动对策是锚定按钮元素并依赖CommentPopover自身的滚动重定位能力。延伸阅读ADR004-annotate-pr-description-and-comments-20260630-155000.md其中 Decision 7 的「评论用exportMessageAnnotations」已被本 Phase 2 规格取代Phase 1 规格description-annotation-phase1-20260630-171500.md、意图文档 intent-description-annotation-phase1-20260630-180000.md关键实现文件PRCommentsTab.tsx、App.tsx、ReviewSidebar.tsx、ReviewStateContext.tsx、exportFeedback.ts、types.ts赞分享【免费下载链接】plannotatorAnnotate and review coding agent plans and code diffs visually, share with your team, send feedback to agents with one click.项目地址https://gitcode.com/gh_mirrors/pl/plannotator点击查看免费下载相关推荐plannotator PR 评论注释Phase 2为 PR 评论时间线卡片添加「Annotate」按钮并打通 Agent 反馈流水线plannotator PR 评论注释Phase 2为 PR 评论时间线卡片添加「Annotate」按钮并打通 Agent 反馈流水线 导读 本文围绕 pplannotator PR 描述标注Phase 1实战指南选中即评、复用现有注释引擎为 PR 描述接入 Agent 反馈管线plannotator PR 描述标注Phase 1实战指南选中即评、复用现有注释引擎为 PR 描述接入 Agent 反馈管线 导读 本文基于 plannplannotator 架构决策 004为 PR 描述与评论接入 Agent 反馈注释管线plannotator 架构决策 004为 PR 描述与评论接入 Agent 反馈注释管线 导读 本文基于 plannotator 仓库中的架构决策记录 AD创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表