feat: bl priority list + bl resolution list#75
Conversation
📝 WalkthroughWalkthroughThis pull request introduces two new CLI commands— Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI as CLI (main.rs)
participant Cmd as Command Handler<br/>(cmd/priority/list)
participant API as BacklogApi<br/>(BacklogClient)
participant Backlog as Backlog Server
User->>CLI: bl priority list [--json]
CLI->>Cmd: list(PriorityListArgs)
Cmd->>API: get_priorities()
API->>Backlog: GET /api/v2/priorities
Backlog-->>API: [Priority {...}, ...]
API-->>Cmd: Vec<Priority>
alt json flag set
Cmd->>Cmd: serde_json::to_string_pretty()
Cmd-->>User: JSON output
else text output
Cmd->>Cmd: format "[id] name" per entry
Cmd-->>User: Text output
end
sequenceDiagram
participant User
participant CLI as CLI (main.rs)
participant Cmd as Command Handler<br/>(cmd/resolution/list)
participant API as BacklogApi<br/>(BacklogClient)
participant Backlog as Backlog Server
User->>CLI: bl resolution list [--json]
CLI->>Cmd: list(ResolutionListArgs)
Cmd->>API: get_resolutions()
API->>Backlog: GET /api/v2/resolutions
Backlog-->>API: [Resolution {...}, ...]
API-->>Cmd: Vec<Resolution>
alt json flag set
Cmd->>Cmd: serde_json::to_string_pretty()
Cmd-->>User: JSON output
else text output
Cmd->>Cmd: format "[id] name" per entry
Cmd-->>User: Text output
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 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
🧪 Generate unit tests (beta)
✨ Simplify code
📝 Coding Plan
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
This PR adds two new space-global reference-list commands to the Backlog CLI (bl): bl priority list and bl resolution list, backed by new API client methods and documented in the command reference/coverage tables.
Changes:
- Added API support for listing priorities and resolutions (
GET /api/v2/priorities,GET /api/v2/resolutions) with httpmock tests. - Added CLI commands
bl priority listandbl resolution list, including--jsonsupport and MockApi-based tests. - Updated English/Japanese command documentation and marked both commands as implemented in the coverage tables.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/api/priority.rs |
Adds Priority model + BacklogClient::get_priorities() + httpmock test. |
src/api/resolution.rs |
Adds Resolution model + BacklogClient::get_resolutions() + httpmock test. |
src/api/mod.rs |
Registers new modules, adds BacklogApi trait methods, and delegates for BacklogClient. |
src/cmd/priority/mod.rs |
Adds priority command module and re-exports. |
src/cmd/priority/list.rs |
Implements bl priority list with --json and unit tests via MockApi. |
src/cmd/resolution/mod.rs |
Adds resolution command module and re-exports. |
src/cmd/resolution/list.rs |
Implements bl resolution list with --json and unit tests via MockApi. |
src/cmd/mod.rs |
Exposes new priority and resolution command modules. |
src/main.rs |
Wires new clap subcommands and dispatch to command handlers. |
website/docs/commands.md |
Documents new commands and updates coverage status to ✅ Implemented. |
website/i18n/ja/.../commands.md |
Japanese documentation + coverage status update to ✅ 実装済み. |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/cmd/resolution/list.rs (1)
75-89: Add assertions for emitted output, not just success.These tests currently verify only
is_ok(). Please add checks for actual text/JSON output shape so formatting regressions are caught.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cmd/resolution/list.rs` around lines 75 - 89, Update the two tests list_with_text_output_succeeds and list_with_json_output_succeeds to assert the actual emitted output instead of just is_ok(): invoke list_with(&args(...), &api) while capturing its stdout (use a capture helper or assert_cmd/gag to capture printed output), then for the text test assert the output string contains expected human-readable pieces from sample_resolutions() (e.g., resolution titles or IDs), and for the JSON test parse the captured output with serde_json into a Vec or struct and assert length and that key fields (id/title/status) match sample_resolutions(); keep MockApi, sample_resolutions, list_with and args as the references to locate the code to change.
🤖 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/resolution/list.rs`:
- Around line 75-89: Update the two tests list_with_text_output_succeeds and
list_with_json_output_succeeds to assert the actual emitted output instead of
just is_ok(): invoke list_with(&args(...), &api) while capturing its stdout (use
a capture helper or assert_cmd/gag to capture printed output), then for the text
test assert the output string contains expected human-readable pieces from
sample_resolutions() (e.g., resolution titles or IDs), and for the JSON test
parse the captured output with serde_json into a Vec or struct and assert length
and that key fields (id/title/status) match sample_resolutions(); keep MockApi,
sample_resolutions, list_with and args as the references to locate the code to
change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d970eace-9ef8-4ef6-ab76-f540d967b05b
📒 Files selected for processing (11)
src/api/mod.rssrc/api/priority.rssrc/api/resolution.rssrc/cmd/mod.rssrc/cmd/priority/list.rssrc/cmd/priority/mod.rssrc/cmd/resolution/list.rssrc/cmd/resolution/mod.rssrc/main.rswebsite/docs/commands.mdwebsite/i18n/ja/docusaurus-plugin-content-docs/current/commands.md
Checklist
mainwebsite/docs/,website/i18n/ja/,README.md)Summary
bl priority list—GET /api/v2/prioritiesbl resolution list—GET /api/v2/resolutionsReason for change
Implements Issue #43. These two space-global reference lists were Planned in the coverage table.
Changes
src/api/priority.rsPrioritystruct +get_prioritiesmethod + httpmock testsrc/api/resolution.rsResolutionstruct +get_resolutionsmethod + httpmock testsrc/api/mod.rsBacklogApi for BacklogClientdelegationssrc/cmd/priority/list.rsPriorityListArgs,list_with, MockApi testssrc/cmd/resolution/list.rsResolutionListArgs,list_with, MockApi testssrc/main.rsPriorityCommands,ResolutionCommandsenums and match armswebsite/docs/commands.mdwebsite/i18n/ja/.../commands.mdNotes
Both commands have no parameters beyond
--json. Tested against real Backlog API — response fields confirmed asid: u64, name: String.Closes #43