@bridge-ds/mcp 0.6.0 → 0.7.1
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/dist/brand.d.ts +132 -1
- package/dist/{chunk-E4D5KPIQ.js → chunk-BZ3KXXMM.js} +8 -1
- package/dist/{chunk-M7DUTFIQ.js → chunk-YCKNSKPW.js} +1520 -103
- package/dist/figma.d.ts +8 -1
- package/dist/history.d.ts +159 -1
- package/dist/index.js +2 -2
- package/dist/lib.d.ts +1 -0
- package/dist/lib.js +5 -3
- package/dist/ops.d.ts +106 -1
- package/dist/pieces.d.ts +3 -0
- package/dist/{src-F2PTXW5B.js → src-ABI7LARD.js} +1 -1
- package/dist/studio.d.ts +18 -0
- package/dist/suggestions.d.ts +397 -0
- package/package.json +3 -3
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { type ApprovalRole, type BridgeConfig, type ChangesMode, type GitHubClient, type RequestSource, type SuggestionGovernance, type SuggestionKind, type SuggestionPayloadV1, type SuggestionStatus, type SuggestionWorkspace } from '@bridge-ds/core';
|
|
2
|
+
import { type LocalApplyMode } from '@bridge-ds/core/node';
|
|
3
|
+
import type { BridgeContext } from './context.js';
|
|
4
|
+
/** Rights a suggestion needs: an issue, never code. */
|
|
5
|
+
export declare const SUGGEST_RIGHTS = "Issues: read and write (Contents: read is enough)";
|
|
6
|
+
/**
|
|
7
|
+
* How a write reaches the code for this call: the explicit choice (a tool's `changes`, the CLI's --suggest or
|
|
8
|
+
* --direct), else `changes` in bridge.config.json, else "suggest".
|
|
9
|
+
*/
|
|
10
|
+
export declare function changesFor(ctx: BridgeContext, explicit?: ChangesMode | undefined): Promise<ChangesMode>;
|
|
11
|
+
/** What to do next once a suggestion is filed. The wording matches the issue's "How to apply". */
|
|
12
|
+
export declare const appliedNext: (n: number) => string;
|
|
13
|
+
/** Why nothing was filed: no GitHub repo, or no token that can write issues. */
|
|
14
|
+
export declare function noSuggestionAccess(ctx: BridgeContext, gh: GitHubClient | null): string;
|
|
15
|
+
/**
|
|
16
|
+
* The commit a suggestion is planned on: the local HEAD when the server reads a checkout (that is what the plan read),
|
|
17
|
+
* else the head of the ref the server reads on GitHub.
|
|
18
|
+
*/
|
|
19
|
+
export declare function suggestionBase(ctx: BridgeContext, gh: GitHubClient, config: BridgeConfig): Promise<{
|
|
20
|
+
ref: string;
|
|
21
|
+
sha: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* The payload of a whole-file change (brand, revert, config): each file with the git blob sha it has where the plan
|
|
25
|
+
* read it (null: new) and its new content (null: deleted).
|
|
26
|
+
*/
|
|
27
|
+
export declare function filesSuggestionPayload(ctx: BridgeContext, input: {
|
|
28
|
+
kind: Extract<SuggestionKind, 'brand' | 'revert' | 'config'>;
|
|
29
|
+
title: string;
|
|
30
|
+
summary: string;
|
|
31
|
+
files: {
|
|
32
|
+
path: string;
|
|
33
|
+
content: string | null;
|
|
34
|
+
}[];
|
|
35
|
+
tier: SuggestionPayloadV1['tier'];
|
|
36
|
+
base: {
|
|
37
|
+
ref: string;
|
|
38
|
+
sha: string;
|
|
39
|
+
};
|
|
40
|
+
source: RequestSource;
|
|
41
|
+
suggestedBy?: string | null | undefined;
|
|
42
|
+
checks?: Partial<SuggestionPayloadV1['checks']> | undefined;
|
|
43
|
+
}): Promise<SuggestionPayloadV1>;
|
|
44
|
+
/**
|
|
45
|
+
* Files a planned whole-file change as a suggestion (bridge_propose_brand, bridge_propose_revert in suggest mode).
|
|
46
|
+
* The caller already checked the plan is not blocked.
|
|
47
|
+
*/
|
|
48
|
+
export declare function fileSuggestion(ctx: BridgeContext, build: (base: {
|
|
49
|
+
ref: string;
|
|
50
|
+
sha: string;
|
|
51
|
+
}, suggestedBy: string | null) => Promise<SuggestionPayloadV1>, opts?: {
|
|
52
|
+
labels?: string[] | undefined;
|
|
53
|
+
details?: string | undefined;
|
|
54
|
+
dryRun?: boolean | undefined;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
status: 'dry-run';
|
|
57
|
+
suggestion: {
|
|
58
|
+
title: string;
|
|
59
|
+
labels: string[];
|
|
60
|
+
body: string;
|
|
61
|
+
parts: number;
|
|
62
|
+
};
|
|
63
|
+
} | {
|
|
64
|
+
status: 'preview';
|
|
65
|
+
message: string;
|
|
66
|
+
} | {
|
|
67
|
+
status: 'suggested';
|
|
68
|
+
number: number;
|
|
69
|
+
url: string;
|
|
70
|
+
sha: string;
|
|
71
|
+
labels: string[];
|
|
72
|
+
warnings: string[];
|
|
73
|
+
next: string;
|
|
74
|
+
}>;
|
|
75
|
+
/** 42, "#42" or an issue link: the suggestion number. Throws how to fix it otherwise. */
|
|
76
|
+
export declare function suggestionNumber(input: number | string): number;
|
|
77
|
+
/**
|
|
78
|
+
* The owners who approve suggestions, from bridge.config.json on the default branch (never from the payload, never
|
|
79
|
+
* from a branch someone could edit), with GitHub team members read when owners name teams.
|
|
80
|
+
*/
|
|
81
|
+
export declare function suggestionGovernance(ctx: BridgeContext, gh: GitHubClient): Promise<{
|
|
82
|
+
config: BridgeConfig;
|
|
83
|
+
gov: SuggestionGovernance;
|
|
84
|
+
}>;
|
|
85
|
+
export type SuggestionStatusFilter = SuggestionStatus | 'all';
|
|
86
|
+
/** bridge_list_suggestions / `bridge suggestions list`. */
|
|
87
|
+
export declare function listSuggestionsOp(ctx: BridgeContext, a?: {
|
|
88
|
+
status?: SuggestionStatusFilter | undefined;
|
|
89
|
+
state?: 'open' | 'closed' | 'all' | undefined;
|
|
90
|
+
kind?: SuggestionKind | undefined;
|
|
91
|
+
limit?: number | undefined;
|
|
92
|
+
}): Promise<{
|
|
93
|
+
repo: string;
|
|
94
|
+
label: string;
|
|
95
|
+
state: "closed" | "open" | "all";
|
|
96
|
+
status: SuggestionStatusFilter;
|
|
97
|
+
total: number;
|
|
98
|
+
suggestions: {
|
|
99
|
+
number: number;
|
|
100
|
+
title: string;
|
|
101
|
+
kind: SuggestionKind | null;
|
|
102
|
+
tier: 1 | 2 | 3 | null;
|
|
103
|
+
status: SuggestionStatus;
|
|
104
|
+
said: string;
|
|
105
|
+
author: string;
|
|
106
|
+
url: string;
|
|
107
|
+
linkedPrs: {
|
|
108
|
+
number: number;
|
|
109
|
+
url: string;
|
|
110
|
+
state: "open" | "closed";
|
|
111
|
+
merged: boolean;
|
|
112
|
+
}[];
|
|
113
|
+
}[];
|
|
114
|
+
next: string;
|
|
115
|
+
}>;
|
|
116
|
+
/** bridge_get_suggestion / `bridge suggestions show <n>`: one suggestion, with its approvals on the current version. */
|
|
117
|
+
export declare function getSuggestionOp(ctx: BridgeContext, a: {
|
|
118
|
+
number: number | string;
|
|
119
|
+
}): Promise<{
|
|
120
|
+
problem: string;
|
|
121
|
+
next: string;
|
|
122
|
+
number: number;
|
|
123
|
+
url: string;
|
|
124
|
+
title: string;
|
|
125
|
+
state: "closed" | "open";
|
|
126
|
+
status: SuggestionStatus;
|
|
127
|
+
said: string;
|
|
128
|
+
author: string;
|
|
129
|
+
labels: string[];
|
|
130
|
+
linkedPrs: {
|
|
131
|
+
number: number;
|
|
132
|
+
url: string;
|
|
133
|
+
state: "open" | "closed";
|
|
134
|
+
merged: boolean;
|
|
135
|
+
}[];
|
|
136
|
+
} | {
|
|
137
|
+
next: string;
|
|
138
|
+
brief?: string | undefined;
|
|
139
|
+
approvals: {
|
|
140
|
+
notCounted?: string[] | undefined;
|
|
141
|
+
staleReviews?: string[] | undefined;
|
|
142
|
+
approvedBy: string[];
|
|
143
|
+
missing: string[];
|
|
144
|
+
changesRequestedBy: string[];
|
|
145
|
+
};
|
|
146
|
+
applied: import("@bridge-ds/core").SuggestionAppliedRecord[];
|
|
147
|
+
previews?: {
|
|
148
|
+
label: string;
|
|
149
|
+
url: string;
|
|
150
|
+
}[] | undefined;
|
|
151
|
+
links?: {
|
|
152
|
+
neededBy?: import("@bridge-ds/core").NeededBy | undefined;
|
|
153
|
+
figma?: {
|
|
154
|
+
fileKey?: string | undefined;
|
|
155
|
+
nodeId?: string | undefined;
|
|
156
|
+
url?: string | undefined;
|
|
157
|
+
nodes?: import("@bridge-ds/core").SuggestionFigmaNode[] | undefined;
|
|
158
|
+
} | undefined;
|
|
159
|
+
exploration?: string | undefined;
|
|
160
|
+
supersedes?: number | undefined;
|
|
161
|
+
} | undefined;
|
|
162
|
+
change: {
|
|
163
|
+
files?: {
|
|
164
|
+
path: string;
|
|
165
|
+
change: string;
|
|
166
|
+
}[] | undefined;
|
|
167
|
+
componentSpec?: {
|
|
168
|
+
component: string;
|
|
169
|
+
specPath: string;
|
|
170
|
+
} | undefined;
|
|
171
|
+
docs?: {
|
|
172
|
+
component: string;
|
|
173
|
+
path: string;
|
|
174
|
+
}[] | undefined;
|
|
175
|
+
tokens?: import("@bridge-ds/core").TokenEdit[] | {
|
|
176
|
+
file: string;
|
|
177
|
+
before: unknown;
|
|
178
|
+
after: unknown;
|
|
179
|
+
from?: string | undefined;
|
|
180
|
+
kind: "added" | "changed" | "renamed" | "removed";
|
|
181
|
+
path: string;
|
|
182
|
+
}[] | undefined;
|
|
183
|
+
};
|
|
184
|
+
checks: {
|
|
185
|
+
newErrors: number;
|
|
186
|
+
contrast: import("@bridge-ds/core").SuggestionContrastCheck[];
|
|
187
|
+
blocked: string | null;
|
|
188
|
+
impact: number;
|
|
189
|
+
};
|
|
190
|
+
edited?: string | undefined;
|
|
191
|
+
createdAt: string;
|
|
192
|
+
base: {
|
|
193
|
+
ref: string;
|
|
194
|
+
sha: string;
|
|
195
|
+
};
|
|
196
|
+
tier: 1 | 2 | 3;
|
|
197
|
+
bump: "patch" | "minor" | "major";
|
|
198
|
+
version: string;
|
|
199
|
+
payloadSha: string;
|
|
200
|
+
suggestedBy?: string | undefined;
|
|
201
|
+
kind: SuggestionKind;
|
|
202
|
+
summary: string;
|
|
203
|
+
source: RequestSource;
|
|
204
|
+
number: number;
|
|
205
|
+
url: string;
|
|
206
|
+
title: string;
|
|
207
|
+
state: "closed" | "open";
|
|
208
|
+
status: SuggestionStatus;
|
|
209
|
+
said: string;
|
|
210
|
+
author: string;
|
|
211
|
+
labels: string[];
|
|
212
|
+
linkedPrs: {
|
|
213
|
+
number: number;
|
|
214
|
+
url: string;
|
|
215
|
+
state: "open" | "closed";
|
|
216
|
+
merged: boolean;
|
|
217
|
+
}[];
|
|
218
|
+
}>;
|
|
219
|
+
export type SuggestionReviewEventArg = 'approve' | 'request-changes' | 'comment' | 'decline';
|
|
220
|
+
/**
|
|
221
|
+
* bridge_review_suggestion / `bridge review <n>`: approve, request changes, comment on or decline a suggestion, as the
|
|
222
|
+
* token's user. Approvals count only from the owners in bridge.config.json and only on the version reviewed
|
|
223
|
+
* (`payloadSha`, the version bridge_get_suggestion showed): a newer version is never approved by mistake.
|
|
224
|
+
*/
|
|
225
|
+
export declare function reviewSuggestionOp(ctx: BridgeContext, a: {
|
|
226
|
+
number: number | string;
|
|
227
|
+
event: SuggestionReviewEventArg;
|
|
228
|
+
message?: string | undefined;
|
|
229
|
+
role?: ApprovalRole | undefined;
|
|
230
|
+
payloadSha?: string | undefined;
|
|
231
|
+
}): Promise<{
|
|
232
|
+
next: string;
|
|
233
|
+
warnings?: string[] | undefined;
|
|
234
|
+
number: number;
|
|
235
|
+
status: SuggestionStatus;
|
|
236
|
+
said: string;
|
|
237
|
+
} | {
|
|
238
|
+
next: string;
|
|
239
|
+
warnings?: string[] | undefined;
|
|
240
|
+
number: number;
|
|
241
|
+
event: "comment" | "approve" | "request-changes";
|
|
242
|
+
counts: boolean;
|
|
243
|
+
version: string;
|
|
244
|
+
status: SuggestionStatus;
|
|
245
|
+
said: string;
|
|
246
|
+
comment: string;
|
|
247
|
+
}>;
|
|
248
|
+
/** The planner's workspace over the GitHub API at a ref (remote mode: nothing is written, the files come back). */
|
|
249
|
+
export declare function githubWorkspace(gh: GitHubClient, ref: string): SuggestionWorkspace;
|
|
250
|
+
export type ApplyModeArg = 'dry-run' | LocalApplyMode;
|
|
251
|
+
/**
|
|
252
|
+
* bridge_apply_suggestion / `bridge apply <n>`: plans the suggestion on today's code and hands it over.
|
|
253
|
+
* - local checkout: "branch" (default, one commit on a new local branch, working tree untouched, nothing pushed),
|
|
254
|
+
* "write" (into the working tree), "patch" (a git format-patch text), or "dry-run" (the plan and the diff);
|
|
255
|
+
* - remote repo: always a plan, with the files to write yourself on a branch.
|
|
256
|
+
* Refused, blocked, conflicting or already applied: nothing written. Once a branch or files exist, the applied record
|
|
257
|
+
* is posted on the issue (best effort, needs Issues write) and the issue is labelled "being applied".
|
|
258
|
+
*/
|
|
259
|
+
export declare function applySuggestionOp(ctx: BridgeContext, a: {
|
|
260
|
+
number: number | string;
|
|
261
|
+
mode?: ApplyModeArg | undefined;
|
|
262
|
+
dryRun?: boolean | undefined;
|
|
263
|
+
acceptEdited?: boolean | undefined;
|
|
264
|
+
forceUnapproved?: boolean | undefined;
|
|
265
|
+
base?: string | undefined;
|
|
266
|
+
branch?: string | undefined;
|
|
267
|
+
}): Promise<{
|
|
268
|
+
number: number;
|
|
269
|
+
status: string;
|
|
270
|
+
outcome: string;
|
|
271
|
+
exitCode: number;
|
|
272
|
+
message: string;
|
|
273
|
+
} | {
|
|
274
|
+
next: string;
|
|
275
|
+
files?: {
|
|
276
|
+
path: string;
|
|
277
|
+
content: string | null;
|
|
278
|
+
}[] | undefined;
|
|
279
|
+
brief?: string | undefined;
|
|
280
|
+
checks?: {
|
|
281
|
+
tier: import("@bridge-ds/core").RiskTier;
|
|
282
|
+
tierWhenSuggested: import("@bridge-ds/core").RiskTier;
|
|
283
|
+
tierIncreased: boolean;
|
|
284
|
+
newErrors: number;
|
|
285
|
+
newContrastFailures: string[];
|
|
286
|
+
} | undefined;
|
|
287
|
+
approvals?: {
|
|
288
|
+
review: "changes-requested" | "needs-review" | "approved";
|
|
289
|
+
missing: string[];
|
|
290
|
+
forced: boolean;
|
|
291
|
+
edited: boolean;
|
|
292
|
+
} | undefined;
|
|
293
|
+
notes?: string[] | undefined;
|
|
294
|
+
problems?: string[] | undefined;
|
|
295
|
+
outcome: import("@bridge-ds/core").SuggestionApplyOutcome;
|
|
296
|
+
exitCode: 0 | 1 | 3;
|
|
297
|
+
version: string;
|
|
298
|
+
table: string;
|
|
299
|
+
number: number;
|
|
300
|
+
status: string;
|
|
301
|
+
message: string;
|
|
302
|
+
} | {
|
|
303
|
+
next: string;
|
|
304
|
+
warnings?: string[] | undefined;
|
|
305
|
+
recorded: boolean;
|
|
306
|
+
diff?: string | undefined;
|
|
307
|
+
patch?: string | undefined;
|
|
308
|
+
written?: string[] | undefined;
|
|
309
|
+
commit?: string | undefined;
|
|
310
|
+
branch?: string | undefined;
|
|
311
|
+
exitCode: 0 | 1 | 3;
|
|
312
|
+
brief?: string | undefined;
|
|
313
|
+
checks?: {
|
|
314
|
+
tier: import("@bridge-ds/core").RiskTier;
|
|
315
|
+
tierWhenSuggested: import("@bridge-ds/core").RiskTier;
|
|
316
|
+
tierIncreased: boolean;
|
|
317
|
+
newErrors: number;
|
|
318
|
+
newContrastFailures: string[];
|
|
319
|
+
} | undefined;
|
|
320
|
+
approvals?: {
|
|
321
|
+
review: "changes-requested" | "needs-review" | "approved";
|
|
322
|
+
missing: string[];
|
|
323
|
+
forced: boolean;
|
|
324
|
+
edited: boolean;
|
|
325
|
+
} | undefined;
|
|
326
|
+
notes?: string[] | undefined;
|
|
327
|
+
problems?: string[] | undefined;
|
|
328
|
+
outcome: import("@bridge-ds/core").SuggestionApplyOutcome;
|
|
329
|
+
version: string;
|
|
330
|
+
table: string;
|
|
331
|
+
number: number;
|
|
332
|
+
status: import("@bridge-ds/core/node").LocalApplyStatus;
|
|
333
|
+
mode: string;
|
|
334
|
+
message: string;
|
|
335
|
+
}>;
|
|
336
|
+
/**
|
|
337
|
+
* bridge_link_suggestion / `bridge suggestions link <n> --pr <m>`: records the pull request (or branch) that applies a
|
|
338
|
+
* suggestion, with the applied comment, and labels it "being applied". A pull request that does not say "Closes #n"
|
|
339
|
+
* is linked with a warning: the suggestion only closes when it says so.
|
|
340
|
+
*/
|
|
341
|
+
export declare function linkSuggestionOp(ctx: BridgeContext, a: {
|
|
342
|
+
number: number | string;
|
|
343
|
+
pr?: number | undefined;
|
|
344
|
+
branch?: string | undefined;
|
|
345
|
+
commit?: string | undefined;
|
|
346
|
+
forced?: boolean | undefined;
|
|
347
|
+
}): Promise<{
|
|
348
|
+
next: string;
|
|
349
|
+
warnings?: string[] | undefined;
|
|
350
|
+
branch?: string | undefined;
|
|
351
|
+
pr?: number | undefined;
|
|
352
|
+
number: number;
|
|
353
|
+
status: SuggestionStatus;
|
|
354
|
+
said: string;
|
|
355
|
+
}>;
|
|
356
|
+
/**
|
|
357
|
+
* bridge_create_suggestion: files any change as a suggestion from its payload (bridge.suggestion/1), for example the
|
|
358
|
+
* payload a dry run returned. Missing schema, source, date, base and checks are filled; the shape and the paths are
|
|
359
|
+
* checked against the kind's folders and the guardrails before anything is sent.
|
|
360
|
+
*/
|
|
361
|
+
export declare function createSuggestionOp(ctx: BridgeContext, a: {
|
|
362
|
+
payload: Record<string, unknown>;
|
|
363
|
+
labels?: string[] | undefined;
|
|
364
|
+
dryRun?: boolean | undefined;
|
|
365
|
+
source?: RequestSource | undefined;
|
|
366
|
+
}): Promise<{
|
|
367
|
+
status: string;
|
|
368
|
+
title: string;
|
|
369
|
+
labels: string[];
|
|
370
|
+
body: string;
|
|
371
|
+
parts: number;
|
|
372
|
+
version: string;
|
|
373
|
+
message?: undefined;
|
|
374
|
+
payload?: undefined;
|
|
375
|
+
} | {
|
|
376
|
+
status: string;
|
|
377
|
+
message: string;
|
|
378
|
+
payload: SuggestionPayloadV1;
|
|
379
|
+
title?: undefined;
|
|
380
|
+
labels?: undefined;
|
|
381
|
+
body?: undefined;
|
|
382
|
+
parts?: undefined;
|
|
383
|
+
version?: undefined;
|
|
384
|
+
} | {
|
|
385
|
+
next: string;
|
|
386
|
+
warnings?: string[] | undefined;
|
|
387
|
+
status: string;
|
|
388
|
+
number: number;
|
|
389
|
+
url: string;
|
|
390
|
+
version: string;
|
|
391
|
+
title?: undefined;
|
|
392
|
+
labels?: undefined;
|
|
393
|
+
body?: undefined;
|
|
394
|
+
parts?: undefined;
|
|
395
|
+
message?: undefined;
|
|
396
|
+
payload?: undefined;
|
|
397
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridge-ds/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Bridge MCP server: lets Claude (Claude Code, Claude Desktop or any MCP client) read, check and propose changes to a DTCG design system repo through pull requests.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"build:package": "node ../../scripts/build-packages.mjs mcp"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@bridge-ds/core": "^0.
|
|
58
|
-
"@bridge-ds/visual": "^0.3.
|
|
57
|
+
"@bridge-ds/core": "^0.11.0",
|
|
58
|
+
"@bridge-ds/visual": "^0.3.5",
|
|
59
59
|
"@modelcontextprotocol/sdk": "1.31.0",
|
|
60
60
|
"typescript": "5.9.3",
|
|
61
61
|
"zod": "3.25.76"
|