@bridge_gpt/mcp-server 0.2.72 → 0.2.74

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 (181) hide show
  1. package/README.md +5 -5
  2. package/build/agent-launchers/claude-executor-adapter.js +15 -0
  3. package/build/agents.generated.js +6 -6
  4. package/build/bridge-config.js +7 -1
  5. package/build/bridge-permissions.js +30 -0
  6. package/build/ci-system-detection.js +50 -0
  7. package/build/ci-trigger-adapters.js +631 -0
  8. package/build/ci-trigger-install.js +106 -0
  9. package/build/codex-launcher-pin.js +33 -2
  10. package/build/codex-skill-adapter.js +3 -1
  11. package/build/command-host.js +33 -0
  12. package/build/command-provisioning.js +4 -3
  13. package/build/commands.generated.js +7 -6
  14. package/build/conductor/bridge-api-client.js +867 -35
  15. package/build/conductor/bring-up-facts.js +18 -5
  16. package/build/conductor/command-drift-production.js +42 -17
  17. package/build/conductor/command-drift.js +48 -1
  18. package/build/conductor/declare-blocked.js +554 -0
  19. package/build/conductor/declared-extras.js +335 -0
  20. package/build/conductor/doctor.js +108 -21
  21. package/build/conductor/driver-commands.js +141 -0
  22. package/build/conductor/driver-guard.js +277 -0
  23. package/build/conductor/driver-lapse.js +321 -0
  24. package/build/conductor/driver-pass-output.js +104 -0
  25. package/build/conductor/driver-pass.js +571 -0
  26. package/build/conductor/driver-register.js +176 -0
  27. package/build/conductor/driver-release.js +174 -0
  28. package/build/conductor/driver-session-state.js +315 -0
  29. package/build/conductor/epic-branch-ci-inspection.js +281 -43
  30. package/build/conductor/epic-implementer-cli.js +199 -15
  31. package/build/conductor/epic-server-database.js +162 -0
  32. package/build/conductor/epic-server-guidance.js +278 -0
  33. package/build/conductor/epic-server-journal.js +239 -0
  34. package/build/conductor/epic-server-processes.js +324 -0
  35. package/build/conductor/epic-server-recipe.js +397 -0
  36. package/build/conductor/epic-server-runtime.js +1207 -0
  37. package/build/conductor/epic-server-sfcc-upload.js +1567 -0
  38. package/build/conductor/epic-server-sfcc.js +85 -0
  39. package/build/conductor/epic-server-state.js +427 -0
  40. package/build/conductor/epic-server.js +647 -0
  41. package/build/conductor/gate-discovery.js +196 -11
  42. package/build/conductor/gate-settings-review.js +261 -4
  43. package/build/conductor/launch-need-probes.js +6 -53
  44. package/build/conductor/launch-plan.js +313 -156
  45. package/build/conductor/prerequisite-inputs.js +879 -45
  46. package/build/conductor/readiness-assessment.js +16 -1
  47. package/build/conductor/readiness-cli.js +20 -9
  48. package/build/conductor/readiness-prerequisites.js +28 -9
  49. package/build/conductor/readiness-sections.js +133 -126
  50. package/build/conductor/readiness.js +1 -1
  51. package/build/conductor/recovery-cli.js +13 -2
  52. package/build/conductor/tools.js +6 -5
  53. package/build/conductor/wait-run-attention.js +2 -2
  54. package/build/conductor/wait-run-cli.js +208 -22
  55. package/build/conductor/worker-database-doctor-inspector.js +33 -2
  56. package/build/conductor/worker-setup-tally.js +27 -0
  57. package/build/credential-delivery.js +280 -0
  58. package/build/credential-launch-safety.js +142 -0
  59. package/build/credential-materialization.js +91 -16
  60. package/build/credential-references-node-deps.js +29 -0
  61. package/build/credential-references.js +1394 -0
  62. package/build/credential-references.test-fixtures.js +211 -0
  63. package/build/credential-scan-conventions.js +145 -0
  64. package/build/credential-scan.js +517 -0
  65. package/build/credential-store.js +121 -1
  66. package/build/credentials-cli.js +252 -3
  67. package/build/dependency-install-declarations.js +102 -1
  68. package/build/docs.generated.js +10 -3
  69. package/build/doctor.js +95 -3
  70. package/build/drive-epic-help.js +21 -2
  71. package/build/drive-epic.js +2095 -375
  72. package/build/engine-paths.js +20 -0
  73. package/build/epic-branch-ci-summary.js +157 -0
  74. package/build/epic-capability-statement.js +175 -0
  75. package/build/epic-ci-workflow-drift.js +77 -23
  76. package/build/epic-ci-workflow-install.js +137 -44
  77. package/build/epic-ci-workflow-v2.js +274 -0
  78. package/build/epic-ci-workflow-v3.js +273 -0
  79. package/build/epic-ci-workflow.js +165 -18
  80. package/build/epic-implementer-bin.js +2204 -56
  81. package/build/epic-launch-context.js +702 -0
  82. package/build/epic-server-record.js +288 -0
  83. package/build/epic-shared/bridge-client.js +11 -3
  84. package/build/escalation-reachability.js +43 -0
  85. package/build/executor/ci-fix-test-runs.js +334 -0
  86. package/build/executor/completion-contract.js +8 -1
  87. package/build/executor/credential-delivery-step.js +168 -0
  88. package/build/executor/deps.js +3 -1
  89. package/build/executor/env.js +98 -23
  90. package/build/executor/epic-server-context.js +157 -0
  91. package/build/executor/gate-qualification-job.js +127 -26
  92. package/build/executor/guarded-fast-forward-push.js +13 -8
  93. package/build/executor/http-client.js +52 -5
  94. package/build/executor/job-runner.js +577 -81
  95. package/build/executor/observation.js +8 -0
  96. package/build/executor/permissions.js +85 -3
  97. package/build/executor/pre-pr-checks.js +363 -0
  98. package/build/executor/prompt-spec.js +149 -3
  99. package/build/executor/reconcile-overlap-job.js +5 -3
  100. package/build/executor/required-work-diagnostics.js +4 -2
  101. package/build/executor/required-work-ledger.js +936 -38
  102. package/build/executor/results.js +58 -0
  103. package/build/executor/terminal-mutation.js +8 -0
  104. package/build/executor/worker-command.js +72 -3
  105. package/build/executor/worker-database-config.js +281 -0
  106. package/build/executor/worker-database-target.js +16 -12
  107. package/build/executor/worker-database.js +320 -101
  108. package/build/executor/worker-finalization.js +7 -1
  109. package/build/executor/worker-resources.js +25 -3
  110. package/build/executor/worker-verification-guidance.js +18 -3
  111. package/build/executor/worktree.js +20 -1
  112. package/build/executor-launch.js +58 -4
  113. package/build/generated-assets-catalog.js +2 -2
  114. package/build/git-exclude-lock.js +187 -0
  115. package/build/index.js +824 -366
  116. package/build/init.js +26 -11
  117. package/build/install-bridge-conductor-answers.js +528 -0
  118. package/build/install-bridge-conductor-apply.js +288 -0
  119. package/build/install-bridge-conductor-assessment.js +1222 -0
  120. package/build/install-bridge-conductor-compact.js +186 -0
  121. package/build/install-bridge-conductor-contracts.js +72 -0
  122. package/build/install-bridge-conductor-gate.js +1312 -198
  123. package/build/install-bridge-conductor-setup.js +577 -83
  124. package/build/install-bridge-conductor.js +3381 -544
  125. package/build/install-bridge.js +280 -25
  126. package/build/install-doctor.js +38 -8
  127. package/build/install-maintenance.js +26 -3
  128. package/build/install-sfcc-detection.js +120 -0
  129. package/build/install-sfcc-setup.js +185 -0
  130. package/build/launcher-config-inspection.js +162 -1
  131. package/build/mcp-grant-candidates.js +779 -0
  132. package/build/mcp-grant-doctor.js +63 -0
  133. package/build/mcp-grant.js +288 -0
  134. package/build/mcp-host-targets.js +8 -0
  135. package/build/mcp-identity.js +23 -0
  136. package/build/mcp-invoke.js +292 -15
  137. package/build/mcp-presets.js +107 -0
  138. package/build/mcp-provisioning.js +155 -6
  139. package/build/mcp-registration-doctor.js +31 -2
  140. package/build/mcp-server-invocation.js +19 -1
  141. package/build/merge-workflow-install.js +243 -110
  142. package/build/pipelines.generated.js +7 -6
  143. package/build/plan-discovery.js +97 -4
  144. package/build/plan-execution-ledger.js +100 -7
  145. package/build/plan-generation-io.js +262 -0
  146. package/build/plan-generation.js +424 -0
  147. package/build/plane/build-freshness.js +6 -1
  148. package/build/plane/cli.js +75 -9
  149. package/build/plane/plane-freshness.js +17 -0
  150. package/build/plane/preflight.js +50 -10
  151. package/build/plane/shutdown.js +19 -0
  152. package/build/plane/status.js +8 -2
  153. package/build/plane/terminal-run-cleanup.js +18 -4
  154. package/build/printed-remedy-commands.js +211 -12
  155. package/build/project-root.js +40 -0
  156. package/build/readiness-check.js +77 -0
  157. package/build/readiness-prerequisites.generated.js +122 -14
  158. package/build/readme.generated.js +1 -1
  159. package/build/repository-state-paths.js +41 -0
  160. package/build/repository-toolchains.js +6 -3
  161. package/build/run-unit-tests-launcher.js +8 -1
  162. package/build/setup-epic.js +1305 -210
  163. package/build/setup-progress.js +44 -0
  164. package/build/setup-question.js +122 -4
  165. package/build/sfcc/credentials.js +3 -2
  166. package/build/sfcc/hostname.js +98 -2
  167. package/build/sfcc/tool-wrapper.js +6 -95
  168. package/build/start-tickets.js +193 -29
  169. package/build/test-support/executor-source-files.js +200 -0
  170. package/build/testing-config-client.js +25 -2
  171. package/build/third-party-mcp-targets.js +63 -2
  172. package/build/ticket-delivery-enrollment.js +9 -0
  173. package/build/upgrade-cli.js +85 -2
  174. package/build/v2-readiness-requirements.js +28 -1
  175. package/build/version.generated.js +3 -3
  176. package/build/with-credentials.js +208 -0
  177. package/build/worktree-credential-delivery.js +340 -0
  178. package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
  179. package/docs/epic-implementer/getting-started.md +3 -1
  180. package/docs/epic-implementer/self-hosting.md +14 -1
  181. package/package.json +2 -2
