@aviaratech/ai-delivery 0.3.34 → 0.3.36
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/CONTRIBUTING.md +12 -206
- package/README.md +57 -506
- package/dist/agent.d.ts +0 -2
- package/dist/agent.js +76 -16
- package/dist/agent.js.map +7 -1
- package/dist/agentReadiness.test.js +73 -67
- package/dist/agentReadiness.test.js.map +7 -1
- package/dist/boardReconcile.test.js +1746 -0
- package/dist/boardReconcile.test.js.map +7 -0
- package/dist/build.test.js +130 -0
- package/dist/build.test.js.map +7 -0
- package/dist/callerErrors.test.js +105 -0
- package/dist/callerErrors.test.js.map +7 -0
- package/dist/cli.js +406 -485
- package/dist/cli.js.map +7 -1
- package/dist/cliResult.d.ts +2 -2
- package/dist/cliResult.js +42 -25
- package/dist/cliResult.js.map +7 -1
- package/dist/cliResult.test.js +434 -297
- package/dist/cliResult.test.js.map +7 -1
- package/dist/config/deliveryConfig.d.ts +320 -14
- package/dist/config/deliveryConfig.js +472 -385
- package/dist/config/deliveryConfig.js.map +7 -1
- package/dist/config/deliveryConfig.test.js +775 -584
- package/dist/config/deliveryConfig.test.js.map +7 -1
- package/dist/contributorChecks.test.js +1694 -916
- package/dist/contributorChecks.test.js.map +7 -1
- package/dist/currentConsumer.test.js +819 -737
- package/dist/currentConsumer.test.js.map +7 -1
- package/dist/currentTrackingScenario.test.js +499 -477
- package/dist/currentTrackingScenario.test.js.map +7 -1
- package/dist/delivery/common.js +160 -172
- package/dist/delivery/common.js.map +7 -1
- package/dist/delivery/delivery.test.js +509 -431
- package/dist/delivery/delivery.test.js.map +7 -1
- package/dist/delivery/evidence.d.ts +2 -2
- package/dist/delivery/evidence.js +133 -120
- package/dist/delivery/evidence.js.map +7 -1
- package/dist/delivery/index.js +7 -2
- package/dist/delivery/index.js.map +7 -1
- package/dist/delivery/legacy.js +65 -5
- package/dist/delivery/legacy.js.map +7 -1
- package/dist/delivery/policy.d.ts +10 -10
- package/dist/delivery/policy.js +211 -238
- package/dist/delivery/policy.js.map +7 -1
- package/dist/delivery/stage.d.ts +18 -18
- package/dist/delivery/stage.js +220 -235
- package/dist/delivery/stage.js.map +7 -1
- package/dist/deliveryBoard.d.ts +74 -0
- package/dist/deliveryBoard.js +644 -0
- package/dist/deliveryBoard.js.map +7 -0
- package/dist/deliveryBoard.test.d.ts +1 -0
- package/dist/deliveryBoard.test.js +649 -0
- package/dist/deliveryBoard.test.js.map +7 -0
- package/dist/deliveryHealth.test.js +179 -155
- package/dist/deliveryHealth.test.js.map +7 -1
- package/dist/dependencyCompatibility.test.js +154 -140
- package/dist/dependencyCompatibility.test.js.map +7 -1
- package/dist/directoryIndependent.test.js +417 -383
- package/dist/directoryIndependent.test.js.map +7 -1
- package/dist/dispatch.d.ts +17 -12
- package/dist/dispatch.js +330 -322
- package/dist/dispatch.js.map +7 -1
- package/dist/errors.d.ts +16 -3
- package/dist/errors.js +104 -82
- package/dist/errors.js.map +7 -1
- package/dist/fixtures/deliveryBoardReplay.d.ts +56 -0
- package/dist/fixtures/deliveryBoardReplay.js +617 -0
- package/dist/fixtures/deliveryBoardReplay.js.map +7 -0
- package/dist/fixtures/discovery.d.ts +59 -19
- package/dist/fixtures/discovery.js +96 -90
- package/dist/fixtures/discovery.js.map +7 -1
- package/dist/fixtures/inertEntrypointChild.js +57 -56
- package/dist/fixtures/inertEntrypointChild.js.map +7 -1
- package/dist/fixtures/inertEntrypoints.d.ts +1 -1
- package/dist/fixtures/inertEntrypoints.js +321 -276
- package/dist/fixtures/inertEntrypoints.js.map +7 -1
- package/dist/fixtures/inertTarget.d.ts +78 -7
- package/dist/fixtures/inertTarget.js +769 -691
- package/dist/fixtures/inertTarget.js.map +7 -1
- package/dist/fixtures/issue63.d.ts +4 -3
- package/dist/fixtures/issue63.js +260 -274
- package/dist/fixtures/issue63.js.map +7 -1
- package/dist/fixtures/issueProjectItems.d.ts +20 -0
- package/dist/fixtures/issueProjectItems.js +15 -0
- package/dist/fixtures/issueProjectItems.js.map +7 -0
- package/dist/fixtures/readView.d.ts +120 -0
- package/dist/fixtures/readView.js +172 -0
- package/dist/fixtures/readView.js.map +7 -0
- package/dist/fixtures/recordedGitHubFlows.d.ts +120 -0
- package/dist/fixtures/recordedGitHubFlows.js +109 -0
- package/dist/fixtures/recordedGitHubFlows.js.map +7 -0
- package/dist/genericCompatibility.test.js +64 -55
- package/dist/genericCompatibility.test.js.map +7 -1
- package/dist/git.js +73 -67
- package/dist/git.js.map +7 -1
- package/dist/gitProcess.d.ts +1 -1
- package/dist/gitProcess.js +58 -53
- package/dist/gitProcess.js.map +7 -1
- package/dist/github/client.d.ts +2 -2
- package/dist/github/client.js +484 -379
- package/dist/github/client.js.map +7 -1
- package/dist/github/commandIdentityPolicy.js +44 -51
- package/dist/github/commandIdentityPolicy.js.map +7 -1
- package/dist/github/discovery.d.ts +3 -0
- package/dist/github/discovery.js +197 -201
- package/dist/github/discovery.js.map +7 -1
- package/dist/github/discovery.test.js +223 -177
- package/dist/github/discovery.test.js.map +7 -1
- package/dist/github/issueHistory.d.ts +2 -2
- package/dist/github/issueHistory.js +117 -125
- package/dist/github/issueHistory.js.map +7 -1
- package/dist/github/machineAuth.d.ts +1 -1
- package/dist/github/machineAuth.js +126 -117
- package/dist/github/machineAuth.js.map +7 -1
- package/dist/github/machineAuth.test.js +755 -639
- package/dist/github/machineAuth.test.js.map +7 -1
- package/dist/github/nativeIssueMetadata.js +286 -273
- package/dist/github/nativeIssueMetadata.js.map +7 -1
- package/dist/github/projectDelivery.d.ts +53 -1
- package/dist/github/projectDelivery.js +623 -460
- package/dist/github/projectDelivery.js.map +7 -1
- package/dist/github/relationships.d.ts +5 -2
- package/dist/github/relationships.js +434 -333
- package/dist/github/relationships.js.map +7 -1
- package/dist/github/repo.d.ts +1 -0
- package/dist/github/repo.js +123 -96
- package/dist/github/repo.js.map +7 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +7 -1
- package/dist/issue.d.ts +103 -7
- package/dist/issue.js +2104 -1547
- package/dist/issue.js.map +7 -1
- package/dist/issue63History.test.js +40 -42
- package/dist/issue63History.test.js.map +7 -1
- package/dist/issue63Routes.test.js +154 -143
- package/dist/issue63Routes.test.js.map +7 -1
- package/dist/issueBatchUpdate.test.js +1004 -683
- package/dist/issueBatchUpdate.test.js.map +7 -1
- package/dist/issueBlockerGuard.test.js +262 -226
- package/dist/issueBlockerGuard.test.js.map +7 -1
- package/dist/issueContract.d.ts +23 -4
- package/dist/issueContract.js +416 -395
- package/dist/issueContract.js.map +7 -1
- package/dist/issueContract.test.d.ts +4 -3
- package/dist/issueContract.test.js +358 -321
- package/dist/issueContract.test.js.map +7 -1
- package/dist/issueDates.test.js +235 -233
- package/dist/issueDates.test.js.map +7 -1
- package/dist/issueInfoReadback.test.js +304 -190
- package/dist/issueInfoReadback.test.js.map +7 -1
- package/dist/issueIntake.test.js +1945 -1732
- package/dist/issueIntake.test.js.map +7 -1
- package/dist/issueJournal.d.ts +40 -19
- package/dist/issueJournal.js +229 -138
- package/dist/issueJournal.js.map +7 -1
- package/dist/issueJournal.test.js +605 -422
- package/dist/issueJournal.test.js.map +7 -1
- package/dist/issueRollup.test.d.ts +1 -0
- package/dist/issueRollup.test.js +476 -0
- package/dist/issueRollup.test.js.map +7 -0
- package/dist/issueTracking.test.js +1088 -593
- package/dist/issueTracking.test.js.map +7 -1
- package/dist/issueWriteRecovery.test.d.ts +1 -0
- package/dist/issueWriteRecovery.test.js +260 -0
- package/dist/issueWriteRecovery.test.js.map +7 -0
- package/dist/lifecycle.test.js +112 -441
- package/dist/lifecycle.test.js.map +7 -1
- package/dist/logger.js +80 -74
- package/dist/logger.js.map +7 -1
- package/dist/mcp/index.js +116 -90
- package/dist/mcp/index.js.map +7 -1
- package/dist/mcp/tools.d.ts +790 -220
- package/dist/mcp/tools.js +267 -333
- package/dist/mcp/tools.js.map +7 -1
- package/dist/pluginAuthProbe.js +63 -52
- package/dist/pluginAuthProbe.js.map +7 -1
- package/dist/pluginAuthProbe.test.js +85 -62
- package/dist/pluginAuthProbe.test.js.map +7 -1
- package/dist/pluginCredentials.test.js +282 -259
- package/dist/pluginCredentials.test.js.map +7 -1
- package/dist/pluginDoctor.test.js +653 -588
- package/dist/pluginDoctor.test.js.map +7 -1
- package/dist/pluginInstaller.d.ts +7 -5
- package/dist/pluginInstaller.js +1173 -1231
- package/dist/pluginInstaller.js.map +7 -1
- package/dist/pluginInstaller.test.js +1822 -1283
- package/dist/pluginInstaller.test.js.map +7 -1
- package/dist/pluginPackaging.test.js +485 -305
- package/dist/pluginPackaging.test.js.map +7 -1
- package/dist/pr.d.ts +132 -94
- package/dist/pr.js +1521 -1323
- package/dist/pr.js.map +7 -1
- package/dist/pr.test.js +1678 -632
- package/dist/pr.test.js.map +7 -1
- package/dist/prAssociation.test.js +2419 -1788
- package/dist/prAssociation.test.js.map +7 -1
- package/dist/prDispatch.test.js +150 -89
- package/dist/prDispatch.test.js.map +7 -1
- package/dist/readView.d.ts +183 -0
- package/dist/readView.js +217 -0
- package/dist/readView.js.map +7 -0
- package/dist/readView.test.d.ts +1 -0
- package/dist/readView.test.js +119 -0
- package/dist/readView.test.js.map +7 -0
- package/dist/releaseReconciliation.test.js +267 -288
- package/dist/releaseReconciliation.test.js.map +7 -1
- package/dist/releaseWorkflow.test.js +2493 -422
- package/dist/releaseWorkflow.test.js.map +7 -1
- package/dist/review.d.ts +738 -2
- package/dist/review.js +601 -348
- package/dist/review.js.map +7 -1
- package/dist/review.test.js +1218 -812
- package/dist/review.test.js.map +7 -1
- package/dist/reviewSubmit.test.d.ts +1 -0
- package/dist/reviewSubmit.test.js +747 -0
- package/dist/reviewSubmit.test.js.map +7 -0
- package/dist/services/agentReadinessService.js +42 -37
- package/dist/services/agentReadinessService.js.map +7 -1
- package/dist/services/blockerGuardService.js +188 -188
- package/dist/services/blockerGuardService.js.map +7 -1
- package/dist/services/boardReconcileService.d.ts +1204 -0
- package/dist/services/boardReconcileService.js +1445 -0
- package/dist/services/boardReconcileService.js.map +7 -0
- package/dist/services/deliveryAdmission.d.ts +2 -0
- package/dist/services/deliveryAdmission.js +129 -152
- package/dist/services/deliveryAdmission.js.map +7 -1
- package/dist/services/deliveryHealthService.js +197 -199
- package/dist/services/deliveryHealthService.js.map +7 -1
- package/dist/services/legacyIssueMigration.js +263 -277
- package/dist/services/legacyIssueMigration.js.map +7 -1
- package/dist/services/worktreeRegistry.d.ts +27 -119
- package/dist/services/worktreeRegistry.js +765 -1182
- package/dist/services/worktreeRegistry.js.map +7 -1
- package/dist/stagedChecks.test.js +396 -194
- package/dist/stagedChecks.test.js.map +7 -1
- package/dist/start.test.js +99 -95
- package/dist/start.test.js.map +7 -1
- package/dist/stdoutRegression.test.js +354 -350
- package/dist/stdoutRegression.test.js.map +7 -1
- package/dist/targetPolicyDiscovery.test.js +141 -143
- package/dist/targetPolicyDiscovery.test.js.map +7 -1
- package/dist/targetPolicyEntrypoints.test.js +308 -269
- package/dist/targetPolicyEntrypoints.test.js.map +7 -1
- package/dist/targetPolicyLocal.test.js +580 -1051
- package/dist/targetPolicyLocal.test.js.map +7 -1
- package/dist/targetPolicyRoutes.test.js +305 -281
- package/dist/targetPolicyRoutes.test.js.map +7 -1
- package/dist/targetRepositoryExecution.test.d.ts +1 -0
- package/dist/targetRepositoryExecution.test.js +463 -0
- package/dist/targetRepositoryExecution.test.js.map +7 -0
- package/dist/terminalMessages.js +41 -35
- package/dist/terminalMessages.js.map +7 -1
- package/dist/toolOutput.d.ts +2 -0
- package/dist/toolOutput.js +36 -0
- package/dist/toolOutput.js.map +7 -0
- package/dist/toolOutput.test.d.ts +1 -0
- package/dist/toolOutput.test.js +240 -0
- package/dist/toolOutput.test.js.map +7 -0
- package/dist/utils/atomicJson.js +84 -76
- package/dist/utils/atomicJson.js.map +7 -1
- package/dist/utils/filesystem.js +15 -18
- package/dist/utils/filesystem.js.map +7 -1
- package/dist/utils/lockfile.js +68 -71
- package/dist/utils/lockfile.js.map +7 -1
- package/dist/verification.d.ts +1 -19
- package/dist/verification.js +1020 -1929
- package/dist/verification.js.map +7 -1
- package/dist/verificationGate.test.js +127 -117
- package/dist/verificationGate.test.js.map +7 -1
- package/dist/version.d.ts +6 -0
- package/dist/version.js +24 -10
- package/dist/version.js.map +7 -1
- package/dist/worktree.d.ts +3 -15
- package/dist/worktree.js +97 -177
- package/dist/worktree.js.map +7 -1
- package/package.json +10 -8
- package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
- package/plugins/ai-delivery/README.md +47 -156
- package/plugins/ai-delivery/plugin.json +1 -1
- package/plugins/ai-delivery/runtime/dist/THIRD-PARTY-NOTICES.md +261 -43
- package/plugins/ai-delivery/runtime/dist/cli.js +369 -125
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/plugins/ai-delivery/skills/intake-create/SKILL.md +14 -78
- package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +35 -36
- package/plugins/ai-delivery/skills/worktree-lifecycle/SKILL.md +14 -15
- package/dist/investigationCompletion.test.js +0 -728
- package/dist/investigationCompletion.test.js.map +0 -1
- package/dist/setup.d.ts +0 -60
- package/dist/setup.js +0 -585
- package/dist/setup.js.map +0 -1
- package/dist/setup.test.js +0 -3058
- package/dist/setup.test.js.map +0 -1
- package/dist/worktreeTransition.d.ts +0 -211
- package/dist/worktreeTransition.js +0 -1037
- package/dist/worktreeTransition.js.map +0 -1
- package/dist/worktreeTransition.test.js +0 -1191
- package/dist/worktreeTransition.test.js.map +0 -1
- /package/dist/{investigationCompletion.test.d.ts → boardReconcile.test.d.ts} +0 -0
- /package/dist/{setup.test.d.ts → build.test.d.ts} +0 -0
- /package/dist/{worktreeTransition.test.d.ts → callerErrors.test.d.ts} +0 -0
|
@@ -1,85 +1,88 @@
|
|
|
1
|
-
import * as z from
|
|
2
|
-
import { CLIError, formatError, logInfo } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.object({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
id: z.string(),
|
|
53
|
-
number: z.number().int().positive(),
|
|
54
|
-
state: z.enum(['OPEN', 'CLOSED']),
|
|
55
|
-
title: z.string(),
|
|
56
|
-
})
|
|
57
|
-
.strict()),
|
|
58
|
-
pageInfo: z.object({ endCursor: z.string().nullable(), hasNextPage: z.boolean() }).strict(),
|
|
59
|
-
})
|
|
60
|
-
.strict(),
|
|
61
|
-
})
|
|
62
|
-
.strict(),
|
|
63
|
-
})
|
|
64
|
-
.strict(),
|
|
65
|
-
})
|
|
66
|
-
.strict();
|
|
67
|
-
export async function getNativeBlockerNumbers(params) {
|
|
68
|
-
return (await getNativeBlockerRelationships(params)).blockers.map((blocker) => blocker.number);
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { CLIError, formatError, logInfo } from "../logger.js";
|
|
3
|
+
import { CollectionLimitError } from "../errors.js";
|
|
4
|
+
const NativeBlockerPageSchema = z.object({
|
|
5
|
+
repository: z.object({
|
|
6
|
+
issue: z.object({
|
|
7
|
+
id: z.string().min(1).optional(),
|
|
8
|
+
number: z.number().int().positive().optional(),
|
|
9
|
+
repository: z.object({ nameWithOwner: z.string() }).strict().optional(),
|
|
10
|
+
blockedBy: z.object({
|
|
11
|
+
nodes: z.array(
|
|
12
|
+
z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
number: z.number().int().positive(),
|
|
15
|
+
state: z.enum(["OPEN", "CLOSED"]),
|
|
16
|
+
title: z.string(),
|
|
17
|
+
repository: z.object({ nameWithOwner: z.string() }).strict().optional()
|
|
18
|
+
}).strict()
|
|
19
|
+
),
|
|
20
|
+
pageInfo: z.object({
|
|
21
|
+
endCursor: z.string().nullable(),
|
|
22
|
+
hasNextPage: z.boolean()
|
|
23
|
+
}).strict()
|
|
24
|
+
}).strict(),
|
|
25
|
+
parent: z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
number: z.number().int().positive().optional(),
|
|
28
|
+
repository: z.object({ nameWithOwner: z.string() }).strict().optional()
|
|
29
|
+
}).strict().nullable()
|
|
30
|
+
}).strict()
|
|
31
|
+
}).strict()
|
|
32
|
+
}).strict();
|
|
33
|
+
const NativeBlockingPageSchema = z.object({
|
|
34
|
+
repository: z.object({
|
|
35
|
+
issue: z.object({
|
|
36
|
+
blocking: z.object({
|
|
37
|
+
nodes: z.array(
|
|
38
|
+
z.object({
|
|
39
|
+
id: z.string(),
|
|
40
|
+
number: z.number().int().positive(),
|
|
41
|
+
state: z.enum(["OPEN", "CLOSED"]),
|
|
42
|
+
title: z.string()
|
|
43
|
+
}).strict()
|
|
44
|
+
),
|
|
45
|
+
pageInfo: z.object({ endCursor: z.string().nullable(), hasNextPage: z.boolean() }).strict()
|
|
46
|
+
}).strict()
|
|
47
|
+
}).strict()
|
|
48
|
+
}).strict()
|
|
49
|
+
}).strict();
|
|
50
|
+
async function getNativeBlockerNumbers(params) {
|
|
51
|
+
return (await getNativeBlockerRelationships(params)).blockers.map((blocker) => blocker.number);
|
|
69
52
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
53
|
+
async function getNativeBlockerRelationships({
|
|
54
|
+
graphql,
|
|
55
|
+
issueNumber,
|
|
56
|
+
repo,
|
|
57
|
+
requireRepositoryIdentity = false,
|
|
58
|
+
maxPages,
|
|
59
|
+
issueNodeId
|
|
60
|
+
}) {
|
|
61
|
+
const blockers = /* @__PURE__ */ new Map();
|
|
62
|
+
let cursor = null;
|
|
63
|
+
let hasNextPage = true;
|
|
64
|
+
let parentId = null;
|
|
65
|
+
let parentRepository = null;
|
|
66
|
+
let parentNumber = null;
|
|
67
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
68
|
+
let pages = 0;
|
|
69
|
+
let observedSubject;
|
|
70
|
+
let observedParent;
|
|
71
|
+
while (hasNextPage) {
|
|
72
|
+
if (maxPages !== void 0 && pages >= maxPages)
|
|
73
|
+
throw new CollectionLimitError({
|
|
74
|
+
collection: "native-blockers",
|
|
75
|
+
pagesRequested: pages,
|
|
76
|
+
rowsObserved: blockers.size,
|
|
77
|
+
limit: maxPages
|
|
78
|
+
});
|
|
79
|
+
pages++;
|
|
80
|
+
const response = await graphql(
|
|
81
|
+
`
|
|
80
82
|
query ($owner: String!, $name: String!, $number: Int!, $cursor: String) {
|
|
81
83
|
repository(owner: $owner, name: $name) {
|
|
82
84
|
issue(number: $number) {
|
|
85
|
+
${maxPages === void 0 ? "" : "id number repository { nameWithOwner }"}
|
|
83
86
|
parent {
|
|
84
87
|
id
|
|
85
88
|
number
|
|
@@ -105,55 +108,71 @@ export async function getNativeBlockerRelationships({ graphql, issueNumber, repo
|
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
|
-
`,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (hasNextPage && nextCursor !== null && (nextCursor === cursor || seenCursors.has(nextCursor))) {
|
|
136
|
-
throw new CLIError(`Native blocked-by pagination for issue #${String(issueNumber)} repeated a non-advancing cursor.`);
|
|
137
|
-
}
|
|
138
|
-
if (nextCursor !== null)
|
|
139
|
-
seenCursors.add(nextCursor);
|
|
140
|
-
cursor = nextCursor;
|
|
111
|
+
`,
|
|
112
|
+
{ cursor, name: repo.repo, number: issueNumber, owner: repo.owner }
|
|
113
|
+
);
|
|
114
|
+
const parsed = NativeBlockerPageSchema.safeParse(response);
|
|
115
|
+
if (!parsed.success) {
|
|
116
|
+
throw new CLIError(`GitHub returned invalid blocked-by relationship evidence for issue #${String(issueNumber)}.`);
|
|
117
|
+
}
|
|
118
|
+
const issue = parsed.data.repository.issue;
|
|
119
|
+
if (maxPages !== void 0 && (!issue.id || issueNodeId !== void 0 && issue.id !== issueNodeId || observedSubject !== void 0 && issue.id !== observedSubject || issue.number !== issueNumber || issue.repository?.nameWithOwner.toLowerCase() !== `${repo.owner}/${repo.repo}`.toLowerCase()))
|
|
120
|
+
throw new CLIError("Native blocker evidence does not identify its exact selected source issue.");
|
|
121
|
+
if (maxPages !== void 0) {
|
|
122
|
+
const parent = JSON.stringify(issue.parent);
|
|
123
|
+
if (observedParent !== void 0 && observedParent !== parent)
|
|
124
|
+
throw new CLIError("Native parent identity changed while reading blocker pages.");
|
|
125
|
+
observedParent = parent;
|
|
126
|
+
observedSubject = issue.id;
|
|
127
|
+
}
|
|
128
|
+
for (const blocker of issue.blockedBy.nodes) {
|
|
129
|
+
if (maxPages !== void 0 && blockers.has(blocker.id))
|
|
130
|
+
throw new CLIError("Native blocker pagination repeats an identity.");
|
|
131
|
+
if (requireRepositoryIdentity && !blocker.repository?.nameWithOwner.match(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u))
|
|
132
|
+
throw new CLIError("Native blocker omitted its repository identity.");
|
|
133
|
+
const { repository, ...identity } = blocker;
|
|
134
|
+
blockers.set(blocker.id, {
|
|
135
|
+
...identity,
|
|
136
|
+
...requireRepositoryIdentity ? { repository: repository.nameWithOwner } : {}
|
|
137
|
+
});
|
|
141
138
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
if (requireRepositoryIdentity && issue.parent && (!issue.parent.number || !issue.parent.repository?.nameWithOwner.match(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u)))
|
|
140
|
+
throw new CLIError("Native parent omitted its repository identity.");
|
|
141
|
+
parentRepository = issue.parent?.repository?.nameWithOwner ?? null;
|
|
142
|
+
parentId = issue.parent?.id ?? null;
|
|
143
|
+
parentNumber = issue.parent?.number ?? null;
|
|
144
|
+
hasNextPage = issue.blockedBy.pageInfo.hasNextPage;
|
|
145
|
+
const nextCursor = issue.blockedBy.pageInfo.endCursor;
|
|
146
|
+
if (hasNextPage && nextCursor === null) {
|
|
147
|
+
throw new CLIError(`Native blocked-by pagination for issue #${String(issueNumber)} omitted its next cursor.`);
|
|
148
|
+
}
|
|
149
|
+
if (hasNextPage && nextCursor !== null && (nextCursor === cursor || seenCursors.has(nextCursor))) {
|
|
150
|
+
throw new CLIError(
|
|
151
|
+
`Native blocked-by pagination for issue #${String(issueNumber)} repeated a non-advancing cursor.`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
if (nextCursor !== null) seenCursors.add(nextCursor);
|
|
155
|
+
cursor = nextCursor;
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
blockers: [...blockers.values()].sort((left, right) => left.number - right.number),
|
|
159
|
+
parentId,
|
|
160
|
+
parentNumber,
|
|
161
|
+
...requireRepositoryIdentity ? { parentRepository } : {}
|
|
162
|
+
};
|
|
148
163
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
164
|
+
async function getNativeBlockingRelationships({
|
|
165
|
+
graphql,
|
|
166
|
+
issueNumber,
|
|
167
|
+
repo
|
|
168
|
+
}) {
|
|
169
|
+
const dependents = /* @__PURE__ */ new Map();
|
|
170
|
+
let cursor = null;
|
|
171
|
+
let hasNextPage = true;
|
|
172
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
173
|
+
while (hasNextPage) {
|
|
174
|
+
const response = await graphql(
|
|
175
|
+
`
|
|
157
176
|
query ($owner: String!, $name: String!, $number: Int!, $cursor: String) {
|
|
158
177
|
repository(owner: $owner, name: $name) {
|
|
159
178
|
issue(number: $number) {
|
|
@@ -172,52 +191,83 @@ export async function getNativeBlockingRelationships({ graphql, issueNumber, rep
|
|
|
172
191
|
}
|
|
173
192
|
}
|
|
174
193
|
}
|
|
175
|
-
`,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
for (const dependent of page.nodes)
|
|
182
|
-
dependents.set(dependent.number, dependent);
|
|
183
|
-
hasNextPage = page.pageInfo.hasNextPage;
|
|
184
|
-
const nextCursor = page.pageInfo.endCursor;
|
|
185
|
-
if (hasNextPage && nextCursor === null) {
|
|
186
|
-
throw new CLIError(`Native blocking pagination for issue #${String(issueNumber)} omitted its next cursor.`);
|
|
187
|
-
}
|
|
188
|
-
if (hasNextPage && nextCursor !== null && (nextCursor === cursor || seenCursors.has(nextCursor))) {
|
|
189
|
-
throw new CLIError(`Native blocking pagination for issue #${String(issueNumber)} repeated a non-advancing cursor.`);
|
|
190
|
-
}
|
|
191
|
-
if (nextCursor !== null)
|
|
192
|
-
seenCursors.add(nextCursor);
|
|
193
|
-
cursor = nextCursor;
|
|
194
|
+
`,
|
|
195
|
+
{ cursor, name: repo.repo, number: issueNumber, owner: repo.owner }
|
|
196
|
+
);
|
|
197
|
+
const parsed = NativeBlockingPageSchema.safeParse(response);
|
|
198
|
+
if (!parsed.success) {
|
|
199
|
+
throw new CLIError(`GitHub returned invalid blocking relationship evidence for issue #${String(issueNumber)}.`);
|
|
194
200
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
201
|
+
const page = parsed.data.repository.issue.blocking;
|
|
202
|
+
for (const dependent of page.nodes) dependents.set(dependent.number, dependent);
|
|
203
|
+
hasNextPage = page.pageInfo.hasNextPage;
|
|
204
|
+
const nextCursor = page.pageInfo.endCursor;
|
|
205
|
+
if (hasNextPage && nextCursor === null) {
|
|
206
|
+
throw new CLIError(`Native blocking pagination for issue #${String(issueNumber)} omitted its next cursor.`);
|
|
207
|
+
}
|
|
208
|
+
if (hasNextPage && nextCursor !== null && (nextCursor === cursor || seenCursors.has(nextCursor))) {
|
|
209
|
+
throw new CLIError(
|
|
210
|
+
`Native blocking pagination for issue #${String(issueNumber)} repeated a non-advancing cursor.`
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
if (nextCursor !== null) seenCursors.add(nextCursor);
|
|
214
|
+
cursor = nextCursor;
|
|
215
|
+
}
|
|
216
|
+
return [...dependents.values()].sort((left, right) => left.number - right.number);
|
|
206
217
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
218
|
+
async function hasNativeSubIssues({
|
|
219
|
+
issueNumber,
|
|
220
|
+
repo,
|
|
221
|
+
rest,
|
|
222
|
+
requireComplete = false
|
|
223
|
+
}) {
|
|
224
|
+
const response = await rest.issues.listSubIssues({
|
|
225
|
+
issue_number: issueNumber,
|
|
226
|
+
owner: repo.owner,
|
|
227
|
+
per_page: 1,
|
|
228
|
+
repo: repo.repo
|
|
229
|
+
});
|
|
230
|
+
if (requireComplete) {
|
|
231
|
+
if (!Array.isArray(response.data) || response.data.length > 1 || response.data.length === 0 && response.headers?.link)
|
|
232
|
+
throw new CLIError("Native child existence evidence is incomplete.");
|
|
233
|
+
for (const child of response.data) {
|
|
234
|
+
const parsed = z.object({
|
|
235
|
+
number: z.number().int().positive().safe(),
|
|
236
|
+
node_id: z.string().min(1),
|
|
237
|
+
id: z.number().int().positive().safe(),
|
|
238
|
+
html_url: z.string().url()
|
|
239
|
+
}).safeParse(child);
|
|
240
|
+
if (!parsed.success || "pull_request" in child) throw new CLIError("Native child identity is unreadable.");
|
|
241
|
+
const url = new URL(parsed.data.html_url);
|
|
242
|
+
if (url.protocol !== "https:" || url.hostname !== "github.com" || url.search || url.hash || !new RegExp(`^/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+/issues/${String(parsed.data.number)}$`, "u").test(url.pathname))
|
|
243
|
+
throw new CLIError("Native child identity is unreadable.");
|
|
210
244
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
245
|
+
}
|
|
246
|
+
return response.data.length > 0;
|
|
247
|
+
}
|
|
248
|
+
async function linkBlockedBy({
|
|
249
|
+
beforeAdd,
|
|
250
|
+
blockerNodeIds,
|
|
251
|
+
blockers,
|
|
252
|
+
existingBlockers = [],
|
|
253
|
+
graphql,
|
|
254
|
+
issueNumber,
|
|
255
|
+
repo,
|
|
256
|
+
rest
|
|
257
|
+
}) {
|
|
258
|
+
if (blockers.length === 0) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const requestedBlockers = [...new Set(blockers)];
|
|
262
|
+
const existing = /* @__PURE__ */ new Set([...existingBlockers, ...await getNativeBlockerNumbers({ graphql, issueNumber, repo })]);
|
|
263
|
+
const blockersToAdd = requestedBlockers.filter((blocker) => !existing.has(blocker));
|
|
264
|
+
if (blockersToAdd.length > 0) {
|
|
265
|
+
const issueNodeId = await issueNumberToNode({ issueNumber, repo, rest });
|
|
266
|
+
for (const blocker of blockersToAdd) {
|
|
267
|
+
const blockerNodeId = blockerNodeIds?.get(blocker) ?? await issueNumberToNode({ issueNumber: blocker, repo, rest });
|
|
268
|
+
if (await beforeAdd?.({ issueNumber, issueNodeId, blocker, blockerNodeId }) === false) continue;
|
|
269
|
+
await graphql(
|
|
270
|
+
`
|
|
221
271
|
mutation ($issue: ID!, $blocking: ID!) {
|
|
222
272
|
addBlockedBy(input: { issueId: $issue, blockingIssueId: $blocking }) {
|
|
223
273
|
issue {
|
|
@@ -225,51 +275,66 @@ export async function linkBlockedBy({ beforeAdd, blockerNodeIds, blockers, exist
|
|
|
225
275
|
}
|
|
226
276
|
}
|
|
227
277
|
}
|
|
228
|
-
`,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
logInfo(`Linked issue #${String(issueNumber)} as blocked by issue #${String(blocker)}.`);
|
|
278
|
+
`,
|
|
279
|
+
{
|
|
280
|
+
blocking: blockerNodeId,
|
|
281
|
+
issue: issueNodeId
|
|
233
282
|
}
|
|
283
|
+
);
|
|
284
|
+
logInfo(`Linked issue #${String(issueNumber)} as blocked by issue #${String(blocker)}.`);
|
|
234
285
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
286
|
+
}
|
|
287
|
+
const observed = new Set(await getNativeBlockerNumbers({ graphql, issueNumber, repo }));
|
|
288
|
+
const missing = requestedBlockers.filter((blocker) => !observed.has(blocker));
|
|
289
|
+
if (missing.length > 0) {
|
|
290
|
+
throw new CLIError(
|
|
291
|
+
`Native blocked-by readback for issue #${String(issueNumber)} omitted requested blocker(s): ${missing.map((blocker) => `#${String(blocker)}`).join(", ")}.`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
242
294
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
295
|
+
async function linkSubIssue({
|
|
296
|
+
parentIssueNumber,
|
|
297
|
+
repo,
|
|
298
|
+
rest,
|
|
299
|
+
subIssueId,
|
|
300
|
+
subIssueNumber
|
|
301
|
+
}) {
|
|
302
|
+
if (parentIssueNumber === subIssueNumber) {
|
|
303
|
+
throw new CLIError(`Issue #${String(subIssueNumber)} cannot be its own parent.`);
|
|
304
|
+
}
|
|
305
|
+
const resolvedSubIssueId = typeof subIssueId === "number" && Number.isFinite(subIssueId) ? subIssueId : await issueNumberToId({ issueNumber: subIssueNumber, repo, rest });
|
|
306
|
+
if (await parentContainsSubIssue({ parentIssueNumber, repo, rest, subIssueNumber })) {
|
|
307
|
+
logInfo(`Issue #${String(subIssueNumber)} is already a sub-issue of issue #${String(parentIssueNumber)}.`);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
await rest.issues.addSubIssue({
|
|
311
|
+
issue_number: parentIssueNumber,
|
|
312
|
+
owner: repo.owner,
|
|
313
|
+
repo: repo.repo,
|
|
314
|
+
sub_issue_id: resolvedSubIssueId
|
|
315
|
+
});
|
|
316
|
+
if (!await parentContainsSubIssue({ parentIssueNumber, repo, rest, subIssueNumber })) {
|
|
317
|
+
throw new CLIError(
|
|
318
|
+
`Native sub-issue readback for parent #${String(parentIssueNumber)} omitted requested issue #${String(subIssueNumber)}.`
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
logInfo(`Linked issue #${String(subIssueNumber)} as sub-issue of issue #${String(parentIssueNumber)}.`);
|
|
264
322
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
323
|
+
async function replaceBlockedBy({
|
|
324
|
+
beforeAdd,
|
|
325
|
+
blockers,
|
|
326
|
+
graphql,
|
|
327
|
+
issueNumber,
|
|
328
|
+
repo,
|
|
329
|
+
rest
|
|
330
|
+
}) {
|
|
331
|
+
const requested = [...new Set(blockers)].sort((left, right) => left - right);
|
|
332
|
+
const before = await getNativeBlockerRelationships({ graphql, issueNumber, repo });
|
|
333
|
+
const requestedSet = new Set(requested);
|
|
334
|
+
const issueNodeId = await issueNumberToNode({ issueNumber, repo, rest });
|
|
335
|
+
for (const blocker of before.blockers.filter((candidate) => !requestedSet.has(candidate.number))) {
|
|
336
|
+
await graphql(
|
|
337
|
+
`
|
|
273
338
|
mutation ($issue: ID!, $blocking: ID!) {
|
|
274
339
|
removeBlockedBy(input: { issueId: $issue, blockingIssueId: $blocking }) {
|
|
275
340
|
issue {
|
|
@@ -277,14 +342,16 @@ export async function replaceBlockedBy({ beforeAdd, blockers, graphql, issueNumb
|
|
|
277
342
|
}
|
|
278
343
|
}
|
|
279
344
|
}
|
|
280
|
-
`,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
345
|
+
`,
|
|
346
|
+
{ blocking: blocker.id, issue: issueNodeId }
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
const existing = new Set(before.blockers.map((blocker) => blocker.number));
|
|
350
|
+
for (const blocker of requested.filter((candidate) => !existing.has(candidate))) {
|
|
351
|
+
const blockerNodeId = await issueNumberToNode({ issueNumber: blocker, repo, rest });
|
|
352
|
+
if (await beforeAdd?.({ issueNumber, issueNodeId, blocker, blockerNodeId }) === false) continue;
|
|
353
|
+
await graphql(
|
|
354
|
+
`
|
|
288
355
|
mutation ($issue: ID!, $blocking: ID!) {
|
|
289
356
|
addBlockedBy(input: { issueId: $issue, blockingIssueId: $blocking }) {
|
|
290
357
|
issue {
|
|
@@ -292,135 +359,169 @@ export async function replaceBlockedBy({ beforeAdd, blockers, graphql, issueNumb
|
|
|
292
359
|
}
|
|
293
360
|
}
|
|
294
361
|
}
|
|
295
|
-
`,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
362
|
+
`,
|
|
363
|
+
{ blocking: blockerNodeId, issue: issueNodeId }
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
const observed = (await getNativeBlockerNumbers({ graphql, issueNumber, repo })).sort((left, right) => left - right);
|
|
367
|
+
if (observed.join(",") !== requested.join(",")) {
|
|
368
|
+
throw new CLIError(
|
|
369
|
+
`Native blocked-by replacement readback mismatch for issue #${String(issueNumber)}: expected ${requested.join(",") || "(none)"}, found ${observed.join(",") || "(none)"}.`
|
|
370
|
+
);
|
|
371
|
+
}
|
|
301
372
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
373
|
+
async function replaceParentIssue({
|
|
374
|
+
graphql,
|
|
375
|
+
issueNumber,
|
|
376
|
+
parentIssueNumber,
|
|
377
|
+
repo,
|
|
378
|
+
rest
|
|
379
|
+
}) {
|
|
380
|
+
if (parentIssueNumber === issueNumber) {
|
|
381
|
+
throw new CLIError(`Issue #${String(issueNumber)} cannot be its own parent.`);
|
|
382
|
+
}
|
|
383
|
+
const before = await getNativeBlockerRelationships({ graphql, issueNumber, repo });
|
|
384
|
+
if (before.parentNumber === parentIssueNumber) return;
|
|
385
|
+
const subIssueId = await issueNumberToId({ issueNumber, repo, rest });
|
|
386
|
+
if (before.parentNumber !== null) {
|
|
387
|
+
await rest.issues.removeSubIssue({
|
|
388
|
+
issue_number: before.parentNumber,
|
|
389
|
+
owner: repo.owner,
|
|
390
|
+
repo: repo.repo,
|
|
391
|
+
sub_issue_id: subIssueId
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
if (parentIssueNumber !== null) {
|
|
395
|
+
await linkSubIssue({ parentIssueNumber, repo, rest, subIssueId, subIssueNumber: issueNumber });
|
|
396
|
+
}
|
|
397
|
+
const after = await getNativeBlockerRelationships({ graphql, issueNumber, repo });
|
|
398
|
+
if (after.parentNumber !== parentIssueNumber) {
|
|
399
|
+
const expectedParent = parentIssueNumber === null ? "(none)" : `#${String(parentIssueNumber)}`;
|
|
400
|
+
const observedParent = after.parentNumber === null ? "(none)" : `#${String(after.parentNumber)}`;
|
|
401
|
+
throw new CLIError(
|
|
402
|
+
`Native parent replacement readback mismatch for issue #${String(issueNumber)}: expected ${expectedParent}, found ${observedParent}.`
|
|
403
|
+
);
|
|
404
|
+
}
|
|
328
405
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
406
|
+
async function resolveNativeRelationshipTargets({
|
|
407
|
+
blockers,
|
|
408
|
+
parentIssueNumber,
|
|
409
|
+
repo,
|
|
410
|
+
rest
|
|
411
|
+
}) {
|
|
412
|
+
const blockerNodeIds = /* @__PURE__ */ new Map();
|
|
413
|
+
const unresolvedBlockers = [];
|
|
414
|
+
for (const blocker of new Set(blockers)) {
|
|
415
|
+
const target = await resolveBlockerTarget({ issueNumber: blocker, repo, rest });
|
|
416
|
+
blockerNodeIds.set(blocker, target.nodeId);
|
|
417
|
+
if (target.state === "OPEN") unresolvedBlockers.push(blocker);
|
|
418
|
+
}
|
|
419
|
+
if (parentIssueNumber !== void 0) {
|
|
420
|
+
await requireIssueTarget({ issueNumber: parentIssueNumber, relationship: "parent", repo, rest });
|
|
421
|
+
}
|
|
422
|
+
return { blockerNodeIds, unresolvedBlockers };
|
|
343
423
|
}
|
|
344
424
|
async function issueNumberToId({ issueNumber, repo, rest }) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
return issueId;
|
|
425
|
+
try {
|
|
426
|
+
const issue = await rest.issues.get({
|
|
427
|
+
issue_number: issueNumber,
|
|
428
|
+
owner: repo.owner,
|
|
429
|
+
repo: repo.repo
|
|
430
|
+
});
|
|
431
|
+
const issueId = issue.data.id;
|
|
432
|
+
if (typeof issueId !== "number") {
|
|
433
|
+
throw new CLIError(`GitHub omitted the numeric issue id for issue #${String(issueNumber)}.`);
|
|
356
434
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
throw new CLIError(`Unable to resolve sub-issue id for issue #${String(issueNumber)}: ${formatError(error)}.`);
|
|
435
|
+
return issueId;
|
|
436
|
+
} catch (error) {
|
|
437
|
+
if (error instanceof CLIError) {
|
|
438
|
+
throw error;
|
|
362
439
|
}
|
|
440
|
+
throw new CLIError(`Unable to resolve sub-issue id for issue #${String(issueNumber)}: ${formatError(error)}.`);
|
|
441
|
+
}
|
|
363
442
|
}
|
|
364
443
|
async function issueNumberToNode({ issueNumber, repo, rest }) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
return nodeId;
|
|
444
|
+
try {
|
|
445
|
+
const issue = await rest.issues.get({
|
|
446
|
+
issue_number: issueNumber,
|
|
447
|
+
owner: repo.owner,
|
|
448
|
+
repo: repo.repo
|
|
449
|
+
});
|
|
450
|
+
const nodeId = issue.data.node_id;
|
|
451
|
+
if (typeof nodeId !== "string") {
|
|
452
|
+
throw new CLIError(`GitHub omitted the node id for issue #${String(issueNumber)}.`);
|
|
376
453
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
throw new CLIError(`Unable to resolve blocker issue #${String(issueNumber)}: ${formatError(error)}.`);
|
|
454
|
+
return nodeId;
|
|
455
|
+
} catch (error) {
|
|
456
|
+
if (error instanceof CLIError) {
|
|
457
|
+
throw error;
|
|
382
458
|
}
|
|
459
|
+
throw new CLIError(`Unable to resolve blocker issue #${String(issueNumber)}: ${formatError(error)}.`);
|
|
460
|
+
}
|
|
383
461
|
}
|
|
384
|
-
async function parentContainsSubIssue({
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
462
|
+
async function parentContainsSubIssue({
|
|
463
|
+
parentIssueNumber,
|
|
464
|
+
repo,
|
|
465
|
+
rest,
|
|
466
|
+
subIssueNumber
|
|
467
|
+
}) {
|
|
468
|
+
const observed = await rest.paginate(rest.issues.listSubIssues, {
|
|
469
|
+
issue_number: parentIssueNumber,
|
|
470
|
+
owner: repo.owner,
|
|
471
|
+
per_page: 100,
|
|
472
|
+
repo: repo.repo
|
|
473
|
+
});
|
|
474
|
+
return observed.some((issue) => issue.number === subIssueNumber);
|
|
392
475
|
}
|
|
393
|
-
async function requireIssueTarget({
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
476
|
+
async function requireIssueTarget({
|
|
477
|
+
issueNumber,
|
|
478
|
+
relationship,
|
|
479
|
+
repo,
|
|
480
|
+
rest
|
|
481
|
+
}) {
|
|
482
|
+
try {
|
|
483
|
+
await rest.issues.get({
|
|
484
|
+
issue_number: issueNumber,
|
|
485
|
+
owner: repo.owner,
|
|
486
|
+
repo: repo.repo
|
|
487
|
+
});
|
|
488
|
+
} catch (error) {
|
|
489
|
+
throw new CLIError(`Unable to resolve ${relationship} issue #${String(issueNumber)}: ${formatError(error)}.`);
|
|
490
|
+
}
|
|
404
491
|
}
|
|
405
|
-
async function resolveBlockerTarget({
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
492
|
+
async function resolveBlockerTarget({
|
|
493
|
+
issueNumber,
|
|
494
|
+
repo,
|
|
495
|
+
rest
|
|
496
|
+
}) {
|
|
497
|
+
try {
|
|
498
|
+
const issue = await rest.issues.get({
|
|
499
|
+
issue_number: issueNumber,
|
|
500
|
+
owner: repo.owner,
|
|
501
|
+
repo: repo.repo
|
|
502
|
+
});
|
|
503
|
+
const nodeId = issue.data.node_id;
|
|
504
|
+
const state = issue.data.state;
|
|
505
|
+
if (typeof nodeId !== "string" || state !== "open" && state !== "closed") {
|
|
506
|
+
throw new CLIError(`GitHub omitted the node id or state for blocker issue #${String(issueNumber)}.`);
|
|
418
507
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
throw new CLIError(`Unable to resolve blocker issue #${String(issueNumber)}: ${formatError(error)}.`);
|
|
508
|
+
return { nodeId, state: state === "open" ? "OPEN" : "CLOSED" };
|
|
509
|
+
} catch (error) {
|
|
510
|
+
if (error instanceof CLIError) {
|
|
511
|
+
throw error;
|
|
424
512
|
}
|
|
513
|
+
throw new CLIError(`Unable to resolve blocker issue #${String(issueNumber)}: ${formatError(error)}.`);
|
|
514
|
+
}
|
|
425
515
|
}
|
|
426
|
-
|
|
516
|
+
export {
|
|
517
|
+
getNativeBlockerNumbers,
|
|
518
|
+
getNativeBlockerRelationships,
|
|
519
|
+
getNativeBlockingRelationships,
|
|
520
|
+
hasNativeSubIssues,
|
|
521
|
+
linkBlockedBy,
|
|
522
|
+
linkSubIssue,
|
|
523
|
+
replaceBlockedBy,
|
|
524
|
+
replaceParentIssue,
|
|
525
|
+
resolveNativeRelationshipTargets
|
|
526
|
+
};
|
|
527
|
+
//# sourceMappingURL=relationships.js.map
|