@aviaratech/ai-delivery 0.3.35 → 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.
Files changed (297) hide show
  1. package/CONTRIBUTING.md +12 -206
  2. package/README.md +57 -554
  3. package/dist/agent.d.ts +0 -2
  4. package/dist/agent.js +76 -16
  5. package/dist/agent.js.map +7 -1
  6. package/dist/agentReadiness.test.js +73 -67
  7. package/dist/agentReadiness.test.js.map +7 -1
  8. package/dist/boardReconcile.test.js +1651 -1590
  9. package/dist/boardReconcile.test.js.map +7 -1
  10. package/dist/build.test.js +130 -0
  11. package/dist/build.test.js.map +7 -0
  12. package/dist/callerErrors.test.js +105 -0
  13. package/dist/callerErrors.test.js.map +7 -0
  14. package/dist/cli.js +402 -515
  15. package/dist/cli.js.map +7 -1
  16. package/dist/cliResult.d.ts +2 -2
  17. package/dist/cliResult.js +42 -45
  18. package/dist/cliResult.js.map +7 -1
  19. package/dist/cliResult.test.js +424 -369
  20. package/dist/cliResult.test.js.map +7 -1
  21. package/dist/config/deliveryConfig.d.ts +288 -14
  22. package/dist/config/deliveryConfig.js +472 -390
  23. package/dist/config/deliveryConfig.js.map +7 -1
  24. package/dist/config/deliveryConfig.test.js +773 -649
  25. package/dist/config/deliveryConfig.test.js.map +7 -1
  26. package/dist/contributorChecks.test.js +1694 -916
  27. package/dist/contributorChecks.test.js.map +7 -1
  28. package/dist/currentConsumer.test.js +819 -737
  29. package/dist/currentConsumer.test.js.map +7 -1
  30. package/dist/currentTrackingScenario.test.js +499 -479
  31. package/dist/currentTrackingScenario.test.js.map +7 -1
  32. package/dist/delivery/common.js +160 -172
  33. package/dist/delivery/common.js.map +7 -1
  34. package/dist/delivery/delivery.test.js +509 -431
  35. package/dist/delivery/delivery.test.js.map +7 -1
  36. package/dist/delivery/evidence.d.ts +2 -2
  37. package/dist/delivery/evidence.js +133 -120
  38. package/dist/delivery/evidence.js.map +7 -1
  39. package/dist/delivery/index.js +7 -2
  40. package/dist/delivery/index.js.map +7 -1
  41. package/dist/delivery/legacy.js +65 -5
  42. package/dist/delivery/legacy.js.map +7 -1
  43. package/dist/delivery/policy.d.ts +10 -10
  44. package/dist/delivery/policy.js +211 -238
  45. package/dist/delivery/policy.js.map +7 -1
  46. package/dist/delivery/stage.d.ts +18 -18
  47. package/dist/delivery/stage.js +220 -235
  48. package/dist/delivery/stage.js.map +7 -1
  49. package/dist/deliveryBoard.d.ts +74 -0
  50. package/dist/deliveryBoard.js +644 -0
  51. package/dist/deliveryBoard.js.map +7 -0
  52. package/dist/deliveryBoard.test.js +649 -0
  53. package/dist/deliveryBoard.test.js.map +7 -0
  54. package/dist/deliveryHealth.test.js +179 -155
  55. package/dist/deliveryHealth.test.js.map +7 -1
  56. package/dist/dependencyCompatibility.test.js +154 -140
  57. package/dist/dependencyCompatibility.test.js.map +7 -1
  58. package/dist/directoryIndependent.test.js +417 -383
  59. package/dist/directoryIndependent.test.js.map +7 -1
  60. package/dist/dispatch.d.ts +16 -11
  61. package/dist/dispatch.js +329 -353
  62. package/dist/dispatch.js.map +7 -1
  63. package/dist/errors.d.ts +3 -3
  64. package/dist/errors.js +103 -96
  65. package/dist/errors.js.map +7 -1
  66. package/dist/fixtures/deliveryBoardReplay.d.ts +56 -0
  67. package/dist/fixtures/deliveryBoardReplay.js +617 -0
  68. package/dist/fixtures/deliveryBoardReplay.js.map +7 -0
  69. package/dist/fixtures/discovery.d.ts +59 -19
  70. package/dist/fixtures/discovery.js +96 -90
  71. package/dist/fixtures/discovery.js.map +7 -1
  72. package/dist/fixtures/inertEntrypointChild.js +57 -56
  73. package/dist/fixtures/inertEntrypointChild.js.map +7 -1
  74. package/dist/fixtures/inertEntrypoints.d.ts +1 -1
  75. package/dist/fixtures/inertEntrypoints.js +321 -276
  76. package/dist/fixtures/inertEntrypoints.js.map +7 -1
  77. package/dist/fixtures/inertTarget.d.ts +78 -7
  78. package/dist/fixtures/inertTarget.js +769 -691
  79. package/dist/fixtures/inertTarget.js.map +7 -1
  80. package/dist/fixtures/issue63.d.ts +4 -3
  81. package/dist/fixtures/issue63.js +260 -274
  82. package/dist/fixtures/issue63.js.map +7 -1
  83. package/dist/fixtures/issueProjectItems.d.ts +20 -0
  84. package/dist/fixtures/issueProjectItems.js +15 -0
  85. package/dist/fixtures/issueProjectItems.js.map +7 -0
  86. package/dist/fixtures/readView.d.ts +120 -0
  87. package/dist/fixtures/readView.js +172 -0
  88. package/dist/fixtures/readView.js.map +7 -0
  89. package/dist/fixtures/recordedGitHubFlows.d.ts +120 -0
  90. package/dist/fixtures/recordedGitHubFlows.js +109 -0
  91. package/dist/fixtures/recordedGitHubFlows.js.map +7 -0
  92. package/dist/genericCompatibility.test.js +64 -55
  93. package/dist/genericCompatibility.test.js.map +7 -1
  94. package/dist/git.js +73 -67
  95. package/dist/git.js.map +7 -1
  96. package/dist/gitProcess.d.ts +1 -1
  97. package/dist/gitProcess.js +58 -53
  98. package/dist/gitProcess.js.map +7 -1
  99. package/dist/github/client.d.ts +2 -2
  100. package/dist/github/client.js +484 -379
  101. package/dist/github/client.js.map +7 -1
  102. package/dist/github/commandIdentityPolicy.js +44 -52
  103. package/dist/github/commandIdentityPolicy.js.map +7 -1
  104. package/dist/github/discovery.d.ts +1 -0
  105. package/dist/github/discovery.js +197 -215
  106. package/dist/github/discovery.js.map +7 -1
  107. package/dist/github/discovery.test.js +223 -177
  108. package/dist/github/discovery.test.js.map +7 -1
  109. package/dist/github/issueHistory.d.ts +2 -2
  110. package/dist/github/issueHistory.js +117 -125
  111. package/dist/github/issueHistory.js.map +7 -1
  112. package/dist/github/machineAuth.d.ts +1 -1
  113. package/dist/github/machineAuth.js +126 -117
  114. package/dist/github/machineAuth.js.map +7 -1
  115. package/dist/github/machineAuth.test.js +755 -639
  116. package/dist/github/machineAuth.test.js.map +7 -1
  117. package/dist/github/nativeIssueMetadata.js +286 -273
  118. package/dist/github/nativeIssueMetadata.js.map +7 -1
  119. package/dist/github/projectDelivery.d.ts +18 -2
  120. package/dist/github/projectDelivery.js +615 -557
  121. package/dist/github/projectDelivery.js.map +7 -1
  122. package/dist/github/relationships.js +433 -389
  123. package/dist/github/relationships.js.map +7 -1
  124. package/dist/github/repo.d.ts +1 -0
  125. package/dist/github/repo.js +123 -96
  126. package/dist/github/repo.js.map +7 -1
  127. package/dist/index.js +3 -3
  128. package/dist/index.js.map +7 -1
  129. package/dist/issue.d.ts +40 -9
  130. package/dist/issue.js +2102 -1742
  131. package/dist/issue.js.map +7 -1
  132. package/dist/issue63History.test.js +40 -42
  133. package/dist/issue63History.test.js.map +7 -1
  134. package/dist/issue63Routes.test.js +154 -143
  135. package/dist/issue63Routes.test.js.map +7 -1
  136. package/dist/issueBatchUpdate.test.js +989 -885
  137. package/dist/issueBatchUpdate.test.js.map +7 -1
  138. package/dist/issueBlockerGuard.test.js +262 -226
  139. package/dist/issueBlockerGuard.test.js.map +7 -1
  140. package/dist/issueContract.d.ts +23 -4
  141. package/dist/issueContract.js +416 -395
  142. package/dist/issueContract.js.map +7 -1
  143. package/dist/issueContract.test.d.ts +4 -3
  144. package/dist/issueContract.test.js +358 -321
  145. package/dist/issueContract.test.js.map +7 -1
  146. package/dist/issueDates.test.js +235 -233
  147. package/dist/issueDates.test.js.map +7 -1
  148. package/dist/issueInfoReadback.test.js +304 -190
  149. package/dist/issueInfoReadback.test.js.map +7 -1
  150. package/dist/issueIntake.test.js +1945 -1732
  151. package/dist/issueIntake.test.js.map +7 -1
  152. package/dist/issueJournal.d.ts +40 -19
  153. package/dist/issueJournal.js +229 -138
  154. package/dist/issueJournal.js.map +7 -1
  155. package/dist/issueJournal.test.js +605 -422
  156. package/dist/issueJournal.test.js.map +7 -1
  157. package/dist/issueRollup.test.d.ts +1 -0
  158. package/dist/issueRollup.test.js +476 -0
  159. package/dist/issueRollup.test.js.map +7 -0
  160. package/dist/issueTracking.test.js +1059 -989
  161. package/dist/issueTracking.test.js.map +7 -1
  162. package/dist/issueWriteRecovery.test.d.ts +1 -0
  163. package/dist/issueWriteRecovery.test.js +260 -0
  164. package/dist/issueWriteRecovery.test.js.map +7 -0
  165. package/dist/lifecycle.test.js +112 -441
  166. package/dist/lifecycle.test.js.map +7 -1
  167. package/dist/logger.js +80 -74
  168. package/dist/logger.js.map +7 -1
  169. package/dist/mcp/index.js +116 -94
  170. package/dist/mcp/index.js.map +7 -1
  171. package/dist/mcp/tools.d.ts +264 -286
  172. package/dist/mcp/tools.js +267 -340
  173. package/dist/mcp/tools.js.map +7 -1
  174. package/dist/pluginAuthProbe.js +63 -52
  175. package/dist/pluginAuthProbe.js.map +7 -1
  176. package/dist/pluginAuthProbe.test.js +85 -62
  177. package/dist/pluginAuthProbe.test.js.map +7 -1
  178. package/dist/pluginCredentials.test.js +282 -259
  179. package/dist/pluginCredentials.test.js.map +7 -1
  180. package/dist/pluginDoctor.test.js +653 -588
  181. package/dist/pluginDoctor.test.js.map +7 -1
  182. package/dist/pluginInstaller.d.ts +7 -5
  183. package/dist/pluginInstaller.js +1173 -1229
  184. package/dist/pluginInstaller.js.map +7 -1
  185. package/dist/pluginInstaller.test.js +1842 -1423
  186. package/dist/pluginInstaller.test.js.map +7 -1
  187. package/dist/pluginPackaging.test.js +460 -409
  188. package/dist/pluginPackaging.test.js.map +7 -1
  189. package/dist/pr.d.ts +132 -94
  190. package/dist/pr.js +1521 -1323
  191. package/dist/pr.js.map +7 -1
  192. package/dist/pr.test.js +1678 -632
  193. package/dist/pr.test.js.map +7 -1
  194. package/dist/prAssociation.test.js +2419 -1788
  195. package/dist/prAssociation.test.js.map +7 -1
  196. package/dist/prDispatch.test.js +150 -89
  197. package/dist/prDispatch.test.js.map +7 -1
  198. package/dist/readView.d.ts +183 -0
  199. package/dist/readView.js +217 -0
  200. package/dist/readView.js.map +7 -0
  201. package/dist/readView.test.d.ts +1 -0
  202. package/dist/readView.test.js +119 -0
  203. package/dist/readView.test.js.map +7 -0
  204. package/dist/releaseReconciliation.test.js +267 -288
  205. package/dist/releaseReconciliation.test.js.map +7 -1
  206. package/dist/releaseWorkflow.test.js +2493 -422
  207. package/dist/releaseWorkflow.test.js.map +7 -1
  208. package/dist/review.d.ts +738 -2
  209. package/dist/review.js +601 -348
  210. package/dist/review.js.map +7 -1
  211. package/dist/review.test.js +1218 -812
  212. package/dist/review.test.js.map +7 -1
  213. package/dist/reviewSubmit.test.d.ts +1 -0
  214. package/dist/reviewSubmit.test.js +747 -0
  215. package/dist/reviewSubmit.test.js.map +7 -0
  216. package/dist/services/agentReadinessService.js +42 -37
  217. package/dist/services/agentReadinessService.js.map +7 -1
  218. package/dist/services/blockerGuardService.js +188 -188
  219. package/dist/services/blockerGuardService.js.map +7 -1
  220. package/dist/services/boardReconcileService.d.ts +125 -125
  221. package/dist/services/boardReconcileService.js +1295 -1421
  222. package/dist/services/boardReconcileService.js.map +7 -1
  223. package/dist/services/deliveryAdmission.js +131 -154
  224. package/dist/services/deliveryAdmission.js.map +7 -1
  225. package/dist/services/deliveryHealthService.js +197 -199
  226. package/dist/services/deliveryHealthService.js.map +7 -1
  227. package/dist/services/legacyIssueMigration.js +263 -277
  228. package/dist/services/legacyIssueMigration.js.map +7 -1
  229. package/dist/services/worktreeRegistry.d.ts +27 -119
  230. package/dist/services/worktreeRegistry.js +765 -1182
  231. package/dist/services/worktreeRegistry.js.map +7 -1
  232. package/dist/stagedChecks.test.js +396 -194
  233. package/dist/stagedChecks.test.js.map +7 -1
  234. package/dist/start.test.js +99 -95
  235. package/dist/start.test.js.map +7 -1
  236. package/dist/stdoutRegression.test.js +353 -352
  237. package/dist/stdoutRegression.test.js.map +7 -1
  238. package/dist/targetPolicyDiscovery.test.js +141 -143
  239. package/dist/targetPolicyDiscovery.test.js.map +7 -1
  240. package/dist/targetPolicyEntrypoints.test.js +308 -269
  241. package/dist/targetPolicyEntrypoints.test.js.map +7 -1
  242. package/dist/targetPolicyLocal.test.js +580 -1051
  243. package/dist/targetPolicyLocal.test.js.map +7 -1
  244. package/dist/targetPolicyRoutes.test.js +305 -281
  245. package/dist/targetPolicyRoutes.test.js.map +7 -1
  246. package/dist/targetRepositoryExecution.test.d.ts +1 -0
  247. package/dist/targetRepositoryExecution.test.js +463 -0
  248. package/dist/targetRepositoryExecution.test.js.map +7 -0
  249. package/dist/terminalMessages.js +41 -35
  250. package/dist/terminalMessages.js.map +7 -1
  251. package/dist/toolOutput.d.ts +2 -0
  252. package/dist/toolOutput.js +36 -0
  253. package/dist/toolOutput.js.map +7 -0
  254. package/dist/toolOutput.test.d.ts +1 -0
  255. package/dist/toolOutput.test.js +240 -0
  256. package/dist/toolOutput.test.js.map +7 -0
  257. package/dist/utils/atomicJson.js +84 -76
  258. package/dist/utils/atomicJson.js.map +7 -1
  259. package/dist/utils/filesystem.js +15 -18
  260. package/dist/utils/filesystem.js.map +7 -1
  261. package/dist/utils/lockfile.js +68 -71
  262. package/dist/utils/lockfile.js.map +7 -1
  263. package/dist/verification.d.ts +1 -19
  264. package/dist/verification.js +1020 -1939
  265. package/dist/verification.js.map +7 -1
  266. package/dist/verificationGate.test.js +127 -117
  267. package/dist/verificationGate.test.js.map +7 -1
  268. package/dist/version.js +23 -24
  269. package/dist/version.js.map +7 -1
  270. package/dist/worktree.d.ts +3 -15
  271. package/dist/worktree.js +97 -177
  272. package/dist/worktree.js.map +7 -1
  273. package/package.json +9 -8
  274. package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
  275. package/plugins/ai-delivery/README.md +47 -156
  276. package/plugins/ai-delivery/plugin.json +1 -1
  277. package/plugins/ai-delivery/runtime/dist/THIRD-PARTY-NOTICES.md +238 -44
  278. package/plugins/ai-delivery/runtime/dist/cli.js +358 -115
  279. package/plugins/ai-delivery/runtime/package.json +1 -1
  280. package/plugins/ai-delivery/skills/intake-create/SKILL.md +14 -78
  281. package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +35 -36
  282. package/plugins/ai-delivery/skills/worktree-lifecycle/SKILL.md +14 -15
  283. package/dist/investigationCompletion.test.js +0 -728
  284. package/dist/investigationCompletion.test.js.map +0 -1
  285. package/dist/setup.d.ts +0 -60
  286. package/dist/setup.js +0 -585
  287. package/dist/setup.js.map +0 -1
  288. package/dist/setup.test.js +0 -3329
  289. package/dist/setup.test.js.map +0 -1
  290. package/dist/worktreeTransition.d.ts +0 -211
  291. package/dist/worktreeTransition.js +0 -1037
  292. package/dist/worktreeTransition.js.map +0 -1
  293. package/dist/worktreeTransition.test.js +0 -1191
  294. package/dist/worktreeTransition.test.js.map +0 -1
  295. /package/dist/{investigationCompletion.test.d.ts → build.test.d.ts} +0 -0
  296. /package/dist/{setup.test.d.ts → callerErrors.test.d.ts} +0 -0
  297. /package/dist/{worktreeTransition.test.d.ts → deliveryBoard.test.d.ts} +0 -0
