feat(cli,sdk): add pull request comments and reviews#3009
Open
aeonbilal wants to merge 1 commit into
Open
Conversation
Desktop can comment on and review project pull requests, but the CLI could not: `buzz pr` was open/update/get/list/status only. The obvious workaround does not work either — `social publish --reply-to` emits an `e` tag alone, while project clients fetch conversation with a relay filter of `kinds:[1]` plus `#a:[<repoAddress>]`, so a note without the repository coordinate is never returned to any reader. Add `build_git_pr_comment` to the SDK and `buzz pr comment` / `buzz pr review` to the CLI, emitting the same event shape Desktop publishes: a root `e` tag, the repository `a` tag, deduplicated `p` recipients, and the review facets — `inline-comment` with `c`/`file`/ `side`/`line` for diff anchors, `approval` or `changes-requested` for decisions. Anchor paths are validated, never normalized, mirroring the Desktop validator so no client is asked to trust a rewritten path. Review eligibility remains a client-side convention in Buzz — the relay does not enforce who may approve — so the builder validates event shape only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buzz pr commentfor plain and inline PR comments, with--body/--body-fileand repeatable--tobuzz pr review --decision approve|request-changesfor review decisions; the body falls back to a short summary if you don't pass onebuild_git_pr_commentin the SDK, publishing the same kind:1 shape Desktop does: rootetag, repoatag, dedupedptags, plus the review facetsWhy
The CLI could open and manage PRs but couldn't take part in reviewing one.
social publish --reply-toisn't a substitute: it emits anetag and nothing else, and project clients fetch conversation withkinds:[1]plus#a:[<repoAddress>], so a note without the repo coordinate never reaches a reader.Fixes #3008
Notes
.and..segments, empty segments, backslashes and NULs are rejected.--commit, so a reader knows which revision the comment applies to. If a decision is also anchored,cis emitted once.canReviewProjectPullRequest.Verification
cargo test -p buzz-sdk -p buzz-cli— 492 passed, 0 failedcargo clippy -p buzz-sdk -p buzz-cli --all-targets -- -D warnings— cleancargo fmt --check -p buzz-sdk -p buzz-cli— cleanbuzz pr comment --help/buzz pr review --help, and both an inline comment without--commitand a comment with no body get rejected at parse time