@bridge_gpt/mcp-server 0.2.65 → 0.2.67

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 (132) hide show
  1. package/README.md +269 -82
  2. package/build/agent-capabilities/probes.js +15 -5
  3. package/build/agent-launchers/claude-executor-adapter.js +55 -34
  4. package/build/agent-launchers/executor-adapter.js +34 -4
  5. package/build/agents.generated.js +1 -1
  6. package/build/bounded-wait.js +67 -10
  7. package/build/bridge-config.js +104 -0
  8. package/build/codex-bridge-profile.js +10 -1
  9. package/build/commands.generated.js +12 -12
  10. package/build/conductor/bridge-api-client.js +372 -10
  11. package/build/conductor/bring-up-facts.js +1 -1
  12. package/build/conductor/doctor.js +3 -3
  13. package/build/conductor/epic-child-continuation.js +61 -34
  14. package/build/conductor/epic-implementer-cli.js +34 -6
  15. package/build/conductor/errors.js +4 -3
  16. package/build/conductor/guided-repair.js +327 -0
  17. package/build/conductor/hook-runtime-qualification.js +1 -1
  18. package/build/conductor/merge-execution-contract.js +27 -8
  19. package/build/conductor/merge-execution-eligibility.js +3 -2
  20. package/build/conductor/pr-ci-producer.js +1 -1
  21. package/build/conductor/readiness-cli.js +46 -9
  22. package/build/conductor/readiness-sections.js +41 -6
  23. package/build/conductor/readiness.js +204 -30
  24. package/build/conductor/recovery-cli.js +703 -20
  25. package/build/conductor/recovery-operations.js +392 -3
  26. package/build/conductor/repair-contract.js +112 -3
  27. package/build/conductor/repository-workflow-remedy.js +125 -0
  28. package/build/conductor/tools.js +2 -2
  29. package/build/conductor-bundle-artifacts.js +8 -0
  30. package/build/credential-store.js +5 -4
  31. package/build/diagnostic-text.js +36 -0
  32. package/build/docs.generated.js +8 -3
  33. package/build/doctor.js +70 -10
  34. package/build/drive-epic-key.js +6 -5
  35. package/build/drive-epic.js +479 -131
  36. package/build/epic-coherence-input.js +2 -1
  37. package/build/epic-implementer-bin.js +30 -26
  38. package/build/epic-implementer-bundle-cli.js +2 -2
  39. package/build/epic-launch-diagnostic.js +31 -0
  40. package/build/epic-launch-profile.js +44 -14
  41. package/build/executor/cli.js +3 -2
  42. package/build/executor/completion-contract.js +48 -5
  43. package/build/executor/completion-supervision.js +9 -0
  44. package/build/executor/correction-dispatch.js +60 -0
  45. package/build/executor/env.js +25 -0
  46. package/build/executor/heartbeat.js +1 -1
  47. package/build/executor/http-client.js +35 -0
  48. package/build/executor/integration-job.js +6 -1
  49. package/build/executor/job-errors.js +38 -4
  50. package/build/executor/job-log-registry.js +340 -73
  51. package/build/executor/job-runner.js +485 -74
  52. package/build/executor/job-types.js +8 -13
  53. package/build/executor/observation.js +6 -1
  54. package/build/executor/preflight.js +136 -10
  55. package/build/executor/prompt-spec.js +113 -9
  56. package/build/executor/required-work-ledger.js +6 -1
  57. package/build/executor/resume-pre-spawn.js +2 -0
  58. package/build/executor/runner.js +31 -2
  59. package/build/executor/service-unit.js +7 -1
  60. package/build/executor/stale-artifacts.js +5 -4
  61. package/build/executor/types.js +1 -0
  62. package/build/executor/watch-cli.js +35 -8
  63. package/build/executor/worker-command.js +43 -43
  64. package/build/executor/worker-finalization.js +161 -43
  65. package/build/executor/worker-guard-hook.js +152 -12
  66. package/build/executor/worker-log.js +137 -70
  67. package/build/executor/worktree-gc.js +30 -6
  68. package/build/executor/worktree.js +82 -1
  69. package/build/index.js +482 -660
  70. package/build/init.js +107 -4
  71. package/build/install-bridge-conductor.js +8 -6
  72. package/build/install-bridge.js +287 -23
  73. package/build/install-doctor.js +172 -30
  74. package/build/install-reexec.js +69 -7
  75. package/build/macos-terminal-permission-guidance.js +16 -0
  76. package/build/model-thresholds-tool.js +185 -0
  77. package/build/phase-context-git-probe.js +68 -0
  78. package/build/phase-result-artifacts.js +173 -5
  79. package/build/pipelines.generated.js +19 -25
  80. package/build/plane/alembic-head.js +12 -3
  81. package/build/plane/base-worktree-guard.js +147 -0
  82. package/build/plane/cli.js +217 -17
  83. package/build/plane/code-snapshot.js +468 -0
  84. package/build/plane/defaults.js +48 -3
  85. package/build/plane/endpoint.js +41 -0
  86. package/build/plane/manifest.js +120 -1
  87. package/build/plane/member-roster.js +94 -19
  88. package/build/plane/preflight.js +30 -2
  89. package/build/plane/process-cwd.js +67 -0
  90. package/build/plane/restart.js +542 -0
  91. package/build/plane/shutdown.js +31 -0
  92. package/build/plane/status.js +145 -6
  93. package/build/plane/supervisor.js +588 -177
  94. package/build/plane/types.js +54 -2
  95. package/build/plane/worker-exit-code.js +2 -0
  96. package/build/printed-remedy-commands.js +37 -0
  97. package/build/project-root.js +99 -0
  98. package/build/readiness-check.js +1 -1
  99. package/build/readme.generated.js +1 -1
  100. package/build/review-generation.js +22 -0
  101. package/build/review-tickets.js +156 -13
  102. package/build/setup-epic.js +224 -127
  103. package/build/sfcc/config.js +9 -0
  104. package/build/sfcc/credentials.js +100 -38
  105. package/build/sfcc/hostname.js +67 -0
  106. package/build/sfcc/permissions.js +17 -13
  107. package/build/sfcc/register.js +1 -1
  108. package/build/sfcc/setup-status.js +2 -0
  109. package/build/sfcc/tool-wrapper.js +41 -43
  110. package/build/sfcc/tools-configured.js +96 -0
  111. package/build/sfcc/write-grants.js +17 -11
  112. package/build/sfcc/write-result.js +4 -3
  113. package/build/sfcc/writes-site-preference.js +20 -8
  114. package/build/start-tickets.js +332 -79
  115. package/build/tool-error-envelope.js +61 -0
  116. package/build/upgrade-cli.js +109 -24
  117. package/build/version.generated.js +3 -3
  118. package/build/visual-diff.js +22 -1
  119. package/build/windows-npm-entry.js +103 -0
  120. package/build/worker-guard-hook-bin.js +3 -5
  121. package/build/worker-guard-hook-main.js +47 -0
  122. package/build/worktree-core.js +136 -9
  123. package/docs/EPIC-IMPLEMENTER-INSTALL.md +849 -0
  124. package/docs/EPIC-IMPLEMENTER.md +662 -0
  125. package/docs/install/mcp-tool-integrations.md +25 -15
  126. package/docs/install/sfcc-integration.md +21 -8
  127. package/package.json +1 -1
  128. package/pipelines/implement-ticket.json +1 -1
  129. package/pipelines/plan-epic.json +0 -5
  130. package/pipelines/review-ticket.json +1 -1
  131. package/docs/CONDUCTOR.md +0 -605
  132. package/pipelines/idea-to-pr.json +0 -49