@@ -1,381 +1,382 @@
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 { CLIError, handleCommandError, logDebug, logError, logInfo, logProgress, logSuccess, logWarn, setLogsSuppressed, } from './logger.js';
14
- import { addWorktreeEntry, removeWorktreeEntry } from './services/worktreeRegistry.js';
15
- // Project/field metadata is unrelated to stream routing. Keep these provider
16
- // adapters local while exercising real parent linking, issue start and dispatch.
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";
17
25
  const projectReadback = vi.hoisted(() => ({ value: null }));
18
- vi.mock('./github/nativeIssueMetadata.js', async (importOriginal) => ({
19
- ...(await importOriginal()),
20
- getConfiguredNativeIssueMetadata: async () => ({ points: 2 }),
21
- setConfiguredNativeIssueMetadata: async () => ({ points: 2 }),
22
- clearConfiguredNativeIssuePoints: async () => { },
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
+ }
23
32
  }));
24
- vi.mock('./github/projectDelivery.js', async (importOriginal) => ({
25
- ...(await importOriginal()),
26
- assertIssueProjectWritable: async () => { },
27
- getIssueProjectStatus: async () => projectReadback.value,
28
- syncIssueProjectStatus: async ({ status }) => (projectReadback.value = { itemId: 'SYNTHETIC-PROJECT-ITEM', status }),
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 }
29
39
  }));
