@bridge-ds/mcp 0.3.3 → 0.4.0

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 CHANGED
@@ -62,7 +62,7 @@ Working on the server itself: `npm run mcp:build` in a clone of this repo builds
62
62
  | `bridge_propose_brand` | The new brand as a local `bridge/brand-<slug>` branch or a draft PR; blocked when a pair fails |
63
63
  | `bridge_list_reviews` | Open PRs (Bridge ones flagged) and local `bridge/*` branches |
64
64
  | `bridge_get_review` | Diff table, contrast before/after, impact, tier check, CI status, approvals |
65
- | `bridge_review_pr` | Comment, approve or request changes (token required) |
65
+ | `bridge_review_pr` | Comment, approve or request changes (token required; `bridge_review_branch` is the designer version) |
66
66
  | `bridge_scaffold_component` | New component folder per the repo checklist |
67
67
  | `bridge_visual_impact` | Before/after screenshots of the impacted stories and admin screens, pixel diff, manifest (local, needs Chrome; `plan` for the selection only) |
68
68
  | `bridge_get_history` | Token history: versions, merged PRs and commits, who, when, why, tier |
@@ -75,6 +75,22 @@ Working on the server itself: `npm run mcp:build` in a clone of this repo builds
75
75
  | `bridge_create_request` | File a request as an issue labeled `component-change` (token required; `dryRun` previews; `exploration` targets an exploration branch) |
76
76
  | `bridge_start_exploration` | Start an exploration: `explore/<name>` branch and a draft pull request labeled `exploration`, previews and a snapshot package, never merged as is |
77
77
  | `bridge_list_explorations` | Explorations with status, previews, the snapshot install command and linked requests |
78
+ | `bridge_promote_exploration`, `bridge_close_exploration` | Promote an exploration to review, or close it |
79
+ | `bridge_list_products` | Products (`products` in bridge.config.json) and the one the current folder belongs to |
80
+ | `bridge_what_needs_me` | The review queue, the branches where you act now first |
81
+ | `bridge_branch_status` | One branch: status, approvals, tests, main, whether you may merge, next step |
82
+ | `bridge_list_comments`, `bridge_comment` | Read the conversation and line threads; comment or reply |
83
+ | `bridge_send_for_review`, `bridge_back_to_draft` | Ready for review, or back to draft (the author) |
84
+ | `bridge_review_branch` | Approve, request changes or comment on the version seen |
85
+ | `bridge_ask_someone_else` | Ask the other people who can give the missing approvals to review |
86
+ | `bridge_merge_branch` | Merge through Studio's gate; owner override with a reason posted first (token required) |
87
+ | `bridge_close_branch`, `bridge_reopen_branch` | Close without merging; reopen with Studio's rule |
88
+ | `bridge_update_from_main` | Update from main; token conflicts to pick, code conflicts left to a developer |
89
+ | `bridge_try_branch` | Product previews Vercel reported, the install command and a message for a product team |
90
+ | `bridge_combine_branches` | Try 2 to 4 token branches together (writes nothing) |
91
+ | `bridge_save_docs` | Save usage guidance on a new branch for review, or on an open branch |
92
+ | `bridge_get_settings` | Roles, who ships, owner override, protection, products |
93
+ | `bridge_figma_coverage` | Which components are in Figma, code images for the fidelity check |
78
94
 
79
95
  Resources: `bridge://tokens/resolved`, `bridge://design-language`, `bridge://guidelines`,
80
96
  `bridge://components/{name}`. Prompts: `review-token-pr`, `add-component`, `audit-ui-for-tokens`,