package/build/doctor.js CHANGED
@@ -24,8 +24,9 @@ import { spawn } from "child_process";
24
24
  import os from "os";
25
25
  import path from "path";
26
26
  import { createDefaultStartTicketsDeps } from "./start-tickets.js";
27
+ import { defaultNpmEntryFileExists, resolveNpmEntry } from "./windows-npm-entry.js";
27
28
  import { VERSION, BUILD_COMMIT } from "./version.generated.js";
28
- import { collectInstallStatusChecks, formatInstallStatusReport, formatInstallStatusFallbackReport, resolveInstallDoctorTarget, } from "./install-doctor.js";
29
+ import { collectInstallStatusChecks, collectProjectIdentityAndRoot, formatInstallStatusReport, formatInstallStatusFallbackReport, formatProjectIdentityAndRootFallbackReport, formatProjectIdentityAndRootReport, resolveInstallDoctorTarget, } from "./install-doctor.js";
29
30
  import { codexHome, inspectBridgeCodexProfile } from "./codex-bridge-profile.js";
30
31
  import { resolveRoutingHost } from "./model-routing-host.js";
31
32
  import { modelRoutingPreferencesPath, readModelRoutingPreference } from "./model-routing-preferences.js";
@@ -35,7 +36,7 @@ import { parseDefaultOnEnvFlag } from "./env-flags.js";
35
36
  import { createBridgeApiUrls } from "./bridge-api-urls.js";
