@bridge-ds/mcp 0.0.0-stage → 0.2.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/dist/ops.d.ts ADDED
@@ -0,0 +1,721 @@
1
+ import { type ScaffoldInput } from './components.js';
2
+ import type { BridgeContext } from './context.js';
3
+ import { type Combo, type PairInput, type TokenEdit, type TokenSet } from './core-adapter.js';
4
+ /** Accepts `color.text.muted`, `--color-text-muted` or `var(--color-text-muted)`. */
5
+ export declare function normalizeTokenPath(set: TokenSet, input: string): string;
6
+ export declare function getConfig(ctx: BridgeContext): Promise<{
7
+ source: string;
8
+ configOrigin: string;
9
+ write: string;
10
+ repo: string | null;
11
+ tokenFiles: number;
12
+ tokens: number;
13
+ tokensPerTier: {
14
+ [k: string]: number;
15
+ };
16
+ modes: Record<string, import("@bridge-ds/core").ModeAxis>;
17
+ modeCombinations: number;
18
+ config: import("@bridge-ds/core").BridgeConfig;
19
+ }>;
20
+ export declare function listTokens(ctx: BridgeContext, a: {
21
+ tier?: string;
22
+ type?: string;
23
+ prefix?: string;
24
+ mode?: Partial<Combo>;
25
+ limit?: number;
26
+ offset?: number;
27
+ }): Promise<{
28
+ next?: string | undefined;
29
+ mode: Combo;
30
+ total: number;
31
+ offset: number;
32
+ returned: number;
33
+ tokens: {
34
+ alias?: string | undefined;
35
+ path: string;
36
+ type: string | undefined;
37
+ tier: string | undefined;
38
+ value: string;
39
+ }[];
40
+ }>;
41
+ export declare function getToken(ctx: BridgeContext, a: {
42
+ path: string;
43
+ }): Promise<{
44
+ definedIn: {
45
+ file: string;
46
+ tier: string | undefined;
47
+ value: unknown;
48
+ }[];
49
+ values: {
50
+ modes: string[];
51
+ value: string;
52
+ chain: string[];
53
+ }[];
54
+ referencedBy: string[];
55
+ usedIn: {
56
+ component: string;
57
+ file: string;
58
+ via?: string;
59
+ }[];
60
+ description?: string | undefined;
61
+ path: string;
62
+ cssVar: string;
63
+ type: string | undefined;
64
+ tier: string | undefined;
65
+ }>;
66
+ export declare function searchTokens(ctx: BridgeContext, a: {
67
+ query: string;
68
+ type?: string;
69
+ limit?: number;
70
+ }): Promise<{
71
+ query: string;
72
+ mode: Combo;
73
+ total: number;
74
+ results: {
75
+ description?: string | undefined;
76
+ path: string;
77
+ score: number;
78
+ type: string | undefined;
79
+ tier: string | undefined;
80
+ value: string;
81
+ }[];
82
+ }>;
83
+ export declare function checkContrast(ctx: BridgeContext, a: {
84
+ edits?: TokenEdit[];
85
+ pairs?: PairInput[];
86
+ mode?: Partial<Combo>;
87
+ includePassing?: boolean;
88
+ }): Promise<{
89
+ results?: import("@bridge-ds/core").LayeredContrastResult[] | undefined;
90
+ source: string | undefined;
91
+ checks: number;
92
+ failing: number;
93
+ failures: import("@bridge-ds/core").LayeredContrastResult[];
94
+ tightest: {
95
+ pair: string;
96
+ modes: string;
97
+ ratio: number | null;
98
+ min: number;
99
+ }[];
100
+ } | {
101
+ pairs: number;
102
+ message: string;
103
+ } | {
104
+ edits: number;
105
+ notes: string[];
106
+ changed: import("@bridge-ds/core").ContrastDelta[];
107
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
108
+ results?: import("@bridge-ds/core").LayeredContrastResult[] | undefined;
109
+ source: string | undefined;
110
+ checks: number;
111
+ failing: number;
112
+ failures: import("@bridge-ds/core").LayeredContrastResult[];
113
+ tightest: {
114
+ pair: string;
115
+ modes: string;
116
+ ratio: number | null;
117
+ min: number;
118
+ }[];
119
+ pairs?: undefined;
120
+ message?: undefined;
121
+ }>;
122
+ export declare function validateTokens(ctx: BridgeContext, a: {
123
+ edits?: TokenEdit[];
124
+ includeWarnings?: boolean;
125
+ }): Promise<{
126
+ valid: boolean;
127
+ files: number;
128
+ tokens: number;
129
+ modeCombinations: number;
130
+ errors: import("@bridge-ds/core").LayerIssue[];
131
+ warningCount: number;
132
+ } | {
133
+ notes: string[];
134
+ newErrors: import("@bridge-ds/core").LayerIssue[];
135
+ warnings: import("@bridge-ds/core").LayerIssue[];
136
+ valid: boolean;
137
+ files: number;
138
+ tokens: number;
139
+ modeCombinations: number;
140
+ errors: import("@bridge-ds/core").LayerIssue[];
141
+ warningCount: number;
142
+ } | {
143
+ notes: string[];
144
+ newErrors: import("@bridge-ds/core").LayerIssue[];
145
+ warningSample: import("@bridge-ds/core").LayerIssue[];
146
+ valid: boolean;
147
+ files: number;
148
+ tokens: number;
149
+ modeCombinations: number;
150
+ errors: import("@bridge-ds/core").LayerIssue[];
151
+ warningCount: number;
152
+ } | {
153
+ notes: string[];
154
+ newErrors: import("@bridge-ds/core").LayerIssue[];
155
+ valid: boolean;
156
+ files: number;
157
+ tokens: number;
158
+ modeCombinations: number;
159
+ errors: import("@bridge-ds/core").LayerIssue[];
160
+ warningCount: number;
161
+ }>;
162
+ export declare function listComponentsOp(ctx: BridgeContext, a: {
163
+ withSummaries?: boolean;
164
+ family?: string;
165
+ }): Promise<{
166
+ components: never[];
167
+ message: string;
168
+ dir?: undefined;
169
+ total?: undefined;
170
+ } | {
171
+ dir: string;
172
+ total: number;
173
+ components: import("./components.js").ComponentSummary[];
174
+ message?: undefined;
175
+ }>;
176
+ export declare function getComponentOp(ctx: BridgeContext, a: {
177
+ name: string;
178
+ include?: string[];
179
+ }): Promise<{
180
+ tokens: {
181
+ notTokens?: string[] | undefined;
182
+ used: string[];
183
+ };
184
+ stories: string[];
185
+ extends?: string | undefined;
186
+ props: import("./components.js").PropInfo[];
187
+ docs?: Record<string, unknown> | undefined;
188
+ name: string;
189
+ family: string | undefined;
190
+ files: string[];
191
+ }>;
192
+ /**
193
+ * bridge_draft_docs: the deterministic pre-fill of a component's docs.json (props table, tokens, anatomy from the
194
+ * CSS module classes, contrast notes, changelog line, existing prose kept) and a prompt for the user's own Claude
195
+ * to write the prose that code cannot tell. Nothing is written.
196
+ */
197
+ export declare function draftDocsOp(ctx: BridgeContext, a: {
198
+ name: string;
199
+ branch?: string | undefined;
200
+ }): Promise<{
201
+ branch?: string | undefined;
202
+ rules?: string[] | undefined;
203
+ component: string;
204
+ path: string;
205
+ exists: boolean;
206
+ prefill: import("@bridge-ds/core").DocsPrefill;
207
+ prompt: string;
208
+ instruction: string;
209
+ }>;
210
+ export declare function getDesignLanguage(ctx: BridgeContext, a: {
211
+ section?: string;
212
+ }): Promise<{
213
+ file: string | undefined;
214
+ sections: {
215
+ level: number;
216
+ title: string;
217
+ slug: string;
218
+ }[];
219
+ hint: string;
220
+ error?: undefined;
221
+ } | {
222
+ file: string | undefined;
223
+ error: string;
224
+ sections: {
225
+ level: number;
226
+ title: string;
227
+ slug: string;
228
+ }[];
229
+ hint?: undefined;
230
+ } | {
231
+ otherMatches?: string[] | undefined;
232
+ file: string | undefined;
233
+ text: string;
234
+ sections?: undefined;
235
+ hint?: undefined;
236
+ error?: undefined;
237
+ }>;
238
+ export declare function getGuidelines(ctx: BridgeContext, a: {
239
+ section?: string;
240
+ }): Promise<{
241
+ file: string | undefined;
242
+ text: string;
243
+ error?: undefined;
244
+ sections?: undefined;
245
+ } | {
246
+ file: string | undefined;
247
+ error: string;
248
+ sections: {
249
+ level: number;
250
+ title: string;
251
+ slug: string;
252
+ }[];
253
+ text?: undefined;
254
+ } | {
255
+ bridgeEnforces: string[];
256
+ sections: {
257
+ level: number;
258
+ title: string;
259
+ slug: string;
260
+ }[];
261
+ riskTiers?: string | undefined;
262
+ file: string | undefined;
263
+ always: string[];
264
+ askBefore: string[];
265
+ never: string[];
266
+ tokenConventions: string[];
267
+ text?: undefined;
268
+ error?: undefined;
269
+ }>;
270
+ export declare function proposeTokenChange(ctx: BridgeContext, a: {
271
+ edits: TokenEdit[];
272
+ title: string;
273
+ summary?: string;
274
+ dryRun?: boolean;
275
+ branch?: string | undefined;
276
+ }): Promise<{
277
+ status: string;
278
+ message: string;
279
+ } | {
280
+ hint: string;
281
+ title: string;
282
+ tier: 1 | 2 | 3;
283
+ bump: import("@bridge-ds/core").SemverBump;
284
+ reasons: string[];
285
+ changes: {
286
+ fields?: ("value" | "description" | "type" | "extensions")[] | undefined;
287
+ file: string;
288
+ before: string | undefined;
289
+ after: string | undefined;
290
+ from?: string | undefined;
291
+ kind: "added" | "changed" | "renamed" | "removed";
292
+ path: string;
293
+ }[];
294
+ contrast: {
295
+ moved: number;
296
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
297
+ };
298
+ impact: {
299
+ total: number;
300
+ sample: import("@bridge-ds/core").ImpactEntry[];
301
+ };
302
+ notes: string[];
303
+ status: string;
304
+ why: string;
305
+ newErrors: import("@bridge-ds/core").LayerIssue[];
306
+ message?: undefined;
307
+ } | {
308
+ fileContents: {
309
+ path: string;
310
+ content: string | null;
311
+ }[];
312
+ branch: string;
313
+ files: string[];
314
+ prBody: string;
315
+ title: string;
316
+ tier: 1 | 2 | 3;
317
+ bump: import("@bridge-ds/core").SemverBump;
318
+ reasons: string[];
319
+ changes: {
320
+ fields?: ("value" | "description" | "type" | "extensions")[] | undefined;
321
+ file: string;
322
+ before: string | undefined;
323
+ after: string | undefined;
324
+ from?: string | undefined;
325
+ kind: "added" | "changed" | "renamed" | "removed";
326
+ path: string;
327
+ }[];
328
+ contrast: {
329
+ moved: number;
330
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
331
+ };
332
+ impact: {
333
+ total: number;
334
+ sample: import("@bridge-ds/core").ImpactEntry[];
335
+ };
336
+ notes: string[];
337
+ status: string;
338
+ message?: undefined;
339
+ } | {
340
+ status: "preview";
341
+ message: string;
342
+ branch: string;
343
+ next?: undefined;
344
+ exploration: boolean;
345
+ files: string[];
346
+ prBody: string;
347
+ title: string;
348
+ tier: 1 | 2 | 3;
349
+ bump: import("@bridge-ds/core").SemverBump;
350
+ reasons: string[];
351
+ changes: {
352
+ fields?: ("value" | "description" | "type" | "extensions")[] | undefined;
353
+ file: string;
354
+ before: string | undefined;
355
+ after: string | undefined;
356
+ from?: string | undefined;
357
+ kind: "added" | "changed" | "renamed" | "removed";
358
+ path: string;
359
+ }[];
360
+ contrast: {
361
+ moved: number;
362
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
363
+ };
364
+ impact: {
365
+ total: number;
366
+ sample: import("@bridge-ds/core").ImpactEntry[];
367
+ };
368
+ notes: string[];
369
+ } | {
370
+ next: string;
371
+ pr?: number | undefined;
372
+ url?: string | undefined;
373
+ status: "committed";
374
+ branch: string;
375
+ commit: string;
376
+ message?: undefined;
377
+ exploration: boolean;
378
+ files: string[];
379
+ prBody: string;
380
+ title: string;
381
+ tier: 1 | 2 | 3;
382
+ bump: import("@bridge-ds/core").SemverBump;
383
+ reasons: string[];
384
+ changes: {
385
+ fields?: ("value" | "description" | "type" | "extensions")[] | undefined;
386
+ file: string;
387
+ before: string | undefined;
388
+ after: string | undefined;
389
+ from?: string | undefined;
390
+ kind: "added" | "changed" | "renamed" | "removed";
391
+ path: string;
392
+ }[];
393
+ contrast: {
394
+ moved: number;
395
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
396
+ };
397
+ impact: {
398
+ total: number;
399
+ sample: import("@bridge-ds/core").ImpactEntry[];
400
+ };
401
+ notes: string[];
402
+ } | {
403
+ status: "written";
404
+ branch: string;
405
+ next: string;
406
+ message?: undefined;
407
+ exploration: boolean;
408
+ files: string[];
409
+ prBody: string;
410
+ title: string;
411
+ tier: 1 | 2 | 3;
412
+ bump: import("@bridge-ds/core").SemverBump;
413
+ reasons: string[];
414
+ changes: {
415
+ fields?: ("value" | "description" | "type" | "extensions")[] | undefined;
416
+ file: string;
417
+ before: string | undefined;
418
+ after: string | undefined;
419
+ from?: string | undefined;
420
+ kind: "added" | "changed" | "renamed" | "removed";
421
+ path: string;
422
+ }[];
423
+ contrast: {
424
+ moved: number;
425
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
426
+ };
427
+ impact: {
428
+ total: number;
429
+ sample: import("@bridge-ds/core").ImpactEntry[];
430
+ };
431
+ notes: string[];
432
+ } | {
433
+ fileContents: {
434
+ path: string;
435
+ content: string | null;
436
+ }[];
437
+ branch: string;
438
+ files: string[];
439
+ prBody: string;
440
+ title: string;
441
+ tier: 1 | 2 | 3;
442
+ bump: import("@bridge-ds/core").SemverBump;
443
+ reasons: string[];
444
+ changes: {
445
+ fields?: ("value" | "description" | "type" | "extensions")[] | undefined;
446
+ file: string;
447
+ before: string | undefined;
448
+ after: string | undefined;
449
+ from?: string | undefined;
450
+ kind: "added" | "changed" | "renamed" | "removed";
451
+ path: string;
452
+ }[];
453
+ contrast: {
454
+ moved: number;
455
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
456
+ };
457
+ impact: {
458
+ total: number;
459
+ sample: import("@bridge-ds/core").ImpactEntry[];
460
+ };
461
+ notes: string[];
462
+ status: string;
463
+ message: string;
464
+ } | {
465
+ branch: string;
466
+ base: string;
467
+ commit: string;
468
+ diff: string;
469
+ next: string;
470
+ files: string[];
471
+ prBody: string;
472
+ title: string;
473
+ tier: 1 | 2 | 3;
474
+ bump: import("@bridge-ds/core").SemverBump;
475
+ reasons: string[];
476
+ changes: {
477
+ fields?: ("value" | "description" | "type" | "extensions")[] | undefined;
478
+ file: string;
479
+ before: string | undefined;
480
+ after: string | undefined;
481
+ from?: string | undefined;
482
+ kind: "added" | "changed" | "renamed" | "removed";
483
+ path: string;
484
+ }[];
485
+ contrast: {
486
+ moved: number;
487
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
488
+ };
489
+ impact: {
490
+ total: number;
491
+ sample: import("@bridge-ds/core").ImpactEntry[];
492
+ };
493
+ notes: string[];
494
+ status: string;
495
+ message?: undefined;
496
+ } | {
497
+ branch: string;
498
+ commit: string;
499
+ pr: number;
500
+ url: string;
501
+ labels: string[];
502
+ draft: boolean;
503
+ files: string[];
504
+ prBody: string;
505
+ title: string;
506
+ tier: 1 | 2 | 3;
507
+ bump: import("@bridge-ds/core").SemverBump;
508
+ reasons: string[];
509
+ changes: {
510
+ fields?: ("value" | "description" | "type" | "extensions")[] | undefined;
511
+ file: string;
512
+ before: string | undefined;
513
+ after: string | undefined;
514
+ from?: string | undefined;
515
+ kind: "added" | "changed" | "renamed" | "removed";
516
+ path: string;
517
+ }[];
518
+ contrast: {
519
+ moved: number;
520
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
521
+ };
522
+ impact: {
523
+ total: number;
524
+ sample: import("@bridge-ds/core").ImpactEntry[];
525
+ };
526
+ notes: string[];
527
+ status: string;
528
+ message?: undefined;
529
+ }>;
530
+ export declare function listReviews(ctx: BridgeContext, a: {
531
+ state?: 'open' | 'closed' | 'all';
532
+ onlyBridge?: boolean;
533
+ }): Promise<Record<string, unknown>>;
534
+ export declare function getReview(ctx: BridgeContext, a: {
535
+ pr?: number;
536
+ branch?: string;
537
+ }): Promise<{
538
+ tokenChanges: number;
539
+ diffTable: string;
540
+ contrastTable: string;
541
+ contrastNewFailures: number;
542
+ validation: {
543
+ errors: number;
544
+ newErrors: import("@bridge-ds/core").LayerIssue[];
545
+ };
546
+ impact: {
547
+ total: number;
548
+ entries: import("@bridge-ds/core").ImpactEntry[];
549
+ };
550
+ tierWarning?: string | undefined;
551
+ changedFiles: string[];
552
+ tier: 1 | 2 | 3;
553
+ bump: import("@bridge-ds/core").SemverBump;
554
+ reasons: string[];
555
+ }>;
556
+ export declare function reviewPr(ctx: BridgeContext, a: {
557
+ pr: number;
558
+ event: 'comment' | 'approve' | 'request_changes';
559
+ body: string;
560
+ }): Promise<{
561
+ pr: number;
562
+ event: "COMMENT" | "APPROVE" | "REQUEST_CHANGES";
563
+ id: number;
564
+ state: string;
565
+ note: string | undefined;
566
+ }>;
567
+ export declare function scaffoldComponentOp(ctx: BridgeContext, a: ScaffoldInput & {
568
+ write?: boolean;
569
+ }): Promise<{
570
+ written: boolean;
571
+ tier: number;
572
+ files: string[] | {
573
+ path: string;
574
+ content: string;
575
+ }[];
576
+ nextSteps: string[];
577
+ }>;
578
+ export declare function auditUi(ctx: BridgeContext, code: string): Promise<import("./audit.js").Finding[]>;
579
+ /**
580
+ * Visual impact of a change: screenshots of the stories and app screens it touches at both refs, pixel-diffed.
581
+ * Local repos only (it builds Storybook and the app). `plan` returns the selection without building.
582
+ */
583
+ export declare function visualImpact(ctx: BridgeContext, a: {
584
+ base?: string;
585
+ head?: string;
586
+ out?: string;
587
+ only?: ('stories' | 'app')[];
588
+ plan?: boolean;
589
+ threshold?: number;
590
+ maxStoriesPerComponent?: number;
591
+ }, run?: typeof import('@bridge-ds/visual').runImpact): Promise<{
592
+ summary: string;
593
+ base: {
594
+ ref: string;
595
+ sha: string;
596
+ };
597
+ head: {
598
+ ref: string;
599
+ sha: string;
600
+ };
601
+ counts: import("@bridge-ds/visual").Summary;
602
+ selection: {
603
+ tokens: number;
604
+ directTokens: string[];
605
+ components: {
606
+ id: string;
607
+ why: string | undefined;
608
+ }[];
609
+ stories: number;
610
+ fallback: string | null;
611
+ app: {
612
+ include: boolean;
613
+ reason: string;
614
+ };
615
+ };
616
+ changed: {
617
+ error?: string | undefined;
618
+ composite?: string | undefined;
619
+ label: string;
620
+ mode: string;
621
+ status: import("@bridge-ds/visual").ShotStatus;
622
+ percent: number;
623
+ boxes: number;
624
+ }[];
625
+ outDir: string;
626
+ manifest: string;
627
+ next: string;
628
+ }>;
629
+ /** Audit a product folder or file (local only): adoption metrics, top files, top fixes, and findings for one file. */
630
+ export declare function auditOp(ctx: BridgeContext, a: {
631
+ path: string;
632
+ baseline?: string;
633
+ label?: string;
634
+ limit?: number;
635
+ findings?: boolean;
636
+ }): Promise<{
637
+ next: string;
638
+ findings?: {
639
+ file: string;
640
+ values: {
641
+ use?: string | undefined;
642
+ confidence?: import("@bridge-ds/core/audit").Confidence | undefined;
643
+ property?: string | undefined;
644
+ line: number;
645
+ value: string;
646
+ category: import("@bridge-ds/core/audit").FindingCategory;
647
+ }[];
648
+ components: {
649
+ use?: string | undefined;
650
+ line: number;
651
+ name: string;
652
+ kind: "foreign" | "native" | "recreated";
653
+ library: string;
654
+ }[];
655
+ }[] | undefined;
656
+ byCategory: Partial<Record<import("@bridge-ds/core/audit").FindingCategory, import("@bridge-ds/core/audit").CategoryCount>>;
657
+ components: {
658
+ ds: Record<string, number>;
659
+ foreign: {
660
+ [k: string]: {
661
+ instances: number;
662
+ top: string[];
663
+ };
664
+ };
665
+ native: Record<string, number>;
666
+ recreated: {
667
+ name: string;
668
+ file: string;
669
+ line: number;
670
+ instances: number;
671
+ }[];
672
+ };
673
+ topFiles: {
674
+ path: string;
675
+ hardcoded: number;
676
+ otherComponents: number;
677
+ tokenUsages: number;
678
+ dsComponents: number;
679
+ }[];
680
+ topFixes: ({
681
+ confidence: import("@bridge-ds/core/audit").Confidence;
682
+ mode?: string | undefined;
683
+ use: string;
684
+ token: string;
685
+ tokenValue: string;
686
+ value: string;
687
+ category: import("@bridge-ds/core/audit").FindingCategory;
688
+ count: number;
689
+ } | {
690
+ use: null;
691
+ value: string;
692
+ category: import("@bridge-ds/core/audit").FindingCategory;
693
+ count: number;
694
+ })[];
695
+ sinceBaseline?: {
696
+ tokenAdoption: {
697
+ before: number | null;
698
+ after: number | null;
699
+ delta: number | null;
700
+ };
701
+ componentAdoption: {
702
+ before: number | null;
703
+ after: number | null;
704
+ delta: number | null;
705
+ };
706
+ hardcoded: {
707
+ before: number;
708
+ after: number;
709
+ delta: number;
710
+ };
711
+ improved: number;
712
+ regressed: {
713
+ path: string;
714
+ before: number;
715
+ after: number;
716
+ }[];
717
+ } | undefined;
718
+ target: string;
719
+ files: number;
720
+ metrics: import("@bridge-ds/core/audit").AuditMetrics;
721
+ }>;