@@ -0,0 +1,443 @@
1
+ import { type BridgeConfig, type GitHubClient, type MergeChoices, type ProductConfig, type ReviewStatusKind } from '@bridge-ds/core';
2
+ import type { BridgeContext } from './context.js';
3
+ /** What a write needs from the token, per action, in the words GitHub's token settings use. */
4
+ export declare const RIGHTS: {
5
+ readonly review: "Pull requests: read and write";
6
+ readonly comment: "Pull requests (or Issues): read and write";
7
+ readonly merge: "Contents and Pull requests: read and write, and the right to ship in bridge.config.json (governance.rights)";
8
+ readonly update: "Contents and Pull requests: read and write";
9
+ readonly draft: "Pull requests: read and write (you must be the author, as in Studio)";
10
+ readonly docs: "Contents and Pull requests: read and write";
11
+ };
12
+ /** 12, "#12" or a pull request link: the branch number. Throws how to fix it otherwise. */
13
+ export declare function branchNumber(input: number | string): number;
14
+ /** Everything Studio reads about one branch to paint its header and decide its actions. */
15
+ export declare function branchFacts(ctx: BridgeContext, gh: GitHubClient, n: number, viewer: string | null): Promise<{
16
+ config: BridgeConfig;
17
+ pr: import("@bridge-ds/core").PullRequest & import("@bridge-ds/core").PullRequestSummary & {
18
+ body: string;
19
+ mergeable: boolean | null;
20
+ requestedReviewers: string[];
21
+ };
22
+ files: import("@bridge-ds/core").PullRequestFile[];
23
+ ci: import("@bridge-ds/core").CiSummary;
24
+ approvals: import("@bridge-ds/core").ApprovalSummary;
25
+ tier: import("@bridge-ds/core").RiskTier | null;
26
+ gate: import("@bridge-ds/core").MergeGate;
27
+ status: ReviewStatusKind;
28
+ fresh: import("@bridge-ds/core").Freshness;
29
+ compare: {
30
+ behindBy: number;
31
+ aheadBy: number;
32
+ mergeBase: string | null;
33
+ baseSha: string | null;
34
+ baseTree: string | null;
35
+ files: {
36
+ filename: string;
37
+ status: string;
38
+ previous_filename?: string | undefined;
39
+ }[];
40
+ } | null;
41
+ exploration: boolean;
42
+ product: ProductConfig;
43
+ lifecycle: import("@bridge-ds/core").PullState;
44
+ write: boolean | null;
45
+ repo: {
46
+ allow_squash_merge?: boolean;
47
+ allow_merge_commit?: boolean;
48
+ allow_rebase_merge?: boolean;
49
+ permissions?: {
50
+ admin?: boolean;
51
+ maintain?: boolean;
52
+ push?: boolean;
53
+ };
54
+ } | null;
55
+ }>;
56
+ /** One branch, the way Studio shows it: status, what blocks the merge and who acts, how it stands against main. */
57
+ export declare function branchStatus(ctx: BridgeContext, a: {
58
+ pr: number | string;
59
+ }): Promise<{
60
+ pr: number;
61
+ title: string;
62
+ url: string;
63
+ author: string;
64
+ product: {
65
+ key: string;
66
+ name: string;
67
+ };
68
+ lifecycle: import("@bridge-ds/core").PullState;
69
+ status: {
70
+ kind: ReviewStatusKind;
71
+ label: string;
72
+ };
73
+ approvalNeeded: string;
74
+ approvals: {
75
+ approvedBy: string[];
76
+ changesRequestedBy: string[];
77
+ design: boolean;
78
+ tech: boolean;
79
+ };
80
+ tests: {
81
+ state: import("@bridge-ds/core").CiState;
82
+ failing: string[];
83
+ running: string[];
84
+ };
85
+ main: {
86
+ state: import("@bridge-ds/core").LibraryState;
87
+ behindBy: number | null;
88
+ };
89
+ merge: {
90
+ you: string;
91
+ youCanShip: boolean;
92
+ ownerOverride: boolean;
93
+ allowed: boolean;
94
+ blockedBy: string[];
95
+ } | {
96
+ you: null;
97
+ note: string;
98
+ allowed: boolean;
99
+ blockedBy: string[];
100
+ };
101
+ next: string;
102
+ }>;
103
+ /**
104
+ * What needs me: the review queue (open branches minus running explorations and release automation), each with its
105
+ * status, and the ones where the viewer acts now first: approvals they can give, their own branches blocked or ready.
106
+ */
107
+ export declare function whatNeedsMe(ctx: BridgeContext, a?: {
108
+ limit?: number | undefined;
109
+ }): Promise<{
110
+ viewer: string | null;
111
+ summary: string;
112
+ branches: ({
113
+ pr: number;
114
+ title: string;
115
+ url: string;
116
+ author: string;
117
+ status: ReviewStatusKind;
118
+ statusLabel: string;
119
+ yours: boolean;
120
+ needsYou: string | null;
121
+ product?: undefined;
122
+ } | {
123
+ pr: number;
124
+ title: string;
125
+ url: string;
126
+ author: string;
127
+ product: string;
128
+ status: ReviewStatusKind;
129
+ statusLabel: string;
130
+ yours: boolean;
131
+ needsYou: string | null;
132
+ })[];
133
+ }>;
134
+ /** The configured products, and the one the current folder or repo belongs to (the default for new work). */
135
+ export declare function listProducts(ctx: BridgeContext): Promise<{
136
+ products: {
137
+ default: boolean;
138
+ framework?: string | undefined;
139
+ preview?: string | undefined;
140
+ path?: string | undefined;
141
+ repo?: string | undefined;
142
+ key: string;
143
+ name: string;
144
+ }[];
145
+ current: {
146
+ key: string;
147
+ name: string;
148
+ how: "path" | "default" | "repo";
149
+ };
150
+ howToPick: string;
151
+ }>;
152
+ /**
153
+ * The product new work belongs to: the one named (key or name), else the product of the current folder or repo.
154
+ * Throws with the list when the name is unknown.
155
+ */
156
+ export declare function resolveProduct(ctx: BridgeContext, name?: string | undefined): Promise<ProductConfig>;
157
+ /** Labels and a body line for a branch that starts work for a product (the default product adds nothing). */
158
+ export declare function productMarks(products: ProductConfig[], p: ProductConfig): {
159
+ labels: string[];
160
+ line: string;
161
+ };
162
+ /**
163
+ * Try it in a product and share it with a product team: the preview of each product Vercel reported for this branch
164
+ * (opened with the Bridge toolbar on it), and the install command product teams use in a staging branch, with a
165
+ * ready-to-paste message. Nothing is written.
166
+ */
167
+ export declare function tryBranch(ctx: BridgeContext, a: {
168
+ pr: number | string;
169
+ }): Promise<{
170
+ pr: number;
171
+ title: string;
172
+ tryInProduct: {
173
+ key: string;
174
+ name: string;
175
+ url: string | null;
176
+ how: string;
177
+ }[];
178
+ previews: {
179
+ app: keyof import("@bridge-ds/core").PreviewApps;
180
+ label: string;
181
+ url: string | null;
182
+ state: import("@bridge-ds/core").PreviewState;
183
+ }[];
184
+ share: {
185
+ message?: import("@bridge-ds/core").ShareMessage | undefined;
186
+ state: "ready" | "building" | "failed" | "closed" | "no-packages" | "shipped";
187
+ install: string | null;
188
+ sentence: string;
189
+ };
190
+ }>;
191
+ /**
192
+ * Combined preview of 2 to 4 token branches: the conflicts to pick ("use #118's"), how many tokens change, and the
193
+ * links that open the combination (the product with the Bridge toolbar, the library views). Nothing is written.
194
+ */
195
+ export declare function combineBranches(ctx: BridgeContext, a: {
196
+ prs: (number | string)[];
197
+ picks?: Record<string, number> | undefined;
198
+ }): Promise<{
199
+ branches: {
200
+ pr: number;
201
+ title: string;
202
+ }[];
203
+ tokens: number;
204
+ conflicts: {
205
+ key: string;
206
+ token: string;
207
+ file: string;
208
+ options: {
209
+ use: number | undefined;
210
+ titles: string[];
211
+ }[];
212
+ picked: number | null;
213
+ }[];
214
+ missingPicks: number;
215
+ problems: string[];
216
+ open: {
217
+ library?: string | undefined;
218
+ product?: string | undefined;
219
+ };
220
+ next: string;
221
+ }>;
222
+ /** Ask for review: a draft branch becomes ready for review (Studio "Mark as ready"). Its author only, as in Studio. */
223
+ export declare function sendForReview(ctx: BridgeContext, a: {
224
+ pr: number | string;
225
+ }): Promise<{
226
+ pr: number;
227
+ status: "already-in-review";
228
+ said: string;
229
+ url?: undefined;
230
+ } | {
231
+ pr: number;
232
+ status: "in-review";
233
+ said: string;
234
+ url: string;
235
+ }>;
236
+ /** Back to draft: the author takes a branch out of review (Studio More menu). */
237
+ export declare function backToDraft(ctx: BridgeContext, a: {
238
+ pr: number | string;
239
+ }): Promise<{
240
+ pr: number;
241
+ status: "draft";
242
+ said: string;
243
+ }>;
244
+ /** Approve, request changes or comment as a review, on the head the reviewer saw (Studio review box). */
245
+ export declare function reviewBranch(ctx: BridgeContext, a: {
246
+ pr: number | string;
247
+ decision: 'approve' | 'request_changes' | 'comment';
248
+ body?: string | undefined;
249
+ }): Promise<{
250
+ pr: number;
251
+ decision: "comment" | "approve" | "request_changes";
252
+ id: number;
253
+ said: string;
254
+ note: string | undefined;
255
+ }>;
256
+ /**
257
+ * "Ask someone else to review" (the review queue): asks the other people who can give the missing approvals, and
258
+ * takes the viewer off the requested reviewers. Studio's rule (core reviewersToAsk): never the viewer or the author.
259
+ */
260
+ export declare function askSomeoneElse(ctx: BridgeContext, a: {
261
+ pr: number | string;
262
+ dryRun?: boolean | undefined;
263
+ }): Promise<{
264
+ pr: number;
265
+ status: "would-ask";
266
+ asks: string[];
267
+ said: string;
268
+ asked?: undefined;
269
+ } | {
270
+ pr: number;
271
+ status: "asked";
272
+ asked: string[];
273
+ said: string;
274
+ asks?: undefined;
275
+ }>;
276
+ /** A comment on the branch, or a reply in the thread of a line comment. */
277
+ export declare function commentOnBranch(ctx: BridgeContext, a: {
278
+ pr: number | string;
279
+ body: string;
280
+ replyTo?: number | undefined;
281
+ }): Promise<{
282
+ pr: number;
283
+ replied: number;
284
+ url: string;
285
+ said: string;
286
+ } | {
287
+ pr: number;
288
+ url: string;
289
+ said: string;
290
+ replied?: undefined;
291
+ }>;
292
+ /** The comments of a branch: the conversation and the line threads (ids to reply to). */
293
+ export declare function listComments(ctx: BridgeContext, a: {
294
+ pr: number | string;
295
+ }): Promise<{
296
+ pr: number;
297
+ conversation: {
298
+ id: number;
299
+ author: string;
300
+ body: string;
301
+ at: string;
302
+ }[];
303
+ threads: {
304
+ id: number;
305
+ author: string;
306
+ file: string;
307
+ line: number | null;
308
+ body: string;
309
+ url: string;
310
+ replies: {
311
+ id: number;
312
+ author: string;
313
+ body: string;
314
+ }[];
315
+ }[];
316
+ howToReply: string;
317
+ }>;
318
+ /**
319
+ * Merge, through the same gate as Studio's Merge button (tests, approvals for the tier, who may ship, conflicts,
320
+ * drafts and explorations). With `overrideReason`, the owner override: only missing approvals are skipped, the reason is
321
+ * posted on the branch first, and only people in governance.override.allowed may use it.
322
+ */
323
+ export declare function mergeBranch(ctx: BridgeContext, a: {
324
+ pr: number | string;
325
+ overrideReason?: string | undefined;
326
+ dryRun?: boolean | undefined;
327
+ }): Promise<{
328
+ pr: number;
329
+ status: "would-merge";
330
+ said: string;
331
+ sha?: undefined;
332
+ skips?: undefined;
333
+ override?: undefined;
334
+ reasonUrl?: undefined;
335
+ } | {
336
+ pr: number;
337
+ status: "merged";
338
+ sha: string;
339
+ said: string;
340
+ skips?: undefined;
341
+ override?: undefined;
342
+ reasonUrl?: undefined;
343
+ } | {
344
+ pr: number;
345
+ status: "would-override";
346
+ skips: import("@bridge-ds/core").MissingApproval[];
347
+ said: string;
348
+ sha?: undefined;
349
+ override?: undefined;
350
+ reasonUrl?: undefined;
351
+ } | {
352
+ pr: number;
353
+ status: "merged";
354
+ override: boolean;
355
+ sha: string;
356
+ reasonUrl: string;
357
+ said: string;
358
+ skips?: undefined;
359
+ }>;
360
+ /** Close without merging (Studio More menu). The work stays on GitHub and the branch can be reopened. */
361
+ export declare function closeBranch(ctx: BridgeContext, a: {
362
+ pr: number | string;
363
+ }): Promise<{
364
+ pr: number;
365
+ status: string;
366
+ said: string;
367
+ }>;
368
+ /** Reopen a closed branch: its author or an owner, with write access, while its work is still there (Studio rule). */
369
+ export declare function reopenBranch(ctx: BridgeContext, a: {
370
+ pr: number | string;
371
+ }): Promise<{
372
+ pr: number;
373
+ status: "open";
374
+ said: string;
375
+ }>;
376
+ /**
377
+ * Update from main: when nothing conflicts, GitHub's update-branch. When only token files conflict, the conflicts to
378
+ * pick ("mine": keep the branch's value, "theirs": use main's) and, once every one is picked, a merge commit with those
379
+ * choices. Code conflicts stay with a developer on GitHub, as in Studio.
380
+ */
381
+ export declare function updateFromMain(ctx: BridgeContext, a: {
382
+ pr: number | string;
383
+ choices?: MergeChoices | undefined;
384
+ dryRun?: boolean | undefined;
385
+ }): Promise<{
386
+ pr: number;
387
+ status: "up-to-date";
388
+ said: string;
389
+ behindBy?: undefined;
390
+ conflicts?: undefined;
391
+ missing?: undefined;
392
+ commit?: undefined;
393
+ } | {
394
+ pr: number;
395
+ status: "would-update";
396
+ behindBy: number | null;
397
+ said: string;
398
+ conflicts?: undefined;
399
+ missing?: undefined;
400
+ commit?: undefined;
401
+ } | {
402
+ pr: number;
403
+ status: "updated";
404
+ said: string;
405
+ behindBy?: undefined;
406
+ conflicts?: undefined;
407
+ missing?: undefined;
408
+ commit?: undefined;
409
+ } | {
410
+ pr: number;
411
+ status: "token-conflicts";
412
+ conflicts: {
413
+ key: string;
414
+ token: string;
415
+ file: string;
416
+ mine: import("@bridge-ds/core").FlatToken | null;
417
+ theirs: import("@bridge-ds/core").FlatToken | null;
418
+ default: import("@bridge-ds/core").MergeSide | null;
419
+ }[];
420
+ missing: string[];
421
+ said: string;
422
+ behindBy?: undefined;
423
+ commit?: undefined;
424
+ } | {
425
+ pr: number;
426
+ status: "resolved";
427
+ commit: string;
428
+ said: string;
429
+ behindBy?: undefined;
430
+ conflicts?: undefined;
431
+ missing?: undefined;
432
+ }>;
433
+ /** Who may add edits to a branch, and its head, for bridge_propose_token_change with `pr` (Studio "Edit tokens in this branch"). */
434
+ export declare function addableBranch(ctx: BridgeContext, n: number): Promise<{
435
+ gh: GitHubClient;
436
+ pr: import("@bridge-ds/core").PullRequest & import("@bridge-ds/core").PullRequestSummary & {
437
+ body: string;
438
+ mergeable: boolean | null;
439
+ requestedReviewers: string[];
440
+ };
441
+ viewer: string;
442
+ comment: (paths: string[]) => string;
443
+ }>;