github-issue-tower-defence-management 1.31.0 → 1.33.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/.github/workflows/umino-project.yml +1 -0
- package/CHANGELOG.md +20 -0
- package/README.md +24 -0
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +101 -33
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
- package/bin/adapter/repositories/FetchWebhookRepository.js +10 -0
- package/bin/adapter/repositories/FetchWebhookRepository.js.map +1 -0
- package/bin/adapter/repositories/GitHubIssueCommentRepository.js +190 -0
- package/bin/adapter/repositories/GitHubIssueCommentRepository.js.map +1 -0
- package/bin/adapter/repositories/NodeLocalCommandRunner.js +34 -0
- package/bin/adapter/repositories/NodeLocalCommandRunner.js.map +1 -0
- package/bin/adapter/repositories/StubClaudeRepository.js +13 -0
- package/bin/adapter/repositories/StubClaudeRepository.js.map +1 -0
- package/bin/domain/usecases/HandleScheduledEventUseCase.js +29 -1
- package/bin/domain/usecases/HandleScheduledEventUseCase.js.map +1 -1
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js +73 -17
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js.map +1 -1
- package/bin/domain/usecases/adapter-interfaces/WebhookRepository.js +3 -0
- package/bin/domain/usecases/adapter-interfaces/WebhookRepository.js.map +1 -0
- package/package.json +1 -1
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.test.ts +23 -0
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +29 -2
- package/src/adapter/repositories/FetchWebhookRepository.ts +7 -0
- package/src/adapter/repositories/GitHubIssueCommentRepository.ts +291 -0
- package/src/adapter/repositories/NodeLocalCommandRunner.test.ts +80 -0
- package/src/adapter/repositories/NodeLocalCommandRunner.ts +37 -0
- package/src/adapter/repositories/StubClaudeRepository.test.ts +19 -0
- package/src/adapter/repositories/StubClaudeRepository.ts +12 -0
- package/src/domain/usecases/HandleScheduledEventUseCase.test.ts +31 -0
- package/src/domain/usecases/HandleScheduledEventUseCase.ts +51 -0
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.test.ts +722 -16
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.ts +117 -20
- package/src/domain/usecases/adapter-interfaces/IssueRepository.ts +2 -0
- package/src/domain/usecases/adapter-interfaces/WebhookRepository.ts +3 -0
- package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
- package/types/adapter/repositories/FetchWebhookRepository.d.ts +5 -0
- package/types/adapter/repositories/FetchWebhookRepository.d.ts.map +1 -0
- package/types/adapter/repositories/GitHubIssueCommentRepository.d.ts +12 -0
- package/types/adapter/repositories/GitHubIssueCommentRepository.d.ts.map +1 -0
- package/types/adapter/repositories/NodeLocalCommandRunner.d.ts +9 -0
- package/types/adapter/repositories/NodeLocalCommandRunner.d.ts.map +1 -0
- package/types/adapter/repositories/StubClaudeRepository.d.ts +7 -0
- package/types/adapter/repositories/StubClaudeRepository.d.ts.map +1 -0
- package/types/domain/usecases/HandleScheduledEventUseCase.d.ts +19 -1
- package/types/domain/usecases/HandleScheduledEventUseCase.d.ts.map +1 -1
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts +5 -1
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts +2 -0
- package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/WebhookRepository.d.ts +4 -0
- package/types/domain/usecases/adapter-interfaces/WebhookRepository.d.ts.map +1 -0
|
@@ -183,6 +183,7 @@ jobs:
|
|
|
183
183
|
steps:
|
|
184
184
|
- uses: nearform-actions/github-action-check-linked-issues@v1
|
|
185
185
|
id: check-linked-issues
|
|
186
|
+
if: github.event.pull_request.user.login != 'dependabot[bot]'
|
|
186
187
|
with:
|
|
187
188
|
exclude-branches: 'release/**, dependabot/**, project-common/**, renovate/**'
|
|
188
189
|
github-token: ${{ secrets.GH_TOKEN }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [1.33.0](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.32.0...v1.33.0) (2026-03-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **core:** remove non-null assertion in HandleScheduledEventUseCase filter ([b7c8cfd](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/commit/b7c8cfd038f84cd7e9c833a9a0caf8abce79adb9))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **core:** integrate NotifyFinishedIssuePreparationUseCase into scheduled event handling ([afe84bf](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/commit/afe84bff4984a2503f54c8ceb43e50eafca44931)), closes [npm-cli-#issue-preparator](https://github.com/npm-cli-/issues/issue-preparator) [#339](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/issues/339)
|
|
12
|
+
* **core:** migrate NotifyFinishedIssuePreparationUseCase to match preparator ([e19a42d](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/commit/e19a42d3e1853183670488d156286af0394f13d4))
|
|
13
|
+
|
|
14
|
+
# [1.32.0](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.31.0...v1.32.0) (2026-03-21)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **core:** integrate StartPreparationUseCase into HandleScheduledEventUseCase chain ([d346cfc](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/commit/d346cfc65480bd1f8b86b8d915404bc975abe97a))
|
|
20
|
+
|
|
1
21
|
# [1.31.0](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.30.2...v1.31.0) (2026-03-16)
|
|
2
22
|
|
|
3
23
|
|
package/README.md
CHANGED
|
@@ -54,6 +54,18 @@ workingReport:
|
|
|
54
54
|
reportIssueLabels: # Array of issue labels
|
|
55
55
|
- string
|
|
56
56
|
- string
|
|
57
|
+
startPreparation?: # Optional: Enable automatic issue preparation workflow
|
|
58
|
+
awaitingWorkspaceStatus: string # Project status name for issues awaiting workspace
|
|
59
|
+
preparationStatus: string # Project status name for issues in preparation
|
|
60
|
+
defaultAgentName: string # Default agent name to assign for preparation
|
|
61
|
+
logFilePath?: string # Optional: Path to log file for preparation output
|
|
62
|
+
maximumPreparingIssuesCount: number | null # Max concurrent preparing issues (null = unlimited)
|
|
63
|
+
notifyFinishedPreparation?: # Optional: Enable notification when issue preparation is finished
|
|
64
|
+
preparationStatus: string # Status name for issues in preparation
|
|
65
|
+
awaitingWorkspaceStatus: string # Status name for issues awaiting workspace
|
|
66
|
+
awaitingQualityCheckStatus: string # Status name for issues awaiting quality check
|
|
67
|
+
thresholdForAutoReject: number # Number of auto-rejections before escalating to quality check
|
|
68
|
+
workflowBlockerResolvedWebhookUrl: string | null # Webhook URL template called when a workflow blocker issue passes checks. Supports {URL} and {MESSAGE} placeholders
|
|
57
69
|
```
|
|
58
70
|
|
|
59
71
|
Example:
|
|
@@ -84,6 +96,18 @@ workingReport:
|
|
|
84
96
|
- 'working-time'
|
|
85
97
|
slack:
|
|
86
98
|
userToken: 'xoxp-xxx'
|
|
99
|
+
startPreparation:
|
|
100
|
+
awaitingWorkspaceStatus: 'Awaiting Workspace'
|
|
101
|
+
preparationStatus: 'Preparation'
|
|
102
|
+
defaultAgentName: 'umino-bot'
|
|
103
|
+
logFilePath: '/tmp/preparation.log'
|
|
104
|
+
maximumPreparingIssuesCount: 3
|
|
105
|
+
notifyFinishedPreparation:
|
|
106
|
+
preparationStatus: 'Preparation'
|
|
107
|
+
awaitingWorkspaceStatus: 'Awaiting Workspace'
|
|
108
|
+
awaitingQualityCheckStatus: 'Awaiting Quality Check'
|
|
109
|
+
thresholdForAutoReject: 3
|
|
110
|
+
workflowBlockerResolvedWebhookUrl: 'https://example.com/webhook?url={URL}&msg={MESSAGE}'
|
|
87
111
|
```
|
|
88
112
|
|
|
89
113
|
### Slack User Token
|
|
@@ -56,6 +56,12 @@ const CreateNewStoryByLabelUseCase_1 = require("../../../domain/usecases/CreateN
|
|
|
56
56
|
const CheerioProjectRepository_1 = require("../../repositories/CheerioProjectRepository");
|
|
57
57
|
const AssignNoAssigneeIssueToManagerUseCase_1 = require("../../../domain/usecases/AssignNoAssigneeIssueToManagerUseCase");
|
|
58
58
|
const UpdateIssueStatusByLabelUseCase_1 = require("../../../domain/usecases/UpdateIssueStatusByLabelUseCase");
|
|
59
|
+
const StartPreparationUseCase_1 = require("../../../domain/usecases/StartPreparationUseCase");
|
|
60
|
+
const NodeLocalCommandRunner_1 = require("../../repositories/NodeLocalCommandRunner");
|
|
61
|
+
const StubClaudeRepository_1 = require("../../repositories/StubClaudeRepository");
|
|
62
|
+
const NotifyFinishedIssuePreparationUseCase_1 = require("../../../domain/usecases/NotifyFinishedIssuePreparationUseCase");
|
|
63
|
+
const GitHubIssueCommentRepository_1 = require("../../repositories/GitHubIssueCommentRepository");
|
|
64
|
+
const FetchWebhookRepository_1 = require("../../repositories/FetchWebhookRepository");
|
|
59
65
|
class HandleScheduledEventUseCaseHandler {
|
|
60
66
|
constructor() {
|
|
61
67
|
this.handle = async (configFilePath, verbose) => {
|
|
@@ -70,8 +76,8 @@ class HandleScheduledEventUseCaseHandler {
|
|
|
70
76
|
});
|
|
71
77
|
const configFileContent = fs_1.default.readFileSync(configFilePath, 'utf8');
|
|
72
78
|
const input = yaml_1.default.parse(configFileContent);
|
|
73
|
-
if (!(() => { const _io0 = input => "string" === typeof input.projectName && "string" === typeof input.org && "string" === typeof input.projectUrl && "string" === typeof input.manager && ("object" === typeof input.workingReport && null !== input.workingReport && _io1(input.workingReport)) && "string" === typeof input.urlOfStoryView && "string" === typeof input.disabledStatus && (null === input.defaultStatus || "string" === typeof input.defaultStatus) && "boolean" === typeof input.disabled && "number" === typeof input.allowIssueCacheMinutes && ("object" === typeof input.credentials && null !== input.credentials &&
|
|
74
|
-
throw new Error(`Invalid input: ${JSON.stringify(input)}\n\n${JSON.stringify((() => { const _io0 = input => "string" === typeof input.projectName && "string" === typeof input.org && "string" === typeof input.projectUrl && "string" === typeof input.manager && ("object" === typeof input.workingReport && null !== input.workingReport && _io1(input.workingReport)) && "string" === typeof input.urlOfStoryView && "string" === typeof input.disabledStatus && (null === input.defaultStatus || "string" === typeof input.defaultStatus) && "boolean" === typeof input.disabled && "number" === typeof input.allowIssueCacheMinutes && ("object" === typeof input.credentials && null !== input.credentials &&
|
|
79
|
+
if (!(() => { const _io0 = input => "string" === typeof input.projectName && "string" === typeof input.org && "string" === typeof input.projectUrl && "string" === typeof input.manager && ("object" === typeof input.workingReport && null !== input.workingReport && _io1(input.workingReport)) && "string" === typeof input.urlOfStoryView && "string" === typeof input.disabledStatus && (null === input.defaultStatus || "string" === typeof input.defaultStatus) && "boolean" === typeof input.disabled && "number" === typeof input.allowIssueCacheMinutes && (null === input.startPreparation || undefined === input.startPreparation || "object" === typeof input.startPreparation && null !== input.startPreparation && _io2(input.startPreparation)) && (null === input.notifyFinishedPreparation || undefined === input.notifyFinishedPreparation || "object" === typeof input.notifyFinishedPreparation && null !== input.notifyFinishedPreparation && _io3(input.notifyFinishedPreparation)) && ("object" === typeof input.credentials && null !== input.credentials && _io4(input.credentials)); const _io1 = input => "string" === typeof input.repo && (Array.isArray(input.members) && input.members.every(elem => "string" === typeof elem)) && "string" === typeof input.spreadsheetUrl; const _io2 = input => "string" === typeof input.awaitingWorkspaceStatus && "string" === typeof input.preparationStatus && "string" === typeof input.defaultAgentName && (undefined === input.logFilePath || "string" === typeof input.logFilePath) && (null === input.maximumPreparingIssuesCount || "number" === typeof input.maximumPreparingIssuesCount); const _io3 = input => "string" === typeof input.preparationStatus && "string" === typeof input.awaitingWorkspaceStatus && "string" === typeof input.awaitingQualityCheckStatus && "number" === typeof input.thresholdForAutoReject && (null === input.workflowBlockerResolvedWebhookUrl || "string" === typeof input.workflowBlockerResolvedWebhookUrl); const _io4 = input => "object" === typeof input.manager && null !== input.manager && _io5(input.manager) && ("object" === typeof input.bot && null !== input.bot && _io9(input.bot)); const _io5 = input => "object" === typeof input.github && null !== input.github && _io6(input.github) && ("object" === typeof input.slack && null !== input.slack && _io7(input.slack)) && ("object" === typeof input.googleServiceAccount && null !== input.googleServiceAccount && _io8(input.googleServiceAccount)); const _io6 = input => "string" === typeof input.token; const _io7 = input => "string" === typeof input.userToken; const _io8 = input => "string" === typeof input.serviceAccountKey; const _io9 = input => "object" === typeof input.github && null !== input.github && _io10(input.github); const _io10 = input => "string" === typeof input.token && (undefined === input.name || "string" === typeof input.name) && (undefined === input.password || "string" === typeof input.password) && (undefined === input.authenticatorKey || "string" === typeof input.authenticatorKey); return input => "object" === typeof input && null !== input && _io0(input); })()(input)) {
|
|
80
|
+
throw new Error(`Invalid input: ${JSON.stringify(input)}\n\n${JSON.stringify((() => { const _io0 = input => "string" === typeof input.projectName && "string" === typeof input.org && "string" === typeof input.projectUrl && "string" === typeof input.manager && ("object" === typeof input.workingReport && null !== input.workingReport && _io1(input.workingReport)) && "string" === typeof input.urlOfStoryView && "string" === typeof input.disabledStatus && (null === input.defaultStatus || "string" === typeof input.defaultStatus) && "boolean" === typeof input.disabled && "number" === typeof input.allowIssueCacheMinutes && (null === input.startPreparation || undefined === input.startPreparation || "object" === typeof input.startPreparation && null !== input.startPreparation && _io2(input.startPreparation)) && (null === input.notifyFinishedPreparation || undefined === input.notifyFinishedPreparation || "object" === typeof input.notifyFinishedPreparation && null !== input.notifyFinishedPreparation && _io3(input.notifyFinishedPreparation)) && ("object" === typeof input.credentials && null !== input.credentials && _io4(input.credentials)); const _io1 = input => "string" === typeof input.repo && (Array.isArray(input.members) && input.members.every(elem => "string" === typeof elem)) && "string" === typeof input.spreadsheetUrl; const _io2 = input => "string" === typeof input.awaitingWorkspaceStatus && "string" === typeof input.preparationStatus && "string" === typeof input.defaultAgentName && (undefined === input.logFilePath || "string" === typeof input.logFilePath) && (null === input.maximumPreparingIssuesCount || "number" === typeof input.maximumPreparingIssuesCount); const _io3 = input => "string" === typeof input.preparationStatus && "string" === typeof input.awaitingWorkspaceStatus && "string" === typeof input.awaitingQualityCheckStatus && "number" === typeof input.thresholdForAutoReject && (null === input.workflowBlockerResolvedWebhookUrl || "string" === typeof input.workflowBlockerResolvedWebhookUrl); const _io4 = input => "object" === typeof input.manager && null !== input.manager && _io5(input.manager) && ("object" === typeof input.bot && null !== input.bot && _io9(input.bot)); const _io5 = input => "object" === typeof input.github && null !== input.github && _io6(input.github) && ("object" === typeof input.slack && null !== input.slack && _io7(input.slack)) && ("object" === typeof input.googleServiceAccount && null !== input.googleServiceAccount && _io8(input.googleServiceAccount)); const _io6 = input => "string" === typeof input.token; const _io7 = input => "string" === typeof input.userToken; const _io8 = input => "string" === typeof input.serviceAccountKey; const _io9 = input => "object" === typeof input.github && null !== input.github && _io10(input.github); const _io10 = input => "string" === typeof input.token && (undefined === input.name || "string" === typeof input.name) && (undefined === input.password || "string" === typeof input.password) && (undefined === input.authenticatorKey || "string" === typeof input.authenticatorKey); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.projectName || _report(_exceptionable, {
|
|
75
81
|
path: _path + ".projectName",
|
|
76
82
|
expected: "string",
|
|
77
83
|
value: input.projectName
|
|
@@ -115,13 +121,29 @@ class HandleScheduledEventUseCaseHandler {
|
|
|
115
121
|
path: _path + ".allowIssueCacheMinutes",
|
|
116
122
|
expected: "number",
|
|
117
123
|
value: input.allowIssueCacheMinutes
|
|
124
|
+
}), null === input.startPreparation || undefined === input.startPreparation || ("object" === typeof input.startPreparation && null !== input.startPreparation || _report(_exceptionable, {
|
|
125
|
+
path: _path + ".startPreparation",
|
|
126
|
+
expected: "(__type.o1 | null | undefined)",
|
|
127
|
+
value: input.startPreparation
|
|
128
|
+
})) && _vo2(input.startPreparation, _path + ".startPreparation", true && _exceptionable) || _report(_exceptionable, {
|
|
129
|
+
path: _path + ".startPreparation",
|
|
130
|
+
expected: "(__type.o1 | null | undefined)",
|
|
131
|
+
value: input.startPreparation
|
|
132
|
+
}), null === input.notifyFinishedPreparation || undefined === input.notifyFinishedPreparation || ("object" === typeof input.notifyFinishedPreparation && null !== input.notifyFinishedPreparation || _report(_exceptionable, {
|
|
133
|
+
path: _path + ".notifyFinishedPreparation",
|
|
134
|
+
expected: "(__type.o2 | null | undefined)",
|
|
135
|
+
value: input.notifyFinishedPreparation
|
|
136
|
+
})) && _vo3(input.notifyFinishedPreparation, _path + ".notifyFinishedPreparation", true && _exceptionable) || _report(_exceptionable, {
|
|
137
|
+
path: _path + ".notifyFinishedPreparation",
|
|
138
|
+
expected: "(__type.o2 | null | undefined)",
|
|
139
|
+
value: input.notifyFinishedPreparation
|
|
118
140
|
}), ("object" === typeof input.credentials && null !== input.credentials || _report(_exceptionable, {
|
|
119
141
|
path: _path + ".credentials",
|
|
120
|
-
expected: "__type.
|
|
142
|
+
expected: "__type.o3",
|
|
121
143
|
value: input.credentials
|
|
122
|
-
})) &&
|
|
144
|
+
})) && _vo4(input.credentials, _path + ".credentials", true && _exceptionable) || _report(_exceptionable, {
|
|
123
145
|
path: _path + ".credentials",
|
|
124
|
-
expected: "__type.
|
|
146
|
+
expected: "__type.o3",
|
|
125
147
|
value: input.credentials
|
|
126
148
|
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.repo || _report(_exceptionable, {
|
|
127
149
|
path: _path + ".repo",
|
|
@@ -143,67 +165,107 @@ class HandleScheduledEventUseCaseHandler {
|
|
|
143
165
|
path: _path + ".spreadsheetUrl",
|
|
144
166
|
expected: "string",
|
|
145
167
|
value: input.spreadsheetUrl
|
|
146
|
-
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => [
|
|
168
|
+
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.awaitingWorkspaceStatus || _report(_exceptionable, {
|
|
169
|
+
path: _path + ".awaitingWorkspaceStatus",
|
|
170
|
+
expected: "string",
|
|
171
|
+
value: input.awaitingWorkspaceStatus
|
|
172
|
+
}), "string" === typeof input.preparationStatus || _report(_exceptionable, {
|
|
173
|
+
path: _path + ".preparationStatus",
|
|
174
|
+
expected: "string",
|
|
175
|
+
value: input.preparationStatus
|
|
176
|
+
}), "string" === typeof input.defaultAgentName || _report(_exceptionable, {
|
|
177
|
+
path: _path + ".defaultAgentName",
|
|
178
|
+
expected: "string",
|
|
179
|
+
value: input.defaultAgentName
|
|
180
|
+
}), undefined === input.logFilePath || "string" === typeof input.logFilePath || _report(_exceptionable, {
|
|
181
|
+
path: _path + ".logFilePath",
|
|
182
|
+
expected: "(string | undefined)",
|
|
183
|
+
value: input.logFilePath
|
|
184
|
+
}), null === input.maximumPreparingIssuesCount || "number" === typeof input.maximumPreparingIssuesCount || _report(_exceptionable, {
|
|
185
|
+
path: _path + ".maximumPreparingIssuesCount",
|
|
186
|
+
expected: "(null | number)",
|
|
187
|
+
value: input.maximumPreparingIssuesCount
|
|
188
|
+
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.preparationStatus || _report(_exceptionable, {
|
|
189
|
+
path: _path + ".preparationStatus",
|
|
190
|
+
expected: "string",
|
|
191
|
+
value: input.preparationStatus
|
|
192
|
+
}), "string" === typeof input.awaitingWorkspaceStatus || _report(_exceptionable, {
|
|
193
|
+
path: _path + ".awaitingWorkspaceStatus",
|
|
194
|
+
expected: "string",
|
|
195
|
+
value: input.awaitingWorkspaceStatus
|
|
196
|
+
}), "string" === typeof input.awaitingQualityCheckStatus || _report(_exceptionable, {
|
|
197
|
+
path: _path + ".awaitingQualityCheckStatus",
|
|
198
|
+
expected: "string",
|
|
199
|
+
value: input.awaitingQualityCheckStatus
|
|
200
|
+
}), "number" === typeof input.thresholdForAutoReject || _report(_exceptionable, {
|
|
201
|
+
path: _path + ".thresholdForAutoReject",
|
|
202
|
+
expected: "number",
|
|
203
|
+
value: input.thresholdForAutoReject
|
|
204
|
+
}), null === input.workflowBlockerResolvedWebhookUrl || "string" === typeof input.workflowBlockerResolvedWebhookUrl || _report(_exceptionable, {
|
|
205
|
+
path: _path + ".workflowBlockerResolvedWebhookUrl",
|
|
206
|
+
expected: "(null | string)",
|
|
207
|
+
value: input.workflowBlockerResolvedWebhookUrl
|
|
208
|
+
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => [("object" === typeof input.manager && null !== input.manager || _report(_exceptionable, {
|
|
147
209
|
path: _path + ".manager",
|
|
148
|
-
expected: "__type.
|
|
210
|
+
expected: "__type.o4",
|
|
149
211
|
value: input.manager
|
|
150
|
-
})) &&
|
|
212
|
+
})) && _vo5(input.manager, _path + ".manager", true && _exceptionable) || _report(_exceptionable, {
|
|
151
213
|
path: _path + ".manager",
|
|
152
|
-
expected: "__type.
|
|
214
|
+
expected: "__type.o4",
|
|
153
215
|
value: input.manager
|
|
154
216
|
}), ("object" === typeof input.bot && null !== input.bot || _report(_exceptionable, {
|
|
155
217
|
path: _path + ".bot",
|
|
156
|
-
expected: "__type.
|
|
218
|
+
expected: "__type.o8",
|
|
157
219
|
value: input.bot
|
|
158
|
-
})) &&
|
|
220
|
+
})) && _vo9(input.bot, _path + ".bot", true && _exceptionable) || _report(_exceptionable, {
|
|
159
221
|
path: _path + ".bot",
|
|
160
|
-
expected: "__type.
|
|
222
|
+
expected: "__type.o8",
|
|
161
223
|
value: input.bot
|
|
162
|
-
})].every(flag => flag); const
|
|
224
|
+
})].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => [("object" === typeof input.github && null !== input.github || _report(_exceptionable, {
|
|
163
225
|
path: _path + ".github",
|
|
164
|
-
expected: "__type.
|
|
226
|
+
expected: "__type.o5",
|
|
165
227
|
value: input.github
|
|
166
|
-
})) &&
|
|
228
|
+
})) && _vo6(input.github, _path + ".github", true && _exceptionable) || _report(_exceptionable, {
|
|
167
229
|
path: _path + ".github",
|
|
168
|
-
expected: "__type.
|
|
230
|
+
expected: "__type.o5",
|
|
169
231
|
value: input.github
|
|
170
232
|
}), ("object" === typeof input.slack && null !== input.slack || _report(_exceptionable, {
|
|
171
233
|
path: _path + ".slack",
|
|
172
|
-
expected: "__type.
|
|
234
|
+
expected: "__type.o6",
|
|
173
235
|
value: input.slack
|
|
174
|
-
})) &&
|
|
236
|
+
})) && _vo7(input.slack, _path + ".slack", true && _exceptionable) || _report(_exceptionable, {
|
|
175
237
|
path: _path + ".slack",
|
|
176
|
-
expected: "__type.
|
|
238
|
+
expected: "__type.o6",
|
|
177
239
|
value: input.slack
|
|
178
240
|
}), ("object" === typeof input.googleServiceAccount && null !== input.googleServiceAccount || _report(_exceptionable, {
|
|
179
241
|
path: _path + ".googleServiceAccount",
|
|
180
|
-
expected: "__type.
|
|
242
|
+
expected: "__type.o7",
|
|
181
243
|
value: input.googleServiceAccount
|
|
182
|
-
})) &&
|
|
244
|
+
})) && _vo8(input.googleServiceAccount, _path + ".googleServiceAccount", true && _exceptionable) || _report(_exceptionable, {
|
|
183
245
|
path: _path + ".googleServiceAccount",
|
|
184
|
-
expected: "__type.
|
|
246
|
+
expected: "__type.o7",
|
|
185
247
|
value: input.googleServiceAccount
|
|
186
|
-
})].every(flag => flag); const
|
|
248
|
+
})].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => ["string" === typeof input.token || _report(_exceptionable, {
|
|
187
249
|
path: _path + ".token",
|
|
188
250
|
expected: "string",
|
|
189
251
|
value: input.token
|
|
190
|
-
})].every(flag => flag); const
|
|
252
|
+
})].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => ["string" === typeof input.userToken || _report(_exceptionable, {
|
|
191
253
|
path: _path + ".userToken",
|
|
192
254
|
expected: "string",
|
|
193
255
|
value: input.userToken
|
|
194
|
-
})].every(flag => flag); const
|
|
256
|
+
})].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => ["string" === typeof input.serviceAccountKey || _report(_exceptionable, {
|
|
195
257
|
path: _path + ".serviceAccountKey",
|
|
196
258
|
expected: "string",
|
|
197
259
|
value: input.serviceAccountKey
|
|
198
|
-
})].every(flag => flag); const
|
|
260
|
+
})].every(flag => flag); const _vo9 = (input, _path, _exceptionable = true) => [("object" === typeof input.github && null !== input.github || _report(_exceptionable, {
|
|
199
261
|
path: _path + ".github",
|
|
200
|
-
expected: "__type.
|
|
262
|
+
expected: "__type.o9",
|
|
201
263
|
value: input.github
|
|
202
|
-
})) &&
|
|
264
|
+
})) && _vo10(input.github, _path + ".github", true && _exceptionable) || _report(_exceptionable, {
|
|
203
265
|
path: _path + ".github",
|
|
204
|
-
expected: "__type.
|
|
266
|
+
expected: "__type.o9",
|
|
205
267
|
value: input.github
|
|
206
|
-
})].every(flag => flag); const
|
|
268
|
+
})].every(flag => flag); const _vo10 = (input, _path, _exceptionable = true) => ["string" === typeof input.token || _report(_exceptionable, {
|
|
207
269
|
path: _path + ".token",
|
|
208
270
|
expected: "string",
|
|
209
271
|
value: input.token
|
|
@@ -267,8 +329,8 @@ class HandleScheduledEventUseCaseHandler {
|
|
|
267
329
|
const projectRepository = {
|
|
268
330
|
...new GraphqlProjectRepository_1.GraphqlProjectRepository(...githubRepositoryParams),
|
|
269
331
|
...new CheerioProjectRepository_1.CheerioProjectRepository(...githubRepositoryParams),
|
|
270
|
-
prepareStatus: async (_name,
|
|
271
|
-
|
|
332
|
+
prepareStatus: async (_name, project) => {
|
|
333
|
+
return project;
|
|
272
334
|
},
|
|
273
335
|
};
|
|
274
336
|
const apiV3IssueRepository = new ApiV3IssueRepository_1.ApiV3IssueRepository(...githubRepositoryParams);
|
|
@@ -288,7 +350,13 @@ class HandleScheduledEventUseCaseHandler {
|
|
|
288
350
|
const createNewStoryByLabel = new CreateNewStoryByLabelUseCase_1.CreateNewStoryByLabelUseCase(projectRepository, issueRepository);
|
|
289
351
|
const assignNoAssigneeIssueToManagerUseCase = new AssignNoAssigneeIssueToManagerUseCase_1.AssignNoAssigneeIssueToManagerUseCase(issueRepository);
|
|
290
352
|
const updateIssueStatusByLabelUseCase = new UpdateIssueStatusByLabelUseCase_1.UpdateIssueStatusByLabelUseCase(issueRepository);
|
|
291
|
-
const
|
|
353
|
+
const nodeLocalCommandRunner = new NodeLocalCommandRunner_1.NodeLocalCommandRunner();
|
|
354
|
+
const stubClaudeRepository = new StubClaudeRepository_1.StubClaudeRepository();
|
|
355
|
+
const startPreparationUseCase = new StartPreparationUseCase_1.StartPreparationUseCase(projectRepository, issueRepository, stubClaudeRepository, nodeLocalCommandRunner);
|
|
356
|
+
const issueCommentRepository = new GitHubIssueCommentRepository_1.GitHubIssueCommentRepository(input.credentials.bot.github.token);
|
|
357
|
+
const webhookRepository = new FetchWebhookRepository_1.FetchWebhookRepository();
|
|
358
|
+
const notifyFinishedIssuePreparationUseCase = new NotifyFinishedIssuePreparationUseCase_1.NotifyFinishedIssuePreparationUseCase(projectRepository, issueRepository, issueCommentRepository, webhookRepository);
|
|
359
|
+
const handleScheduledEventUseCase = new HandleScheduledEventUseCase_1.HandleScheduledEventUseCase(actionAnnouncement, setWorkflowManagementIssueToStoryUseCase, clearNextActionHourUseCase, analyzeProblemByIssueUseCase, analyzeStoriesUseCase, clearDependedIssueURLUseCase, createEstimationIssueUseCase, convertCheckboxToIssueInStoryIssueUseCase, changeStatusByStoryColorUseCase, setNoStoryIssueToStoryUseCase, createNewStoryByLabel, assignNoAssigneeIssueToManagerUseCase, updateIssueStatusByLabelUseCase, startPreparationUseCase, notifyFinishedIssuePreparationUseCase, systemDateRepository, googleSpreadsheetRepository, projectRepository, issueRepository);
|
|
292
360
|
return await handleScheduledEventUseCase.run(input);
|
|
293
361
|
};
|
|
294
362
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HandleScheduledEventUseCaseHandler.js","sourceRoot":"","sources":["../../../../src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,kDAA0B;AAC1B,4CAAoB;AACpB,kFAA+E;AAC/E,sFAAmF;AACnF,gGAA6F;AAC7F,0FAAuF;AACvF,wFAAqF;AACrF,sFAAmF;AACnF,wGAAqG;AACrG,8GAA2G;AAC3G,sGAAmG;AACnG,gGAA6F;AAC7F,kGAA+F;AAC/F,gIAA6H;AAC7H,oGAAiG;AACjG,wGAAqG;AAIrG,0FAAuF;AACvF,wGAAqG;AACrG,wGAAqG;AACrG,kDAA0C;AAC1C,kIAA+H;AAC/H,8GAA2G;AAC3G,0GAAuG;AACvG,wGAAqG;AACrG,0FAAuF;AAEvF,0HAAuH;AACvH,8GAA2G;
|
|
1
|
+
{"version":3,"file":"HandleScheduledEventUseCaseHandler.js","sourceRoot":"","sources":["../../../../src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,kDAA0B;AAC1B,4CAAoB;AACpB,kFAA+E;AAC/E,sFAAmF;AACnF,gGAA6F;AAC7F,0FAAuF;AACvF,wFAAqF;AACrF,sFAAmF;AACnF,wGAAqG;AACrG,8GAA2G;AAC3G,sGAAmG;AACnG,gGAA6F;AAC7F,kGAA+F;AAC/F,gIAA6H;AAC7H,oGAAiG;AACjG,wGAAqG;AAIrG,0FAAuF;AACvF,wGAAqG;AACrG,wGAAqG;AACrG,kDAA0C;AAC1C,kIAA+H;AAC/H,8GAA2G;AAC3G,0GAAuG;AACvG,wGAAqG;AACrG,0FAAuF;AAEvF,0HAAuH;AACvH,8GAA2G;AAC3G,8FAA2F;AAC3F,sFAAmF;AACnF,kFAA+E;AAC/E,0HAAuH;AACvH,kGAA+F;AAC/F,sFAAmF;AAEnF,MAAa,kCAAkC;IAA/C;QACE,WAAM,GAAG,KAAK,EACZ,cAAsB,EACtB,O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AG,CAAC,MAAM,CAAC,KAAK,CACnC,CAAC;YACF,MAAM,iBAAiB,GAAG,IAAI,+CAAsB,EAAE,CAAC;YACvD,MAAM,qCAAqC,GACzC,IAAI,6EAAqC,CACvC,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,CAClB,CAAC;YAEJ,MAAM,2BAA2B,GAAG,IAAI,yDAA2B,CACjE,kBAAkB,EAClB,wCAAwC,EACxC,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,yCAAyC,EACzC,+BAA+B,EAC/B,6BAA6B,EAC7B,qBAAqB,EACrB,qCAAqC,EACrC,+BAA+B,EAC/B,uBAAuB,EACvB,qCAAqC,EACrC,oBAAoB,EACpB,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,CAChB,CAAC;YAEF,OAAO,MAAM,2BAA2B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtD,CAAC,CAAC;IACJ,CAAC;CAAA;AA5LD,gFA4LC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FetchWebhookRepository = void 0;
|
|
4
|
+
class FetchWebhookRepository {
|
|
5
|
+
async sendGetRequest(url) {
|
|
6
|
+
await fetch(url);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.FetchWebhookRepository = FetchWebhookRepository;
|
|
10
|
+
//# sourceMappingURL=FetchWebhookRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchWebhookRepository.js","sourceRoot":"","sources":["../../../src/adapter/repositories/FetchWebhookRepository.ts"],"names":[],"mappings":";;;AAEA,MAAa,sBAAsB;IACjC,KAAK,CAAC,cAAc,CAAC,GAAW;QAC9B,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;CACF;AAJD,wDAIC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitHubIssueCommentRepository = void 0;
|
|
4
|
+
function isIssueCommentsResponse(value) {
|
|
5
|
+
if (typeof value !== 'object' || value === null)
|
|
6
|
+
return false;
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
function isCreateCommentResponse(value) {
|
|
10
|
+
if (typeof value !== 'object' || value === null)
|
|
11
|
+
return false;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
function isIssueIdResponse(value) {
|
|
15
|
+
if (typeof value !== 'object' || value === null)
|
|
16
|
+
return false;
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
class GitHubIssueCommentRepository {
|
|
20
|
+
constructor(token) {
|
|
21
|
+
this.token = token;
|
|
22
|
+
}
|
|
23
|
+
parseIssueUrl(issue) {
|
|
24
|
+
const urlMatch = issue.url.match(/github\.com\/([^/]+)\/([^/]+)\/(issues|pull)\/(\d+)/);
|
|
25
|
+
if (!urlMatch) {
|
|
26
|
+
throw new Error(`Invalid GitHub issue URL: ${issue.url}`);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
owner: urlMatch[1],
|
|
30
|
+
repo: urlMatch[2],
|
|
31
|
+
issueNumber: parseInt(urlMatch[4], 10),
|
|
32
|
+
isPr: urlMatch[3] === 'pull',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async getCommentsFromIssue(issue) {
|
|
36
|
+
const { owner, repo, issueNumber, isPr } = this.parseIssueUrl(issue);
|
|
37
|
+
const entityType = isPr ? 'pullRequest' : 'issue';
|
|
38
|
+
const query = `
|
|
39
|
+
query($owner: String!, $repo: String!, $issueNumber: Int!, $after: String) {
|
|
40
|
+
repository(owner: $owner, name: $repo) {
|
|
41
|
+
${entityType}(number: $issueNumber) {
|
|
42
|
+
comments(first: 100, after: $after) {
|
|
43
|
+
pageInfo {
|
|
44
|
+
endCursor
|
|
45
|
+
hasNextPage
|
|
46
|
+
}
|
|
47
|
+
nodes {
|
|
48
|
+
author {
|
|
49
|
+
login
|
|
50
|
+
}
|
|
51
|
+
body
|
|
52
|
+
createdAt
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
const comments = [];
|
|
60
|
+
let after = null;
|
|
61
|
+
let hasNextPage = true;
|
|
62
|
+
while (hasNextPage) {
|
|
63
|
+
const response = await fetch('https://api.github.com/graphql', {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
headers: {
|
|
66
|
+
Authorization: `Bearer ${this.token}`,
|
|
67
|
+
'Content-Type': 'application/json',
|
|
68
|
+
},
|
|
69
|
+
body: JSON.stringify({
|
|
70
|
+
query,
|
|
71
|
+
variables: {
|
|
72
|
+
owner,
|
|
73
|
+
repo,
|
|
74
|
+
issueNumber,
|
|
75
|
+
after,
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
if (!response.ok) {
|
|
80
|
+
throw new Error(`Failed to fetch comments from GitHub GraphQL API: ${response.status} ${response.statusText}`);
|
|
81
|
+
}
|
|
82
|
+
const responseData = await response.json();
|
|
83
|
+
if (!isIssueCommentsResponse(responseData)) {
|
|
84
|
+
throw new Error('Unexpected response shape when fetching comments from GitHub GraphQL API');
|
|
85
|
+
}
|
|
86
|
+
const issueData = isPr
|
|
87
|
+
? responseData.data?.repository?.pullRequest
|
|
88
|
+
: responseData.data?.repository?.issue;
|
|
89
|
+
if (!issueData) {
|
|
90
|
+
throw new Error(`${isPr ? 'Pull request' : 'Issue'} not found when fetching comments from GitHub GraphQL API`);
|
|
91
|
+
}
|
|
92
|
+
const commentNodes = issueData.comments.nodes;
|
|
93
|
+
for (const node of commentNodes) {
|
|
94
|
+
comments.push({
|
|
95
|
+
author: node.author?.login || '',
|
|
96
|
+
content: node.body,
|
|
97
|
+
createdAt: new Date(node.createdAt),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
hasNextPage = issueData.comments.pageInfo.hasNextPage;
|
|
101
|
+
after = issueData.comments.pageInfo.endCursor;
|
|
102
|
+
}
|
|
103
|
+
return comments;
|
|
104
|
+
}
|
|
105
|
+
async getIssueNodeId(issue) {
|
|
106
|
+
const { owner, repo, issueNumber, isPr } = this.parseIssueUrl(issue);
|
|
107
|
+
const entityType = isPr ? 'pullRequest' : 'issue';
|
|
108
|
+
const query = `
|
|
109
|
+
query($owner: String!, $repo: String!, $issueNumber: Int!) {
|
|
110
|
+
repository(owner: $owner, name: $repo) {
|
|
111
|
+
${entityType}(number: $issueNumber) {
|
|
112
|
+
id
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
const response = await fetch('https://api.github.com/graphql', {
|
|
118
|
+
method: 'POST',
|
|
119
|
+
headers: {
|
|
120
|
+
Authorization: `Bearer ${this.token}`,
|
|
121
|
+
'Content-Type': 'application/json',
|
|
122
|
+
},
|
|
123
|
+
body: JSON.stringify({
|
|
124
|
+
query,
|
|
125
|
+
variables: {
|
|
126
|
+
owner,
|
|
127
|
+
repo,
|
|
128
|
+
issueNumber,
|
|
129
|
+
},
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
132
|
+
if (!response.ok) {
|
|
133
|
+
throw new Error(`Failed to fetch issue ID from GitHub GraphQL API: ${response.status} ${response.statusText}`);
|
|
134
|
+
}
|
|
135
|
+
const responseData = await response.json();
|
|
136
|
+
if (!isIssueIdResponse(responseData)) {
|
|
137
|
+
throw new Error('Unexpected response shape when fetching issue ID from GitHub GraphQL API');
|
|
138
|
+
}
|
|
139
|
+
const issueId = isPr
|
|
140
|
+
? responseData.data?.repository?.pullRequest?.id
|
|
141
|
+
: responseData.data?.repository?.issue?.id;
|
|
142
|
+
if (!issueId) {
|
|
143
|
+
throw new Error(`${isPr ? 'Pull request' : 'Issue'} not found when fetching issue ID from GitHub GraphQL API`);
|
|
144
|
+
}
|
|
145
|
+
return issueId;
|
|
146
|
+
}
|
|
147
|
+
async createComment(issue, commentContent) {
|
|
148
|
+
const issueId = await this.getIssueNodeId(issue);
|
|
149
|
+
const mutation = `
|
|
150
|
+
mutation($issueId: ID!, $body: String!) {
|
|
151
|
+
addComment(input: {
|
|
152
|
+
subjectId: $issueId
|
|
153
|
+
body: $body
|
|
154
|
+
}) {
|
|
155
|
+
commentEdge {
|
|
156
|
+
node {
|
|
157
|
+
id
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
`;
|
|
163
|
+
const response = await fetch('https://api.github.com/graphql', {
|
|
164
|
+
method: 'POST',
|
|
165
|
+
headers: {
|
|
166
|
+
Authorization: `Bearer ${this.token}`,
|
|
167
|
+
'Content-Type': 'application/json',
|
|
168
|
+
},
|
|
169
|
+
body: JSON.stringify({
|
|
170
|
+
query: mutation,
|
|
171
|
+
variables: {
|
|
172
|
+
issueId,
|
|
173
|
+
body: commentContent,
|
|
174
|
+
},
|
|
175
|
+
}),
|
|
176
|
+
});
|
|
177
|
+
if (!response.ok) {
|
|
178
|
+
throw new Error(`Failed to create comment via GitHub GraphQL API: ${response.status} ${response.statusText}`);
|
|
179
|
+
}
|
|
180
|
+
const responseData = await response.json();
|
|
181
|
+
if (!isCreateCommentResponse(responseData)) {
|
|
182
|
+
throw new Error('Invalid API response format when creating comment');
|
|
183
|
+
}
|
|
184
|
+
if (responseData.errors) {
|
|
185
|
+
throw new Error(`GraphQL errors when creating comment: ${JSON.stringify(responseData.errors)}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.GitHubIssueCommentRepository = GitHubIssueCommentRepository;
|
|
190
|
+
//# sourceMappingURL=GitHubIssueCommentRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubIssueCommentRepository.js","sourceRoot":"","sources":["../../../src/adapter/repositories/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AC;YACjB,MAAM,IAAI,KAAK,CACb,oDAAoD,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAC7F,CAAC;QACJ,CAAC;QAED,MAAM,YAAY,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpD,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAED,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,yCAAyC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAC/E,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAtND,oEAsNC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeLocalCommandRunner = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
7
|
+
class NodeLocalCommandRunner {
|
|
8
|
+
async runCommand(command) {
|
|
9
|
+
try {
|
|
10
|
+
const { stdout, stderr } = await execAsync(command);
|
|
11
|
+
return {
|
|
12
|
+
stdout,
|
|
13
|
+
stderr,
|
|
14
|
+
exitCode: 0,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (error &&
|
|
19
|
+
typeof error === 'object' &&
|
|
20
|
+
'stdout' in error &&
|
|
21
|
+
'stderr' in error &&
|
|
22
|
+
'code' in error) {
|
|
23
|
+
return {
|
|
24
|
+
stdout: String(error.stdout),
|
|
25
|
+
stderr: String(error.stderr),
|
|
26
|
+
exitCode: typeof error.code === 'number' ? error.code : 1,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.NodeLocalCommandRunner = NodeLocalCommandRunner;
|
|
34
|
+
//# sourceMappingURL=NodeLocalCommandRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeLocalCommandRunner.js","sourceRoot":"","sources":["../../../src/adapter/repositories/NodeLocalCommandRunner.ts"],"names":[],"mappings":";;;AACA,iDAAqC;AACrC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAElC,MAAa,sBAAsB;IACjC,KAAK,CAAC,UAAU,CAAC,OAAe;QAK9B,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;YACpD,OAAO;gBACL,MAAM;gBACN,MAAM;gBACN,QAAQ,EAAE,CAAC;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IACE,KAAK;gBACL,OAAO,KAAK,KAAK,QAAQ;gBACzB,QAAQ,IAAI,KAAK;gBACjB,QAAQ,IAAI,KAAK;gBACjB,MAAM,IAAI,KAAK,EACf,CAAC;gBACD,OAAO;oBACL,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;oBAC5B,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;oBAC5B,QAAQ,EAAE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBAC1D,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA9BD,wDA8BC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StubClaudeRepository = void 0;
|
|
4
|
+
class StubClaudeRepository {
|
|
5
|
+
async getUsage() {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
async isClaudeAvailable(_threshold) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.StubClaudeRepository = StubClaudeRepository;
|
|
13
|
+
//# sourceMappingURL=StubClaudeRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StubClaudeRepository.js","sourceRoot":"","sources":["../../../src/adapter/repositories/StubClaudeRepository.ts"],"names":[],"mappings":";;;AAGA,MAAa,oBAAoB;IAC/B,KAAK,CAAC,QAAQ;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,UAAkB;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AARD,oDAQC"}
|