Skip to content

feat: add bl git repo list/show commands#103

Merged
23prime merged 2 commits intomainfrom
feature/50-git-repo-list-show
Mar 22, 2026
Merged

feat: add bl git repo list/show commands#103
23prime merged 2 commits intomainfrom
feature/50-git-repo-list-show

Conversation

@23prime
Copy link
Owner

@23prime 23prime commented Mar 22, 2026

Checklist

  • Target branch is main
  • Status checks are passing
  • Documentation updated if user-visible behavior changed (website/docs/, website/i18n/ja/, README.md)

Summary

  • Add bl git repo list <project-id-or-key> — lists Git repositories in a project
  • Add bl git repo show <project-id-or-key> <repo-id-or-name> — shows details of a Git repository

Reason for change

Implements #50.

Changes

  • src/api/git.rsGitRepository struct + BacklogClient methods for both endpoints
  • src/api/mod.rs — trait declaration + impl
  • src/cmd/git/list.rs, src/cmd/git/show.rs — command logic with tests
  • src/cmd/git/mod.rs — re-exports
  • src/cmd/mod.rs — added git module
  • src/main.rs — clap wiring for bl git repo list/show
  • website/docs/commands.md, website/i18n/ja/.../commands.md — docs and coverage table updated

Notes

Closes #50

Copilot AI review requested due to automatic review settings March 22, 2026 00:06
@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

📝 Walkthrough

Walkthrough

Adds Git repository support: new API models and client methods to fetch repositories, CLI commands bl git repo list and bl git repo show (text or JSON), and documentation updates. Includes unit tests for API and CLI handlers.

Changes

