@bridge_gpt/mcp-server 0.2.71 → 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 (198) hide show
  1. package/README.md +55 -17
  2. package/build/agent-launchers/claude-executor-adapter.js +22 -3
  3. package/build/agent-notes.js +171 -95
  4. package/build/agents.generated.js +7 -7
  5. package/build/bridge-permissions.js +31 -0
  6. package/build/bridge-worktree-inspection.js +237 -0
  7. package/build/check-evidence.js +6 -0
  8. package/build/ci-system-detection.js +50 -0
  9. package/build/ci-trigger-adapters.js +631 -0
  10. package/build/ci-trigger-install.js +106 -0
  11. package/build/claude-review-workflow.js +1 -1
  12. package/build/cli-help.js +6 -0
  13. package/build/codex-auto-recovery.js +126 -0
  14. package/build/codex-launcher-pin.js +33 -2
  15. package/build/codex-skill-adapter.js +5 -1
  16. package/build/command-host.js +33 -0
  17. package/build/commands.generated.js +7 -6
  18. package/build/conductor/bridge-api-client.js +1352 -50
  19. package/build/conductor/bring-up-facts.js +18 -5
  20. package/build/conductor/command-drift-production.js +42 -17
  21. package/build/conductor/command-drift.js +47 -0
  22. package/build/conductor/declare-blocked.js +554 -0
  23. package/build/conductor/doctor.js +187 -28
  24. package/build/conductor/driver-commands.js +141 -0
  25. package/build/conductor/driver-guard.js +277 -0
  26. package/build/conductor/driver-lapse.js +321 -0
  27. package/build/conductor/driver-register.js +176 -0
  28. package/build/conductor/driver-release.js +174 -0
  29. package/build/conductor/driver-session-state.js +315 -0
  30. package/build/conductor/epic-branch-ci-inspection.js +222 -29
  31. package/build/conductor/epic-implementer-cli.js +213 -13
  32. package/build/conductor/epic-server-database.js +162 -0
  33. package/build/conductor/epic-server-guidance.js +278 -0
  34. package/build/conductor/epic-server-journal.js +239 -0
  35. package/build/conductor/epic-server-processes.js +324 -0
  36. package/build/conductor/epic-server-recipe.js +397 -0
  37. package/build/conductor/epic-server-runtime.js +1207 -0
  38. package/build/conductor/epic-server-sfcc.js +107 -0
  39. package/build/conductor/epic-server-state.js +427 -0
  40. package/build/conductor/epic-server.js +594 -0
  41. package/build/conductor/gate-discovery.js +281 -10
  42. package/build/conductor/gate-settings-review.js +525 -5
  43. package/build/conductor/git-hooks-uninstall.js +112 -0
  44. package/build/conductor/git-hooks.js +81 -15
  45. package/build/conductor/guided-repair.js +10 -1
  46. package/build/conductor/install-doctor.js +2 -4
  47. package/build/conductor/launch-need-probes.js +6 -53
  48. package/build/conductor/launch-plan.js +318 -121
  49. package/build/conductor/local-merge.js +12 -1
  50. package/build/conductor/merge-execution-contract.js +1 -1
  51. package/build/conductor/merged-child-check.js +2 -1
  52. package/build/conductor/prerequisite-inputs.js +1213 -0
  53. package/build/conductor/readiness-assessment.js +93 -0
  54. package/build/conductor/readiness-cli.js +30 -9
  55. package/build/conductor/readiness-prerequisites.js +77 -5
  56. package/build/conductor/readiness-sections.js +146 -126
  57. package/build/conductor/readiness.js +21 -3
  58. package/build/conductor/recovery-cli.js +236 -15
  59. package/build/conductor/recovery-operations.js +34 -4
  60. package/build/conductor/repair-contract.js +33 -0
  61. package/build/conductor/tools.js +36 -4
  62. package/build/conductor/wait-run-attention.js +115 -0
  63. package/build/conductor/wait-run-cli.js +300 -21
  64. package/build/conductor/worker-database-doctor-inspector.js +34 -2
  65. package/build/conductor/worker-setup-tally.js +27 -0
  66. package/build/credential-store.js +96 -21
  67. package/build/dependency-install-declarations.js +212 -0
  68. package/build/docs.generated.js +4 -4
  69. package/build/doctor.js +91 -8
  70. package/build/drive-epic-help.js +23 -4
  71. package/build/drive-epic.js +1841 -340
  72. package/build/engine-paths.js +20 -0
  73. package/build/epic-branch-ci-summary.js +140 -0
  74. package/build/epic-capability-statement.js +107 -0
  75. package/build/epic-ci-workflow-drift.js +30 -15
  76. package/build/epic-ci-workflow-install.js +110 -42
  77. package/build/epic-ci-workflow-v2.js +274 -0
  78. package/build/epic-ci-workflow.js +38 -12
  79. package/build/epic-implementer-bin.js +2184 -52
  80. package/build/epic-launch-context.js +607 -0
  81. package/build/epic-launch-profile.js +1 -1
  82. package/build/epic-server-record.js +273 -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/cli.js +2 -0
  87. package/build/executor/completion-contract.js +24 -1
  88. package/build/executor/credentials.js +1 -1
  89. package/build/executor/delivery-observations.js +113 -0
  90. package/build/executor/delivery-outcome.js +30 -0
  91. package/build/executor/dependency-refresh-runner.js +132 -0
  92. package/build/executor/dependency-refresh.js +530 -0
  93. package/build/executor/deps.js +4 -0
  94. package/build/executor/env.js +119 -17
  95. package/build/executor/epic-server-context.js +141 -0
  96. package/build/executor/gate-qualification-job.js +127 -26
  97. package/build/executor/harness-coverage.js +19 -0
  98. package/build/executor/http-client.js +87 -6
  99. package/build/executor/index.js +2 -1
  100. package/build/executor/install-preflight.js +1 -1
  101. package/build/executor/job-runner.js +659 -87
  102. package/build/executor/likely-tests.js +94 -97
  103. package/build/executor/observation.js +8 -0
  104. package/build/executor/pre-pr-checks.js +363 -0
  105. package/build/executor/prompt-spec.js +127 -5
  106. package/build/executor/reconcile-overlap-job.js +5 -3
  107. package/build/executor/required-verification.js +28 -0
  108. package/build/executor/required-work-diagnostics.js +32 -0
  109. package/build/executor/required-work-ledger.js +955 -39
  110. package/build/executor/results.js +100 -0
  111. package/build/executor/service-discovery.js +42 -0
  112. package/build/executor/service-lifecycle.js +109 -2
  113. package/build/executor/service-uninstall.js +205 -0
  114. package/build/executor/service-unit.js +5 -3
  115. package/build/executor/terminal-mutation.js +8 -0
  116. package/build/executor/test-clock.js +3 -0
  117. package/build/executor/verification-hints.js +179 -0
  118. package/build/executor/worker-command.js +126 -5
  119. package/build/executor/worker-database-config.js +281 -0
  120. package/build/executor/worker-database-target.js +16 -12
  121. package/build/executor/worker-database.js +575 -116
  122. package/build/executor/worker-finalization.js +71 -10
  123. package/build/executor/worker-guard-hook.js +10 -2
  124. package/build/executor/worker-resources.js +25 -3
  125. package/build/executor/worker-verification-guidance.js +55 -5
  126. package/build/executor/worktree-inspection.js +42 -0
  127. package/build/executor/worktree.js +20 -1
  128. package/build/executor-launch.js +54 -2
  129. package/build/generated-assets-catalog.js +2 -2
  130. package/build/github-sign-in.js +1 -1
  131. package/build/index.js +1111 -381
  132. package/build/init.js +29 -14
  133. package/build/install-bridge-conductor-answers.js +465 -0
  134. package/build/install-bridge-conductor-apply.js +259 -0
  135. package/build/install-bridge-conductor-assessment.js +895 -0
  136. package/build/install-bridge-conductor-compact.js +161 -0
  137. package/build/install-bridge-conductor-contracts.js +63 -0
  138. package/build/install-bridge-conductor-gate.js +1383 -188
  139. package/build/install-bridge-conductor-setup.js +637 -92
  140. package/build/install-bridge-conductor.js +3163 -740
  141. package/build/install-bridge.js +601 -128
  142. package/build/install-maintenance.js +127 -0
  143. package/build/install-reexec.js +1 -1
  144. package/build/launcher-config-inspection.js +162 -1
  145. package/build/local-cleanup.js +59 -0
  146. package/build/mcp-grant-candidates.js +767 -0
  147. package/build/mcp-grant-doctor.js +63 -0
  148. package/build/mcp-grant.js +288 -0
  149. package/build/mcp-host-targets.js +8 -0
  150. package/build/mcp-identity.js +23 -0
  151. package/build/mcp-install-state.js +68 -2
  152. package/build/mcp-invoke.js +126 -13
  153. package/build/mcp-presets.js +107 -0
  154. package/build/mcp-provisioning.js +134 -2
  155. package/build/mcp-registration-doctor.js +31 -2
  156. package/build/mcp-server-invocation.js +6 -1
  157. package/build/merge-workflow-install.js +236 -111
  158. package/build/package-script-semantics.js +10 -0
  159. package/build/pipeline-utils.js +1 -1
  160. package/build/pipelines.generated.js +6 -6
  161. package/build/plan-discovery.js +97 -4
  162. package/build/plan-execution-ledger.js +248 -9
  163. package/build/plan-generation-io.js +262 -0
  164. package/build/plan-generation.js +424 -0
  165. package/build/plane/build-freshness.js +6 -1
  166. package/build/plane/cli.js +75 -9
  167. package/build/plane/plane-freshness.js +23 -7
  168. package/build/plane/preflight.js +50 -10
  169. package/build/plane/shutdown.js +19 -0
  170. package/build/plane/terminal-run-cleanup.js +23 -5
  171. package/build/plane/terminal-run-status.js +4 -0
  172. package/build/printed-remedy-commands.js +229 -15
  173. package/build/readiness-check.js +1 -1
  174. package/build/readiness-prerequisites.generated.js +311 -4
  175. package/build/readme.generated.js +1 -1
  176. package/build/repository-state-paths.js +38 -0
  177. package/build/repository-toolchains.js +50 -8
  178. package/build/run-unit-tests-launcher.js +8 -1
  179. package/build/setup-change-policy.js +32 -0
  180. package/build/setup-epic.js +1192 -198
  181. package/build/setup-progress.js +44 -0
  182. package/build/setup-question.js +180 -0
  183. package/build/start-tickets.js +4 -0
  184. package/build/test-command-detection.js +32 -88
  185. package/build/test-support/notes-fs.js +40 -0
  186. package/build/third-party-mcp-targets.js +30 -0
  187. package/build/ticket-delivery-enrollment.js +30 -8
  188. package/build/ticket-delivery-run-scope.js +128 -0
  189. package/build/upgrade-cli.js +85 -2
  190. package/build/v2-readiness-requirements.js +28 -1
  191. package/build/version.generated.js +3 -3
  192. package/build/worker-guard-hook-bin.js +2 -2
  193. package/build/worktrees.js +105 -0
  194. package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
  195. package/docs/EPIC-IMPLEMENTER.md +5 -0
  196. package/docs/epic-implementer/getting-started.md +42 -15
  197. package/docs/epic-implementer/self-hosting.md +14 -1
  198. package/package.json +2 -2
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Per-repository state records kept OUTSIDE every worktree (BAPI-1545).
3
+ *
4
+ * Two record families live here, one file per repository:
5
+ *
6
+ * - `mcp-grants/<repo>.json` — the owner-approved MCP grant (`mcp-grant.ts`).
7
+ * - `epic-server/<repo>.json` — the epic-server record child 3 writes
8
+ * (`epic-server-record.ts` owns the contract).
9
+ *
10
+ * Both sit beside the user credential store, under `~/.config/bridge` (or
11
+ * `$XDG_CONFIG_HOME/bridge` when that is set, exactly as the credential store
12
+ * resolves it). A worker's worktree never contains them, so nothing a worker
13
+ * commits or edits inside its checkout can change them.
14
+ *
15
+ * The repository name comes from a trusted caller (the executor's claim
16
+ * response, or the install run's resolved access). It is validated with
17
+ * `validateRepoName()` and used directly as the file name. It is never derived
18
+ * from a checkout.
19
+ */
20
+ import path from "path";
21
+ import { validateRepoName } from "./bridge-config.js";
22
+ import { getPrimaryCredentialStorePath } from "./credential-store.js";
23
+ /** The Bridge user config directory (the credential store's own directory). */
24
+ export function bridgeUserConfigDir(deps) {
25
+ return path.dirname(getPrimaryCredentialStorePath(deps));
26
+ }
27
+ /**
28
+ * Resolve `<bridge config dir>/<kind>/<repo>.json`. An invalid repository name
29
+ * is a structured failure with a fixed message; the name is never echoed.
30
+ */
31
+ export function repositoryStateRecordPath(kind, repoName, deps) {
32
+ const validated = validateRepoName(repoName);
33
+ if (!validated.ok || validated.value === "." || validated.value === "..") {
34
+ return { ok: false, error: "the repository name is not usable as a record name" };
35
+ }
36
+ const dir = path.join(bridgeUserConfigDir(deps), kind);
37
+ return { ok: true, dir, path: path.join(dir, `${validated.value}.json`), repoName: validated.value };
38
+ }
@@ -509,36 +509,78 @@ function describeManagerVersion(name, version, fallback) {
509
509
  ? `${name} ${version.version} (from package.json)`
510
510
  : `${name} ${fallback} (fixed fallback)`;
511
511
  }
512
+ /**
513
+ * BAPI-1551 — the ONE fixed install argv per toolchain. The plain-language text
514
+ * below is built from it, so the text a person reads and the argv a dependency
515
+ * refresh declaration proposes can never drift apart.
516
+ */
517
+ export function installArgvForJavaScript(js) {
518
+ switch (js.manager) {
519
+ case "npm":
520
+ return ["npm", "ci"];
521
+ case "pnpm":
522
+ return ["pnpm", "install", "--frozen-lockfile"];
523
+ case "yarn":
524
+ return js.generation === "classic"
525
+ ? ["yarn", "install", "--frozen-lockfile"]
526
+ : ["yarn", "install", "--immutable"];
527
+ case "bun":
528
+ return ["bun", "install", "--frozen-lockfile"];
529
+ }
530
+ }
531
+ /**
532
+ * BAPI-1551 — the fixed install argv for a Python toolchain. pip's argv is kept
533
+ * for the description only: a bare `pip install` targets whatever interpreter is
534
+ * first on `PATH`, so a dependency refresh never proposes it.
535
+ */
536
+ export function installArgvForPython(py) {
537
+ switch (py.manager) {
538
+ case "uv":
539
+ return ["uv", "sync", "--frozen"];
540
+ case "poetry":
541
+ return ["poetry", "install"];
542
+ case "pip":
543
+ return ["pip", "install", "-r", "requirements.txt"];
544
+ }
545
+ }
546
+ /**
547
+ * BAPI-1551 — the files whose CONTENT the resolver reads. Every other file it
548
+ * consults is checked for existence only, so a reader that cannot return a
549
+ * large lockfile's bytes may still report that it exists.
550
+ */
551
+ export const TOOLCHAIN_CONTENT_FILES = Object.freeze(["package.json", "yarn.lock"]);
512
552
  /** One plain line for the JavaScript selection. Never carries repository text beyond a validated version. */
513
553
  export function describeJavaScriptToolchain(js) {
554
+ const installs = `installs with ${installArgvForJavaScript(js).join(" ")}`;
514
555
  switch (js.manager) {
515
556
  case "npm":
516
- return `JavaScript: npm (${js.dependencyFile}); ${describeNode(js.node)}; installs with npm ci`;
557
+ return `JavaScript: npm (${js.dependencyFile}); ${describeNode(js.node)}; ${installs}`;
517
558
  case "pnpm":
518
559
  return (`JavaScript: pnpm (${js.dependencyFile}); ${describeManagerVersion("pnpm", js.pnpm, PNPM_FALLBACK_MAJOR)}; ` +
519
- `${describeNode(js.node)}; installs with pnpm install --frozen-lockfile`);
560
+ `${describeNode(js.node)}; ${installs}`);
520
561
  case "yarn":
521
562
  return js.generation === "classic"
522
- ? `JavaScript: Yarn classic (${js.dependencyFile}); ${describeNode(js.node)}; installs with yarn install --frozen-lockfile`
563
+ ? `JavaScript: Yarn classic (${js.dependencyFile}); ${describeNode(js.node)}; ${installs}`
523
564
  : `JavaScript: Yarn Berry (${js.dependencyFile}); ` +
524
565
  (js.yarn === "package_manager"
525
566
  ? "Yarn version from package.json through Corepack"
526
567
  : `Yarn ${YARN_BERRY_FALLBACK_MAJOR} (fixed fallback) through Corepack`) +
527
- `; ${describeNode(js.node)}; installs with yarn install --immutable`;
568
+ `; ${describeNode(js.node)}; ${installs}`;
528
569
  case "bun":
529
- return `JavaScript: Bun (${js.dependencyFile}); Bun ${BUN_VERSION_RANGE}; installs with bun install --frozen-lockfile`;
570
+ return `JavaScript: Bun (${js.dependencyFile}); Bun ${BUN_VERSION_RANGE}; ${installs}`;
530
571
  }
531
572
  }
