Skip to content

feat: add bl issue attachment delete, participant list, and shared-file commands#65

Merged
23prime merged 3 commits intomainfrom
feature/issue-attachment-participant
Mar 15, 2026
Merged

feat: add bl issue attachment delete, participant list, and shared-file commands#65
23prime merged 3 commits intomainfrom
feature/issue-attachment-participant

Conversation

@23prime
Copy link
Owner

@23prime 23prime commented Mar 15, 2026

Checklist

  • Target branch is main
  • Status checks are passing

Summary

  • bl issue attachment delete <key> <attachment-id> — DELETE attachment
  • bl issue participant list <key> — list issue participants (bot-safe: falls back to numeric ID when userId is null)
  • bl issue shared-file list <key> — list linked shared files
  • bl issue shared-file link <key> --shared-file-id <id> — link shared files (try_new validates non-empty list)
  • bl issue shared-file unlink <key> <shared-file-id> — unlink a shared file

Reason for change

Implements missing issue attachment/participant/shared-file endpoints (closes #60 area).

Changes

  • src/api/issue.rs: add IssueParticipant, IssueSharedFile structs + 5 new BacklogClient methods + httpmock tests
  • src/api/mod.rs: add 5 trait methods with default unimplemented!() + BacklogApi for BacklogClient delegates
  • src/cmd/issue/attachment/delete.rs: new
  • src/cmd/issue/participant/: new list subcommand
  • src/cmd/issue/shared_file/: new list, link, unlink subcommands
  • src/main.rs: clap wiring
  • docs: command reference and coverage table updated (EN + JA)

Notes

Reimplementation from scratch on current main (previous draft PR #60 had widespread conflicts due to BacklogApi default impl refactor in #63).

…le commands

- bl issue attachment delete <key> <id> — DELETE /api/v2/issues/{key}/attachments/{id}
- bl issue participant list <key> — GET /api/v2/issues/{key}/participants
- bl issue shared-file list <key> — GET /api/v2/issues/{key}/sharedFiles
- bl issue shared-file link <key> --shared-file-id <id> — POST (try_new validates non-empty)
- bl issue shared-file unlink <key> <id> — DELETE /api/v2/issues/{key}/sharedFiles/{id}
Copilot AI review requested due to automatic review settings March 15, 2026 12:37
@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2026

📝 Walkthrough

Walkthrough

This PR introduces five new issue-related CLI commands for managing attachments, participants, and shared files. It adds IssueParticipant and IssueSharedFile data structures to the API layer, extends the BacklogApi trait with five new methods (delete_issue_attachment, get_issue_participants, get_issue_shared_files, link_issue_shared_files, unlink_issue_shared_file), implements corresponding CLI commands with argument structures and output formatting, and updates documentation to reflect the newly implemented functionality.

Changes

Cohort / File(s) Summary
API Layer
src/api/issue.rs, src/api/mod.rs
Added IssueParticipant and IssueSharedFile structs with serde camelCase naming. Extended BacklogApi trait with five new methods for attachment deletion, participant retrieval, and shared file operations. Implemented corresponding methods in BacklogClient. Updated public imports to expose new types.
Attachment Deletion Command
src/cmd/issue/attachment/delete.rs, src/cmd/issue/attachment/mod.rs
Introduced IssueAttachmentDeleteArgs struct and delete function to handle attachment removal. Supports both JSON and human-readable output. Includes test coverage for success and error paths.
Participant Listing Command
src/cmd/issue/participant/list.rs, src/cmd/issue/participant/mod.rs
Added IssueParticipantListArgs struct and list function to fetch and display issue participants. Falls back to numeric ID when user_id is unavailable. Provides JSON and formatted text output with test validation.
Shared File Management Commands
src/cmd/issue/shared_file/list.rs, src/cmd/issue/shared_file/link.rs, src/cmd/issue/shared_file/unlink.rs, src/cmd/issue/shared_file/mod.rs, src/cmd/issue/mod.rs
Implemented three subcommands for managing shared files: list displays linked files, link associates files to an issue with validation for at least one file ID, unlink removes a file association. Each includes argument structures, dual output modes, and comprehensive tests.
CLI Wiring and Dispatch
src/main.rs
Added enum variants for IssueParticipantCommands and IssueSharedFileCommands, extended IssueAttachmentCommands with Delete variant. Routed commands to respective handler functions. Added imports for all new argument types.
Documentation
website/docs/commands.md, website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md
Updated command reference with usage examples and status table entries for five newly implemented commands: bl issue attachment delete, bl issue participant list, bl issue shared-file {list,link,unlink}. Marked endpoints as implemented in both English and Japanese documentation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Possibly related PRs

Poem

🐰 Five new commands hop and play,
Participants and files on display!
Delete, list, link with care,
Backlog API's shared everywhere! 📎

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 32.47% 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 clearly and concisely summarizes the main changes: adding attachment delete, participant list, and shared-file commands for issues.
Linked Issues check ✅ Passed The PR fully implements all coding objectives from issue #60: new data structures (IssueParticipant, IssueSharedFile), five API methods, CLI commands (attachment delete, participant list, shared-file list/link/unlink), and tests.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the linked issue objectives; documentation updates and new modules are expected components of feature implementation.
Description check ✅ Passed The pull request description accurately describes the five new CLI commands and their implementation across API, command modules, and documentation.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/issue-attachment-participant
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature/issue-attachment-participant
📝 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

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

This PR adds new bl issue subcommands for deleting issue attachments, listing issue participants, and managing shared files linked to issues, including the necessary Backlog API client endpoints and documentation updates (EN + JA).

Changes:

  • Add CLI subcommands: bl issue attachment delete, bl issue participant list, and bl issue shared-file {list,link,unlink}.
  • Extend the API layer with participant/shared-file models and new endpoints (delete attachment, list participants, list/link/unlink shared files).
  • Update the commands documentation and endpoint mapping tables in both English and Japanese docs.

Reviewed changes

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

Show a summary per file
File Description
website/docs/commands.md Documents new commands and marks their API mappings as implemented.
website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md Japanese docs equivalent updates for the new commands and mapping table.
src/main.rs Registers new clap subcommands and wires them to cmd handlers.
src/cmd/issue/mod.rs Exposes new participant and shared_file modules under cmd::issue.
src/cmd/issue/attachment/mod.rs Adds delete submodule and re-exports its args/handler.
src/cmd/issue/attachment/delete.rs Implements attachment deletion command + unit tests via BacklogApi mock.
src/cmd/issue/participant/mod.rs Module wiring and re-exports for participant commands.
src/cmd/issue/participant/list.rs Implements participant listing command + tests.
src/cmd/issue/shared_file/mod.rs Module wiring and re-exports for shared-file commands.
src/cmd/issue/shared_file/list.rs Implements shared-file listing command + tests (includes shared test helper).
src/cmd/issue/shared_file/link.rs Implements shared-file link command with validation + tests.
src/cmd/issue/shared_file/unlink.rs Implements shared-file unlink command + tests.
src/api/mod.rs Extends BacklogApi trait and client impl with new issue attachment/participant/shared-file methods.
src/api/issue.rs Adds IssueParticipant/IssueSharedFile models, client endpoints, and httpmock-based API tests.

You can also share your feedback on Copilot code review. Take the survey.

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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/cmd/issue/participant/list.rs (1)

113-118: Assert the numeric-id fallback instead of only success.

list_with_bot_falls_back_to_numeric_id currently only checks is_ok(), so a regression in the [99] Bot rendering would still pass. Please capture the output, or extract the formatter into a helper and assert the fallback string.

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

In `@src/cmd/issue/participant/list.rs` around lines 113 - 118, Update the test
list_with_bot_falls_back_to_numeric_id to assert the actual fallback output
rather than only checking is_ok(): call list_with(...) and capture its Result
output (or stdout string) and assert that the rendered participant string
contains the numeric-id fallback (e.g. "[99] Bot" or the numeric id produced by
bot_participant()). Alternatively, extract the formatting logic used by
list_with into a helper formatter function (the code path that formats
Participant entries) and call that helper directly with bot_participant(), then
assert the returned string equals the expected numeric-id fallback. Ensure you
reference the existing functions list_with, bot_participant, and args(false)
when locating the test and the formatter helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/api/issue.rs`:
- Around line 248-252: The form parameter name is wrong when linking shared
files: change the params created from mapping shared_file_ids (in the block that
builds Vec<(String,String)> and calls
self.post_form(&format!("/issues/{}/sharedFiles", key), &params) ) to use
"fileId[]" as the key instead of "sharedFileId[]", so the request matches the
Backlog API contract; leave the rest (post_form call and URL) unchanged.

In `@website/docs/commands.md`:
- Line 911: Update the command signature line that currently reads "bl issue
shared-file unlink <id-or-key> <id>" to use a clearer parameter name: change the
second parameter to "<shared-file-id>" so it reads "bl issue shared-file unlink
<id-or-key> <shared-file-id>"; this replaces the ambiguous "<id>" in the command
signature (the line containing "bl issue shared-file unlink <id-or-key> <id>" in
the docs) to improve consistency and clarity.

In `@website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md`:
- Line 915: Update the command example string `bl issue shared-file unlink
<id-or-key> <id>` to use the clearer parameter name `bl issue shared-file unlink
<id-or-key> <shared-file-id>` so it matches other command lines and the CLI
intent; edit the literal table cell text containing that command (the row with
`DELETE /api/v2/issues/{issueIdOrKey}/sharedFiles/{id}`) and verify any other
occurrences of `<id>` in the "shared-file" command rows are renamed to
`<shared-file-id>` for consistency.

---

Nitpick comments:
In `@src/cmd/issue/participant/list.rs`:
- Around line 113-118: Update the test list_with_bot_falls_back_to_numeric_id to
assert the actual fallback output rather than only checking is_ok(): call
list_with(...) and capture its Result output (or stdout string) and assert that
the rendered participant string contains the numeric-id fallback (e.g. "[99]
Bot" or the numeric id produced by bot_participant()). Alternatively, extract
the formatting logic used by list_with into a helper formatter function (the
code path that formats Participant entries) and call that helper directly with
bot_participant(), then assert the returned string equals the expected
numeric-id fallback. Ensure you reference the existing functions list_with,
bot_participant, and args(false) when locating the test and the formatter
helper.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 55e3bfb6-dd9c-4e5e-999c-49e068ea40ea

📥 Commits

Reviewing files that changed from the base of the PR and between 7c0f1e2 and 57a18f2.

📒 Files selected for processing (14)
  • src/api/issue.rs
  • src/api/mod.rs
  • src/cmd/issue/attachment/delete.rs
  • src/cmd/issue/attachment/mod.rs
  • src/cmd/issue/mod.rs
  • src/cmd/issue/participant/list.rs
  • src/cmd/issue/participant/mod.rs
  • src/cmd/issue/shared_file/link.rs
  • src/cmd/issue/shared_file/list.rs
  • src/cmd/issue/shared_file/mod.rs
  • src/cmd/issue/shared_file/unlink.rs
  • src/main.rs
  • website/docs/commands.md
  • website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md

@23prime 23prime merged commit d2d2c9d into main Mar 15, 2026
10 checks passed
@23prime 23prime deleted the feature/issue-attachment-participant branch March 15, 2026 12:57
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.

2 participants