Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds star management: new BacklogApi trait methods Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (bl star add)
participant Cmd as cmd::star::add
participant API as BacklogApi (trait)
participant Client as BacklogClient
participant Server as Backlog HTTP API
CLI->>Cmd: parse args -> StarAddArgs
Cmd->>API: add_with(params)
API-->>Client: BacklogClient impl invoked
Client->>Server: POST /api/v2/stars (form params)
Server-->>Client: 204 No Content
Client-->>API: Ok(())
API-->>Cmd: Ok(())
Cmd-->>CLI: exit success
sequenceDiagram
participant CLI as CLI (bl star delete)
participant Cmd as cmd::star::delete
participant API as BacklogApi (trait)
participant Client as BacklogClient
participant Server as Backlog HTTP API
CLI->>Cmd: parse args -> StarDeleteArgs
Cmd->>API: delete_with(star_id)
API-->>Client: BacklogClient impl invoked
Client->>Server: DELETE /api/v2/stars/{star_id}
Server-->>Client: 204 No Content
Client-->>API: Ok(())
API-->>Cmd: Ok(())
Cmd-->>CLI: exit success
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
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. Comment |
There was a problem hiding this comment.
Pull request overview
Adds CLI support for managing Backlog “stars” by wiring new bl star add / bl star delete commands through the command layer, API trait/client, and user-facing documentation.
Changes:
- Add new
starcommand module withadd(POST/api/v2/stars) anddelete(DELETE/api/v2/stars/{starId}) handlers and validation. - Extend
BacklogApi+BacklogClientwithadd_star/delete_starAPI methods. - Document the new commands (EN + JA) and mark them as implemented in the command coverage tables.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md | Adds JA docs for bl star add/delete and updates coverage status. |
| website/docs/commands.md | Adds EN docs for bl star add/delete and updates coverage status. |
| src/main.rs | Registers the new Star top-level command and subcommands; wires args into handlers. |
| src/cmd/star/mod.rs | Introduces cmd::star module exports for add/delete. |
| src/cmd/star/add.rs | Implements bl star add validation (exactly one target) and request param construction + tests. |
| src/cmd/star/delete.rs | Implements bl star delete + tests. |
| src/cmd/mod.rs | Registers the new star module. |
| src/api/user.rs | Adds BacklogClient::add_star / delete_star HTTP methods. |
| src/api/mod.rs | Adds add_star / delete_star to BacklogApi and forwards in BacklogClient impl. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/cmd/star/mod.rs (1)
1-5: Prefer a single consolidatedstarcommand file instead of per-subcommand files.This split (
add.rs/delete.rs) diverges from the repository’s established sub-resource command layout and will increase fragmentation over time.Based on learnings: “In the
23prime/backlog-clirepository, sub-resource command files undersrc/cmd/<resource>/… should consolidate all subcommands … into a single file per resource.”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cmd/star/mod.rs` around lines 1 - 5, Consolidate the split subcommand modules into one resource module by inlining the add.rs and delete.rs contents into this single module: remove the mod add; mod delete; declarations and copy the implementations of add, delete, StarAddArgs and StarDeleteArgs into this file, keeping the public exports (pub use add::{StarAddArgs, add}; pub use delete::{StarDeleteArgs, delete};) replaced by direct pub declarations or re-exports from the local implementations so callers still reference add, delete, StarAddArgs and StarDeleteArgs the same way; delete the now-empty add.rs and delete.rs files and ensure module-level tests/visibility are preserved.src/api/user.rs (1)
157-165: Move/starsendpoint methods to a dedicated API resource module and add endpoint tests.The wrappers work, but placing star-specific endpoints in
src/api/user.rsbreaks the API resource organization pattern and makes discovery harder. Please move these methods tosrc/api/star.rs(with module registration) and addhttpmocktests forPOST /starsandDELETE /stars/{starId}behavior.As per coding guidelines: “For new API endpoints, add response struct and
impl BacklogClientblock insrc/api/<resource>.rs, add method toBacklogApitrait insrc/api/mod.rs, and addpub mod <resource>tosrc/api/mod.rs,” and “Forapi/layer tests, usehttpmock… withBacklogClient::new_with(base_url, api_key).”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/user.rs` around lines 157 - 165, Move the star-specific methods out of src/api/user.rs into a new src/api/star.rs: create a response struct for the endpoints, add an impl BacklogClient block containing add_star(&self, params: &[(String,String)])->Result<()> and delete_star(&self, star_id: u64)->Result<()>, and remove the old methods from user.rs; then register the module by adding pub mod star; and add corresponding method signatures to the BacklogApi trait in src/api/mod.rs. Finally add httpmock tests exercising POST /stars and DELETE /stars/{starId} using BacklogClient::new_with(base_url, api_key) to assert request paths, methods and expected responses.
🤖 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/user.rs`:
- Around line 157-165: Move the star-specific methods out of src/api/user.rs
into a new src/api/star.rs: create a response struct for the endpoints, add an
impl BacklogClient block containing add_star(&self, params:
&[(String,String)])->Result<()> and delete_star(&self, star_id:
u64)->Result<()>, and remove the old methods from user.rs; then register the
module by adding pub mod star; and add corresponding method signatures to the
BacklogApi trait in src/api/mod.rs. Finally add httpmock tests exercising POST
/stars and DELETE /stars/{starId} using BacklogClient::new_with(base_url,
api_key) to assert request paths, methods and expected responses.
In `@src/cmd/star/mod.rs`:
- Around line 1-5: Consolidate the split subcommand modules into one resource
module by inlining the add.rs and delete.rs contents into this single module:
remove the mod add; mod delete; declarations and copy the implementations of
add, delete, StarAddArgs and StarDeleteArgs into this file, keeping the public
exports (pub use add::{StarAddArgs, add}; pub use delete::{StarDeleteArgs,
delete};) replaced by direct pub declarations or re-exports from the local
implementations so callers still reference add, delete, StarAddArgs and
StarDeleteArgs the same way; delete the now-empty add.rs and delete.rs files and
ensure module-level tests/visibility are preserved.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3a05f7a3-c9d8-4445-a539-2cd8914de933
📒 Files selected for processing (9)
src/api/mod.rssrc/api/user.rssrc/cmd/mod.rssrc/cmd/star/add.rssrc/cmd/star/delete.rssrc/cmd/star/mod.rssrc/main.rswebsite/docs/commands.mdwebsite/i18n/ja/docusaurus-plugin-content-docs/current/commands.md
Addresses review comment: add tests that capture params and assert correct key/value for each target
Checklist
mainwebsite/docs/,website/i18n/ja/,README.md)Summary
bl star add— POST /api/v2/stars (adds a star to an issue, comment, wiki, pull request, or pull request comment)bl star delete <id>— DELETE /api/v2/stars/{starId} (removes a star by its ID)Reason for change
Implements the star management commands requested in #51.
Changes
src/api/user.rs: addadd_staranddelete_starmethods toBacklogClientsrc/api/mod.rs: addadd_star/delete_startoBacklogApitrait andBacklogClientimplsrc/cmd/star/: new module withadd.rsanddelete.rscommand handlerssrc/cmd/mod.rs: registerstarmodulesrc/main.rs: addStarcommand withAdd/Deletesubcommands andStarCommandsenumwebsite/docs/commands.md/website/i18n/ja/.../commands.md: document new commands and mark as implemented in coverage tableNotes
Both endpoints return 204 No Content, so neither command produces output on success.
Validation:
bl star addrequires exactly one of--issue-id,--comment-id,--wiki-id,--pull-request-id,--pull-request-comment-id.Closes #51