From odh-ai-helpers
Validates file existence and uploads attachments to Jira tickets via the Jira REST API. Requires acli auth, JIRA_API_TOKEN, and JIRA_EMAIL.
How this skill is triggered — by the user, by Claude, or both
Slash command
/odh-ai-helpers:jira-workitem-attachThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Upload file attachments to Jira tickets using the Jira REST API (since `acli` does not support attachment uploads).
Upload file attachments to Jira tickets using the Jira REST API (since acli does not support attachment uploads).
acli must be installed and authenticated (acli jira auth) to verify the uploaduv must be installedJIRA_API_TOKEN environment variable must be set with a valid API tokenJIRA_EMAIL environment variable must be set with the email address associated with your Atlassian accountSecurity Note: The JIRA_API_TOKEN is sensitive and should be kept secure:
Before proceeding, verify that acli is installed and authenticated by invoking the acli-setup-check skill:
/acli-setup-check
If the setup check fails, stop execution and guide the user to fix the issue.
Check that the required environment variables are set:
if [[ -z "$JIRA_API_TOKEN" || -z "$JIRA_EMAIL" ]]; then
echo "Error: JIRA_API_TOKEN and JIRA_EMAIL environment variables must be set"
exit 1
fi
If either variable is missing, inform the user:
JIRA_API_TOKEN and JIRA_EMAIL environment variables are required for uploading attachments.
To set them:
export JIRA_EMAIL="[email protected]"
export JIRA_API_TOKEN="your-api-token"
Get your API token from:
https://id.atlassian.com/manage-profile/security/api-tokens
Note: The Python upload script will also validate these variables, but checking early provides better user experience.
Ticket Key:
[A-Z]+-\d+File Path:
Validate File Path Security:
Before proceeding to Step 4, validate the FILE_PATH for security:
# Resolve to absolute path and check it exists
FILE_PATH="<user-provided-path>"
REAL_PATH=$(realpath -e "$FILE_PATH" 2>/dev/null)
if [[ $? -ne 0 ]]; then
echo "Error: File does not exist or is not accessible: $FILE_PATH"
exit 1
fi
# Check if file is readable
if [[ ! -r "$REAL_PATH" ]]; then
echo "Error: File is not readable: $FILE_PATH"
exit 1
fi
# Reject parent-traversal patterns in original path
if [[ "$FILE_PATH" == *".."* ]]; then
echo "Error: Parent directory traversal (..) not allowed in file path"
exit 1
fi
# Restrict to allowed directories: current working directory or /tmp
CURRENT_DIR=$(pwd)
if [[ "$REAL_PATH" != "$CURRENT_DIR"/* ]] && [[ "$REAL_PATH" != /tmp/* ]]; then
echo "Error: File must be in current directory or /tmp for security"
echo " File location: $REAL_PATH"
echo " Allowed: $CURRENT_DIR/* or /tmp/*"
exit 1
fi
# Check for symlinks pointing outside allowed directories
if [[ -L "$FILE_PATH" ]]; then
echo "Error: Symlinks not allowed for security reasons"
exit 1
fi
If any validation fails, surface the error to the user and abort before calling upload_attachment.py.
Since acli does not support attachment uploads, use the upload
script located at scripts/upload_attachment.py relative to the
jira-workitem-attach skill directory.
Resolve the skill directory path and execute the script directly (not via python or
bash) to invoke uv via the shebang:
# Resolve skill directory path (adjust based on runtime context)
# Option 1: If skill directory is known via environment or context
SKILL_DIR="<path-to-helpers>/helpers/skills/jira-workitem-attach"
# Option 2: Compute relative to repository root if available
# SKILL_DIR="${REPO_ROOT}/helpers/skills/jira-workitem-attach"
# Option 3: Use current directory if already in skill directory
# SKILL_DIR="$(pwd)"
# Execute the upload script with resolved path
"$SKILL_DIR/scripts/upload_attachment.py" "$TICKET_KEY" "$FILE_PATH"
Note: The skill directory path resolution method depends on how the runtime provides context. Use whichever approach is available (environment variables, repository-root relative paths, or explicit path configuration).
The script will:
After the upload script completes, verify the attachment was successfully added using acli:
acli jira workitem attachment list --key <TICKET-KEY>
This command will display all attachments on the ticket, including the newly uploaded file. Confirm the file appears in the list with the correct name and size.
After successfully uploading and verifying the attachment, report to the user:
✓ Attachment uploaded to <TICKET-KEY>
File: <filename> (<size>)
View: https://redhat.atlassian.net/browse/<TICKET-KEY>
If the attachment doesn't appear in the list, report the issue and check the upload script output for errors
acli-setup-check skillacli-setup-check skillacli does not support uploading attachments, so this skill uses the Jira REST API directlyUser: Attach error.log to AIPCC-1234
Assistant: [Verifies file exists, uploads via API]
Attachment uploaded to AIPCC-1234
File: error.log (15.2 KB)
View: https://redhat.atlassian.net/browse/AIPCC-1234
User: Attach the conversation log to AIPCC-5678
Assistant: [Exports conversation, uploads to ticket]
Attachment uploaded to AIPCC-5678
File: conversation-2024-03-20.md (42.1 KB)
View: https://redhat.atlassian.net/browse/AIPCC-5678
User: Attach large-dataset.csv to AIPCC-910
Assistant: Warning: large-dataset.csv is 15.3 MB, which exceeds the typical 10MB Jira limit.
The upload may fail. Would you like to proceed anyway?
User: Yes
Assistant: [Attempts upload]
✗ Upload failed: Request Entity Too Large (413)
Consider compressing the file or using a file sharing service instead.
User: Attach screenshot.png to AIPCC-1234
Assistant: [Uploads file]
Attachment uploaded to AIPCC-1234
File: screenshot.png (234 KB)
Current attachments on AIPCC-1234:
- screenshot.png (234 KB) - uploaded just now
- error.log (15.2 KB) - uploaded 2024-03-19
- build.log (8.1 KB) - uploaded 2024-03-18
npx claudepluginhub opendatahub-io/ai-helpersUploads local files as attachments to a Jira issue via POST /rest/api/3/issue/{key}/attachments. Shows a preview with file sizes and requires explicit confirmation before sending.
Uploads local files as attachments to Jira issues using jirac CLI. Extracts issue key (e.g., PROJ-123) and file path from requests, verifies file, runs jirac issue attach, and confirms result.
Exports the current chat conversation as a markdown file and uploads it as an attachment to a JIRA ticket for review and documentation.