36
37
  import { probeToolSurface } from "./tool-surface-gating.js";
37
38
  import { readStoredBindingState, resolveBapiCredentials } from "./credential-store.js";
38
- import { listEpicLaunchProfiles } from "./epic-launch-profile.js";
39
+ import { EPIC_LAUNCH_PROFILE_NAME_PATTERN, listEpicLaunchProfiles } from "./epic-launch-profile.js";
39
40
  import { CONDUCTOR_DEFAULT_BASE_URL, resolveConductorBridgeApiAccess } from "./conductor/bridge-api-client.js";
40
41
  import { validateHttpBaseUrl } from "./base-url.js";
41
42
  import { getLiveRepositoryConductors, getParseDispatcherHealth, } from "./epic-shared/bridge-client.js";
@@ -88,6 +89,12 @@ export function getDoctorUsage() {
88
89
  "bootstrap-field completeness, integration credentials, and repository-indexing",
89
90
  "state. It performs read-only GETs only and never affects the exit code.",
90
91
  "",
92
+ "Next comes an advisory 'Project identity and root' section (BAPI-1318): whether",
93
+ "each BAPI_PROJECT_ROOT (from the environment and the project MCP configs) names",
94
+ "a real project folder the server will use, and whether .bridge/config's",
95
+ "repo_name matches each project MCP config's BAPI_REPO_NAME. It only reads",
96
+ "files and never affects the exit code.",
97
+ "",
91
98
  "After that come the start-tickets prerequisite checks (for the current OS):",
92
99
  "the start-tickets preflight prerequisites plus",
93
100
  "uv, the selected agent's command, Bridge API credential resolution, and",
@@ -541,10 +548,25 @@ export function parseLauncherPin(args) {
541
548
  * spawn error, or timeout is classified `indeterminate` (never silently "warm").
542
549
  * `--no-install` guarantees the probe never downloads/warms the bucket.
543
550
  */
544
- function probeNpxNoInstallDefault(spec) {
551
+ export function probeNpxNoInstallDefault(spec, options = {}) {
552
+ const doSpawn = options.spawn ?? spawn;
545
553
  return new Promise((resolve) => {
554
+ // WINDOWS (BAPI-1319): a bare `npx` is ENOENT without a shell, so the probe
555
+ // always read "indeterminate". Map it to npm's `npx-cli.js` through Node;
556
+ // `--no-install` is kept, so doctor still can never warm the cache. Other
557
+ // platforms pass through unchanged.
558
+ const resolved = resolveNpmEntry("npx", ["--no-install", spec, "--version"], {
559
+ platform: options.platform ?? process.platform,
560
+ env: options.env ?? process.env,
561
+ execPath: options.execPath ?? process.execPath,
562
+ fileExists: options.fileExists ?? defaultNpmEntryFileExists,
563
+ });
564
+ if (resolved.status !== "resolved") {
565
+ resolve({ warmed: false, indeterminate: true });
566
+ return;
567
+ }
546
568
  try {
547
- const child = spawn("npx", ["--no-install", spec, "--version"], {
569
+ const child = doSpawn(resolved.command, resolved.args, {
548
570
  shell: false,
549
571
  stdio: "ignore",
550
572
  timeout: 30_000,
@@ -1663,11 +1685,17 @@ export function formatOperationalAdvisoryReport(diagnostic) {
1663
1685
  * migrates anything.
1664
1686
  */
1665
1687
  export async function collectEpicLaunchProfileDiagnostic(deps) {
1688
+ const selectedName = deps.env.BAPI_EPIC_LAUNCH_PROFILE?.trim();
1689
+ const selected = selectedName
1690
+ ? EPIC_LAUNCH_PROFILE_NAME_PATTERN.test(selectedName)
1691
+ ? { name: selectedName, status: "missing" }
1692
+ : { name: "<invalid>", status: "invalid" }
1693
+ : undefined;
1666
1694
  const listing = await listEpicLaunchProfiles(deps);
1667
1695
  if (!listing.ok)
1668
- return { store: "unreadable", message: listing.message };
1696
+ return { store: "unreadable", message: listing.message, ...(selected ? { selected } : {}) };
1669
1697
  if (!listing.present)
1670
- return { store: "absent" };
1698
+ return { store: "absent", ...(selected ? { selected: { ...selected, status: selected.status === "invalid" ? "invalid" : "missing" } } : {}) };
1671
1699
  const host = deps.hostname();
1672
1700
  const production = validateHttpBaseUrl(CONDUCTOR_DEFAULT_BASE_URL);
1673
1701
  const productionBaseUrl = production.ok ? production.baseUrl : null;
@@ -1711,7 +1739,12 @@ export async function collectEpicLaunchProfileDiagnostic(deps) {
1711
1739
  credentialBinding,
1712
1740
  });
1713
1741
  }
1714
- return { store: "present", profiles };
1742
+ const selectedProfile = selected?.status !== "invalid" ? profiles.find((p) => p.name === selected?.name) : undefined;
1743
+ return {
1744
+ store: "present",
1745
+ profiles,
1746
+ ...(selected ? { selected: { name: selected.name, status: selected.status === "invalid" ? "invalid" : !selectedProfile ? "missing" : selectedProfile.usable ? "usable" : "unusable" } } : {}),
1747
+ };
1715
1748
  }
1716
1749
  /**
1717
1750
  * BAPI-1272 — a target-selection fact, shown whether or not a profile store
@@ -1725,6 +1758,12 @@ export const EPIC_LAUNCH_DEFAULT_TARGET_LINE = ` [info] drive-epic with no prof
1725
1758
  */
1726
1759
  export function formatEpicLaunchProfileDiagnosticReport(diagnostic) {
1727
1760
  const lines = ["", "Epic launch profiles (read-only)", "", EPIC_LAUNCH_DEFAULT_TARGET_LINE];
1761
+ if (diagnostic.selected) {
1762
+ const { name, status } = diagnostic.selected;
1763
+ lines.push(` [${status === "usable" ? "ok" : "fail"}] BAPI_EPIC_LAUNCH_PROFILE selects ${name}: ${status}.`);
1764
+ if (status !== "usable")
1765
+ lines.push(" Epic launch will refuse this selection; inspect the local profile and credential binding.");
1766
+ }
1728
1767
  if (diagnostic.store === "absent")
1729
1768
  return lines.join("\n");
1730
1769
  if (diagnostic.store === "unreadable") {
@@ -1772,8 +1811,8 @@ export async function runDoctorCli(argv, overrides = {}) {
1772
1811
  const agent = resolveAgentSpec(parsed.options.agentName) ?? resolveAgentSpec(DEFAULT_AGENT_NAME);
1773
1812
  const collection = await collectDoctorResults(deps, parsed.options.agentName);
1774
1813
  // ---- Section order (BAPI-669, U9c) ----
1775
- // Broad header → Install status → start-tickets prerequisites → launcher cache →
1776
- // MCP tool surface. Install status renders FIRST and UNCONDITIONALLY: it answers
1814
+ // Broad header → Install status → Project identity and root (BAPI-1318) →
1815
+ // start-tickets prerequisites → launcher cache → MCP tool surface. Install status renders FIRST and UNCONDITIONALLY: it answers
1777
1816
  // "is this project actually set up?", which is what someone running `doctor` after
1778
1817
  // an install is asking. There is deliberately no "invocation context" flag to gate
1779
1818
  // the ordering on — the report has a single caller and carries no context, so
@@ -1809,6 +1848,27 @@ export async function runDoctorCli(argv, overrides = {}) {
1809
1848
  log(formatInstallStatusFallbackReport());
1810
1849
  }
1811
1850
  }
1851
+ // Advisory "Project identity and root" section (BAPI-1318). Read-only: it
1852
+ // validates each explicit BAPI_PROJECT_ROOT the way the server does and
1853
+ // compares .bridge/config's repo_name with each project MCP config. Placed
1854
+ // right after Install status without reordering any existing section; a throw
1855
+ // renders a sanitized line, and the exit code is never affected.
1856
+ if (overrides.projectIdentity !== false) {
1857
+ try {
1858
+ const injectedFs = deps;
1859
+ const identityDeps = {
1860
+ env: overrides.projectIdentity?.env ?? deps.env,
1861
+ cwd: overrides.projectIdentity?.cwd ?? deps.cwd,
1862
+ readFile: overrides.projectIdentity?.readFile ?? injectedFs.readFile ?? ((p) => readFile(p, "utf-8")),
1863
+ statDir: overrides.projectIdentity?.statDir ?? ((p) => stat(p)),
1864
+ };
1865
+ const collect = overrides.projectIdentity?.collect ?? collectProjectIdentityAndRoot;
1866
+ log(formatProjectIdentityAndRootReport(await collect(identityDeps)));
1867
+ }
1868
+ catch {
1869
+ log(formatProjectIdentityAndRootFallbackReport());
1870
+ }
1871
+ }
1812
1872
  if (parsed.options.agentName === "codex") {
1813
1873
  const readCodexFile = deps.readFile ?? ((p) => readFile(p, "utf-8"));
1814
1874
  const profile = await inspectBridgeCodexProfile(codexHome(deps.env), readCodexFile);
@@ -1883,7 +1943,7 @@ export async function runDoctorCli(argv, overrides = {}) {
1883
1943
  const launcherDeps = {
1884
1944
  cwd: overrides.launcherProbe?.cwd ?? deps.cwd,
1885
1945
  readFile: overrides.launcherProbe?.readFile ?? ((p) => readFile(p, "utf-8")),
1886
- probeNpxNoInstall: overrides.launcherProbe?.probeNpxNoInstall ?? probeNpxNoInstallDefault,
1946
+ probeNpxNoInstall: overrides.launcherProbe?.probeNpxNoInstall ?? ((spec) => probeNpxNoInstallDefault(spec)),
1887
1947
  };
1888
1948
  const launcherInspections = await inspectLauncherCache(launcherDeps);
1889
1949
  log(formatLauncherCacheReport(launcherInspections));
@@ -4,9 +4,10 @@
4
4
  * It lives in its own module so `plan-discovery.ts` can import it without
5
5
  * importing `drive-epic.ts`, which imports discovery — a cycle.
6
6
  *
7
- * This is deliberately the narrower CLI grammar. Bundle finalization accepts some
8
- * underscore or digit project prefixes, but `drive-epic` already rejects them, so
9
- * metadata naming such a key can never be discovered through this CLI.
7
+ * BAPI-1348: this is the canonical ticket-key grammar from `ticket-key-utils.ts`,
8
+ * so a local-mode epic whose prefix carries digits or underscores (for example
9
+ * `STOREFRONT2-1` or `STOREFRONT_CLIENTA-1`) is accepted.
10
10
  */
11
- /** Jira epic key shape. Matches the epic-key positional rule exactly. */
12
- export const EPIC_KEY_PATTERN = /^[A-Z]+-[0-9]+$/;
11
+ import { TICKET_KEY_PATTERN } from "./ticket-key-utils.js";
12
+ /** Epic key shape. The canonical ticket-key pattern, shared with every other reader. */
13
+ export const EPIC_KEY_PATTERN = TICKET_KEY_PATTERN;