@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,378 +1,382 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import { execFileSync } from
|
|
3
|
-
import { Console } from
|
|
4
|
-
import { mkdtempSync, realpathSync, rmSync, writeFileSync } from
|
|
5
|
-
import { tmpdir } from
|
|
6
|
-
import { join } from
|
|
7
|
-
import { Octokit } from
|
|
8
|
-
import { afterEach, test, vi } from
|
|
9
|
-
import { parseDeliveryConfig } from
|
|
10
|
-
import { syntheticDiscoveryConfig } from
|
|
11
|
-
import { replaceParentIssue } from
|
|
12
|
-
import { IssueFields, renderIssueBody } from
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { Console } from "node:console";
|
|
4
|
+
import { mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { Octokit } from "@octokit/rest";
|
|
8
|
+
import { afterEach, test, vi } from "vitest";
|
|
9
|
+
import { parseDeliveryConfig } from "./config/deliveryConfig.js";
|
|
10
|
+
import { syntheticDiscoveryConfig } from "./fixtures/discovery.js";
|
|
11
|
+
import { replaceParentIssue } from "./github/relationships.js";
|
|
12
|
+
import { IssueFields, renderIssueBody } from "./issueContract.js";
|
|
13
|
+
import {
|
|
14
|
+
CLIError,
|
|
15
|
+
handleCommandError,
|
|
16
|
+
logDebug,
|
|
17
|
+
logError,
|
|
18
|
+
logInfo,
|
|
19
|
+
logProgress,
|
|
20
|
+
logSuccess,
|
|
21
|
+
logWarn,
|
|
22
|
+
setLogsSuppressed
|
|
23
|
+
} from "./logger.js";
|
|
24
|
+
import { addWorktreeEntry, removeWorktreeEntry } from "./services/worktreeRegistry.js";
|
|
25
|
+
const projectReadback = vi.hoisted(() => ({ value: null }));
|
|
26
|
+
vi.mock("./github/nativeIssueMetadata.js", async (importOriginal) => ({
|
|
27
|
+
...await importOriginal(),
|
|
28
|
+
getConfiguredNativeIssueMetadata: async () => ({ points: 2 }),
|
|
29
|
+
setConfiguredNativeIssueMetadata: async () => ({ points: 2 }),
|
|
30
|
+
clearConfiguredNativeIssuePoints: async () => {
|
|
31
|
+
}
|
|
22
32
|
}));
|
|
23
|
-
vi.mock(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
vi.mock("./github/projectDelivery.js", async (importOriginal) => ({
|
|
34
|
+
...await importOriginal(),
|
|
35
|
+
assertIssueProjectWritable: async () => {
|
|
36
|
+
},
|
|
37
|
+
getIssueProjectStatus: async () => projectReadback.value,
|
|
38
|
+
syncIssueProjectStatus: async ({ status }) => projectReadback.value = { itemId: "SYNTHETIC-PROJECT-ITEM", status }
|
|
27
39
|
}));
|
|
28
40
|
afterEach(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
projectReadback.value = null;
|
|
42
|
+
vi.restoreAllMocks();
|
|
43
|
+
vi.unstubAllEnvs();
|
|
44
|
+
setLogsSuppressed(false);
|
|
32
45
|
});
|
|
33
|
-
const readyBody = renderIssueBody(
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
const readyBody = renderIssueBody(
|
|
47
|
+
IssueFields.parse({
|
|
48
|
+
title: "Synthetic change",
|
|
49
|
+
issueType: "Task",
|
|
36
50
|
points: 2,
|
|
37
|
-
problem:
|
|
38
|
-
outcome:
|
|
51
|
+
problem: "Parent-link diagnostics can corrupt the CLI JSON result.",
|
|
52
|
+
outcome: "Return one parseable JSON result after parent linking or branch failure.",
|
|
39
53
|
acceptanceCriteria: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
{
|
|
55
|
+
behavior: "Parent linking leaves stdout as one JSON result and diagnostics on stderr.",
|
|
56
|
+
verifiedBy: "Byte-level CLI stream assertions."
|
|
57
|
+
}
|
|
44
58
|
],
|
|
45
|
-
outOfScope: [
|
|
46
|
-
context: { files: [
|
|
47
|
-
})
|
|
59
|
+
outOfScope: ["Live GitHub access and host configuration."],
|
|
60
|
+
context: { files: ["artifact.txt"] }
|
|
61
|
+
})
|
|
62
|
+
);
|
|
48
63
|
function fixture(developmentFails = false) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
repository: {
|
|
134
|
-
issue: {
|
|
135
|
-
blockedBy: page,
|
|
136
|
-
parent: parent === null
|
|
137
|
-
? null
|
|
138
|
-
: { id: 'ISSUE-5', number: parent, repository: { nameWithOwner: 'example/widget' } },
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
};
|
|
64
|
+
const root = realpathSync(mkdtempSync(join(tmpdir(), "ai-delivery-stdout-")));
|
|
65
|
+
const git = (...args) => execFileSync("git", args, { cwd: root, encoding: "utf8" }).trim();
|
|
66
|
+
git("init", "-q", "-b", "main");
|
|
67
|
+
git("config", "user.name", "Synthetic Delivery");
|
|
68
|
+
git("config", "user.email", "delivery@example.test");
|
|
69
|
+
writeFileSync(join(root, "artifact.txt"), "synthetic\n");
|
|
70
|
+
git("add", "artifact.txt");
|
|
71
|
+
git("commit", "-qm", "synthetic base");
|
|
72
|
+
git("remote", "add", "origin", "https://github.com/example/widget.git");
|
|
73
|
+
git("update-ref", "refs/remotes/origin/main", git("rev-parse", "HEAD"));
|
|
74
|
+
git("symbolic-ref", "refs/remotes/origin/HEAD", "refs/remotes/origin/main");
|
|
75
|
+
let parent = null;
|
|
76
|
+
const issue = {
|
|
77
|
+
id: 170,
|
|
78
|
+
number: 17,
|
|
79
|
+
node_id: "ISSUE-17",
|
|
80
|
+
title: "Synthetic change",
|
|
81
|
+
body: readyBody,
|
|
82
|
+
state: "open",
|
|
83
|
+
html_url: "https://github.com/example/widget/issues/17",
|
|
84
|
+
labels: [],
|
|
85
|
+
type: { name: "Task" }
|
|
86
|
+
};
|
|
87
|
+
const rest = new Octokit();
|
|
88
|
+
rest.request = (async (route) => {
|
|
89
|
+
if (route === "GET /orgs/{org}/issue-fields")
|
|
90
|
+
return {
|
|
91
|
+
data: [
|
|
92
|
+
{ id: 101, name: "Estimate", data_type: "single_select" },
|
|
93
|
+
{ id: 102, name: "Urgency", data_type: "single_select" }
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
if (route === "GET /repos/{owner}/{repo}/issues/{issue_number}/issue-field-values")
|
|
97
|
+
return {
|
|
98
|
+
data: [
|
|
99
|
+
{
|
|
100
|
+
issue_field_id: 101,
|
|
101
|
+
issue_field_name: "Estimate",
|
|
102
|
+
data_type: "single_select",
|
|
103
|
+
value: "2",
|
|
104
|
+
single_select_option: { name: "2" }
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
throw new Error(`Unexpected synthetic stdout REST operation: ${route}`);
|
|
109
|
+
});
|
|
110
|
+
Object.assign(rest.issues, {
|
|
111
|
+
get: async ({ issue_number }) => ({
|
|
112
|
+
data: issue_number === 17 ? { ...issue, state: developmentFails ? "closed" : "open" } : { ...issue, number: issue_number, id: issue_number * 10, node_id: `ISSUE-${String(issue_number)}` }
|
|
113
|
+
}),
|
|
114
|
+
create: async (input) => {
|
|
115
|
+
issue.title = input.title;
|
|
116
|
+
issue.body = input.body;
|
|
117
|
+
return { data: issue };
|
|
118
|
+
},
|
|
119
|
+
listForRepo: async () => ({ data: [] }),
|
|
120
|
+
update: async (input) => {
|
|
121
|
+
if (input.title !== void 0) issue.title = input.title;
|
|
122
|
+
if (input.body !== void 0) issue.body = input.body;
|
|
123
|
+
return { data: issue };
|
|
124
|
+
},
|
|
125
|
+
listSubIssues: async ({ issue_number }) => ({
|
|
126
|
+
data: parent === issue_number ? [issue] : []
|
|
127
|
+
}),
|
|
128
|
+
addSubIssue: async ({ issue_number }) => {
|
|
129
|
+
parent = issue_number;
|
|
130
|
+
return { data: issue };
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
Object.assign(rest, {
|
|
134
|
+
paginate: async (_route, { issue_number }) => parent === issue_number ? [issue] : []
|
|
135
|
+
});
|
|
136
|
+
const clients = {
|
|
137
|
+
authSource: "personal",
|
|
138
|
+
role: "author",
|
|
139
|
+
rest,
|
|
140
|
+
graphql: (async (query) => {
|
|
141
|
+
const page = { nodes: [], pageInfo: { endCursor: null, hasNextPage: false } };
|
|
142
|
+
if (query.includes("blockedBy(")) {
|
|
143
|
+
return {
|
|
144
|
+
repository: {
|
|
145
|
+
issue: {
|
|
146
|
+
blockedBy: page,
|
|
147
|
+
parent: parent === null ? null : { id: "ISSUE-5", number: parent, repository: { nameWithOwner: "example/widget" } }
|
|
142
148
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (query.includes("blocking(")) return { repository: { issue: { blocking: page } } };
|
|
153
|
+
if (query.includes("subIssues(")) return { repository: { issue: { subIssues: page } } };
|
|
154
|
+
throw new Error("Unexpected synthetic stdout query.");
|
|
155
|
+
})
|
|
156
|
+
};
|
|
157
|
+
const config = parseDeliveryConfig({
|
|
158
|
+
...syntheticDiscoveryConfig,
|
|
159
|
+
schemaVersion: "ai-delivery.config@2",
|
|
160
|
+
policy: { contract: "RepositoryDeliveryPolicy@1", module: "./policy.mjs" },
|
|
161
|
+
roles: {
|
|
162
|
+
author: { identity: "host-author", authSource: "personal", credentialEnv: { token: "AUTHOR_TOKEN" } },
|
|
163
|
+
reviewer: {
|
|
164
|
+
identity: "synthetic-reviewer",
|
|
165
|
+
credentialEnv: {
|
|
166
|
+
appId: "REVIEWER_APP_ID",
|
|
167
|
+
installationId: "REVIEWER_INSTALLATION_ID",
|
|
168
|
+
privateKeyPath: "REVIEWER_KEY_PATH"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
commandPolicy: {
|
|
173
|
+
checks: { format: "REQUIRED", gitClean: "REQUIRED", lint: "REQUIRED", test: "REQUIRED", typecheck: "REQUIRED" },
|
|
174
|
+
timeoutsMs: { lint: 6e4, test: 6e4, typecheck: 6e4 }
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
context: { root, repo: { owner: "example", repo: "widget" }, clients, config },
|
|
179
|
+
cleanup: () => rmSync(root, { recursive: true, force: true })
|
|
180
|
+
};
|
|
174
181
|
}
|
|
175
182
|
function captureStreams() {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
err.mockRestore();
|
|
194
|
-
globalThis.console = previousConsole;
|
|
195
|
-
},
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
test('parent replacement emits its diagnostic on stderr without writing any stdout bytes', async () => {
|
|
199
|
-
const f = fixture();
|
|
200
|
-
const capture = captureStreams();
|
|
201
|
-
try {
|
|
202
|
-
await replaceParentIssue({ ...f.context.clients, repo: f.context.repo, issueNumber: 17, parentIssueNumber: 5 });
|
|
203
|
-
assert.equal(capture.output.stdout, '');
|
|
204
|
-
assert.match(capture.output.stderr, /Linked issue #17 as sub-issue of issue #5\./u);
|
|
205
|
-
}
|
|
206
|
-
finally {
|
|
207
|
-
capture.restore();
|
|
208
|
-
f.cleanup();
|
|
183
|
+
const output = { stdout: "", stderr: "" };
|
|
184
|
+
const previousConsole = globalThis.console;
|
|
185
|
+
globalThis.console = new Console(process.stdout, process.stderr);
|
|
186
|
+
const out = vi.spyOn(process.stdout, "write").mockImplementation((value) => {
|
|
187
|
+
output.stdout += String(value);
|
|
188
|
+
return true;
|
|
189
|
+
});
|
|
190
|
+
const err = vi.spyOn(process.stderr, "write").mockImplementation((value) => {
|
|
191
|
+
output.stderr += String(value);
|
|
192
|
+
return true;
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
output,
|
|
196
|
+
restore: () => {
|
|
197
|
+
out.mockRestore();
|
|
198
|
+
err.mockRestore();
|
|
199
|
+
globalThis.console = previousConsole;
|
|
209
200
|
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
test("parent replacement emits its diagnostic on stderr without writing any stdout bytes", async () => {
|
|
204
|
+
const f = fixture();
|
|
205
|
+
const capture = captureStreams();
|
|
206
|
+
try {
|
|
207
|
+
await replaceParentIssue({ ...f.context.clients, repo: f.context.repo, issueNumber: 17, parentIssueNumber: 5 });
|
|
208
|
+
assert.equal(capture.output.stdout, "");
|
|
209
|
+
assert.match(capture.output.stderr, /Linked issue #17 as sub-issue of issue #5\./u);
|
|
210
|
+
} finally {
|
|
211
|
+
capture.restore();
|
|
212
|
+
f.cleanup();
|
|
213
|
+
}
|
|
210
214
|
});
|
|
211
|
-
test.each([
|
|
215
|
+
test.each(["add", "remove"])(
|
|
216
|
+
"registry %s emits its diagnostic without writing any stdout bytes",
|
|
217
|
+
async (operation) => {
|
|
212
218
|
const f = fixture();
|
|
213
219
|
const row = {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
path: join(f.context.root, ".worktrees", "synthetic"),
|
|
221
|
+
branch: "issue/17",
|
|
222
|
+
type: "issue",
|
|
223
|
+
issueNumber: 17,
|
|
224
|
+
identity: "host-author",
|
|
225
|
+
status: "active",
|
|
226
|
+
createdAt: "2026-10-08T00:00:00Z",
|
|
227
|
+
updatedAt: "2026-10-08T00:00:00Z"
|
|
222
228
|
};
|
|
223
229
|
const capture = captureStreams();
|
|
224
230
|
try {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
231
|
+
await addWorktreeEntry(row, f.context.root);
|
|
232
|
+
if (operation === "remove") {
|
|
233
|
+
capture.output.stdout = "";
|
|
234
|
+
capture.output.stderr = "";
|
|
235
|
+
assert.equal(await removeWorktreeEntry(row.path, f.context.root), true);
|
|
236
|
+
}
|
|
237
|
+
assert.equal(capture.output.stdout, "");
|
|
238
|
+
assert.match(
|
|
239
|
+
capture.output.stderr,
|
|
240
|
+
operation === "add" ? /Added to worktree registry:/u : /Removed from worktree registry:/u
|
|
241
|
+
);
|
|
242
|
+
} finally {
|
|
243
|
+
capture.restore();
|
|
244
|
+
f.cleanup();
|
|
237
245
|
}
|
|
238
|
-
}
|
|
246
|
+
}
|
|
247
|
+
);
|
|
239
248
|
async function runCli(context, args) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
catch (error) {
|
|
272
|
-
failed(error);
|
|
273
|
-
throw error;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
vi.spyOn(process.stdout, 'write').mockImplementation((value) => {
|
|
277
|
-
capture.output.stdout += String(value);
|
|
278
|
-
// Wait for the result, not the earlier diagnostic chunk that reproduces #74.
|
|
279
|
-
if (String(value).startsWith('{'))
|
|
280
|
-
completed();
|
|
281
|
-
return true;
|
|
282
|
-
});
|
|
249
|
+
vi.resetModules();
|
|
250
|
+
const configuration = await import("./config/deliveryConfig.js");
|
|
251
|
+
const issues = await import("./issue.js");
|
|
252
|
+
const admission = await import("./services/deliveryAdmission.js");
|
|
253
|
+
const prs = await import("./pr.js");
|
|
254
|
+
const dispatch = await import("./dispatch.js");
|
|
255
|
+
vi.spyOn(configuration, "loadDeliverySettings").mockResolvedValue({
|
|
256
|
+
...context.config,
|
|
257
|
+
configPath: "synthetic-user.json",
|
|
258
|
+
checkoutRoots: [],
|
|
259
|
+
overrides: { schemaVersion: "ai-delivery.config@2" },
|
|
260
|
+
sourceDigest: "synthetic"
|
|
261
|
+
});
|
|
262
|
+
vi.spyOn(issues, "loadDeliveryContext").mockResolvedValue(context);
|
|
263
|
+
vi.spyOn(admission, "assertDeliveryRuntimeAdmitted").mockResolvedValue(
|
|
264
|
+
{}
|
|
265
|
+
);
|
|
266
|
+
vi.spyOn(prs, "preflightReviewRoute").mockResolvedValue({});
|
|
267
|
+
const argv = process.argv;
|
|
268
|
+
const exitCode = process.exitCode;
|
|
269
|
+
const capture = captureStreams();
|
|
270
|
+
let completed = () => {
|
|
271
|
+
};
|
|
272
|
+
let failed = () => {
|
|
273
|
+
};
|
|
274
|
+
const resultWritten = new Promise((resolve, reject) => {
|
|
275
|
+
completed = resolve;
|
|
276
|
+
failed = reject;
|
|
277
|
+
});
|
|
278
|
+
const execute = dispatch.executeTool;
|
|
279
|
+
vi.spyOn(dispatch, "executeTool").mockImplementation(async (...input) => {
|
|
283
280
|
try {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return { ...capture.output, exitCode: process.exitCode };
|
|
289
|
-
}
|
|
290
|
-
finally {
|
|
291
|
-
capture.restore();
|
|
292
|
-
vi.restoreAllMocks();
|
|
293
|
-
process.argv = argv;
|
|
294
|
-
process.exitCode = exitCode;
|
|
281
|
+
return await execute(...input);
|
|
282
|
+
} catch (error) {
|
|
283
|
+
failed(error);
|
|
284
|
+
throw error;
|
|
295
285
|
}
|
|
286
|
+
});
|
|
287
|
+
vi.spyOn(process.stdout, "write").mockImplementation((value) => {
|
|
288
|
+
capture.output.stdout += String(value);
|
|
289
|
+
if (String(value).startsWith("{")) completed();
|
|
290
|
+
return true;
|
|
291
|
+
});
|
|
292
|
+
try {
|
|
293
|
+
process.exitCode = void 0;
|
|
294
|
+
process.argv = [process.execPath, "ai-delivery", "--repo-root", context.root, "--identity", "host-author", ...args];
|
|
295
|
+
await import("./cli.js");
|
|
296
|
+
await resultWritten;
|
|
297
|
+
return { ...capture.output, exitCode: process.exitCode };
|
|
298
|
+
} finally {
|
|
299
|
+
capture.restore();
|
|
300
|
+
vi.restoreAllMocks();
|
|
301
|
+
process.argv = argv;
|
|
302
|
+
process.exitCode = exitCode;
|
|
303
|
+
}
|
|
296
304
|
}
|
|
297
|
-
test(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
305
|
+
test("parent update through the CLI entry produces one parseable JSON result", async () => {
|
|
306
|
+
const f = fixture();
|
|
307
|
+
try {
|
|
308
|
+
const output = await runCli(f.context, ["update", "--issue", "17", "--parent", "5"]);
|
|
309
|
+
const result = JSON.parse(output.stdout);
|
|
310
|
+
assert.equal(result.issueNumber, 17);
|
|
311
|
+
assert.equal(result.parentIssueNumber, 5);
|
|
312
|
+
assert.equal(output.exitCode, void 0);
|
|
313
|
+
assert.match(output.stderr, /Linked issue #17 as sub-issue of issue #5\./u);
|
|
314
|
+
} finally {
|
|
315
|
+
f.cleanup();
|
|
316
|
+
}
|
|
310
317
|
});
|
|
311
|
-
test(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
318
|
+
test("failed remote branch start after parent linking preserves parseable CLI recovery JSON and nonzero exit", async () => {
|
|
319
|
+
const f = fixture(true);
|
|
320
|
+
try {
|
|
321
|
+
const output = await runCli(f.context, [
|
|
322
|
+
"start",
|
|
323
|
+
"--title",
|
|
324
|
+
"Synthetic change",
|
|
325
|
+
"--body",
|
|
326
|
+
readyBody,
|
|
327
|
+
"--parent",
|
|
328
|
+
"5"
|
|
329
|
+
]);
|
|
330
|
+
const result = JSON.parse(output.stdout);
|
|
331
|
+
assert.equal(result.status, "created-not-started");
|
|
332
|
+
assert.equal(result.createdIssue.number, 17);
|
|
333
|
+
assert.equal(result.failure.phase, "branch-or-journal");
|
|
334
|
+
assert.match(result.failure.message, /open GitHub issue/u);
|
|
335
|
+
assert.equal(result.safeResume.arguments.issueNumber, 17);
|
|
336
|
+
assert.equal("parentIssueNumber" in result.safeResume.arguments, false);
|
|
337
|
+
assert.equal("resumeCreated" in result.safeResume.arguments, false);
|
|
338
|
+
assert.equal(output.exitCode, 1);
|
|
339
|
+
assert.match(output.stderr, /Linked issue #17 as sub-issue of issue #5\./u);
|
|
340
|
+
} finally {
|
|
341
|
+
f.cleanup();
|
|
342
|
+
}
|
|
337
343
|
});
|
|
338
|
-
test(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
finally {
|
|
355
|
-
capture.restore();
|
|
344
|
+
test("all enabled diagnostics preserve their content on stderr", () => {
|
|
345
|
+
vi.stubEnv("DEBUG", "1");
|
|
346
|
+
const capture = captureStreams();
|
|
347
|
+
try {
|
|
348
|
+
logDebug("debug proof");
|
|
349
|
+
logInfo("info proof");
|
|
350
|
+
logSuccess("success proof");
|
|
351
|
+
logWarn("warning proof");
|
|
352
|
+
logError("error proof");
|
|
353
|
+
logProgress("progress proof");
|
|
354
|
+
handleCommandError(new CLIError("failure proof", { hint: "retry proof" }));
|
|
355
|
+
assert.equal(capture.output.stdout, "");
|
|
356
|
+
for (const message of ["debug", "info", "success", "warning", "error", "progress", "failure", "retry"]) {
|
|
357
|
+
assert.match(capture.output.stderr, new RegExp(`${message} proof`, "u"));
|
|
356
358
|
}
|
|
359
|
+
} finally {
|
|
360
|
+
capture.restore();
|
|
361
|
+
}
|
|
357
362
|
});
|
|
358
|
-
test(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
363
|
+
test("MCP suppression still silences diagnostics while retaining errors and recovery hints on stderr", () => {
|
|
364
|
+
vi.stubEnv("DEBUG", "true");
|
|
365
|
+
setLogsSuppressed(true);
|
|
366
|
+
const capture = captureStreams();
|
|
367
|
+
try {
|
|
368
|
+
logDebug("hidden");
|
|
369
|
+
logInfo("hidden");
|
|
370
|
+
logSuccess("hidden");
|
|
371
|
+
logWarn("hidden");
|
|
372
|
+
logProgress("hidden");
|
|
373
|
+
handleCommandError(new CLIError("visible error", { hint: "visible recovery" }));
|
|
374
|
+
assert.equal(capture.output.stdout, "");
|
|
375
|
+
assert.doesNotMatch(capture.output.stderr, /hidden/u);
|
|
376
|
+
assert.match(capture.output.stderr, /visible error/u);
|
|
377
|
+
assert.match(capture.output.stderr, /visible recovery/u);
|
|
378
|
+
} finally {
|
|
379
|
+
capture.restore();
|
|
380
|
+
}
|
|
377
381
|
});
|
|
378
|
-
//# sourceMappingURL=stdoutRegression.test.js.map
|
|
382
|
+
//# sourceMappingURL=stdoutRegression.test.js.map
|