@bridge_gpt/mcp-server 0.2.67 → 0.2.68

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 (114) hide show
  1. package/README.md +178 -15
  2. package/build/agent-launchers/claude-executor-adapter.js +27 -0
  3. package/build/agents.generated.js +22 -2
  4. package/build/bitbucket-workspace-remote.js +136 -0
  5. package/build/bootstrap-project-identity.js +24 -0
  6. package/build/bridge-permissions.js +829 -0
  7. package/build/claude-settings.js +18 -0
  8. package/build/cli-help.js +21 -0
  9. package/build/command-assets-doctor.js +24 -70
  10. package/build/command-provisioning.js +29 -5
  11. package/build/commands.generated.js +8 -8
  12. package/build/conductor/bridge-api-client.js +714 -0
  13. package/build/conductor/command-drift-production.js +92 -0
  14. package/build/conductor/command-drift.js +89 -0
  15. package/build/conductor/doctor.js +69 -26
  16. package/build/conductor/epic-branch-ci-inspection.js +1375 -0
  17. package/build/conductor/epic-implementer-cli.js +76 -22
  18. package/build/conductor/gate-discovery.js +890 -0
  19. package/build/conductor/install-doctor.js +15 -3
  20. package/build/conductor/json-output.js +63 -0
  21. package/build/conductor/readiness-cli.js +95 -10
  22. package/build/conductor/readiness-sections.js +369 -3
  23. package/build/conductor/readiness.js +211 -8
  24. package/build/conductor/recovery-cli.js +110 -4
  25. package/build/conductor/recovery-operations.js +99 -1
  26. package/build/connect-bitbucket-api.js +41 -6
  27. package/build/connect-bitbucket.js +106 -33
  28. package/build/credential-store.js +207 -47
  29. package/build/docs.generated.js +57 -3
  30. package/build/doctor.js +92 -1
  31. package/build/drive-epic.js +45 -8
  32. package/build/epic-coherence-input.test-fixtures.js +4 -3
  33. package/build/epic-implementer-bin.js +1374 -25
  34. package/build/epic-workarounds-path.js +39 -0
  35. package/build/executor/cli.js +30 -0
  36. package/build/executor/completion-contract.js +18 -5
  37. package/build/executor/deps.js +4 -1
  38. package/build/executor/gate-qualification-job.js +499 -0
  39. package/build/executor/guarded-fast-forward-push.js +129 -0
  40. package/build/executor/integration-job.js +122 -8
  41. package/build/executor/job-errors.js +8 -1
  42. package/build/executor/job-runner.js +589 -47
  43. package/build/executor/likely-tests.js +290 -0
  44. package/build/executor/live-worker-registry.js +1 -1
  45. package/build/executor/observation.js +31 -2
  46. package/build/executor/packaged-recipe.js +106 -0
  47. package/build/executor/permissions.js +115 -28
  48. package/build/executor/platform.js +1 -1
  49. package/build/executor/preflight.js +61 -12
  50. package/build/executor/process-containment.js +36 -12
  51. package/build/executor/process.js +15 -7
  52. package/build/executor/prompt-spec.js +33 -1
  53. package/build/executor/recently-failed-tests-file.js +71 -0
  54. package/build/executor/reconcile-overlap-job.js +41 -23
  55. package/build/executor/required-verification.js +1 -1
  56. package/build/executor/required-work-ledger.js +105 -17
  57. package/build/executor/retirement.js +69 -0
  58. package/build/executor/runner.js +114 -11
  59. package/build/executor/test-clock.js +15 -0
  60. package/build/executor/types.js +32 -0
  61. package/build/executor/viewer-tabs.js +58 -8
  62. package/build/executor/worker-command.js +23 -7
  63. package/build/executor/worker-diagnostics.js +37 -0
  64. package/build/executor/worker-finalization.js +31 -5
  65. package/build/executor/worker-guard-hook.js +179 -25
  66. package/build/executor/worker-log.js +4 -3
  67. package/build/executor/worker-verification-guidance.js +37 -0
  68. package/build/executor/worktree.js +88 -11
  69. package/build/first-build-advisory.js +97 -0
  70. package/build/generated-assets-advisory.js +14 -0
  71. package/build/generated-assets-catalog.js +66 -0
  72. package/build/generated-assets-context.js +46 -0
  73. package/build/generated-assets-dependencies.js +26 -0
  74. package/build/generated-assets-doctor.js +50 -0
  75. package/build/generated-assets-health.js +65 -0
  76. package/build/generated-assets-host.js +17 -0
  77. package/build/generated-assets-inventory.js +17 -0
  78. package/build/generated-assets-paths.js +60 -0
  79. package/build/generated-assets-publisher.js +133 -0
  80. package/build/generated-assets-remedy.js +25 -0
  81. package/build/generated-assets-repair.js +72 -0
  82. package/build/generated-assets-session.js +71 -0
  83. package/build/generated-assets-test-support.js +35 -0
  84. package/build/index.js +964 -768
  85. package/build/init.js +54 -177
  86. package/build/install-bridge-conductor-gate.js +1372 -0
  87. package/build/install-bridge-conductor.js +289 -36
  88. package/build/install-bridge.js +544 -37
  89. package/build/mcp-install-state.js +50 -4
  90. package/build/merge-workflow-install.js +3 -4
  91. package/build/pipeline-utils.js +6 -2
  92. package/build/pipelines.generated.js +22 -142
  93. package/build/plan-execution-ledger.js +2 -32
  94. package/build/plane/manifest.js +16 -1
  95. package/build/plane/preflight.js +54 -1
  96. package/build/printed-remedy-commands.js +16 -1
  97. package/build/readme.generated.js +1 -1
  98. package/build/repair-assets.js +93 -0
  99. package/build/run-unit-tests-launcher.js +130 -49
  100. package/build/secret-redaction.js +33 -0
  101. package/build/setup-epic.js +108 -3
  102. package/build/start-tickets-prereqs.js +70 -16
  103. package/build/start-tickets.js +29 -5
  104. package/build/tool-surface-gating.js +36 -0
  105. package/build/upgrade-cli.js +55 -1
  106. package/build/version.generated.js +3 -3
  107. package/build/worker-guard-hook-bin.js +3 -2
  108. package/build/worker-guard-hook-main.js +1 -1
  109. package/build/worktree-core.js +15 -2
  110. package/docs/EPIC-IMPLEMENTER-INSTALL.md +30 -12
  111. package/docs/EPIC-IMPLEMENTER.md +68 -2
  112. package/package.json +3 -3
  113. package/pipelines/greenfield-setup.json +4 -128
  114. package/pipelines/implement-ticket.json +3 -2
