@bridge_gpt/mcp-server 0.2.67 → 0.2.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +178 -15
  2. package/build/agent-launchers/claude-executor-adapter.js +27 -0
  3. package/build/agents.generated.js +22 -2
  4. package/build/bitbucket-workspace-remote.js +136 -0
  5. package/build/bootstrap-project-identity.js +24 -0
  6. package/build/bridge-permissions.js +829 -0
  7. package/build/claude-settings.js +18 -0
  8. package/build/cli-help.js +21 -0
  9. package/build/command-assets-doctor.js +24 -70
  10. package/build/command-provisioning.js +29 -5
  11. package/build/commands.generated.js +8 -8
  12. package/build/conductor/bridge-api-client.js +714 -0
  13. package/build/conductor/command-drift-production.js +92 -0
  14. package/build/conductor/command-drift.js +89 -0
  15. package/build/conductor/doctor.js +69 -26
  16. package/build/conductor/epic-branch-ci-inspection.js +1375 -0
  17. package/build/conductor/epic-implementer-cli.js +76 -22
  18. package/build/conductor/gate-discovery.js +890 -0
  19. package/build/conductor/install-doctor.js +15 -3
  20. package/build/conductor/json-output.js +63 -0
  21. package/build/conductor/readiness-cli.js +95 -10
  22. package/build/conductor/readiness-sections.js +369 -3
  23. package/build/conductor/readiness.js +211 -8
  24. package/build/conductor/recovery-cli.js +110 -4
  25. package/build/conductor/recovery-operations.js +99 -1
  26. package/build/connect-bitbucket-api.js +41 -6
  27. package/build/connect-bitbucket.js +106 -33
  28. package/build/credential-store.js +207 -47
  29. package/build/docs.generated.js +57 -3
  30. package/build/doctor.js +92 -1
  31. package/build/drive-epic.js +45 -8
  32. package/build/epic-coherence-input.test-fixtures.js +4 -3
  33. package/build/epic-implementer-bin.js +1374 -25
  34. package/build/epic-workarounds-path.js +39 -0
  35. package/build/executor/cli.js +30 -0
  36. package/build/executor/completion-contract.js +18 -5
  37. package/build/executor/deps.js +4 -1
  38. package/build/executor/gate-qualification-job.js +499 -0
  39. package/build/executor/guarded-fast-forward-push.js +129 -0
  40. package/build/executor/integration-job.js +122 -8
  41. package/build/executor/job-errors.js +8 -1
  42. package/build/executor/job-runner.js +589 -47
  43. package/build/executor/likely-tests.js +290 -0
  44. package/build/executor/live-worker-registry.js +1 -1
  45. package/build/executor/observation.js +31 -2
  46. package/build/executor/packaged-recipe.js +106 -0
  47. package/build/executor/permissions.js +115 -28
  48. package/build/executor/platform.js +1 -1
  49. package/build/executor/preflight.js +61 -12
  50. package/build/executor/process-containment.js +36 -12
  51. package/build/executor/process.js +15 -7
  52. package/build/executor/prompt-spec.js +33 -1
  53. package/build/executor/recently-failed-tests-file.js +71 -0
  54. package/build/executor/reconcile-overlap-job.js +41 -23
  55. package/build/executor/required-verification.js +1 -1
  56. package/build/executor/required-work-ledger.js +105 -17
  57. package/build/executor/retirement.js +69 -0
  58. package/build/executor/runner.js +114 -11
  59. package/build/executor/test-clock.js +15 -0
  60. package/build/executor/types.js +32 -0
  61. package/build/executor/viewer-tabs.js +58 -8
  62. package/build/executor/worker-command.js +23 -7
  63. package/build/executor/worker-diagnostics.js +37 -0
  64. package/build/executor/worker-finalization.js +31 -5
  65. package/build/executor/worker-guard-hook.js +179 -25
  66. package/build/executor/worker-log.js +4 -3
  67. package/build/executor/worker-verification-guidance.js +37 -0
  68. package/build/executor/worktree.js +88 -11
  69. package/build/first-build-advisory.js +97 -0
  70. package/build/generated-assets-advisory.js +14 -0
  71. package/build/generated-assets-catalog.js +66 -0
  72. package/build/generated-assets-context.js +46 -0
  73. package/build/generated-assets-dependencies.js +26 -0
  74. package/build/generated-assets-doctor.js +50 -0
  75. package/build/generated-assets-health.js +65 -0
  76. package/build/generated-assets-host.js +17 -0
  77. package/build/generated-assets-inventory.js +17 -0
  78. package/build/generated-assets-paths.js +60 -0
  79. package/build/generated-assets-publisher.js +133 -0
  80. package/build/generated-assets-remedy.js +25 -0
  81. package/build/generated-assets-repair.js +72 -0
  82. package/build/generated-assets-session.js +71 -0
  83. package/build/generated-assets-test-support.js +35 -0
  84. package/build/index.js +964 -768
  85. package/build/init.js +54 -177
  86. package/build/install-bridge-conductor-gate.js +1372 -0
  87. package/build/install-bridge-conductor.js +289 -36
  88. package/build/install-bridge.js +544 -37
  89. package/build/mcp-install-state.js +50 -4
  90. package/build/merge-workflow-install.js +3 -4
  91. package/build/pipeline-utils.js +6 -2
  92. package/build/pipelines.generated.js +22 -142
  93. package/build/plan-execution-ledger.js +2 -32
  94. package/build/plane/manifest.js +16 -1
  95. package/build/plane/preflight.js +54 -1
  96. package/build/printed-remedy-commands.js +16 -1
  97. package/build/readme.generated.js +1 -1
  98. package/build/repair-assets.js +93 -0
  99. package/build/run-unit-tests-launcher.js +130 -49
  100. package/build/secret-redaction.js +33 -0
  101. package/build/setup-epic.js +108 -3
  102. package/build/start-tickets-prereqs.js +70 -16
  103. package/build/start-tickets.js +29 -5
  104. package/build/tool-surface-gating.js +36 -0
  105. package/build/upgrade-cli.js +55 -1
  106. package/build/version.generated.js +3 -3
  107. package/build/worker-guard-hook-bin.js +3 -2
  108. package/build/worker-guard-hook-main.js +1 -1
  109. package/build/worktree-core.js +15 -2
  110. package/docs/EPIC-IMPLEMENTER-INSTALL.md +30 -12
  111. package/docs/EPIC-IMPLEMENTER.md +68 -2
  112. package/package.json +3 -3
  113. package/pipelines/greenfield-setup.json +4 -128
  114. package/pipelines/implement-ticket.json +3 -2
