Skip to content

feat: bl project version add / update / delete#83

Merged
23prime merged 1 commit intomainfrom
feature/41-project-version-add-update-delete
Mar 20, 2026
Merged

feat: bl project version add / update / delete#83
23prime merged 1 commit intomainfrom
feature/41-project-version-add-update-delete

Conversation

@23prime
Copy link
Copy Markdown
Owner

@23prime 23prime commented Mar 20, 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 project version add, update, delete subcommands
  • Implement add_project_version, update_project_version, delete_project_version in BacklogClient and BacklogApi trait

Reason for change

Implements #41.

Changes

  • src/api/project.rs: Add add_project_version, update_project_version, delete_project_version
  • src/api/mod.rs: Declare trait methods and delegate to BacklogClient
  • src/cmd/project/version.rs: Add add_with, update_with, delete_with with tests
  • src/main.rs: Wire up new subcommands via clap
  • website/docs/commands.md, website/i18n/ja/.../commands.md: Add docs and mark as implemented

Notes

Closes #41

Copilot AI review requested due to automatic review settings March 20, 2026 06:42
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

This PR adds three new project version management commands (add, update, delete) to the CLI tool. It extends the BacklogApi trait with corresponding methods, implements them in BacklogClient via HTTP requests, adds CLI command handlers with argument types, and updates documentation in both English and Japanese.

Changes

Cohort / File(s) Summary
API Trait & Client Implementation
src/api/mod.rs, src/api/project.rs
Extended BacklogApi trait with add_project_version, update_project_version, and delete_project_version methods; implemented them in BacklogClient to issue POST/PATCH/DELETE requests to /projects/{key}/versions endpoints with form-encoded parameters and JSON deserialization.
CLI Command Handlers & Dispatch
src/cmd/project/version.rs, src/main.rs
Added ProjectVersionAddArgs, ProjectVersionUpdateArgs, and ProjectVersionDeleteArgs structs; implemented paired handler functions (add/add_with, update/update_with, delete/delete_with) that call corresponding API methods and format output as JSON or text rows; updated CLI enum to include Add, Update, Delete subcommands with argument parsing and routing.
Documentation
website/docs/commands.md, website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md
Added English and Japanese documentation for new bl project version add/update/delete commands, including usage examples, supported flags, and sample outputs; updated command coverage table to reflect "✅ Implemented" status.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 With versions now added, updated, and gone,
The project commands march ever on.
Three operations hop into place,
A CLI feature bringing grace!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.09% 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 pull request title 'feat: bl project version add / update / delete' clearly and concisely summarizes the main changes: adding three new CLI subcommands for managing project versions.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #41: adds CLI subcommands for add/update/delete project versions, implements corresponding BacklogClient and BacklogApi methods, and integrates them into the CLI with documentation.
Out of Scope Changes check ✅ Passed All code changes are directly related to implementing issue #41's requirements: API trait extensions, client implementations, CLI command wiring, and documentation updates for the three project version operations.
Description check ✅ Passed The pull request description clearly describes the implementation of project version add/update/delete CLI subcommands and corresponding API methods, with specific file changes and rationale referencing issue #41.