30
40
  afterEach(() => {
31
- projectReadback.value = null;
32
- vi.restoreAllMocks();
33
- vi.unstubAllEnvs();
34
- setLogsSuppressed(false);
41
+ projectReadback.value = null;
42
+ vi.restoreAllMocks();
43
+ vi.unstubAllEnvs();
44
+ setLogsSuppressed(false);
35
45
  });
36
- const readyBody = renderIssueBody(IssueFields.parse({
37
- title: 'Synthetic change',
38
- issueType: 'Task',
46
+ const readyBody = renderIssueBody(
47
+ IssueFields.parse({
48
+ title: "Synthetic change",
49
+ issueType: "Task",
39
50
  points: 2,
40
- problem: 'Parent-link diagnostics can corrupt the CLI JSON result.',
41
- outcome: 'Return one parseable JSON result after parent linking or branch failure.',
51
+ problem: "Parent-link diagnostics can corrupt the CLI JSON result.",
52
+ outcome: "Return one parseable JSON result after parent linking or branch failure.",
42
53
  acceptanceCriteria: [
43
- {
44
- behavior: 'Parent linking leaves stdout as one JSON result and diagnostics on stderr.',
45
- verifiedBy: 'Byte-level CLI stream assertions.',
46
- },
54
+ {
55
+ behavior: "Parent linking leaves stdout as one JSON result and diagnostics on stderr.",
56
+ verifiedBy: "Byte-level CLI stream assertions."
57
+ }
47
58
  ],
48
- outOfScope: ['Live GitHub access and host configuration.'],
49
- context: { files: ['artifact.txt'] },
50
- }));
59
+ outOfScope: ["Live GitHub access and host configuration."],
60
+ context: { files: ["artifact.txt"] }
61
+ })
62
+ );
51
63
  function fixture(developmentFails = false) {
52
- const root = realpathSync(mkdtempSync(join(tmpdir(), 'ai-delivery-stdout-')));
53
- const git = (...args) => execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim();
54
- git('init', '-q', '-b', 'main');
55
- git('config', 'user.name', 'Synthetic Delivery');
56
- git('config', 'user.email', 'delivery@example.test');
57
- writeFileSync(join(root, 'artifact.txt'), 'synthetic\n');
58
- git('add', 'artifact.txt');
59
- git('commit', '-qm', 'synthetic base');
60
- git('remote', 'add', 'origin', 'https://github.com/example/widget.git');
61
- git('update-ref', 'refs/remotes/origin/main', git('rev-parse', 'HEAD'));
62
- git('symbolic-ref', 'refs/remotes/origin/HEAD', 'refs/remotes/origin/main');
63
- let parent = null;
64
- const issue = {
65
- id: 170,
66
- number: 17,
67
- node_id: 'ISSUE-17',
68
- title: 'Synthetic change',
69
- body: readyBody,
70
- state: 'open',
71
- html_url: 'https://github.com/example/widget/issues/17',
72
- labels: [],
73
- type: { name: 'Task' },
74
- };
75
- const rest = new Octokit();
76
- rest.request = (async (route) => {
77
- if (route === 'GET /orgs/{org}/issue-fields')
78
- return {
79
- data: [
80
- { id: 101, name: 'Estimate', data_type: 'single_select' },
81
- { id: 102, name: 'Urgency', data_type: 'single_select' },
82
- ],
83
- };
84
- if (route === 'GET /repos/{owner}/{repo}/issues/{issue_number}/issue-field-values')
85
- return {
86
- data: [
87
- {
88
- issue_field_id: 101,
89
- issue_field_name: 'Estimate',
90
- data_type: 'single_select',
91
- value: '2',
92
- single_select_option: { name: '2' },
93
- },
94
- ],
95
- };
96
- throw new Error(`Unexpected synthetic stdout REST operation: ${route}`);
97
- });
98
- Object.assign(rest.issues, {
99
- get: async ({ issue_number }) => ({
100
- data: issue_number === 17
101
- ? { ...issue, state: developmentFails ? 'closed' : 'open' }
102
- : { ...issue, number: issue_number, id: issue_number * 10, node_id: `ISSUE-${String(issue_number)}` },
103
- }),
104
- create: async (input) => {
105
- issue.title = input.title;
106
- issue.body = input.body;
107
- return { data: issue };
108
- },
109
- listForRepo: async () => ({ data: [] }),
110
- update: async (input) => {
111
- if (input.title !== undefined)
112
- issue.title = input.title;
113
- if (input.body !== undefined)
114
- issue.body = input.body;
115
- return { data: issue };
116
- },
117
- listSubIssues: async ({ issue_number }) => ({
118
- data: parent === issue_number ? [issue] : [],
119
- }),
120
- addSubIssue: async ({ issue_number }) => {
121
- parent = issue_number;
122
- return { data: issue };
123
- },
124
- });
125
- Object.assign(rest, {
126
- paginate: async (_route, { issue_number }) => parent === issue_number ? [issue] : [],
127
- });
128
- const clients = {
129
- authSource: 'personal',
130
- role: 'author',
131
- rest,
132
- graphql: (async (query) => {
133
- const page = { nodes: [], pageInfo: { endCursor: null, hasNextPage: false } };
134
- if (query.includes('blockedBy(')) {
135
- return {
136
- repository: {
137
- issue: {
138
- blockedBy: page,
139
- parent: parent === null
140
- ? null
141
- : { id: 'ISSUE-5', number: parent, repository: { nameWithOwner: 'example/widget' } },
142
- },
143
- },
144
- };
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" } }
145
148
  }
146
- if (query.includes('blocking('))
147
- return { repository: { issue: { blocking: page } } };
148
- if (query.includes('subIssues('))
149
- return { repository: { issue: { subIssues: page } } };
150
- throw new Error('Unexpected synthetic stdout query.');
151
- }),
152
- };
153
- const config = parseDeliveryConfig({
154
- ...syntheticDiscoveryConfig,
155
- schemaVersion: 'ai-delivery.config@2',
156
- policy: { contract: 'RepositoryDeliveryPolicy@1', module: './policy.mjs' },
157
- roles: {
158
- author: { identity: 'host-author', authSource: 'personal', credentialEnv: { token: 'AUTHOR_TOKEN' } },
159
- reviewer: {
160
- identity: 'synthetic-reviewer',
161
- credentialEnv: {
162
- appId: 'REVIEWER_APP_ID',
163
- installationId: 'REVIEWER_INSTALLATION_ID',
164
- privateKeyPath: 'REVIEWER_KEY_PATH',
165
- },
166
- },
167
- },
168
- commandPolicy: {
169
- checks: { format: 'REQUIRED', gitClean: 'REQUIRED', lint: 'REQUIRED', test: 'REQUIRED', typecheck: 'REQUIRED' },
170
- timeoutsMs: { lint: 60000, test: 60000, typecheck: 60000 },
171
- },
172
- });
173
- return {
174
- context: { root, repo: { owner: 'example', repo: 'widget' }, clients, config },
175
- cleanup: () => rmSync(root, { recursive: true, force: true }),
176
- };
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
+ };
177
181
  }