@@ -472,38 +472,8 @@ export function validateExecutionLimits(observed, limits = PRE_PR_VERIFICATION_L
472
472
  // ---------------------------------------------------------------------------
473
473
  // Secret safety
474
474
  // ---------------------------------------------------------------------------
475
- const REDACTED = "[REDACTED]";
476
- /**
477
- * Patterns for values that must never reach durable state or a log line.
478
- *
479
- * Each rewrites only the secret itself and keeps the surrounding key or scheme, so a
480
- * redacted record still shows *that* a credential was involved — useful for audit,
481
- * and materially different from dropping the field.
482
- */
483
- const SECRET_PATTERNS = [
484
- // Bearer / token schemes in an Authorization header or bare.
485
- [/\b(Bearer|Basic|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi, `$1 ${REDACTED}`],
486
- // authorization: <anything>
487
- [/\b(authorization)\s*[:=]\s*\S+/gi, `$1: ${REDACTED}`],
488
- // Well-known provider key shapes.
489
- [/\b(sk|pk|rk)-[A-Za-z0-9_-]{16,}/g, REDACTED],
490
- [/\bgh[pousr]_[A-Za-z0-9]{16,}/g, REDACTED],
491
- // key/secret/password/token assignments in prose, env, JSON, or CLI form.
492
- [
493
- /\b([A-Za-z0-9_-]*(?:api[_-]?key|secret|password|passwd|token|credential)[A-Za-z0-9_-]*)\s*[:=]\s*("[^"]*"|'[^']*'|\S+)/gi,
494
- `$1=${REDACTED}`,
495
- ],
496
- // Credentials embedded in a URL.
497
- [/\b([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi, `$1${REDACTED}@`],
498
- ];
499
- /** Redact secret-bearing substrings while leaving safe technical text intact. */
500
- export function redactSecrets(value) {
501
- let output = value;
502
- for (const [pattern, replacement] of SECRET_PATTERNS) {
503
- output = output.replace(pattern, replacement);
504
- }
505
- return output;
506
- }
475
+ export { redactSecrets } from "./secret-redaction.js";
476
+ import { redactSecrets } from "./secret-redaction.js";
507
477
  function redactDeep(value) {
508
478
  if (typeof value === "string")
509
479
  return redactSecrets(value);
@@ -536,7 +536,22 @@ export async function writePlaneManifest(manifest, fs) {
536
536
  // atomic replacement rather than a copy across a mount boundary.
537
537
  const tempPath = `${manifestPath}.${manifest.planeId}.${process.pid}.${manifestWriteCounter}.tmp`;
538
538
  await fs.writeFile(tempPath, formatPlaneManifest(manifest));
539
- await fs.rename(tempPath, manifestPath);
539
+ // Windows can briefly refuse replacement while another writer or reader
540
+ // holds the destination. Retry the atomic rename; never remove the published
541
+ // manifest or rewrite this writer's private snapshot.
542
+ for (let attempt = 0;; attempt += 1) {
543
+ try {
544
+ await fs.rename(tempPath, manifestPath);
545
+ return;
546
+ }
547
+ catch (error) {
548
+ const code = error.code;
549
+ if (process.platform !== "win32" || !["EPERM", "EACCES"].includes(code ?? "") || attempt >= 4) {
550
+ throw error;
551
+ }
552
+ await new Promise((resolve) => setTimeout(resolve, 25 * (attempt + 1)));
553
+ }
554
+ }
540
555
  }
541
556
  /**
542
557
  * Remove the manifest, but only when it still belongs to `planeId`.
@@ -915,6 +915,35 @@ const PLANE_NOT_APPLICABLE_DETAIL = {
915
915
  remote: "not applicable: the target is a remote Bridge API, not a local plane",
916
916
  unresolvable: "not applicable: endpoint could not be resolved from target URL",
917
917
  };
918
+ /** BAPI-1397 (F4) — the reason id carried by an own-plane pass row. */
919
+ export const PLANE_OWN_PLANE_REASON_ID = "own_plane";
920
+ /**
921
+ * Fixed own-plane details. Each starts with the stable token `own_plane: ` because
922
+ * the shared readiness row has no reason field; neither names a port, pid, path,
923
+ * or run id.
924
+ */
925
+ const PLANE_OWN_PLANE_DETAIL = {
926
+ "server-port": `${PLANE_OWN_PLANE_REASON_ID}: the port is served by this repository's plane, which is ` +
927
+ "bound to the run being attached",
928
+ "existing-plane": `${PLANE_OWN_PLANE_REASON_ID}: this repository's live plane is bound to the run being attached`,
929
+ };
930
+ /**
931
+ * Is the live plane this preflight observed the selected run's OWN plane?
932
+ * (BAPI-1397, F4). Pure, and READINESS-ONLY.
933
+ *
934
+ * True only when the existing-plane check's own classification — the same
935
+ * exact-root, live-member reading `classifyLivePlaneForAttach` makes from the ONE
936
+ * manifest read — is `attachable` and the manifest's `epicRunId` equals the
937
+ * selected run id. Nothing here feeds `ok` or a diagnostic, so `plane up` still
938
+ * refuses a live plane exactly as before; only `readiness --epic-run-id` supplies
939
+ * a run id.
940
+ */
941
+ export function planeIsOwnPlaneForRun(result, epicRunId) {
942
+ if (epicRunId === undefined || epicRunId.trim() === "")
943
+ return false;
944
+ const existing = result?.observations?.existingPlane;
945
+ return existing?.kind === "attachable" && existing.manifest.epicRunId === epicRunId;
946
+ }
918
947
  export function mapPlanePreflightToReadinessChecks(result,
919
948
  /**
920
949
  * An EXPLICIT statement that the plane checks do not apply to this target. It is
@@ -922,7 +951,14 @@ export function mapPlanePreflightToReadinessChecks(result,
922
951
  * input stays the failure it always was, so an unrun probe is never mistaken for
923
952
  * an inapplicable one.
924
953
  */
925
- notApplicable) {
954
+ notApplicable,
955
+ /**
956
+ * BAPI-1397 (F4) — the run being attached (`readiness --epic-run-id`). When the
957
+ * observed live plane is that run's own plane, its occupied port and its live
958
+ * manifest are reported as `pass` rows with the `own_plane` reason instead of two
959
+ * `fail` rows. Absent or different, every row maps exactly as before.
960
+ */
961
+ options = {}) {
926
962
  if (notApplicable !== undefined) {
927
963
  return PLANE_READINESS_DESCRIPTORS.map(({ id, label }) => createReadinessCheck({
928
964
  id: `plane.${id}`,
@@ -937,8 +973,25 @@ notApplicable) {
937
973
  if (!byId.has(outcome.id))
938
974
  byId.set(outcome.id, outcome);
939
975
  }
976
+ const ownPlane = planeIsOwnPlaneForRun(result, options.epicRunId);
940
977
  return PLANE_READINESS_DESCRIPTORS.map(({ id, label }) => {
941
978
  const outcome = byId.get(id);
979
+ // The occupied port is only reclassified when the probe actually saw it
980
+ // occupied; a free port is already a pass and an indeterminate probe keeps
981
+ // its warning. A pass carries no remediation.
982
+ if (ownPlane &&
983
+ outcome &&
984
+ outcome.status === "fail" &&
985
+ (id === "existing-plane" ||
986
+ (id === "server-port" && result?.observations?.serverPort === "connected"))) {
987
+ return createReadinessCheck({
988
+ id: `plane.${id}`,
989
+ source: "plane",
990
+ label: outcome.label || label,
991
+ status: "pass",
992
+ detail: PLANE_OWN_PLANE_DETAIL[id],
993
+ });
994
+ }
942
995
  if (!outcome) {
943
996
  return createReadinessCheck({
944
997
  id: `plane.${id}`,
@@ -19,10 +19,15 @@ export const PRINTED_REMEDY_DISPATCHED_SUBCOMMANDS = [
19
19
  "install-bridge",
20
20
  "doctor",
21
21
  "connect-github",
22
+ "executor",
22
23
  ];
23
24
  /** The guided installer (interactive project setup). */
24
25
  export const PRINTED_INSTALL_COMMAND = `${LAUNCHER} install`;
25
- /** Conductor bootstrap. The parser requires at least one `--required-check`. */
26
+ /**
27
+ * Conductor bootstrap with an explicit provider check. Since BAPI-1391 a
28
+ * confirmed gate (provider, local, mixed, or none) replaces the old "at least
29
+ * one --required-check" rule; a provider check is still the common scripted form.
30
+ */
26
31
  export const PRINTED_CONDUCTOR_INSTALL_COMMAND = `${LAUNCHER} install conductor --required-check <check-name>`;
27
32
  /** Conductor bootstrap that also provisions a repository-wide executor service. */
28
33
  export const PRINTED_CONDUCTOR_EXECUTOR_INSTALL_COMMAND = `${LAUNCHER} install conductor --required-check <check-name> --executor-id <id> --repo-wide`;
@@ -35,3 +40,13 @@ export const PRINTED_CHECK_NAME_INSTRUCTION = "Replace <check-name> with the exa
35
40
  "repeat --required-check for each additional check.";
36
41
  /** Explains the `<id>` placeholder of the executor command. */
37
42
  export const PRINTED_EXECUTOR_ID_INSTRUCTION = "Replace <id> with a name for the executor service.";
43
+ /**
44
+ * BAPI-1391 — qualify a confirmed local or mixed gate: enqueue the run-less
45
+ * qualification job and drain it with a short-lived repository-wide executor.
46
+ * The remedy for `local_command_unqualified`.
47
+ */
48
+ export const PRINTED_QUALIFY_GATE_COMMAND = `${LAUNCHER} install-bridge conductor --qualify-gate`;
49
+ /** A persistent repository-wide executor service, which also drains qualification jobs. */
50
+ export const PRINTED_REPO_WIDE_EXECUTOR_COMMAND = `${LAUNCHER} install conductor --executor-id <id> --repo-wide`;
51
+ /** The lifecycle-free executor service-unit generator. */
52
+ export const PRINTED_EXECUTOR_INSTALL_SERVICE_COMMAND = `${LAUNCHER} executor install-service`;