@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
@@ -76,19 +76,38 @@
76
76
  * line) so a later run can re-render the file byte for byte and tell a
77
77
  * legitimate toolchain change from a hand edit.
78
78
  *
79
+ * ## Approved install commands (renderer version 4, BAPI-1677)
80
+ *
81
+ * Version 3 always ran the fixed install line for each toolchain. A project whose
82
+ * tests need an optional extra failed in CI the way it failed on a worker. Version 4
83
+ * takes the entries the owner approved, the same ones the test trial and every worker
84
+ * use. With none, or with a list that only repeats fixed install lines, it keeps
85
+ * version 3's install lines. With any other list, it keeps the runtime setup, manager
86
+ * bootstrap, and PATH steps, and renders each entry as its own step in its own
87
+ * directory, every argument quoted for the shell. An entry replaces a fixed install
88
+ * line only when it runs that line's manager at the repository root. Every other fixed
89
+ * line stays, so a partial list loses nothing. The pip line always stays, because setup
90
+ * never proposes pip. Entry steps use a block scalar, so the stored test command stays
91
+ * the only double-quoted `run:` line. The entries are recorded in the header, so a later
92
+ * run can reproduce the file.
93
+ *
79
94
  * The command still never receives a prefix or an install: it stays on its one
80
95
  * protected scalar line.
81
96
  */
82
97
  import { BUN_VERSION_RANGE, NODE_FALLBACK_MAJOR, PNPM_FALLBACK_MAJOR, POETRY_VERSION, PYTHON_FALLBACK_MINOR, YARN_BERRY_FALLBACK_MAJOR, serializeRepositoryToolchains, validateRepositoryToolchains, } from "./repository-toolchains.js";
98
+ import { DEPENDENCY_INSTALL_UNSAFE_MESSAGE, parseDependencyInstallStrict, } from "./dependency-install-declarations.js";
99
+ import { posixShellQuote } from "./platform-escaping.js";
83
100
  import { validateTestCommand } from "./test-command-validation.js";
84
101
  /** Repository-relative path of the managed workflow. */
85
102
  export const EPIC_CI_WORKFLOW_PATH = ".github/workflows/epic-implementer-ci.yml";
86
103
  /** The renderer version written into the managed header. */
87
- export const EPIC_CI_WORKFLOW_RENDERER_VERSION = 3;
104
+ export const EPIC_CI_WORKFLOW_RENDERER_VERSION = 4;
88
105
  /** The header marker key; the line is `# <key>: <version>`. */
89
106
  export const EPIC_CI_WORKFLOW_VERSION_MARKER_KEY = "x-bridge-ci-renderer-version";
90
107
  /** The header marker key for the canonical toolchain set; the line is `# <key>: <json>`. */
91
108
  export const EPIC_CI_WORKFLOW_TOOLCHAINS_MARKER_KEY = "x-bridge-ci-toolchains";
109
+ /** BAPI-1677 — the header marker key for the approved install commands; the line is `# <key>: <json>`. */
110
+ export const EPIC_CI_WORKFLOW_DEPENDENCY_INSTALL_MARKER_KEY = "x-bridge-ci-dependency-install";
92
111
  /** The `name:` of the one step that runs the stored command. */
93
112
  export const EPIC_CI_COMMAND_STEP_NAME = "Run the stored test command";
94
113
  /** Pinned action majors. Changing any of these is a renderer-version change. */
@@ -146,6 +165,54 @@ function pythonSetupLines(python) {
146
165
  : " python-version-file: " + python,
147
166
  ];
148
167
  }
168
+ const INSTALL_STEP_NAME = " - name: Install dependencies";
169
+ /** The run text of each fixed "Install dependencies" step, in file order. Every such step is two lines. */
170
+ function fixedInstallCommands(lines) {
171
+ const fixed = [];
172
+ lines.forEach((line, index) => {
173
+ if (line === INSTALL_STEP_NAME)
174
+ fixed.push((lines[index + 1] ?? "").replace(/^ *run: /, ""));
175
+ });
176
+ return fixed;
177
+ }
178
+ /**
179
+ * True when an approved entry replaces this fixed install command: it runs the same manager at the
180
+ * repository root, where the fixed step runs. An entry elsewhere does not install the root's
181
+ * dependencies. pip's fixed CI install is never replaced: setup's only pip proposal (BAPI-1698) is a
182
+ * checkout-local `.venv` bootstrap run through `sh`, which does not install into CI's interpreter.
183
+ * An approved pip entry therefore ADDS an install step and the fixed one stays.
184
+ */
185
+ function entriesReplaceFixedInstall(command, entries) {
186
+ const manager = command.split(" ")[0];
187
+ return manager !== "pip" && entries.some((entry) => entry.cwd === "." && entry.argv[0] === manager);
188
+ }
189
+ /** Drop only the fixed install steps the approved entries replace, keeping everything around them. */
190
+ function withoutReplacedInstallSteps(lines, entries) {
191
+ const kept = [];
192
+ for (let i = 0; i < lines.length; i += 1) {
193
+ if (lines[i] === INSTALL_STEP_NAME && entriesReplaceFixedInstall((lines[i + 1] ?? "").replace(/^ *run: /, ""), entries)) {
194
+ i += 1;
195
+ continue;
196
+ }
197
+ kept.push(lines[i]);
198
+ }
199
+ return kept;
200
+ }
201
+ /**
202
+ * True when every entry is one of the fixed install commands at the repository root, in the fixed
203
+ * order. The list may name only some of them, because the others keep running either way.
204
+ */
205
+ function repeatsFixedInstallLines(lines, entries) {
206
+ const fixed = fixedInstallCommands(lines);
207
+ let next = 0;
208
+ return entries.every((entry) => {
209
+ if (entry.cwd !== ".")
210
+ return false;
211
+ const found = fixed.indexOf(entry.argv.join(" "), next);
212
+ next = found + 1;
213
+ return found !== -1;
214
+ });
215
+ }
149
216
  function javaScriptSetupLines(js) {
150
217
  switch (js.manager) {
151
218
  case "npm":
@@ -232,15 +299,62 @@ function toolchainSetupLines(toolchains) {
232
299
  }
233
300
  return lines;
234
301
  }
302
+ /** Raised for approved entries the renderer will not write. Its message is fixed text. */
303
+ export class EpicCiDependencyInstallError extends Error {
304
+ constructor() {
305
+ super(DEPENDENCY_INSTALL_UNSAFE_MESSAGE);
306
+ this.name = "EpicCiDependencyInstallError";
307
+ }
308
+ }
309
+ /** Escape every non-ASCII character, so a permitted separator cannot start a new header line. */
310
+ function asciiJson(value) {
311
+ return JSON.stringify(value).replace(/[\u007f-\uffff]/g, (ch) => "\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0"));
312
+ }
313
+ /** The one header form of the entries: fixed key order, and every list in its own order. */
314
+ export function serializeEpicCiDependencyInstall(entries) {
315
+ return asciiJson(entries.map((e) => ({ cwd: e.cwd, argv: e.argv, lockfiles: e.lockfiles })));
316
+ }
317
+ /** Characters a YAML reader could take as a break, or refuse, inside a block scalar. */
318
+ const BLOCK_SCALAR_UNSAFE = /([\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u2028\u2029\ufeff]+)/;
319
+ /** One argument for bash. Such characters are written as `$'\\xNN'` bytes, so the line stays one line. */
320
+ function shellWord(arg) {
321
+ const parts = arg.split(BLOCK_SCALAR_UNSAFE).filter((part) => part.length > 0);
322
+ return parts
323
+ .map((part) => BLOCK_SCALAR_UNSAFE.test(part)
324
+ ? "$'" + [...Buffer.from(part, "utf8")].map((b) => "\\x" + b.toString(16).padStart(2, "0")).join("") + "'"
325
+ : posixShellQuote(part))
326
+ .join("");
327
+ }
328
+ function dependencyInstallStepLines(entries) {
329
+ return entries.flatMap((entry, index) => [
330
+ " - name: Install declared dependencies (" + String(index + 1) + " of " + String(entries.length) + ")",
331
+ " shell: bash",
332
+ " working-directory: " + encodeCommandScalar(entry.cwd),
333
+ " run: |-",
334
+ " " + entry.argv.map(shellWord).join(" "),
335
+ ]);
336
+ }
235
337
  /**
236
- * Render the workflow for `testCommand` and the resolved `toolchains`.
237
- * Deterministic: the same inputs always give the same bytes. Throws
238
- * `TestCommandValidationError` for a bad command and `RepositoryToolchainError`
239
- * for a toolchain set outside the closed vocabulary.
338
+ * Render the workflow for `testCommand`, the resolved `toolchains`, and the approved
339
+ * install `entries`. Deterministic: the same inputs always give the same bytes. Throws
340
+ * `TestCommandValidationError` for a bad command, `RepositoryToolchainError` for a
341
+ * toolchain set outside the closed vocabulary, and `EpicCiDependencyInstallError` for
342
+ * entries the shared rules refuse, so a value an older server accepted cannot reach a
343
+ * workflow.
240
344
  */
