@bridge_gpt/mcp-server 0.2.75 → 0.2.77
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 +8 -6
- package/build/agents.generated.js +5 -5
- package/build/cli-dispatch.js +333 -0
- package/build/codex-auto-recovery.js +25 -7
- package/build/commands.generated.js +8 -8
- package/build/conductor/bridge-api-client.js +193 -13
- package/build/conductor/declare-blocked.js +146 -7
- package/build/conductor/driver-pass.js +8 -0
- package/build/conductor/driver-register.js +8 -2
- package/build/conductor/epic-implementer-cli.js +15 -10
- package/build/conductor/epic-server-journal.js +52 -22
- 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/install-doctor.js +30 -2
- package/build/conductor/launch-plan.js +28 -7
- package/build/conductor/local-merge.js +55 -13
- package/build/conductor/pr-ci-producer.js +12 -3
- package/build/conductor/readiness-prerequisites.js +89 -2
- package/build/conductor/readiness-sections.js +46 -13
- package/build/conductor/readiness.js +3 -40
- package/build/conductor/recovery-cli.js +14 -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/docs.generated.js +67 -4
- package/build/doctor.js +97 -1
- package/build/drive-epic.js +625 -33
- package/build/engine-paths.js +10 -0
- package/build/epic-coherence-input-cli.js +105 -10
- package/build/epic-coherence-input.js +877 -4
- package/build/epic-coherence-input.test-fixtures.js +117 -0
- package/build/epic-implementer-bin.js +947 -120
- package/build/epic-implementer-env.js +2 -2
- package/build/epic-launch-context.js +8 -1
- package/build/epic-shared/cut-protocol.js +55 -3
- package/build/executor/completion-contract.js +14 -1
- package/build/executor/failure-reason-codes.js +2 -0
- package/build/executor/guarded-fast-forward-push.js +25 -2
- package/build/executor/integration-job.js +56 -2
- package/build/executor/job-runner.js +87 -28
- package/build/executor/likely-tests.js +78 -6
- package/build/executor/merge-job.js +45 -1
- package/build/executor/permissions.js +187 -2
- package/build/executor/provider-checks.js +101 -5
- package/build/executor/rebase-finalization.js +29 -27
- package/build/executor/reconcile-overlap-job.js +70 -17
- package/build/executor/rename-aside.js +265 -0
- package/build/executor/required-work-ledger.js +89 -6
- package/build/executor/resume-pre-spawn.js +32 -8
- package/build/executor/runner.js +26 -4
- package/build/executor/types.js +121 -0
- package/build/executor/worktree.js +39 -2
- package/build/index.js +2500 -495
- package/build/init.js +16 -0
- package/build/install-bridge-conductor-answers.js +4 -0
- package/build/install-bridge-conductor-apply.js +10 -0
- package/build/install-bridge-conductor-assessment.js +84 -0
- package/build/install-bridge-conductor-contracts.js +9 -1
- package/build/install-bridge-conductor-setup.js +103 -3
- package/build/install-bridge-conductor.js +440 -812
- package/build/install-bridge.js +4 -11
- package/build/language-catalog.generated.js +2649 -0
- package/build/mcp-host-config.js +54 -37
- package/build/phase-context-git-probe.js +16 -0
- package/build/pipelines.generated.js +47 -19
- package/build/plan-execution-ledger.js +35 -0
- package/build/plan-generation.js +34 -0
- package/build/plane/build-freshness.js +6 -0
- package/build/plane/cli.js +12 -5
- package/build/plane/plane-freshness.js +43 -26
- package/build/printed-remedy-commands.js +17 -0
- package/build/readiness-prerequisites.generated.js +28 -0
- package/build/readme.generated.js +1 -1
- package/build/run-unit-tests-launcher.js +3 -1
- package/build/secret-redaction.js +3 -0
- package/build/server.js +7946 -0
- package/build/setup-epic.js +41 -8
- package/build/start-tickets-prereqs.js +3 -6
- package/build/test-support/console-guard.js +30 -0
- package/build/test-support/create-preview-world.js +232 -0
- package/build/test-support/module-imports.js +155 -0
- package/build/test-support/server-client.js +96 -0
- package/build/test-support/stdio-server.js +146 -0
- package/build/ticket-delivery.js +65 -0
- package/build/v2-readiness-requirements.js +39 -5
- package/build/version.generated.js +3 -3
- package/build/worktree-core.js +51 -7
- package/docs/EPIC-IMPLEMENTER.md +150 -2
- package/docs/epic-implementer/getting-started.md +5 -1
- package/package.json +3 -3
- package/pipelines/implement-ticket.json +2 -2
- package/pipelines/learn-repository.json +19 -1
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI subcommand dispatch for the `bridge-api-mcp-server` bin.
|
|
3
|
+
*
|
|
4
|
+
* `index.ts` calls `dispatchCliSubcommand(process.argv.slice(2))` before the MCP
|
|
5
|
+
* server module is loaded. A non-null result is the exit code; `null` means
|
|
6
|
+
* start the server. `resolveCliRoute` is the pure routing decision, so tests can
|
|
7
|
+
* check the order of the routes without running any of them.
|
|
8
|
+
*/
|
|
9
|
+
import { runRepairAssetsCli } from "./repair-assets.js";
|
|
10
|
+
import { stat } from "fs/promises";
|
|
11
|
+
import { VERSION, BUILD_COMMIT } from "./version.generated.js";
|
|
12
|
+
import { getTopLevelCliUsage } from "./cli-help.js";
|
|
13
|
+
import { InitPreflightError, runInit } from "./init.js";
|
|
14
|
+
import { runStartTicketsCli } from "./start-tickets.js";
|
|
15
|
+
import { runReviewTicketsCli } from "./review-tickets.js";
|
|
16
|
+
import { runBridgePermissionsCliFromProcess } from "./bridge-permissions.js";
|
|
17
|
+
import { runDoctorCli } from "./doctor.js";
|
|
18
|
+
import { runMcpInvokeCli } from "./mcp-invoke.js";
|
|
19
|
+
import { runWithCredentialsCli } from "./with-credentials.js";
|
|
20
|
+
import { runAgentCapabilitiesCli } from "./agent-capabilities/cli.js";
|
|
21
|
+
import { runExecutorCli, runExecutorInstallServiceCli } from "./executor/index.js";
|
|
22
|
+
import { runExecutorWatchCli } from "./executor/watch-cli.js";
|
|
23
|
+
import { runSetupEpicCli } from "./setup-epic.js";
|
|
24
|
+
import { runDriveEpicCli } from "./drive-epic.js";
|
|
25
|
+
import { runPlaneCli } from "./plane/cli.js";
|
|
26
|
+
import { runEpicImplementerBundleCli } from "./epic-implementer-bundle-cli.js";
|
|
27
|
+
import { runEpicPlanCli } from "./authored-plan.js";
|
|
28
|
+
import { runEpicCoherenceInputCli } from "./epic-coherence-input-cli.js";
|
|
29
|
+
import { runRegressionCheckCli } from "./regression-check.js";
|
|
30
|
+
import { runNotificationsCli } from "./notifications.js";
|
|
31
|
+
import { buildInstallBridgeFailureLines, INSTALL_BRIDGE_DISPATCH_STEP_LABEL, INSTALL_BRIDGE_NO_GIT_PROMPT, INSTALL_BRIDGE_NO_GIT_ABORT, INSTALL_BRIDGE_NO_GIT_NONINTERACTIVE_WARNING, promptLineViaReadline, } from "./install-bridge.js";
|
|
32
|
+
import { hasProjectRootMarker } from "./project-root.js";
|
|
33
|
+
import { runInstallBridgeWithLatestCli } from "./install-reexec.js";
|
|
34
|
+
import { runConnectGithubCli } from "./connect-github.js";
|
|
35
|
+
import { runConnectBitbucketCli } from "./connect-bitbucket.js";
|
|
36
|
+
import { runUpgradeCli } from "./upgrade-cli.js";
|
|
37
|
+
import { runCredentialsCli } from "./credentials-cli.js";
|
|
38
|
+
import { runEpicImplementerCli } from "./conductor/epic-implementer-cli.js";
|
|
39
|
+
import { runCheckUpdateCli } from "./check-update-cli.js";
|
|
40
|
+
function createDefaultRunInitCliDeps() {
|
|
41
|
+
const isTTY = Boolean(process.stdin.isTTY);
|
|
42
|
+
return {
|
|
43
|
+
stat,
|
|
44
|
+
isTTY,
|
|
45
|
+
promptLine: isTTY ? promptLineViaReadline : undefined,
|
|
46
|
+
// BAPI-668/BAPI-818: index.ts writes NO diagnostic to stdout other than the
|
|
47
|
+
// `--version` exception — stdout carries the MCP stdio protocol once the
|
|
48
|
+
// server starts, and every dispatched CLI subcommand's own output goes to
|
|
49
|
+
// stderr uniformly regardless of success/failure. `log` follows that
|
|
50
|
+
// convention rather than `install`'s own `log` (which targets stdout).
|
|
51
|
+
log: (line) => console.error(line),
|
|
52
|
+
errorLog: (line) => console.error(line),
|
|
53
|
+
runInit,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Run the ``--init`` scaffolding flow. Returns a process exit code.
|
|
58
|
+
*
|
|
59
|
+
* BAPI-818 (R1): `--init` used to hard-require a `package.json` — a guard
|
|
60
|
+
* inherited from the old inline `--upgrade`, which genuinely ran
|
|
61
|
+
* `npm i @bridge_gpt/mcp-server@latest` and so genuinely needed one. `--upgrade`
|
|
62
|
+
* was rebuilt (BAPI-430/728) to stop needing a manifest at all, and `--init`'s
|
|
63
|
+
* own scaffolding (`runInit`) never read `package.json` in the first place — so
|
|
64
|
+
* the requirement was stale, not load-bearing, and blocked every non-Node
|
|
65
|
+
* repository (SFCC cartridges, Python, Go, Rust, polyglot monorepos) from the
|
|
66
|
+
* documented manual setup path. `--init` now shares ONE project-root definition
|
|
67
|
+
* with `install` (`project-root.ts`'s `.git` probe) and the SAME missing-marker
|
|
68
|
+
* confirmation policy — same prompt text, same default-No, same non-interactive
|
|
69
|
+
* warn-and-continue, same TTY/non-TTY exit semantics.
|
|
70
|
+
*/
|
|
71
|
+
export async function runInitCli(cwd, overrides = {}) {
|
|
72
|
+
const deps = { ...createDefaultRunInitCliDeps(), ...overrides };
|
|
73
|
+
if (!(await hasProjectRootMarker(cwd, deps.stat))) {
|
|
74
|
+
if (deps.isTTY && deps.promptLine) {
|
|
75
|
+
let answer = "";
|
|
76
|
+
try {
|
|
77
|
+
answer = (await deps.promptLine(INSTALL_BRIDGE_NO_GIT_PROMPT)).trim().toLowerCase();
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// A prompt that cannot be read is NOT confirmation. Never infer it — the
|
|
81
|
+
// default is No, so a malformed or failed read takes the abort path.
|
|
82
|
+
answer = "";
|
|
83
|
+
}
|
|
84
|
+
if (answer !== "y" && answer !== "yes") {
|
|
85
|
+
deps.log(INSTALL_BRIDGE_NO_GIT_ABORT);
|
|
86
|
+
// Exit 0: the user cancelled, and nothing was resolved, written, or spent.
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// Automation compatibility: warn, never prompt, never abort.
|
|
92
|
+
deps.errorLog(INSTALL_BRIDGE_NO_GIT_NONINTERACTIVE_WARNING);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
// BAPI-728: a run that scaffolded successfully but produced a config that
|
|
97
|
+
// authenticates as nobody is NOT a success. `runInit` already printed the
|
|
98
|
+
// path-specific warning; exiting non-zero stops a caller (or a CI step) from
|
|
99
|
+
// treating "files were written" as "the MCP is configured".
|
|
100
|
+
const result = await deps.runInit(cwd);
|
|
101
|
+
return result.ok ? 0 : 1;
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
// A deliberate preflight refusal is safe to show and the user needs it: each
|
|
105
|
+
// failure is a repo-relative path plus a reason from init's fixed table.
|
|
106
|
+
if (err instanceof InitPreflightError) {
|
|
107
|
+
deps.errorLog("Bridge API --init failed: these MCP launcher configs cannot be safely reconciled:");
|
|
108
|
+
for (const failure of err.failures)
|
|
109
|
+
deps.errorLog(` ${failure.relPath}: ${failure.reason}`);
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
// Any other thrown message can carry a credential or a path, so it is never printed:
|
|
113
|
+
// only a fixed line plus the error's class name and, when it is a short
|
|
114
|
+
// identifier, its code.
|
|
115
|
+
deps.errorLog(`Bridge API --init failed: an unexpected error occurred (${describeInitError(err)}).`);
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** The class name and a safe `code` of a thrown value, never its message. */
|
|
120
|
+
function describeInitError(err) {
|
|
121
|
+
const name = err instanceof Error && /^[A-Za-z][A-Za-z0-9_]{0,63}$/.test(err.name) ? err.name : "unknown error";
|
|
122
|
+
const code = err?.code;
|
|
123
|
+
return typeof code === "string" && /^[A-Z][A-Z0-9_]{0,31}$/.test(code) ? `${name}, ${code}` : name;
|
|
124
|
+
}
|
|
125
|
+
// Positional subcommands that take the rest of argv after their one token, in
|
|
126
|
+
// routing order. The executor sub-verbs and the renamed tokens are matched
|
|
127
|
+
// separately in `resolveCliRoute` at their place in this order.
|
|
128
|
+
const EXECUTOR_SUBVERBS = ["watch", "install-service", "uninstall-service"];
|
|
129
|
+
/**
|
|
130
|
+
* Decide which route `argv` takes, without running anything. `null` means
|
|
131
|
+
* start the MCP server (a bare run, or `serve`).
|
|
132
|
+
*
|
|
133
|
+
* The order is the contract:
|
|
134
|
+
* - `repair-assets` first, then `--help` / `-h` (only when it is the only token).
|
|
135
|
+
* - Every positional subcommand before the flag checks.
|
|
136
|
+
* - `executor watch|install-service|uninstall-service` before plain `executor`,
|
|
137
|
+
* which would otherwise reject the sub-verb as an unknown argument.
|
|
138
|
+
* - `emit-conductor-bundle` and bare `conductor` are renamed tokens: they fail
|
|
139
|
+
* with a pointer and never reach the renamed command.
|
|
140
|
+
* - `install` and its legacy spelling `install-bridge` share one route, the only
|
|
141
|
+
* one that reaches the npm registry.
|
|
142
|
+
* - `serve` drops its own token and keeps going, so `serve` alone starts the
|
|
143
|
+
* server and `serve --version` prints the version.
|
|
144
|
+
* - `--version`, then `--init` (wins over `--upgrade`), then `--upgrade`.
|
|
145
|
+
* - Any other positional token is rejected last.
|
|
146
|
+
*/
|
|
147
|
+
export function resolveCliRoute(argv) {
|
|
148
|
+
const first = argv[0];
|
|
149
|
+
const rest = argv.slice(1);
|
|
150
|
+
if (first === "repair-assets")
|
|
151
|
+
return { id: "repair-assets", args: rest };
|
|
152
|
+
if (argv.length === 1 && (first === "--help" || first === "-h"))
|
|
153
|
+
return { id: "help", args: [] };
|
|
154
|
+
switch (first) {
|
|
155
|
+
case "start-tickets":
|
|
156
|
+
case "review-tickets":
|
|
157
|
+
case "mcp-invoke":
|
|
158
|
+
case "with-credentials":
|
|
159
|
+
case "check-update":
|
|
160
|
+
case "doctor":
|
|
161
|
+
case "bridge-permissions":
|
|
162
|
+
case "agent-capabilities":
|
|
163
|
+
case "notifications":
|
|
164
|
+
return { id: first, args: rest };
|
|
165
|
+
}
|
|
166
|
+
if (first === "executor" && EXECUTOR_SUBVERBS.includes(argv[1] ?? "")) {
|
|
167
|
+
return { id: `executor ${argv[1]}`, args: argv.slice(2) };
|
|
168
|
+
}
|
|
169
|
+
switch (first) {
|
|
170
|
+
case "worktrees":
|
|
171
|
+
case "executor":
|
|
172
|
+
case "setup-epic":
|
|
173
|
+
case "drive-epic":
|
|
174
|
+
case "plane":
|
|
175
|
+
return { id: first, args: rest };
|
|
176
|
+
case "emit-conductor-bundle":
|
|
177
|
+
return { id: "emit-conductor-bundle (renamed)", args: rest };
|
|
178
|
+
case "emit-epic-implementer-bundle":
|
|
179
|
+
case "epic-plan":
|
|
180
|
+
case "regression-check":
|
|
181
|
+
case "epic-coherence-input":
|
|
182
|
+
case "credentials":
|
|
183
|
+
return { id: first, args: rest };
|
|
184
|
+
case "conductor":
|
|
185
|
+
return { id: "conductor (renamed)", args: rest };
|
|
186
|
+
case "epic-implementer":
|
|
187
|
+
return { id: first, args: rest };
|
|
188
|
+
case "install-bridge":
|
|
189
|
+
case "install":
|
|
190
|
+
return { id: "install", args: rest };
|
|
191
|
+
case "connect-github":
|
|
192
|
+
case "connect-bitbucket":
|
|
193
|
+
case "upgrade":
|
|
194
|
+
return { id: first, args: rest };
|
|
195
|
+
}
|
|
196
|
+
const flags = first === "serve" ? rest : argv.slice();
|
|
197
|
+
if (flags.includes("--version"))
|
|
198
|
+
return { id: "--version", args: [] };
|
|
199
|
+
if (flags.includes("--init"))
|
|
200
|
+
return { id: "--init", args: [] };
|
|
201
|
+
// --upgrade passes every argument on, so flags like --dry-run are forwarded.
|
|
202
|
+
if (flags.includes("--upgrade"))
|
|
203
|
+
return { id: "--upgrade", args: flags };
|
|
204
|
+
if (flags.length > 0 && !flags[0].startsWith("-"))
|
|
205
|
+
return { id: "unknown-subcommand", args: [flags[0]] };
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
async function writeStdout(text) {
|
|
209
|
+
await new Promise((resolve, reject) => {
|
|
210
|
+
process.stdout.write(text, (error) => {
|
|
211
|
+
if (error) {
|
|
212
|
+
reject(error);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
resolve();
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Run one resolved route and return its exit code. Every route writes its own
|
|
221
|
+
* diagnostics to stderr; only `--help`, `--version` and the subcommands that own
|
|
222
|
+
* their stdout write there.
|
|
223
|
+
*/
|
|
224
|
+
export async function runCliRoute(route) {
|
|
225
|
+
const { args } = route;
|
|
226
|
+
switch (route.id) {
|
|
227
|
+
case "repair-assets":
|
|
228
|
+
return runRepairAssetsCli(args);
|
|
229
|
+
case "help":
|
|
230
|
+
await writeStdout(getTopLevelCliUsage());
|
|
231
|
+
return 0;
|
|
232
|
+
case "start-tickets":
|
|
233
|
+
return runStartTicketsCli(args);
|
|
234
|
+
case "review-tickets":
|
|
235
|
+
return runReviewTicketsCli(args);
|
|
236
|
+
case "mcp-invoke":
|
|
237
|
+
return runMcpInvokeCli(args);
|
|
238
|
+
case "with-credentials":
|
|
239
|
+
return runWithCredentialsCli(args);
|
|
240
|
+
case "check-update":
|
|
241
|
+
return runCheckUpdateCli(args);
|
|
242
|
+
case "doctor":
|
|
243
|
+
return runDoctorCli(args);
|
|
244
|
+
case "bridge-permissions":
|
|
245
|
+
return runBridgePermissionsCliFromProcess(args);
|
|
246
|
+
case "agent-capabilities":
|
|
247
|
+
return runAgentCapabilitiesCli(args);
|
|
248
|
+
case "notifications":
|
|
249
|
+
return runNotificationsCli(args);
|
|
250
|
+
case "executor watch":
|
|
251
|
+
return runExecutorWatchCli(args);
|
|
252
|
+
case "executor install-service":
|
|
253
|
+
return runExecutorInstallServiceCli(args);
|
|
254
|
+
case "executor uninstall-service": {
|
|
255
|
+
const { runExecutorUninstallServiceCli } = await import("./executor/service-uninstall.js");
|
|
256
|
+
return runExecutorUninstallServiceCli(args);
|
|
257
|
+
}
|
|
258
|
+
case "worktrees": {
|
|
259
|
+
const { runWorktreesCli } = await import("./worktrees.js");
|
|
260
|
+
return runWorktreesCli(args);
|
|
261
|
+
}
|
|
262
|
+
case "executor":
|
|
263
|
+
return runExecutorCli(args);
|
|
264
|
+
case "setup-epic":
|
|
265
|
+
return runSetupEpicCli(args);
|
|
266
|
+
case "drive-epic":
|
|
267
|
+
return runDriveEpicCli(args);
|
|
268
|
+
case "plane":
|
|
269
|
+
return runPlaneCli(args);
|
|
270
|
+
case "emit-conductor-bundle (renamed)":
|
|
271
|
+
process.stderr.write("'emit-conductor-bundle' was renamed to 'emit-epic-implementer-bundle'. Run 'emit-epic-implementer-bundle ...' instead.\n");
|
|
272
|
+
return 1;
|
|
273
|
+
case "emit-epic-implementer-bundle":
|
|
274
|
+
return runEpicImplementerBundleCli(args);
|
|
275
|
+
case "epic-plan":
|
|
276
|
+
return runEpicPlanCli(args);
|
|
277
|
+
case "regression-check":
|
|
278
|
+
return runRegressionCheckCli(args);
|
|
279
|
+
case "epic-coherence-input":
|
|
280
|
+
return runEpicCoherenceInputCli(args);
|
|
281
|
+
case "credentials":
|
|
282
|
+
return runCredentialsCli(args);
|
|
283
|
+
case "conductor (renamed)":
|
|
284
|
+
process.stderr.write("'conductor' was renamed to 'epic-implementer'. Run 'epic-implementer ...' instead.\n");
|
|
285
|
+
return 1;
|
|
286
|
+
case "epic-implementer":
|
|
287
|
+
return runEpicImplementerCli(args);
|
|
288
|
+
case "install":
|
|
289
|
+
// BAPI-668: a last-resort catch scoped to the installer only, so a
|
|
290
|
+
// first-time user never sees a raw Node stack. It uses the same
|
|
291
|
+
// secret-safe formatter as the installer; the raw message appears only
|
|
292
|
+
// under BAPI_INSTALL_DEBUG. Not a process-global handler: that would hide
|
|
293
|
+
// real server runtime failures.
|
|
294
|
+
try {
|
|
295
|
+
return await runInstallBridgeWithLatestCli(args);
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
const lines = buildInstallBridgeFailureLines(error, {
|
|
299
|
+
step: INSTALL_BRIDGE_DISPATCH_STEP_LABEL,
|
|
300
|
+
debugEnabled: Boolean(process.env.BAPI_INSTALL_DEBUG),
|
|
301
|
+
});
|
|
302
|
+
for (const line of lines)
|
|
303
|
+
console.error(line);
|
|
304
|
+
return 1;
|
|
305
|
+
}
|
|
306
|
+
case "connect-github":
|
|
307
|
+
return runConnectGithubCli(args);
|
|
308
|
+
case "connect-bitbucket":
|
|
309
|
+
return runConnectBitbucketCli(args);
|
|
310
|
+
case "upgrade":
|
|
311
|
+
return runUpgradeCli(args);
|
|
312
|
+
case "--version":
|
|
313
|
+
// BAPI-873: the first line stays the bare semver (a parsed contract); the
|
|
314
|
+
// build commit is on a labelled second line.
|
|
315
|
+
console.log(`${VERSION}\ncommit: ${BUILD_COMMIT}`);
|
|
316
|
+
return 0;
|
|
317
|
+
case "--init":
|
|
318
|
+
return runInitCli(process.cwd());
|
|
319
|
+
case "--upgrade":
|
|
320
|
+
return runUpgradeCli(args);
|
|
321
|
+
case "unknown-subcommand":
|
|
322
|
+
console.error(`Error: Unknown subcommand '${args[0]}'. Run with --help for usage, or omit subcommands to start the MCP server.`);
|
|
323
|
+
return 1;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Route CLI subcommands before MCP server startup. Returns an exit code to exit
|
|
328
|
+
* the process with, or `null` to continue to normal MCP server startup.
|
|
329
|
+
*/
|
|
330
|
+
export async function dispatchCliSubcommand(argv) {
|
|
331
|
+
const route = resolveCliRoute(argv);
|
|
332
|
+
return route === null ? null : runCliRoute(route);
|
|
333
|
+
}
|
|
@@ -19,7 +19,8 @@ Codex-only exceptions, rather than letting its immediate-stop wording cancel the
|
|
|
19
19
|
In particular, the recipe preamble's on_error "halt"
|
|
20
20
|
means stop after the applicable recovery below fails, not on its first recoverable
|
|
21
21
|
attempt. It does not make any failed mandatory step optional. All other stop
|
|
22
|
-
conditions, ownership rules,
|
|
22
|
+
conditions, ownership rules, and approvals remain authoritative. Exhausted recovery
|
|
23
|
+
attempts are not a terminal outcome for the worker's own unfinished work.
|
|
23
24
|
Continue from the recovered step; never restart a full command, rerun completed
|
|
24
25
|
review decisions, or launch another worker as recovery.
|
|
25
26
|
|
|
@@ -89,8 +90,9 @@ review decisions, or launch another worker as recovery.
|
|
|
89
90
|
This does not extend existing rendered-UI cycles. Preserve failure history and
|
|
90
91
|
report the actual final observation at its head; only a successful rerun proves
|
|
91
92
|
a fix. Never label an assertion failure as a missing capability or weaken a
|
|
92
|
-
test. When recovery fails, retain unresolved
|
|
93
|
-
|
|
93
|
+
test. When recovery fails, retain the unresolved failure, record the remaining
|
|
94
|
+
obligation honestly under the continuation rule below, and continue other
|
|
95
|
+
authorized work. Publication/readiness holds remain in force.
|
|
94
96
|
5. **Current-head CI/review corrections.** Only in monitor-ci-checks.md's configured
|
|
95
97
|
fix_and_iterate branch (Step 6), item 10 also owns actionable changes_requested findings
|
|
96
98
|
from an authoritative required review for the CURRENT head, even when the
|
|
@@ -120,7 +122,23 @@ gates, authentication/authorization failures, file ownership, publication/readin
|
|
|
120
122
|
holds, commit/push guards, or terminal server states. Never force-push, disable
|
|
121
123
|
hooks/tests, alter gate policy, or re-enter implement-ticket/planning for CI fixes.
|
|
122
124
|
|
|
123
|
-
When recovery is exhausted
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
When a recovery strategy is exhausted, that ends the strategy, not the session. Unsafe
|
|
126
|
+
recovery still stops the affected operation. Re-entering a command, nesting a workflow,
|
|
127
|
+
or relabeling a failure never resets the combined two-attempt retry budget. The worker
|
|
128
|
+
retains the unresolved result and continues independent authorized work; with none
|
|
129
|
+
left, it follows the outside-blocker or host-forced-end rule below without
|
|
130
|
+
manufacturing a gap or claiming completion. The continuation rule governs
|
|
131
|
+
implementation work only: it authorizes no implementation or publication in a
|
|
132
|
+
review-only workflow.
|
|
133
|
+
|
|
134
|
+
<!-- BEGIN BRIDGE WORKER CONTINUATION RULE -->
|
|
135
|
+
**Continue, reconsider, or record an honest gap**
|
|
136
|
+
|
|
137
|
+
- **A hold that lists your own (\`self_recorded\`) blockers is not the end of the run.** Finish your own unfinished work, record it with \`record_phase_result\`, and call \`create_pull_request\` again.
|
|
138
|
+
- **Before recording any step as escalated or cannot-do, reconsider once.** Try a corrected command, a disposable fixture or local service, an equivalent check, or a CI-covered deferral, using capabilities already provisioned for this repository. Never search for or obtain credentials.
|
|
139
|
+
- **If a review or verification step truly can't be done, record an honest gap and continue other work.** Running out of budget never makes unfinished implementation, unwritten tests, or failing assertions gap-eligible.
|
|
140
|
+
- **Never mark a step \`executed\` that you didn't run or write.**
|
|
141
|
+
- **An incomplete run ends only on an observed outside blocker or a host-forced end.** Before a forced end, commit, push, and call \`record_checkpoint\`. A person running the session can always stop it. Normal completion and existing safety stops still apply. Open a PR only through \`create_pull_request\`'s readiness check.
|
|
142
|
+
<!-- END BRIDGE WORKER CONTINUATION RULE -->
|
|
143
|
+
|
|
144
|
+
Never claim completion or advance past a failed mandatory step.\n`;
|