@@ -31,6 +31,8 @@ import { HOOK_RUNTIME_PROBE_ACTION, HOOK_RUNTIME_PROBE_MARKER } from "./hook-run
31
31
  import { runFileScopeGuardCli } from "./file-scope-guard.js";
32
32
  import { runPostCommitHookProducer, runReferenceTransactionHookProducer } from "./git-producer.js";
33
33
  import { buildConductorDoctorReport, formatConductorDoctorReport } from "./doctor.js";
34
+ import { createCommandDriftInspector } from "./command-drift-production.js";
35
+ import { writeJsonDocument } from "./json-output.js";
34
36
  import { resolveSupervisorConfig } from "./supervisor-config.js";
35
37
  import { VERSION } from "../version.generated.js";
36
38
  // `runSupervisor` is imported LAZILY inside runSuperviseCommand: it transitively
@@ -80,6 +82,7 @@ export function getConductorUsage() {
80
82
  " git-hook post-commit Run the post-commit producer (invoked by the installed hook)",
81
83
  " git-hook reference-transaction --phase <p> --stdin-file <f>",
82
84
  " Run the reference-transaction producer (invoked by the hook)",
85
+ " likely-tests --base <sha> Local advisory test references for committed changes.",
83
86
  " file-scope-guard Warn-only: compare the branch diff against the declared",
84
87
  " touched-file set (always exits 0; never blocks a PR)",
85
88
  " stop-run Stop an epic run: block dispatch and cancel queued work",
@@ -94,6 +97,7 @@ export function getConductorUsage() {
94
97
  " scope-reparse --epic-run-id <id> --scope-id <scope>",
95
98
  " Re-drive the run's OWN index scope through retry-reparse",
96
99
  " and schedule its parse. Refused if the scope is not the run's.",
100
+ " escalate --epic-run-id <id> --ticket-key <key> --cause <cause> --action-needed <text>",
97
101
  " dispatch-remediation --epic-run-id <id> --ticket-key <key> --context-file <path>",
98
102
  ` Dispatch a remediation job carrying driver context (UTF-8,`,
99
103
  ` at most DRIVER_CONTEXT_MAX_BYTES = ${DRIVER_CONTEXT_MAX_BYTES} bytes; never truncated).`,
@@ -109,7 +113,8 @@ export function getConductorUsage() {
109
113
  " resume-run --epic-run-id <id> [--clear-quarantine] [--json]",
110
114
  " Resume a paused run (a quarantined one only with --clear-quarantine);",
111
115
  " activation is re-checked server-side. Active/no-control is a no-op.",
112
- " continue-child --epic-run-id <id> --ticket-key <key> [--reason <text>] [--json]",
116
+ " continue-child --epic-run-id <id> --ticket-key <key> [--reason <text> --worker-exit-proof exited|fenced] [--json]",
117
+ " grant-continuation --epic-run-id <id> --ticket-key <key> --reason <text> [--extra-continuations 1] [--extra-seconds <seconds>] [--json]",
113
118
  " Continue a parked child's CURRENT episode WITHOUT a reset: same attempt,",
114
119
  " retained work, only the allowance left. At most one dispatch per episode.",
115
120
  " continuation-receipt --epic-run-id <id> --ticket-key <key> [--request-id <id>] [--json]",
@@ -179,6 +184,9 @@ export function getConductorUsage() {
179
184
  " --no-deny-probe Accepted for parity with `doctor`; inert here — `readiness`",
180
185
  " never spawns the deny-enforcement probe, and reports that",
181
186
  " check as an explicit skip naming `epic-implementer doctor`",
187
+ " --epic-run-id <id> The epic run being attached; when the live plane is bound",
188
+ " to it, the plane port and existing-plane rows pass with",
189
+ " reason own_plane instead of failing",
182
190
  " --help Print the readiness usage message",
183
191
  " Note: advisory only. It blocks nothing and changes no exit code; `drive-epic`",
184
192
  " remains the sole route-selection gate and server-side admission the sole refusal.",
@@ -303,6 +311,7 @@ const VALID_COMMANDS = new Set([
303
311
  "install-git-hooks",
304
312
  "git-hook",
305
313
  "file-scope-guard",
314
+ "likely-tests",
306
315
  // BAPI-872: CLI-only operator recovery verbs — never registered as MCP tools.
307
316
  "stop-run",
308
317
  "abandon-run",
@@ -310,6 +319,7 @@ const VALID_COMMANDS = new Set([
310
319
  "adopt-current-head-and-unpark",
311
320
  // BAPI-1154: CLI-only run-addressed repair verbs — never registered as MCP tools.
312
321
  "scope-reparse",
322
+ "escalate",
313
323
  "dispatch-remediation",
314
324
  "merge-child",
315
325
  // BAPI-1176: CLI-only run-addressed repair verbs — never registered as MCP tools.
@@ -318,6 +328,7 @@ const VALID_COMMANDS = new Set([
318
328
  "resume-run",
319
329
  // BAPI-1300: CLI-only parked-child continuation pair — never registered as MCP tools.
320
330
  "continue-child",
331
+ "grant-continuation",
321
332
  "continuation-receipt",
322
333
  // BAPI-1326: CLI-only allowance-preserving CI resume — never an MCP tool.
323
334
  "resume-ci",
@@ -543,11 +554,9 @@ export async function runEmitEventCommand(argv, deps = {}) {
543
554
  throw error;
544
555
  }
545
556
  if (parsed.json) {
546
- console.log(JSON.stringify(result));
547
- }
548
- else {
549
- console.log(JSON.stringify(result, null, 2));
557
+ return (await writeJsonDocument(JSON.stringify(result))) ? 0 : 1;
550
558
  }
559
+ console.log(JSON.stringify(result, null, 2));
551
560
  return 0;
552
561
  }
553
562
  // ---------------------------------------------------------------------------
@@ -649,7 +658,8 @@ export async function runSendMessageCommand(argv, deps = {}) {
649
658
  }
650
659
  const result = await sendWorkerMessage(parsed.input);
651
660
  if (parsed.json) {
652
- console.log(JSON.stringify(result));
661
+ if (!(await writeJsonDocument(JSON.stringify(result))))
662
+ return 1;
653
663
  }
654
664
  else {
655
665
  console.log([
@@ -702,8 +712,7 @@ export async function runCheckMessagesCommand(argv) {
702
712
  }
703
713
  const result = await checkWorkerMessages(parsed.input);
704
714
  if (parsed.json) {
705
- console.log(JSON.stringify(result));
706
- return 0;
715
+ return (await writeJsonDocument(JSON.stringify(result))) ? 0 : 1;
707
716
  }
708
717
  const lines = [`Acknowledged ${result.acked_count} of ${result.count} message(s).`];
709
718
  for (const message of result.messages) {
@@ -728,10 +737,16 @@ export async function runDoctorCommand(argv, deps = {}) {
728
737
  return 0;
729
738
  }
730
739
  // A caller may inject deps (e.g. a fake deny inspector in tests) to stay hermetic.
731
- const report = await buildConductorDoctorReport(bools.has("--no-deny-probe") ? { ...deps, skipDenyProbe: true } : deps);
740
+ // BAPI-1392: the warn-only committed-command drift row is read-only; a caller's
741
+ // injected inspector wins so tests stay hermetic.
742
+ const doctorDeps = {
743
+ inspectCommandDrift: createCommandDriftInspector({ env: deps.env ?? process.env, cwd: process.cwd() }),
744
+ ...deps,
745
+ };
746
+ const report = await buildConductorDoctorReport(bools.has("--no-deny-probe") ? { ...doctorDeps, skipDenyProbe: true } : doctorDeps);
732
747
  if (bools.has("--json")) {
733
- console.log(JSON.stringify({ ...report.ledger, git_hooks: report.git_hooks, mcp_profile: report.mcp_profile, native_ledger: report.native_ledger, deny_enforcement: report.deny_enforcement }));
734
- return 0;
748
+ const written = await writeJsonDocument(JSON.stringify({ ...report.ledger, git_hooks: report.git_hooks, mcp_profile: report.mcp_profile, native_ledger: report.native_ledger, deny_enforcement: report.deny_enforcement, ...(report.command_drift ? { command_drift: report.command_drift } : {}) }));
749
+ return written ? 0 : 1;
735
750
  }
736
751
  console.log(formatConductorDoctorReport(report));
737
752
  return 0;
@@ -1103,7 +1118,7 @@ export async function runApprovePlanCommand(argv) {
1103
1118
  if (!accessResult.ok) {
1104
1119
  const envelope = { error: "CREDENTIALS_UNAVAILABLE", status: 401, message: accessResult.error };
1105
1120
  if (parsed.json) {
1106
- console.log(JSON.stringify({ ok: false, kind: "unauthorized", error: envelope.message }));
1121
+ await writeJsonDocument(JSON.stringify({ ok: false, kind: "unauthorized", error: envelope.message }));
1107
1122
  }
1108
1123
  else {
1109
1124
  console.error(`Error: ${accessResult.error}`);
@@ -1121,7 +1136,8 @@ export async function runApprovePlanCommand(argv) {
1121
1136
  `the current approved version and that the blob has been stored first.`);
1122
1137
  }
1123
1138
  if (parsed.json) {
1124
- console.log(JSON.stringify({ ok: true, plan_hash: result.plan_hash }));
1139
+ if (!(await writeJsonDocument(JSON.stringify({ ok: true, plan_hash: result.plan_hash }))))
1140
+ return 1;
1125
1141
  }
1126
1142
  else {
1127
1143
  console.log(`Plan approved atomically. ` +
@@ -1136,7 +1152,7 @@ export async function runApprovePlanCommand(argv) {
1136
1152
  // rather than distinguishing 5xx (2) from other failures.
1137
1153
  const envelope = toConductorErrorEnvelope(error);
1138
1154
  if (parsed.json) {
1139
- console.log(JSON.stringify(envelope));
1155
+ await writeJsonDocument(JSON.stringify(envelope));
1140
1156
  }
1141
1157
  else {
1142
1158
  console.error(`Error: ${formatConductorErrorLine(envelope)}`);
@@ -1190,7 +1206,7 @@ export async function runEpicStatusCommand(argv) {
1190
1206
  const accessResult = await resolveConductorBridgeApiAccess();
1191
1207
  if (!accessResult.ok) {
1192
1208
  if (parsed.json) {
1193
- console.log(JSON.stringify({ ok: false, kind: "unauthorized", error: accessResult.error }));
1209
+ await writeJsonDocument(JSON.stringify({ ok: false, kind: "unauthorized", error: accessResult.error }));
1194
1210
  }
1195
1211
  else {
1196
1212
  console.error(`Error: ${accessResult.error}`);
@@ -1200,8 +1216,7 @@ export async function runEpicStatusCommand(argv) {
1200
1216
  try {
1201
1217
  const state = await fetchEpicRunState(accessResult.access, parsed.epicKey);
1202
1218
  if (parsed.json) {
1203
- console.log(JSON.stringify(state));
1204
- return 0;
1219
+ return (await writeJsonDocument(JSON.stringify(state))) ? 0 : 1;
1205
1220
  }
1206
1221
  // Human-readable summary: structured status fields only, no raw payloads.
1207
1222
  const lines = [];
@@ -1231,7 +1246,9 @@ export async function runEpicStatusCommand(argv) {
1231
1246
  catch (error) {
1232
1247
  if (error instanceof BridgeApiError && error.status === 404) {
1233
1248
  if (parsed.json) {
1234
- console.log(JSON.stringify({ epic_key: parsed.epicKey, status: "unknown", state: null }));
1249
+ const written = await writeJsonDocument(JSON.stringify({ epic_key: parsed.epicKey, status: "unknown", state: null }));
1250
+ if (!written)
1251
+ return 1;
1235
1252
  }
1236
1253
  else {
1237
1254
  console.log("No such epic found.");
@@ -1242,7 +1259,7 @@ export async function runEpicStatusCommand(argv) {
1242
1259
  // rather than distinguishing 5xx (2) from other failures.
1243
1260
  const envelope = toConductorErrorEnvelope(error);
1244
1261
  if (parsed.json) {
1245
- console.log(JSON.stringify(envelope));
1262
+ await writeJsonDocument(JSON.stringify(envelope));
1246
1263
  }
1247
1264
  else {
1248
1265
  console.error(`Error: ${formatConductorErrorLine(envelope)}`);
@@ -1329,8 +1346,7 @@ export async function runPurgeCommand(argv) {
1329
1346
  }
1330
1347
  const result = await purgeConductorLedger();
1331
1348
  if (bools.has("--json")) {
1332
- console.log(JSON.stringify(result));
1333
- return 0;
1349
+ return (await writeJsonDocument(JSON.stringify(result))) ? 0 : 1;
1334
1350
  }
1335
1351
  console.log([
1336
1352
  `Conductor ledger purged (existed: ${result.existed}).`,
@@ -1340,6 +1356,32 @@ export async function runPurgeCommand(argv) {
1340
1356
  ].join("\n"));
1341
1357
  return 0;
1342
1358
  }
1359
+ export async function runLikelyTestsCommand(argv, deps = {}) {
1360
+ const { resolveLikelyTests, isFullCommitSha, validTestReference, DISCOVERY_NOTES } = await import("../executor/likely-tests.js");
1361
+ const stdout = deps.stdout ?? ((text) => { process.stdout.write(text); });
1362
+ const stderr = deps.stderr ?? ((text) => { process.stderr.write(text); });
1363
+ let base;
1364
+ if (argv.length === 2 && argv[0] === "--base")
1365
+ base = argv[1];
1366
+ if (argv.length === 1 && argv[0].startsWith("--base="))
1367
+ base = argv[0].slice(7);
1368
+ if (!base || !isFullCommitSha(base)) {
1369
+ stderr(DISCOVERY_NOTES.invalid_arguments + "\n");
1370
+ return 0;
1371
+ }
1372
+ try {
1373
+ const result = await (deps.resolve ?? resolveLikelyTests)({ cwd: deps.cwd ?? process.cwd(), comparisonSha: base });
1374
+ for (const reference of result.references)
1375
+ if (validTestReference(reference))
1376
+ stdout(reference + "\n");
1377
+ for (const diagnostic of result.diagnostics)
1378
+ stderr(DISCOVERY_NOTES[diagnostic] + "\n");
1379
+ }
1380
+ catch {
1381
+ stderr(DISCOVERY_NOTES.git_unavailable + "\n");
1382
+ }
1383
+ return 0;
1384
+ }
1343
1385
  /**
1344
1386
  * Dispatch the epic-implementer CLI. Returns (asynchronously) a process exit
1345
1387
  * code (non-zero for parser, validation, and storage failures). The dispatcher
@@ -1351,7 +1393,9 @@ export async function runPurgeCommand(argv) {
1351
1393
  * profile group this dispatcher sits alongside remain unrenamed until S5; this
1352
1394
  * S4 slice renames only the public entry point and CLI-facing text.
1353
1395
  */
1354
- export async function runEpicImplementerCli(argv) {
1396
+ export async function runEpicImplementerCli(argv, likelyTestsDeps) {
1397
+ if (argv[0] === "likely-tests")
1398
+ return runLikelyTestsCommand(argv.slice(1), likelyTestsDeps);
1355
1399
  const parsed = parseConductorArgs(argv);
1356
1400
  if (parsed.kind === "help") {
1357
1401
  console.log(getConductorUsage());
@@ -1400,6 +1444,8 @@ export async function runEpicImplementerCli(argv) {
1400
1444
  // Also dispatched before any MCP construction or store open: it only
1401
1445
  // imports the native binding, so it can answer on a host with no ledger.
1402
1446
  return await runHookRuntimeProbeCommand();
1447
+ case "likely-tests":
1448
+ return runLikelyTestsCommand(parsed.argv);
1403
1449
  case "file-scope-guard":
1404
1450
  // BAPI-507 (N-2): warn-only worker file-scope guard. Always exits 0.
1405
1451
  return runFileScopeGuardCli();
@@ -1427,6 +1473,10 @@ export async function runEpicImplementerCli(argv) {
1427
1473
  const { runScopeReparseCommand } = await import("./recovery-cli.js");
1428
1474
  return await runScopeReparseCommand(parsed.argv);
1429
1475
  }
1476
+ case "escalate": {
1477
+ const { runEscalateCommand } = await import("./recovery-cli.js");
1478
+ return await runEscalateCommand(parsed.argv);
1479
+ }
1430
1480
  case "dispatch-remediation": {
1431
1481
  const { runDispatchRemediationCommand } = await import("./recovery-cli.js");
1432
1482
  return await runDispatchRemediationCommand(parsed.argv);
@@ -1453,6 +1503,10 @@ export async function runEpicImplementerCli(argv) {
1453
1503
  const { runContinueChildCommand } = await import("./recovery-cli.js");
1454
1504
  return await runContinueChildCommand(parsed.argv);
1455
1505
  }
1506
+ case "grant-continuation": {
1507
+ const { runGrantContinuationCommand } = await import("./recovery-cli.js");
1508
+ return await runGrantContinuationCommand(parsed.argv);
1509
+ }
1456
1510
  case "continuation-receipt": {
1457
1511
  const { runContinuationReceiptCommand } = await import("./recovery-cli.js");
1458
1512
  return await runContinuationReceiptCommand(parsed.argv);