github-issue-tower-defence-management 1.44.5 → 1.44.7
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/.github/workflows/umino-project.yml +33 -9
- package/CHANGELOG.md +14 -0
- package/README.md +2 -2
- package/bin/adapter/entry-points/cli/index.js +3 -1
- package/bin/adapter/entry-points/cli/index.js.map +1 -1
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +1 -1
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
- package/bin/domain/usecases/HandleScheduledEventUseCase.js +1 -0
- package/bin/domain/usecases/HandleScheduledEventUseCase.js.map +1 -1
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js +15 -0
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js.map +1 -1
- package/bin/domain/usecases/RevertOrphanedPreparationUseCase.js +65 -3
- package/bin/domain/usecases/RevertOrphanedPreparationUseCase.js.map +1 -1
- package/package.json +1 -1
- package/src/adapter/entry-points/cli/index.ts +5 -0
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +1 -0
- package/src/domain/usecases/HandleScheduledEventUseCase.ts +2 -0
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.test.ts +56 -1
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.ts +45 -0
- package/src/domain/usecases/RevertOrphanedPreparationUseCase.test.ts +316 -11
- package/src/domain/usecases/RevertOrphanedPreparationUseCase.ts +107 -11
- package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
- package/types/domain/usecases/HandleScheduledEventUseCase.d.ts.map +1 -1
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts +1 -1
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts.map +1 -1
- package/types/domain/usecases/RevertOrphanedPreparationUseCase.d.ts +8 -2
- package/types/domain/usecases/RevertOrphanedPreparationUseCase.d.ts.map +1 -1
|
@@ -12,7 +12,26 @@ const createMockProject = (overrides: Partial<Project> = {}): Project => ({
|
|
|
12
12
|
status: {
|
|
13
13
|
name: 'Status',
|
|
14
14
|
fieldId: 'field-1',
|
|
15
|
-
statuses: [
|
|
15
|
+
statuses: [
|
|
16
|
+
{
|
|
17
|
+
id: 'preparation-id',
|
|
18
|
+
name: 'Preparation',
|
|
19
|
+
color: 'YELLOW',
|
|
20
|
+
description: '',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'awaiting-workspace-id',
|
|
24
|
+
name: 'Awaiting Workspace',
|
|
25
|
+
color: 'GRAY',
|
|
26
|
+
description: '',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'awaiting-quality-check-id',
|
|
30
|
+
name: 'Awaiting Quality Check',
|
|
31
|
+
color: 'BLUE',
|
|
32
|
+
description: '',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
16
35
|
},
|
|
17
36
|
nextActionDate: null,
|
|
18
37
|
nextActionHour: null,
|
|
@@ -66,6 +85,7 @@ describe('NotifyFinishedIssuePreparationUseCase', () => {
|
|
|
66
85
|
let mockIssueRepository: {
|
|
67
86
|
get: jest.Mock;
|
|
68
87
|
update: jest.Mock;
|
|
88
|
+
updateStatus: jest.Mock;
|
|
69
89
|
updateNextActionDate: jest.Mock;
|
|
70
90
|
findRelatedOpenPRs: jest.Mock;
|
|
71
91
|
getStoryObjectMap: jest.Mock;
|
|
@@ -98,6 +118,7 @@ describe('NotifyFinishedIssuePreparationUseCase', () => {
|
|
|
98
118
|
getStoryObjectMap: jest.fn().mockResolvedValue(new Map()),
|
|
99
119
|
get: jest.fn(),
|
|
100
120
|
update: jest.fn(),
|
|
121
|
+
updateStatus: jest.fn(),
|
|
101
122
|
updateNextActionDate: jest.fn(),
|
|
102
123
|
findRelatedOpenPRs: jest.fn(),
|
|
103
124
|
getOpenPullRequest: jest.fn(),
|
|
@@ -222,6 +243,15 @@ describe('NotifyFinishedIssuePreparationUseCase', () => {
|
|
|
222
243
|
}),
|
|
223
244
|
mockProject,
|
|
224
245
|
);
|
|
246
|
+
expect(mockIssueRepository.updateStatus).toHaveBeenCalledTimes(1);
|
|
247
|
+
expect(mockIssueRepository.updateStatus).toHaveBeenCalledWith(
|
|
248
|
+
mockProject,
|
|
249
|
+
expect.objectContaining({
|
|
250
|
+
url: 'https://github.com/user/repo/issues/1',
|
|
251
|
+
status: 'Awaiting Quality Check',
|
|
252
|
+
}),
|
|
253
|
+
'awaiting-quality-check-id',
|
|
254
|
+
);
|
|
225
255
|
|
|
226
256
|
const expectedNextActionDate = new Date('2026-01-01T00:00:00Z');
|
|
227
257
|
expectedNextActionDate.setMonth(expectedNextActionDate.getMonth() + 1);
|
|
@@ -353,6 +383,11 @@ describe('NotifyFinishedIssuePreparationUseCase', () => {
|
|
|
353
383
|
expect.objectContaining({ status: 'Awaiting Workspace' }),
|
|
354
384
|
mockProject,
|
|
355
385
|
);
|
|
386
|
+
expect(mockIssueRepository.updateStatus).toHaveBeenCalledWith(
|
|
387
|
+
mockProject,
|
|
388
|
+
expect.objectContaining({ status: 'Awaiting Workspace' }),
|
|
389
|
+
'awaiting-workspace-id',
|
|
390
|
+
);
|
|
356
391
|
expect(mockIssueCommentRepository.createComment).toHaveBeenCalledWith(
|
|
357
392
|
expect.objectContaining({ url: 'https://github.com/user/repo/issues/1' }),
|
|
358
393
|
expect.stringContaining(
|
|
@@ -433,6 +468,11 @@ describe('NotifyFinishedIssuePreparationUseCase', () => {
|
|
|
433
468
|
expect.objectContaining({ status: 'Awaiting Workspace' }),
|
|
434
469
|
mockProject,
|
|
435
470
|
);
|
|
471
|
+
expect(mockIssueRepository.updateStatus).toHaveBeenCalledWith(
|
|
472
|
+
mockProject,
|
|
473
|
+
expect.objectContaining({ status: 'Awaiting Workspace' }),
|
|
474
|
+
'awaiting-workspace-id',
|
|
475
|
+
);
|
|
436
476
|
expect(mockIssueCommentRepository.createComment).toHaveBeenCalledWith(
|
|
437
477
|
expect.objectContaining({ url: 'https://github.com/user/repo/issues/1' }),
|
|
438
478
|
expect.stringContaining('Issue has next action date or hour set:'),
|
|
@@ -463,6 +503,11 @@ describe('NotifyFinishedIssuePreparationUseCase', () => {
|
|
|
463
503
|
expect.objectContaining({ status: 'Awaiting Workspace' }),
|
|
464
504
|
mockProject,
|
|
465
505
|
);
|
|
506
|
+
expect(mockIssueRepository.updateStatus).toHaveBeenCalledWith(
|
|
507
|
+
mockProject,
|
|
508
|
+
expect.objectContaining({ status: 'Awaiting Workspace' }),
|
|
509
|
+
'awaiting-workspace-id',
|
|
510
|
+
);
|
|
466
511
|
expect(mockIssueCommentRepository.createComment).toHaveBeenCalledWith(
|
|
467
512
|
expect.objectContaining({ url: 'https://github.com/user/repo/issues/1' }),
|
|
468
513
|
expect.stringContaining('nextActionHour=9'),
|
|
@@ -510,6 +555,11 @@ describe('NotifyFinishedIssuePreparationUseCase', () => {
|
|
|
510
555
|
}),
|
|
511
556
|
mockProject,
|
|
512
557
|
);
|
|
558
|
+
expect(mockIssueRepository.updateStatus).toHaveBeenCalledWith(
|
|
559
|
+
mockProject,
|
|
560
|
+
expect.objectContaining({ status: 'Awaiting Workspace' }),
|
|
561
|
+
'awaiting-workspace-id',
|
|
562
|
+
);
|
|
513
563
|
expect(mockIssueCommentRepository.createComment).toHaveBeenCalledWith(
|
|
514
564
|
expect.objectContaining({
|
|
515
565
|
url: 'https://github.com/user/repo/issues/1',
|
|
@@ -723,6 +773,11 @@ describe('NotifyFinishedIssuePreparationUseCase', () => {
|
|
|
723
773
|
}),
|
|
724
774
|
mockProject,
|
|
725
775
|
);
|
|
776
|
+
expect(mockIssueRepository.updateStatus).toHaveBeenCalledWith(
|
|
777
|
+
mockProject,
|
|
778
|
+
expect.objectContaining({ status: 'Awaiting Quality Check' }),
|
|
779
|
+
'awaiting-quality-check-id',
|
|
780
|
+
);
|
|
726
781
|
expect(mockIssueCommentRepository.createComment).toHaveBeenCalledWith(
|
|
727
782
|
expect.objectContaining({
|
|
728
783
|
url: 'https://github.com/user/repo/issues/1',
|
|
@@ -44,6 +44,7 @@ export class NotifyFinishedIssuePreparationUseCase {
|
|
|
44
44
|
IssueRepository,
|
|
45
45
|
| 'get'
|
|
46
46
|
| 'update'
|
|
47
|
+
| 'updateStatus'
|
|
47
48
|
| 'updateNextActionDate'
|
|
48
49
|
| 'findRelatedOpenPRs'
|
|
49
50
|
| 'getStoryObjectMap'
|
|
@@ -82,6 +83,25 @@ export class NotifyFinishedIssuePreparationUseCase {
|
|
|
82
83
|
project,
|
|
83
84
|
);
|
|
84
85
|
|
|
86
|
+
const awaitingWorkspaceStatusOption = project.status.statuses.find(
|
|
87
|
+
(s) => s.name === params.awaitingWorkspaceStatus,
|
|
88
|
+
);
|
|
89
|
+
if (!awaitingWorkspaceStatusOption) {
|
|
90
|
+
console.error(
|
|
91
|
+
`Awaiting workspace status option '${params.awaitingWorkspaceStatus}' not found in project.`,
|
|
92
|
+
);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const awaitingQualityCheckStatusOption = project.status.statuses.find(
|
|
96
|
+
(s) => s.name === params.awaitingQualityCheckStatus,
|
|
97
|
+
);
|
|
98
|
+
if (!awaitingQualityCheckStatusOption) {
|
|
99
|
+
console.error(
|
|
100
|
+
`Awaiting quality check status option '${params.awaitingQualityCheckStatus}' not found in project.`,
|
|
101
|
+
);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
85
105
|
const issue = await this.issueRepository.get(params.issueUrl, project);
|
|
86
106
|
|
|
87
107
|
if (!issue) {
|
|
@@ -120,6 +140,11 @@ export class NotifyFinishedIssuePreparationUseCase {
|
|
|
120
140
|
if (issue.dependedIssueUrls.length > 0) {
|
|
121
141
|
issue.status = params.awaitingWorkspaceStatus;
|
|
122
142
|
await this.issueRepository.update(issue, project);
|
|
143
|
+
await this.issueRepository.updateStatus(
|
|
144
|
+
project,
|
|
145
|
+
issue,
|
|
146
|
+
awaitingWorkspaceStatusOption.id,
|
|
147
|
+
);
|
|
123
148
|
await this.issueCommentRepository.createComment(
|
|
124
149
|
issue,
|
|
125
150
|
`Issue has dependent issue URLs: ${issue.dependedIssueUrls.join(', ')}`,
|
|
@@ -130,6 +155,11 @@ export class NotifyFinishedIssuePreparationUseCase {
|
|
|
130
155
|
if (issue.nextActionDate !== null || issue.nextActionHour !== null) {
|
|
131
156
|
issue.status = params.awaitingWorkspaceStatus;
|
|
132
157
|
await this.issueRepository.update(issue, project);
|
|
158
|
+
await this.issueRepository.updateStatus(
|
|
159
|
+
project,
|
|
160
|
+
issue,
|
|
161
|
+
awaitingWorkspaceStatusOption.id,
|
|
162
|
+
);
|
|
133
163
|
await this.issueCommentRepository.createComment(
|
|
134
164
|
issue,
|
|
135
165
|
`Issue has next action date or hour set: nextActionDate=${issue.nextActionDate?.toISOString() ?? 'null'}, nextActionHour=${issue.nextActionHour ?? 'null'}`,
|
|
@@ -165,6 +195,11 @@ export class NotifyFinishedIssuePreparationUseCase {
|
|
|
165
195
|
) {
|
|
166
196
|
issue.status = params.awaitingQualityCheckStatus;
|
|
167
197
|
await this.issueRepository.update(issue, project);
|
|
198
|
+
await this.issueRepository.updateStatus(
|
|
199
|
+
project,
|
|
200
|
+
issue,
|
|
201
|
+
awaitingQualityCheckStatusOption.id,
|
|
202
|
+
);
|
|
168
203
|
const escalationStatusLine =
|
|
169
204
|
rejections.length > 0
|
|
170
205
|
? rejectionStatusMessage
|
|
@@ -187,6 +222,11 @@ export class NotifyFinishedIssuePreparationUseCase {
|
|
|
187
222
|
if (rejections.length <= 0) {
|
|
188
223
|
issue.status = params.awaitingQualityCheckStatus;
|
|
189
224
|
await this.issueRepository.update(issue, project);
|
|
225
|
+
await this.issueRepository.updateStatus(
|
|
226
|
+
project,
|
|
227
|
+
issue,
|
|
228
|
+
awaitingQualityCheckStatusOption.id,
|
|
229
|
+
);
|
|
190
230
|
if (approvedPrUrl !== null) {
|
|
191
231
|
await this.setPrNextActionDate(approvedPrUrl, project);
|
|
192
232
|
}
|
|
@@ -200,6 +240,11 @@ export class NotifyFinishedIssuePreparationUseCase {
|
|
|
200
240
|
|
|
201
241
|
issue.status = params.awaitingWorkspaceStatus;
|
|
202
242
|
await this.issueRepository.update(issue, project);
|
|
243
|
+
await this.issueRepository.updateStatus(
|
|
244
|
+
project,
|
|
245
|
+
issue,
|
|
246
|
+
awaitingWorkspaceStatusOption.id,
|
|
247
|
+
);
|
|
203
248
|
|
|
204
249
|
await this.issueCommentRepository.createComment(
|
|
205
250
|
issue,
|