178
182
  function captureStreams() {
179
- const output = { stdout: '', stderr: '' };
180
- const previousConsole = globalThis.console;
181
- // Vitest intercepts console calls before they reach process streams. Use a
182
- // native console so the byte-level capture matches an actual CLI process.
183
- globalThis.console = new Console(process.stdout, process.stderr);
184
- const out = vi.spyOn(process.stdout, 'write').mockImplementation((value) => {
185
- output.stdout += String(value);
186
- return true;
187
- });
188
- const err = vi.spyOn(process.stderr, 'write').mockImplementation((value) => {
189
- output.stderr += String(value);
190
- return true;
191
- });
192
- return {
193
- output,
194
- restore: () => {
195
- out.mockRestore();
196
- err.mockRestore();
197
- globalThis.console = previousConsole;
198
- },
199
- };
200
- }
201
- test('parent replacement emits its diagnostic on stderr without writing any stdout bytes', async () => {
202
- const f = fixture();
203
- const capture = captureStreams();
204
- try {
205
- await replaceParentIssue({ ...f.context.clients, repo: f.context.repo, issueNumber: 17, parentIssueNumber: 5 });
206
- assert.equal(capture.output.stdout, '');
207
- assert.match(capture.output.stderr, /Linked issue #17 as sub-issue of issue #5\./u);
208
- }
209
- finally {
210
- capture.restore();
211
- 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;
212
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
+ }
213
214
  });
214
- test.each(['add', 'remove'])('registry %s emits its diagnostic without writing any stdout bytes', async (operation) => {
215
+ test.each(["add", "remove"])(
216
+ "registry %s emits its diagnostic without writing any stdout bytes",
217
+ async (operation) => {
215
218
  const f = fixture();
216
219
  const row = {
217
- path: join(f.context.root, '.worktrees', 'synthetic'),
218
- branch: 'issue/17',
219
- type: 'issue',
220
- issueNumber: 17,
221
- identity: 'host-author',
222
- status: 'active',
223
- createdAt: '2026-10-08T00:00:00Z',
224
- updatedAt: '2026-10-08T00:00:00Z',
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"
225
228
  };
226
229
  const capture = captureStreams();
227
230
  try {
228
- await addWorktreeEntry(row, f.context.root);
229
- if (operation === 'remove') {
230
- capture.output.stdout = '';
231
- capture.output.stderr = '';
232
- assert.equal(await removeWorktreeEntry(row.path, f.context.root), true);
233
- }
234
- assert.equal(capture.output.stdout, '');
235
- assert.match(capture.output.stderr, operation === 'add' ? /Added to worktree registry:/u : /Removed from worktree registry:/u);
236
- }
237
- finally {
238
- capture.restore();
239
- f.cleanup();
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();
240
245
  }
241
- });
246
+ }
247
+ );
242
248
  async function runCli(context, args) {
243
- vi.resetModules();
244
- const configuration = await import('./config/deliveryConfig.js');
245
- const issues = await import('./issue.js');
246
- const admission = await import('./services/deliveryAdmission.js');
247
- const prs = await import('./pr.js');
248
- const dispatch = await import('./dispatch.js');
249
- vi.spyOn(configuration, 'loadDeliverySettings').mockResolvedValue({
250
- ...context.config,
251
- configPath: 'synthetic-user.json',
252
- checkoutRoots: [],
253
- overrides: { schemaVersion: 'ai-delivery.config@2' },
254
- sourceDigest: 'synthetic',
255
- });
256
- vi.spyOn(issues, 'loadDeliveryContext').mockResolvedValue(context);
257
- // Synthetic authorization seams: these tests exercise streams, not live access.
258
- vi.spyOn(admission, 'assertDeliveryRuntimeAdmitted').mockResolvedValue({});
259
- vi.spyOn(prs, 'preflightReviewRoute').mockResolvedValue({});
260
- const argv = process.argv;
261
- const exitCode = process.exitCode;
262
- const capture = captureStreams();
263
- let completed = () => { };
264
- let failed = () => { };
265
- const resultWritten = new Promise((resolve, reject) => {
266
- completed = resolve;
267
- failed = reject;
268
- });
269
- const execute = dispatch.executeTool;
270
- vi.spyOn(dispatch, 'executeTool').mockImplementation(async (...input) => {
271
- try {
272
- return await execute(...input);
273
- }
274
- catch (error) {
275
- failed(error);
276
- throw error;
277
- }
278
- });
279
- vi.spyOn(process.stdout, 'write').mockImplementation((value) => {
280
- capture.output.stdout += String(value);
281
- // Wait for the result, not the earlier diagnostic chunk that reproduces #74.
282
- if (String(value).startsWith('{'))
283
- completed();
284
- return true;
285
- });
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) => {
286
280
  try {
287
- process.exitCode = undefined;
288
- process.argv = [process.execPath, 'ai-delivery', '--repo-root', context.root, '--identity', 'host-author', ...args];
289
- await import('./cli.js');
290
- await resultWritten;
291
- return { ...capture.output, exitCode: process.exitCode };
292
- }
293
- finally {
294
- capture.restore();
295
- vi.restoreAllMocks();
296
- process.argv = argv;
297
- process.exitCode = exitCode;
281
+ return await execute(...input);
282
+ } catch (error) {
283
+ failed(error);
284
+ throw error;
298
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
+ }
299
304
  }
300
- test('parent update through the CLI entry produces one parseable JSON result', async () => {
301
- const f = fixture();
302
- try {
303
- const output = await runCli(f.context, ['update', '--issue', '17', '--parent', '5']);
304
- const result = JSON.parse(output.stdout);
305
- assert.equal(result.issueNumber, 17);
306
- assert.equal(result.parentIssueNumber, 5);
307
- assert.equal(output.exitCode, undefined);
308
- assert.match(output.stderr, /Linked issue #17 as sub-issue of issue #5\./u);
309
- }
310
- finally {
311
- f.cleanup();
312
- }
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
+ }
313
317
  });
314
- test('failed remote branch start after parent linking preserves parseable CLI recovery JSON and nonzero exit', async () => {
315
- const f = fixture(true);
316
- try {
317
- const output = await runCli(f.context, [
318
- 'start',
319
- '--title',
320
- 'Synthetic change',
321
- '--body',
322
- readyBody,
323
- '--parent',
324
- '5',
325
- ]);
326
- const result = JSON.parse(output.stdout);
327
- assert.equal(result.status, 'created-not-started');
328
- assert.equal(result.createdIssue.number, 17);
329
- assert.equal(result.failure.phase, 'branch-or-journal');
330
- assert.match(result.failure.message, /open GitHub issue/u);
331
- assert.equal(result.safeResume.arguments.issueNumber, 17);
332
- assert.equal('parentIssueNumber' in result.safeResume.arguments, false);
333
- assert.equal('resumeCreated' in result.safeResume.arguments, false);
334
- assert.equal(output.exitCode, 1);
335
- assert.match(output.stderr, /Linked issue #17 as sub-issue of issue #5\./u);
336
- }
337
- finally {
338
- f.cleanup();
339
- }
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
+ }
340
343
  });
341
- test('all enabled diagnostics preserve their content on stderr', () => {
342
- vi.stubEnv('DEBUG', '1');
343
- const capture = captureStreams();
344
- try {
345
- logDebug('debug proof');
346
- logInfo('info proof');
347
- logSuccess('success proof');
348
- logWarn('warning proof');
349
- logError('error proof');
350
- logProgress('progress proof');
351
- handleCommandError(new CLIError('failure proof', { hint: 'retry proof' }));
352
- assert.equal(capture.output.stdout, '');
353
- for (const message of ['debug', 'info', 'success', 'warning', 'error', 'progress', 'failure', 'retry']) {
354
- assert.match(capture.output.stderr, new RegExp(`${message} proof`, 'u'));
355
- }
356
- }
357
- finally {
358
- 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"));
359
358
  }
359
+ } finally {
360
+ capture.restore();
361
+ }
360
362
  });
361
- test('MCP suppression still silences diagnostics while retaining errors and recovery hints on stderr', () => {
362
- vi.stubEnv('DEBUG', 'true');
363
- setLogsSuppressed(true);
364
- const capture = captureStreams();
365
- try {
366
- logDebug('hidden');
367
- logInfo('hidden');
368
- logSuccess('hidden');
369
- logWarn('hidden');
370
- logProgress('hidden');
371
- handleCommandError(new CLIError('visible error', { hint: 'visible recovery' }));
372
- assert.equal(capture.output.stdout, '');
373
- assert.doesNotMatch(capture.output.stderr, /hidden/u);
374
- assert.match(capture.output.stderr, /visible error/u);
375
- assert.match(capture.output.stderr, /visible recovery/u);
376
- }
377
- finally {
378
- capture.restore();
379
- }
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
+ }
380
381
  });
381
- //# sourceMappingURL=stdoutRegression.test.js.map
382
+ //# sourceMappingURL=stdoutRegression.test.js.map