github-issue-tower-defence-management 1.46.0 → 1.48.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +70 -25
  3. package/bin/adapter/entry-points/cli/index.js +2 -104
  4. package/bin/adapter/entry-points/cli/index.js.map +1 -1
  5. package/bin/adapter/entry-points/cli/projectConfig.js +0 -15
  6. package/bin/adapter/entry-points/cli/projectConfig.js.map +1 -1
  7. package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +28 -62
  8. package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
  9. package/bin/adapter/entry-points/handlers/situationFileWriter.js +98 -0
  10. package/bin/adapter/entry-points/handlers/situationFileWriter.js.map +1 -0
  11. package/bin/adapter/repositories/GraphqlProjectRepository.js +37 -0
  12. package/bin/adapter/repositories/GraphqlProjectRepository.js.map +1 -1
  13. package/bin/domain/entities/WorkflowStatus.js +36 -0
  14. package/bin/domain/entities/WorkflowStatus.js.map +1 -0
  15. package/bin/domain/usecases/AnalyzeStoriesUseCase.js +2 -1
  16. package/bin/domain/usecases/AnalyzeStoriesUseCase.js.map +1 -1
  17. package/bin/domain/usecases/ChangeStatusByStoryColorUseCase.js +4 -3
  18. package/bin/domain/usecases/ChangeStatusByStoryColorUseCase.js.map +1 -1
  19. package/bin/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.js +2 -1
  20. package/bin/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.js.map +1 -1
  21. package/bin/domain/usecases/CreateEstimationIssueUseCase.js +2 -1
  22. package/bin/domain/usecases/CreateEstimationIssueUseCase.js.map +1 -1
  23. package/bin/domain/usecases/CreateNewStoryByLabelUseCase.js.map +1 -1
  24. package/bin/domain/usecases/HandleScheduledEventUseCase.js +9 -17
  25. package/bin/domain/usecases/HandleScheduledEventUseCase.js.map +1 -1
  26. package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js +13 -15
  27. package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js.map +1 -1
  28. package/bin/domain/usecases/RevertOrphanedPreparationUseCase.js +4 -5
  29. package/bin/domain/usecases/RevertOrphanedPreparationUseCase.js.map +1 -1
  30. package/bin/domain/usecases/SetupTowerDefenceProjectUseCase.js +47 -0
  31. package/bin/domain/usecases/SetupTowerDefenceProjectUseCase.js.map +1 -0
  32. package/bin/domain/usecases/StartPreparationUseCase.js +7 -8
  33. package/bin/domain/usecases/StartPreparationUseCase.js.map +1 -1
  34. package/bin/domain/usecases/UpdateIssueStatusByLabelUseCase.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/adapter/entry-points/cli/index.test.ts +8 -258
  37. package/src/adapter/entry-points/cli/index.ts +6 -106
  38. package/src/adapter/entry-points/cli/projectConfig.ts +0 -33
  39. package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.test.ts +24 -58
  40. package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +36 -41
  41. package/src/adapter/entry-points/handlers/situationFileWriter.test.ts +417 -0
  42. package/src/adapter/entry-points/handlers/situationFileWriter.ts +168 -0
  43. package/src/adapter/repositories/GraphqlProjectRepository.ts +55 -1
  44. package/src/domain/entities/WorkflowStatus.ts +41 -0
  45. package/src/domain/usecases/AnalyzeStoriesUseCase.ts +2 -2
  46. package/src/domain/usecases/ChangeStatusByStoryColorUseCase.test.ts +5 -10
  47. package/src/domain/usecases/ChangeStatusByStoryColorUseCase.ts +4 -4
  48. package/src/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.test.ts +0 -11
  49. package/src/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.ts +2 -2
  50. package/src/domain/usecases/CreateEstimationIssueUseCase.ts +2 -2
  51. package/src/domain/usecases/CreateNewStoryByLabelUseCase.test.ts +0 -4
  52. package/src/domain/usecases/CreateNewStoryByLabelUseCase.ts +0 -1
  53. package/src/domain/usecases/HandleScheduledEventUseCase.test.ts +4 -41
  54. package/src/domain/usecases/HandleScheduledEventUseCase.ts +9 -27
  55. package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.test.ts +0 -202
  56. package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.ts +18 -31
  57. package/src/domain/usecases/RevertOrphanedPreparationUseCase.test.ts +13 -101
  58. package/src/domain/usecases/RevertOrphanedPreparationUseCase.ts +10 -10
  59. package/src/domain/usecases/SetupTowerDefenceProjectUseCase.test.ts +187 -0
  60. package/src/domain/usecases/SetupTowerDefenceProjectUseCase.ts +69 -0
  61. package/src/domain/usecases/StartPreparationUseCase.test.ts +1 -151
  62. package/src/domain/usecases/StartPreparationUseCase.ts +11 -20
  63. package/src/domain/usecases/UpdateIssueStatusByLabelUseCase.test.ts +2 -47
  64. package/src/domain/usecases/UpdateIssueStatusByLabelUseCase.ts +1 -5
  65. package/src/domain/usecases/adapter-interfaces/ProjectRepository.ts +6 -1
  66. package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
  67. package/types/adapter/entry-points/cli/projectConfig.d.ts +0 -3
  68. package/types/adapter/entry-points/cli/projectConfig.d.ts.map +1 -1
  69. package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
  70. package/types/adapter/entry-points/handlers/situationFileWriter.d.ts +30 -0
  71. package/types/adapter/entry-points/handlers/situationFileWriter.d.ts.map +1 -0
  72. package/types/adapter/repositories/GraphqlProjectRepository.d.ts +4 -1
  73. package/types/adapter/repositories/GraphqlProjectRepository.d.ts.map +1 -1
  74. package/types/domain/entities/WorkflowStatus.d.ts +13 -0
  75. package/types/domain/entities/WorkflowStatus.d.ts.map +1 -0
  76. package/types/domain/usecases/AnalyzeStoriesUseCase.d.ts +0 -1
  77. package/types/domain/usecases/AnalyzeStoriesUseCase.d.ts.map +1 -1
  78. package/types/domain/usecases/ChangeStatusByStoryColorUseCase.d.ts +0 -1
  79. package/types/domain/usecases/ChangeStatusByStoryColorUseCase.d.ts.map +1 -1
  80. package/types/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.d.ts +0 -1
  81. package/types/domain/usecases/ConvertCheckboxToIssueInStoryIssueUseCase.d.ts.map +1 -1
  82. package/types/domain/usecases/CreateEstimationIssueUseCase.d.ts +0 -1
  83. package/types/domain/usecases/CreateEstimationIssueUseCase.d.ts.map +1 -1
  84. package/types/domain/usecases/CreateNewStoryByLabelUseCase.d.ts +0 -1
  85. package/types/domain/usecases/CreateNewStoryByLabelUseCase.d.ts.map +1 -1
  86. package/types/domain/usecases/HandleScheduledEventUseCase.d.ts +3 -8
  87. package/types/domain/usecases/HandleScheduledEventUseCase.d.ts.map +1 -1
  88. package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts +1 -4
  89. package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts.map +1 -1
  90. package/types/domain/usecases/RevertOrphanedPreparationUseCase.d.ts +0 -3
  91. package/types/domain/usecases/RevertOrphanedPreparationUseCase.d.ts.map +1 -1
  92. package/types/domain/usecases/SetupTowerDefenceProjectUseCase.d.ts +10 -0
  93. package/types/domain/usecases/SetupTowerDefenceProjectUseCase.d.ts.map +1 -0
  94. package/types/domain/usecases/StartPreparationUseCase.d.ts +1 -3
  95. package/types/domain/usecases/StartPreparationUseCase.d.ts.map +1 -1
  96. package/types/domain/usecases/UpdateIssueStatusByLabelUseCase.d.ts +0 -1
  97. package/types/domain/usecases/UpdateIssueStatusByLabelUseCase.d.ts.map +1 -1
  98. package/types/domain/usecases/adapter-interfaces/ProjectRepository.d.ts +3 -1
  99. package/types/domain/usecases/adapter-interfaces/ProjectRepository.d.ts.map +1 -1
