@bridge_gpt/mcp-server 0.2.53 → 0.2.55

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 (103) hide show
  1. package/README.md +116 -56
  2. package/build/agent-guidance.generated.js +3 -0
  3. package/build/agent-launchers/claude-executor-adapter.js +3 -0
  4. package/build/agent-launchers/claude.js +3 -3
  5. package/build/agent-launchers/prompt.js +8 -11
  6. package/build/agent-notes.js +178 -0
  7. package/build/agent-registry.js +5 -2
  8. package/build/agent-utils.js +58 -0
  9. package/build/agents.generated.js +1 -1
  10. package/build/base-ref.js +33 -9
  11. package/build/bounded-wait.js +174 -0
  12. package/build/codex-skill-adapter.js +55 -0
  13. package/build/commands.generated.js +6 -5
  14. package/build/conductor/bridge-api-client.js +235 -14
  15. package/build/conductor/bring-up-facts.js +187 -0
  16. package/build/conductor/claude-hook.js +7 -5
  17. package/build/conductor/cli.js +28 -0
  18. package/build/conductor/doctor.js +80 -9
  19. package/build/conductor/epic-implementer-cli.js +1298 -0
  20. package/build/conductor/epic-runtime.js +134 -98
  21. package/build/conductor/errors.js +2 -2
  22. package/build/conductor/git-ci-types.js +1 -1
  23. package/build/conductor/git-hooks.js +28 -14
  24. package/build/conductor/install-doctor.js +11 -5
  25. package/build/conductor/readiness-cli.js +10 -10
  26. package/build/conductor/readiness-sections.js +58 -9
  27. package/build/conductor/readiness.js +120 -4
  28. package/build/conductor/recovery-cli.js +289 -10
  29. package/build/conductor/recovery-operations.js +125 -2
  30. package/build/conductor/repair-contract.js +58 -0
  31. package/build/conductor/run-branch.js +137 -0
  32. package/build/conductor/store.js +2 -2
  33. package/build/conductor/supervisor-runtime.js +1 -1
  34. package/build/conductor/test-run-branch-vectors.js +165 -0
  35. package/build/conductor-bin.js +2 -139
  36. package/build/conductor-claude-hook-bin.js +2 -2
  37. package/build/conductor-claude-hook-removed-stub-bin.js +31 -0
  38. package/build/conductor-removed-stub-bin.js +30 -0
  39. package/build/docs.generated.js +1 -1
  40. package/build/doctor.js +145 -18
  41. package/build/drive-epic.js +752 -90
  42. package/build/epic-implementer-bin.js +145 -0
  43. package/build/epic-implementer-bundle-cli.js +264 -0
  44. package/build/epic-implementer-claude-hook-bin.js +3 -0
  45. package/build/epic-integration-pr.js +5 -3
  46. package/build/executor/claim-scope.js +104 -0
  47. package/build/executor/cli.js +14 -25
  48. package/build/executor/env-file-guard.js +82 -3
  49. package/build/executor/env.js +6 -0
  50. package/build/executor/interrupted-worktree.js +60 -0
  51. package/build/executor/job-errors.js +45 -0
  52. package/build/executor/job-runner.js +334 -9
  53. package/build/executor/job-types.js +25 -9
  54. package/build/executor/merge-tree-classifier.js +171 -0
  55. package/build/executor/reconcile-overlap-governance.js +129 -0
  56. package/build/executor/reconcile-overlap-job.js +989 -0
  57. package/build/executor/reconcile-overlap-types.js +14 -0
  58. package/build/executor/spawn-job-driver.js +1 -0
  59. package/build/executor/types.js +2 -0
  60. package/build/executor/worker-finalization.js +25 -2
  61. package/build/executor/worker-guard-hook.js +15 -7
  62. package/build/implement-epic/bridge-client.js +773 -0
  63. package/build/implement-epic/checkpoint-store.js +542 -0
  64. package/build/implement-epic/cli.js +3158 -0
  65. package/build/implement-epic/cut-protocol.js +392 -0
  66. package/build/implement-epic/lock.js +302 -0
  67. package/build/implement-epic/pr-state.js +286 -0
  68. package/build/implement-epic/spawn.js +113 -0
  69. package/build/index.js +657 -481
  70. package/build/init.js +72 -8
  71. package/build/install-bridge-conductor.js +5 -5
  72. package/build/install-bridge.js +403 -70
  73. package/build/local-artifact-storage.js +130 -0
  74. package/build/mcp-host-config.js +22 -60
  75. package/build/mcp-host-entry-adapter.js +18 -0
  76. package/build/mcp-host-targets.js +1 -21
  77. package/build/merge-pull-request.js +1 -1
  78. package/build/pipelines.generated.js +23 -16
  79. package/build/plan-epic-conductor-eligibility.js +1 -1
  80. package/build/plane/cli.js +321 -41
  81. package/build/plane/manifest.js +209 -1
  82. package/build/plane/member-roster.js +70 -0
  83. package/build/plane/preflight.js +128 -12
  84. package/build/plane/shutdown.js +18 -5
  85. package/build/plane/status.js +35 -1
  86. package/build/plane/supervisor.js +546 -164
  87. package/build/plane/types.js +25 -2
  88. package/build/polling-policy.js +72 -0
  89. package/build/readiness-check.js +3 -3
  90. package/build/readme.generated.js +1 -1
  91. package/build/review-generation.js +219 -0
  92. package/build/run-unit-tests-launcher.js +6 -1
  93. package/build/setup-epic.js +567 -38
  94. package/build/start-tickets-conductor.js +8 -7
  95. package/build/ticket-key-utils.js +4 -3
  96. package/build/ticket-review-artifact-gate.js +461 -0
  97. package/build/upgrade-cli.js +5 -26
  98. package/build/version.generated.js +3 -3
  99. package/build/worker-guard-hook-bin.js +1 -1
  100. package/docs/CONDUCTOR.md +8 -6
  101. package/docs/install/mcp-tool-integrations.md +23 -1
  102. package/package.json +5 -3
  103. package/pipelines/review-ticket.json +17 -4
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Secret-free agent-tab spawning for `implement-epic spawn` (BAPI-803).
3
+ *
4
+ * `spawn` opens exactly ONE terminal tab in a ticket's worktree running the
5
+ * agent against a prompt the CALLER wrote to a file. The prompt is arbitrary
6
+ * operator/loop-authored text — it can contain apostrophes, `$(…)`, backticks,
7
+ * and newlines — so it is placed inside a single-quoted shell literal using the
8
+ * repository's existing quoting helpers rather than any local escaping. Reusing
9
+ * `shSquoteInner` / `powershellSquote` is the point: a second escaping
10
+ * implementation is a second place for a quoting bug to produce shell execution.
11
+ *
12
+ * Two invariants this module is responsible for:
13
+ *
14
+ * - **Exactly one tab, and only after every check passes.** The spawn seam is
15
+ * invoked once, at the end, after the agent is validated and the command is
16
+ * built. A partial failure must leave no tab, because the caller increments
17
+ * `sessions_spawned` on success and a phantom tab would desynchronize it.
18
+ * - **No credential reaches the command.** Nothing here resolves, receives, or
19
+ * formats Bridge access data. The spawned agent resolves its own credentials
20
+ * from the user-scoped store, exactly as `start-tickets` workers do; a key in
21
+ * argv would be visible to every process on the machine via `ps`.
22
+ */
23
+ import { powershellSquote, shSquoteInner, } from "../start-tickets.js";
24
+ import { INDEX_SCOPE_ENV_VAR } from "../index-scope-contract.js";
25
+ /** The agents `implement-epic spawn` may launch. */
26
+ export const CONDUCT_EPIC_AGENTS = ["claude", "cursor-agent"];
27
+ /** The repository's established default agent. */
28
+ export const CONDUCT_EPIC_DEFAULT_AGENT = "claude";
29
+ /**
30
+ * Validate an agent value, defaulting to {@link CONDUCT_EPIC_DEFAULT_AGENT}.
31
+ *
32
+ * Rejects before any command is built. The agent name becomes the executable in
33
+ * a shell command, so an unvalidated value is a command-injection surface even
34
+ * though the surrounding operands are quoted.
35
+ */
36
+ export function resolveConductEpicAgent(agent) {
37
+ if (agent === undefined || agent.trim().length === 0) {
38
+ return { ok: true, agent: CONDUCT_EPIC_DEFAULT_AGENT };
39
+ }
40
+ const trimmed = agent.trim();
41
+ if (!CONDUCT_EPIC_AGENTS.includes(trimmed)) {
42
+ return {
43
+ ok: false,
44
+ error: `Unsupported agent '${trimmed}'. Expected one of: ${CONDUCT_EPIC_AGENTS.join(", ")}`,
45
+ };
46
+ }
47
+ return { ok: true, agent: trimmed };
48
+ }
49
+ /**
50
+ * Build `cd '<worktree>' && <agent> '<prompt>'` (POSIX) or the PowerShell
51
+ * equivalent, with both operands quoted by the shared helpers.
52
+ *
53
+ * Returns the command as a string rather than an argv array because that is what
54
+ * every terminal spawner in this repository consumes — a tab is opened by handing
55
+ * a shell a command line, not by `exec`ing a process.
56
+ *
57
+ * BAPI-844: a validated `indexScope` is prefixed as an environment assignment
58
+ * using the SAME quoting helpers as the rest of the command — the shell's own
59
+ * environment mechanism, not an argument the agent can see. An absent scope emits
60
+ * no prefix, so the unscoped command is unchanged byte-for-byte.
61
+ */
62
+ export function buildConductEpicAgentCommand(input) {
63
+ const resolved = resolveConductEpicAgent(input.agent);
64
+ if (!resolved.ok)
65
+ return resolved;
66
+ if (input.worktreePath.trim().length === 0) {
67
+ return { ok: false, error: "A worktree path is required to build the agent command." };
68
+ }
69
+ if (input.platform === "win32") {
70
+ const scopePrefix = input.indexScope
71
+ ? `$env:${INDEX_SCOPE_ENV_VAR} = ${powershellSquote(input.indexScope)}; `
72
+ : "";
73
+ return {
74
+ ok: true,
75
+ command: `${scopePrefix}Set-Location -LiteralPath ${powershellSquote(input.worktreePath)}; ` +
76
+ `${resolved.agent} ${powershellSquote(input.prompt)}`,
77
+ };
78
+ }
79
+ const scopePrefix = input.indexScope
80
+ ? `export ${INDEX_SCOPE_ENV_VAR}='${shSquoteInner(input.indexScope)}' && `
81
+ : "";
82
+ return {
83
+ ok: true,
84
+ command: `${scopePrefix}cd '${shSquoteInner(input.worktreePath)}' && ` +
85
+ `${resolved.agent} '${shSquoteInner(input.prompt)}'`,
86
+ };
87
+ }
88
+ /**
89
+ * Build the command and open exactly one tab through `spawnTab`.
90
+ *
91
+ * The seam is invoked once and only after construction succeeds. A spawner
92
+ * failure is returned as `{ ok: false }` with the spawner's own sanitized
93
+ * message — never the command, which embeds the full prompt text.
94
+ */
95
+ export async function spawnConductEpicAgentTab(input, spawnTab) {
96
+ const built = buildConductEpicAgentCommand(input);
97
+ if (!built.ok)
98
+ return built;
99
+ let result;
100
+ try {
101
+ result = await spawnTab(built.command, {
102
+ key: input.ticketKey,
103
+ worktreePath: input.worktreePath,
104
+ title: `implement-epic ${input.ticketKey}`,
105
+ });
106
+ }
107
+ catch {
108
+ return { ok: false, error: "The terminal tab could not be opened." };
109
+ }
110
+ if (!result.ok)
111
+ return { ok: false, error: result.error };
112
+ return { ok: true, command: built.command };
113
+ }