@bridge_gpt/mcp-server 0.2.71 → 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.
Files changed (198) hide show
  1. package/README.md +55 -17
  2. package/build/agent-launchers/claude-executor-adapter.js +22 -3
  3. package/build/agent-notes.js +171 -95
  4. package/build/agents.generated.js +7 -7
  5. package/build/bridge-permissions.js +31 -0
  6. package/build/bridge-worktree-inspection.js +237 -0
  7. package/build/check-evidence.js +6 -0
  8. package/build/ci-system-detection.js +50 -0
  9. package/build/ci-trigger-adapters.js +631 -0
  10. package/build/ci-trigger-install.js +106 -0
  11. package/build/claude-review-workflow.js +1 -1
  12. package/build/cli-help.js +6 -0
  13. package/build/codex-auto-recovery.js +126 -0
  14. package/build/codex-launcher-pin.js +33 -2
  15. package/build/codex-skill-adapter.js +5 -1
  16. package/build/command-host.js +33 -0
  17. package/build/commands.generated.js +7 -6
  18. package/build/conductor/bridge-api-client.js +1352 -50
  19. package/build/conductor/bring-up-facts.js +18 -5
  20. package/build/conductor/command-drift-production.js +42 -17
  21. package/build/conductor/command-drift.js +47 -0
  22. package/build/conductor/declare-blocked.js +554 -0
  23. package/build/conductor/doctor.js +187 -28
  24. package/build/conductor/driver-commands.js +141 -0
  25. package/build/conductor/driver-guard.js +277 -0
  26. package/build/conductor/driver-lapse.js +321 -0
  27. package/build/conductor/driver-register.js +176 -0
  28. package/build/conductor/driver-release.js +174 -0
  29. package/build/conductor/driver-session-state.js +315 -0
  30. package/build/conductor/epic-branch-ci-inspection.js +222 -29
  31. package/build/conductor/epic-implementer-cli.js +213 -13
  32. package/build/conductor/epic-server-database.js +162 -0
  33. package/build/conductor/epic-server-guidance.js +278 -0
  34. package/build/conductor/epic-server-journal.js +239 -0
  35. package/build/conductor/epic-server-processes.js +324 -0
  36. package/build/conductor/epic-server-recipe.js +397 -0
  37. package/build/conductor/epic-server-runtime.js +1207 -0
  38. package/build/conductor/epic-server-sfcc.js +107 -0
  39. package/build/conductor/epic-server-state.js +427 -0
  40. package/build/conductor/epic-server.js +594 -0
  41. package/build/conductor/gate-discovery.js +281 -10
  42. package/build/conductor/gate-settings-review.js +525 -5
  43. package/build/conductor/git-hooks-uninstall.js +112 -0
  44. package/build/conductor/git-hooks.js +81 -15
  45. package/build/conductor/guided-repair.js +10 -1
  46. package/build/conductor/install-doctor.js +2 -4
  47. package/build/conductor/launch-need-probes.js +6 -53
  48. package/build/conductor/launch-plan.js +318 -121
  49. package/build/conductor/local-merge.js +12 -1
  50. package/build/conductor/merge-execution-contract.js +1 -1
  51. package/build/conductor/merged-child-check.js +2 -1
  52. package/build/conductor/prerequisite-inputs.js +1213 -0
  53. package/build/conductor/readiness-assessment.js +93 -0
  54. package/build/conductor/readiness-cli.js +30 -9
  55. package/build/conductor/readiness-prerequisites.js +77 -5
  56. package/build/conductor/readiness-sections.js +146 -126
  57. package/build/conductor/readiness.js +21 -3
  58. package/build/conductor/recovery-cli.js +236 -15
  59. package/build/conductor/recovery-operations.js +34 -4
  60. package/build/conductor/repair-contract.js +33 -0
  61. package/build/conductor/tools.js +36 -4
  62. package/build/conductor/wait-run-attention.js +115 -0
  63. package/build/conductor/wait-run-cli.js +300 -21
  64. package/build/conductor/worker-database-doctor-inspector.js +34 -2
  65. package/build/conductor/worker-setup-tally.js +27 -0
  66. package/build/credential-store.js +96 -21
  67. package/build/dependency-install-declarations.js +212 -0
  68. package/build/docs.generated.js +4 -4
  69. package/build/doctor.js +91 -8
  70. package/build/drive-epic-help.js +23 -4
  71. package/build/drive-epic.js +1841 -340
  72. package/build/engine-paths.js +20 -0
  73. package/build/epic-branch-ci-summary.js +140 -0
  74. package/build/epic-capability-statement.js +107 -0
  75. package/build/epic-ci-workflow-drift.js +30 -15
  76. package/build/epic-ci-workflow-install.js +110 -42
  77. package/build/epic-ci-workflow-v2.js +274 -0
  78. package/build/epic-ci-workflow.js +38 -12
  79. package/build/epic-implementer-bin.js +2184 -52
  80. package/build/epic-launch-context.js +607 -0
  81. package/build/epic-launch-profile.js +1 -1
  82. package/build/epic-server-record.js +273 -0
  83. package/build/epic-shared/bridge-client.js +11 -3
  84. package/build/escalation-reachability.js +43 -0
  85. package/build/executor/ci-fix-test-runs.js +334 -0
  86. package/build/executor/cli.js +2 -0
  87. package/build/executor/completion-contract.js +24 -1
  88. package/build/executor/credentials.js +1 -1
  89. package/build/executor/delivery-observations.js +113 -0
  90. package/build/executor/delivery-outcome.js +30 -0
  91. package/build/executor/dependency-refresh-runner.js +132 -0
  92. package/build/executor/dependency-refresh.js +530 -0
  93. package/build/executor/deps.js +4 -0
  94. package/build/executor/env.js +119 -17
  95. package/build/executor/epic-server-context.js +141 -0
  96. package/build/executor/gate-qualification-job.js +127 -26
  97. package/build/executor/harness-coverage.js +19 -0
  98. package/build/executor/http-client.js +87 -6
  99. package/build/executor/index.js +2 -1
  100. package/build/executor/install-preflight.js +1 -1
  101. package/build/executor/job-runner.js +659 -87
  102. package/build/executor/likely-tests.js +94 -97
  103. package/build/executor/observation.js +8 -0
  104. package/build/executor/pre-pr-checks.js +363 -0
  105. package/build/executor/prompt-spec.js +127 -5
  106. package/build/executor/reconcile-overlap-job.js +5 -3
  107. package/build/executor/required-verification.js +28 -0
  108. package/build/executor/required-work-diagnostics.js +32 -0
  109. package/build/executor/required-work-ledger.js +955 -39
  110. package/build/executor/results.js +100 -0
  111. package/build/executor/service-discovery.js +42 -0
  112. package/build/executor/service-lifecycle.js +109 -2
  113. package/build/executor/service-uninstall.js +205 -0
  114. package/build/executor/service-unit.js +5 -3
  115. package/build/executor/terminal-mutation.js +8 -0
  116. package/build/executor/test-clock.js +3 -0
  117. package/build/executor/verification-hints.js +179 -0
  118. package/build/executor/worker-command.js +126 -5
  119. package/build/executor/worker-database-config.js +281 -0
  120. package/build/executor/worker-database-target.js +16 -12
  121. package/build/executor/worker-database.js +575 -116
  122. package/build/executor/worker-finalization.js +71 -10
  123. package/build/executor/worker-guard-hook.js +10 -2
  124. package/build/executor/worker-resources.js +25 -3
  125. package/build/executor/worker-verification-guidance.js +55 -5
  126. package/build/executor/worktree-inspection.js +42 -0
  127. package/build/executor/worktree.js +20 -1
  128. package/build/executor-launch.js +54 -2
  129. package/build/generated-assets-catalog.js +2 -2
  130. package/build/github-sign-in.js +1 -1
  131. package/build/index.js +1111 -381
  132. package/build/init.js +29 -14
  133. package/build/install-bridge-conductor-answers.js +465 -0
  134. package/build/install-bridge-conductor-apply.js +259 -0
  135. package/build/install-bridge-conductor-assessment.js +895 -0
  136. package/build/install-bridge-conductor-compact.js +161 -0
  137. package/build/install-bridge-conductor-contracts.js +63 -0
  138. package/build/install-bridge-conductor-gate.js +1383 -188
  139. package/build/install-bridge-conductor-setup.js +637 -92
  140. package/build/install-bridge-conductor.js +3163 -740
  141. package/build/install-bridge.js +601 -128
  142. package/build/install-maintenance.js +127 -0
  143. package/build/install-reexec.js +1 -1
  144. package/build/launcher-config-inspection.js +162 -1
  145. package/build/local-cleanup.js +59 -0
  146. package/build/mcp-grant-candidates.js +767 -0
  147. package/build/mcp-grant-doctor.js +63 -0
  148. package/build/mcp-grant.js +288 -0
  149. package/build/mcp-host-targets.js +8 -0
  150. package/build/mcp-identity.js +23 -0
  151. package/build/mcp-install-state.js +68 -2
  152. package/build/mcp-invoke.js +126 -13
  153. package/build/mcp-presets.js +107 -0
  154. package/build/mcp-provisioning.js +134 -2
  155. package/build/mcp-registration-doctor.js +31 -2
  156. package/build/mcp-server-invocation.js +6 -1
  157. package/build/merge-workflow-install.js +236 -111
  158. package/build/package-script-semantics.js +10 -0
  159. package/build/pipeline-utils.js +1 -1
  160. package/build/pipelines.generated.js +6 -6
  161. package/build/plan-discovery.js +97 -4
  162. package/build/plan-execution-ledger.js +248 -9
  163. package/build/plan-generation-io.js +262 -0
  164. package/build/plan-generation.js +424 -0
  165. package/build/plane/build-freshness.js +6 -1
  166. package/build/plane/cli.js +75 -9
  167. package/build/plane/plane-freshness.js +23 -7
  168. package/build/plane/preflight.js +50 -10
  169. package/build/plane/shutdown.js +19 -0
  170. package/build/plane/terminal-run-cleanup.js +23 -5
  171. package/build/plane/terminal-run-status.js +4 -0
  172. package/build/printed-remedy-commands.js +229 -15
  173. package/build/readiness-check.js +1 -1
  174. package/build/readiness-prerequisites.generated.js +311 -4
  175. package/build/readme.generated.js +1 -1
  176. package/build/repository-state-paths.js +38 -0
  177. package/build/repository-toolchains.js +50 -8
  178. package/build/run-unit-tests-launcher.js +8 -1
  179. package/build/setup-change-policy.js +32 -0
  180. package/build/setup-epic.js +1192 -198
  181. package/build/setup-progress.js +44 -0
  182. package/build/setup-question.js +180 -0
  183. package/build/start-tickets.js +4 -0
  184. package/build/test-command-detection.js +32 -88
  185. package/build/test-support/notes-fs.js +40 -0
  186. package/build/third-party-mcp-targets.js +30 -0
  187. package/build/ticket-delivery-enrollment.js +30 -8
  188. package/build/ticket-delivery-run-scope.js +128 -0
  189. package/build/upgrade-cli.js +85 -2
  190. package/build/v2-readiness-requirements.js +28 -1
  191. package/build/version.generated.js +3 -3
  192. package/build/worker-guard-hook-bin.js +2 -2
  193. package/build/worktrees.js +105 -0
  194. package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
  195. package/docs/EPIC-IMPLEMENTER.md +5 -0
  196. package/docs/epic-implementer/getting-started.md +42 -15
  197. package/docs/epic-implementer/self-hosting.md +14 -1
  198. package/package.json +2 -2
