@bridge_gpt/mcp-server 0.2.72 → 0.2.73

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 (146) hide show
  1. package/README.md +5 -5
  2. package/build/agent-launchers/claude-executor-adapter.js +3 -0
  3. package/build/agents.generated.js +6 -6
  4. package/build/bridge-permissions.js +27 -0
  5. package/build/ci-system-detection.js +50 -0
  6. package/build/ci-trigger-adapters.js +631 -0
  7. package/build/ci-trigger-install.js +106 -0
  8. package/build/codex-launcher-pin.js +33 -2
  9. package/build/codex-skill-adapter.js +3 -1
  10. package/build/command-host.js +33 -0
  11. package/build/commands.generated.js +7 -6
  12. package/build/conductor/bridge-api-client.js +842 -35
  13. package/build/conductor/bring-up-facts.js +18 -5
  14. package/build/conductor/command-drift-production.js +42 -17
  15. package/build/conductor/command-drift.js +47 -0
  16. package/build/conductor/declare-blocked.js +554 -0
  17. package/build/conductor/doctor.js +106 -21
  18. package/build/conductor/driver-commands.js +141 -0
  19. package/build/conductor/driver-guard.js +277 -0
  20. package/build/conductor/driver-lapse.js +321 -0
  21. package/build/conductor/driver-register.js +176 -0
  22. package/build/conductor/driver-release.js +174 -0
  23. package/build/conductor/driver-session-state.js +315 -0
  24. package/build/conductor/epic-branch-ci-inspection.js +222 -29
  25. package/build/conductor/epic-implementer-cli.js +166 -15
  26. package/build/conductor/epic-server-database.js +162 -0
  27. package/build/conductor/epic-server-guidance.js +278 -0
  28. package/build/conductor/epic-server-journal.js +239 -0
  29. package/build/conductor/epic-server-processes.js +324 -0
  30. package/build/conductor/epic-server-recipe.js +397 -0
  31. package/build/conductor/epic-server-runtime.js +1207 -0
  32. package/build/conductor/epic-server-sfcc.js +107 -0
  33. package/build/conductor/epic-server-state.js +427 -0
  34. package/build/conductor/epic-server.js +594 -0
  35. package/build/conductor/gate-discovery.js +150 -5
  36. package/build/conductor/gate-settings-review.js +224 -4
  37. package/build/conductor/launch-need-probes.js +6 -53
  38. package/build/conductor/launch-plan.js +313 -156
  39. package/build/conductor/prerequisite-inputs.js +879 -45
  40. package/build/conductor/readiness-assessment.js +16 -1
  41. package/build/conductor/readiness-cli.js +20 -9
  42. package/build/conductor/readiness-prerequisites.js +28 -9
  43. package/build/conductor/readiness-sections.js +133 -126
  44. package/build/conductor/readiness.js +1 -1
  45. package/build/conductor/recovery-cli.js +13 -2
  46. package/build/conductor/tools.js +6 -5
  47. package/build/conductor/wait-run-attention.js +2 -2
  48. package/build/conductor/wait-run-cli.js +208 -22
  49. package/build/conductor/worker-database-doctor-inspector.js +33 -2
  50. package/build/conductor/worker-setup-tally.js +27 -0
  51. package/build/credential-store.js +71 -1
  52. package/build/dependency-install-declarations.js +55 -0
  53. package/build/docs.generated.js +2 -2
  54. package/build/doctor.js +54 -3
  55. package/build/drive-epic-help.js +21 -2
  56. package/build/drive-epic.js +1811 -351
  57. package/build/engine-paths.js +20 -0
  58. package/build/epic-branch-ci-summary.js +140 -0
  59. package/build/epic-capability-statement.js +107 -0
  60. package/build/epic-ci-workflow-drift.js +30 -15
  61. package/build/epic-ci-workflow-install.js +110 -42
  62. package/build/epic-ci-workflow-v2.js +274 -0
  63. package/build/epic-ci-workflow.js +38 -12
  64. package/build/epic-implementer-bin.js +2101 -44
  65. package/build/epic-launch-context.js +607 -0
  66. package/build/epic-server-record.js +273 -0
  67. package/build/epic-shared/bridge-client.js +11 -3
  68. package/build/escalation-reachability.js +43 -0
  69. package/build/executor/ci-fix-test-runs.js +334 -0
  70. package/build/executor/completion-contract.js +8 -1
  71. package/build/executor/env.js +59 -22
  72. package/build/executor/epic-server-context.js +141 -0
  73. package/build/executor/gate-qualification-job.js +127 -26
  74. package/build/executor/http-client.js +52 -5
  75. package/build/executor/job-runner.js +423 -69
  76. package/build/executor/observation.js +8 -0
  77. package/build/executor/pre-pr-checks.js +363 -0
  78. package/build/executor/prompt-spec.js +114 -2
  79. package/build/executor/reconcile-overlap-job.js +5 -3
  80. package/build/executor/required-work-diagnostics.js +4 -2
  81. package/build/executor/required-work-ledger.js +936 -38
  82. package/build/executor/results.js +58 -0
  83. package/build/executor/terminal-mutation.js +8 -0
  84. package/build/executor/worker-command.js +72 -3
  85. package/build/executor/worker-database-config.js +281 -0
  86. package/build/executor/worker-database-target.js +16 -12
  87. package/build/executor/worker-database.js +320 -101
  88. package/build/executor/worker-finalization.js +7 -1
  89. package/build/executor/worker-resources.js +25 -3
  90. package/build/executor/worker-verification-guidance.js +18 -3
  91. package/build/executor/worktree.js +20 -1
  92. package/build/executor-launch.js +54 -2
  93. package/build/generated-assets-catalog.js +2 -2
  94. package/build/index.js +664 -335
  95. package/build/init.js +26 -11
  96. package/build/install-bridge-conductor-answers.js +465 -0
  97. package/build/install-bridge-conductor-apply.js +259 -0
  98. package/build/install-bridge-conductor-assessment.js +895 -0
  99. package/build/install-bridge-conductor-compact.js +161 -0
  100. package/build/install-bridge-conductor-contracts.js +63 -0
  101. package/build/install-bridge-conductor-gate.js +1197 -196
  102. package/build/install-bridge-conductor-setup.js +535 -79
  103. package/build/install-bridge-conductor.js +2885 -560
  104. package/build/install-bridge.js +199 -21
  105. package/build/install-maintenance.js +26 -3
  106. package/build/launcher-config-inspection.js +162 -1
  107. package/build/mcp-grant-candidates.js +767 -0
  108. package/build/mcp-grant-doctor.js +63 -0
  109. package/build/mcp-grant.js +288 -0
  110. package/build/mcp-host-targets.js +8 -0
  111. package/build/mcp-identity.js +23 -0
  112. package/build/mcp-invoke.js +126 -13
  113. package/build/mcp-presets.js +107 -0
  114. package/build/mcp-provisioning.js +134 -2
  115. package/build/mcp-registration-doctor.js +31 -2
  116. package/build/mcp-server-invocation.js +6 -1
  117. package/build/merge-workflow-install.js +234 -109
  118. package/build/pipelines.generated.js +5 -5
  119. package/build/plan-discovery.js +97 -4
  120. package/build/plan-execution-ledger.js +100 -7
  121. package/build/plan-generation-io.js +262 -0
  122. package/build/plan-generation.js +424 -0
  123. package/build/plane/build-freshness.js +6 -1
  124. package/build/plane/cli.js +75 -9
  125. package/build/plane/plane-freshness.js +17 -0
  126. package/build/plane/preflight.js +50 -10
  127. package/build/plane/shutdown.js +19 -0
  128. package/build/plane/terminal-run-cleanup.js +18 -4
  129. package/build/printed-remedy-commands.js +206 -12
  130. package/build/readiness-check.js +77 -0
  131. package/build/readiness-prerequisites.generated.js +122 -14
  132. package/build/readme.generated.js +1 -1
  133. package/build/repository-state-paths.js +38 -0
  134. package/build/run-unit-tests-launcher.js +8 -1
  135. package/build/setup-epic.js +1190 -196
  136. package/build/setup-progress.js +44 -0
  137. package/build/setup-question.js +122 -4
  138. package/build/third-party-mcp-targets.js +30 -0
  139. package/build/ticket-delivery-enrollment.js +9 -0
  140. package/build/upgrade-cli.js +85 -2
  141. package/build/v2-readiness-requirements.js +28 -1
  142. package/build/version.generated.js +3 -3
  143. package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
  144. package/docs/epic-implementer/getting-started.md +3 -1
  145. package/docs/epic-implementer/self-hosting.md +14 -1
  146. package/package.json +2 -2
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Reassurance during long setup work (BAPI-1604). A notice is printed on stderr
3
+ * every few seconds while an operation runs, so a quiet terminal is not mistaken
4
+ * for a hang. It is never a timeout, a retry, or a readiness condition: the
5
+ * operation's value or exception passes through untouched, and the notice stops
6
+ * on every completion path.
7
+ */
8
+ export const SETUP_PROGRESS_INTERVAL_MS = 10_000;
9
+ /** The real timer. The interval is unreferenced so it never holds the process open. */
10
+ export function createSetupProgressTimer() {
11
+ return {
12
+ now: () => Number(process.hrtime.bigint() / 1000000n),
13
+ start: (tick, intervalMs) => {
14
+ const handle = setInterval(tick, intervalMs);
15
+ handle.unref();
16
+ return () => clearInterval(handle);
17
+ },
18
+ };
19
+ }
20
+ /** `activity` is a fixed label such as `checking readiness`; it is never user data. */
21
+ export async function withSetupProgress(activity, operation, deps) {
22
+ const timer = deps.timer ?? createSetupProgressTimer();
23
+ const startedAt = timer.now();
24
+ let cancel;
25
+ try {
26
+ cancel = timer.start(() => {
27
+ const seconds = Math.round((timer.now() - startedAt) / 1000);
28
+ deps.errorLog(`Still ${activity} (${seconds} s)…`);
29
+ }, timer.intervalMs ?? SETUP_PROGRESS_INTERVAL_MS);
30
+ }
31
+ catch {
32
+ // A timer that cannot start must not change the operation.
33
+ cancel = undefined;
34
+ }
35
+ try {
36
+ return await operation();
37
+ }
38
+ finally {
39
+ try {
40
+ cancel?.();
41
+ }
42
+ catch { /* cancellation failure never masks the outcome */ }
43
+ }
44
+ }
@@ -1,9 +1,13 @@
1
- export function renderSetupQuestion(spec) {
2
- return [spec.purpose, `Current evidence:\n${spec.evidence.join("\n")}`,
1
+ /** Everything except the leading question line, built structurally. */
2
+ function renderSetupQuestionBody(spec) {
3
+ return [`Current evidence:\n${spec.evidence.join("\n")}`,
3
4
  `Options:\n${spec.options.map(o => `${o.id}: ${o.label}`).join("\n")}`,
4
5
  `Consequences:\n${spec.consequences.join("\n")}`,
5
6
  `Defer: ${spec.deferred}\nRecovery: ${spec.recovery}`].join("\n\n");
6
7
  }
8
+ export function renderSetupQuestion(spec) {
9
+ return [spec.purpose, renderSetupQuestionBody(spec)].join("\n\n");
10
+ }
7
11
  export function parseSetupDecision(input, options = []) {
8
12
  const value = input?.trim().toLowerCase();
9
13
  if (!value)
@@ -16,11 +20,13 @@ export function parseSetupDecision(input, options = []) {
16
20
  return option ? { status: "selected", id: option.id } : { status: "invalid" };
17
21
  }
18
22
  export async function askSetupQuestion(spec, terminal) {
19
- terminal.write?.(renderSetupQuestion(spec));
23
+ const question = spec.prompt ?? spec.purpose;
24
+ // The reader shows the question; print it here only when no reader will.
25
+ terminal.write?.(terminal.read ? renderSetupQuestionBody(spec) : [question, renderSetupQuestionBody(spec)].join("\n\n"));
20
26
  if (!terminal.read)
21
27
  return { status: "defer" };
22
28
  try {
23
- return parseSetupDecision(await terminal.read(spec.prompt ?? spec.purpose), spec.options);
29
+ return parseSetupDecision(await terminal.read(question), spec.options);
24
30
  }
25
31
  catch {
26
32
  return { status: "defer" };
@@ -60,3 +66,115 @@ export function setupConsentQuestion(purpose) {
60
66
  consequences: [consequence], deferred: "Only this operation is deferred; completed independent work is retained.",
61
67
  recovery: "Rerun setup interactively after resolving the affected prerequisite." };
62
68
  }
69
+ export const PLAIN_SETUP_INSTRUCTION = "Press Enter for the recommended option. Type ? for details.";
70
+ /** Invalid answers allowed after the first before the recommendation is used. */
71
+ export const PLAIN_SETUP_MAX_REASKS = 2;
72
+ /** A line ending pasted right behind an answer arrives within this window. */
73
+ export const PLAIN_SETUP_PASTE_TAIL_MS = 150;
74
+ /** Numbered options and the instruction, without the question line. */
75
+ function renderPlainSetupBody(spec) {
76
+ const lines = spec.options.map((o, i) => ` ${i + 1}. ${o.label}${o.id === spec.recommended ? " (recommended)" : ""}`);
77
+ return [...lines, ...(spec.summary ?? []), PLAIN_SETUP_INSTRUCTION].join("\n");
78
+ }
79
+ export function renderPlainSetupQuestion(spec) {
80
+ return [spec.question, renderPlainSetupBody(spec)].join("\n");
81
+ }
82
+ export function renderPlainSetupDetails(spec) {
83
+ return [`Current evidence:\n${spec.evidence.join("\n")}`,
84
+ ...(spec.consequences.length > 0 ? [`Consequences:\n${spec.consequences.join("\n")}`] : []),
85
+ `Recovery: ${spec.recovery}`].join("\n\n");
86
+ }
87
+ export function parsePlainSetupDecision(input, options) {
88
+ if (input === undefined)
89
+ return { status: "unavailable" };
90
+ const value = input.trim().toLowerCase();
91
+ if (!value)
92
+ return { status: "empty" };
93
+ if (value === "?")
94
+ return { status: "details" };
95
+ if (/^\d+$/.test(value)) {
96
+ const byNumber = options[Number(value) - 1];
97
+ return byNumber ? { status: "selected", id: byNumber.id } : { status: "invalid" };
98
+ }
99
+ const option = options.find(o => o.id.toLowerCase() === value
100
+ || (o.aliases ?? []).some(a => a.toLowerCase() === value));
101
+ return option ? { status: "selected", id: option.id } : { status: "invalid" };
102
+ }
103
+ /**
104
+ * Ask one plain question. Enter selects the recommendation; `?` shows details;
105
+ * an unavailable terminal defers (nothing is chosen) and prints the recording flag.
106
+ */
107
+ export async function askPlainSetupQuestion(spec, terminal) {
108
+ const deferUnavailable = () => {
109
+ terminal.write?.(`${spec.question}\nNo terminal is available, so nothing was chosen. To record this choice: ${spec.recordingFlag}`);
110
+ return { status: "defer" };
111
+ };
112
+ if (terminal.isTTY !== true || !terminal.read)
113
+ return deferUnavailable();
114
+ let invalid = 0;
115
+ for (;;) {
116
+ // The read prompt carries the question, so only the body is written.
117
+ terminal.write?.(renderPlainSetupBody(spec));
118
+ let parsed;
119
+ try {
120
+ parsed = parsePlainSetupDecision(await terminal.read(`${spec.question} `), spec.options);
121
+ }
122
+ catch {
123
+ return deferUnavailable();
124
+ }
125
+ if (parsed.status === "unavailable")
126
+ return deferUnavailable();
127
+ if (parsed.status === "empty")
128
+ return { status: "selected", id: spec.recommended };
129
+ if (parsed.status === "selected")
130
+ return parsed;
131
+ if (parsed.status === "details") {
132
+ terminal.write?.(renderPlainSetupDetails(spec));
133
+ continue;
134
+ }
135
+ invalid += 1;
136
+ if (invalid > PLAIN_SETUP_MAX_REASKS) {
137
+ terminal.write?.("That answer was not recognized, so the recommended option was used.");
138
+ return { status: "selected", id: spec.recommended };
139
+ }
140
+ }
141
+ }
142
+ /**
143
+ * Wrap one reader for one setup run. A pasted answer's trailing line ending can
144
+ * arrive as an immediate empty answer to the NEXT question; that one empty answer
145
+ * is dropped and the reader is asked again once. Non-empty input is never dropped,
146
+ * and only the previous answer's time and non-empty status are remembered.
147
+ */
148
+ export function createPlainInputSession(read, deps = {}) {
149
+ const now = deps.now ?? (() => Number(process.hrtime.bigint() / 1000000n));
150
+ const windowMs = deps.pasteTailMs ?? PLAIN_SETUP_PASTE_TAIL_MS;
151
+ let lastDoneAt;
152
+ let lastNonEmpty = false;
153
+ const finish = (answer) => {
154
+ lastDoneAt = now();
155
+ lastNonEmpty = (answer ?? "").trim().length > 0;
156
+ return answer;
157
+ };
158
+ return async (prompt) => {
159
+ let answer = await read(prompt);
160
+ if (answer !== undefined && answer.trim().length === 0 && lastNonEmpty
161
+ && lastDoneAt !== undefined && now() - lastDoneAt <= windowMs) {
162
+ answer = await read(prompt);
163
+ }
164
+ return finish(answer);
165
+ };
166
+ }
167
+ /** Plain consent for one operation. The safe default is `no` unless the caller says otherwise. */
168
+ export function plainConsentQuestion(purpose, recordingFlag, recommended = "no") {
169
+ const legacy = setupConsentQuestion(purpose);
170
+ return {
171
+ question: legacy.purpose,
172
+ options: [{ id: "yes", label: "Yes, do this", aliases: ["y"] }, { id: "no", label: "No, skip this", aliases: ["n"] }],
173
+ recommended, recordingFlag,
174
+ evidence: legacy.evidence, consequences: legacy.consequences, recovery: legacy.recovery,
175
+ };
176
+ }
177
+ export async function askPlainConsent(purpose, recordingFlag, terminal, recommended = "no") {
178
+ const decision = await askPlainSetupQuestion(plainConsentQuestion(purpose, recordingFlag, recommended), terminal);
179
+ return decision.status === "selected" && decision.id === "yes";
180
+ }
@@ -51,6 +51,36 @@ export function validateThirdPartyTargetManifestEntry(entry) {
51
51
  }
52
52
  return { ok: true };
53
53
  }
54
+ /**
55
+ * BAPI-1545: validate a GRANTED entry for launch. Unlike the legacy manifest
56
+ * validator above, a bundle is OPTIONAL: an owner-approved secret-free server
57
+ * needs none. Granted entries bypass the closed registry for SUPPORT, but a
58
+ * granted name that matches a registry target still needs a bundle, because the
59
+ * registry's required keys must be resolved. Errors name only the field.
60
+ */
61
+ export function validateGrantedTargetEntry(entry) {
62
+ if (typeof entry.command !== "string" || entry.command.trim().length === 0) {
63
+ return { ok: false, error: `granted server '${entry.name}' requires a non-empty command` };
64
+ }
65
+ if (!Array.isArray(entry.args)) {
66
+ return { ok: false, error: `granted server '${entry.name}' requires an args array` };
67
+ }
68
+ const registry = getThirdPartyTargetDefinition(entry.name);
69
+ const needsBundle = (entry.secret_env_keys?.length ?? 0) > 0 || (registry?.requiredEnvKeys.length ?? 0) > 0;
70
+ if (needsBundle && (entry.secret_bundle === undefined || entry.secret_bundle.trim().length === 0)) {
71
+ return { ok: false, error: `granted server '${entry.name}' requires a secret_bundle` };
72
+ }
73
+ return { ok: true };
74
+ }
75
+ /**
76
+ * BAPI-1545: the keys a granted entry's bundle must supply — its own
77
+ * `secret_env_keys` plus, for a registry target such as `sfcc`, the registry's
78
+ * required keys. Sorted and deduplicated.
79
+ */
80
+ export function grantedEntryRequiredKeys(entry) {
81
+ const registry = getThirdPartyTargetDefinition(entry.name);
82
+ return [...new Set([...(entry.secret_env_keys ?? []), ...(registry?.requiredEnvKeys ?? [])])].sort();
83
+ }
54
84
  // ---------------------------------------------------------------------------
55
85
  // Atomic env resolution
56
86
  // ---------------------------------------------------------------------------
@@ -199,6 +199,13 @@ async function confirmExecutorJob(deps, store, ticketKey, registrationKey, bindi
199
199
  return { binding, replaced: false };
200
200
  }
201
201
  }
202
+ /** Non-empty string warnings from an optional server field; anything else is ignored. */
203
+ function readWarnings(value) {
204
+ if (!Array.isArray(value))
205
+ return undefined;
206
+ const warnings = value.filter((entry) => typeof entry === "string" && entry.trim() !== "");
207
+ return warnings.length > 0 ? warnings : undefined;
208
+ }
202
209
  /**
203
210
  * Send every pending batch, oldest first. Never throws.
204
211
  *
@@ -242,6 +249,7 @@ export async function syncPendingSubmissions(deps, ticketKey, binding) {
242
249
  const body = response.body;
243
250
  if (body.readiness)
244
251
  readiness = body.readiness;
252
+ const warnings = readWarnings(body.warnings);
245
253
  const report = {
246
254
  submission_id: entry.submission_id,
247
255
  phase: entry.phase,
@@ -249,6 +257,7 @@ export async function syncPendingSubmissions(deps, ticketKey, binding) {
249
257
  retryable: body.retryable === true,
250
258
  refusals: Array.isArray(body.refusals) ? body.refusals : [],
251
259
  ...(body.recovery_guidance ? { recovery_guidance: body.recovery_guidance } : {}),
260
+ ...(warnings ? { warnings } : {}),
252
261
  };
253
262
  reports.push(report);
254
263
  if (report.retryable)
@@ -324,6 +324,8 @@ export function formatDryRunLine(found) {
324
324
  return ` ${relPath}: would create with ${MCP_PACKAGE_NAME}@${targetVersion}`;
325
325
  case "skip-worktree-shim":
326
326
  return ` ${relPath}: skipped — worktree mcp-invoke shim (no published-package pin applies)`;
327
+ case "skip-local-build":
328
+ return ` ${relPath}: skipped — local build preserved (no published-package pin applies)`;
327
329
  case "skip-inactive":
328
330
  return null; // Absent config for an inactive IDE — not worth a line.
329
331
  default:
@@ -346,6 +348,8 @@ export function formatResultLine(action) {
346
348
  return ` ${relPath}: created with ${MCP_PACKAGE_NAME}@${action.toVersion}`;
347
349
  case "skipped-worktree-shim":
348
350
  return ` ${relPath}: skipped — worktree mcp-invoke shim preserved`;
351
+ case "skipped-local-build":
352
+ return ` ${relPath}: skipped — local build preserved`;
349
353
  case "skipped-ahead":
350
354
  // Defensive: upgrade blocks on an ahead pin during preflight, so this is
351
355
  // only reachable if a config changed underneath the run.
@@ -363,6 +367,7 @@ export function formatResultLine(action) {
363
367
  */
364
368
  export function isEveryLauncherAlreadyCurrent(actions) {
365
369
  const applicable = actions.filter((a) => a.kind !== "skipped-worktree-shim" &&
370
+ a.kind !== "skipped-local-build" &&
366
371
  a.kind !== "skipped-inactive" &&
367
372
  a.kind !== "skipped-ahead");
368
373
  if (applicable.length === 0)
@@ -419,6 +424,8 @@ function globalResultAction(initial, targetVersion) {
419
424
  return { relPath, kind: "already-current", registrationKey, toVersion: targetVersion };
420
425
  case "skip-worktree-shim":
421
426
  return { relPath, kind: "skipped-worktree-shim", registrationKey };
427
+ case "skip-local-build":
428
+ return { relPath, kind: "skipped-local-build", registrationKey };
422
429
  default:
423
430
  return null;
424
431
  }
@@ -518,6 +525,12 @@ async function verifyCodexConfig(deps, env, snapshot, targetVersion, expected) {
518
525
  ? { inspection: found, failures: [] }
519
526
  : fail("a worktree shim was expected to be preserved but no longer looks like one");
520
527
  }
528
+ if (initial.action === "skip-local-build") {
529
+ // BAPI-1636: never spliced, so the file must read back byte-identical.
530
+ return found.action === "skip-local-build" && after.source === snapshot.source
531
+ ? { inspection: found, failures: [] }
532
+ : fail("a local build was expected to be preserved but no longer looks the same");
533
+ }
521
534
  if (found.action !== "already-current" || found.currentVersion !== targetVersion) {
522
535
  return fail(`expected ${MCP_PACKAGE_NAME}@${targetVersion} after the write`);
523
536
  }
@@ -572,11 +585,19 @@ export async function runUpgradeCli(argv, injected) {
572
585
  // ---- Phase 2: read-only launcher preflight, before ANY side effect ----
573
586
  const isCreatable = deps.isCreatable ?? ((relPath) => relPath === ".mcp.json");
574
587
  let inspections;
588
+ // BAPI-1636: the exact text each project config held, kept privately so a
589
+ // preserved local build can be proven byte-identical after the writes and its
590
+ // backing install found. Never reported.
591
+ const projectSources = new Map();
575
592
  try {
576
593
  inspections = await inspectLauncherConfigs({
577
594
  cwd: deps.cwd,
578
595
  targetVersion: target.version,
579
- readFile: deps.readFile,
596
+ readFile: async (filePath) => {
597
+ const text = await deps.readFile(filePath);
598
+ projectSources.set(filePath, text);
599
+ return text;
600
+ },
580
601
  isCreatable,
581
602
  targets: LAUNCHER_CONFIG_TARGETS,
582
603
  });
@@ -654,7 +675,14 @@ export async function runUpgradeCli(argv, injected) {
654
675
  return 0;
655
676
  }
656
677
  // ---- Phase 4: competing local install — a reconciliation, not a transition ----
657
- if (await deps.hasCompetingLocalInstall(deps.cwd)) {
678
+ // BAPI-1636: an install that a preserved local-build launcher runs from is
679
+ // never removed; removing it would break the registration this run keeps.
680
+ const localBuildEntries = localBuildEntryPoints(deps.cwd, inspections, projectSources, codexSnapshot);
681
+ const localInstallDir = path.join(deps.cwd, "node_modules", MCP_PACKAGE_NAME);
682
+ if (localBuildEntries.some((entry) => isPathInside(localInstallDir, entry))) {
683
+ stdout(`Kept node_modules/${MCP_PACKAGE_NAME}: a preserved local-build launcher runs from it.`);
684
+ }
685
+ else if (await deps.hasCompetingLocalInstall(deps.cwd)) {
658
686
  stdout("Found a competing local installation in node_modules. Removing so npx resolves the pinned version...");
659
687
  const removed = await deps.removeCompetingLocalInstall(deps.cwd);
660
688
  if (!removed) {
@@ -724,6 +752,7 @@ export async function runUpgradeCli(argv, injected) {
724
752
  const verificationFailures = [];
725
753
  for (const action of initResult.configActions) {
726
754
  if (action.kind === "skipped-worktree-shim" ||
755
+ action.kind === "skipped-local-build" ||
727
756
  action.kind === "skipped-inactive" ||
728
757
  action.kind === "skipped-ahead") {
729
758
  // Assert the shim really was left alone rather than quietly rewritten.
@@ -731,6 +760,20 @@ export async function runUpgradeCli(argv, injected) {
731
760
  if (action.kind === "skipped-worktree-shim" && after?.action !== "skip-worktree-shim") {
732
761
  verificationFailures.push(`${action.relPath}: a worktree shim was expected to be preserved but no longer looks like one`);
733
762
  }
763
+ // BAPI-1636: a local build is proven by its bytes, re-read after every write.
764
+ if (action.kind === "skipped-local-build") {
765
+ const fullPath = path.join(deps.cwd, action.relPath);
766
+ let current = null;
767
+ try {
768
+ current = await deps.readFile(fullPath);
769
+ }
770
+ catch {
771
+ current = null;
772
+ }
773
+ if (after?.action !== "skip-local-build" || current === null || current !== projectSources.get(fullPath)) {
774
+ verificationFailures.push(`${action.relPath}: a local build was expected to be preserved but no longer looks the same`);
775
+ }
776
+ }
734
777
  continue;
735
778
  }
736
779
  const after = verifiedByPath.get(action.relPath);
@@ -862,6 +905,43 @@ export async function runUpgradeCli(argv, injected) {
862
905
  }
863
906
  return 0;
864
907
  }
908
+ /**
909
+ * BAPI-1636: the entry-point paths of every preserved local-build launcher,
910
+ * project and Codex, read from the text Phase 2 already captured. Private: the
911
+ * paths decide Phase 4 cleanup and are never printed.
912
+ */
913
+ function localBuildEntryPoints(cwd, inspections, projectSources, codex) {
914
+ const entries = [];
915
+ for (const found of inspections) {
916
+ if (found.action !== "skip-local-build" || found.registrationKey === null)
917
+ continue;
918
+ try {
919
+ const parsed = JSON.parse(projectSources.get(path.join(cwd, found.relPath)) ?? "");
920
+ const first = parsed?.[found.topLevelKey]?.[found.registrationKey]?.args?.[0];
921
+ if (typeof first === "string")
922
+ entries.push(first);
923
+ }
924
+ catch {
925
+ // Unreadable now means unknown: nothing is added, so cleanup is unchanged.
926
+ }
927
+ }
928
+ if (codex.inspection.action === "skip-local-build" && codex.source !== null) {
929
+ const found = inspectCodexLauncher(codex.source);
930
+ if (found.kind === "local-build" && typeof found.args[0] === "string")
931
+ entries.push(found.args[0]);
932
+ }
933
+ return entries;
934
+ }
935
+ /**
936
+ * True when `candidate` lies inside `dir`, by path containment rather than a
937
+ * string prefix (`.../mcp-server-old` is not inside `.../mcp-server`). The POSIX
938
+ * or Windows rules follow the candidate's own form.
939
+ */
940
+ function isPathInside(dir, candidate) {
941
+ const paths = candidate.startsWith("/") ? path.posix : path.win32;
942
+ const relative = paths.relative(dir, candidate);
943
+ return relative.length > 0 && !relative.startsWith("..") && !paths.isAbsolute(relative);
944
+ }
865
945
  /** Planned actions that change a configuration and so warrant reload guidance. */
866
946
  const PLANNED_CHANGE_ACTIONS = new Set([
867
947
  "repin",
@@ -935,6 +1015,9 @@ function toPlannedActions(inspections) {
935
1015
  case "skip-worktree-shim":
936
1016
  actions.push({ relPath: found.relPath, kind: "skipped-worktree-shim" });
937
1017
  break;
1018
+ case "skip-local-build":
1019
+ actions.push({ relPath: found.relPath, kind: "skipped-local-build" });
1020
+ break;
938
1021
  case "skip-inactive":
939
1022
  actions.push({ relPath: found.relPath, kind: "skipped-inactive" });
940
1023
  break;
@@ -164,7 +164,11 @@ const LEGACY_V2_READINESS_REQUIREMENTS = [
164
164
  // with child 4, once a repository can actually satisfy it.
165
165
  ];
166
166
  /** The three additive outcomes are authoritative; absent or unknown never denies. */
167
- const NEW_IDS = ['server.indexed-workflows', 'server.unattended-notify-default', 'server.test-command'];
167
+ const LAUNCH_ONLY_BLOCKING_IDS = [
168
+ { id: 'server.escalation-webhook-reachable', unattendedOnly: true },
169
+ { id: 'server.provider-default-branch-readable', unattendedOnly: false },
170
+ ];
171
+ const NEW_IDS = ['server.indexed-workflows', 'server.unattended-notify-default'];
168
172
  export const V2_READINESS_REQUIREMENTS = [
169
173
  ...LEGACY_V2_READINESS_REQUIREMENTS.map(req => {
170
174
  const id = READINESS_LEGACY_IDS[req.id] ?? req.id;
@@ -183,6 +187,17 @@ export const V2_READINESS_REQUIREMENTS = [
183
187
  satisfied: (r) => !r.prerequisites?.some(p => p.id === id && p.check_status === 'not_met' && p.impact === 'blocking'),
184
188
  remedyFor: (r) => r.prerequisites?.find(p => p.id === id)?.fix ?? 'Retry readiness.',
185
189
  })),
190
+ // BAPI-1585 — two launch checks the server evaluates only on a launch path. The
191
+ // webhook row is unattended-only (it is not_applicable otherwise). The provider
192
+ // read applies to every launch, attended included, so it carries no marker. The
193
+ // integration-branch note is deliberately absent: it is a warning, rendered from
194
+ // the generic prerequisite list, and never gates.
195
+ ...LAUNCH_ONLY_BLOCKING_IDS.map(({ id, unattendedOnly }) => ({
196
+ id, describe: READINESS_PREREQUISITE_BY_ID.get(id).label, governedRowIds: [id], launchOnly: true,
197
+ ...(unattendedOnly ? { unattendedOnly: true } : {}),
198
+ satisfied: (r) => !r.prerequisites?.some(p => p.id === id && p.check_status === 'not_met' && p.impact === 'blocking'),
199
+ remedyFor: (r) => r.prerequisites?.find(p => p.id === id)?.fix ?? 'Retry readiness.',
200
+ })),
186
201
  ];
187
202
  // ---------------------------------------------------------------------------
188
203
  // BAPI-1452: launch capability evidence
@@ -509,6 +524,18 @@ export function buildLaunchReadinessChecks(readiness, context) {
509
524
  providerRepositoryCheck(readiness),
510
525
  ], context);
511
526
  }
527
+ /**
528
+ * BAPI-1595 — only the two launch-evidence rows (merge credential, worktree), for a
529
+ * launch that holds the local evidence but no full readiness report. The rows are
530
+ * built by the same functions {@link buildLaunchReadinessChecks} uses, so their
531
+ * wording and blocking projection cannot drift from it.
532
+ */
533
+ export function buildLaunchEvidenceChecks(context, evidence) {
534
+ const used = optedOut(context) ? undefined : evidence;
535
+ return projectReadinessRowBlocking([credentialCheck(used?.credential ?? null), worktreeCheck(used?.worktree ?? null)],
536
+ // The launch-evidence requirements apply by the evidence itself, as in {@link buildLaunchReadinessChecks}.
537
+ { ...context, launchEvidence: evidence });
538
+ }
512
539
  /** The two launch-evidence rows a launch can be refused on. */
513
540
  export const LAUNCH_EVIDENCE_ROW_IDS = [
514
541
  MERGE_CREDENTIAL_CAPABILITY_ROW_ID,
@@ -1,4 +1,4 @@
1
1
  // AUTO-GENERATED — do not edit manually. Regenerate with: npm run build
2
- export const VERSION = "0.2.72";
3
- export const BUILD_COMMIT = "bfa72f4a97cf";
4
- export const LAUNCHER_ARGS = ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.72", "serve"];
2
+ export const VERSION = "0.2.73";
3
+ export const BUILD_COMMIT = "4fdcc25cb582";
4
+ export const LAUNCHER_ARGS = ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.73", "serve"];
@@ -1,6 +1,14 @@
1
1
  # Epic Implementer install guide
2
2
 
3
- This file is now a short pointer. The one first-run guide is
3
+ The easiest way to set up Epic Implementer is the `/install-epic-implementer`
4
+ command in Claude Code. It checks your repository, explains what it found, and asks
5
+ for one approval before it changes anything.
6
+
7
+ You can also run setup yourself with
8
+ `npx -y @bridge_gpt/mcp-server install epic-implementer`. To script it, see the
9
+ `--answers` section of new-project-setup.md.
10
+
11
+ The one first-run guide is
4
12
  [epic-implementer/getting-started.md](./epic-implementer/getting-started.md).
5
13
  `npx -y @bridge_gpt/mcp-server install` writes that guide into your project at
6
14
  `docs/install/epic-implementer-install.md`. Run it again at any time to refresh
@@ -18,6 +18,7 @@ Setup checks every item below for you, fixes what it can, and prints the one ste
18
18
  - **Supervisor required CI checks** (`server.supervisor-required-checks`) — The CI checks a child pull request must pass before it merges are stored. Fix: Run setup and confirm the gate it proposes, or name a check with `--required-check <name>`.
19
19
  - **Review policy** (`server.review-policy`) — The review policy for child pull requests is known. AI review is an opt-in choice by the repository admin. Fix: Nothing is needed unless you want AI review. Choose a policy at launch with `--review-policy`.
20
20
  - **GitHub App credentials** (`server.github-credentials`) — Bridge's GitHub App is connected and can read this repository. Fix: Run `npx -y @bridge_gpt/mcp-server connect-github`, then run setup again.
21
+ - **Provider default branch readable** (`server.provider-default-branch-readable`) — Bridge can read this repository's default branch from GitHub. Fix: Reconnect the GitHub App with `npx -y @bridge_gpt/mcp-server connect-github`, then run setup again.
21
22
  - **GitHub App actions permission** (`server.github-actions-permission`) — The GitHub App may start workflow runs. Only needed when merges go through GitHub Actions. Fix: Accept the updated permission on the GitHub App's installation page, then run setup again.
22
23
  - **Merge workflow eligibility** (`server.merge-execution-workflow`) — The merge workflow file is on the default branch and current. Only needed when merges go through GitHub Actions. Fix: Run `npx -y @bridge_gpt/mcp-server install epic-implementer --merge-workflow --codeowner <@org/team|@user>`, merge the pull request it opens, then run setup again.
23
24
  - **Merge branch policy** (`server.merge-execution-branch-policy`) — The default branch rules let the merge workflow do its job. Only needed when merges go through GitHub Actions. Fix: Adjust the branch rule or ruleset as setup describes, then run setup again.
@@ -25,9 +26,10 @@ Setup checks every item below for you, fixes what it can, and prints the one ste
25
26
  - **Review workflow protocol** (`server.review-workflow`) — The review workflow on the default branch matches the review policy. Only needed with AI review. Fix: Run setup; it names the workflow change to make.
26
27
  - **Conductor CI migration guard** (`server.conductor-ci-workflow`) — The CI workflow file `epic-implementer-ci.yml` is on the default branch and runs the migration guard where needed. Fix: Run setup, merge the setup pull request it opens, then run setup again.
27
28
  - **Escalation channel (webhook or email)** (`server.unattended-notify-default`) — Bridge has somewhere to send an escalation: a verified notify webhook, or your account email. Fix: Declare a notify webhook, or verify your account email.
29
+ - **Escalation webhook reachable** (`server.escalation-webhook-reachable`) — A declared notify webhook answers Bridge's test request. Only checked for unattended runs that declare a webhook. Fix: Start or fix the notify sink so it answers with a 2xx status, or launch with `--attended`.
28
30
  - **Repository workflow readiness** (`server.repository-workflow-readiness`) — The CI and review workflows are confirmed on the default branch. Fix: Run setup, merge the setup pull request, then run setup again.
29
31
  - **Workflows at indexed commit** (`server.indexed-workflows`) — The repository index includes the workflow files on the default branch. Fix: Merge the setup pull request, then run setup again. It starts the re-index and reports this item as pending until the index reaches that commit.
30
- - **Known test command** (`server.test-command`) — Bridge knows the command that runs this repository's tests. Fix: Run `npx -y @bridge_gpt/mcp-server install epic-implementer --test-command "<command>"`, replacing `<command>` with the one command that runs your tests, or run setup and answer its test command question.
32
+ - **Integration branch configured** (`server.integration-branch-unset`) — The repository has an integration branch set. This is a note only and never blocks a launch. Fix: Nothing is needed. Set the repository's base branch to clear the note.
31
33
  - **Service availability** (`server.service-availability`) — Bridge could read this repository's readiness from the server. Fix: Retry in a few minutes. If it keeps failing, email info@bridgegpt.ai.
32
34
  - **Claude login** (`install.claude-login`) — Claude Code is signed in on this computer. Fix: Run `claude` and sign in, then run setup again.
33
35
  - **Repository identity** (`install.identity`) — Bridge knows which repository this folder is. Fix: Run setup from the repository root, or pass `--repo <name>`.
@@ -126,7 +126,20 @@ npx -y @bridge_gpt/mcp-server install conductor --launch-profile <name> --base-u
126
126
 
127
127
  Setup records an explicit target (there is no production default), a confirmed credential binding, and verified consent, notification, and actor prerequisites. Only when all of them hold does it save the profile and print the one launch command that selects it. `--execution-mode local|durable` chooses the runtime (durable when `--executor-id` is given, otherwise local), and `--policy-file <path>` names the run policy the profile references.
128
128
 
129
- To launch with a profile, pass `--launch-profile <name>` to `drive-epic`, or set `BAPI_EPIC_LAUNCH_PROFILE`. The flag takes precedence. With a profile, `--base-url` must agree with it; an override never rebinds a profile. For an environment-selected profile, `BAPI_BASE_URL` remains the general CLI endpoint and does not conflict with the epic launch target. With none of the three, `drive-epic` targets production and uses the stored `bapi:<repo>` key when there is one. A stored key approved for a different endpoint is never sent.
129
+ To launch with a profile, pass `--launch-profile <name>` to `drive-epic`, or set `BAPI_EPIC_LAUNCH_PROFILE`. The flag takes precedence. With a profile, `--base-url` must agree with it; an override never rebinds a profile. For an environment-selected profile, `BAPI_BASE_URL` remains the general CLI endpoint for other CLIs and does not conflict with the epic launch target. The Epic Implementer verbs (`wait-run`, approve, state reads, and the recovery verbs) also follow that profile, so they reach the same server as the launch. The `prerequisite-inputs` lookup keeps `BAPI_BASE_URL`, because it runs before the plane starts. With none of the three, `drive-epic` targets production and uses the stored `bapi:<repo>` key when there is one. A stored key approved for a different endpoint is never sent.
130
+
131
+ ## A missing plan is built at setup
132
+
133
+ When no plan file names the epic and the epic has no live run, `drive-epic` builds the plan
134
+ from the epic's stored children before anything is created. Those reads run
135
+ before any local plane is up, so they use the general Bridge resolver, the same one the
136
+ `prerequisite-inputs` lookup uses: `BAPI_BASE_URL` and the stored `bapi:<repo>` key, never
137
+ the launch profile. The child list comes from `GET /jira/tickets/{epic_key}/children`,
138
+ which reads through the ticket-store seam, so it works the same for Jira and for local
139
+ ticket storage. A preview builds the plan in memory and writes nothing; a real launch saves
140
+ it to `{docs_dir}/epic-plans/<epic-key>-generated/` by one folder rename, then continues as
141
+ for a found plan. Delete that folder to return to the missing-plan behavior. The operator
142
+ runbook describes the rules and every fixed failure reason.
130
143
 
131
144
  ## A live run with no plan
132
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridge_gpt/mcp-server",
3
- "version": "0.2.72",
3
+ "version": "0.2.73",
4
4
  "description": "Bridge API MCP server — exposes Jira endpoints as MCP tools for Claude Code agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "overrides": {
65
65
  "fast-uri": ">=4.1.3",
66
- "hono": ">=4.13.7",
66
+ "hono": ">=4.13.13",
67
67
  "@hono/node-server": "^1.19.13",
68
68
  "ip-address": ">=10.1.1"
69
69
  },