@bridge_gpt/mcp-server 0.2.72 → 0.2.73
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 +5 -5
- package/build/agent-launchers/claude-executor-adapter.js +3 -0
- package/build/agents.generated.js +6 -6
- package/build/bridge-permissions.js +27 -0
- package/build/ci-system-detection.js +50 -0
- package/build/ci-trigger-adapters.js +631 -0
- package/build/ci-trigger-install.js +106 -0
- package/build/codex-launcher-pin.js +33 -2
- package/build/codex-skill-adapter.js +3 -1
- package/build/command-host.js +33 -0
- package/build/commands.generated.js +7 -6
- package/build/conductor/bridge-api-client.js +842 -35
- package/build/conductor/bring-up-facts.js +18 -5
- package/build/conductor/command-drift-production.js +42 -17
- package/build/conductor/command-drift.js +47 -0
- package/build/conductor/declare-blocked.js +554 -0
- package/build/conductor/doctor.js +106 -21
- package/build/conductor/driver-commands.js +141 -0
- package/build/conductor/driver-guard.js +277 -0
- package/build/conductor/driver-lapse.js +321 -0
- package/build/conductor/driver-register.js +176 -0
- package/build/conductor/driver-release.js +174 -0
- package/build/conductor/driver-session-state.js +315 -0
- package/build/conductor/epic-branch-ci-inspection.js +222 -29
- package/build/conductor/epic-implementer-cli.js +166 -15
- package/build/conductor/epic-server-database.js +162 -0
- package/build/conductor/epic-server-guidance.js +278 -0
- package/build/conductor/epic-server-journal.js +239 -0
- package/build/conductor/epic-server-processes.js +324 -0
- package/build/conductor/epic-server-recipe.js +397 -0
- package/build/conductor/epic-server-runtime.js +1207 -0
- package/build/conductor/epic-server-sfcc.js +107 -0
- package/build/conductor/epic-server-state.js +427 -0
- package/build/conductor/epic-server.js +594 -0
- package/build/conductor/gate-discovery.js +150 -5
- package/build/conductor/gate-settings-review.js +224 -4
- package/build/conductor/launch-need-probes.js +6 -53
- package/build/conductor/launch-plan.js +313 -156
- package/build/conductor/prerequisite-inputs.js +879 -45
- package/build/conductor/readiness-assessment.js +16 -1
- package/build/conductor/readiness-cli.js +20 -9
- package/build/conductor/readiness-prerequisites.js +28 -9
- package/build/conductor/readiness-sections.js +133 -126
- package/build/conductor/readiness.js +1 -1
- package/build/conductor/recovery-cli.js +13 -2
- package/build/conductor/tools.js +6 -5
- package/build/conductor/wait-run-attention.js +2 -2
- package/build/conductor/wait-run-cli.js +208 -22
- package/build/conductor/worker-database-doctor-inspector.js +33 -2
- package/build/conductor/worker-setup-tally.js +27 -0
- package/build/credential-store.js +71 -1
- package/build/dependency-install-declarations.js +55 -0
- package/build/docs.generated.js +2 -2
- package/build/doctor.js +54 -3
- package/build/drive-epic-help.js +21 -2
- package/build/drive-epic.js +1811 -351
- package/build/engine-paths.js +20 -0
- package/build/epic-branch-ci-summary.js +140 -0
- package/build/epic-capability-statement.js +107 -0
- package/build/epic-ci-workflow-drift.js +30 -15
- package/build/epic-ci-workflow-install.js +110 -42
- package/build/epic-ci-workflow-v2.js +274 -0
- package/build/epic-ci-workflow.js +38 -12
- package/build/epic-implementer-bin.js +2101 -44
- package/build/epic-launch-context.js +607 -0
- package/build/epic-server-record.js +273 -0
- package/build/epic-shared/bridge-client.js +11 -3
- package/build/escalation-reachability.js +43 -0
- package/build/executor/ci-fix-test-runs.js +334 -0
- package/build/executor/completion-contract.js +8 -1
- package/build/executor/env.js +59 -22
- package/build/executor/epic-server-context.js +141 -0
- package/build/executor/gate-qualification-job.js +127 -26
- package/build/executor/http-client.js +52 -5
- package/build/executor/job-runner.js +423 -69
- package/build/executor/observation.js +8 -0
- package/build/executor/pre-pr-checks.js +363 -0
- package/build/executor/prompt-spec.js +114 -2
- package/build/executor/reconcile-overlap-job.js +5 -3
- package/build/executor/required-work-diagnostics.js +4 -2
- package/build/executor/required-work-ledger.js +936 -38
- package/build/executor/results.js +58 -0
- package/build/executor/terminal-mutation.js +8 -0
- package/build/executor/worker-command.js +72 -3
- package/build/executor/worker-database-config.js +281 -0
- package/build/executor/worker-database-target.js +16 -12
- package/build/executor/worker-database.js +320 -101
- package/build/executor/worker-finalization.js +7 -1
- package/build/executor/worker-resources.js +25 -3
- package/build/executor/worker-verification-guidance.js +18 -3
- package/build/executor/worktree.js +20 -1
- package/build/executor-launch.js +54 -2
- package/build/generated-assets-catalog.js +2 -2
- package/build/index.js +664 -335
- package/build/init.js +26 -11
- package/build/install-bridge-conductor-answers.js +465 -0
- package/build/install-bridge-conductor-apply.js +259 -0
- package/build/install-bridge-conductor-assessment.js +895 -0
- package/build/install-bridge-conductor-compact.js +161 -0
- package/build/install-bridge-conductor-contracts.js +63 -0
- package/build/install-bridge-conductor-gate.js +1197 -196
- package/build/install-bridge-conductor-setup.js +535 -79
- package/build/install-bridge-conductor.js +2885 -560
- package/build/install-bridge.js +199 -21
- package/build/install-maintenance.js +26 -3
- package/build/launcher-config-inspection.js +162 -1
- package/build/mcp-grant-candidates.js +767 -0
- package/build/mcp-grant-doctor.js +63 -0
- package/build/mcp-grant.js +288 -0
- package/build/mcp-host-targets.js +8 -0
- package/build/mcp-identity.js +23 -0
- package/build/mcp-invoke.js +126 -13
- package/build/mcp-presets.js +107 -0
- package/build/mcp-provisioning.js +134 -2
- package/build/mcp-registration-doctor.js +31 -2
- package/build/mcp-server-invocation.js +6 -1
- package/build/merge-workflow-install.js +234 -109
- package/build/pipelines.generated.js +5 -5
- package/build/plan-discovery.js +97 -4
- package/build/plan-execution-ledger.js +100 -7
- package/build/plan-generation-io.js +262 -0
- package/build/plan-generation.js +424 -0
- package/build/plane/build-freshness.js +6 -1
- package/build/plane/cli.js +75 -9
- package/build/plane/plane-freshness.js +17 -0
- package/build/plane/preflight.js +50 -10
- package/build/plane/shutdown.js +19 -0
- package/build/plane/terminal-run-cleanup.js +18 -4
- package/build/printed-remedy-commands.js +206 -12
- package/build/readiness-check.js +77 -0
- package/build/readiness-prerequisites.generated.js +122 -14
- package/build/readme.generated.js +1 -1
- package/build/repository-state-paths.js +38 -0
- package/build/run-unit-tests-launcher.js +8 -1
- package/build/setup-epic.js +1190 -196
- package/build/setup-progress.js +44 -0
- package/build/setup-question.js +122 -4
- package/build/third-party-mcp-targets.js +30 -0
- package/build/ticket-delivery-enrollment.js +9 -0
- package/build/upgrade-cli.js +85 -2
- package/build/v2-readiness-requirements.js +28 -1
- package/build/version.generated.js +3 -3
- package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
- package/docs/epic-implementer/getting-started.md +3 -1
- package/docs/epic-implementer/self-hosting.md +14 -1
- package/package.json +2 -2
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The FROZEN version-2 Epic Implementer CI workflow renderer (BAPI-1603).
|
|
3
|
+
*
|
|
4
|
+
* Version 2 (BAPI-1536) added toolchain provisioning and triggered on every
|
|
5
|
+
* `pull_request`. Version 3 restricts the trigger to epic-targeted pull requests
|
|
6
|
+
* (`branches: ['epic/**']`). Customers hold files this renderer wrote, and the
|
|
7
|
+
* drift classifier recognizes such a file only by reproducing its ENTIRE bytes,
|
|
8
|
+
* so this module is a published contract: its output for a given command and
|
|
9
|
+
* toolchain set must never change, whatever happens to the current renderer
|
|
10
|
+
* (`epic-ci-workflow.ts`). It therefore owns every literal it emits — the action
|
|
11
|
+
* pins, the fallback versions, the timeouts, and the header text — and imports
|
|
12
|
+
* nothing from the current renderer. Only the validators and the canonical
|
|
13
|
+
* toolchain serializer are shared, and a change to either of those is a
|
|
14
|
+
* compatibility break for every renderer version, not only this one.
|
|
15
|
+
*
|
|
16
|
+
* Do not edit this file to change what the workflow does. A behavior change is a
|
|
17
|
+
* new renderer version in `epic-ci-workflow.ts`, with this function left as is.
|
|
18
|
+
*
|
|
19
|
+
* Leaf module: no filesystem, network, or subprocess access.
|
|
20
|
+
*/
|
|
21
|
+
import { serializeRepositoryToolchains, validateRepositoryToolchains, } from "./repository-toolchains.js";
|
|
22
|
+
import { validateTestCommand } from "./test-command-validation.js";
|
|
23
|
+
/** Repository-relative path of the managed workflow, as version 2 wrote it. */
|
|
24
|
+
const V2_WORKFLOW_PATH = ".github/workflows/epic-implementer-ci.yml";
|
|
25
|
+
/** The renderer version version 2 wrote into its header. */
|
|
26
|
+
const V2_RENDERER_VERSION = 2;
|
|
27
|
+
/** The header marker keys version 2 used. */
|
|
28
|
+
const V2_VERSION_MARKER_KEY = "x-bridge-ci-renderer-version";
|
|
29
|
+
const V2_TOOLCHAINS_MARKER_KEY = "x-bridge-ci-toolchains";
|
|
30
|
+
/** The `name:` of the one step that runs the stored command. */
|
|
31
|
+
const V2_COMMAND_STEP_NAME = "Run the stored test command";
|
|
32
|
+
/** The pinned action majors version 2 wrote. */
|
|
33
|
+
const V2_ACTION_CHECKOUT = "actions/checkout@v7";
|
|
34
|
+
const V2_ACTION_SETUP_NODE = "actions/setup-node@v7";
|
|
35
|
+
const V2_ACTION_SETUP_PYTHON = "actions/setup-python@v7";
|
|
36
|
+
const V2_ACTION_SETUP_GO = "actions/setup-go@v6";
|
|
37
|
+
const V2_ACTION_SETUP_PNPM = "pnpm/action-setup@v4";
|
|
38
|
+
const V2_ACTION_SETUP_BUN = "oven-sh/setup-bun@v2";
|
|
39
|
+
const V2_ACTION_SETUP_UV = "astral-sh/setup-uv@v6";
|
|
40
|
+
/** The fixed fallbacks version 2 wrote when a repository declared nothing. */
|
|
41
|
+
const V2_NODE_FALLBACK_MAJOR = "24";
|
|
42
|
+
const V2_PYTHON_FALLBACK_MINOR = "3.12";
|
|
43
|
+
const V2_PNPM_FALLBACK_MAJOR = "10";
|
|
44
|
+
const V2_YARN_BERRY_FALLBACK_MAJOR = "4";
|
|
45
|
+
const V2_BUN_VERSION_RANGE = "1.x";
|
|
46
|
+
const V2_POETRY_VERSION = "2.1.3";
|
|
47
|
+
/** The workflow `name:`. */
|
|
48
|
+
const V2_WORKFLOW_NAME = "epic-implementer-ci";
|
|
49
|
+
/** The required check context, and the aggregator job's display `name:`. */
|
|
50
|
+
const V2_CHECK_NAME = "epic-implementer-ci / gate";
|
|
51
|
+
/** Bounds on the execution and aggregator jobs, in minutes. */
|
|
52
|
+
const V2_TEST_JOB_TIMEOUT_MINUTES = 30;
|
|
53
|
+
const V2_GATE_JOB_TIMEOUT_MINUTES = 5;
|
|
54
|
+
/** The fixed indentation and key that precede the command scalar. */
|
|
55
|
+
const V2_COMMAND_LINE_PREFIX = " run: ";
|
|
56
|
+
/**
|
|
57
|
+
* Characters `JSON.stringify` leaves raw that a YAML parser may read as a line
|
|
58
|
+
* break or a byte-order mark (YAML 1.1 treats U+0085, U+2028 and U+2029 as
|
|
59
|
+
* breaks), plus DEL and the C1 controls. They are escaped as `\uXXXX`, which is
|
|
60
|
+
* still valid JSON and a valid YAML double-quoted escape.
|
|
61
|
+
*/
|
|
62
|
+
const V2_YAML_UNSAFE_RAW = /[\u007f-\u009f\u2028\u2029\ufeff]/g;
|
|
63
|
+
/** Encode the command as one JSON string that is also a safe YAML scalar. */
|
|
64
|
+
function encodeV2CommandScalar(testCommand) {
|
|
65
|
+
return JSON.stringify(testCommand).replace(V2_YAML_UNSAFE_RAW, (ch) => "\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0"));
|
|
66
|
+
}
|
|
67
|
+
function v2NodeSetupLines(node) {
|
|
68
|
+
return [
|
|
69
|
+
" - name: Set up Node.js",
|
|
70
|
+
" uses: " + V2_ACTION_SETUP_NODE,
|
|
71
|
+
" with:",
|
|
72
|
+
node === "fixed"
|
|
73
|
+
? ' node-version: "' + V2_NODE_FALLBACK_MAJOR + '"'
|
|
74
|
+
: " node-version-file: " + node,
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
function v2PythonSetupLines(python) {
|
|
78
|
+
return [
|
|
79
|
+
" - name: Set up Python",
|
|
80
|
+
" uses: " + V2_ACTION_SETUP_PYTHON,
|
|
81
|
+
" with:",
|
|
82
|
+
python === "fixed"
|
|
83
|
+
? ' python-version: "' + V2_PYTHON_FALLBACK_MINOR + '"'
|
|
84
|
+
: " python-version-file: " + python,
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
function v2JavaScriptSetupLines(js) {
|
|
88
|
+
switch (js.manager) {
|
|
89
|
+
case "npm":
|
|
90
|
+
return [...v2NodeSetupLines(js.node), " - name: Install dependencies", " run: npm ci"];
|
|
91
|
+
case "pnpm":
|
|
92
|
+
return [
|
|
93
|
+
" - name: Set up pnpm",
|
|
94
|
+
" uses: " + V2_ACTION_SETUP_PNPM,
|
|
95
|
+
// A declared `packageManager` is read by the action itself at CI runtime.
|
|
96
|
+
// Passing `version:` as well makes it fail with "Multiple versions of pnpm
|
|
97
|
+
// specified" whenever the two strings differ (a Corepack `+sha` suffix is
|
|
98
|
+
// enough), so the input is given only for the fixed fallback.
|
|
99
|
+
...(js.pnpm.source === "default" ? [" with:", ' version: "' + V2_PNPM_FALLBACK_MAJOR + '"'] : []),
|
|
100
|
+
...v2NodeSetupLines(js.node),
|
|
101
|
+
" - name: Install dependencies",
|
|
102
|
+
" run: pnpm install --frozen-lockfile",
|
|
103
|
+
];
|
|
104
|
+
case "yarn":
|
|
105
|
+
if (js.generation === "classic") {
|
|
106
|
+
return [...v2NodeSetupLines(js.node), " - name: Install dependencies", " run: yarn install --frozen-lockfile"];
|
|
107
|
+
}
|
|
108
|
+
// Corepack reads a declared Yarn version from package.json at CI runtime;
|
|
109
|
+
// the activation below is only the fallback major when none is declared.
|
|
110
|
+
return [
|
|
111
|
+
...v2NodeSetupLines(js.node),
|
|
112
|
+
" - name: Enable Corepack",
|
|
113
|
+
" run: corepack enable",
|
|
114
|
+
" - name: Activate Yarn",
|
|
115
|
+
" run: corepack prepare yarn@" + V2_YARN_BERRY_FALLBACK_MAJOR + " --activate",
|
|
116
|
+
" - name: Install dependencies",
|
|
117
|
+
" run: yarn install --immutable",
|
|
118
|
+
];
|
|
119
|
+
case "bun":
|
|
120
|
+
return [
|
|
121
|
+
" - name: Set up Bun",
|
|
122
|
+
" uses: " + V2_ACTION_SETUP_BUN,
|
|
123
|
+
" with:",
|
|
124
|
+
' bun-version: "' + V2_BUN_VERSION_RANGE + '"',
|
|
125
|
+
" - name: Install dependencies",
|
|
126
|
+
" run: bun install --frozen-lockfile",
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const V2_PROJECT_ENVIRONMENT_PATH_LINES = [
|
|
131
|
+
" - name: Add the project environment to PATH",
|
|
132
|
+
' run: echo "$GITHUB_WORKSPACE/.venv/bin" >> "$GITHUB_PATH"',
|
|
133
|
+
];
|
|
134
|
+
function v2PythonSetupLinesFor(py) {
|
|
135
|
+
const setup = v2PythonSetupLines(py.python);
|
|
136
|
+
switch (py.manager) {
|
|
137
|
+
case "uv":
|
|
138
|
+
return [
|
|
139
|
+
...setup,
|
|
140
|
+
" - name: Set up uv",
|
|
141
|
+
" uses: " + V2_ACTION_SETUP_UV,
|
|
142
|
+
" - name: Install dependencies",
|
|
143
|
+
" run: uv sync --frozen",
|
|
144
|
+
...V2_PROJECT_ENVIRONMENT_PATH_LINES,
|
|
145
|
+
];
|
|
146
|
+
case "poetry":
|
|
147
|
+
return [
|
|
148
|
+
...setup,
|
|
149
|
+
" - name: Install Poetry",
|
|
150
|
+
" run: python -m pip install poetry==" + V2_POETRY_VERSION,
|
|
151
|
+
" - name: Configure Poetry",
|
|
152
|
+
" run: poetry config virtualenvs.in-project true",
|
|
153
|
+
" - name: Install dependencies",
|
|
154
|
+
" run: poetry install",
|
|
155
|
+
...V2_PROJECT_ENVIRONMENT_PATH_LINES,
|
|
156
|
+
];
|
|
157
|
+
case "pip":
|
|
158
|
+
return [...setup, " - name: Install dependencies", " run: pip install -r requirements.txt"];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/** The setup steps for a validated set, in the fixed JavaScript, Python, Go order. */
|
|
162
|
+
function v2ToolchainSetupLines(toolchains) {
|
|
163
|
+
const lines = [];
|
|
164
|
+
if (toolchains.javascript !== null)
|
|
165
|
+
lines.push(...v2JavaScriptSetupLines(toolchains.javascript));
|
|
166
|
+
if (toolchains.python !== null)
|
|
167
|
+
lines.push(...v2PythonSetupLinesFor(toolchains.python));
|
|
168
|
+
if (toolchains.go !== null) {
|
|
169
|
+
lines.push(" - name: Set up Go", " uses: " + V2_ACTION_SETUP_GO, " with:", " go-version-file: " + toolchains.go.dependencyFile);
|
|
170
|
+
}
|
|
171
|
+
return lines;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Render the workflow for `testCommand` and the resolved `toolchains`.
|
|
175
|
+
* Deterministic: the same inputs always give the same bytes. Throws
|
|
176
|
+
* `TestCommandValidationError` for a bad command and `RepositoryToolchainError`
|
|
177
|
+
* for a toolchain set outside the closed vocabulary.
|
|
178
|
+
*/
|
|
179
|
+
export function renderEpicCiWorkflowV2(testCommand, toolchains) {
|
|
180
|
+
const command = validateTestCommand(testCommand);
|
|
181
|
+
const validated = validateRepositoryToolchains(toolchains);
|
|
182
|
+
const lines = [
|
|
183
|
+
"# ===========================================================================",
|
|
184
|
+
"# Epic Implementer CI gate — MANAGED FILE",
|
|
185
|
+
"#",
|
|
186
|
+
"# Generated by Bridge (`" + V2_WORKFLOW_PATH + "`). Do not hand-edit: the",
|
|
187
|
+
"# installer compares this file byte for byte against what it renders and",
|
|
188
|
+
"# refuses to overwrite a modified or unrecognized copy.",
|
|
189
|
+
"#",
|
|
190
|
+
"# " + V2_VERSION_MARKER_KEY + ": " + String(V2_RENDERER_VERSION),
|
|
191
|
+
"# " + V2_TOOLCHAINS_MARKER_KEY + ": " + serializeRepositoryToolchains(validated),
|
|
192
|
+
"#",
|
|
193
|
+
"# WHAT THIS WORKFLOW IS",
|
|
194
|
+
"#",
|
|
195
|
+
"# It publishes one required check, `" + V2_CHECK_NAME + "`, that the",
|
|
196
|
+
"# Bridge Epic Implementer reads before it merges a child pull request. The",
|
|
197
|
+
"# check is green only when the repository's stored test command passes.",
|
|
198
|
+
"#",
|
|
199
|
+
"# SCOPE: SAME-REPOSITORY PULL REQUESTS ONLY",
|
|
200
|
+
"#",
|
|
201
|
+
"# The `tests` job runs only when the pull request head is this repository.",
|
|
202
|
+
"# A fork pull request never checks out or runs repository code; the gate",
|
|
203
|
+
"# passes for it immediately and says so. Nothing here uses a secret, and the",
|
|
204
|
+
"# token is read-only.",
|
|
205
|
+
"#",
|
|
206
|
+
"# DEPENDENCIES",
|
|
207
|
+
"#",
|
|
208
|
+
"# The setup steps before the test command were chosen from the lockfiles in",
|
|
209
|
+
"# the repository root when this file was generated; the toolchains line above",
|
|
210
|
+
"# records the choice. They install dependencies and nothing else. When no",
|
|
211
|
+
"# supported dependency file was found, nothing is installed for that",
|
|
212
|
+
"# ecosystem and the command must install what it needs itself.",
|
|
213
|
+
"#",
|
|
214
|
+
"# THE TEST COMMAND",
|
|
215
|
+
"#",
|
|
216
|
+
"# The command below is the repository's stored test command, run with bash",
|
|
217
|
+
"# from the repository root after the setup steps. To change it, save a new",
|
|
218
|
+
"# command through Bridge setup and re-run the installer; do not edit it here.",
|
|
219
|
+
"# ===========================================================================",
|
|
220
|
+
"name: " + V2_WORKFLOW_NAME,
|
|
221
|
+
"",
|
|
222
|
+
"on:",
|
|
223
|
+
" pull_request:",
|
|
224
|
+
"",
|
|
225
|
+
"permissions:",
|
|
226
|
+
" contents: read",
|
|
227
|
+
"",
|
|
228
|
+
"jobs:",
|
|
229
|
+
" tests:",
|
|
230
|
+
" name: tests",
|
|
231
|
+
" if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}",
|
|
232
|
+
" runs-on: ubuntu-latest",
|
|
233
|
+
" timeout-minutes: " + String(V2_TEST_JOB_TIMEOUT_MINUTES),
|
|
234
|
+
" steps:",
|
|
235
|
+
" - name: Check out the pull request",
|
|
236
|
+
" uses: " + V2_ACTION_CHECKOUT,
|
|
237
|
+
" with:",
|
|
238
|
+
" persist-credentials: false",
|
|
239
|
+
...v2ToolchainSetupLines(validated),
|
|
240
|
+
" - name: " + V2_COMMAND_STEP_NAME,
|
|
241
|
+
" shell: bash",
|
|
242
|
+
V2_COMMAND_LINE_PREFIX + encodeV2CommandScalar(command),
|
|
243
|
+
"",
|
|
244
|
+
" gate:",
|
|
245
|
+
" name: " + V2_CHECK_NAME,
|
|
246
|
+
" needs: [tests]",
|
|
247
|
+
" if: ${{ always() }}",
|
|
248
|
+
" runs-on: ubuntu-latest",
|
|
249
|
+
" timeout-minutes: " + String(V2_GATE_JOB_TIMEOUT_MINUTES),
|
|
250
|
+
" steps:",
|
|
251
|
+
" - name: Aggregate the Epic Implementer CI result",
|
|
252
|
+
" env:",
|
|
253
|
+
" HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}",
|
|
254
|
+
" THIS_REPOSITORY: ${{ github.repository }}",
|
|
255
|
+
" TESTS_RESULT: ${{ needs.tests.result }}",
|
|
256
|
+
" run: |",
|
|
257
|
+
" if [ -z \"$HEAD_REPOSITORY\" ] || [ -z \"$THIS_REPOSITORY\" ]; then",
|
|
258
|
+
" echo \"The pull request head repository could not be identified; the gate fails.\"",
|
|
259
|
+
" exit 1",
|
|
260
|
+
" fi",
|
|
261
|
+
" if [ \"$HEAD_REPOSITORY\" != \"$THIS_REPOSITORY\" ]; then",
|
|
262
|
+
" echo \"Fork pull request: repository code is never run for a fork, so the gate passes without running tests.\"",
|
|
263
|
+
" exit 0",
|
|
264
|
+
" fi",
|
|
265
|
+
" echo \"Tests: $TESTS_RESULT\"",
|
|
266
|
+
" if [ \"$TESTS_RESULT\" = \"success\" ]; then",
|
|
267
|
+
" exit 0",
|
|
268
|
+
" fi",
|
|
269
|
+
" echo \"The stored test command did not conclude 'success'; the gate fails.\"",
|
|
270
|
+
" exit 1",
|
|
271
|
+
"",
|
|
272
|
+
];
|
|
273
|
+
return lines.join("\n");
|
|
274
|
+
}
|
|
@@ -23,22 +23,40 @@
|
|
|
23
23
|
*
|
|
24
24
|
* ## Safe by default
|
|
25
25
|
*
|
|
26
|
-
* `on: pull_request`
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* `on: pull_request` for pull requests that target `epic/**` only (renderer
|
|
27
|
+
* version 3, BAPI-1603), `permissions: contents: read`, no secrets, no path
|
|
28
|
+
* filters, `ubuntu-latest`. The execution job runs only when the pull request
|
|
29
|
+
* head is this repository; a fork pull request never checks out or runs
|
|
29
30
|
* repository code. The checkout does not persist its token.
|
|
30
31
|
*
|
|
32
|
+
* ## Why only epic-targeted pull requests (renderer version 3)
|
|
33
|
+
*
|
|
34
|
+
* Versions 1 and 2 ran on every pull request. The Epic Implementer reads this
|
|
35
|
+
* check on the child pull requests it merges into an `epic/<EPIC>` branch, and an
|
|
36
|
+
* owner who has their own CI should not pay for a second run on every ordinary
|
|
37
|
+
* pull request. The final pull request into the default branch targets the
|
|
38
|
+
* default branch, so this workflow does not run there: a default-branch rule that
|
|
39
|
+
* requires `epic-implementer-ci / gate` would wait for a check that never starts.
|
|
40
|
+
* The setup warns about that rule; it never edits one. The frozen version-2
|
|
41
|
+
* renderer (`epic-ci-workflow-v2.ts`) keeps unmodified version-2 files
|
|
42
|
+
* recognizable as upgradeable.
|
|
43
|
+
*
|
|
31
44
|
* ## Toolchain provisioning (renderer version 2, BAPI-1536)
|
|
32
45
|
*
|
|
33
46
|
* Version 1 provisioned nothing, so a command that needed installed dependencies
|
|
34
47
|
* had to install them itself. Version 2 adds fixed setup steps between the
|
|
35
48
|
* checkout and the stored command, chosen from the repository's own lockfiles by
|
|
36
49
|
* the shared resolver (`repository-toolchains.ts`) at the moment the workflow is
|
|
37
|
-
* generated.
|
|
38
|
-
* metadata is deliberately NOT an input: it can be stale, absent, or describe a
|
|
50
|
+
* generated. Through version 2 the resolver read the local working tree. Server
|
|
51
|
+
* indexing metadata is deliberately NOT an input: it can be stale, absent, or describe a
|
|
39
52
|
* different checkout, and the workflow must be reproducible from the files it is
|
|
40
53
|
* committed next to.
|
|
41
54
|
*
|
|
55
|
+
* From version 3 the resolver reads the remote default branch at the installer's
|
|
56
|
+
* captured head, not the person's working tree: the workflow is committed onto
|
|
57
|
+
* that head, so uncommitted or unpushed local files must not choose its
|
|
58
|
+
* toolchains.
|
|
59
|
+
*
|
|
42
60
|
* - JavaScript, Python, and Go are provisioned, in that order, when found.
|
|
43
61
|
* Manager priority, version-file precedence, and fixed fallbacks are defined in
|
|
44
62
|
* `repository-toolchains.ts`; the user-facing summary is the packaged
|
|
@@ -66,7 +84,7 @@ import { validateTestCommand } from "./test-command-validation.js";
|
|
|
66
84
|
/** Repository-relative path of the managed workflow. */
|
|
67
85
|
export const EPIC_CI_WORKFLOW_PATH = ".github/workflows/epic-implementer-ci.yml";
|
|
68
86
|
/** The renderer version written into the managed header. */
|
|
69
|
-
export const EPIC_CI_WORKFLOW_RENDERER_VERSION =
|
|
87
|
+
export const EPIC_CI_WORKFLOW_RENDERER_VERSION = 3;
|
|
70
88
|
/** The header marker key; the line is `# <key>: <version>`. */
|
|
71
89
|
export const EPIC_CI_WORKFLOW_VERSION_MARKER_KEY = "x-bridge-ci-renderer-version";
|
|
72
90
|
/** The header marker key for the canonical toolchain set; the line is `# <key>: <json>`. */
|
|
@@ -240,7 +258,12 @@ export function renderEpicImplementerCiWorkflow(testCommand, toolchains) {
|
|
|
240
258
|
"# Bridge Epic Implementer reads before it merges a child pull request. The",
|
|
241
259
|
"# check is green only when the repository's stored test command passes.",
|
|
242
260
|
"#",
|
|
243
|
-
"# SCOPE: SAME-REPOSITORY PULL REQUESTS ONLY",
|
|
261
|
+
"# SCOPE: EPIC-TARGETED, SAME-REPOSITORY PULL REQUESTS ONLY",
|
|
262
|
+
"#",
|
|
263
|
+
"# The workflow runs only for pull requests that target an `epic/**` branch:",
|
|
264
|
+
"# the child pull requests the Epic Implementer merges into an epic branch. It",
|
|
265
|
+
"# does not run for other pull requests, including the final pull request into",
|
|
266
|
+
"# the default branch.",
|
|
244
267
|
"#",
|
|
245
268
|
"# The `tests` job runs only when the pull request head is this repository.",
|
|
246
269
|
"# A fork pull request never checks out or runs repository code; the gate",
|
|
@@ -250,21 +273,24 @@ export function renderEpicImplementerCiWorkflow(testCommand, toolchains) {
|
|
|
250
273
|
"# DEPENDENCIES",
|
|
251
274
|
"#",
|
|
252
275
|
"# The setup steps before the test command were chosen from the lockfiles in",
|
|
253
|
-
"# the repository
|
|
254
|
-
"# records the choice. They install dependencies and
|
|
255
|
-
"# supported dependency file was found, nothing is
|
|
256
|
-
"# ecosystem and the command must install what it needs
|
|
276
|
+
"# the root of the repository's default branch when this file was generated;",
|
|
277
|
+
"# the toolchains line above records the choice. They install dependencies and",
|
|
278
|
+
"# nothing else. When no supported dependency file was found, nothing is",
|
|
279
|
+
"# installed for that ecosystem and the command must install what it needs",
|
|
280
|
+
"# itself.",
|
|
257
281
|
"#",
|
|
258
282
|
"# THE TEST COMMAND",
|
|
259
283
|
"#",
|
|
260
284
|
"# The command below is the repository's stored test command, run with bash",
|
|
261
285
|
"# from the repository root after the setup steps. To change it, save a new",
|
|
262
|
-
"# command through Bridge setup and re-run the installer; do
|
|
286
|
+
"# command through Bridge setup (`--test-command`) and re-run the installer; do",
|
|
287
|
+
"# not edit it here.",
|
|
263
288
|
"# ===========================================================================",
|
|
264
289
|
"name: " + EPIC_CI_WORKFLOW_NAME,
|
|
265
290
|
"",
|
|
266
291
|
"on:",
|
|
267
292
|
" pull_request:",
|
|
293
|
+
" branches: ['epic/**']",
|
|
268
294
|
"",
|
|
269
295
|
"permissions:",
|
|
270
296
|
" contents: read",
|