jira-sprinter 2.5.0 → 2.6.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 CHANGED
@@ -12151,7 +12151,7 @@ var require_follow_redirects = __commonJS({
12151
12151
  self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause }));
12152
12152
  }
12153
12153
  };
12154
- this._headerFilter = new RegExp("^(?:" + sensitiveHeaders.concat(options.sensitiveHeaders).map(escapeRegex2).join("|") + ")$", "i");
12154
+ this._headerFilter = new RegExp("^(?:" + sensitiveHeaders.concat(options.sensitiveHeaders).map(escapeRegex3).join("|") + ")$", "i");
12155
12155
  this._performRequest();
12156
12156
  }
12157
12157
  RedirectableRequest.prototype = Object.create(Writable.prototype);
@@ -12561,7 +12561,7 @@ var require_follow_redirects = __commonJS({
12561
12561
  function isURL(value) {
12562
12562
  return URL2 && value instanceof URL2;
12563
12563
  }
12564
- function escapeRegex2(regex) {
12564
+ function escapeRegex3(regex) {
12565
12565
  return regex.replace(/[\]\\/()*+?.$]/g, "\\$&");
12566
12566
  }
12567
12567
  module2.exports = wrap({ http: http4, https: https3 });
@@ -47675,7 +47675,7 @@ var Jira = class {
47675
47675
  };
47676
47676
  this.availableTasks = [
47677
47677
  { ...this.devTask, checked: true },
47678
- { ...this.qeTask, checked: true },
47678
+ { ...this.qeTask, checked: false },
47679
47679
  { ...this.upstreamTask, checked: false },
47680
47680
  { ...this.rootCauseAnalysisTask, checked: false },
47681
47681
  { ...this.preliminaryTestingTask, checked: false },
@@ -47844,6 +47844,12 @@ var Jira = class {
47844
47844
  const assigneeValue = values.assignee ? { [this.fields.assignee]: { accountId: values.assignee } } : {};
47845
47845
  const storyPointsValue = values.size !== void 0 ? { [this.fields.storyPoints]: values.size } : {};
47846
47846
  const sprintValue = values.sprint !== void 0 ? { [this.fields.sprint]: values.sprint } : {};
47847
+ if (this.dry) {
47848
+ this.logger.log(
47849
+ ` ${source_default.dim(`Setting values ${JSON.stringify(values)} on ${issue2} (dry-run)`)}`
47850
+ );
47851
+ return;
47852
+ }
47847
47853
  await this.api.issues.editIssue({
47848
47854
  issueIdOrKey: issue2,
47849
47855
  fields: { ...assigneeValue, ...storyPointsValue, ...sprintValue }
@@ -53431,7 +53437,8 @@ var relPrepEntrySchema = external_exports.object({
53431
53437
  });
53432
53438
  var releaseDeadlinesSchema = external_exports.object({
53433
53439
  rel_prep: external_exports.array(relPrepEntrySchema),
53434
- itm_26: external_exports.string().nullable()
53440
+ itm_26: external_exports.string().nullable(),
53441
+ all_built_rel_prep: external_exports.string().nullable().default(null)
53435
53442
  });
53436
53443
  var deadlinesFileSchema = external_exports.object({
53437
53444
  updated_at: external_exports.string(),
@@ -53443,7 +53450,13 @@ var DEFAULT_DEADLINES_PATH = import_path3.default.resolve(
53443
53450
  "jira-sprinter",
53444
53451
  "deadlines.json"
53445
53452
  );
53446
- var SCHEDULE_TASK_REGEX = ".*(Package Advisory REL_PREP Deadline|ITM 26 DevTestDoc).*";
53453
+ var TASK_NAME_REL_PREP = "Package Advisory REL_PREP Deadline";
53454
+ var TASK_NAME_ITM_26 = "ITM 26 DevTestDoc";
53455
+ var TASK_NAME_ALL_BUILT_REL_PREP = "All packages built & All Errata in REL_PREP (non-container)";
53456
+ function escapeRegex2(str) {
53457
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
53458
+ }
53459
+ var SCHEDULE_TASK_REGEX = `.*(${escapeRegex2(TASK_NAME_REL_PREP)}|${escapeRegex2(TASK_NAME_ITM_26)}|${escapeRegex2(TASK_NAME_ALL_BUILT_REL_PREP)}).*`;
53447
53460
  function readDeadlines(filePath = DEFAULT_DEADLINES_PATH) {
53448
53461
  try {
53449
53462
  const raw = import_fs.default.readFileSync(filePath, "utf-8");
@@ -53459,14 +53472,20 @@ function formatDate(date5) {
53459
53472
  return `${y}-${m}-${d}`;
53460
53473
  }
53461
53474
  function classifyScheduleTasks(tasks) {
53462
- const deadlines = { rel_prep: [], itm_26: null };
53475
+ const deadlines = {
53476
+ rel_prep: [],
53477
+ itm_26: null,
53478
+ all_built_rel_prep: null
53479
+ };
53463
53480
  for (const task of tasks) {
53464
- if (task.name.includes("REL_PREP")) {
53481
+ if (task.name.includes(TASK_NAME_ALL_BUILT_REL_PREP)) {
53482
+ deadlines.all_built_rel_prep = task.date_finish;
53483
+ } else if (task.name.includes(TASK_NAME_REL_PREP)) {
53465
53484
  deadlines.rel_prep.push({
53466
53485
  name: task.name,
53467
53486
  date_finish: task.date_finish
53468
53487
  });
53469
- } else if (task.name.includes("ITM 26")) {
53488
+ } else if (task.name.includes(TASK_NAME_ITM_26)) {
53470
53489
  deadlines.itm_26 = task.date_finish;
53471
53490
  }
53472
53491
  }
@@ -53489,13 +53508,23 @@ function computePreliminaryTestingDueDate(deadlines, isZStream, today = /* @__PU
53489
53508
  if (!closest) return twoWeeksStr;
53490
53509
  return closest < twoWeeksStr ? closest : twoWeeksStr;
53491
53510
  }
53511
+ const todayStr = formatDate(today);
53492
53512
  if (deadlines.itm_26) {
53493
- const todayStr = formatDate(today);
53494
53513
  if (deadlines.itm_26 >= todayStr && deadlines.itm_26 < twoWeeksStr) {
53495
53514
  return deadlines.itm_26;
53496
53515
  }
53497
53516
  }
53498
- return twoWeeksStr;
53517
+ const pastItm26 = !deadlines.itm_26 || deadlines.itm_26 < todayStr;
53518
+ const oneWeek = new Date(today);
53519
+ oneWeek.setDate(oneWeek.getDate() + 7);
53520
+ const oneWeekStr = formatDate(oneWeek);
53521
+ const maxCap = pastItm26 ? oneWeekStr : twoWeeksStr;
53522
+ if (deadlines.all_built_rel_prep) {
53523
+ if (deadlines.all_built_rel_prep >= todayStr && deadlines.all_built_rel_prep < maxCap) {
53524
+ return deadlines.all_built_rel_prep;
53525
+ }
53526
+ }
53527
+ return maxCap;
53499
53528
  }
53500
53529
  function computeQeTaskDueDate(deadlines, isZStream, today = /* @__PURE__ */ new Date()) {
53501
53530
  if (isZStream) {
@@ -53504,9 +53533,13 @@ function computeQeTaskDueDate(deadlines, isZStream, today = /* @__PURE__ */ new
53504
53533
  today
53505
53534
  );
53506
53535
  }
53507
- if (deadlines.itm_26 && deadlines.itm_26 >= formatDate(today)) {
53536
+ const todayStr = formatDate(today);
53537
+ if (deadlines.itm_26 && deadlines.itm_26 >= todayStr) {
53508
53538
  return deadlines.itm_26;
53509
53539
  }
53540
+ if (deadlines.all_built_rel_prep && deadlines.all_built_rel_prep >= todayStr) {
53541
+ return deadlines.all_built_rel_prep;
53542
+ }
53510
53543
  return null;
53511
53544
  }
53512
53545
  function writeDeadlines(data, filePath = DEFAULT_DEADLINES_PATH) {
@@ -53801,6 +53834,8 @@ ${source_default.cyan("Syncing")} ${source_default.bold(release)}...`);
53801
53834
  }
53802
53835
  const itm26 = deadlines.itm_26 ? source_default.bold(deadlines.itm_26) : source_default.dim("not found");
53803
53836
  logger.log(` ITM 26: ${itm26}`);
53837
+ const allBuiltRelPrep = deadlines.all_built_rel_prep ? source_default.bold(deadlines.all_built_rel_prep) : source_default.dim("not found");
53838
+ logger.log(` All built REL_PREP: ${allBuiltRelPrep}`);
53804
53839
  } catch (error51) {
53805
53840
  logger.log(source_default.yellow(` Failed to sync ${release}: ${error51}`));
53806
53841
  }
@@ -53921,7 +53956,7 @@ var issueStatusSchema = external_exports.union([
53921
53956
  });
53922
53957
 
53923
53958
  // package.json
53924
- var version2 = "2.5.0";
53959
+ var version2 = "2.6.0";
53925
53960
 
53926
53961
  // src/cli.ts
53927
53962
  function cli() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jira-sprinter",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Small CLI tool to manage sprints in JIRA Board",
5
5
  "main": "src/main.ts",
6
6
  "type": "commonjs",
package/src/jira.ts CHANGED
@@ -59,7 +59,7 @@ export class Jira {
59
59
  };
60
60
  readonly availableTasks = [
61
61
  { ...this.devTask, checked: true },
62
- { ...this.qeTask, checked: true },
62
+ { ...this.qeTask, checked: false },
63
63
  { ...this.upstreamTask, checked: false },
64
64
  { ...this.rootCauseAnalysisTask, checked: false },
65
65
  { ...this.preliminaryTestingTask, checked: false },
@@ -286,6 +286,13 @@ export class Jira {
286
286
  ? { [this.fields.sprint]: values.sprint }
287
287
  : {};
288
288
 
289
+ if (this.dry) {
290
+ this.logger.log(
291
+ ` ${chalk.dim(`Setting values ${JSON.stringify(values)} on ${issue} (dry-run)`)}`
292
+ );
293
+ return;
294
+ }
295
+
289
296
  await this.api.issues.editIssue({
290
297
  issueIdOrKey: issue,
291
298
  fields: { ...assigneeValue, ...storyPointsValue, ...sprintValue },
package/src/pp-sync.ts CHANGED
@@ -53,6 +53,10 @@ export async function runPpSync(
53
53
  ? chalk.bold(deadlines.itm_26)
54
54
  : chalk.dim('not found');
55
55
  logger.log(` ITM 26: ${itm26}`);
56
+ const allBuiltRelPrep = deadlines.all_built_rel_prep
57
+ ? chalk.bold(deadlines.all_built_rel_prep)
58
+ : chalk.dim('not found');
59
+ logger.log(` All built REL_PREP: ${allBuiltRelPrep}`);
56
60
  } catch (error) {
57
61
  logger.log(chalk.yellow(` Failed to sync ${release}: ${error}`));
58
62
  }
@@ -13,6 +13,7 @@ export type RelPrepEntry = z.infer<typeof relPrepEntrySchema>;
13
13
  const releaseDeadlinesSchema = z.object({
14
14
  rel_prep: z.array(relPrepEntrySchema),
15
15
  itm_26: z.string().nullable(),
16
+ all_built_rel_prep: z.string().nullable().default(null),
16
17
  });
17
18
 
18
19
  const deadlinesFileSchema = z.object({
@@ -30,8 +31,16 @@ export const DEFAULT_DEADLINES_PATH = path.resolve(
30
31
  'deadlines.json'
31
32
  );
32
33
 
33
- export const SCHEDULE_TASK_REGEX =
34
- '.*(Package Advisory REL_PREP Deadline|ITM 26 DevTestDoc).*';
34
+ const TASK_NAME_REL_PREP = 'Package Advisory REL_PREP Deadline';
35
+ const TASK_NAME_ITM_26 = 'ITM 26 DevTestDoc';
36
+ const TASK_NAME_ALL_BUILT_REL_PREP =
37
+ 'All packages built & All Errata in REL_PREP (non-container)';
38
+
39
+ export function escapeRegex(str: string): string {
40
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
41
+ }
42
+
43
+ export const SCHEDULE_TASK_REGEX = `.*(${escapeRegex(TASK_NAME_REL_PREP)}|${escapeRegex(TASK_NAME_ITM_26)}|${escapeRegex(TASK_NAME_ALL_BUILT_REL_PREP)}).*`;
35
44
 
36
45
  export function readDeadlines(
37
46
  filePath: string = DEFAULT_DEADLINES_PATH
@@ -54,14 +63,20 @@ function formatDate(date: Date): string {
54
63
  export function classifyScheduleTasks(
55
64
  tasks: { name: string; date_finish: string }[]
56
65
  ): ReleaseDeadlines {
57
- const deadlines: ReleaseDeadlines = { rel_prep: [], itm_26: null };
66
+ const deadlines: ReleaseDeadlines = {
67
+ rel_prep: [],
68
+ itm_26: null,
69
+ all_built_rel_prep: null,
70
+ };
58
71
  for (const task of tasks) {
59
- if (task.name.includes('REL_PREP')) {
72
+ if (task.name.includes(TASK_NAME_ALL_BUILT_REL_PREP)) {
73
+ deadlines.all_built_rel_prep = task.date_finish;
74
+ } else if (task.name.includes(TASK_NAME_REL_PREP)) {
60
75
  deadlines.rel_prep.push({
61
76
  name: task.name,
62
77
  date_finish: task.date_finish,
63
78
  });
64
- } else if (task.name.includes('ITM 26')) {
79
+ } else if (task.name.includes(TASK_NAME_ITM_26)) {
65
80
  deadlines.itm_26 = task.date_finish;
66
81
  }
67
82
  }
@@ -95,14 +110,30 @@ export function computePreliminaryTestingDueDate(
95
110
  return closest < twoWeeksStr ? closest : twoWeeksStr;
96
111
  }
97
112
 
113
+ const todayStr = formatDate(today);
114
+
98
115
  if (deadlines.itm_26) {
99
- const todayStr = formatDate(today);
100
116
  if (deadlines.itm_26 >= todayStr && deadlines.itm_26 < twoWeeksStr) {
101
117
  return deadlines.itm_26;
102
118
  }
103
119
  }
104
120
 
105
- return twoWeeksStr;
121
+ const pastItm26 = !deadlines.itm_26 || deadlines.itm_26 < todayStr;
122
+ const oneWeek = new Date(today);
123
+ oneWeek.setDate(oneWeek.getDate() + 7);
124
+ const oneWeekStr = formatDate(oneWeek);
125
+ const maxCap = pastItm26 ? oneWeekStr : twoWeeksStr;
126
+
127
+ if (deadlines.all_built_rel_prep) {
128
+ if (
129
+ deadlines.all_built_rel_prep >= todayStr &&
130
+ deadlines.all_built_rel_prep < maxCap
131
+ ) {
132
+ return deadlines.all_built_rel_prep;
133
+ }
134
+ }
135
+
136
+ return maxCap;
106
137
  }
107
138
 
108
139
  export function computeQeTaskDueDate(
@@ -117,10 +148,19 @@ export function computeQeTaskDueDate(
117
148
  );
118
149
  }
119
150
 
120
- if (deadlines.itm_26 && deadlines.itm_26 >= formatDate(today)) {
151
+ const todayStr = formatDate(today);
152
+
153
+ if (deadlines.itm_26 && deadlines.itm_26 >= todayStr) {
121
154
  return deadlines.itm_26;
122
155
  }
123
156
 
157
+ if (
158
+ deadlines.all_built_rel_prep &&
159
+ deadlines.all_built_rel_prep >= todayStr
160
+ ) {
161
+ return deadlines.all_built_rel_prep;
162
+ }
163
+
124
164
  return null;
125
165
  }
126
166