532
573
  /** One plain line for the Python selection. */
533
574
  export function describePythonToolchain(py) {
575
+ const installs = `installs with ${installArgvForPython(py).join(" ")}`;
534
576
  switch (py.manager) {
535
577
  case "uv":
536
- return `Python: uv (${py.dependencyFile}); ${describePython(py.python)}; installs with uv sync --frozen`;
578
+ return `Python: uv (${py.dependencyFile}); ${describePython(py.python)}; ${installs}`;
537
579
  case "poetry":
538
580
  return (`Python: Poetry (${py.dependencyFile}); Poetry ${POETRY_VERSION}; ${describePython(py.python)}; ` +
539
- "installs with poetry install");
581
+ installs);
540
582
  case "pip":
541
- return `Python: pip (${py.dependencyFile}); ${describePython(py.python)}; installs with pip install -r requirements.txt`;
583
+ return `Python: pip (${py.dependencyFile}); ${describePython(py.python)}; ${installs}`;
542
584
  }
543
585
  }
544
586
  /** The selected ecosystems as plain lines, in JavaScript, Python, Go order. */
@@ -483,13 +483,20 @@ function runWithReports(group, options, ordinary, quarantined, nodeOptions, log)
483
483
  writeFileSync(temporary, JSON.stringify(inventory, null, 2));
