Skip to content

feat: add Confluence page comment commands#40

Merged
Hinne1 merged 1 commit intomainfrom
claude/confluence-comments
Mar 20, 2026
Merged

feat: add Confluence page comment commands#40
Hinne1 merged 1 commit intomainfrom
claude/confluence-comments

Conversation

@Hinne1
Copy link
Contributor

@Hinne1 Hinne1 commented Mar 20, 2026

Summary

  • Add atl confluence comment list|add|edit commands for managing footer comments on Confluence pages via the v2 API
  • list — view all footer comments on a page (with --json support)
  • add — create a comment (supports --reply-to for threaded replies, --body-file for file input)
  • edit — update an existing comment by ID (auto-fetches current version)
  • Add OAuth scopes: read:comment:confluence, write:comment:confluence
  • No delete command — Confluence does not allow normal users to delete comments via API

Test plan

  • atl confluence comment list <page-id> returns comments (tested against live Confluence)
  • atl confluence comment add <page-id> --body "<p>text</p>" creates a comment
  • atl confluence comment add <page-id> --body "<p>reply</p>" --reply-to <id> creates a threaded reply
  • atl confluence comment edit --id <id> --body "<p>updated</p>" updates a comment
  • --json output works on all commands
  • --body-file reads from file correctly
  • Re-auth required after install (atl auth logout && atl auth login) to pick up new OAuth scopes

Add `atl confluence comment list|add|edit` commands for managing
footer comments on Confluence pages via the v2 API.

- list: view all footer comments on a page
- add: create a comment (supports --reply-to for threaded replies)
- edit: update an existing comment by ID
- All commands support --json output and --body-file input
- Add OAuth scopes: read:comment:confluence, write:comment:confluence
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Confluence CLI capabilities by introducing a comprehensive set of commands for managing page comments. Users can now programmatically list, add, and modify footer comments on Confluence pages, streamlining content collaboration workflows directly from the command line. This feature leverages the Confluence v2 API and integrates seamlessly into the existing CLI structure, providing a powerful new tool for Confluence administrators and power users.

Highlights

  • New Confluence Comment Commands: Introduced a new atl confluence comment command group with subcommands to list, add, and edit footer comments on Confluence pages.
  • List Comments (list): The list command allows users to view all footer comments on a specified Confluence page, including support for JSON output.
  • Add Comments (add): The add command enables creation of new footer comments. It supports threaded replies via --reply-to and allows comment bodies to be provided from a file using --body-file.
  • Edit Comments (edit): The edit command facilitates updating existing footer comments by ID. It automatically fetches the current comment version for proper update handling.
  • OAuth Scopes: Added necessary OAuth scopes (read:comment:confluence, write:comment:confluence) to support comment management via the Confluence v2 API.
  • No Delete Command: A delete command for comments was intentionally omitted as the Confluence v2 API does not allow normal users to delete comments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Hinne1 Hinne1 marked this pull request as ready for review March 20, 2026 14:20
@Hinne1 Hinne1 merged commit e09ecba into main Mar 20, 2026
8 of 9 checks passed
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds commands for managing Confluence page comments. The implementation is solid, adding new API service methods and corresponding CLI commands for list, add, and edit. My review focuses on improving code reuse, robustness, and fixing a bug in the HTML stripping logic. I've suggested refactoring some duplicated anonymous structs in the API layer, improving how shared output structs are handled between commands, making the timestamp formatting more robust, and replacing a buggy HTML stripping function with a more reliable regex-based approach.

Comment on lines +138 to +153
func stripHTML(s string) string {
// Simple tag stripping for display purposes
result := s
for {
start := strings.Index(result, "<")
if start == -1 {
break
}
end := strings.Index(result[start:], ">")
if end == -1 {
break
}
result = result[:start] + result[start+end+1:]
}
return strings.TrimSpace(result)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This stripHTML implementation has a bug. It can incorrectly strip content if the text contains \u003c characters, for example 1 \u003c 2. A much safer and more robust approach is to use a regular expression to remove tags. For example: regexp.MustCompile("\u003c[^\u003e]*\u003e").ReplaceAllString(s, ""). This will correctly strip tags without affecting content.

Comment on lines +915 to +934
// CreateFooterCommentRequest represents a request to create a footer comment.
type CreateFooterCommentRequest struct {
PageID string `json:"pageId"`
ParentCommentID string `json:"parentCommentId,omitempty"`
Body struct {
Representation string `json:"representation"`
Value string `json:"value"`
} `json:"body"`
}

// UpdateFooterCommentRequest represents a request to update a footer comment.
type UpdateFooterCommentRequest struct {
Version struct {
Number int `json:"number"`
} `json:"version"`
Body struct {
Representation string `json:"representation"`
Value string `json:"value"`
} `json:"body"`
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The CreateFooterCommentRequest and UpdateFooterCommentRequest structs use anonymous structs for Body and Version. This leads to code duplication for the Body struct. To improve maintainability and clarity, consider extracting these into named types. For example, a CommentRequestBody could be defined and reused, and a CommentUpdateVersion could be defined for the update request.

Comment on lines +71 to +76
// AddCommentOutput represents the result of adding a comment.
type AddCommentOutput struct {
PageID string `json:"page_id"`
CommentID string `json:"comment_id"`
Action string `json:"action"`
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The AddCommentOutput struct is defined here but is also used by the edit command. To better reflect its shared nature and improve code organization, consider moving this struct to a more central location (e.g., internal/cmd/confluence/comment/comment.go) and renaming it to something more generic like CommentActionOutput.

Comment on lines +130 to +135
func formatTime(t string) string {
if len(t) >= 19 {
return t[:10] + " " + t[11:19]
}
return t
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The formatTime function uses string slicing, which is brittle. It assumes the timestamp string will always have a specific length and format. A more robust method would be to parse the string using time.Parse(time.RFC3339, t) and then format the resulting time.Time object. This would correctly handle any valid ISO 8601 timestamp from the API.

@Hinne1 Hinne1 deleted the claude/confluence-comments branch March 20, 2026 14:20
@github-actions
Copy link

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/enthus-appdev/atl-cli/internal/api 36.83% (-1.65%) 👎
github.com/enthus-appdev/atl-cli/internal/auth 27.44% (ø)
github.com/enthus-appdev/atl-cli/internal/cmd/confluence 0.00% (ø)
github.com/enthus-appdev/atl-cli/internal/cmd/confluence/comment 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/enthus-appdev/atl-cli/internal/api/confluence.go 1.44% (-0.29%) 348 (+59) 5 343 (+59) 👎
github.com/enthus-appdev/atl-cli/internal/auth/oauth.go 0.00% (ø) 79 0 79
github.com/enthus-appdev/atl-cli/internal/cmd/confluence/comment/add.go 0.00% (ø) 30 (+30) 0 30 (+30)
github.com/enthus-appdev/atl-cli/internal/cmd/confluence/comment/comment.go 0.00% (ø) 5 (+5) 0 5 (+5)
github.com/enthus-appdev/atl-cli/internal/cmd/confluence/comment/edit.go 0.00% (ø) 33 (+33) 0 33 (+33)
github.com/enthus-appdev/atl-cli/internal/cmd/confluence/comment/list.go 0.00% (ø) 51 (+51) 0 51 (+51)
github.com/enthus-appdev/atl-cli/internal/cmd/confluence/comment/util.go 0.00% (ø) 8 (+8) 0 8 (+8)
github.com/enthus-appdev/atl-cli/internal/cmd/confluence/confluence.go 0.00% (ø) 6 (+1) 0 6 (+1)

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant