@bridge_gpt/mcp-server 0.2.73 → 0.2.75

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 (123) hide show
  1. package/README.md +14 -7
  2. package/build/agent-launchers/claude-executor-adapter.js +12 -0
  3. package/build/agent-launchers/prompt.js +9 -21
  4. package/build/agents.generated.js +4 -4
  5. package/build/authored-plan.js +542 -0
  6. package/build/bridge-config.js +7 -1
  7. package/build/bridge-permissions.js +11 -0
  8. package/build/command-provisioning.js +4 -3
  9. package/build/commands.generated.js +6 -6
  10. package/build/conductor/bridge-api-client.js +692 -47
  11. package/build/conductor/command-drift.js +1 -1
  12. package/build/conductor/declared-extras.js +335 -0
  13. package/build/conductor/doctor.js +2 -0
  14. package/build/conductor/driver-pass-output.js +104 -0
  15. package/build/conductor/driver-pass.js +571 -0
  16. package/build/conductor/epic-branch-ci-inspection.js +61 -16
  17. package/build/conductor/epic-implementer-cli.js +370 -93
  18. package/build/conductor/epic-server-sfcc-upload.js +1567 -0
  19. package/build/conductor/epic-server-sfcc.js +58 -80
  20. package/build/conductor/epic-server.js +57 -4
  21. package/build/conductor/gate-discovery.js +253 -13
  22. package/build/conductor/gate-settings-review.js +58 -25
  23. package/build/conductor/launch-plan.js +58 -12
  24. package/build/conductor/open-decision-phrases.js +50 -0
  25. package/build/conductor/prerequisite-inputs.js +181 -14
  26. package/build/connect-github-api.js +18 -0
  27. package/build/connect-github.js +35 -18
  28. package/build/credential-delivery.js +280 -0
  29. package/build/credential-launch-safety.js +142 -0
  30. package/build/credential-materialization.js +91 -16
  31. package/build/credential-references-node-deps.js +29 -0
  32. package/build/credential-references.js +1394 -0
  33. package/build/credential-references.test-fixtures.js +211 -0
  34. package/build/credential-scan-conventions.js +145 -0
  35. package/build/credential-scan.js +517 -0
  36. package/build/credential-store.js +50 -0
  37. package/build/credentials-cli.js +252 -3
  38. package/build/dependency-install-declarations.js +47 -1
  39. package/build/docs.generated.js +8 -1
  40. package/build/doctor.js +41 -0
  41. package/build/drive-epic.js +684 -49
  42. package/build/epic-branch-ci-summary.js +18 -1
  43. package/build/epic-capability-statement.js +71 -3
  44. package/build/epic-ci-workflow-drift.js +52 -13
  45. package/build/epic-ci-workflow-install.js +31 -6
  46. package/build/epic-ci-workflow-v3.js +273 -0
  47. package/build/epic-ci-workflow.js +129 -7
  48. package/build/epic-implementer-bin.js +288 -83
  49. package/build/epic-implementer-bundle-cli.js +61 -0
  50. package/build/epic-implementer-claude-hook-bin.js +1 -1
  51. package/build/epic-implementer-env.js +3 -4
  52. package/build/epic-integration-pr.js +5 -2
  53. package/build/epic-launch-context.js +102 -7
  54. package/build/epic-server-record.js +30 -15
  55. package/build/executor/completion-contract.js +24 -1
  56. package/build/executor/credential-delivery-step.js +168 -0
  57. package/build/executor/deps.js +3 -1
  58. package/build/executor/env.js +39 -1
  59. package/build/executor/epic-server-context.js +23 -7
  60. package/build/executor/gate-qualification-job.js +193 -23
  61. package/build/executor/gate-qualification-tests-ran.js +232 -0
  62. package/build/executor/guarded-fast-forward-push.js +13 -8
  63. package/build/executor/job-runner.js +167 -738
  64. package/build/executor/job-type-wrappers.js +734 -0
  65. package/build/executor/permissions.js +85 -3
  66. package/build/executor/preflight.js +6 -2
  67. package/build/executor/process-containment.js +8 -1
  68. package/build/executor/prompt-spec.js +37 -3
  69. package/build/executor/required-verification.js +28 -2
  70. package/build/executor/runner.js +4 -1
  71. package/build/executor/types.js +9 -0
  72. package/build/executor/worker-database.js +6 -1
  73. package/build/executor/worker-guard-hook.js +24 -2
  74. package/build/executor-launch.js +4 -2
  75. package/build/generated/ticket-status.js +20 -0
  76. package/build/git-exclude-lock.js +187 -0
  77. package/build/index.js +589 -326
  78. package/build/install-bridge-conductor-answers.js +112 -22
  79. package/build/install-bridge-conductor-apply.js +38 -1
  80. package/build/install-bridge-conductor-assessment.js +482 -53
  81. package/build/install-bridge-conductor-compact.js +29 -2
  82. package/build/install-bridge-conductor-contracts.js +10 -1
  83. package/build/install-bridge-conductor-gate.js +379 -89
  84. package/build/install-bridge-conductor-setup.js +46 -8
  85. package/build/install-bridge-conductor-trial-report.js +170 -0
  86. package/build/install-bridge-conductor.js +925 -141
  87. package/build/install-bridge.js +88 -11
  88. package/build/install-doctor.js +38 -8
  89. package/build/install-sfcc-detection.js +120 -0
  90. package/build/install-sfcc-setup.js +185 -0
  91. package/build/mcp-grant-candidates.js +108 -96
  92. package/build/mcp-invoke.js +168 -4
  93. package/build/mcp-provisioning.js +21 -4
  94. package/build/mcp-server-invocation.js +13 -0
  95. package/build/merge-workflow-install.js +9 -1
  96. package/build/pipelines.generated.js +8 -7
  97. package/build/plan-generation.js +17 -0
  98. package/build/plane/status.js +8 -2
  99. package/build/printed-remedy-commands.js +59 -0
  100. package/build/project-root.js +40 -0
  101. package/build/readme.generated.js +1 -1
  102. package/build/repository-state-paths.js +5 -2
  103. package/build/repository-toolchains.js +16 -7
  104. package/build/scripts/saved-commands-config-field-driver.js +65 -0
  105. package/build/setup-epic.js +126 -16
  106. package/build/sfcc/credentials.js +3 -2
  107. package/build/sfcc/hostname.js +98 -2
  108. package/build/sfcc/tool-wrapper.js +6 -95
  109. package/build/start-tickets.js +193 -29
  110. package/build/test-support/executor-source-files.js +200 -0
  111. package/build/testing-config-client.js +25 -2
  112. package/build/third-party-mcp-targets.js +35 -4
  113. package/build/v2-readiness-requirements.js +5 -1
  114. package/build/version.generated.js +3 -3
  115. package/build/with-credentials.js +208 -0
  116. package/build/worker-guard-hook-bin.js +2 -2
  117. package/build/worktree-credential-delivery.js +340 -0
  118. package/docs/EPIC-IMPLEMENTER.md +4 -4
  119. package/docs/install/github-app.md +79 -92
  120. package/package.json +1 -1
  121. package/build/conductor/epic-reconcile.js +0 -603
  122. package/build/conductor/epic-runtime.js +0 -2020
  123. package/build/conductor/epic-state.js +0 -774
@@ -1047,6 +1047,10 @@ export const EPIC_BRANCH_RULES_REASONS = [
1047
1047
  "approvals_required",
1048
1048
  "approvals_not_required",
1049
1049
  "no_rules_apply",
1050
+ // Additive closed token: GitHub's definitive "your plan has no rulesets / branch
1051
+ // protection here" answer. It is confirmed absence of applicable rules, unlike
1052
+ // the other non-200 reasons, which are uncertainty.
1053
+ "plan_unavailable",
1050
1054
  ];
1051
1055
  /** Closed reason tokens for {@link assessApprovalExemptionScope} / {@link applyApprovalExemption}. */
1052
1056
  export const EXEMPTION_REASONS = [
@@ -1089,7 +1093,16 @@ function encodeBranchPath(branch) {
1089
1093
  return branch.split("/").map(encodeURIComponent).join("/");
1090
1094
  }
1091
1095
  const GH_JSON_HEADERS = ["-H", "Accept: application/vnd.github+json", "-H", "X-GitHub-Api-Version: 2022-11-28"];
1092
- /** Run `gh api ...` and parse JSON. Output text is inspected for status only and never returned. */
1096
+ /**
1097
+ * The one definitive plan-limit reply: HTTP 403 whose message, right after the
1098
+ * `gh: ` wrapper at the very start of stderr, begins with this text. Anchored so
1099
+ * a bare 403 or an unrelated "upgrade" message never matches.
1100
+ */
1101
+ const PLAN_LIMIT_STDERR_RE = /^\s*gh: Upgrade to GitHub Pro or make this repository public/;
1102
+ /**
1103
+ * Run `gh api ...` and parse JSON. Output text is inspected for the HTTP status and
1104
+ * the exact plan-limit message condition only, and is never returned.
1105
+ */
1093
1106
  async function ghApiJson(run, args, input) {
1094
1107
  let result;
1095
1108
  try {
@@ -1104,6 +1117,9 @@ async function ghApiJson(run, args, input) {
1104
1117
  const err = typeof result.stderr === "string" ? result.stderr : "";
1105
1118
  if (/HTTP 404\b/.test(err))
1106
1119
  return { ok: false, reason: "not_found" };
1120
+ if (/HTTP 403\b/.test(err) && PLAN_LIMIT_STDERR_RE.test(err) && !/HTTP (?:401|404|500)\b/.test(err)) {
1121
+ return { ok: false, reason: "plan_unavailable" };
1122
+ }
1107
1123
  if (/HTTP 401\b|gh auth login|not logged in|authentication required/i.test(err)) {
1108
1124
  return { ok: false, reason: "gh_unauthenticated" };
1109
1125
  }
@@ -1197,6 +1213,8 @@ export async function readDefaultBranchClassicContextViaGh(run, ownerRepo) {
1197
1213
  const branchPath = encodeBranchPath(defaultBranch);
1198
1214
  const prot = await ghApiJson(run, [`repos/${ownerRepo}/branches/${branchPath}/protection`]);
1199
1215
  if (!prot.ok) {
1216
+ if (prot.reason === "plan_unavailable")
1217
+ return { defaultBranch, approvals: "no", count: null };
1200
1218
  if (prot.reason !== "not_found")
1201
1219
  return unknown;
1202
1220
  const exists = await branchExists(run, ownerRepo, defaultBranch);
@@ -1243,9 +1261,12 @@ export async function readDefaultBranchRequiredChecksViaGh(run, ownerRepo, known
1243
1261
  if (!validBranch(defaultBranch))
1244
1262
  return { status: "unknown", reason: "invalid_input" };
1245
1263
  const rules = await readBranchRules(run, ownerRepo, defaultBranch);
1246
- if (!rules.ok)
1264
+ // A plan-limited source is an empty source, judged independently of the other.
1265
+ const rulesPlanLimited = !rules.ok && rules.reason === "plan_unavailable";
1266
+ if (!rules.ok && !rulesPlanLimited) {
1247
1267
  return { status: "unknown", reason: rules.reason };
1248
- const checks = new Set(rules.rules.statusChecks);
1268
+ }
1269
+ const checks = new Set(rules.ok ? rules.rules.statusChecks : []);
1249
1270
  const protection = await ghApiJson(run, [
1250
1271
  `repos/${ownerRepo}/branches/${encodeBranchPath(defaultBranch)}/protection`,
1251
1272
  ]);
@@ -1274,6 +1295,9 @@ export async function readDefaultBranchRequiredChecksViaGh(run, ownerRepo, known
1274
1295
  }
1275
1296
  }
1276
1297
  }
1298
+ else if (protection.reason === "plan_unavailable") {
1299
+ // Empty source; the rules source (if readable) already supplied its checks.
1300
+ }
1277
1301
  else if (protection.reason === "not_found") {
1278
1302
  // A 404 can mean "no classic protection" or "cannot see it": only a branch
1279
1303
  // proven visible makes it the former.
@@ -1318,8 +1342,11 @@ function rulesCouldNotTell(branch, reason) {
1318
1342
  * a branch with that name will be returned"
1319
1343
  * (https://docs.github.com/en/rest/repos/rules#get-rules-for-a-branch). That is
1320
1344
  * documented but not yet live-verified (Bridge-GPT/bridge-api is a private
1321
- * repository whose plan lacks rulesets), hence `inferred`. A non-200 reply,
1322
- * including the 403 a plan without rulesets returns, stays `could_not_tell`. It also
1345
+ * repository whose plan lacks rulesets), hence `inferred`. The one definitive
1346
+ * exception is the exact plan-limit 403 ("Upgrade to GitHub Pro or make this
1347
+ * repository public"): the plan has no rules, so that is `no` / `exact` with reason
1348
+ * `plan_unavailable`. Every other non-200 reply (a bare 403, permissions, SSO, rate
1349
+ * limit, 500) is uncertainty and stays `could_not_tell`. It also
1323
1350
  * attaches the default branch's classic protection as separately labelled
1324
1351
  * CONTEXT ({@link readDefaultBranchClassicContextViaGh}); that context never
1325
1352
  * changes `approvalsRequired`. Never throws.
@@ -1341,6 +1368,17 @@ export async function readEpicBranchRulesViaGh(run, ownerRepo, branch) {
1341
1368
  }
1342
1369
  async function readEpicBranchRulesOnly(run, ownerRepo, branch) {
1343
1370
  const read = await readBranchRules(run, ownerRepo, branch);
1371
+ if (!read.ok && read.reason === "plan_unavailable") {
1372
+ // Definitive: the plan has no rules to apply. No branch probe is needed.
1373
+ return {
1374
+ branch,
1375
+ approvalsRequired: "no",
1376
+ requiredApprovingReviewCount: null,
1377
+ requiredStatusChecks: [],
1378
+ observationQuality: "exact",
1379
+ reason: "plan_unavailable",
1380
+ };
1381
+ }
1344
1382
  if (!read.ok)
1345
1383
  return rulesCouldNotTell(branch, read.reason);
1346
1384
  const { pullRequestRules, statusChecks } = read.rules;
@@ -1433,8 +1471,12 @@ export async function assessApprovalExemptionScope(run, ownerRepo, branch) {
1433
1471
  if (!validOwnerRepo(ownerRepo) || !validBranch(branch))
1434
1472
  return ineligible("rules_unreadable");
1435
1473
  const read = await readBranchRules(run, ownerRepo, branch);
1436
- if (!read.ok)
1474
+ if (!read.ok) {
1475
+ // A plan without rulesets has no approval rule to exempt; no ruleset details are read.
1476
+ if (read.reason === "plan_unavailable")
1477
+ return ineligible("no_approval_rule");
1437
1478
  return ineligible(read.reason === "malformed_rule" ? "malformed_rule" : "rules_unreadable");
1479
+ }
1438
1480
  const prRules = read.rules.pullRequestRules;
1439
1481
  if (prRules.length === 0)
1440
1482
  return ineligible("no_approval_rule");
@@ -1470,6 +1512,8 @@ function sameList(a, b) {
1470
1512
  * Never attempts a repair. The caller must have the user's explicit consent.
1471
1513
  */
1472
1514
  export async function applyApprovalExemption(run, ownerRepo, branch, assessment) {
1515
+ // Pre-write refusals return attempted:false; once the PUT loop may start, or an
1516
+ // exception is caught, the write is conservatively treated as attempted.
1473
1517
  try {
1474
1518
  if (!assessment ||
1475
1519
  assessment.eligible !== true ||
@@ -1478,35 +1522,36 @@ export async function applyApprovalExemption(run, ownerRepo, branch, assessment)
1478
1522
  !assessment.rulesetIds.every(isNonNegInt) ||
1479
1523
  !validOwnerRepo(ownerRepo) ||
1480
1524
  !validBranch(branch)) {
1481
- return { confirmed: false, reason: "scope_not_eligible" };
1525
+ return { confirmed: false, reason: "scope_not_eligible", attempted: false };
1482
1526
  }
1483
1527
  const before = await readBranchRules(run, ownerRepo, branch);
1484
1528
  if (!before.ok)
1485
- return { confirmed: false, reason: "ruleset_changed" };
1529
+ return { confirmed: false, reason: "ruleset_changed", attempted: false };
1486
1530
  const bodies = [];
1487
1531
  for (const id of assessment.rulesetIds) {
1488
1532
  const check = await checkRuleset(run, ownerRepo, id);
1489
1533
  if (!check.ok)
1490
- return { confirmed: false, reason: "ruleset_changed" };
1534
+ return { confirmed: false, reason: "ruleset_changed", attempted: false };
1491
1535
  bodies.push({ id, body: check.body });
1492
1536
  }
1493
1537
  for (const { id, body } of bodies) {
1494
1538
  const put = await ghApiJson(run, ["--method", "PUT", `repos/${ownerRepo}/rulesets/${id}`, "--input", "-"], JSON.stringify(body));
1495
1539
  if (!put.ok)
1496
- return { confirmed: false, reason: "apply_failed" };
1540
+ return { confirmed: false, reason: "apply_failed", attempted: true };
1497
1541
  }
1498
1542
  const after = await readBranchRules(run, ownerRepo, branch);
1499
1543
  if (!after.ok)
1500
- return { confirmed: false, reason: "verification_failed" };
1501
- if (after.rules.pullRequestRules.length > 0)
1502
- return { confirmed: false, reason: "approvals_still_required" };
1544
+ return { confirmed: false, reason: "verification_failed", attempted: true };
1545
+ if (after.rules.pullRequestRules.length > 0) {
1546
+ return { confirmed: false, reason: "approvals_still_required", attempted: true };
1547
+ }
1503
1548
  if (!sameList(before.rules.statusChecks, after.rules.statusChecks)) {
1504
- return { confirmed: false, reason: "status_checks_changed" };
1549
+ return { confirmed: false, reason: "status_checks_changed", attempted: true };
1505
1550
  }
1506
- return { confirmed: true, reason: "confirmed" };
1551
+ return { confirmed: true, reason: "confirmed", attempted: true };
1507
1552
  }
1508
1553
  catch {
1509
- return { confirmed: false, reason: "verification_failed" };
1554
+ return { confirmed: false, reason: "verification_failed", attempted: true };
1510
1555
  }
1511
1556
  }
1512
1557
  /**