✏️ 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/41-project-version-add-update-delete
📝 Coding Plan
  • Generate coding plan for human review comments

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
Copy Markdown

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 full CRUD support for Backlog project versions (milestones) to the bl CLI, including API client support, clap wiring, tests, and command documentation updates to reflect the newly implemented subcommands (Issue #41).

Changes:

  • Introduce bl project version add|update|delete subcommands and wire them in src/main.rs.
  • Implement add_project_version, update_project_version, delete_project_version in BacklogClient and expose them via the BacklogApi trait.
  • Document the new commands and mark them as implemented in both English and Japanese command docs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/api/project.rs Adds BacklogClient methods for adding/updating/deleting project versions via form/patch/delete requests.
src/api/mod.rs Extends BacklogApi trait + delegates new methods in BacklogClient impl.
src/cmd/project/version.rs Adds args structs and add/update/delete command handlers with unit tests.
src/main.rs Wires new clap subcommands to the corresponding command handlers.
website/docs/commands.md Documents new commands and updates the endpoint/command mapping table to “Implemented”.
website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md Japanese docs for new commands + mapping table updates.

@23prime
Copy link
Copy Markdown
Owner Author

23prime commented Mar 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@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/project/version.rs (1)

17-95: Consider enforcing date-format invariants in args construction.

start_date / release_due_date are documented as YYYY-MM-DD but currently pass through unchecked. A try_new constructor for add/update args would keep validation at the intended boundary and fail fast before API calls.

As per coding guidelines: "Validation boundaries: main.rs (clap) handles syntactic/type-level checks; Args::try_new handles domain invariants; cmd/*_with handles API call logic, output formatting, and API-spec constraints; api/ handles HTTP-level error translation only."

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

In `@src/cmd/project/version.rs` around lines 17 - 95, Add a try_new constructor
that validates the YYYY-MM-DD date invariants for ProjectVersionAddArgs and
ProjectVersionUpdateArgs: implement ProjectVersionAddArgs::try_new(...) ->
Result<Self, YourError> and ProjectVersionUpdateArgs::try_new(...) ->
Result<Self, YourError> which parse/validate optional start_date and
release_due_date (e.g., via chrono::NaiveDate::parse_from_str or equivalent) and
return Err on invalid format; keep the same fields (Option<String>) if
validation passes and return Ok(Self{...}); update call sites to use try_new
where args are constructed so domain invariants are enforced before API calls.
src/api/project.rs (1)

293-367: Add API-layer tests for the new project version mutation methods.

add_project_version, update_project_version, and delete_project_version were added, but this file doesn’t add corresponding httpmock tests for request path/form payloads and response parsing. Please add parity tests like the other project API methods.

🧪 Suggested test additions (pattern)
+    #[test]
+    fn add_project_version_returns_parsed_struct() {
+        let server = MockServer::start();
+        server.mock(|when, then| {
+            when.method(POST).path("/projects/TEST/versions");
+            then.status(201).json_body(json!({
+                "id": 5, "projectId": 1, "name": "v1.0",
+                "description": null, "startDate": null, "releaseDueDate": null,
+                "archived": false, "displayOrder": 0
+            }));
+        });
+        let client = BacklogClient::new_with(&server.base_url(), "test-key").unwrap();
+        let v = client.add_project_version("TEST", "v1.0", None, None, None).unwrap();
+        assert_eq!(v.id, 5);
+    }
+
+    #[test]
+    fn update_project_version_returns_parsed_struct() { /* same pattern for PATCH */ }
+
+    #[test]
+    fn delete_project_version_returns_parsed_struct() { /* same pattern for DELETE */ }
As per coding guidelines: "For `api/` layer tests, use `httpmock` to spin up a local HTTP server and construct `BacklogClient::new_with(base_url, api_key)` instead of calling `BacklogClient::from_config()`."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/api/project.rs` around lines 293 - 367, Add httpmock-based API tests that
exercise add_project_version, update_project_version, and
delete_project_version: spin up an httpmock server, construct
BacklogClient::new_with(base_url, api_key), register mock endpoints for POST
/projects/{key}/versions, PATCH /projects/{key}/versions/{version_id}, and
DELETE /projects/{key}/versions/{version_id}, assert incoming request paths and
form payloads (name, description, startDate, releaseDueDate, archived as
applicable), return representative JSON responses, and verify serde parsing by
asserting the returned ProjectVersion values; follow the same test pattern used
by the other project API tests and use httpmock for server lifecycle.
🤖 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/project.rs`:
- Around line 293-367: Add httpmock-based API tests that exercise
add_project_version, update_project_version, and delete_project_version: spin up
an httpmock server, construct BacklogClient::new_with(base_url, api_key),
register mock endpoints for POST /projects/{key}/versions, PATCH
/projects/{key}/versions/{version_id}, and DELETE
/projects/{key}/versions/{version_id}, assert incoming request paths and form
payloads (name, description, startDate, releaseDueDate, archived as applicable),
return representative JSON responses, and verify serde parsing by asserting the
returned ProjectVersion values; follow the same test pattern used by the other
project API tests and use httpmock for server lifecycle.

In `@src/cmd/project/version.rs`:
- Around line 17-95: Add a try_new constructor that validates the YYYY-MM-DD
date invariants for ProjectVersionAddArgs and ProjectVersionUpdateArgs:
implement ProjectVersionAddArgs::try_new(...) -> Result<Self, YourError> and
ProjectVersionUpdateArgs::try_new(...) -> Result<Self, YourError> which
parse/validate optional start_date and release_due_date (e.g., via
chrono::NaiveDate::parse_from_str or equivalent) and return Err on invalid
format; keep the same fields (Option<String>) if validation passes and return
Ok(Self{...}); update call sites to use try_new where args are constructed so
domain invariants are enforced before API calls.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 28d7c344-f6ed-4b2c-b85d-a3dacadadac1

📥 Commits

Reviewing files that changed from the base of the PR and between 5350dd8 and f9cd7e4.

📒 Files selected for processing (6)
  • src/api/mod.rs
  • src/api/project.rs
  • src/cmd/project/version.rs
  • src/main.rs
  • website/docs/commands.md
  • website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md

@23prime 23prime merged commit 9f841c5 into main Mar 20, 2026
16 checks passed
@23prime 23prime deleted the feature/41-project-version-add-update-delete branch March 20, 2026 07:53
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 project version add / update / delete

2 participants