jira-sprinter 2.4.2 → 2.5.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/dist/main.js +6242 -18669
- package/package.json +4 -4
- package/src/auto.ts +27 -0
- package/src/cli.ts +2 -2
- package/src/jira.ts +19 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jira-sprinter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Small CLI tool to manage sprints in JIRA Board",
|
|
5
5
|
"main": "src/main.ts",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"dotenv": "17.4.2",
|
|
43
43
|
"jira.js": "5.4.0",
|
|
44
44
|
"kerberos": "^7.0.0",
|
|
45
|
-
"product-pages": "^1.0.
|
|
45
|
+
"product-pages": "^1.0.1",
|
|
46
46
|
"zod": "4.4.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/node": "26.
|
|
49
|
+
"@types/node": "26.2.0",
|
|
50
50
|
"@vitest/coverage-v8": "4.1.10",
|
|
51
|
-
"esbuild": "0.28.
|
|
51
|
+
"esbuild": "0.28.2",
|
|
52
52
|
"prettier": "3.9.6",
|
|
53
53
|
"ts-node": "10.9.2",
|
|
54
54
|
"typescript": "7.0.2",
|
package/src/auto.ts
CHANGED
|
@@ -85,6 +85,22 @@ export async function runAuto(options: OptionValues): Promise<void> {
|
|
|
85
85
|
)
|
|
86
86
|
);
|
|
87
87
|
|
|
88
|
+
const activeSprint = await jira.getActiveSprint(+options.board);
|
|
89
|
+
let tasksWithoutSprint: { key?: string; fields?: Record<string, any> }[] = [];
|
|
90
|
+
|
|
91
|
+
if (!activeSprint) {
|
|
92
|
+
logger.log(
|
|
93
|
+
` ${chalk.yellow('No active sprint found — skipping sprint assignment')}`
|
|
94
|
+
);
|
|
95
|
+
} else {
|
|
96
|
+
const sprintAssignmentJQL = `project in (RHEL, "RHEL Miscellaneous") AND labels in (NEWA, dev_task, qe_task, upstream_task, root_cause_analysis_task, preliminary_testing_task, integration_testing_task) AND "Flagged[Checkboxes]" = EMPTY AND Sprint is EMPTY AND "AssignedTeam[Dropdown]" = "${options.team}" AND statusCategory = "In Progress" AND type = Task`;
|
|
97
|
+
|
|
98
|
+
tasksWithoutSprint = await jira.getBoardIssues(
|
|
99
|
+
+options.board,
|
|
100
|
+
sprintAssignmentJQL
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
88
104
|
const summary = [
|
|
89
105
|
{
|
|
90
106
|
label: 'Preliminary Testing Requested',
|
|
@@ -99,6 +115,7 @@ export async function runAuto(options: OptionValues): Promise<void> {
|
|
|
99
115
|
label: 'Release Pending w/ QE Task',
|
|
100
116
|
count: issuesInReleasePending.length,
|
|
101
117
|
},
|
|
118
|
+
{ label: 'In Progress w/o Sprint', count: tasksWithoutSprint.length },
|
|
102
119
|
].filter(entry => entry.count > 0);
|
|
103
120
|
|
|
104
121
|
for (const { label, count } of summary) {
|
|
@@ -197,6 +214,16 @@ export async function runAuto(options: OptionValues): Promise<void> {
|
|
|
197
214
|
await jira.closeTask(qeTask.outwardIssue?.key);
|
|
198
215
|
}
|
|
199
216
|
|
|
217
|
+
if (activeSprint) {
|
|
218
|
+
for (const task of tasksWithoutSprint) {
|
|
219
|
+
if (!task.key) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
await jira.addToSprint(task.key, activeSprint.id);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
200
227
|
const dueDateResults = await Promise.allSettled(
|
|
201
228
|
dueDateJobs.map(job =>
|
|
202
229
|
setDueDateOnSplitTask(
|
package/src/cli.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { getDefaultValue, getOptions } from './util';
|
|
|
9
9
|
import { runAuto } from './auto';
|
|
10
10
|
import { runPpSync } from './pp-sync';
|
|
11
11
|
|
|
12
|
-
import { SearchResults } from 'jira.js/
|
|
12
|
+
import { SearchResults } from 'jira.js/agile/models';
|
|
13
13
|
import {
|
|
14
14
|
colorTaskSchema,
|
|
15
15
|
issueStatusSchema,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
colorSizeSchema,
|
|
18
18
|
Size,
|
|
19
19
|
} from './schema/jira';
|
|
20
|
-
import { Issue } from 'jira.js/
|
|
20
|
+
import { Issue } from 'jira.js/version3/models';
|
|
21
21
|
|
|
22
22
|
import { version } from '../package.json';
|
|
23
23
|
|
package/src/jira.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgileClient, Version3Client } from 'jira.js';
|
|
2
|
-
import { SearchResults, Sprint } from 'jira.js/
|
|
3
|
-
import { Issue } from 'jira.js/
|
|
2
|
+
import { SearchResults, Sprint } from 'jira.js/agile/models';
|
|
3
|
+
import { Issue } from 'jira.js/version3/models';
|
|
4
4
|
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
|
|
@@ -111,6 +111,11 @@ export class Jira {
|
|
|
111
111
|
return response.values;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
async getActiveSprint(boardId: number): Promise<Sprint | undefined> {
|
|
115
|
+
const sprints = await this.getSprints(boardId);
|
|
116
|
+
return sprints.find(s => s.state === 'active');
|
|
117
|
+
}
|
|
118
|
+
|
|
114
119
|
async getIssuesInSprint(
|
|
115
120
|
sprintId: number,
|
|
116
121
|
assignee?: string,
|
|
@@ -287,6 +292,18 @@ export class Jira {
|
|
|
287
292
|
});
|
|
288
293
|
}
|
|
289
294
|
|
|
295
|
+
async addToSprint(issue: string, sprintId: number): Promise<void> {
|
|
296
|
+
if (this.dry) {
|
|
297
|
+
this.logger.log(
|
|
298
|
+
` ${chalk.dim(`Adding ${issue} to sprint ${sprintId} (dry-run)`)}`
|
|
299
|
+
);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
this.logger.log(` ${chalk.cyan(`Adding ${issue} to sprint ${sprintId}`)}`);
|
|
304
|
+
await this.setValues(issue, { sprint: sprintId });
|
|
305
|
+
}
|
|
306
|
+
|
|
290
307
|
async setDueDate(issue: string, dueDate: string) {
|
|
291
308
|
if (this.dry) {
|
|
292
309
|
this.logger.log(
|