@bridge_gpt/mcp-server 0.2.74 → 0.2.76
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.
- package/README.md +14 -7
- package/build/agent-launchers/prompt.js +9 -21
- package/build/agents.generated.js +6 -6
- package/build/authored-plan.js +542 -0
- package/build/bridge-permissions.js +8 -0
- package/build/codex-auto-recovery.js +25 -7
- package/build/commands.generated.js +7 -7
- package/build/conductor/bridge-api-client.js +807 -52
- package/build/conductor/declare-blocked.js +4 -0
- package/build/conductor/driver-pass.js +8 -0
- package/build/conductor/epic-implementer-cli.js +341 -96
- package/build/conductor/epic-server-journal.js +13 -0
- package/build/conductor/epic-server-recipe.js +15 -5
- package/build/conductor/epic-server-runtime.js +163 -45
- package/build/conductor/epic-server.js +13 -6
- package/build/conductor/gate-discovery.js +209 -9
- package/build/conductor/gate-settings-review.js +7 -11
- package/build/conductor/install-doctor.js +30 -2
- package/build/conductor/launch-plan.js +58 -12
- package/build/conductor/local-merge.js +54 -12
- package/build/conductor/open-decision-phrases.js +50 -0
- package/build/conductor/pr-ci-producer.js +12 -3
- package/build/conductor/prerequisite-inputs.js +181 -14
- package/build/conductor/readiness-sections.js +46 -13
- package/build/conductor/readiness.js +3 -40
- package/build/conductor/recovery-cli.js +12 -12
- package/build/conductor/repository-workflow-remedy.js +147 -7
- package/build/conductor/ui-readiness.js +224 -0
- package/build/conductor/wait-run-attention.js +9 -4
- package/build/conductor/wait-run-cli.js +9 -2
- package/build/connect-github-api.js +18 -0
- package/build/connect-github.js +35 -18
- package/build/docs.generated.js +3 -3
- package/build/drive-epic.js +787 -37
- package/build/epic-ci-workflow.js +3 -2
- package/build/epic-implementer-bin.js +200 -66
- package/build/epic-implementer-bundle-cli.js +61 -0
- package/build/epic-implementer-claude-hook-bin.js +1 -1
- package/build/epic-implementer-env.js +3 -4
- package/build/epic-integration-pr.js +5 -2
- package/build/epic-launch-context.js +8 -1
- package/build/epic-shared/cut-protocol.js +55 -3
- package/build/executor/completion-contract.js +24 -1
- package/build/executor/failure-reason-codes.js +2 -0
- package/build/executor/gate-qualification-job.js +193 -23
- package/build/executor/gate-qualification-tests-ran.js +232 -0
- package/build/executor/integration-job.js +56 -2
- package/build/executor/job-runner.js +13 -723
- package/build/executor/job-type-wrappers.js +734 -0
- package/build/executor/merge-job.js +45 -1
- package/build/executor/permissions.js +187 -2
- package/build/executor/preflight.js +6 -2
- package/build/executor/process-containment.js +8 -1
- package/build/executor/provider-checks.js +28 -5
- package/build/executor/reconcile-overlap-job.js +70 -17
- package/build/executor/required-verification.js +28 -2
- package/build/executor/required-work-ledger.js +7 -2
- package/build/executor/resume-pre-spawn.js +32 -8
- package/build/executor/runner.js +30 -5
- package/build/executor/types.js +9 -0
- package/build/executor/worker-database.js +6 -1
- package/build/executor/worker-guard-hook.js +24 -2
- package/build/executor/worktree.js +12 -1
- package/build/generated/ticket-status.js +20 -0
- package/build/index.js +627 -551
- package/build/init.js +16 -0
- package/build/install-bridge-conductor-answers.js +32 -1
- package/build/install-bridge-conductor-apply.js +21 -3
- package/build/install-bridge-conductor-assessment.js +185 -12
- package/build/install-bridge-conductor-compact.js +2 -0
- package/build/install-bridge-conductor-contracts.js +9 -1
- package/build/install-bridge-conductor-gate.js +257 -80
- package/build/install-bridge-conductor-setup.js +106 -6
- package/build/install-bridge-conductor-trial-report.js +170 -0
- package/build/install-bridge-conductor.js +740 -124
- package/build/mcp-host-config.js +54 -37
- package/build/phase-context-git-probe.js +16 -0
- package/build/pipelines.generated.js +15 -15
- package/build/plan-execution-ledger.js +27 -0
- package/build/plan-generation.js +17 -0
- package/build/plane/plane-freshness.js +43 -26
- package/build/printed-remedy-commands.js +62 -0
- package/build/readme.generated.js +1 -1
- package/build/repository-toolchains.js +11 -5
- package/build/scripts/saved-commands-config-field-driver.js +65 -0
- package/build/secret-redaction.js +3 -0
- package/build/setup-epic.js +51 -9
- package/build/test-support/create-preview-world.js +232 -0
- package/build/test-support/executor-source-files.js +1 -1
- package/build/ticket-delivery.js +65 -0
- package/build/v2-readiness-requirements.js +13 -4
- package/build/version.generated.js +3 -3
- package/build/worker-guard-hook-bin.js +2 -2
- package/build/worktree-core.js +51 -7
- package/docs/EPIC-IMPLEMENTER.md +83 -4
- package/docs/epic-implementer/getting-started.md +1 -1
- package/docs/install/github-app.md +79 -92
- package/package.json +1 -1
- package/pipelines/implement-ticket.json +2 -2
- package/build/conductor/epic-reconcile.js +0 -603
- package/build/conductor/epic-runtime.js +0 -2020
- package/build/conductor/epic-state.js +0 -774
package/build/init.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { writeFile, mkdir, readFile, stat, lstat, access, realpath } from "fs/promises";
|
|
13
13
|
import { execFile } from "child_process";
|
|
14
|
+
import { resolveProfiles } from "./mcp-profile.js";
|
|
14
15
|
import path from "path";
|
|
15
16
|
import os from "os";
|
|
16
17
|
import { buildPackagedAssetCatalog } from "./generated-assets-catalog.js";
|
|
@@ -271,6 +272,12 @@ export class DuplicateRegistrationError extends Error {
|
|
|
271
272
|
* half-updated with no record of what moved, which is the same all-or-nothing
|
|
272
273
|
* guarantee `runInit`'s preflight provides.
|
|
273
274
|
*
|
|
275
|
+
* BAPI-1719: an entry that already loads the group, resolved the way the runtime
|
|
276
|
+
* resolves it (`full` and any-case spellings count), is skipped and its file is
|
|
277
|
+
* not rewritten. The raw-token append below is unchanged: it extends the original
|
|
278
|
+
* comma-separated value (`sfcc` becomes `sfcc,epic_implementer`) and never
|
|
279
|
+
* serializes the resolver's expanded set.
|
|
280
|
+
*
|
|
274
281
|
* Returns the final resolved profile string (comma-joined) after merging, or an
|
|
275
282
|
* empty string if no config file was found or updated.
|
|
276
283
|
*
|
|
@@ -327,6 +334,15 @@ export async function mergeBridgeApiProfileToken(cwd, token) {
|
|
|
327
334
|
// ---- Pass 2: apply. Every target here was proven unambiguous above. ----
|
|
328
335
|
let lastProfile = "";
|
|
329
336
|
for (const { fullPath, parsed, entry } of pending) {
|
|
337
|
+
// BAPI-1719: an entry whose stored profile already RESOLVES the group (for
|
|
338
|
+
// example `full`, or any-case `Epic_Implementer`) is left untouched: no
|
|
339
|
+
// rewrite, so its bytes and whitespace are preserved. Uses `mcp-profile.js`
|
|
340
|
+
// directly; `mcp-host-config.ts` imports this file, so the reverse import
|
|
341
|
+
// would be a cycle.
|
|
342
|
+
const storedForCheck = entry.env?.BRIDGE_MCP_PROFILE;
|
|
343
|
+
if (resolveProfiles(typeof storedForCheck === "string" ? storedForCheck : undefined).has(token)) {
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
330
346
|
if (!entry.env)
|
|
331
347
|
entry.env = {};
|
|
332
348
|
const existing = entry.env.BRIDGE_MCP_PROFILE;
|
|
@@ -83,7 +83,14 @@ const OPTION_VOCABULARY = Object.freeze({
|
|
|
83
83
|
approval_exemption: ["approve", "decline", "keep"],
|
|
84
84
|
launch_profile: ["save", "skip"],
|
|
85
85
|
epic_ci_change: ["approve", "decline", "keep"],
|
|
86
|
+
// BAPI-1719: no DEPENDS_ON entry. It is a local write to existing MCP entries.
|
|
87
|
+
tool_visibility: ["approve", "decline", "keep"],
|
|
88
|
+
// BAPI-1526: no DEPENDS_ON entry. It qualifies the gate revision stored in this pass.
|
|
89
|
+
qualify_gate: ["approve", "decline"],
|
|
86
90
|
});
|
|
91
|
+
/** BAPI-1699 — the most commands one `commands` answer may carry, and the longest line. */
|
|
92
|
+
const TEST_COMMANDS_MAX = 4;
|
|
93
|
+
const TEST_COMMAND_MAX_CHARS = 500;
|
|
87
94
|
function isPlainObject(value) {
|
|
88
95
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
89
96
|
}
|
|
@@ -122,11 +129,29 @@ export function parseAnswerValue(key, raw) {
|
|
|
122
129
|
}
|
|
123
130
|
return bad("invalid_value", 'Use "decline", "keep", or a list of offered option ids ([] approves none).');
|
|
124
131
|
}
|
|
132
|
+
if (key === "test_command" && isPlainObject(raw) && Object.hasOwn(raw, "commands")) {
|
|
133
|
+
// BAPI-1699: the whole list or a refusal. The detail is position-based and never
|
|
134
|
+
// echoes a submitted value, and accepted strings are kept exactly as given.
|
|
135
|
+
const shape = 'Use {"commands": ["<one line>", ...]} with one to four commands.';
|
|
136
|
+
if (Object.keys(raw).length !== 1 || !Array.isArray(raw.commands))
|
|
137
|
+
return bad("invalid_value", shape);
|
|
138
|
+
const list = raw.commands;
|
|
139
|
+
if (list.length < 1 || list.length > TEST_COMMANDS_MAX) {
|
|
140
|
+
return bad("invalid_value", `Give between 1 and ${TEST_COMMANDS_MAX} commands.`);
|
|
141
|
+
}
|
|
142
|
+
for (let i = 0; i < list.length; i += 1) {
|
|
143
|
+
const entry = list[i];
|
|
144
|
+
if (typeof entry !== "string" || entry.trim().length === 0 || entry.length > TEST_COMMAND_MAX_CHARS || /[\r\n]/.test(entry)) {
|
|
145
|
+
return bad("invalid_value", `Command ${i + 1} must be one non-blank line of at most ${TEST_COMMAND_MAX_CHARS} characters.`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return { ok: true, decision: { kind: "commands", commands: [...list] } };
|
|
149
|
+
}
|
|
125
150
|
if (key === "test_command" && isPlainObject(raw)) {
|
|
126
151
|
if (onlyKeys(raw, ["command"]) && typeof raw.command === "string" && raw.command.trim().length > 0 && raw.command.length <= 500 && !/[\r\n]/.test(raw.command)) {
|
|
127
152
|
return { ok: true, decision: { kind: "command", command: raw.command.trim() } };
|
|
128
153
|
}
|
|
129
|
-
return bad("invalid_value", 'Use "learn", "skip", "keep", or {"
|
|
154
|
+
return bad("invalid_value", 'Use "learn", "skip", "keep", {"command": "<one line>"}, or {"commands": ["<one line>", ...]}.');
|
|
130
155
|
}
|
|
131
156
|
if (key === "dependency_install" && isPlainObject(raw)) {
|
|
132
157
|
const shape = 'Use "approve", "decline", "keep", or {"entries": [{"cwd": ".", "argv": ["..."], "lockfiles": ["..."]}]}.';
|
|
@@ -239,6 +264,8 @@ function effectFor(key, choice, decision) {
|
|
|
239
264
|
return effects.reference !== undefined ? { ...effects.reference, params: { reference: decision.reference } } : null;
|
|
240
265
|
case "command":
|
|
241
266
|
return { action: "qualify_owner_test_command", target: "repository_gate.local_commands", params: { command: decision.command }, condition: "only_if_check_passes" };
|
|
267
|
+
case "commands":
|
|
268
|
+
return { action: "qualify_saved_test_commands", target: "repository_gate.local_commands", params: { commands: decision.commands }, condition: "only_if_check_passes" };
|
|
242
269
|
case "epic_server_sfcc":
|
|
243
270
|
return effects[decision.value.mode] !== undefined
|
|
244
271
|
? { ...effects[decision.value.mode], params: { ...decision.value } }
|
|
@@ -271,6 +298,10 @@ function consequenceOf(choice, decision) {
|
|
|
271
298
|
}
|
|
272
299
|
if (decision.kind === "command")
|
|
273
300
|
return "Bridge proves your command with one bounded check and stores it only if it passes.";
|
|
301
|
+
if (decision.kind === "commands") {
|
|
302
|
+
const lines = decision.commands.map((command) => `\`${command}\``).join(", ");
|
|
303
|
+
return `Saves your ${decision.commands.length} test command${decision.commands.length === 1 ? "" : "s"} right away, in the order you gave: ${lines}. They are not relied on for the guard until they passed the trial run in a clean checkout.`;
|
|
304
|
+
}
|
|
274
305
|
if (decision.kind === "dependency_install_entries") {
|
|
275
306
|
return decision.entries.length === 0
|
|
276
307
|
? "Stores an empty list: workers and the test trial run no declared install, and managed CI uses its normal toolchain install."
|
|
@@ -14,7 +14,18 @@
|
|
|
14
14
|
* `unattempted`; independent ones still run. Nothing is rolled back.
|
|
15
15
|
* - The setup record is written here and nowhere else, only after approval.
|
|
16
16
|
*/
|
|
17
|
+
import { isTrialPhase, presentTrialResult } from "./install-bridge-conductor-trial-report.js";
|
|
17
18
|
import { SETUP_RECORD_RELATIVE_PATH, } from "./install-bridge-conductor-contracts.js";
|
|
19
|
+
/**
|
|
20
|
+
* What counts as finished (BAPI-1718, the rule for an optional advisory write):
|
|
21
|
+
*
|
|
22
|
+
* - A deliberate skip or an owner's decline is complete. It is `declined` or
|
|
23
|
+
* `unchanged`, and it carries a `reason` that says why nothing was written.
|
|
24
|
+
* - A notice that plans no write adds no apply row, so it cannot affect completion.
|
|
25
|
+
* - A write the owner asked for that cannot finish is incomplete, and it needs an
|
|
26
|
+
* actionable `fix`. That includes a requested write whose required read failed
|
|
27
|
+
* (reported `unattempted`), because "nothing changed" there is not the owner's choice.
|
|
28
|
+
*/
|
|
18
29
|
const NOT_COMPLETED = new Set(["failed", "refused", "uncertain", "unattempted"]);
|
|
19
30
|
const COMPLETE = new Set(["written", "unchanged", "declined"]);
|
|
20
31
|
function unexpectedFailure(key, target) {
|
|
@@ -148,7 +159,7 @@ export function renderSetupRecord(proposal, digest, results) {
|
|
|
148
159
|
lines.push("");
|
|
149
160
|
// BAPI-1677: the approved install commands, once they are confirmed in place. The text comes
|
|
150
161
|
// from the approved proposal, so a replay that finds them unchanged leaves the record alone.
|
|
151
|
-
// An install that worked is not a
|
|
162
|
+
// An install that worked is not a test command that passed the trial run, and a failed trial is not a failed install.
|
|
152
163
|
const installResult = results.find((r) => r.key === "dependency_install");
|
|
153
164
|
const installValue = proposal?.actions.find((a) => a.key === "dependency_install")?.effect?.params?.value;
|
|
154
165
|
if (Array.isArray(installValue) && (installResult?.status === "written" || installResult?.status === "unchanged")) {
|
|
@@ -164,10 +175,16 @@ export function renderSetupRecord(proposal, digest, results) {
|
|
|
164
175
|
const ran = trial?.read_back?.ran;
|
|
165
176
|
if (Array.isArray(ran) && (trial?.status === "written" || trial?.status === "unchanged")) {
|
|
166
177
|
// The command the server reports, never the one Bridge expected to try.
|
|
167
|
-
lines.push("## Test trial", "", `Passed. The
|
|
178
|
+
lines.push("## Test trial", "", `Passed the trial run. The test command is ${ran.map((c) => `\`${c.replace(/`/g, "'")}\``).join(", ")}.`, "");
|
|
168
179
|
}
|
|
169
180
|
else if (trial?.status === "failed" && trial.phase != null) {
|
|
170
|
-
|
|
181
|
+
// BAPI-1698: the same phase-specific presentation every setup path uses.
|
|
182
|
+
const presentation = presentTrialResult({
|
|
183
|
+
phase: isTrialPhase(trial.phase) ? trial.phase : null,
|
|
184
|
+
dependencyInstallDeclared: null,
|
|
185
|
+
});
|
|
186
|
+
lines.push("## Test trial", "", `${presentation.headline}. ${presentation.explanation} No test command was stored. The install commands are unaffected.` +
|
|
187
|
+
(presentation.remedy !== null ? ` Next: ${presentation.remedy}` : ""), "");
|
|
171
188
|
}
|
|
172
189
|
return lines.join("\n");
|
|
173
190
|
}
|
|
@@ -198,6 +215,7 @@ function describeDecision(decision) {
|
|
|
198
215
|
case "selection": return decision.ids.length === 0 ? "none selected" : `${decision.ids.length} selected`;
|
|
199
216
|
case "reference": return decision.reference.kind === "env" ? `reference env:${decision.reference.name}` : `reference credential_store:${decision.reference.target}`;
|
|
200
217
|
case "command": return "owner command";
|
|
218
|
+
case "commands": return `${decision.commands.length} test command${decision.commands.length === 1 ? "" : "s"} given`;
|
|
201
219
|
case "epic_server_sfcc": return decision.value.mode;
|
|
202
220
|
case "profile": return `profile ${decision.name}`;
|
|
203
221
|
case "dependency_install_entries": return decision.entries.length === 0 ? "empty install list" : `${decision.entries.length} install command${decision.entries.length === 1 ? "" : "s"} given`;
|
|
@@ -238,6 +238,8 @@ export function dependencyInstallDetails(input) {
|
|
|
238
238
|
argv: e.argv.map(displayArg),
|
|
239
239
|
lockfiles: e.lockfiles.map(displayArg),
|
|
240
240
|
});
|
|
241
|
+
// BAPI-1698: proposed installs come first; named coverage gaps (from the plan's
|
|
242
|
+
// limitations) follow them. Gaps are advisory and never a prerequisite.
|
|
241
243
|
return {
|
|
242
244
|
commands: input.commands.map(row),
|
|
243
245
|
...(input.differs ? { stored: input.stored.map(row) } : {}),
|
|
@@ -254,15 +256,88 @@ export const LEARN_EFFECT = Object.freeze({
|
|
|
254
256
|
params: Object.freeze({ bounded: true }),
|
|
255
257
|
condition: "only_if_check_passes",
|
|
256
258
|
});
|
|
259
|
+
/** BAPI-1699 — qualify the owner's saved commands; the model is not consulted. */
|
|
260
|
+
export function qualifySavedEffect(saved) {
|
|
261
|
+
return {
|
|
262
|
+
action: "qualify_saved_test_commands",
|
|
263
|
+
target: "repository_gate.local_commands",
|
|
264
|
+
params: { commands: [...saved.commands], generation: saved.generation },
|
|
265
|
+
condition: "only_if_check_passes",
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const SAVED_STATUS_LABEL = Object.freeze({
|
|
269
|
+
not_tried: "Saved; trial not yet run",
|
|
270
|
+
queued: "Trial queued",
|
|
271
|
+
failed: "Trial failed",
|
|
272
|
+
passed: "Passed the trial run",
|
|
273
|
+
});
|
|
274
|
+
/** The factual label for a saved selection's trial state; `null` means the server could not say. */
|
|
275
|
+
export function savedStatusLabel(trialState) {
|
|
276
|
+
return trialState === null ? "Trial could not be read" : SAVED_STATUS_LABEL[trialState] ?? "Trial could not be read";
|
|
277
|
+
}
|
|
278
|
+
function savedDetails(saved) {
|
|
279
|
+
return {
|
|
280
|
+
pending: saved.commands.map(displayArg),
|
|
281
|
+
in_force: (saved.commandsInForce ?? []).map(displayArg),
|
|
282
|
+
status_label: savedStatusLabel(saved.trialState),
|
|
283
|
+
...(saved.setBy !== null ? { set_by: displayArg(saved.setBy) } : {}),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function savedCommandsChoice(t, saved) {
|
|
287
|
+
const details = savedDetails(saved);
|
|
288
|
+
const lines = details.pending.map((command) => `\`${command}\``).join(", ");
|
|
289
|
+
if (saved.trialState === "passed") {
|
|
290
|
+
return {
|
|
291
|
+
id: "test_command",
|
|
292
|
+
family: "test_command",
|
|
293
|
+
answer_key: "test_command",
|
|
294
|
+
current: "stored",
|
|
295
|
+
options: [KEEP_OPTION(`The saved test commands (${lines}) passed the trial run and stay in force.`)],
|
|
296
|
+
recommended: "keep",
|
|
297
|
+
why_recommended: "These commands passed the trial run, so nothing changes.",
|
|
298
|
+
consequential: false,
|
|
299
|
+
applicable: t.ownerCommandSupplied,
|
|
300
|
+
selection: "single",
|
|
301
|
+
test_commands: details,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
const replacing = details.in_force.length > 0;
|
|
305
|
+
return {
|
|
306
|
+
id: "test_command",
|
|
307
|
+
family: "test_command",
|
|
308
|
+
answer_key: "test_command",
|
|
309
|
+
current: "saved_pending",
|
|
310
|
+
options: [
|
|
311
|
+
{
|
|
312
|
+
id: "learn",
|
|
313
|
+
label: `Give the saved test commands a trial run: ${lines}`,
|
|
314
|
+
consequence: `Bridge tries exactly these commands, in this order, in a clean checkout. The model is not consulted. ` +
|
|
315
|
+
(replacing
|
|
316
|
+
? "The guard you have now stays in force until they pass the trial run."
|
|
317
|
+
: "They are relied on for the guard only after they pass the trial run."),
|
|
318
|
+
},
|
|
319
|
+
{ id: "skip", label: "Leave the saved commands untried for now", consequence: "Nothing runs; the commands stay saved and are not in force." },
|
|
320
|
+
],
|
|
321
|
+
recommended: "learn",
|
|
322
|
+
why_recommended: "You or your agent already chose these commands; a trial run proves they work in a clean checkout before anything relies on them.",
|
|
323
|
+
consequential: false,
|
|
324
|
+
applicable: true,
|
|
325
|
+
selection: "single",
|
|
326
|
+
effects: { learn: qualifySavedEffect(saved) },
|
|
327
|
+
test_commands: details,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
257
330
|
function testCommandChoice(t) {
|
|
331
|
+
if (t.saved !== undefined)
|
|
332
|
+
return savedCommandsChoice(t, t.saved);
|
|
258
333
|
const options = [];
|
|
259
334
|
const candidate = t.candidate !== undefined && t.candidate !== null ? displayArg(t.candidate) : null;
|
|
260
335
|
if (t.trialEligible) {
|
|
261
336
|
options.push({
|
|
262
337
|
id: "learn",
|
|
263
|
-
label: candidate !== null ? `Let Bridge learn
|
|
338
|
+
label: candidate !== null ? `Let Bridge learn the test command and give it a trial run (it expects to try ${candidate})` : "Let Bridge learn the test command and give it a trial run",
|
|
264
339
|
consequence: (candidate !== null ? `Bridge expects to try ${candidate} first. ` : "") +
|
|
265
|
-
"Learning stores instructions, not a
|
|
340
|
+
"Learning stores instructions, not a command that has passed the trial run, so they guide the attempt and the server may choose another command. " +
|
|
266
341
|
"It runs one bounded trial and stores a command only if the check passes.",
|
|
267
342
|
});
|
|
268
343
|
}
|
|
@@ -277,9 +352,9 @@ function testCommandChoice(t) {
|
|
|
277
352
|
options,
|
|
278
353
|
recommended: t.trialEligible ? "learn" : t.stored ? "keep" : "skip",
|
|
279
354
|
why_recommended: t.trialEligible
|
|
280
|
-
? "A learned command is stored only after
|
|
355
|
+
? "A learned command is stored only after it passes the trial run, so it cannot weaken the gate."
|
|
281
356
|
: t.stored
|
|
282
|
-
? "A command is already stored and
|
|
357
|
+
? "A command is already stored and passed the trial run, so nothing changes."
|
|
283
358
|
: "There is no test command Bridge can try right now, and setup can still finish without one.",
|
|
284
359
|
consequential: false,
|
|
285
360
|
applicable: t.trialEligible || t.ownerCommandSupplied,
|
|
@@ -314,9 +389,12 @@ function setupPrChoice(pr) {
|
|
|
314
389
|
family: "setup_pr",
|
|
315
390
|
answer_key: "setup_pr",
|
|
316
391
|
current: pr.workflowState,
|
|
317
|
-
options: approveDecline(`
|
|
318
|
-
|
|
319
|
-
|
|
392
|
+
options: approveDecline(`Adds a GitHub check (${EPIC_IMPLEMENTER_CI_CHECK_NAME}) to each epic pull request, running ${runs}. ` +
|
|
393
|
+
"The setup pull request opens only if the check passes, and you must merge it before the first epic. " +
|
|
394
|
+
"Approving also adds that check as a required check.", "Opens no pull request. Bridge's workflow is not added, and the managed check is not made required."),
|
|
395
|
+
// BAPI-1701: the managed workflow is an opt-in. Approving it also adds a required check, so it is offered, not recommended.
|
|
396
|
+
recommended: "decline",
|
|
397
|
+
why_recommended: `Declining avoids the setup pull request and does not add ${EPIC_IMPLEMENTER_CI_CHECK_NAME} as a required check, and you can still approve it for a GitHub check on each epic pull request running ${runs}.`,
|
|
320
398
|
consequential: true,
|
|
321
399
|
applicable: true,
|
|
322
400
|
selection: "single",
|
|
@@ -694,6 +772,65 @@ function epicCiChangeChoice(e) {
|
|
|
694
772
|
effects: { approve: effect },
|
|
695
773
|
};
|
|
696
774
|
}
|
|
775
|
+
/** The effect an approval of the tool-visibility write has. Its params are the approval's binding. */
|
|
776
|
+
export function toolVisibilityEffect(configPaths) {
|
|
777
|
+
return {
|
|
778
|
+
action: "merge_profile_group",
|
|
779
|
+
target: "host_mcp_profile",
|
|
780
|
+
// The group name and the supported config paths only: no stored profile, env, command, or credential.
|
|
781
|
+
params: { group: "epic_implementer", config_paths: [...configPaths].sort() },
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* BAPI-1719 — the local MCP profile merge, an optional-consent choice. Present only
|
|
786
|
+
* when `tool_visibility` is planned, so every proposal where no write is offered keeps
|
|
787
|
+
* its exact decisions, actions, and digest.
|
|
788
|
+
*/
|
|
789
|
+
function toolVisibilityChoice(e) {
|
|
790
|
+
if (e === null || e === undefined || !e.planned)
|
|
791
|
+
return null;
|
|
792
|
+
const where = e.configPaths.length > 0 ? ` in ${e.configPaths.join(", ")}` : "";
|
|
793
|
+
return {
|
|
794
|
+
id: "tool_visibility",
|
|
795
|
+
family: "tool_visibility",
|
|
796
|
+
answer_key: "tool_visibility",
|
|
797
|
+
current: "group_missing",
|
|
798
|
+
options: approveDecline(`Adds the epic_implementer group to the Bridge entry${where}, keeping every group already listed there. It changes only existing entries and creates no file. Restart your MCP client afterward so this session can see the Epic Implementer tools.`, "Leaves every MCP configuration untouched. The Epic Implementer tools stay hidden from your editor until you add the group yourself and restart your MCP client."),
|
|
799
|
+
recommended: "approve",
|
|
800
|
+
why_recommended: "Without this group your editor cannot see the tools that drive an epic, and the change only adds a group to an entry that already exists.",
|
|
801
|
+
consequential: false,
|
|
802
|
+
applicable: true,
|
|
803
|
+
selection: "single",
|
|
804
|
+
effects: { approve: toolVisibilityEffect(e.configPaths) },
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
/** BAPI-1526 — the effect an approval of the gate qualification has. No params: it qualifies the stored revision. */
|
|
808
|
+
export const QUALIFY_GATE_EFFECT = Object.freeze({
|
|
809
|
+
action: "qualify_stored_gate",
|
|
810
|
+
target: "repository_gate.qualification",
|
|
811
|
+
});
|
|
812
|
+
/**
|
|
813
|
+
* BAPI-1526 — run the stored local gate once under the executor, an optional-consent
|
|
814
|
+
* choice. Present only when `qualify_gate` is planned, so every proposal where it is
|
|
815
|
+
* not offered keeps its exact decisions, actions, and digest.
|
|
816
|
+
*/
|
|
817
|
+
function qualifyGateChoice(e) {
|
|
818
|
+
if (e === null || e === undefined || !e.planned)
|
|
819
|
+
return null;
|
|
820
|
+
return {
|
|
821
|
+
id: "qualify_gate",
|
|
822
|
+
family: "qualify_gate",
|
|
823
|
+
answer_key: "qualify_gate",
|
|
824
|
+
current: "unqualified",
|
|
825
|
+
options: approveDecline("Runs the stored local gate commands once now under a short-lived executor, on this machine. A pass qualifies the gate for its current revision; the server then admits unattended runs that rely on it.", "Runs nothing. The gate stays unqualified, so setup ends Not ready and unattended runs that rely on it are refused until it is qualified."),
|
|
826
|
+
recommended: "approve",
|
|
827
|
+
why_recommended: "The local gate must pass once under the executor before an unattended run is admitted, and running it now clears that without another setup pass.",
|
|
828
|
+
consequential: false,
|
|
829
|
+
applicable: true,
|
|
830
|
+
selection: "single",
|
|
831
|
+
effects: { approve: QUALIFY_GATE_EFFECT },
|
|
832
|
+
};
|
|
833
|
+
}
|
|
697
834
|
/**
|
|
698
835
|
* What choosing `include` means, by what is known. Never claims checks run or pass:
|
|
699
836
|
* confirmed coverage says a workflow is configured to start; otherwise it says plainly
|
|
@@ -881,6 +1018,12 @@ export const NO_TESTS_SENTENCE = "Bridge will not require a passing test run bef
|
|
|
881
1018
|
export const TEST_TRIAL_CONDITION = "If the test-command trial does not pass:";
|
|
882
1019
|
/** The next step when nothing is left to do. */
|
|
883
1020
|
export const READY_NEXT_STEP = "Next step: Run /drive-epic-run for an epic.";
|
|
1021
|
+
/**
|
|
1022
|
+
* BAPI-1698 — the next step when everything a run needs is in place and only the
|
|
1023
|
+
* test trial failed. The owner may start now; the warning names the consequence.
|
|
1024
|
+
*/
|
|
1025
|
+
export const GUARDLESS_NEXT_STEP = "Next step: You can start an epic now (run /drive-epic-run for an epic). Until a test command has passed the " +
|
|
1026
|
+
"trial run, epics run without a local test guard.";
|
|
884
1027
|
/**
|
|
885
1028
|
* The one rule for merge-test protection, used for both the proposal's planned value
|
|
886
1029
|
* and the verdict's confirmed value. Returns `undefined` when the evidence does not
|
|
@@ -959,6 +1102,8 @@ const SETTING_LABEL = Object.freeze({
|
|
|
959
1102
|
approval_exemption: "Approval rule",
|
|
960
1103
|
launch_profile: "Launch profile",
|
|
961
1104
|
epic_ci_change: "Epic-branch CI change",
|
|
1105
|
+
tool_visibility: "Epic Implementer tools",
|
|
1106
|
+
qualify_gate: "Gate qualification",
|
|
962
1107
|
setup_record: "Setup record",
|
|
963
1108
|
});
|
|
964
1109
|
const INCOMPLETE_STATUS = new Set(["failed", "refused", "uncertain", "unattempted"]);
|
|
@@ -1024,10 +1169,23 @@ export function buildInstallVerdict(input) {
|
|
|
1024
1169
|
}
|
|
1025
1170
|
if (protection === "none" || protection === "watched_only")
|
|
1026
1171
|
parts.push(NO_TESTS_SENTENCE);
|
|
1027
|
-
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1030
|
-
|
|
1172
|
+
// BAPI-1701: the gate's own fix leads, so an optional setting's generic rerun cannot hide why no gate was stored.
|
|
1173
|
+
const firstFix = (settings.find((s) => s.key === "gate") ?? settings[0])?.fix ?? blockers[0]?.fix;
|
|
1174
|
+
// BAPI-1698: when the ONLY setting that did not take is a completed test trial that
|
|
1175
|
+
// failed, and nothing blocks a run, the owner can start an epic now. Say so, with
|
|
1176
|
+
// the consequence, instead of sending them back to setup.
|
|
1177
|
+
const trialResult = results.find((r) => r.key === "test_command");
|
|
1178
|
+
const onlyFailedTrial = ready === true &&
|
|
1179
|
+
blockers.length === 0 &&
|
|
1180
|
+
settings.length === 1 &&
|
|
1181
|
+
settings[0].key === "test_command" &&
|
|
1182
|
+
trialResult?.status === "failed" &&
|
|
1183
|
+
typeof trialResult.phase === "string";
|
|
1184
|
+
const nextStep = onlyFailedTrial
|
|
1185
|
+
? GUARDLESS_NEXT_STEP
|
|
1186
|
+
: firstFix !== undefined
|
|
1187
|
+
? asNextStep(firstFix)
|
|
1188
|
+
: ready === true ? READY_NEXT_STEP : asNextStep(READINESS_PREREQUISITE_FIXES.doctor);
|
|
1031
1189
|
return {
|
|
1032
1190
|
line: parts.join(" "),
|
|
1033
1191
|
settings_not_applied: settings,
|
|
@@ -1053,6 +1211,8 @@ const CHOICE_QUESTION = Object.freeze({
|
|
|
1053
1211
|
approval_exemption: "Should setup change your GitHub rule so epic work can merge into the epic branch without a person approving each merge?",
|
|
1054
1212
|
launch_profile: "Should setup save these launch settings so later runs can reuse them?",
|
|
1055
1213
|
epic_ci_change: "Should setup open a pull request so your checks also run on pull requests into epic branches?",
|
|
1214
|
+
tool_visibility: "Should setup add the Epic Implementer tools to your editor's MCP configuration (you restart your MCP client afterward)?",
|
|
1215
|
+
qualify_gate: "The local gate must pass once under the executor before an unattended run is admitted. Should setup run it now?",
|
|
1056
1216
|
});
|
|
1057
1217
|
/** Place the choice's question right after its answer key. */
|
|
1058
1218
|
function withQuestion(c) {
|
|
@@ -1129,9 +1289,14 @@ export function resolveEpicBranchCiRecommendation(choices, settled, context = {
|
|
|
1129
1289
|
// Decline: the draft's reason described a delivery the final answers no longer approve. Finalize
|
|
1130
1290
|
// first, then set the reason, so the generic last-resort sentence cannot replace it.
|
|
1131
1291
|
const declined = finalizeRecommendation({ ...withOptions, recommended: "decline" });
|
|
1292
|
+
// BAPI-1701: when the setup pull request is the only way Bridge's workflow arrives and it is not approved,
|
|
1293
|
+
// say what declining leaves out. Anything another approved action supplies is never described as absent.
|
|
1294
|
+
const setupIsSolePath = context.setupSuppliesWorkflow && !setupApproved && !ciApproved && !covers;
|
|
1132
1295
|
return replaceCi({
|
|
1133
1296
|
...declined,
|
|
1134
|
-
why_recommended:
|
|
1297
|
+
why_recommended: setupIsSolePath
|
|
1298
|
+
? `Declining the setup pull request does not add ${EPIC_IMPLEMENTER_CI_CHECK_NAME} as a required check, and no CI change is approved, so child pull requests merge into the epic branch without that check.`
|
|
1299
|
+
: "No workflow is confirmed to run on pull requests into epic branches and no CI change is approved, so child pull requests merge into the epic branch without checks.",
|
|
1135
1300
|
});
|
|
1136
1301
|
}
|
|
1137
1302
|
/** Build the full choice catalog. Every family appears, applicable or not. */
|
|
@@ -1156,6 +1321,14 @@ export function buildInstallChoices(d) {
|
|
|
1156
1321
|
const ciChange = epicCiChangeChoice(d.epicBranchCi);
|
|
1157
1322
|
if (ciChange !== null)
|
|
1158
1323
|
choices.push(ciChange);
|
|
1324
|
+
// BAPI-1719: the local profile merge, after the CI change, only when planned.
|
|
1325
|
+
const toolVisibility = toolVisibilityChoice(d.toolVisibility);
|
|
1326
|
+
if (toolVisibility !== null)
|
|
1327
|
+
choices.push(toolVisibility);
|
|
1328
|
+
// BAPI-1526: the gate qualification, after tool visibility, only when planned.
|
|
1329
|
+
const qualifyGate = qualifyGateChoice(d.qualifyGate);
|
|
1330
|
+
if (qualifyGate !== null)
|
|
1331
|
+
choices.push(qualifyGate);
|
|
1159
1332
|
const built = choices.map((c) => finalizeRecommendation(withQuestion(c)));
|
|
1160
1333
|
// The draft resolves against the complete proposed selection set (recommended approvals as proposals).
|
|
1161
1334
|
return resolveEpicBranchCiRecommendation(built, () => undefined, {
|
|
@@ -27,6 +27,7 @@ function compactChoice(choice) {
|
|
|
27
27
|
...(choice.excluded !== undefined ? { excluded: choice.excluded } : {}),
|
|
28
28
|
...(choice.invalid_existing !== undefined ? { invalid_existing: choice.invalid_existing } : {}),
|
|
29
29
|
...(choice.dependency_install !== undefined ? { dependency_install: choice.dependency_install } : {}),
|
|
30
|
+
...(choice.test_commands !== undefined ? { test_commands: choice.test_commands } : {}),
|
|
30
31
|
...(choice.credential_references !== undefined ? { credential_references: choice.credential_references } : {}),
|
|
31
32
|
};
|
|
32
33
|
}
|
|
@@ -81,6 +82,7 @@ function selectedValue(decision) {
|
|
|
81
82
|
case "profile":
|
|
82
83
|
return "save";
|
|
83
84
|
case "command":
|
|
85
|
+
case "commands":
|
|
84
86
|
case "dependency_install_entries":
|
|
85
87
|
return null;
|
|
86
88
|
}
|
|
@@ -53,6 +53,14 @@ export const INSTALL_ANSWER_KEYS = Object.freeze([
|
|
|
53
53
|
// BAPI-1654 — appended last, so every earlier key keeps its apply position. An
|
|
54
54
|
// older CLI does not know it and refuses an answers file that carries it.
|
|
55
55
|
"epic_ci_change",
|
|
56
|
+
// BAPI-1719 — appended after `epic_ci_change`; every earlier key keeps its apply
|
|
57
|
+
// position and INSTALL_PROPOSAL_DIGEST_VERSION stays 1. An older CLI refuses an
|
|
58
|
+
// answers file that carries it.
|
|
59
|
+
"tool_visibility",
|
|
60
|
+
// BAPI-1526 — appended after `tool_visibility`; every earlier key keeps its apply
|
|
61
|
+
// position and INSTALL_PROPOSAL_DIGEST_VERSION stays 1. An older CLI refuses an
|
|
62
|
+
// answers file that carries it.
|
|
63
|
+
"qualify_gate",
|
|
56
64
|
]);
|
|
57
65
|
/** The worker-setup declarations stored with the gate, each with its own key. */
|
|
58
66
|
export const DECLARATION_ANSWER_KEYS = Object.freeze([
|
|
@@ -66,7 +74,7 @@ export const DECLARATION_ANSWER_KEYS = Object.freeze([
|
|
|
66
74
|
* always KNOWN keys: an answers file may carry them after the evidence moved on,
|
|
67
75
|
* and apply then refuses only the re-index write, never the whole file.
|
|
68
76
|
*/
|
|
69
|
-
export const CONDITIONAL_ANSWER_KEYS = Object.freeze(["reindex_branch", "reindex_retry", "epic_ci_change"]);
|
|
77
|
+
export const CONDITIONAL_ANSWER_KEYS = Object.freeze(["reindex_branch", "reindex_retry", "epic_ci_change", "tool_visibility", "qualify_gate"]);
|
|
70
78
|
export function isInstallAnswerKey(value) {
|
|
71
79
|
return INSTALL_ANSWER_KEYS.includes(value);
|
|
72
80
|
}
|