241
- export function renderEpicImplementerCiWorkflow(testCommand, toolchains) {
345
+ export function renderEpicImplementerCiWorkflow(testCommand, toolchains, dependencyInstall = []) {
242
346
  const command = validateTestCommand(testCommand);
243
347
  const validated = validateRepositoryToolchains(toolchains);
348
+ const entries = parseDependencyInstallStrict(dependencyInstall);
349
+ if (entries === null)
350
+ throw new EpicCiDependencyInstallError();
351
+ const fixedLines = toolchainSetupLines(validated);
352
+ // A list that only repeats fixed install lines installs the same thing, so it renders the same
353
+ // bytes. Otherwise storing `npm ci` would turn an up-to-date workflow into an upgrade offer.
354
+ const sealed = repeatsFixedInstallLines(fixedLines, entries) ? [] : entries;
355
+ const setupLines = sealed.length === 0
356
+ ? fixedLines
357
+ : [...withoutReplacedInstallSteps(fixedLines, sealed), ...dependencyInstallStepLines(sealed)];
244
358
  const lines = [
245
359
  "# ===========================================================================",
246
360
  "# Epic Implementer CI gate — MANAGED FILE",
@@ -251,6 +365,7 @@ export function renderEpicImplementerCiWorkflow(testCommand, toolchains) {
251
365
  "#",
252
366
  "# " + EPIC_CI_WORKFLOW_VERSION_MARKER_KEY + ": " + String(EPIC_CI_WORKFLOW_RENDERER_VERSION),
253
367
  "# " + EPIC_CI_WORKFLOW_TOOLCHAINS_MARKER_KEY + ": " + serializeRepositoryToolchains(validated),
368
+ "# " + EPIC_CI_WORKFLOW_DEPENDENCY_INSTALL_MARKER_KEY + ": " + serializeEpicCiDependencyInstall(sealed),
254
369
  "#",
255
370
  "# WHAT THIS WORKFLOW IS",
256
371
  "#",
@@ -279,6 +394,13 @@ export function renderEpicImplementerCiWorkflow(testCommand, toolchains) {
279
394
  "# installed for that ecosystem and the command must install what it needs",
280
395
  "# itself.",
281
396
  "#",
397
+ "# When the install commands line above lists any, those approved commands run",
398
+ "# in that order. One that runs a toolchain's manager at the repository root",
399
+ "# replaces that manager's fixed install line. Every other fixed install line",
400
+ "# still runs, and the pip line always does.",
401
+ "# When it is empty, the fixed install lines for the toolchains run.",
402
+ "# To change the commands, correct them through Bridge setup and re-run it.",
403
+ "#",
282
404
  "# THE TEST COMMAND",
283
405
  "#",
284
406
  "# The command below is the repository's stored test command, run with bash",
@@ -306,7 +428,7 @@ export function renderEpicImplementerCiWorkflow(testCommand, toolchains) {
306
428
  " uses: " + EPIC_CI_ACTION_CHECKOUT,
307
429
  " with:",
308
430
  " persist-credentials: false",
309
- ...toolchainSetupLines(validated),
431
+ ...setupLines,
310
432
  " - name: " + EPIC_CI_COMMAND_STEP_NAME,
311
433
  " shell: bash",
312
434
  EPIC_CI_COMMAND_LINE_PREFIX + encodeCommandScalar(command),