10
310
Fork
You've already forked codeberg-cli
33

feat: add branch and comment management commands #255

Closed
timstoop wants to merge 8 commits from timstoop/codeberg-cli:feat-branch-and-comment-commands into main
pull from: timstoop/codeberg-cli:feat-branch-and-comment-commands
merge into: Aviac:main
Aviac:main
Contributor
Copy link

Fixes #253

New Commands

Repository Branch Management

  • berg repo branch list - List all branches in a repository
  • berg repo branch delete BRANCH - Delete a branch

Issue Comments

  • berg issue comments [ID] - List comments on an issue

Pull Request Comments and Reviews

  • berg pull comments [ID] - List discussion comments on a pull request
  • berg pull reviews [ID] - List reviews on a pull request
  • berg pull review-comments [ID] - List review comments (aggregated from all reviews)

All commands support:

  • Optional --repo OWNER/REPO flag to specify repository
  • Interactive selection when ID/branch not provided
  • Non-interactive mode support
  • JSON output via --output json
  • State filtering where applicable (--state open|closed|all)

Test Coverage

All commands include comprehensive integration tests in nix/tests/noninteractive/.

Fixes #253 ## New Commands ### Repository Branch Management - `berg repo branch list` - List all branches in a repository - `berg repo branch delete BRANCH` - Delete a branch ### Issue Comments - `berg issue comments [ID]` - List comments on an issue ### Pull Request Comments and Reviews - `berg pull comments [ID]` - List discussion comments on a pull request - `berg pull reviews [ID]` - List reviews on a pull request - `berg pull review-comments [ID]` - List review comments (aggregated from all reviews) All commands support: - Optional `--repo OWNER/REPO` flag to specify repository - Interactive selection when ID/branch not provided - Non-interactive mode support - JSON output via `--output json` - State filtering where applicable (`--state open|closed|all`) ## Test Coverage All commands include comprehensive integration tests in `nix/tests/noninteractive/`.
Add new command to list repository branches with support for --repo flag.
Changes:
- Add RepoBranchesArgs with --repo flag support
- Implement pretty table and JSON output modes
- Add integration tests for listing branches
- Support both in-repo and --repo OWNER/REPO usage
Implements part of #253
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add branch delete subcommand with --repo flag support.
Changes:
- Restructure branch commands under 'berg repo branch' namespace
- Add 'berg repo branch list' (moved from 'berg repo branches')
- Add 'berg repo branch delete' with confirmation message
- Add integration tests for branch deletion
- Support both in-repo and --repo OWNER/REPO usage
Implements part of #253
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add command to list comments on an issue without fetching full issue details.
Changes:
- Add IssueCommentsArgs with issue ID and --repo flag support
- Implement pretty table and JSON output modes
- Support interactive issue selection or direct ID
- Add integration tests for listing issue comments
- Reuse existing comment rendering from view command
Implements part of #253
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add command to list comments on a pull request without fetching full PR details.
Changes:
- Add PullCommentsArgs with PR ID and --repo flag support
- Implement pretty table and JSON output modes
- Support interactive PR selection or direct ID
- Add integration tests for listing PR comments
- Reuse existing comment rendering from view command
Implements part of #253
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add command to list reviews on a pull request.
Changes:
- Add PullReviewsArgs with PR ID and --repo flag support
- Implement pretty table and JSON output modes
- Support interactive PR selection or direct ID
- Display review ID, state, user, submission time, and comment count
- Add integration tests for listing PR reviews
This command is useful for discovering review IDs to inspect specific
reviews or their comments.
Implements part of #253
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements aggregated review comment listing for pull requests.
The command fetches all reviews for a PR and collects comments
from each review into a single list.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
@ -0,0 +19,4 @@
test = ''
# Create a branch and some commits
${testLib.berg_run {
cmd = ''!cd${testLib.testRepo}&&gitcheckout-btest-pr&&echo"test">test.txt&&gitaddtest.txt&&gitcommit-m"Addtestfile"&&gitpushorigintest-pr'';
Owner
Copy link

This is not valid nix code. I'm glad that you include tests in these PRs but they are getting too big for me to review. This is pretty spammy for me and not fun at all :( I have to check if the AI generated correct code. This is just becoming a chore. This is not why I started a coding project

This is not valid nix code. I'm glad that you include tests in these PRs but they are getting too big for me to review. This is pretty spammy for me and not fun at all :( I have to check if the AI generated correct code. This is just becoming a chore. This is not why I started a coding project
Owner
Copy link

I have no problem with the AI generating some of the code or assisting you to learn rust but this is becomming frustrating for me now. If you want to continue with this then please take smaller steps and open just one PR at a time, otherwise I'll just have to ignore this soon as it quickly becomes overwhelming

I have no problem with the AI generating some of the code or assisting you to learn rust but this is becomming frustrating for me now. If you want to continue with this then please take smaller steps and open just one PR at a time, otherwise I'll just have to ignore this soon as it quickly becomes overwhelming
Owner
Copy link

If you want to do some more rapid development I'm also not holding you back from forking this project and go at your own pace btw. No hard feelings.

Also, for the record: I still have good faith, I just have my own human limits.

If you want to do some more rapid development I'm also not holding you back from forking this project and go at your own pace btw. No hard feelings. Also, for the record: I still have good faith, I just have my own human limits.
Author
Contributor
Copy link

@Aviac wrote in #255 (comment):

I have no problem with the AI generating some of the code or assisting you to learn rust but this is becomming frustrating for me now. If you want to continue with this then please take smaller steps and open just one PR at a time, otherwise I'll just have to ignore this soon as it quickly becomes overwhelming

Hey sorry about that! That was not my intention, of course. To be totally honest, I was unable to get the nix tests to work correctly from a container and I may have ragequitted a bit with regards to that :-( I have no interest in forking. Or of being a chore, if you need me to slow down or split things up, please just let me know and I'll make it so. I'll make sure to keep that in mind for future PRs.

Again, really sorry if I've been a pain, my intend was to be helpful. And I'm well aware that not testing the actual nix code is not helpful at all! I'll do better.

@Aviac wrote in https://codeberg.org/Aviac/codeberg-cli/pulls/255#issuecomment-7694524: > I have no problem with the AI generating some of the code or assisting you to learn rust but this is becomming frustrating for me now. If you want to continue with this then please take smaller steps and open just one PR at a time, otherwise I'll just have to ignore this soon as it quickly becomes overwhelming Hey sorry about that! That was not my intention, of course. To be totally honest, I was unable to get the nix tests to work correctly from a container and I may have ragequitted a bit with regards to that :-( I have no interest in forking. Or of being a chore, if you need me to slow down or split things up, please just let me know and I'll make it so. I'll make sure to keep that in mind for future PRs. Again, really sorry if I've been a pain, my intend was to be helpful. And I'm well aware that not testing the actual nix code is not helpful at all! I'll do better.
Owner
Copy link

I will extract the branch subcommands now manually and implement proper tests for them. You will still be mentioned in the commit

I will extract the branch subcommands now manually and implement proper tests for them. You will still be mentioned in the commit
Owner
Copy link

@Aviac wrote in #255 (comment):

I will extract the branch subcommands now manually and implement proper tests for them. You will still be mentioned in the commit

See 3ffb41efa1 for starters... I'll see in how far I can implement the rest

@Aviac wrote in https://codeberg.org/Aviac/codeberg-cli/pulls/255#issuecomment-7695190: > I will extract the branch subcommands now manually and implement proper tests for them. You will still be mentioned in the commit See 3ffb41efa1bb5dce1a6fd89e006967654d86c607 for starters... I'll see in how far I can implement the rest
@ -16,6 +17,7 @@ pub enum IssueArgs {
List(list::ListIssueArgs),
Create(create::CreateIssueArgs),
Comment(comment::CommentIssueArgs),
Comments(comments::IssueCommentsArgs),
Owner
Copy link

I'm not a fan. I think at this point it should be another layer of subcommands for comment with commands:

  • write
  • list

see 3ffb41efa1 for reference how it can look

I'm not a fan. I think at this point it should be another layer of subcommands for comment with commands: - write - list see 3ffb41efa1bb5dce1a6fd89e006967654d86c607 for reference how it can look
@ -20,3 +21,4 @@
Comment(comment::CommentPullRequestArgs),
Comments(comments::PullCommentsArgs),
}
Owner
Copy link

Same as with issue comments

Same as with issue comments
@ -20,2 +22,4 @@
Comment(comment::CommentPullRequestArgs),
Comments(comments::PullCommentsArgs),
Reviews(reviews::PullReviewsArgs),
}
Owner
Copy link

I planned on making review a completely separate subcommand a la berg review .... The idea was that it would be the place to go to check for undone work. Not only PRs but also unread notifications and unresponded issue comments/ review comments. Stuff like this. It should probably also have some subcommands for the categories just mentioned!

I planned on making `review` a completely separate subcommand a la `berg review ...`. The idea was that it would be the place to go to check for undone work. Not only PRs but also unread notifications and unresponded issue comments/ review comments. Stuff like this. It should probably also have some subcommands for the categories just mentioned!
Author
Contributor
Copy link

@Aviac wrote in #255 (comment):

I will extract the branch subcommands now manually and implement proper tests for them. You will still be mentioned in the commit

Thanks, but for the record, I'm not doing it for the accolades. You're already going out of your way to help me teach myself better. And that is very much appreciated!

@Aviac wrote in https://codeberg.org/Aviac/codeberg-cli/pulls/255#issuecomment-7695190: > I will extract the branch subcommands now manually and implement proper tests for them. You will still be mentioned in the commit Thanks, but for the record, I'm not doing it for the accolades. You're already going out of your way to help me teach myself better. And that is very much appreciated!
Fix test parameter names and shared library references:
- Replace withTestRepo with cdTestRepo in berg_run/berg_run_json calls
- Add sharedLib imports to test modules
- Replace testLib.{user,repo,testRepo} with sharedLib.{user,repo}
These changes fix the nix flake check errors. The tests now parse correctly
and can be validated for syntax, though running the full VM-based integration
tests requires KVM support which is difficult to set up in Docker containers
on non-NixOS systems.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author
Contributor
Copy link

So I got a bit father with running the nix tests, but it's not easy to run from a container as it depends on kvm for setting up a test instance. Syntax validated now, at least. I know you won't be using this branch directly anymore, but felt like the least I could do was make sure the syntax is correct.

So I got a bit father with running the nix tests, but it's not easy to run from a container as it depends on kvm for setting up a test instance. Syntax validated now, at least. I know you won't be using this branch directly anymore, but felt like the least I could do was make sure the syntax is correct.
Owner
Copy link

Thanks again @timstoop , I'll close this for now since the codebase has diverted too much from this PR already. Let me know if you're missing any features or even better: create a feature request issue so I don't forget about it 😅

Thanks again @timstoop , I'll close this for now since the codebase has diverted too much from this PR already. Let me know if you're missing any features or even better: create a feature request issue so I don't forget about it 😅
Aviac closed this pull request 2026年01月11日 13:24:03 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Aviac/codeberg-cli!255
Reference in a new issue
Aviac/codeberg-cli
No description provided.
Delete branch "timstoop/codeberg-cli:feat-branch-and-comment-commands"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?