jira-sprinter 1.0.2 → 1.1.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/README.md CHANGED
@@ -34,7 +34,7 @@ JIRA_API_TOKEN="exaple-token"
34
34
 
35
35
  > [!TIP]
36
36
  >
37
- > You can also set default values for the `assignee`, `board` in the `~/.config/jira-sprinter/.env` or `~/.env.jira-sprinter` file:
37
+ > You can also set default values for the `assignee`, `board` and more in the `~/.config/jira-sprinter/.env` or `~/.env.jira-sprinter` file:
38
38
  >
39
39
  > ```bash
40
40
  > # ~/.config/jira-sprinter/.env
@@ -69,6 +69,8 @@ Options:
69
69
  -V, --version output the version number
70
70
  -b, --board [board] Jira Board ID
71
71
  -a, --assignee [assignee] Jira Assignee (default: "<user-login>@redhat.com")
72
+ -y, --yolo YOLO mode, dangerously skip all questions, apply
73
+ default values (use with caution!) (default: false)
72
74
  -n, --nocolor Disable color output (default: false)
73
75
  -x, --dry dry run
74
76
  -h, --help display help for command
package/dist/main.js CHANGED
@@ -36507,6 +36507,9 @@ function getDefaultValue(envName) {
36507
36507
  if (envName === "NOCOLOR" && !value) {
36508
36508
  return false;
36509
36509
  }
36510
+ if (envName === "YOLO" && !value) {
36511
+ return false;
36512
+ }
36510
36513
  return value;
36511
36514
  }
36512
36515
  function getOptions(inputs) {
@@ -36626,6 +36629,7 @@ var Jira = class {
36626
36629
  );
36627
36630
  return;
36628
36631
  }
36632
+ this.logger.log(`Creating tasks: ${tasks.join(", ")} for issue: ${issue2}`);
36629
36633
  await this.api.issues.editIssue({
36630
36634
  issueIdOrKey: issue2,
36631
36635
  fields: {
@@ -36636,8 +36640,8 @@ var Jira = class {
36636
36640
  }
36637
36641
  async setValues(issue2, values) {
36638
36642
  const assigneeValue = values.assignee ? { [this.fields.assignee]: { name: values.assignee } } : {};
36639
- const storyPointsValue = values.size ? { [this.fields.storyPoints]: values.size } : {};
36640
- const sprintValue = values.sprint === void 0 ? {} : { [this.fields.sprint]: values.sprint };
36643
+ const storyPointsValue = values.size !== void 0 ? { [this.fields.storyPoints]: values.size } : {};
36644
+ const sprintValue = values.sprint !== void 0 ? { [this.fields.sprint]: values.sprint } : {};
36641
36645
  await this.api.issues.editIssue({
36642
36646
  issueIdOrKey: issue2,
36643
36647
  fields: { ...assigneeValue, ...storyPointsValue, ...sprintValue }
@@ -49310,11 +49314,15 @@ var issueStatusSchema = external_exports2.union([
49310
49314
  // src/cli.ts
49311
49315
  function cli() {
49312
49316
  const program2 = new Command();
49313
- program2.name("jira-sprinter").description("\u{1F3C3} Small CLI tool to manage sprints in JIRA Board").version("1.0.2");
49317
+ program2.name("jira-sprinter").description("\u{1F3C3} Small CLI tool to manage sprints in JIRA Board").version("1.1.0");
49314
49318
  program2.option("-b, --board [board]", "Jira Board ID", getDefaultValue("BOARD")).option(
49315
49319
  "-a, --assignee [assignee]",
49316
49320
  "Jira Assignee",
49317
49321
  getDefaultValue("ASSIGNEE")
49322
+ ).option(
49323
+ "-y, --yolo",
49324
+ "YOLO mode, dangerously skip all questions, apply default values (use with caution!)",
49325
+ getDefaultValue("YOLO")
49318
49326
  ).option("-n, --nocolor", "Disable color output", getDefaultValue("NOCOLOR")).option("-x, --dry", "dry run", getDefaultValue("DRY"));
49319
49327
  return program2;
49320
49328
  }
@@ -49380,27 +49388,33 @@ ${issueTypeSchema.parse(issue2.fields?.issuetype.name)} ${issue2.key} - ${source
49380
49388
  { name: "Preliminary Testing Task", value: 39398 },
49381
49389
  { name: "Integration Testing", value: 48270 }
49382
49390
  ];
49383
- const answer = await esm_default3({
49384
- message: `Split ${source_default.bold(issue2.key)} into following tasks:
49391
+ let answer = [];
49392
+ if (!options.yolo) {
49393
+ answer = await esm_default3({
49394
+ message: `Split ${source_default.bold(issue2.key)} into following tasks:
49385
49395
  `,
49386
- choices: [
49387
- ...availableTasks.map((task) => ({
49388
- name: colorTaskSchema(task.name),
49389
- value: task.value,
49390
- checked: task.checked ?? false
49391
- })),
49392
- new Separator(),
49393
- { name: "SKIP", value: -1 },
49394
- { name: "EXIT", value: -2 }
49395
- ],
49396
- loop: false,
49397
- pageSize: 10
49398
- });
49399
- if (answer.includes(-1)) {
49400
- continue;
49396
+ choices: [
49397
+ ...availableTasks.map((task) => ({
49398
+ name: colorTaskSchema(task.name),
49399
+ value: task.value,
49400
+ checked: task.checked ?? false
49401
+ })),
49402
+ new Separator(),
49403
+ { name: "SKIP", value: -1 },
49404
+ { name: "EXIT", value: -2 }
49405
+ ],
49406
+ loop: false,
49407
+ pageSize: 10
49408
+ });
49409
+ if (answer.includes(-1)) {
49410
+ continue;
49411
+ }
49412
+ if (answer.includes(-2)) {
49413
+ process.exit(0);
49414
+ }
49401
49415
  }
