$npx -y skills add opendatahub-io/ai-helpers --skill jira-upload-chat-logUse this skill to export and upload the current chat conversation as a markdown file attachment to a JIRA ticket for later review and documentation.
| 1 | # Upload Chat Log to JIRA |
| 2 | |
| 3 | Export and upload the current chat conversation as a markdown file attachment to a JIRA ticket for later review and documentation. |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | - The `jira-workitem-attach` skill must be installed |
| 8 | - `JIRA_API_TOKEN` environment variable must be set with a valid API token for https://redhat.atlassian.net |
| 9 | - `JIRA_EMAIL` environment variable must be set with the email address associated with your Atlassian account |
| 10 | - Appropriate JIRA permissions to add attachments to the target ticket |
| 11 | |
| 12 | ## Usage |
| 13 | |
| 14 | This skill exports the current conversation as a formatted markdown document and uploads it as an attachment to a specified JIRA ticket. |
| 15 | |
| 16 | ## Implementation |
| 17 | |
| 18 | ### Step 1: Determine the Ticket Key |
| 19 | |
| 20 | 1. If a ticket key is provided by the user, use it |
| 21 | 2. Otherwise, search the conversation history for JIRA ticket references matching the pattern `[A-Z]+-\d+` |
| 22 | 3. If no ticket is found in context, ask the user: "Which JIRA ticket should I attach this chat log to? (e.g., AIPCC-1234)" |
| 23 | |
| 24 | ### Step 2: Format the Conversation with Summary and Full Transcript |
| 25 | |
| 26 | Create a document with two main sections: Summary and Full Chat Log. Format the document as follows: |
| 27 | |
| 28 | ```markdown |
| 29 | # Chat Log Export - JIRA Ticket: [ticket-key] |
| 30 | |
| 31 | **Exported**: [current timestamp] |
| 32 | **Ticket**: https://redhat.atlassian.net/browse/[ticket-key] |
| 33 | |
| 34 | --- |
| 35 | |
| 36 | ## Summary |
| 37 | |
| 38 | [Provide a concise summary of the conversation including: |
| 39 | - Main topic/task discussed |
| 40 | - Key decisions made |
| 41 | - Files created/modified |
| 42 | - Important outcomes or next steps |
| 43 | - 3-5 paragraphs maximum] |
| 44 | |
| 45 | --- |
| 46 | |
| 47 | ## Full Chat Transcript |
| 48 | |
| 49 | [Export the complete conversation transcript in the same format as the `/export` command: |
| 50 | - All user messages and assistant responses |
| 51 | - All tool calls and their results |
| 52 | - Code blocks, thinking blocks, and system messages |
| 53 | - Timestamps and metadata |
| 54 | - The full, unabridged conversation from start to finish] |
| 55 | ``` |
| 56 | |
| 57 | The summary should be human-readable and highlight key points. The full transcript should be comprehensive for detailed review. |
| 58 | |
| 59 | ### Step 3: Save to Temporary File |
| 60 | |
| 61 | 1. Create a temporary file with a descriptive name: `chat-log-{ticket-key}-{timestamp}.md` |
| 62 | 2. Write the formatted conversation to this file |
| 63 | 3. Store in the system temporary directory (e.g., `/tmp` on Linux, `/private/tmp` on macOS, or use `mktemp` to create in the appropriate location) |
| 64 | |
| 65 | ### Step 4: Upload to JIRA |
| 66 | |
| 67 | Invoke the `jira-workitem-attach` skill to upload the file: |
| 68 | |
| 69 | ``` |
| 70 | /jira-workitem-attach <ticket-key> <file-path> |
| 71 | ``` |
| 72 | |
| 73 | The skill will: |
| 74 | - Verify environment variables (JIRA_API_TOKEN, JIRA_EMAIL) are set |
| 75 | - Verify the ticket exists and is accessible |
| 76 | - Upload the file as an attachment |
| 77 | - Display success message with attachment details |
| 78 | - Handle all error cases (authentication, permissions, file size, etc.) |
| 79 | |
| 80 | ### Step 5: Confirm and Clean Up |
| 81 | |
| 82 | 1. If upload succeeds: |
| 83 | - Inform the user: "Successfully uploaded chat log to {ticket-key}" |
| 84 | - The `jira-workitem-attach` skill will provide the direct ticket link |
| 85 | 2. If upload fails: |
| 86 | - The `jira-workitem-attach` skill will display the error and troubleshooting guidance |
| 87 | 3. Delete the temporary file after upload attempt (success or failure) |
| 88 | |
| 89 | ## Error Handling |
| 90 | |
| 91 | - **Missing jira-workitem-attach skill**: Inform user that the skill must be installed |
| 92 | - **Chat export failure**: Check conversation history is available |
| 93 | - **File creation failure**: Verify temp directory is writable |
| 94 | - **Upload errors**: Delegated to the `jira-workitem-attach` skill (handles authentication, permissions, file size, etc.) |
| 95 | |
| 96 | ## Examples |
| 97 | |
| 98 | ### Basic Usage |
| 99 | ``` |
| 100 | User: Upload this chat to AIPCC-7354 |
| 101 | Assistant: [Skill creates formatted chat log and uploads to AIPCC-7354] |
| 102 | ``` |
| 103 | |
| 104 | ### No Ticket Specified |
| 105 | ``` |
| 106 | User: Upload this conversation to JIRA |
| 107 | Assistant: Which JIRA ticket should I attach this chat log to? (e.g., AIPCC-1234) |
| 108 | User: RHEL-9876 |
| 109 | Assistant: [Skill uploads to RHEL-9876] |
| 110 | ``` |
| 111 | |
| 112 | ### Context Detection |
| 113 | ``` |
| 114 | User: We're working on AIPCC-7354. Can you upload our conversation? |
| 115 | Assistant: [Skill detects AIPCC-7354 from context and uploads automatically] |
| 116 | ``` |