@@ -5,6 +5,7 @@ import { Member } from '../entities/Member';
5
5
  import { DateRepository } from './adapter-interfaces/DateRepository';
6
6
  import { StoryObjectMap } from '../entities/StoryObjectMap';
7
7
  import { encodeForURI } from './utils';
8
+ import { DISABLED_STATUS_NAME } from '../entities/WorkflowStatus';
8
9
 
9
10
  export class AnalyzeStoriesUseCase {
10
11
  constructor(
@@ -21,7 +22,6 @@ export class AnalyzeStoriesUseCase {
21
22
  org: string;
22
23
  repo: string;
23
24
  urlOfStoryView: string;
24
- disabledStatus: string;
25
25
  storyObjectMap: StoryObjectMap;
26
26
  members: Member['name'][];
27
27
  }): Promise<void> => {
@@ -66,7 +66,7 @@ export class AnalyzeStoriesUseCase {
66
66
  ...story,
67
67
  };
68
68
 
69
- if (storyIssue.status === input.disabledStatus) {
69
+ if (storyIssue.status === DISABLED_STATUS_NAME) {
70
70
  phases.get('others')?.push(storyIssueObject);
71
71
  } else if (storyIssue.labels.includes('story:phase:finished-qa')) {
72
72
  phases.get('story:phase:finished-qa')?.push(storyIssueObject);
@@ -18,9 +18,9 @@ describe('ChangeStatusByStoryColorUseCase', () => {
18
18
  mockReviewStatus.id = 'status2';
19
19
  mockReviewStatus.name = 'InReview';
20
20
 
21
- const mockIceboxStatus = mock<FieldOption>();
22
- mockIceboxStatus.id = 'status3';
23
- mockIceboxStatus.name = 'Icebox';
21
+ const mockDisabledStatus = mock<FieldOption>();
22
+ mockDisabledStatus.id = 'status3';
23
+ mockDisabledStatus.name = 'Disabled';
24
24
 
25
25
  const basicProject = {
26
26
  ...mock<Project>(),
@@ -38,7 +38,7 @@ describe('ChangeStatusByStoryColorUseCase', () => {
38
38
  status: {
39
39
  name: 'Status Field',
40
40
  fieldId: 'statusFieldId',
41
- statuses: [mockStatus, mockReviewStatus, mockIceboxStatus],
41
+ statuses: [mockStatus, mockReviewStatus, mockDisabledStatus],
42
42
  },
43
43
  };
44
44
 
@@ -118,7 +118,6 @@ describe('ChangeStatusByStoryColorUseCase', () => {
118
118
  cacheUsed: false,
119
119
  org: 'testOrg',
120
120
  repo: 'testRepo',
121
- disabledStatus: 'Icebox',
122
121
  storyObjectMap: basicStoryObjectMap,
123
122
  },
124
123
  expectedCalls: {
@@ -133,7 +132,6 @@ describe('ChangeStatusByStoryColorUseCase', () => {
133
132
  cacheUsed: true,
134
133
  org: 'testOrg',
135
134
  repo: 'testRepo',
136
- disabledStatus: 'Icebox',
137
135
  storyObjectMap: basicStoryObjectMap,
138
136
  },
139
137
  expectedCalls: {
@@ -148,7 +146,6 @@ describe('ChangeStatusByStoryColorUseCase', () => {
148
146
  cacheUsed: false,
149
147
  org: 'testOrg',
150
148
  repo: 'testRepo',
151
- disabledStatus: 'Icebox',
152
149
  storyObjectMap: new Map([
153
150
  [
154
151
  'Story 1',
@@ -180,7 +177,6 @@ describe('ChangeStatusByStoryColorUseCase', () => {
180
177
  cacheUsed: false,
181
178
  org: 'testOrg',
182
179
  repo: 'testRepo',
183
- disabledStatus: 'Icebox',
184
180
  storyObjectMap: new Map([
185
181
  [
186
182
  'Story 1',
@@ -189,7 +185,7 @@ describe('ChangeStatusByStoryColorUseCase', () => {
189
185
  issues: [
190
186
  {
191
187
  ...basicStoryObject1.issues[0],
192
- status: 'Icebox',
188
+ status: 'Disabled',
193
189
  },
194
190
  ],
195
191
  },
@@ -245,7 +241,6 @@ describe('ChangeStatusByStoryColorUseCase', () => {
245
241
  cacheUsed: false,
246
242
  org: 'testOrg',
247
243
  repo: 'testRepo',
248
- disabledStatus: 'Icebox',
249
244
  storyObjectMap: basicStoryObjectMap,
250
245
  }),
251
246
  ).rejects.toThrow('First status is not found');
@@ -2,6 +2,7 @@ import { IssueRepository } from './adapter-interfaces/IssueRepository';
2
2
  import { Project } from '../entities/Project';
3
3
  import { DateRepository } from './adapter-interfaces/DateRepository';
4
4
  import { StoryObjectMap } from '../entities/StoryObjectMap';
5
+ import { DISABLED_STATUS_NAME } from '../entities/WorkflowStatus';
5
6
 
6
7
  export class ChangeStatusByStoryColorUseCase {
7
8
  constructor(
@@ -17,7 +18,6 @@ export class ChangeStatusByStoryColorUseCase {
17
18
  cacheUsed: boolean;
18
19
  org: string;
19
20
  repo: string;
20
- disabledStatus: string;
21
21
  storyObjectMap: StoryObjectMap;
22
22
  }): Promise<void> => {
23
23
  const firstStatus = input.project.status.statuses[0];
@@ -27,7 +27,7 @@ export class ChangeStatusByStoryColorUseCase {
27
27
  return;
28
28
  }
29
29
  const disabledStatusObject = input.project.status.statuses.find(
30
- (status) => status.name === input.disabledStatus,
30
+ (status) => status.name === DISABLED_STATUS_NAME,
31
31
  );
32
32
  if (!disabledStatusObject) {
33
33
  throw new Error('Disabled status is not found');
@@ -36,7 +36,7 @@ export class ChangeStatusByStoryColorUseCase {
36
36
  const isStoryDisabled = storyObject.story.color === 'GRAY';
37
37
  for (const issue of storyObject.issues) {
38
38
  if (isStoryDisabled) {
39
- if (issue.status && issue.status === input.disabledStatus) {
39
+ if (issue.status && issue.status === DISABLED_STATUS_NAME) {
40
40
  continue;
41
41
  }
42
42
  await this.issueRepository.updateStatus(
@@ -49,7 +49,7 @@ export class ChangeStatusByStoryColorUseCase {
49
49
  `This issue status is changed because the story is disabled.`,
50
50
  );
51
51
  } else if (!isStoryDisabled) {
52
- if (issue.status && issue.status !== input.disabledStatus) {
52
+ if (issue.status && issue.status !== DISABLED_STATUS_NAME) {
53
53
  continue;
54
54
  }
55
55
  await this.issueRepository.updateStatus(
@@ -99,7 +99,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
99
99
  issues: Issue[];
100
100
  cacheUsed: boolean;
101
101
  urlOfStoryView: string;
102
- disabledStatus: string;
103
102
  storyObjectMap: StoryObjectMap;
104
103
  };
105
104
  expectedThrowError?: Error;
@@ -122,7 +121,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
122
121
  issues: [basicStoryIssue1],
123
122
  cacheUsed: false,
124
123
  urlOfStoryView: 'https://example.com',
125
- disabledStatus: 'Closed',
126
124
  storyObjectMap: basicStoryObjectMap,
127
125
  },
128
126
  expectedCreateNewIssueCalls: [],
@@ -137,7 +135,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
137
135
  issues: [basicStoryIssue1],
138
136
  cacheUsed: true,
139
137
  urlOfStoryView: 'https://example.com',
140
- disabledStatus: 'Closed',
141
138
  storyObjectMap: basicStoryObjectMap,
142
139
  },
143
140
  expectedCreateNewIssueCalls: [],
@@ -152,7 +149,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
152
149
  issues: [basicStoryIssue1],
153
150
  cacheUsed: false,
154
151
  urlOfStoryView: 'https://example.com',
155
- disabledStatus: 'Closed',
156
152
  storyObjectMap: regularStoryObjectMap,
157
153
  },
158
154
  expectedCreateNewIssueCalls: [],
@@ -167,7 +163,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
167
163
  issues: [],
168
164
  cacheUsed: false,
169
165
  urlOfStoryView: 'https://example.com',
170
- disabledStatus: 'Closed',
171
166
  storyObjectMap: basicStoryObjectMap,
172
167
  },
173
168
  expectedThrowError: new Error('Story issue not found: Story 1'),
@@ -194,7 +189,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
194
189
  ],
195
190
  cacheUsed: false,
196
191
  urlOfStoryView: 'https://example.com',
197
- disabledStatus: 'Disabled',
198
192
  storyObjectMap: basicStoryObjectMap,
199
193
  },
200
194
  expectedCreateNewIssueCalls: [],
@@ -209,7 +203,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
209
203
  issues: [basicStoryIssue1, basicStoryIssue2],
210
204
  cacheUsed: false,
211
205
  urlOfStoryView: 'https://example.com',
212
- disabledStatus: 'Closed',
213
206
  storyObjectMap: basicStoryObjectMap,
214
207
  },
215
208
  expectedCreateNewIssueCalls: [
@@ -365,7 +358,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
365
358
  ],
366
359
  cacheUsed: false,
367
360
  urlOfStoryView: 'https://example.com',
368
- disabledStatus: 'Closed',
369
361
  storyObjectMap: new Map([['Story 1', basicStoryObject1]]),
370
362
  },
371
363
  expectedCreateNewIssueCalls: [
@@ -428,7 +420,6 @@ describe('ConvertCheckboxToIssueInStoryIssueUseCase', () => {
428
420
  ],
429
421
  cacheUsed: false,
430
422
  urlOfStoryView: 'https://example.com',
431
- disabledStatus: 'Closed',
432
423
  storyObjectMap: new Map([
433
424
  [
434
425
  'Story 1',
@@ -470,7 +461,6 @@ Some description without checkboxes`,
470
461
  ],
471
462
  cacheUsed: false,
472
463
  urlOfStoryView: 'https://example.com',
473
- disabledStatus: 'Closed',
474
464
  storyObjectMap: basicStoryObjectMap,
475
465
  },
476
466
  expectedCreateNewIssueCalls: [
@@ -624,7 +614,6 @@ Some description without checkboxes`,
624
614
  ],
625
615
  cacheUsed: false,
626
616
  urlOfStoryView: 'https://example.com',
627
- disabledStatus: 'Closed',
628
617
  storyObjectMap: new Map([
629
618
  [
630
619
  'Story 1',
@@ -3,6 +3,7 @@ import { IssueRepository } from './adapter-interfaces/IssueRepository';
3
3
  import { Project } from '../entities/Project';
4
4
  import { StoryObjectMap } from '../entities/StoryObjectMap';
5
5
  import { encodeForURI } from './utils';
6
+ import { DISABLED_STATUS_NAME } from '../entities/WorkflowStatus';
6
7
 
7
8
  export class ConvertCheckboxToIssueInStoryIssueUseCase {
8
9
  constructor(
@@ -17,7 +18,6 @@ export class ConvertCheckboxToIssueInStoryIssueUseCase {
17
18
  issues: Issue[];
18
19
  cacheUsed: boolean;
19
20
  urlOfStoryView: string;
20
- disabledStatus: string;
21
21
  storyObjectMap: StoryObjectMap;
22
22
  }): Promise<void> => {
23
23
  const story = input.project.story;
@@ -36,7 +36,7 @@ export class ConvertCheckboxToIssueInStoryIssueUseCase {
36
36
  throw new Error(`Story issue not found: ${storyOption.name}`);
37
37
  } else if (
38
38
  storyIssue.isClosed ||
39
- storyIssue.status === input.disabledStatus
39
+ storyIssue.status === DISABLED_STATUS_NAME
40
40
  ) {
41
41
  continue;
42
42
  }
@@ -5,6 +5,7 @@ import { Member } from '../entities/Member';
5
5
  import { DateRepository } from './adapter-interfaces/DateRepository';
6
6
  import { StoryObjectMap } from '../entities/StoryObjectMap';
7
7
  import { encodeForURI } from './utils';
8
+ import { DISABLED_STATUS_NAME } from '../entities/WorkflowStatus';
8
9
 
9
10
  export class CreateEstimationIssueUseCase {
10
11
  constructor(
@@ -24,7 +25,6 @@ export class CreateEstimationIssueUseCase {
24
25
  org: string;
25
26
  repo: string;
26
27
  urlOfStoryView: string;
27
- disabledStatus: string;
28
28
  storyObjectMap: StoryObjectMap;
29
29
  }): Promise<void> => {
30
30
  const story = input.project.story;
@@ -66,7 +66,7 @@ export class CreateEstimationIssueUseCase {
66
66
  issueInStory.isClosed ||
67
67
  issueInStory.isPr ||
68
68
  issueInStory.labels.includes('story') ||
69
- issueInStory.status === input.disabledStatus
69
+ issueInStory.status === DISABLED_STATUS_NAME
70
70
  ) {
71
71
  continue;
72
72
  }
@@ -84,7 +84,6 @@ describe('CreateNewStoryByLabelUseCase', () => {
84
84
  cacheUsed: false,
85
85
  org: 'testOrg',
86
86
  repo: 'testRepo',
87
- disabledStatus: 'Icebox',
88
87
  storyObjectMap: new Map([['Story 1', storyObjectWithNewStoryIssues]]),
89
88
  });
90
89
 
@@ -105,7 +104,6 @@ describe('CreateNewStoryByLabelUseCase', () => {
105
104
  cacheUsed: false,
106
105
  org: 'testOrg',
107
106
  repo: 'testRepo',
108
- disabledStatus: 'Icebox',
109
107
  storyObjectMap: new Map([
110
108
  ['Story 1', storyObjectWithoutNewStoryIssues],
111
109
  ]),
@@ -142,7 +140,6 @@ describe('CreateNewStoryByLabelUseCase', () => {
142
140
  cacheUsed: false,
143
141
  org: 'testOrg',
144
142
  repo: 'testRepo',
145
- disabledStatus: 'Icebox',
146
143
  storyObjectMap: new Map([['Story 1', storyObjectWithNewStoryIssues]]),
147
144
  });
148
145
 
@@ -239,7 +236,6 @@ describe('CreateNewStoryByLabelUseCase', () => {
239
236
  cacheUsed: false,
240
237
  org: 'testOrg',
241
238
  repo: 'testRepo',
242
- disabledStatus: 'Icebox',
243
239
  storyObjectMap: new Map([['Story 1', storyObject]]),
244
240
  });
245
241
 
@@ -18,7 +18,6 @@ export class CreateNewStoryByLabelUseCase {
18
18
  cacheUsed: boolean;
19
19
  org: string;
20
20
  repo: string;
21
- disabledStatus: string;
22
21
  storyObjectMap: StoryObjectMap;
23
22
  }): Promise<void> => {
24
23
  const projectStory = input.project.story;
@@ -22,6 +22,7 @@ import { UpdateIssueStatusByLabelUseCase } from './UpdateIssueStatusByLabelUseCa
22
22
  import { StartPreparationUseCase } from './StartPreparationUseCase';
23
23
  import { NotifyFinishedIssuePreparationUseCase } from './NotifyFinishedIssuePreparationUseCase';
24
24
  import { RevertOrphanedPreparationUseCase } from './RevertOrphanedPreparationUseCase';
25
+ import { SetupTowerDefenceProjectUseCase } from './SetupTowerDefenceProjectUseCase';
25
26
 
26
27
  describe('HandleScheduledEventUseCase', () => {
27
28
  describe('createTargetDateTimes', () => {
@@ -80,6 +81,8 @@ describe('HandleScheduledEventUseCase', () => {
80
81
  });
81
82
 
82
83
  describe('run', () => {
84
+ const mockSetupTowerDefenceProjectUseCase =
85
+ mock<SetupTowerDefenceProjectUseCase>();
83
86
  const mockActionAnnouncementUseCase = mock<ActionAnnouncementUseCase>();
84
87
  const mockSetWorkflowManagementIssueToStoryUseCase =
85
88
  mock<SetWorkflowManagementIssueToStoryUseCase>();
@@ -115,6 +118,7 @@ describe('HandleScheduledEventUseCase', () => {
115
118
  const mockIssueRepository = mock<IssueRepository>();
116
119
 
117
120
  const useCase = new HandleScheduledEventUseCase(
121
+ mockSetupTowerDefenceProjectUseCase,
118
122
  mockActionAnnouncementUseCase,
119
123
  mockSetWorkflowManagementIssueToStoryUseCase,
120
124
  mockClearPastNextActionDateHourUseCase,
@@ -166,8 +170,6 @@ describe('HandleScheduledEventUseCase', () => {
166
170
  spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
167
171
  },
168
172
  urlOfStoryView: 'https://github.com/test-org/test-project/issues',
169
- disabledStatus: 'disabled',
170
- defaultStatus: null,
171
173
  disabled: false,
172
174
  allowIssueCacheMinutes: 60,
173
175
  };
@@ -190,8 +192,6 @@ describe('HandleScheduledEventUseCase', () => {
190
192
  spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
191
193
  },
192
194
  urlOfStoryView: 'https://github.com/test-org/test-project/issues',
193
- disabledStatus: 'disabled',
194
- defaultStatus: 'ToDo',
195
195
  disabled: false,
196
196
  allowIssueCacheMinutes: 60,
197
197
  };
@@ -202,35 +202,6 @@ describe('HandleScheduledEventUseCase', () => {
202
202
  expect(mockUpdateIssueStatusByLabelUseCase.run).toHaveBeenCalledWith({
203
203
  project: mockProject,
204
204
  issues: [],
205
- defaultStatus: 'ToDo',
206
- });
207
- });
208
-
209
- it('should accept null for defaultStatus parameter', async () => {
210
- const input = {
211
- projectName: 'test-project',
212
- org: 'test-org',
213
- projectUrl: 'https://github.com/test-org/test-project',
214
- manager: 'test-manager',
215
- workingReport: {
216
- repo: 'test-repo',
217
- members: ['member1'],
218
- spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
219
- },
220
- urlOfStoryView: 'https://github.com/test-org/test-project/issues',
221
- disabledStatus: 'disabled',
222
- defaultStatus: null,
223
- disabled: false,
224
- allowIssueCacheMinutes: 60,
225
- };
226
-
227
- const mockProject = mock<Project>();
228
- mockProjectRepository.getProject.mockResolvedValue(mockProject);
229
- await useCase.run(input);
230
- expect(mockUpdateIssueStatusByLabelUseCase.run).toHaveBeenCalledWith({
231
- project: mockProject,
232
- issues: [],
233
- defaultStatus: null,
234
205
  });
235
206
  });
236
207
 
@@ -246,8 +217,6 @@ describe('HandleScheduledEventUseCase', () => {
246
217
  spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
247
218
  },
248
219
  urlOfStoryView: 'https://github.com/test-org/test-project/issues',
249
- disabledStatus: 'disabled',
250
- defaultStatus: null,
251
220
  disabled: true,
252
221
  allowIssueCacheMinutes: 60,
253
222
  };
@@ -271,8 +240,6 @@ describe('HandleScheduledEventUseCase', () => {
271
240
  spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
272
241
  },
273
242
  urlOfStoryView: 'https://github.com/test-org/test-project/issues',
274
- disabledStatus: 'disabled',
275
- defaultStatus: null,
276
243
  disabled: false,
277
244
  allowIssueCacheMinutes: 60,
278
245
  };
@@ -296,8 +263,6 @@ describe('HandleScheduledEventUseCase', () => {
296
263
  spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
297
264
  },
298
265
  urlOfStoryView: 'https://github.com/test-org/test-project/issues',
299
- disabledStatus: 'disabled',
300
- defaultStatus: null,
301
266
  disabled: false,
302
267
  allowIssueCacheMinutes: 120,
303
268
  };
@@ -323,8 +288,6 @@ describe('HandleScheduledEventUseCase', () => {
323
288
  spreadsheetUrl: 'https://docs.google.com/spreadsheets/test',
324
289
  },
325
290
  urlOfStoryView: 'https://github.com/test-org/test-project/issues',
326
- disabledStatus: 'disabled',
327
- defaultStatus: null,
328
291
  disabled: false,
329
292
  allowIssueCacheMinutes: 60,
330
293
  };
@@ -22,6 +22,8 @@ import { UpdateIssueStatusByLabelUseCase } from './UpdateIssueStatusByLabelUseCa
22
22
  import { StartPreparationUseCase } from './StartPreparationUseCase';
23
23
  import { NotifyFinishedIssuePreparationUseCase } from './NotifyFinishedIssuePreparationUseCase';
24
24
  import { RevertOrphanedPreparationUseCase } from './RevertOrphanedPreparationUseCase';
25
+ import { SetupTowerDefenceProjectUseCase } from './SetupTowerDefenceProjectUseCase';
26
+ import { PREPARATION_STATUS_NAME } from '../entities/WorkflowStatus';
25
27
 
26
28
  export class ProjectNotFoundError extends Error {
27
29
  constructor(message: string) {
@@ -32,6 +34,7 @@ export class ProjectNotFoundError extends Error {
32
34
 
33
35
  export class HandleScheduledEventUseCase {
34
36
  constructor(
37
+ readonly setupTowerDefenceProjectUseCase: SetupTowerDefenceProjectUseCase,
35
38
  readonly actionAnnouncementUseCase: ActionAnnouncementUseCase,
36
39
  readonly setWorkflowManagementIssueToStoryUseCase: SetWorkflowManagementIssueToStoryUseCase,
37
40
  readonly clearPastNextActionUseCase: ClearPastNextActionDateHourUseCase,
@@ -65,13 +68,9 @@ export class HandleScheduledEventUseCase {
65
68
  spreadsheetUrl: string;
66
69
  };
67
70
  urlOfStoryView: string;
68
- disabledStatus: string;
69
- defaultStatus: string | null;
70
71
  disabled: boolean;
71
72
  allowIssueCacheMinutes: number;
72
73
  startPreparation?: {
73
- awaitingWorkspaceStatus: string;
74
- preparationStatus: string;
75
74
  defaultAgentName: string;
76
75
  defaultLlmModelName?: string | null;
77
76
  defaultLlmAgentName?: string | null;
@@ -85,9 +84,6 @@ export class HandleScheduledEventUseCase {
85
84
  awLogStaleThresholdMinutes?: number;
86
85
  } | null;
87
86
  notifyFinishedPreparation?: {
88
- preparationStatus: string;
89
- awaitingWorkspaceStatus: string;
90
- awaitingQualityCheckStatus: string;
91
87
  thresholdForAutoReject: number;
92
88
  workflowBlockerResolvedWebhookUrl: string | null;
93
89
  } | null;
@@ -101,6 +97,9 @@ export class HandleScheduledEventUseCase {
101
97
  if (input.disabled) {
102
98
  return null;
103
99
  }
100
+ await this.setupTowerDefenceProjectUseCase.run({
101
+ projectUrl: input.projectUrl,
102
+ });
104
103
  const projectId = await this.projectRepository.findProjectIdByUrl(
105
104
  input.projectUrl,
106
105
  );
@@ -297,7 +296,6 @@ ${JSON.stringify(e)}
297
296
  org: input.org,
298
297
  repo: input.workingReport.repo,
299
298
  urlOfStoryView: input.urlOfStoryView,
300
- disabledStatus: input.disabledStatus,
301
299
  storyObjectMap: storyObjectMap,
302
300
  });
303
301
  await this.convertCheckboxToIssueInStoryIssueUseCase.run({
@@ -305,7 +303,6 @@ ${JSON.stringify(e)}
305
303
  issues,
306
304
  cacheUsed,
307
305
  urlOfStoryView: input.urlOfStoryView,
308
- disabledStatus: input.disabledStatus,
309
306
  storyObjectMap: storyObjectMap,
310
307
  });
311
308
  await this.changeStatusByStoryColorUseCase.run({
@@ -313,7 +310,6 @@ ${JSON.stringify(e)}
313
310
  cacheUsed,
314
311
  org: input.org,
315
312
  repo: input.workingReport.repo,
316
- disabledStatus: input.disabledStatus,
317
313
  storyObjectMap: storyObjectMap,
318
314
  });
319
315
  await this.createNewStoryByLabelUseCase.run({
@@ -321,7 +317,6 @@ ${JSON.stringify(e)}
321
317
  cacheUsed,
322
318
  org: input.org,
323
319
  repo: input.workingReport.repo,
324
- disabledStatus: input.disabledStatus,
325
320
  storyObjectMap: storyObjectMap,
326
321
  });
327
322
  await this.assignNoAssigneeIssueToManagerUseCase.run({
@@ -332,17 +327,11 @@ ${JSON.stringify(e)}
332
327
  await this.updateIssueStatusByLabelUseCase.run({
333
328
  project,
334
329
  issues,
335
- defaultStatus: input.defaultStatus,
336
330
  });
337
331
  if (input.startPreparation) {
338
332
  if (input.startPreparation.preparationProcessCheckCommand) {
339
333
  await this.revertOrphanedPreparationUseCase.run({
340
334
  projectUrl: input.projectUrl,
341
- preparationStatus: input.startPreparation.preparationStatus,
342
- awaitingWorkspaceStatus:
343
- input.startPreparation.awaitingWorkspaceStatus,
344
- awaitingQualityCheckStatus:
345
- input.notifyFinishedPreparation?.awaitingQualityCheckStatus,
346
335
  allowIssueCacheMinutes: input.allowIssueCacheMinutes,
347
336
  preparationProcessCheckCommand:
348
337
  input.startPreparation.preparationProcessCheckCommand,
@@ -353,8 +342,6 @@ ${JSON.stringify(e)}
353
342
  }
354
343
  await this.startPreparationUseCase.run({
355
344
  projectUrl: input.projectUrl,
356
- awaitingWorkspaceStatus: input.startPreparation.awaitingWorkspaceStatus,
357
- preparationStatus: input.startPreparation.preparationStatus,
358
345
  defaultAgentName: input.startPreparation.defaultAgentName,
359
346
  defaultLlmModelName: input.startPreparation.defaultLlmModelName ?? null,
360
347
  defaultLlmAgentName: input.startPreparation.defaultLlmAgentName ?? null,
@@ -371,21 +358,16 @@ ${JSON.stringify(e)}
371
358
  if (input.notifyFinishedPreparation) {
372
359
  const notifyFinishedPreparation = input.notifyFinishedPreparation;
373
360
  const preparationIssues = issues.filter(
374
- (issue) => issue.status === notifyFinishedPreparation.preparationStatus,
361
+ (issue) => issue.status === PREPARATION_STATUS_NAME,
375
362
  );
376
363
  for (const issue of preparationIssues) {
377
364
  await this.notifyFinishedIssuePreparationUseCase.run({
378
365
  projectUrl: input.projectUrl,
379
366
  issueUrl: issue.url,
380
- preparationStatus: input.notifyFinishedPreparation.preparationStatus,
381
- awaitingWorkspaceStatus:
382
- input.notifyFinishedPreparation.awaitingWorkspaceStatus,
383
- awaitingQualityCheckStatus:
384
- input.notifyFinishedPreparation.awaitingQualityCheckStatus,
385
367
  thresholdForAutoReject:
386
- input.notifyFinishedPreparation.thresholdForAutoReject,
368
+ notifyFinishedPreparation.thresholdForAutoReject,
387
369
  workflowBlockerResolvedWebhookUrl:
388
- input.notifyFinishedPreparation.workflowBlockerResolvedWebhookUrl,
370
+ notifyFinishedPreparation.workflowBlockerResolvedWebhookUrl,
389
371
  });
390
372
  }
391
373
  }