Cohort / File(s) Summary
API Data Models & Methods
src/api/git.rs, src/api/mod.rs
Added GitUser and GitRepository response models (serde camelCase, flattened extra fields). Added BacklogClient::get_git_repositories() and get_git_repository() and extended BacklogApi trait with corresponding methods; includes a deserialize helper and unit tests using httpmock.
CLI Command Implementation
src/cmd/git/list.rs, src/cmd/git/show.rs, src/cmd/git/mod.rs
Implemented git repo list and git repo show commands with argument structs (GitRepoListArgs, GitRepoShowArgs), *_with testable handlers, text and --json output paths, formatting helpers, and unit tests with mock BacklogApi.
CLI Routing & Integration
src/cmd/mod.rs, src/main.rs
Exported git command module; added GitCommands/GitRepoCommands CLI enums and dispatch wiring to call the new handlers.
Documentation
website/docs/commands.md, website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md
Added docs and examples for bl git repo list and bl git repo show; updated command coverage table for the two API endpoints to “✅ Implemented”.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI (bl)
  participant Client as BacklogClient
  participant API as Backlog API (HTTP)

  CLI->>Client: call get_git_repositories(projectIdOrKey)
  Client->>API: GET /api/v2/projects/{projectIdOrKey}/git/repositories
  API-->>Client: 200 OK [JSON array of repositories]
  Client->>Client: deserialize JSON -> Vec<GitRepository>
  Client-->>CLI: return Vec<GitRepository>
  CLI->>CLI: render text rows or pretty JSON
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add bl git repo list/show commands' clearly and concisely describes the main changes in the pull request.
Linked Issues check ✅ Passed The pull request fully implements the requirements from issue #50: adds bl git repo list and bl git repo show commands mapped to the correct API endpoints with proper argument handling.
Out of Scope Changes check ✅ Passed All changes are in scope; the PR adds the two Git repository commands, their supporting API layer, and comprehensive documentation updates without introducing unrelated modifications.
Description check ✅ Passed The pull request description clearly describes the changes: adding two CLI commands (bl git repo list and bl git repo show), references the implemented issue (#50), lists all modified files, and includes a completed checklist.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature/50-git-repo-list-show

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class Git repository support to the bl CLI by implementing Backlog API v2 Git repository list/show endpoints and wiring them into the command tree, with docs updates for both EN and JA command references.

Changes:

  • Introduce src/api/git.rs with GitRepository model and BacklogClient methods for listing/showing Git repos.
  • Add bl git repo list and bl git repo show commands (including unit tests) and wire them into src/main.rs.
  • Update command documentation and command coverage tables in website/docs/commands.md and the Japanese translation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md Adds JA docs for bl git repo list/show and marks endpoints as implemented.
website/docs/commands.md Adds EN docs for bl git repo list/show and marks endpoints as implemented.
src/main.rs Adds clap subcommands for bl git repo list/show and dispatches to cmd::git.
src/cmd/mod.rs Registers the new cmd::git module.
src/cmd/git/mod.rs Adds cmd::git module exports for list/show.
src/cmd/git/list.rs Implements bl git repo list command + tests.
src/cmd/git/show.rs Implements bl git repo show command + tests.
src/api/mod.rs Exposes api::git and extends BacklogApi trait + client impl.
src/api/git.rs Adds Git API models + client methods + httpmock tests.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/cmd/git/mod.rs (1)

1-5: Consider consolidating Git repo subcommands into a single resource file.

This split works functionally, but it diverges from the repo’s established sub-resource layout and may increase navigation overhead over time.

♻️ Suggested module-level refactor
-mod list;
-mod show;
+mod repo;

-pub use list::{GitRepoListArgs, list};
-pub use show::{GitRepoShowArgs, show};
+pub use repo::{GitRepoListArgs, GitRepoShowArgs, list, show};

Based on learnings: “sub-resource command files under src/cmd/<resource>/ … should consolidate all subcommands … into a single file per resource. Do not split each subcommand into its own file.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cmd/git/mod.rs` around lines 1 - 5, Currently git subcommands are split
into separate modules (mod list; mod show;) with pub use of GitRepoListArgs/list
and GitRepoShowArgs/show; consolidate them into a single resource module by
merging the contents of the list and show modules into one file (e.g., the git
resource module), replace the two mod declarations with a single module
implementation, and re-export the unified symbols (keep the names
GitRepoListArgs, list, GitRepoShowArgs, show) from that single module so callers
do not need to change; remove the old separate module files and update any
internal references to point to the consolidated module.
src/cmd/git/list.rs (1)

41-43: Consider showing additional repository information.

The current format only displays the repository name. For a list command, you might want to include the repository ID or HTTP URL to help users quickly identify and reference repositories for follow-up commands like bl git repo show.

💡 Optional: Include repo ID for easier reference
 pub fn format_repo_row(repo: &GitRepository) -> String {
-    format!("{}", repo.name.cyan().bold())
+    format!("{} (id: {})", repo.name.cyan().bold(), repo.id)
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cmd/git/list.rs` around lines 41 - 43, The current format_repo_row
function only prints repo.name; update format_repo_row(&GitRepository) to
include additional identifying info (e.g., repo.id and/or repo.http_url)
alongside repo.name so list output is more actionable for follow-up commands;
locate format_repo_row and the GitRepository fields (name, id, http_url) and
change the formatted string to include the chosen identifier(s) (for example
prefix with the repo id and append the http_url) while preserving existing
styling (cyan().bold()) for the name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/cmd/git/list.rs`:
- Around line 41-43: The current format_repo_row function only prints repo.name;
update format_repo_row(&GitRepository) to include additional identifying info
(e.g., repo.id and/or repo.http_url) alongside repo.name so list output is more
actionable for follow-up commands; locate format_repo_row and the GitRepository
fields (name, id, http_url) and change the formatted string to include the
chosen identifier(s) (for example prefix with the repo id and append the
http_url) while preserving existing styling (cyan().bold()) for the name.

In `@src/cmd/git/mod.rs`:
- Around line 1-5: Currently git subcommands are split into separate modules
(mod list; mod show;) with pub use of GitRepoListArgs/list and
GitRepoShowArgs/show; consolidate them into a single resource module by merging
the contents of the list and show modules into one file (e.g., the git resource
module), replace the two mod declarations with a single module implementation,
and re-export the unified symbols (keep the names GitRepoListArgs, list,
GitRepoShowArgs, show) from that single module so callers do not need to change;
remove the old separate module files and update any internal references to point
to the consolidated module.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 44c1a8d0-1997-46fa-8957-51614d2a1d56

📥 Commits

Reviewing files that changed from the base of the PR and between 1e4a13c and c34c73d.

📒 Files selected for processing (9)
  • src/api/git.rs
  • src/api/mod.rs
  • src/cmd/git/list.rs
  • src/cmd/git/mod.rs
  • src/cmd/git/show.rs
  • src/cmd/mod.rs
  • src/main.rs
  • website/docs/commands.md
  • website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md

Addresses review comment: deserialize drops the raw JSON payload
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/api/git.rs (1)

52-69: Optional: URL-encode path parameters for consistency with defensive programming practices.

Path parameters (project_id_or_key, repo_id_or_name) are interpolated directly into URLs. While the Backlog API likely restricts allowed characters in these identifiers, URL-encoding would add robustness against unexpected input. Note: This pattern is consistent across all other API methods in the codebase (e.g., user.rs, project.rs, team.rs, wiki.rs), so any change should apply codebase-wide rather than to these methods alone.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/api/git.rs` around lines 52 - 69, The get methods on BacklogClient
(get_git_repositories and get_git_repository) currently interpolate
project_id_or_key and repo_id_or_name directly into the request path; update
both methods to URL-encode those path parameters before formatting the path
(e.g., encode project_id_or_key and repo_id_or_name with a safe URL-encoding
helper) and use the encoded values in the format! call; apply the same change
consistently to other API methods that build paths from identifiers (e.g.,
functions in user.rs, project.rs, team.rs, wiki.rs) so all path parameters are
defensively URL-encoded before calling self.get.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/api/git.rs`:
- Around line 52-69: The get methods on BacklogClient (get_git_repositories and
get_git_repository) currently interpolate project_id_or_key and repo_id_or_name
directly into the request path; update both methods to URL-encode those path
parameters before formatting the path (e.g., encode project_id_or_key and
repo_id_or_name with a safe URL-encoding helper) and use the encoded values in
the format! call; apply the same change consistently to other API methods that
build paths from identifiers (e.g., functions in user.rs, project.rs, team.rs,
wiki.rs) so all path parameters are defensively URL-encoded before calling
self.get.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d6b0dbca-aeb3-491c-a2e2-1891c934d11b

📥 Commits

Reviewing files that changed from the base of the PR and between c34c73d and bcf9acd.

📒 Files selected for processing (1)
  • src/api/git.rs

@23prime 23prime merged commit 27a3154 into main Mar 22, 2026
8 checks passed
@23prime 23prime deleted the feature/50-git-repo-list-show branch March 22, 2026 00:27
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.

feat: bl git repo list / show

2 participants