issue_994: Add optional role/group comment visibility via REST v3 and CLI flags#995
Open
jordanlgraham wants to merge 1 commit into
Open
issue_994: Add optional role/group comment visibility via REST v3 and CLI flags#995jordanlgraham wants to merge 1 commit into
jordanlgraham wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds optional role/group-based visibility restrictions to jira issue comment add by introducing new CLI flags and routing restricted comments through Jira’s REST API v3 comment endpoint with an ADF body, while keeping the existing REST v2 + markdown→wiki behavior unchanged when no visibility flags are used.
Changes:
- Add
--visibility-role/--visibility-groupflags tojira issue comment addand pass them through to the Jira client. - Introduce
IssueCommentOptionsand a newAddIssueCommentOptscode path that posts comments via REST v3 withvisibilitywhen role/group visibility is requested. - Document the new flags and clarify v3 ADF body behavior in the README.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Documents the new visibility flags and notes the v3 ADF/plain-text behavior. |
| pkg/jira/issue.go | Adds options/validation, ADF conversion helper, and v3 posting path for visibility-restricted comments. |
| pkg/jira/issue_test.go | Adds tests for options validation and verifies v3 request payload/path for role/group visibility. |
| internal/cmd/issue/comment/add/add.go | Adds new CLI flags and wires them into the Jira client call. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+372
to
+373
| block = strings.TrimSpace(block) | ||
| if block == "" { |
Comment on lines
+355
to
+360
| // commentPlainToADF builds a minimal Atlassian Document body from plain text (paragraphs split on | ||
| // blank lines; single newlines become hard breaks). Used for REST v3 comments when setting visibility. | ||
| func commentPlainToADF(text string) *adf.ADF { | ||
| text = strings.ReplaceAll(text, "\r\n", "\n") | ||
| text = strings.TrimRight(text, "\n") | ||
| if text == "" { |
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
Adds optional
--visibility-roleand--visibility-groupflags tojira issue comment add. When either is set, the client uses Jira REST v3POST /rest/api/3/issue/{issueIdOrKey}/commentwith avisibilityobject (type+valueonly) and a valid v3 comment body.When neither flag is set, behavior is unchanged (existing v2 flow, markdown handling,
--internal/sd.public.commentunchanged).Fixes #994.
Behavior
--visibility-role <name>visibility:{ "type": "role", "value": "<name>" }.--visibility-group <name>visibility:{ "type": "group", "value": "<name>" }.--visibility-roleand--visibility-groupare mutually exclusive with each other.--internalis mutually exclusive with--visibility-role/--visibility-group(calling them together exits with a clear error; avoids ambiguous precedence).Notes
identifierandvalueare mutually exclusive invisibility; this PR uses onlytype+valuefor role/group visibility (matches Cloud behavior and avoids HTTP 400 from sending both).Testing
--visibility-role/--visibility-group→ comment restricted as expected on Jira Cloud.Refs: Add comment (v3)