@plotday/tool-jira 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/jira.d.ts +92 -0
- package/dist/jira.js +403 -0
- package/dist/jira.js.map +1 -0
- package/package.json +53 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Plot Technologies Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/jira.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type ActivityLink, type NewActivityWithNotes } from "@plotday/twister";
|
|
2
|
+
import type { Project, ProjectAuth, ProjectSyncOptions, ProjectTool } from "@plotday/twister/common/projects";
|
|
3
|
+
import { Tool, type ToolBuilder } from "@plotday/twister/tool";
|
|
4
|
+
import { Callbacks } from "@plotday/twister/tools/callbacks";
|
|
5
|
+
import { Integrations } from "@plotday/twister/tools/integrations";
|
|
6
|
+
import { Network } from "@plotday/twister/tools/network";
|
|
7
|
+
import { Plot } from "@plotday/twister/tools/plot";
|
|
8
|
+
import { Tasks } from "@plotday/twister/tools/tasks";
|
|
9
|
+
/**
|
|
10
|
+
* Jira project management tool
|
|
11
|
+
*
|
|
12
|
+
* Implements the ProjectTool interface for syncing Jira projects and issues
|
|
13
|
+
* with Plot activities.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Jira extends Tool<Jira> implements ProjectTool {
|
|
16
|
+
build(build: ToolBuilder): {
|
|
17
|
+
integrations: Promise<Integrations>;
|
|
18
|
+
network: Promise<Network>;
|
|
19
|
+
callbacks: Promise<Callbacks>;
|
|
20
|
+
tasks: Promise<Tasks>;
|
|
21
|
+
plot: Promise<Plot>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Create Jira API client with auth token
|
|
25
|
+
*/
|
|
26
|
+
private getClient;
|
|
27
|
+
/**
|
|
28
|
+
* Request Jira OAuth authorization
|
|
29
|
+
*/
|
|
30
|
+
requestAuth<TCallback extends (auth: ProjectAuth, ...args: any[]) => any>(callback: TCallback, ...extraArgs: TCallback extends (auth: any, ...rest: infer R) => any ? R : []): Promise<ActivityLink>;
|
|
31
|
+
/**
|
|
32
|
+
* Handle successful OAuth authorization
|
|
33
|
+
*/
|
|
34
|
+
private onAuthSuccess;
|
|
35
|
+
/**
|
|
36
|
+
* Get list of Jira projects
|
|
37
|
+
*/
|
|
38
|
+
getProjects(authToken: string): Promise<Project[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Start syncing issues from a Jira project
|
|
41
|
+
*/
|
|
42
|
+
startSync<TCallback extends (issue: NewActivityWithNotes, ...args: any[]) => any>(authToken: string, projectId: string, callback: TCallback, options?: ProjectSyncOptions, ...extraArgs: TCallback extends (issue: any, ...rest: infer R) => any ? R : []): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Setup Jira webhook for real-time updates
|
|
45
|
+
* Note: Webhook API varies by Jira version, so we skip for now
|
|
46
|
+
*/
|
|
47
|
+
private setupJiraWebhook;
|
|
48
|
+
/**
|
|
49
|
+
* Initialize batch sync process
|
|
50
|
+
*/
|
|
51
|
+
private startBatchSync;
|
|
52
|
+
/**
|
|
53
|
+
* Process a batch of issues
|
|
54
|
+
*/
|
|
55
|
+
private syncBatch;
|
|
56
|
+
/**
|
|
57
|
+
* Convert a Jira issue to a Plot Activity
|
|
58
|
+
*/
|
|
59
|
+
private convertIssueToActivity;
|
|
60
|
+
/**
|
|
61
|
+
* Extract plain text from Atlassian Document Format (ADF)
|
|
62
|
+
*/
|
|
63
|
+
private extractTextFromADF;
|
|
64
|
+
/**
|
|
65
|
+
* Update issue with new values
|
|
66
|
+
*
|
|
67
|
+
* @param authToken - Authorization token
|
|
68
|
+
* @param update - ActivityUpdate with changed fields
|
|
69
|
+
*/
|
|
70
|
+
updateIssue(authToken: string, update: import("@plotday/twister").ActivityUpdate): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Add a comment to a Jira issue
|
|
73
|
+
*
|
|
74
|
+
* @param authToken - Authorization token
|
|
75
|
+
* @param issueKey - Jira issue key (e.g., "PROJ-123")
|
|
76
|
+
* @param body - Comment text (converted to ADF format)
|
|
77
|
+
*/
|
|
78
|
+
addIssueComment(authToken: string, issueKey: string, body: string): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Convert plain text to Atlassian Document Format (ADF)
|
|
81
|
+
*/
|
|
82
|
+
private convertTextToADF;
|
|
83
|
+
/**
|
|
84
|
+
* Handle incoming webhook events from Jira
|
|
85
|
+
*/
|
|
86
|
+
private onWebhook;
|
|
87
|
+
/**
|
|
88
|
+
* Stop syncing a Jira project
|
|
89
|
+
*/
|
|
90
|
+
stopSync(authToken: string, projectId: string): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
export default Jira;
|
package/dist/jira.js
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { Version3Client } from "jira.js";
|
|
2
|
+
import { ActivityType, } from "@plotday/twister";
|
|
3
|
+
import { Tool } from "@plotday/twister/tool";
|
|
4
|
+
import { Callbacks } from "@plotday/twister/tools/callbacks";
|
|
5
|
+
import { AuthLevel, AuthProvider, Integrations, } from "@plotday/twister/tools/integrations";
|
|
6
|
+
import { Network } from "@plotday/twister/tools/network";
|
|
7
|
+
import { ContactAccess, Plot } from "@plotday/twister/tools/plot";
|
|
8
|
+
import { Tasks } from "@plotday/twister/tools/tasks";
|
|
9
|
+
/**
|
|
10
|
+
* Jira project management tool
|
|
11
|
+
*
|
|
12
|
+
* Implements the ProjectTool interface for syncing Jira projects and issues
|
|
13
|
+
* with Plot activities.
|
|
14
|
+
*/
|
|
15
|
+
export class Jira extends Tool {
|
|
16
|
+
build(build) {
|
|
17
|
+
return {
|
|
18
|
+
integrations: build(Integrations),
|
|
19
|
+
network: build(Network, { urls: ["https://*.atlassian.net/*"] }),
|
|
20
|
+
callbacks: build(Callbacks),
|
|
21
|
+
tasks: build(Tasks),
|
|
22
|
+
plot: build(Plot, { contact: { access: ContactAccess.Write } }),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create Jira API client with auth token
|
|
27
|
+
*/
|
|
28
|
+
async getClient(authToken) {
|
|
29
|
+
const authorization = await this.get(`authorization:${authToken}`);
|
|
30
|
+
if (!authorization) {
|
|
31
|
+
throw new Error("Authorization no longer available");
|
|
32
|
+
}
|
|
33
|
+
const token = await this.tools.integrations.get(authorization);
|
|
34
|
+
if (!token) {
|
|
35
|
+
throw new Error("Authorization no longer available");
|
|
36
|
+
}
|
|
37
|
+
// Get the cloud ID from provider metadata
|
|
38
|
+
const cloudId = token.provider?.cloud_id;
|
|
39
|
+
if (!cloudId) {
|
|
40
|
+
throw new Error("Jira cloud ID not found in authorization");
|
|
41
|
+
}
|
|
42
|
+
return new Version3Client({
|
|
43
|
+
host: `https://api.atlassian.com/ex/jira/${cloudId}`,
|
|
44
|
+
authentication: {
|
|
45
|
+
oauth2: {
|
|
46
|
+
accessToken: token.token,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Request Jira OAuth authorization
|
|
53
|
+
*/
|
|
54
|
+
async requestAuth(callback, ...extraArgs) {
|
|
55
|
+
const jiraScopes = [
|
|
56
|
+
"read:jira-work",
|
|
57
|
+
"write:jira-work",
|
|
58
|
+
"read:jira-user",
|
|
59
|
+
];
|
|
60
|
+
// Generate opaque token for authorization
|
|
61
|
+
const authToken = crypto.randomUUID();
|
|
62
|
+
const callbackToken = await this.tools.callbacks.createFromParent(callback, ...extraArgs);
|
|
63
|
+
// Request auth and return the activity link
|
|
64
|
+
return await this.tools.integrations.request({
|
|
65
|
+
provider: AuthProvider.Atlassian,
|
|
66
|
+
level: AuthLevel.User,
|
|
67
|
+
scopes: jiraScopes,
|
|
68
|
+
}, this.onAuthSuccess, authToken, callbackToken);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Handle successful OAuth authorization
|
|
72
|
+
*/
|
|
73
|
+
async onAuthSuccess(authorization, authToken, callbackToken) {
|
|
74
|
+
// Store authorization for later use
|
|
75
|
+
await this.set(`authorization:${authToken}`, authorization);
|
|
76
|
+
// Execute the callback with the auth token
|
|
77
|
+
await this.run(callbackToken, { authToken });
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get list of Jira projects
|
|
81
|
+
*/
|
|
82
|
+
async getProjects(authToken) {
|
|
83
|
+
const client = await this.getClient(authToken);
|
|
84
|
+
// Get all projects the user has access to
|
|
85
|
+
const projects = await client.projects.searchProjects({
|
|
86
|
+
maxResults: 100,
|
|
87
|
+
});
|
|
88
|
+
return (projects.values || []).map((project) => ({
|
|
89
|
+
id: project.id,
|
|
90
|
+
name: project.name,
|
|
91
|
+
description: project.description || null,
|
|
92
|
+
key: project.key,
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Start syncing issues from a Jira project
|
|
97
|
+
*/
|
|
98
|
+
async startSync(authToken, projectId, callback, options, ...extraArgs) {
|
|
99
|
+
// Setup webhook for real-time updates
|
|
100
|
+
await this.setupJiraWebhook(authToken, projectId);
|
|
101
|
+
// Store callback for webhook processing
|
|
102
|
+
const callbackToken = await this.tools.callbacks.createFromParent(callback, ...extraArgs);
|
|
103
|
+
await this.set(`callback_${projectId}`, callbackToken);
|
|
104
|
+
// Start initial batch sync
|
|
105
|
+
await this.startBatchSync(authToken, projectId, options);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Setup Jira webhook for real-time updates
|
|
109
|
+
* Note: Webhook API varies by Jira version, so we skip for now
|
|
110
|
+
*/
|
|
111
|
+
async setupJiraWebhook(authToken, projectId) {
|
|
112
|
+
// TODO: Implement Jira webhooks once we confirm the correct API
|
|
113
|
+
// The jira.js library webhook API may vary by Jira version
|
|
114
|
+
console.log(`Jira webhooks not yet implemented for project ${projectId}`);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Initialize batch sync process
|
|
118
|
+
*/
|
|
119
|
+
async startBatchSync(authToken, projectId, options) {
|
|
120
|
+
// Initialize sync state
|
|
121
|
+
await this.set(`sync_state_${projectId}`, {
|
|
122
|
+
startAt: 0,
|
|
123
|
+
batchNumber: 1,
|
|
124
|
+
issuesProcessed: 0,
|
|
125
|
+
initialSync: true,
|
|
126
|
+
});
|
|
127
|
+
// Queue first batch
|
|
128
|
+
const batchCallback = await this.callback(this.syncBatch, authToken, projectId, options);
|
|
129
|
+
await this.tools.tasks.runTask(batchCallback);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Process a batch of issues
|
|
133
|
+
*/
|
|
134
|
+
async syncBatch(authToken, projectId, options) {
|
|
135
|
+
const state = await this.get(`sync_state_${projectId}`);
|
|
136
|
+
if (!state) {
|
|
137
|
+
throw new Error(`Sync state not found for project ${projectId}`);
|
|
138
|
+
}
|
|
139
|
+
// Retrieve callback token from storage
|
|
140
|
+
const callbackToken = await this.get(`callback_${projectId}`);
|
|
141
|
+
if (!callbackToken) {
|
|
142
|
+
throw new Error(`Callback token not found for project ${projectId}`);
|
|
143
|
+
}
|
|
144
|
+
const client = await this.getClient(authToken);
|
|
145
|
+
// Build JQL query
|
|
146
|
+
let jql = `project = ${projectId}`;
|
|
147
|
+
if (options?.timeMin) {
|
|
148
|
+
const timeMinStr = options.timeMin.toISOString().split("T")[0];
|
|
149
|
+
jql += ` AND created >= "${timeMinStr}"`;
|
|
150
|
+
}
|
|
151
|
+
jql += ` ORDER BY created ASC`;
|
|
152
|
+
// Fetch batch of issues (50 at a time)
|
|
153
|
+
const batchSize = 50;
|
|
154
|
+
const searchResult = await client.issueSearch.searchForIssuesUsingJql({
|
|
155
|
+
jql,
|
|
156
|
+
startAt: state.startAt,
|
|
157
|
+
maxResults: batchSize,
|
|
158
|
+
fields: [
|
|
159
|
+
"summary",
|
|
160
|
+
"description",
|
|
161
|
+
"status",
|
|
162
|
+
"assignee",
|
|
163
|
+
"comment",
|
|
164
|
+
"created",
|
|
165
|
+
"updated",
|
|
166
|
+
],
|
|
167
|
+
});
|
|
168
|
+
// Process each issue
|
|
169
|
+
for (const issue of searchResult.issues || []) {
|
|
170
|
+
const activityWithNotes = await this.convertIssueToActivity(issue, projectId);
|
|
171
|
+
// Set unread based on sync type (false for initial sync to avoid notification overload)
|
|
172
|
+
activityWithNotes.unread = !state.initialSync;
|
|
173
|
+
// Execute the callback using the callback token
|
|
174
|
+
await this.tools.callbacks.run(callbackToken, activityWithNotes);
|
|
175
|
+
}
|
|
176
|
+
// Check if more pages
|
|
177
|
+
const totalIssues = searchResult.total || 0;
|
|
178
|
+
const nextStartAt = state.startAt + batchSize;
|
|
179
|
+
if (nextStartAt < totalIssues) {
|
|
180
|
+
await this.set(`sync_state_${projectId}`, {
|
|
181
|
+
startAt: nextStartAt,
|
|
182
|
+
batchNumber: state.batchNumber + 1,
|
|
183
|
+
issuesProcessed: state.issuesProcessed + (searchResult.issues?.length || 0),
|
|
184
|
+
initialSync: state.initialSync,
|
|
185
|
+
});
|
|
186
|
+
// Queue next batch
|
|
187
|
+
const nextBatch = await this.callback(this.syncBatch, authToken, projectId, options);
|
|
188
|
+
await this.tools.tasks.runTask(nextBatch);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
// Initial sync is complete - cleanup sync state
|
|
192
|
+
await this.clear(`sync_state_${projectId}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Convert a Jira issue to a Plot Activity
|
|
197
|
+
*/
|
|
198
|
+
async convertIssueToActivity(issue, projectId) {
|
|
199
|
+
const fields = issue.fields || {};
|
|
200
|
+
const status = fields.status?.name;
|
|
201
|
+
const comments = fields.comment?.comments || [];
|
|
202
|
+
// Build notes array: description + comments
|
|
203
|
+
const notes = [];
|
|
204
|
+
if (fields.description) {
|
|
205
|
+
// Jira uses Atlassian Document Format (ADF), need to convert to plain text
|
|
206
|
+
const description = typeof fields.description === "string"
|
|
207
|
+
? fields.description
|
|
208
|
+
: this.extractTextFromADF(fields.description);
|
|
209
|
+
notes.push({ content: description });
|
|
210
|
+
}
|
|
211
|
+
for (const comment of comments) {
|
|
212
|
+
const commentText = typeof comment.body === "string"
|
|
213
|
+
? comment.body
|
|
214
|
+
: this.extractTextFromADF(comment.body);
|
|
215
|
+
notes.push({ content: commentText });
|
|
216
|
+
}
|
|
217
|
+
// Ensure at least one note exists
|
|
218
|
+
if (notes.length === 0) {
|
|
219
|
+
notes.push({ content: "" });
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
type: ActivityType.Action,
|
|
223
|
+
title: fields.summary || issue.key,
|
|
224
|
+
source: `jira:issue:${projectId}:${issue.key}`,
|
|
225
|
+
doneAt: status === "Done" || status === "Closed" || status === "Resolved"
|
|
226
|
+
? new Date()
|
|
227
|
+
: null,
|
|
228
|
+
notes,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Extract plain text from Atlassian Document Format (ADF)
|
|
233
|
+
*/
|
|
234
|
+
extractTextFromADF(adf) {
|
|
235
|
+
if (!adf || typeof adf !== "object") {
|
|
236
|
+
return "";
|
|
237
|
+
}
|
|
238
|
+
let text = "";
|
|
239
|
+
const traverse = (node) => {
|
|
240
|
+
if (node.type === "text") {
|
|
241
|
+
text += node.text || "";
|
|
242
|
+
}
|
|
243
|
+
if (node.content && Array.isArray(node.content)) {
|
|
244
|
+
for (const child of node.content) {
|
|
245
|
+
traverse(child);
|
|
246
|
+
}
|
|
247
|
+
// Add newline after paragraphs
|
|
248
|
+
if (node.type === "paragraph") {
|
|
249
|
+
text += "\n";
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
traverse(adf);
|
|
254
|
+
return text.trim();
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Update issue with new values
|
|
258
|
+
*
|
|
259
|
+
* @param authToken - Authorization token
|
|
260
|
+
* @param update - ActivityUpdate with changed fields
|
|
261
|
+
*/
|
|
262
|
+
async updateIssue(authToken, update) {
|
|
263
|
+
// Extract Jira issue key from source
|
|
264
|
+
const issueKey = update.source?.split(":").pop();
|
|
265
|
+
if (!issueKey) {
|
|
266
|
+
throw new Error("Invalid source format for Jira issue");
|
|
267
|
+
}
|
|
268
|
+
const client = await this.getClient(authToken);
|
|
269
|
+
// Handle field updates (title, assignee)
|
|
270
|
+
const updateFields = {};
|
|
271
|
+
if (update.title !== undefined) {
|
|
272
|
+
updateFields.summary = update.title;
|
|
273
|
+
}
|
|
274
|
+
if (update.assignee !== undefined) {
|
|
275
|
+
updateFields.assignee = update.assignee
|
|
276
|
+
? { id: update.assignee.id }
|
|
277
|
+
: null;
|
|
278
|
+
}
|
|
279
|
+
// Apply field updates if any
|
|
280
|
+
if (Object.keys(updateFields).length > 0) {
|
|
281
|
+
await client.issues.editIssue({
|
|
282
|
+
issueIdOrKey: issueKey,
|
|
283
|
+
fields: updateFields,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
// Handle workflow state transitions based on start + doneAt combination
|
|
287
|
+
if (update.start !== undefined || update.doneAt !== undefined) {
|
|
288
|
+
// Get available transitions for this issue
|
|
289
|
+
const transitions = await client.issues.getTransitions({
|
|
290
|
+
issueIdOrKey: issueKey,
|
|
291
|
+
});
|
|
292
|
+
let targetTransition;
|
|
293
|
+
// Determine target state based on combination
|
|
294
|
+
if (update.doneAt !== undefined && update.doneAt !== null) {
|
|
295
|
+
// Completed - look for "Done", "Close", or "Resolve" transition
|
|
296
|
+
targetTransition = transitions.transitions?.find((t) => t.name?.toLowerCase() === "done" ||
|
|
297
|
+
t.name?.toLowerCase() === "close" ||
|
|
298
|
+
t.name?.toLowerCase() === "resolve" ||
|
|
299
|
+
t.to?.name?.toLowerCase() === "done" ||
|
|
300
|
+
t.to?.name?.toLowerCase() === "closed" ||
|
|
301
|
+
t.to?.name?.toLowerCase() === "resolved");
|
|
302
|
+
}
|
|
303
|
+
else if (update.start !== undefined && update.start !== null) {
|
|
304
|
+
// In Progress - look for "Start Progress" or "In Progress" transition
|
|
305
|
+
targetTransition = transitions.transitions?.find((t) => t.name?.toLowerCase() === "start progress" ||
|
|
306
|
+
t.name?.toLowerCase() === "in progress" ||
|
|
307
|
+
t.to?.name?.toLowerCase() === "in progress");
|
|
308
|
+
}
|
|
309
|
+
else if ((update.start !== undefined && update.start === null) ||
|
|
310
|
+
(update.doneAt !== undefined && update.doneAt === null)) {
|
|
311
|
+
// Backlog/Todo - look for "To Do", "Open", or "Reopen" transition
|
|
312
|
+
targetTransition = transitions.transitions?.find((t) => t.name?.toLowerCase() === "reopen" ||
|
|
313
|
+
t.name?.toLowerCase() === "to do" ||
|
|
314
|
+
t.name?.toLowerCase() === "open" ||
|
|
315
|
+
t.to?.name?.toLowerCase() === "to do" ||
|
|
316
|
+
t.to?.name?.toLowerCase() === "open");
|
|
317
|
+
}
|
|
318
|
+
// Execute transition if found
|
|
319
|
+
if (targetTransition) {
|
|
320
|
+
await client.issues.doTransition({
|
|
321
|
+
issueIdOrKey: issueKey,
|
|
322
|
+
transition: {
|
|
323
|
+
id: targetTransition.id,
|
|
324
|
+
},
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Add a comment to a Jira issue
|
|
331
|
+
*
|
|
332
|
+
* @param authToken - Authorization token
|
|
333
|
+
* @param issueKey - Jira issue key (e.g., "PROJ-123")
|
|
334
|
+
* @param body - Comment text (converted to ADF format)
|
|
335
|
+
*/
|
|
336
|
+
async addIssueComment(authToken, issueKey, body) {
|
|
337
|
+
const client = await this.getClient(authToken);
|
|
338
|
+
// Convert plain text to Atlassian Document Format (ADF)
|
|
339
|
+
const adfBody = this.convertTextToADF(body);
|
|
340
|
+
await client.issueComments.addComment({
|
|
341
|
+
issueIdOrKey: issueKey,
|
|
342
|
+
comment: adfBody,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Convert plain text to Atlassian Document Format (ADF)
|
|
347
|
+
*/
|
|
348
|
+
convertTextToADF(text) {
|
|
349
|
+
// Split text into paragraphs
|
|
350
|
+
const paragraphs = text.split("\n\n").filter((p) => p.trim());
|
|
351
|
+
return {
|
|
352
|
+
version: 1,
|
|
353
|
+
type: "doc",
|
|
354
|
+
content: paragraphs.map((paragraph) => ({
|
|
355
|
+
type: "paragraph",
|
|
356
|
+
content: [
|
|
357
|
+
{
|
|
358
|
+
type: "text",
|
|
359
|
+
text: paragraph.trim(),
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
})),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Handle incoming webhook events from Jira
|
|
367
|
+
*/
|
|
368
|
+
async onWebhook(request, projectId, authToken) {
|
|
369
|
+
const payload = request.body;
|
|
370
|
+
// Jira webhook events have different structure
|
|
371
|
+
if (payload.webhookEvent?.startsWith("jira:issue_") ||
|
|
372
|
+
payload.webhookEvent?.startsWith("comment_")) {
|
|
373
|
+
const callbackToken = await this.get(`callback_${projectId}`);
|
|
374
|
+
if (!callbackToken)
|
|
375
|
+
return;
|
|
376
|
+
const issue = payload.issue;
|
|
377
|
+
if (!issue)
|
|
378
|
+
return;
|
|
379
|
+
const activityWithNotes = await this.convertIssueToActivity(issue, projectId);
|
|
380
|
+
// Webhooks are incremental updates - mark as unread
|
|
381
|
+
activityWithNotes.unread = true;
|
|
382
|
+
// Execute stored callback
|
|
383
|
+
await this.tools.callbacks.run(callbackToken, activityWithNotes);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Stop syncing a Jira project
|
|
388
|
+
*/
|
|
389
|
+
async stopSync(authToken, projectId) {
|
|
390
|
+
// TODO: Remove webhook when webhook support is implemented
|
|
391
|
+
await this.clear(`webhook_id_${projectId}`);
|
|
392
|
+
// Cleanup callback
|
|
393
|
+
const callbackToken = await this.get(`callback_${projectId}`);
|
|
394
|
+
if (callbackToken) {
|
|
395
|
+
await this.deleteCallback(callbackToken);
|
|
396
|
+
await this.clear(`callback_${projectId}`);
|
|
397
|
+
}
|
|
398
|
+
// Cleanup sync state
|
|
399
|
+
await this.clear(`sync_state_${projectId}`);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
export default Jira;
|
|
403
|
+
//# sourceMappingURL=jira.js.map
|
package/dist/jira.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jira.js","sourceRoot":"","sources":["../src/jira.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAEL,YAAY,GAEb,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EAAE,IAAI,EAAoB,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAiB,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EACL,SAAS,EACT,YAAY,EAEZ,YAAY,GACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAuB,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AASrD;;;;;GAKG;AACH,MAAM,OAAO,IAAK,SAAQ,IAAU;IAClC,KAAK,CAAC,KAAkB;QACtB,OAAO;YACL,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;YACjC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,2BAA2B,CAAC,EAAE,CAAC;YAChE,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;YAC3B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;YACnB,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC;SAChE,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,SAAS,CAAC,SAAiB;QACvC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,GAAG,CAClC,iBAA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,KAAK,EACL,SAAS,CACV,CAAC;YAEF,oDAAoD;YACpD,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;YAEhC,0BAA0B;YAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,SAAiB,EAAE,SAAiB;QACjD,2DAA2D;QAC3D,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,SAAS,EAAE,CAAC,CAAC;QAE5C,mBAAmB;QACnB,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,GAAG,CAAW,YAAY,SAAS,EAAE,CAAC,CAAC;QACxE,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;YACzC,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,SAAS,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,qBAAqB;QACrB,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,SAAS,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF;AAED,eAAe,IAAI,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plotday/tool-jira",
|
|
3
|
+
"displayName": "Jira",
|
|
4
|
+
"description": "Sync with Jira project management",
|
|
5
|
+
"author": "Plot <team@plot.day> (https://plot.day)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"version": "0.2.0",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"@plotday/source": "./src/index.ts",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"jira.js": "^4.0.2",
|
|
25
|
+
"@plotday/twister": "^0.26.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"typescript": "^5.9.3"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/plotday/plot.git",
|
|
33
|
+
"directory": "tools/jira"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://plot.day",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/plotday/plot/issues"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"plot",
|
|
41
|
+
"tool",
|
|
42
|
+
"jira",
|
|
43
|
+
"atlassian",
|
|
44
|
+
"project-management"
|
|
45
|
+
],
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc",
|
|
51
|
+
"clean": "rm -rf dist"
|
|
52
|
+
}
|
|
53
|
+
}
|