49402
- if (answer.includes(-2)) {
49403
- process.exit(0);
49416
+ if (options.yolo) {
49417
+ answer = availableTasks.filter((task) => task.checked ?? false).map((task) => task.value);
49404
49418
  }
49405
49419
  await jira.createTasks(issue2.key, answer);
49406
49420
  let tasks = [];
@@ -49422,52 +49436,63 @@ ${issueTypeSchema.parse(issue2.fields?.issuetype.name)} ${issue2.key} - ${source
49422
49436
  continue;
49423
49437
  }
49424
49438
  logger.log(`${source_default.italic(task.fields.summary)}`);
49425
- const storyPointsAnswer = await esm_default2({
49426
- message: "Story Points",
49427
- choices: [
49428
- {
49429
- name: colorSizeSchema.parse(0),
49430
- value: 0
49431
- },
49432
- {
49433
- name: colorSizeSchema.parse(1),
49434
- value: 1
49435
- },
49436
- {
49437
- name: colorSizeSchema.parse(2),
49438
- value: 2
49439
- },
49440
- {
49441
- name: colorSizeSchema.parse(3),
49442
- value: 3
49443
- },
49444
- {
49445
- name: colorSizeSchema.parse(5),
49446
- value: 5
49447
- },
49448
- {
49449
- name: colorSizeSchema.parse(8),
49450
- value: 8
49451
- },
49452
- {
49453
- name: colorSizeSchema.parse(13),
49454
- value: 13
49455
- }
49456
- ],
49457
- default: issue2.fields?.[jira.fields.storyPoints] ?? 3,
49458
- pageSize: 6,
49459
- loop: false
49460
- });
49461
- const addToSprintAnswer = await esm_default2({
49462
- message: "Add to sprint",
49463
- choices: [
49464
- { name: `${source_default.green("Yes")}`, value: true },
49465
- { name: `${source_default.red("No")}`, value: false }
49466
- ],
49467
- default: true,
49468
- pageSize: 2,
49469
- loop: false
49470
- });
49439
+ let storyPointsAnswer;
49440
+ let addToSprintAnswer;
49441
+ if (!options.yolo) {
49442
+ storyPointsAnswer = await esm_default2({
49443
+ message: "Story Points",
49444
+ choices: [
49445
+ {
49446
+ name: colorSizeSchema.parse(0),
49447
+ value: 0
49448
+ },
49449
+ {
49450
+ name: colorSizeSchema.parse(1),
49451
+ value: 1
49452
+ },
49453
+ {
49454
+ name: colorSizeSchema.parse(2),
49455
+ value: 2
49456
+ },
49457
+ {
49458
+ name: colorSizeSchema.parse(3),
49459
+ value: 3
49460
+ },
49461
+ {
49462
+ name: colorSizeSchema.parse(5),
49463
+ value: 5
49464
+ },
49465
+ {
49466
+ name: colorSizeSchema.parse(8),
49467
+ value: 8
49468
+ },
49469
+ {
49470
+ name: colorSizeSchema.parse(13),
49471
+ value: 13
49472
+ }
49473
+ ],
49474
+ default: issue2.fields?.[jira.fields.storyPoints] ?? 3,
49475
+ pageSize: 6,
49476
+ loop: false
49477
+ });
49478
+ addToSprintAnswer = await esm_default2({
49479
+ message: "Add to sprint",
49480
+ choices: [
49481
+ { name: `${source_default.green("Yes")}`, value: true },
49482
+ { name: `${source_default.red("No")}`, value: false }
49483
+ ],
49484
+ default: true,
49485
+ pageSize: 2,
49486
+ loop: false
49487
+ });
49488
+ }
49489
+ if (options.yolo) {
49490
+ storyPointsAnswer = issue2.fields?.[jira.fields.storyPoints];
49491
+ addToSprintAnswer = sprintOrBacklog != -1;
49492
+ logger.log(
49493
+ `Setting story points to ${colorSizeSchema.parse(storyPointsAnswer)} and adding it to the sprint.`
49494
+ );
49495
+ }
49471
49496
  await jira.setValues(task.key, {
49472
49497
  assignee: issue2.fields?.assignee?.emailAddress,
49473
49498
  size: storyPointsAnswer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jira-sprinter",
3
- "version": "1.0.2",
3
+ "version": "1.1.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/cli.ts CHANGED
@@ -23,7 +23,7 @@ export function cli(): Command {
23
23
  program
24
24
  .name('jira-sprinter')
25
25
  .description('🏃 Small CLI tool to manage sprints in JIRA Board')
26
- .version('1.0.2');
26
+ .version('1.1.0');
27
27
 
28
28
  program
29
29
  .option('-b, --board [board]', 'Jira Board ID', getDefaultValue('BOARD'))
@@ -32,6 +32,11 @@ export function cli(): Command {
32
32
  'Jira Assignee',
33
33
  getDefaultValue('ASSIGNEE')
34
34
  )
35
+ .option(
36
+ '-y, --yolo',
37
+ 'YOLO mode, dangerously skip all questions, apply default values (use with caution!)',
38
+ getDefaultValue('YOLO')
39
+ )
35
40
  .option('-n, --nocolor', 'Disable color output', getDefaultValue('NOCOLOR'))
36
41
  .option('-x, --dry', 'dry run', getDefaultValue('DRY'));
37
42
 
@@ -113,28 +118,37 @@ const runProgram = async () => {
113
118
  { name: 'Integration Testing', value: 48270 },
114
119
  ];
115
120
 
116
- const answer = await checkbox({
117
- message: `Split ${chalk.bold(issue.key)} into following tasks:\n`,
118
- choices: [
119
- ...availableTasks.map(task => ({
120
- name: colorTaskSchema(task.name),
121
- value: task.value,
122
- checked: task.checked ?? false,
123
- })),
124
- new Separator(),
125
- { name: 'SKIP', value: -1 },
126
- { name: 'EXIT', value: -2 },
127
- ],
128
- loop: false,
129
- pageSize: 10,
130
- });
131
-
132
- if (answer.includes(-1)) {
133
- continue;
121
+ let answer: number[] = [];
122
+ if (!options.yolo) {
123
+ answer = await checkbox({
124
+ message: `Split ${chalk.bold(issue.key)} into following tasks:\n`,
125
+ choices: [
126
+ ...availableTasks.map(task => ({
127
+ name: colorTaskSchema(task.name),
128
+ value: task.value,
129
+ checked: task.checked ?? false,
130
+ })),
131
+ new Separator(),
132
+ { name: 'SKIP', value: -1 },
133
+ { name: 'EXIT', value: -2 },
134
+ ],
135
+ loop: false,
136
+ pageSize: 10,
137
+ });
138
+
139
+ if (answer.includes(-1)) {
140
+ continue;
141
+ }
142
+
143
+ if (answer.includes(-2)) {
144
+ process.exit(0);
145
+ }
134
146
  }
135
147
 
136
- if (answer.includes(-2)) {
137
- process.exit(0);
148
+ if (options.yolo) {
149
+ answer = availableTasks
150
+ .filter(task => task.checked ?? false)
151
+ .map(task => task.value);
138
152
  }
139
153
 
140
154
  // Create tasks
@@ -165,53 +179,66 @@ const runProgram = async () => {
165
179
  }
166
180
 
167
181
  logger.log(`${chalk.italic(task.fields.summary)}`);
168
- const storyPointsAnswer: Size = await select({
169
- message: 'Story Points',
170
- choices: [
171
- {
172
- name: colorSizeSchema.parse(0),
173
- value: 0,
174
- },
175
- {
176
- name: colorSizeSchema.parse(1),
177
- value: 1,
178
- },
179
- {
180
- name: colorSizeSchema.parse(2),
181
- value: 2,
182
- },
183
- {
184
- name: colorSizeSchema.parse(3),
185
- value: 3,
186
- },
187
- {
188
- name: colorSizeSchema.parse(5),
189
- value: 5,
190
- },
191
- {
192
- name: colorSizeSchema.parse(8),
193
- value: 8,
194
- },
195
- {
196
- name: colorSizeSchema.parse(13),
197
- value: 13,
198
- },
199
- ],
200
- default: issue.fields?.[jira.fields.storyPoints] ?? 3,
201
- pageSize: 6,
202
- loop: false,
203
- });
204
182
 
205
- const addToSprintAnswer = await select({
206
- message: 'Add to sprint',
207
- choices: [
208
- { name: `${chalk.green('Yes')}`, value: true },
209
- { name: `${chalk.red('No')}`, value: false },
210
- ],
211
- default: true,
212
- pageSize: 2,
213
- loop: false,
214
- });
183
+ let storyPointsAnswer: Size | undefined;
184
+ let addToSprintAnswer: boolean | undefined;
185
+ if (!options.yolo) {
186
+ storyPointsAnswer = await select({
187
+ message: 'Story Points',
188
+ choices: [
189
+ {
190
+ name: colorSizeSchema.parse(0),
191
+ value: 0,
192
+ },
193
+ {
194
+ name: colorSizeSchema.parse(1),
195
+ value: 1,
196
+ },
197
+ {
198
+ name: colorSizeSchema.parse(2),
199
+ value: 2,
200
+ },
201
+ {
202
+ name: colorSizeSchema.parse(3),
203
+ value: 3,
204
+ },
205
+ {
206
+ name: colorSizeSchema.parse(5),
207
+ value: 5,
208
+ },
209
+ {
210
+ name: colorSizeSchema.parse(8),
211
+ value: 8,
212
+ },
213
+ {
214
+ name: colorSizeSchema.parse(13),
215
+ value: 13,
216
+ },
217
+ ],
218
+ default: issue.fields?.[jira.fields.storyPoints] ?? 3,
219
+ pageSize: 6,
220
+ loop: false,
221
+ });
222
+
223
+ addToSprintAnswer = await select({
224
+ message: 'Add to sprint',
225
+ choices: [
226
+ { name: `${chalk.green('Yes')}`, value: true },
227
+ { name: `${chalk.red('No')}`, value: false },
228
+ ],
229
+ default: true,
230
+ pageSize: 2,
231
+ loop: false,
232
+ });
233
+ }
234
+
235
+ if (options.yolo) {
236
+ storyPointsAnswer = issue.fields?.[jira.fields.storyPoints];
237
+ addToSprintAnswer = sprintOrBacklog != -1;
238
+ logger.log(
239
+ `Setting story points to ${colorSizeSchema.parse(storyPointsAnswer)} and adding it to the sprint.`
240
+ );
241
+ }
215
242
 
216
243
  // update task
217
244
  await jira.setValues(task.key, {
package/src/jira.ts CHANGED
@@ -139,6 +139,7 @@ export class Jira {
139
139
  return;
140
140
  }
141
141
 
142
+ this.logger.log(`Creating tasks: ${tasks.join(', ')} for issue: ${issue}`);
142
143
  await this.api.issues.editIssue({
143
144
  issueIdOrKey: issue,
144
145
  fields: {
@@ -159,13 +160,14 @@ export class Jira {
159
160
  const assigneeValue = values.assignee
160
161
  ? { [this.fields.assignee]: { name: values.assignee } }
161
162
  : {};
162
- const storyPointsValue = values.size
163
- ? { [this.fields.storyPoints]: values.size }
164
- : {};
163
+ const storyPointsValue =
164
+ values.size !== undefined
165
+ ? { [this.fields.storyPoints]: values.size }
166
+ : {};
165
167
  const sprintValue =
166
- values.sprint === undefined
167
- ? {}
168
- : { [this.fields.sprint]: values.sprint };
168
+ values.sprint !== undefined
169
+ ? { [this.fields.sprint]: values.sprint }
170
+ : {};
169
171
 
170
172
  await this.api.issues.editIssue({
171
173
  issueIdOrKey: issue,
package/src/util.ts CHANGED
@@ -21,7 +21,7 @@ export function isDefaultValuesDisabled(): boolean {
21
21
  }
22
22
 
23
23
  export function getDefaultValue(
24
- envName: 'ASSIGNEE' | 'BOARD' | 'NOCOLOR' | 'DRY'
24
+ envName: 'ASSIGNEE' | 'BOARD' | 'NOCOLOR' | 'DRY' | 'YOLO'
25
25
  ) {
26
26
  if (isDefaultValuesDisabled()) {
27
27
  return undefined;
@@ -37,6 +37,10 @@ export function getDefaultValue(
37
37
  return false;
38
38
  }
39
39
 
40
+ if (envName === 'YOLO' && !value) {
41
+ return false;
42
+ }
43
+
40
44
  return value;
41
45
  }
42
46