@@ -0,0 +1,237 @@
1
+ /** Shared local observations for listing, pruning, and quiet cleanup advisories. */
2
+ import { lstat, readdir, readFile, realpath } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { runLocalCommand } from "./local-cleanup.js";
5
+ import { isValidTicketKey } from "./ticket-key-utils.js";
6
+ import { posixShellQuote } from "./platform-escaping.js";
7
+ import { MCP_PACKAGE_NAME } from "./mcp-identity.js";
8
+ import { parseGitWorktreePorcelainZ } from "./executor/worktree-inspection.js";
9
+ import { parseExecutorWorktreeLock } from "./executor/worktree-lock.js";
10
+ const defaults = { run: runLocalCommand, lstat, readdir, readFile, realpath, now: Date.now,
11
+ alive: pid => { try {
12
+ process.kill(pid, 0);
13
+ return true;
14
+ }
15
+ catch (error) {
16
+ return error.code !== "ESRCH";
17
+ } } };
18
+ /** Reject revision expressions; only literal branch names enter ref resolution. */
19
+ export function validCleanupBranch(value) {
20
+ return value.length > 0 && !value.startsWith("-") && !/[\s\x00-\x1f\x7f~^:?*\[\\]/.test(value) && !value.includes("..") && !value.includes("@{") && !value.includes("//") && !value.startsWith("/") && !value.endsWith("/") && !value.endsWith(".") && value.split("/").every(part => !part.startsWith(".") && !part.endsWith(".lock"));
21
+ }
22
+ export async function inspectBridgeWorktrees(options = {}, overrides = {}) {
23
+ const deps = { ...defaults, ...overrides }, cwd = options.cwd ?? process.cwd();
24
+ const until = deps.now() + (options.budgetMs ?? 5000);
25
+ const inspection = { state: "complete", worktrees: [], cwd, baseRef: null, baseTip: null };
26
+ const git = async (args, at = cwd) => {
27
+ if (deps.now() >= until)
28
+ throw new Error("budget");
29
+ return deps.run("git", args, at, Math.max(1, until - deps.now()));
30
+ };
31
+ try {
32
+ if (options.base && !validCleanupBranch(options.base))
33
+ return { ...inspection, state: "unavailable" };
34
+ const list = await git(["worktree", "list", "--porcelain", "-z"]);
35
+ if (list.exitCode !== 0 || !list.stdout.startsWith("worktree ") || !list.stdout.endsWith("\0"))
36
+ return { ...inspection, state: "unavailable" };
37
+ const entries = parseGitWorktreePorcelainZ(list.stdout);
38
+ const rootResult = await git(["rev-parse", "--show-toplevel"]);
39
+ if (rootResult.exitCode !== 0)
40
+ return { ...inspection, state: "unavailable" };
41
+ const invoking = rootResult.stdout.trim();
42
+ const resolveRef = async (ref) => {
43
+ const result = await git(["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]);
44
+ return result.exitCode === 0 && /^[a-f0-9]{40,64}$/.test(result.stdout.trim()) ? result.stdout.trim() : null;
45
+ };
46
+ let candidates;
47
+ if (options.base)
48
+ candidates = [`refs/remotes/origin/${options.base}`, `refs/heads/${options.base}`];
49
+ else {
50
+ const origin = await git(["symbolic-ref", "--quiet", "refs/remotes/origin/HEAD"]);
51
+ const ref = origin.exitCode === 0 ? origin.stdout.trim() : "";
52
+ candidates = [...(ref.startsWith("refs/remotes/origin/") && validCleanupBranch(ref.slice(20)) ? [ref] : []), "refs/heads/main"];
53
+ }
54
+ for (const ref of candidates) {
55
+ const tip = await resolveRef(ref);
56
+ if (tip) {
57
+ inspection.baseRef = ref;
58
+ inspection.baseTip = tip;
59
+ break;
60
+ }
61
+ }
62
+ const sizeOf = async (root) => {
63
+ let bytes = 0, count = 0, complete = true;
64
+ const pending = [root];
65
+ while (pending.length) {
66
+ if (++count > 20_000 || deps.now() >= until) {
67
+ complete = false;
68
+ break;
69
+ }
70
+ const target = pending.pop();
71
+ try {
72
+ const stat = await deps.lstat(target);
73
+ if (stat.isSymbolicLink()) {
74
+ bytes += stat.size;
75
+ continue;
76
+ }
77
+ if (stat.isDirectory()) {
78
+ for (const name of await deps.readdir(target))
79
+ pending.push(path.join(target, String(name)));
80
+ }
81
+ else if (stat.isFile())
82
+ bytes += stat.size;
83
+ }
84
+ catch {
85
+ complete = false;
86
+ }
87
+ }
88
+ return { bytes, complete };
89
+ };
90
+ for (let index = 0; index < entries.length; index++) {
91
+ const entry = entries[index];
92
+ const wt = { ...entry, evidence: [], status: "unknown", retained: [], size: null, eligible: false };
93
+ inspection.worktrees.push(wt);
94
+ if (deps.now() >= until) {
95
+ inspection.state = "partial";
96
+ wt.retained.push("inspection budget exhausted");
97
+ continue;
98
+ }
99
+ try {
100
+ const canonical = await deps.realpath(entry.path);
101
+ if (canonical !== path.resolve(entry.path))
102
+ wt.retained.push("worktree path is not canonical");
103
+ if (index === 0)
104
+ wt.retained.push("main checkout");
105
+ if (entry.path === invoking)
106
+ wt.retained.push("invoking checkout");
107
+ if (entry.locked)
108
+ wt.retained.push("Git worktree locked");
109
+ if (entry.prunable || entry.bare || entry.detached || !entry.branch || !entry.head || !validCleanupBranch(entry.branch))
110
+ wt.retained.push("unsafe registration or branch");
111
+ const baseBranch = inspection.baseRef?.replace(/^refs\/(heads|remotes\/origin)\//, "");
112
+ if (entry.branch === baseBranch)
113
+ wt.retained.push("base branch checkout");
114
+ if (entry.branch?.startsWith("feature/") && isValidTicketKey(entry.branch.slice(8)))
115
+ wt.evidence.push("feature/<ticket-key>");
116
+ try {
117
+ const marker = await deps.lstat(path.join(entry.path, ".conductor"));
118
+ if (marker.isSymbolicLink() || !marker.isDirectory())
119
+ wt.retained.push("unsafe conductor marker");
120
+ else
121
+ wt.evidence.push(".conductor directory");
122
+ }
123
+ catch (error) {
124
+ if (error.code !== "ENOENT")
125
+ wt.retained.push("conductor ownership unavailable");
126
+ }
127
+ if (!wt.evidence.length)
128
+ wt.retained.push("no Bridge ownership evidence");
129
+ try {
130
+ const lockPath = path.join(entry.path, ".conductor", "worker.lock");
131
+ const lockStat = await deps.lstat(lockPath);
132
+ if (!lockStat.isFile() || lockStat.isSymbolicLink() || lockStat.size > 4096)
133
+ wt.retained.push("worker ownership unknown");
134
+ else {
135
+ const owner = parseExecutorWorktreeLock(await deps.readFile(lockPath, "utf8"));
136
+ if (!owner || owner.worktreePath !== entry.path || deps.alive(owner.ownerPid))
137
+ wt.retained.push("worker active or ownership unknown");
138
+ }
139
+ }
140
+ catch (error) {
141
+ if (error.code !== "ENOENT")
142
+ wt.retained.push("worker ownership unavailable");
143
+ }
144
+ const gitdir = await git(["rev-parse", "--absolute-git-dir"], entry.path);
145
+ if (gitdir.exitCode !== 0)
146
+ wt.retained.push("Git directory unavailable");
147
+ else
148
+ for (const name of ["index.lock", "HEAD.lock", "packed-refs.lock"]) {
149
+ try {
150
+ await deps.lstat(path.join(gitdir.stdout.trim(), name));
151
+ wt.retained.push(`Git ${name} present`);
152
+ }
153
+ catch (error) {
154
+ if (error.code !== "ENOENT")
155
+ wt.retained.push("Git lock observation unavailable");
156
+ }
157
+ }
158
+ const status = await git(["status", "--porcelain=v1", "-z", "--untracked-files=all"], entry.path);
159
+ if (status.exitCode !== 0) {
160
+ wt.status = "unknown";
161
+ wt.retained.push("cleanliness unavailable");
162
+ }
163
+ else if (status.stdout.length) {
164
+ wt.status = "dirty";
165
+ wt.retained.push("uncommitted or untracked work");
166
+ }
167
+ else if (inspection.baseTip && entry.head && /^[a-f0-9]{40,64}$/.test(entry.head)) {
168
+ const ancestor = await git(["merge-base", "--is-ancestor", entry.head, inspection.baseTip]);
169
+ wt.status = ancestor.exitCode === 0 ? "merged" : ancestor.exitCode === 1 ? "active" : "unknown";
170
+ if (ancestor.exitCode === 1 && entry.branch) {
171
+ const remote = await git(["config", "--get", `branch.${entry.branch}.remote`]);
172
+ const merge = await git(["config", "--get", `branch.${entry.branch}.merge`]);
173
+ const upstream = merge.stdout.trim();
174
+ if (remote.exitCode === 0 && remote.stdout.trim() === "origin" && merge.exitCode === 0 && upstream.startsWith("refs/heads/") && validCleanupBranch(upstream.slice(11))) {
175
+ const gone = await git(["show-ref", "--verify", "--quiet", `refs/remotes/origin/${upstream.slice(11)}`]);
176
+ const currentTip = await resolveRef("HEAD");
177
+ const preserved = await git(["for-each-ref", `--contains=${entry.head}`, "--format=%(refname)", "refs/remotes/origin/"]);
178
+ const safeDelete = currentTip ? await git(["merge-base", "--is-ancestor", entry.head, currentTip]) : null;
179
+ if (gone.exitCode === 1 && preserved.exitCode === 0 && preserved.stdout.split(/\r?\n/).some(ref => ref.startsWith("refs/remotes/origin/") && !ref.endsWith("/HEAD")) && safeDelete?.exitCode === 0) {
180
+ wt.status = "remote-gone";
181
+ wt.evidence.push("configured origin upstream absent; tip preserved in surviving remote ref and invoking HEAD");
182
+ }
183
+ }
184
+ }
185
+ if (ancestor.exitCode !== 0 && wt.status !== "remote-gone")
186
+ wt.retained.push(ancestor.exitCode === 1 ? "tip is not merged into base" : "ancestry unavailable");
187
+ }
188
+ else
189
+ wt.retained.push("base or branch tip unavailable");
190
+ if (wt.retained.length && (wt.status === "merged" || wt.status === "remote-gone"))
191
+ wt.status = "unsafe";
192
+ wt.eligible = (wt.status === "merged" || wt.status === "remote-gone") && wt.retained.length === 0;
193
+ }
194
+ catch {
195
+ inspection.state = "partial";
196
+ wt.retained.push("inspection unavailable");
197
+ wt.eligible = false;
198
+ }
199
+ }
200
+ // Finish every safety observation before optional size disclosure can spend
201
+ // the remaining budget. Protected/retained checkouts are never traversed.
202
+ // A large dependency tree must not invalidate already-proven eligibility.
203
+ for (const wt of inspection.worktrees) {
204
+ if (wt.eligible && deps.now() < until)
205
+ wt.size = await sizeOf(wt.path);
206
+ }
207
+ return inspection;
208
+ }
209
+ catch {
210
+ return { ...inspection, state: inspection.worktrees.length ? "partial" : "unavailable" };
211
+ }
212
+ }
213
+ export function buildBridgeWorktreePrunePlan(inspection) {
214
+ return inspection.state === "complete" ? inspection.worktrees.filter(wt => wt.eligible) : [];
215
+ }
216
+ export function formatBridgeWorktreeSummary(inspection) {
217
+ const candidates = inspection.worktrees.filter(wt => wt.evidence.length), eligible = buildBridgeWorktreePrunePlan(inspection);
218
+ const known = candidates.reduce((sum, wt) => sum + (wt.size?.bytes ?? 0), 0);
219
+ return `${candidates.length} Bridge worktrees; ${known} bytes${candidates.some(wt => !wt.size?.complete) ? " (partial/unknown)" : ""}; ${eligible.length} prune-eligible. Inspection: ${inspection.state}. Local refs reflect the last fetch.`;
220
+ }
221
+ export function formatWorktreeStatusCommand(wt) { return `git -C ${posixShellQuote(wt.path)} status`; }
222
+ export function formatBridgeWorktreeCleanupAdvisory(inspection) {
223
+ const eligible = buildBridgeWorktreePrunePlan(inspection);
224
+ if (!eligible.length)
225
+ return null;
226
+ const known = eligible.reduce((n, wt) => n + (wt.size?.bytes ?? 0), 0);
227
+ const size = eligible.every(wt => wt.size?.complete) ? `${known} bytes` : `${known} known bytes; partial/unknown size`;
228
+ return `${eligible.length} Bridge worktrees (${size}) can be removed: npx -y ${MCP_PACKAGE_NAME} worktrees --prune`;
229
+ }
230
+ export async function bridgeWorktreeCleanupAdvisory(cwd) {
231
+ try {
232
+ return formatBridgeWorktreeCleanupAdvisory(await inspectBridgeWorktrees({ cwd, budgetMs: 1000 }));
233
+ }
234
+ catch {
235
+ return null;
236
+ }
237
+ }
@@ -0,0 +1,6 @@
1
+ export function describeCheckEvidence(name, outcome, source) {
2
+ const inferred = /test|unit|integration|e2e/i.test(name);
3
+ return { identity: name, purpose: inferred ? "possibly tests" : "unknown",
4
+ purposeProvenance: inferred ? "name-inference" : "unknown", discoverySource: source,
5
+ executionOutcome: outcome };
6
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * BAPI-1654 — which CI systems does this repository configure?
3
+ *
4
+ * Read-only, file-based, and independent of the remote host: a repository on
5
+ * GitHub can still run CircleCI, and "no checks have reported" is not "no CI".
6
+ * The answer names every system found, in a fixed order, so the owner-facing
7
+ * wording can name them. It never reads a file's contents beyond what is needed
8
+ * to tell that it exists, and it never returns content.
9
+ */
10
+ /** Plain names, by id. */
11
+ export const CI_SYSTEM_NAMES = Object.freeze({
12
+ github_actions: "GitHub Actions",
13
+ circleci: "CircleCI",
14
+ jenkins: "Jenkins",
15
+ buildkite: "Buildkite",
16
+ });
17
+ const FILE_PROBES = Object.freeze([
18
+ { id: "circleci", path: ".circleci/config.yml" },
19
+ { id: "jenkins", path: "Jenkinsfile" },
20
+ { id: "buildkite", path: ".buildkite/pipeline.yml" },
21
+ ]);
22
+ /** Detect configured CI systems. Never throws. */
23
+ export async function detectCiSystems(fs) {
24
+ const systems = [];
25
+ let complete = true;
26
+ try {
27
+ const entries = await fs.listDir(".github/workflows");
28
+ const workflow = (entries ?? []).filter((n) => typeof n === "string" && /^[^/\\]+\.ya?ml$/.test(n)).sort()[0];
29
+ if (workflow !== undefined) {
30
+ systems.push({ id: "github_actions", name: CI_SYSTEM_NAMES.github_actions, path: `.github/workflows/${workflow}` });
31
+ }
32
+ }
33
+ catch {
34
+ complete = false;
35
+ }
36
+ for (const probe of FILE_PROBES) {
37
+ try {
38
+ if (await fs.exists(probe.path))
39
+ systems.push({ id: probe.id, name: CI_SYSTEM_NAMES[probe.id], path: probe.path });
40
+ }
41
+ catch {
42
+ complete = false;
43
+ }
44
+ }
45
+ return { systems, complete };
46
+ }
47
+ /** The plain names of the detected systems Bridge cannot safely change. */
48
+ export function systemsWithoutAdapter(systems) {
49
+ return systems.filter((s) => s.id !== "github_actions" && s.name !== CI_SYSTEM_NAMES.github_actions).map((s) => s.name);
50
+ }