@@ -0,0 +1,340 @@
1
+ /**
2
+ * BAPI-1647: the one file-delivery lifecycle shared by the EI executor and
3
+ * `start-tickets` worktrees.
4
+ *
5
+ * For each approved sandbox `worktree_file` destination, at every worker start:
6
+ *
7
+ * 1. RECONCILE. Bridge keeps a small, names-and-paths-only state file under
8
+ * the worktree's OWN git directory (`git rev-parse --git-dir`, so each
9
+ * linked worktree has its own). A link Bridge recorded that is no longer
10
+ * approved, or whose approved source changed, is removed — but only after
11
+ * `lstat` + `readlink` show it is still exactly the link Bridge made. A
12
+ * regular file, a foreign link, or a target Bridge cannot identify is left
13
+ * in place. An absent or unusable record approves nothing, so it removes
14
+ * every identifiable Bridge link.
15
+ * 2. EXCLUDE FIRST. Every approved destination — retained, new, or one whose
16
+ * source is missing right now — is added to the checkout's local
17
+ * `info/exclude` under the cross-process exclude lock. A link is created
18
+ * (or kept) only after its exclusion succeeded, so a reused worktree never
19
+ * fails the pre-spawn clean check because of an unexcluded link.
20
+ * 3. LINK. Ownership is recorded BEFORE the link is exposed, and rolled back
21
+ * when the hardened materializer refuses. An unrecorded symlink that
22
+ * already points at the approved source is used but never adopted.
23
+ *
24
+ * WHY A SYMLINK IS SAFE TO LEAVE IN A CHECKOUT: git stores a symlink as the
25
+ * link's TARGET PATHNAME, never the bytes of the file it points to. Even a
26
+ * link that was somehow committed would carry only a path such as
27
+ * `/Users/owner/.config/tool/dw.json`, not the secret. The local exclusion is
28
+ * still required so the link (and its path) stays out of commits and out of
29
+ * `git status`.
30
+ *
31
+ * Every failure omits only the affected credential with a named notice. Nothing
32
+ * here fails a job or a `start-tickets` row, and nothing reads or copies a
33
+ * credential file's contents.
34
+ */
35
+ import { lstat, mkdir, readFile, readlink, realpath, rename, symlink, unlink, writeFile } from "fs/promises";
36
+ import path from "path";
37
+ import { materializeFileCredentialForWorktree, } from "./credential-materialization.js";
38
+ import { defaultExcludeLockDeps, ensureGitInfoExcludedLocked, } from "./git-exclude-lock.js";
39
+ export const CREDENTIAL_LINK_STATE_VERSION = 1;
40
+ /** Relative to the worktree's own git directory. */
41
+ export const CREDENTIAL_LINK_STATE_RELPATH = path.join("bridge", "credential-links.json");
42
+ function errnoCode(err) {
43
+ return err && typeof err === "object" ? err.code : undefined;
44
+ }
45
+ function isWithin(child, root) {
46
+ const rel = path.relative(root, child);
47
+ return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
48
+ }
49
+ function outcomeFor(reason) {
50
+ switch (reason) {
51
+ case "dest_occupied":
52
+ return "dest_occupied";
53
+ case "dest_unsafe":
54
+ case "invalid_dest":
55
+ return "dest_unsafe";
56
+ default:
57
+ return "dest_unavailable";
58
+ }
59
+ }
60
+ function parseState(raw) {
61
+ let parsed;
62
+ try {
63
+ parsed = JSON.parse(raw);
64
+ }
65
+ catch {
66
+ return null;
67
+ }
68
+ if (!parsed || typeof parsed !== "object")
69
+ return null;
70
+ const obj = parsed;
71
+ if (obj.version !== CREDENTIAL_LINK_STATE_VERSION || !Array.isArray(obj.links))
72
+ return null;
73
+ const links = [];
74
+ for (const item of obj.links) {
75
+ if (!item || typeof item !== "object")
76
+ return null;
77
+ const { name, dest, source } = item;
78
+ if (typeof name !== "string" || typeof dest !== "string" || typeof source !== "string")
79
+ return null;
80
+ if (path.isAbsolute(dest) || dest.split(/[\\/]+/).includes("..") || !path.isAbsolute(source))
81
+ return null;
82
+ links.push({ name, dest, source });
83
+ }
84
+ return { version: CREDENTIAL_LINK_STATE_VERSION, links };
85
+ }
86
+ async function resolveGitDir(worktreeRoot, deps) {
87
+ try {
88
+ const result = await deps.runCommand("git", ["rev-parse", "--git-dir"], { cwd: worktreeRoot });
89
+ const raw = result.stdout.trim();
90
+ if (result.exitCode !== 0 || raw.length === 0)
91
+ return null;
92
+ return path.isAbsolute(raw) ? path.normalize(raw) : path.resolve(worktreeRoot, raw);
93
+ }
94
+ catch {
95
+ return null;
96
+ }
97
+ }
98
+ /**
99
+ * Remove one Bridge-recorded link, only when it is still provably Bridge's:
100
+ * its parent canonicalizes inside the worktree, it is a symlink, and it points
101
+ * at the recorded source. Returns "removed", "left" (not identifiable — left in
102
+ * place), or "failed" (identifiable but could not be removed).
103
+ */
104
+ async function removeOwnedLink(worktreeRoot, realRoot, entry, deps) {
105
+ const linkPath = path.join(worktreeRoot, entry.dest);
106
+ try {
107
+ const parent = await deps.realpath(path.dirname(linkPath));
108
+ if (!isWithin(parent, realRoot))
109
+ return "unsafe";
110
+ }
111
+ catch (err) {
112
+ return errnoCode(err) === "ENOENT" ? "removed" : "left";
113
+ }
114
+ let stat;
115
+ try {
116
+ stat = await deps.lstat(linkPath);
117
+ }
118
+ catch (err) {
119
+ return errnoCode(err) === "ENOENT" ? "removed" : "left";
120
+ }
121
+ if (!stat.isSymbolicLink())
122
+ return "left";
123
+ try {
124
+ if ((await deps.readlink(linkPath)) !== entry.source)
125
+ return "left";
126
+ }
127
+ catch {
128
+ return "left";
129
+ }
130
+ try {
131
+ await deps.unlink(linkPath);
132
+ return "removed";
133
+ }
134
+ catch (err) {
135
+ return errnoCode(err) === "ENOENT" ? "removed" : "failed";
136
+ }
137
+ }
138
+ /** Deliver approved file credentials into one worktree. Never throws. */
139
+ export async function deliverWorktreeFileCredentials(input, deps) {
140
+ const result = { delivered: [], notices: [], removed: [] };
141
+ try {
142
+ return await deliver(input, deps, result);
143
+ }
144
+ catch {
145
+ // Contain anything unexpected: omit every credential not yet delivered.
146
+ const delivered = new Set(result.delivered.map((d) => d.name));
147
+ for (const spec of input.files) {
148
+ if (!delivered.has(spec.name))
149
+ result.notices.push({ name: spec.name, reason: "dest_unavailable" });
150
+ }
151
+ return result;
152
+ }
153
+ }
154
+ async function deliver(input, deps, result) {
155
+ const { worktreeRoot } = input;
156
+ if (deps.platform === "win32") {
157
+ // The file channel stays gated on Windows; variables and MCP overlays still apply.
158
+ for (const spec of input.files)
159
+ result.notices.push({ name: spec.name, reason: "windows_gated" });
160
+ return result;
161
+ }
162
+ const approved = input.recordState === "ok" ? input.approved : [];
163
+ const gitDir = await resolveGitDir(worktreeRoot, deps);
164
+ if (gitDir === null) {
165
+ for (const spec of input.files)
166
+ result.notices.push({ name: spec.name, reason: "state_write_failed" });
167
+ return result;
168
+ }
169
+ const statePath = path.join(gitDir, CREDENTIAL_LINK_STATE_RELPATH);
170
+ let state;
171
+ try {
172
+ state = parseState(await deps.readFile(statePath));
173
+ }
174
+ catch (err) {
175
+ state = errnoCode(err) === "ENOENT" ? { version: CREDENTIAL_LINK_STATE_VERSION, links: [] } : null;
176
+ }
177
+ if (state === null) {
178
+ // Ownership bookkeeping is unreadable: never guess what Bridge owns.
179
+ for (const spec of input.files)
180
+ result.notices.push({ name: spec.name, reason: "state_write_failed" });
181
+ return result;
182
+ }
183
+ // Nothing recorded, approved, or offered (for example an absent record in a
184
+ // worktree Bridge never linked into): no further filesystem work.
185
+ if (state.links.length === 0 && approved.length === 0 && input.files.length === 0)
186
+ return result;
187
+ let realRoot;
188
+ try {
189
+ realRoot = await deps.realpath(worktreeRoot);
190
+ }
191
+ catch {
192
+ for (const spec of input.files)
193
+ result.notices.push({ name: spec.name, reason: "state_write_failed" });
194
+ return result;
195
+ }
196
+ const publish = async (links) => {
197
+ try {
198
+ await deps.mkdir(path.dirname(statePath), { recursive: true });
199
+ const temp = `${statePath}.${deps.tempSuffix ? deps.tempSuffix() : `${process.pid}.${Date.now()}`}.tmp`;
200
+ const body = { version: CREDENTIAL_LINK_STATE_VERSION, links };
201
+ await deps.writeFile(temp, `${JSON.stringify(body, null, 2)}\n`);
202
+ await deps.rename(temp, statePath);
203
+ return true;
204
+ }
205
+ catch {
206
+ return false;
207
+ }
208
+ };
209
+ const specByDest = new Map(input.files.map((spec) => [spec.dest, spec]));
210
+ const approvedByDest = new Map(approved.map((a) => [a.dest, a.entry]));
211
+ // 1. Reconcile recorded links.
212
+ const kept = [];
213
+ let stateChanged = false;
214
+ for (const entry of state.links) {
215
+ const stillApproved = approvedByDest.get(entry.dest) === entry.name;
216
+ const spec = specByDest.get(entry.dest);
217
+ const sameSource = spec === undefined || spec.source === entry.source;
218
+ if (stillApproved && sameSource) {
219
+ kept.push(entry);
220
+ continue;
221
+ }
222
+ const outcome = await removeOwnedLink(worktreeRoot, realRoot, entry, deps);
223
+ if (outcome === "failed") {
224
+ kept.push(entry);
225
+ result.notices.push({ name: entry.name, reason: "reconcile_failed" });
226
+ continue;
227
+ }
228
+ // A parent that now resolves outside the worktree: never delete through
229
+ // it; name the omission and stop tracking a link Bridge cannot reach.
230
+ if (outcome === "unsafe")
231
+ result.notices.push({ name: entry.name, reason: "reconcile_failed" });
232
+ if (outcome === "removed")
233
+ result.removed.push(entry.dest);
234
+ stateChanged = true;
235
+ }
236
+ let links = kept;
237
+ if (stateChanged && !(await publish(links))) {
238
+ for (const spec of input.files)
239
+ result.notices.push({ name: spec.name, reason: "state_write_failed" });
240
+ return result;
241
+ }
242
+ // 2. Exclude every approved destination first.
243
+ const gitDeps = {
244
+ readFile: deps.readFile,
245
+ writeFile: deps.writeFile,
246
+ mkdir: deps.mkdir,
247
+ runCommand: deps.runCommand,
248
+ platform: deps.platform,
249
+ };
250
+ const ensureExcluded = deps.ensureExcluded ??
251
+ ((root, rel, d) => ensureGitInfoExcludedLocked(root, rel, d, deps.excludeLock ?? defaultExcludeLockDeps()));
252
+ const excluded = new Set();
253
+ for (const { dest } of approved) {
254
+ if (excluded.has(dest))
255
+ continue;
256
+ const outcome = await ensureExcluded(worktreeRoot, dest, gitDeps);
257
+ if (outcome.ok)
258
+ excluded.add(dest);
259
+ }
260
+ // A retained Bridge link whose exclusion failed is withdrawn.
261
+ const retained = [];
262
+ for (const entry of links) {
263
+ if (excluded.has(entry.dest)) {
264
+ retained.push(entry);
265
+ continue;
266
+ }
267
+ const outcome = await removeOwnedLink(worktreeRoot, realRoot, entry, deps);
268
+ if (outcome === "failed") {
269
+ retained.push(entry);
270
+ result.notices.push({ name: entry.name, reason: "reconcile_failed" });
271
+ }
272
+ else if (outcome === "unsafe") {
273
+ result.notices.push({ name: entry.name, reason: "reconcile_failed" });
274
+ }
275
+ else if (outcome === "removed") {
276
+ result.removed.push(entry.dest);
277
+ }
278
+ }
279
+ if (retained.length !== links.length) {
280
+ links = retained;
281
+ if (!(await publish(links))) {
282
+ for (const spec of input.files)
283
+ result.notices.push({ name: spec.name, reason: "state_write_failed" });
284
+ return result;
285
+ }
286
+ }
287
+ // 3. Link each resolvable credential whose exclusion succeeded.
288
+ for (const spec of input.files) {
289
+ if (!excluded.has(spec.dest)) {
290
+ result.notices.push({ name: spec.name, reason: "exclude_failed" });
291
+ continue;
292
+ }
293
+ const recorded = links.some((l) => l.dest === spec.dest && l.source === spec.source);
294
+ let willCreate = false;
295
+ if (!recorded) {
296
+ try {
297
+ await deps.lstat(path.join(worktreeRoot, spec.dest));
298
+ }
299
+ catch (err) {
300
+ willCreate = errnoCode(err) === "ENOENT";
301
+ }
302
+ }
303
+ if (willCreate) {
304
+ const next = [...links.filter((l) => l.dest !== spec.dest), { name: spec.name, dest: spec.dest, source: spec.source }];
305
+ if (!(await publish(next))) {
306
+ result.notices.push({ name: spec.name, reason: "state_write_failed" });
307
+ continue;
308
+ }
309
+ links = next;
310
+ }
311
+ const materialized = await materializeFileCredentialForWorktree({ canonicalSourcePath: spec.source, worktreeRelativeDestPath: spec.dest }, worktreeRoot, deps);
312
+ if (materialized.ok) {
313
+ result.delivered.push({ name: spec.name, dest: spec.dest });
314
+ continue;
315
+ }
316
+ result.notices.push({ name: spec.name, reason: outcomeFor(materialized.reason) });
317
+ if (willCreate) {
318
+ const rolledBack = links.filter((l) => l.dest !== spec.dest);
319
+ if (await publish(rolledBack))
320
+ links = rolledBack;
321
+ }
322
+ }
323
+ return result;
324
+ }
325
+ /** Node-backed deps for the production executor and `start-tickets` callers. */
326
+ export function createNodeWorktreeCredentialDeliveryDeps(runCommand, platform) {
327
+ return {
328
+ platform,
329
+ runCommand,
330
+ readFile: (p) => readFile(p, "utf-8"),
331
+ writeFile: (p, data) => writeFile(p, data, { encoding: "utf-8", mode: 0o600 }),
332
+ mkdir: (p, o) => mkdir(p, o),
333
+ rename: (a, b) => rename(a, b),
334
+ unlink: (p) => unlink(p),
335
+ symlink: (target, linkPath) => symlink(target, linkPath),
336
+ lstat: (p) => lstat(p),
337
+ readlink: (p) => readlink(p),
338
+ realpath: (p) => realpath(p),
339
+ };
340
+ }
@@ -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.74",
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
  },