Skip to content

Add attach-file sub-command for Jira file attachments#13

Merged
alexec merged 3 commits intomainfrom
copilot/add-attach-file-command
Nov 4, 2025
Merged

Add attach-file sub-command for Jira file attachments#13
alexec merged 3 commits intomainfrom
copilot/add-attach-file-command

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

Adds capability to attach files to Jira issues via both CLI and MCP server.

Changes

  • CLI: New attach-file <issue-key> <file-path> sub-command
  • MCP Server: New attach_file tool with issue_key and file_path parameters
  • Uses IssueService.PostAttachmentWithContext() from go-jira library
  • Cross-platform path handling via filepath.Base()

Usage

# CLI
jira attach-file PROJ-123 /path/to/document.pdf

# MCP (via AI assistant)
"Attach /tmp/logs.txt to issue PROJ-123"

Implementation Notes

  • Returns attachment ID on successful upload
  • Validates file existence before API call
  • Consistent error handling between CLI and MCP interfaces
Original prompt

Add a sub-command to attach a file to a Jira ticket.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 4, 2025 20:42
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sub-command to attach file to Jira ticket Add attach-file sub-command for Jira file attachments Nov 4, 2025
Copilot AI requested a review from alexec November 4, 2025 20:48
@alexec
Copy link
Contributor

alexec commented Nov 4, 2025

@copilot What happens if the file has already been attached?

Copy link
Contributor Author

Copilot AI commented Nov 4, 2025

@copilot What happens if the file has already been attached?

The file will be attached again as a new attachment with a unique ID. Jira's standard behavior allows duplicate filenames - each attachment is treated independently even if the filename is the same. This is by design, as the same filename might contain different content or represent different versions over time. Users can manually remove duplicate attachments from the Jira UI if needed.

@alexec alexec marked this pull request as ready for review November 4, 2025 20:54
@alexec alexec merged commit 89663c2 into main Nov 4, 2025
3 checks passed
@alexec alexec deleted the copilot/add-attach-file-command branch November 4, 2025 20:55
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