484
484
  renameSync(temporary, path.join(outputDirectory, "inventory.json"));
485
485
  };
486
+ // Unit children never run the startup npm update check. Importing index.js
487
+ // otherwise fetches the registry whenever the shared ~/.config cache is
488
+ // missing or stale, and that call lands in the tests' fetch stubs. The
489
+ // integration harness sets the same flag for its own children.
490
+ const childEnv = group === "integration"
491
+ ? process.env
492
+ : { ...process.env, BAPI_MCP_UPDATE_CHECK_ENABLED: "false" };
486
493
  publish(); // Complete expected inventory is durable before the first spawn.
487
494
  log(`run-unit-tests: group="${group}" files=${ordinary.length + quarantined.length} batches=${plans.length}`);
488
495
  for (const [index, plan] of plans.entries()) {
489
496
  plan.state = "started";
490
497
  publish();
491
498
  try {
492
- const result = spawnFn(execPath, args(plan.files, index, plan.forceExit), { cwd: root, stdio: "inherit", shell: false });
499
+ const result = spawnFn(execPath, args(plan.files, index, plan.forceExit), { cwd: root, stdio: "inherit", shell: false, env: childEnv });
493
500
  plan.status = result.status;
494
501
  plan.state = result.status === null || !existsSync(path.join(outputDirectory, plan.report)) ? "failed" : "completed";
495
502
  }
@@ -0,0 +1,32 @@
1
+ export function classifySetupAction(action) {
2
+ if (action.state.status === "unknown" || !action.trusted)
3
+ return "missing-information";
4
+ if (action.unchanged)
5
+ return "no-op";
6
+ if (action.category === "bookkeeping")
7
+ return "routine";
8
+ if (action.category === "test-command" && action.state.status === "absent" && action.eligibleCommand)
9
+ return "routine";
10
+ return "consequential";
11
+ }
12
+ export function authorizeSetupAction(action, authorization, now = Date.now()) {
13
+ const classification = classifySetupAction(action);
14
+ if (classification === "missing-information")
15
+ return false;
16
+ if (classification === "no-op" || classification === "routine")
17
+ return true;
18
+ return !!authorization && authorization.expiresAt > now
19
+ && authorization.effect === action.effect && authorization.context === action.context
20
+ && authorization.repository === action.repository && authorization.principal === action.principal;
21
+ }
22
+ export function classifyServerSetupEffects(effects, approvalRequired) {
23
+ if (!Array.isArray(effects) || typeof approvalRequired !== "boolean")
24
+ return "invalid";
25
+ const categories = new Set(["gate", "setup", "config", "sources", "qualification"]);
26
+ if (effects.some(e => !e || typeof e !== "object" || e.classification !== "consequential"
27
+ || !categories.has(e.category) || !("before" in e) || !("after" in e)))
28
+ return "invalid";
29
+ if (approvalRequired !== (effects.length > 0))
30
+ return "invalid";
31
+ return effects.length ? "consequential" : "no-op";
32
+ }