@bridge-ds/mcp 0.8.4 → 0.9.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.
@@ -0,0 +1,206 @@
1
+ import { type FigmaFixesFile } from '@bridge-ds/core';
2
+ import type { BridgeContext } from './context.js';
3
+ /** Where `bridge specs --measure` writes, from the repo root. */
4
+ export declare const MEASURED_SPECS_FILE = "measured-specs.json";
5
+ /** The label every figma-fixes.json change carries, next to drafted-by-claude. */
6
+ export declare const FIGMA_FIXES_LABEL = "figma-fixes";
7
+ export interface FixFilesArgs {
8
+ /** measured-specs.json path in the repo. */
9
+ measured?: string | undefined;
10
+ /** The fidelity run: a path in the repo, or the report itself (pasted from the plugin's "Copy the report"). */
11
+ fidelity?: string | Record<string, unknown> | undefined;
12
+ /** figma-fixes.json path in the repo. */
13
+ fixesFile?: string | undefined;
14
+ }
15
+ /** bridge_figma_gaps / `bridge gaps`: the components whose Figma build differs from their story, or cannot be checked. */
16
+ export declare function figmaGapsOp(ctx: BridgeContext, a?: FixFilesArgs): Promise<{
17
+ measured: string;
18
+ gaps: import("@bridge-ds/core").FigmaGapRow[];
19
+ next: string;
20
+ report: string;
21
+ checkedAt: string | undefined;
22
+ referee: string;
23
+ } | {
24
+ measured: string;
25
+ gaps: import("@bridge-ds/core").FigmaGapRow[];
26
+ next: string;
27
+ note: string;
28
+ referee: string;
29
+ }>;
30
+ /** bridge_get_gap_case / `bridge fix <component> --case`: one component's gap case and the fix schema. */
31
+ export declare function getGapCaseOp(ctx: BridgeContext, a: FixFilesArgs & {
32
+ component: string;
33
+ }): Promise<{
34
+ schema: string;
35
+ docs: string;
36
+ rounds: {
37
+ used: number;
38
+ max: number;
39
+ };
40
+ /** Ids already in figma-fixes.json: a new fix takes another id, or the same id to replace that fix. */
41
+ fixIds: string[];
42
+ next: string;
43
+ report: string;
44
+ gap: import("@bridge-ds/core").GapCase;
45
+ } | {
46
+ schema: string;
47
+ docs: string;
48
+ rounds: {
49
+ used: number;
50
+ max: number;
51
+ };
52
+ /** Ids already in figma-fixes.json: a new fix takes another id, or the same id to replace that fix. */
53
+ fixIds: string[];
54
+ next: string;
55
+ note: string;
56
+ gap: import("@bridge-ds/core").GapCase;
57
+ }>;
58
+ /** bridge_try_figma_fix / `bridge fix <component> --try fixes.json`: the values referee on proposed fixes. */
59
+ export declare function tryFigmaFixOp(ctx: BridgeContext, a: FixFilesArgs & {
60
+ component: string;
61
+ fixes: unknown[];
62
+ }): Promise<{
63
+ next: string;
64
+ fixesFile?: FigmaFixesFile | undefined;
65
+ report: string;
66
+ round: number;
67
+ roundsLeft: number;
68
+ pixelCheck: string;
69
+ status: "invalid" | "checked";
70
+ component: string;
71
+ problems: string[];
72
+ applied: import("@bridge-ds/core").AppliedFix[];
73
+ verdict: import("@bridge-ds/core").FixVerdict;
74
+ referee: "values";
75
+ variants: import("@bridge-ds/core").TriedVariant[];
76
+ summary: string;
77
+ detail: string;
78
+ } | {
79
+ next: string;
80
+ fixesFile?: FigmaFixesFile | undefined;
81
+ note: string;
82
+ round: number;
83
+ roundsLeft: number;
84
+ pixelCheck: string;
85
+ status: "invalid" | "checked";
86
+ component: string;
87
+ problems: string[];
88
+ applied: import("@bridge-ds/core").AppliedFix[];
89
+ verdict: import("@bridge-ds/core").FixVerdict;
90
+ referee: "values";
91
+ variants: import("@bridge-ds/core").TriedVariant[];
92
+ summary: string;
93
+ detail: string;
94
+ }>;
95
+ /**
96
+ * bridge_propose_figma_fixes / `bridge fix <component> --propose fixes.json`: the accepted fixes in figma-fixes.json on
97
+ * a new branch, opened for review like other Bridge changes (a draft pull request labelled drafted-by-claude and its
98
+ * tier; locally, a bridge/* branch never pushed). The values referee runs again first: a fix that moves the component
99
+ * further from the code is refused, and part or story fixes that move nothing are refused (propose a status fix),
100
+ * unless they size, place or lay out a part: the values referee can't judge layout, Check fidelity decides.
101
+ */
102
+ export declare function proposeFigmaFixesOp(ctx: BridgeContext, a: FixFilesArgs & {
103
+ component: string;
104
+ fixes: unknown[];
105
+ summary: string;
106
+ dryRun?: boolean | undefined;
107
+ source?: 'mcp' | 'cli' | undefined;
108
+ }): Promise<{
109
+ status: string;
110
+ verdict: "same" | "worse";
111
+ why: string;
112
+ detail: string;
113
+ hint: string;
114
+ } | {
115
+ labels: string[];
116
+ prBody: string;
117
+ fileContents: {
118
+ path: string;
119
+ content: string;
120
+ }[];
121
+ component: string;
122
+ verdict: "closer" | "same";
123
+ summary: string;
124
+ variants: import("@bridge-ds/core").TriedVariant[];
125
+ fixes: string[];
126
+ tier: import("@bridge-ds/core").RiskTier;
127
+ prTitle: string;
128
+ status: string;
129
+ why?: undefined;
130
+ detail?: undefined;
131
+ hint?: undefined;
132
+ } | {
133
+ prBody: string;
134
+ fileContents: {
135
+ path: string;
136
+ content: string;
137
+ }[];
138
+ component: string;
139
+ verdict: "closer" | "same";
140
+ summary: string;
141
+ variants: import("@bridge-ds/core").TriedVariant[];
142
+ fixes: string[];
143
+ tier: import("@bridge-ds/core").RiskTier;
144
+ prTitle: string;
145
+ status: string;
146
+ message: string;
147
+ why?: undefined;
148
+ detail?: undefined;
149
+ hint?: undefined;
150
+ } | {
151
+ branch: string;
152
+ base: string;
153
+ commit: string;
154
+ prBody: string;
155
+ labels: string[];
156
+ next: string;
157
+ component: string;
158
+ verdict: "closer" | "same";
159
+ summary: string;
160
+ variants: import("@bridge-ds/core").TriedVariant[];
161
+ fixes: string[];
162
+ tier: import("@bridge-ds/core").RiskTier;
163
+ prTitle: string;
164
+ status: string;
165
+ why?: undefined;
166
+ detail?: undefined;
167
+ hint?: undefined;
168
+ } | {
169
+ prBody: string;
170
+ labels: string[];
171
+ fileContents: {
172
+ path: string;
173
+ content: string;
174
+ }[];
175
+ component: string;
176
+ verdict: "closer" | "same";
177
+ summary: string;
178
+ variants: import("@bridge-ds/core").TriedVariant[];
179
+ fixes: string[];
180
+ tier: import("@bridge-ds/core").RiskTier;
181
+ prTitle: string;
182
+ status: string;
183
+ message: string;
184
+ why?: undefined;
185
+ detail?: undefined;
186
+ hint?: undefined;
187
+ } | {
188
+ branch: string;
189
+ commit: string;
190
+ pr: number;
191
+ url: string;
192
+ labels: string[];
193
+ draft: boolean;
194
+ next: string;
195
+ component: string;
196
+ verdict: "closer" | "same";
197
+ summary: string;
198
+ variants: import("@bridge-ds/core").TriedVariant[];
199
+ fixes: string[];
200
+ tier: import("@bridge-ds/core").RiskTier;
201
+ prTitle: string;
202
+ status: string;
203
+ why?: undefined;
204
+ detail?: undefined;
205
+ hint?: undefined;
206
+ }>;
package/dist/figma.d.ts CHANGED
@@ -45,13 +45,14 @@ export declare function getFigmaChangeOp(ctx: BridgeContext, a: {
45
45
  status: string;
46
46
  said: string;
47
47
  }>;
48
- /** bridge_mark_figma_change_drafted / `bridge figma drafted <n>`: the code is on the branch, labelled drafted by Claude AI. */
48
+ /** bridge_mark_figma_change_drafted / `bridge figma drafted <n>`: the code is on the branch, ready for review and labelled drafted by Claude AI. */
49
49
  export declare function markFigmaDraftedOp(ctx: BridgeContext, a: {
50
50
  pr: number | string;
51
51
  }): Promise<{
52
52
  pr: number;
53
53
  status: string;
54
54
  said: string;
55
+ readyForReview: boolean;
55
56
  files: string[];
56
57
  next: string;
57
58
  }>;
package/dist/history.d.ts CHANGED
@@ -115,7 +115,9 @@ export declare function getTokenHistory(ctx: BridgeContext, a: {
115
115
  }[];
116
116
  }>;
117
117
  /** Finds an entry by id ("pr-12"), PR number ("#12", "12"), or sha (7 characters or more). */
118
- export declare function findEntry(entries: HistoryEntry[], target: string): HistoryEntry;
118
+ export declare function findEntry(entries: HistoryEntry[], target: string, ctx?: {
119
+ surface: 'mcp' | 'cli';
120
+ }): HistoryEntry;
119
121
  export interface RestoreArg {
120
122
  path: string;
121
123
  /** History entry whose value to restore (its value AFTER that change), or use `value`. */
@@ -134,16 +136,44 @@ export interface PlanArgs {
134
136
  /** Shortcut: every conflict uses the value from before the change. */
135
137
  restoreConflicts?: boolean;
136
138
  }
139
+ /** Items per list in a bridge_plan_revert answer, and the longest PR body it returns, so a bulk revert stays readable. */
140
+ export declare const PLAN_PAGE = 50;
141
+ export declare const PLAN_BODY_MAX = 20000;
142
+ /**
143
+ * One page of each list of a plan report (edits, conflicts, skipped, changes), with the totals and how to read the
144
+ * rest. The whole plan is still what bridge_propose_revert opens.
145
+ */
146
+ export declare function pagePlanReport<R extends {
147
+ edits: unknown[];
148
+ conflicts: unknown[];
149
+ skipped: unknown[];
150
+ changes: unknown[];
151
+ }>(report: R, limit?: number, offset?: number): R & {
152
+ truncated?: string | undefined;
153
+ edits: unknown[];
154
+ conflicts: unknown[];
155
+ skipped: unknown[];
156
+ changes: unknown[];
157
+ counts: {
158
+ edits: number;
159
+ conflicts: number;
160
+ skipped: number;
161
+ changes: number;
162
+ };
163
+ };
137
164
  /** Dry run: what undoing a change (or restoring a token) takes, conflicts included. Writes nothing. */
138
165
  export declare function planRevertOp(ctx: BridgeContext, a: PlanArgs & {
139
166
  includeBody?: boolean;
167
+ limit?: number;
168
+ offset?: number;
140
169
  }): Promise<{
141
170
  next: string;
142
- prBody?: string | undefined;
171
+ prBody: string;
172
+ prBodyNote: string;
143
173
  tier: 1 | 2 | 3;
144
174
  bump: import("@bridge-ds/core").SemverBump;
145
175
  reasons: string[];
146
- edits: string[];
176
+ edits: string[] & unknown[];
147
177
  conflicts: {
148
178
  before?: string | undefined;
149
179
  now?: unknown;
@@ -154,15 +184,15 @@ export declare function planRevertOp(ctx: BridgeContext, a: PlanArgs & {
154
184
  message: string;
155
185
  later: string[];
156
186
  resolution: RevertResolution;
157
- }[];
158
- skipped: string[];
187
+ }[] & unknown[];
188
+ skipped: string[] & unknown[];
159
189
  changes: {
160
190
  kind: "added" | "changed" | "renamed" | "removed";
161
191
  path: string;
162
192
  file: string;
163
193
  before: string | undefined;
164
194
  after: string | undefined;
165
- }[];
195
+ }[] & unknown[];
166
196
  contrast: {
167
197
  moved: number;
168
198
  newFailures: import("@bridge-ds/core").ContrastDelta[];
@@ -183,6 +213,119 @@ export declare function planRevertOp(ctx: BridgeContext, a: PlanArgs & {
183
213
  title: string;
184
214
  why?: string | undefined;
185
215
  status: "ready" | "blocked" | "nothing-to-do";
216
+ truncated?: string | undefined;
217
+ counts: {
218
+ edits: number;
219
+ conflicts: number;
220
+ skipped: number;
221
+ changes: number;
222
+ };
223
+ } | {
224
+ next: string;
225
+ prBody: string;
226
+ prBodyNote?: undefined;
227
+ tier: 1 | 2 | 3;
228
+ bump: import("@bridge-ds/core").SemverBump;
229
+ reasons: string[];
230
+ edits: string[] & unknown[];
231
+ conflicts: {
232
+ before?: string | undefined;
233
+ now?: unknown;
234
+ key: string;
235
+ path: string;
236
+ file: string;
237
+ reason: import("@bridge-ds/core").ConflictReason;
238
+ message: string;
239
+ later: string[];
240
+ resolution: RevertResolution;
241
+ }[] & unknown[];
242
+ skipped: string[] & unknown[];
243
+ changes: {
244
+ kind: "added" | "changed" | "renamed" | "removed";
245
+ path: string;
246
+ file: string;
247
+ before: string | undefined;
248
+ after: string | undefined;
249
+ }[] & unknown[];
250
+ contrast: {
251
+ moved: number;
252
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
253
+ sample: import("@bridge-ds/core").ContrastDelta[];
254
+ };
255
+ newErrors: import("@bridge-ds/core").LayerIssue[];
256
+ branch: string;
257
+ files: string[];
258
+ notes: string[];
259
+ reverts?: {
260
+ pr?: number | undefined;
261
+ id: string;
262
+ title: string;
263
+ date: string;
264
+ author: string;
265
+ } | undefined;
266
+ kind: "revert" | "restore";
267
+ title: string;
268
+ why?: string | undefined;
269
+ status: "ready" | "blocked" | "nothing-to-do";
270
+ truncated?: string | undefined;
271
+ counts: {
272
+ edits: number;
273
+ conflicts: number;
274
+ skipped: number;
275
+ changes: number;
276
+ };
277
+ } | {
278
+ next: string;
279
+ tier: 1 | 2 | 3;
280
+ bump: import("@bridge-ds/core").SemverBump;
281
+ reasons: string[];
282
+ edits: string[] & unknown[];
283
+ conflicts: {
284
+ before?: string | undefined;
285
+ now?: unknown;
286
+ key: string;
287
+ path: string;
288
+ file: string;
289
+ reason: import("@bridge-ds/core").ConflictReason;
290
+ message: string;
291
+ later: string[];
292
+ resolution: RevertResolution;
293
+ }[] & unknown[];
294
+ skipped: string[] & unknown[];
295
+ changes: {
296
+ kind: "added" | "changed" | "renamed" | "removed";
297
+ path: string;
298
+ file: string;
299
+ before: string | undefined;
300
+ after: string | undefined;
301
+ }[] & unknown[];
302
+ contrast: {
303
+ moved: number;
304
+ newFailures: import("@bridge-ds/core").ContrastDelta[];
305
+ sample: import("@bridge-ds/core").ContrastDelta[];
306
+ };
307
+ newErrors: import("@bridge-ds/core").LayerIssue[];
308
+ branch: string;
309
+ files: string[];
310
+ notes: string[];
311
+ reverts?: {
312
+ pr?: number | undefined;
313
+ id: string;
314
+ title: string;
315
+ date: string;
316
+ author: string;
317
+ } | undefined;
318
+ kind: "revert" | "restore";
319
+ title: string;
320
+ why?: string | undefined;
321
+ status: "ready" | "blocked" | "nothing-to-do";
322
+ truncated?: string | undefined;
323
+ counts: {
324
+ edits: number;
325
+ conflicts: number;
326
+ skipped: number;
327
+ changes: number;
328
+ };
186
329
  }>;
187
330
  /** Plans, then commits to a new local bridge/* branch or opens a PR on a new bridge/* branch. Never main. */
188
331
  export declare function proposeRevert(ctx: BridgeContext, a: PlanArgs & {
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  VERSION,
4
4
  optionsFromArgv,
5
5
  serveStdio
6
- } from "./chunk-HZWFI7A2.js";
7
- import "./chunk-PMZGEZGX.js";
6
+ } from "./chunk-TP33MW7E.js";
7
+ import "./chunk-ZVORAO5H.js";
8
8
 
9
9
  // src/index.ts
10
10
  var argv = process.argv.slice(2);
@@ -16,8 +16,12 @@ Usage:
16
16
  bridge-mcp --repo <owner/name> [--ref r] GitHub repo over the API
17
17
 
18
18
  Env:
19
- GITHUB_TOKEN optional. Without it Bridge is read-only. With it Bridge can open PRs on new
20
- bridge/* branches (never main). Use a fine-grained token scoped to one repo.
19
+ GITHUB_TOKEN optional (or BRIDGE_GITHUB_TOKEN). When neither is set, Bridge uses your gh sign-in
20
+ (gh auth token) and says so once at start. Without any token Bridge is read-only on GitHub
21
+ (60 requests an hour) and says that at start too; a local git repo still gets local bridge/*
22
+ branches, never pushed. With one Bridge files suggestions and requests (issues), reviews,
23
+ comments, branches and pull requests, never the default branch. Use a fine-grained token
24
+ scoped to one repo. bridge_get_config says what this server may write. The token is never logged.
21
25
  `);
22
26
  process.exit(0);
23
27
  }
package/dist/lib.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type ContextOptions } from './context.js';
2
2
  export { BridgeContext, type ContextOptions } from './context.js';
3
+ export { BlockedError, isBlocked, say } from './say.js';
3
4
  export { createServer, VERSION } from './server.js';
4
5
  export { CONFIG_FILE, detectConfig, parseConfig, toConfigJson, type BridgeConfig } from './config.js';
5
6
  export { core } from './core-adapter.js';
@@ -9,17 +10,29 @@ export * as ops from './ops.js';
9
10
  export * as history from './history.js';
10
11
  export * as brand from './brand.js';
11
12
  export * as requests from './requests.js';
13
+ export * as buildRequests from './build-requests.js';
12
14
  export * as explorations from './explorations.js';
13
15
  export * as drafts from './drafts.js';
14
16
  export * as branches from './branches.js';
15
17
  export * as studio from './studio.js';
16
18
  export * as pieces from './pieces.js';
17
19
  export * as figma from './figma.js';
20
+ export * as figmaFixes from './figma-fixes.js';
18
21
  export * as suggestions from './suggestions.js';
19
22
  export { DOCS_DRAFT_MODEL, anthropicReplyText, anthropicRequest, formatDocsJson, mergeDocsDraft, missingProse, parseDocsReply } from '@bridge-ds/core';
23
+ /** Where the server's GitHub token came from: the environment, the gh sign-in, or nowhere. Never the token itself. */
24
+ export type TokenSource = 'env' | 'gh' | 'none';
20
25
  export interface ServeOptions extends ContextOptions {
26
+ tokenSource?: TokenSource;
21
27
  }
28
+ /** The gh sign-in (`gh auth token`), or undefined when gh is missing or signed out. Never logged. */
29
+ export declare function ghAuthToken(): string | undefined;
30
+ /** Said once at start, on stderr: where the token came from, or what the server does without one. Never the token. */
31
+ export declare function tokenNote(source: TokenSource | undefined): string | undefined;
22
32
  /** Starts the stdio MCP server. Logs go to stderr: stdout belongs to the protocol. */
23
33
  export declare function serveStdio(opts?: ServeOptions): Promise<void>;
24
- /** Parses `--root <dir> --repo <owner/name> --ref <ref>`; token from GITHUB_TOKEN or BRIDGE_GITHUB_TOKEN. */
25
- export declare function optionsFromArgv(argv: string[], env?: NodeJS.ProcessEnv): ServeOptions;
34
+ /**
35
+ * Parses `--root <dir> --repo <owner/name> --ref <ref>`. Token: BRIDGE_GITHUB_TOKEN or GITHUB_TOKEN, else the gh
36
+ * sign-in (`gh auth token`), in the same order as the bridge CLI. `tokenSource` says which, for the start line.
37
+ */
38
+ export declare function optionsFromArgv(argv: string[], env?: NodeJS.ProcessEnv, gh?: () => string | undefined): ServeOptions;
package/dist/lib.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ BlockedError,
2
3
  BridgeContext,
3
4
  DOCS_DRAFT_MODEL,
4
5
  GitHubSource,
@@ -10,14 +11,18 @@ import {
10
11
  auditSnippet,
11
12
  branches_exports,
12
13
  brand_exports,
14
+ build_requests_exports,
13
15
  core,
14
16
  createServer,
15
17
  detectConfig,
16
18
  drafts_exports,
17
19
  explorations_exports,
18
20
  figma_exports,
21
+ figma_fixes_exports,
19
22
  formatDocsJson,
23
+ ghAuthToken,
20
24
  history_exports,
25
+ isBlocked,
21
26
  mergeDocsDraft,
22
27
  missingProse,
23
28
  ops_exports,
@@ -25,16 +30,19 @@ import {
25
30
  parseDocsReply,
26
31
  pieces_exports,
27
32
  requests_exports,
33
+ say,
28
34
  serveStdio,
29
35
  studio_exports,
30
- suggestions_exports
31
- } from "./chunk-HZWFI7A2.js";
36
+ suggestions_exports,
37
+ tokenNote
38
+ } from "./chunk-TP33MW7E.js";
32
39
  import {
33
40
  CONFIG_FILE,
34
41
  loadConfig,
35
42
  toConfigJson
36
- } from "./chunk-PMZGEZGX.js";
43
+ } from "./chunk-ZVORAO5H.js";
37
44
  export {
45
+ BlockedError,
38
46
  BridgeContext,
39
47
  CONFIG_FILE,
40
48
  DOCS_DRAFT_MODEL,
@@ -47,14 +55,18 @@ export {
47
55
  auditSnippet,
48
56
  branches_exports as branches,
49
57
  brand_exports as brand,
58
+ build_requests_exports as buildRequests,
50
59
  core,
51
60
  createServer,
52
61
  detectConfig,
53
62
  drafts_exports as drafts,
54
63
  explorations_exports as explorations,
55
64
  figma_exports as figma,
65
+ figma_fixes_exports as figmaFixes,
56
66
  formatDocsJson,
67
+ ghAuthToken,
57
68
  history_exports as history,
69
+ isBlocked,
58
70
  mergeDocsDraft,
59
71
  missingProse,
60
72
  ops_exports as ops,
@@ -63,8 +75,10 @@ export {
63
75
  parseDocsReply,
64
76
  pieces_exports as pieces,
65
77
  requests_exports as requests,
78
+ say,
66
79
  serveStdio,
67
80
  studio_exports as studio,
68
81
  suggestions_exports as suggestions,
69
- toConfigJson
82
+ toConfigJson,
83
+ tokenNote
70
84
  };
package/dist/ops.d.ts CHANGED
@@ -71,6 +71,7 @@ export declare function searchTokens(ctx: BridgeContext, a: {
71
71
  type?: string;
72
72
  limit?: number;
73
73
  }): Promise<{
74
+ truncated?: string | undefined;
74
75
  query: string;
75
76
  mode: Combo;
76
77
  total: number;
@@ -197,6 +198,46 @@ export declare function getComponentOp(ctx: BridgeContext, a: {
197
198
  * CSS module classes, contrast notes, changelog line, existing prose kept) and a prompt for the user's own Claude
198
199
  * to write the prose that code cannot tell. Nothing is written.
199
200
  */
201
+ /**
202
+ * The tokens a component reaches: the ones its stylesheets read plus every token they alias, in any mode
203
+ * (card.bg -> color.surface.raised), so a contrast pair written on semantic tokens matches a component token.
204
+ */
205
+ export declare function reachedTokens(set: TokenSet, paths: Iterable<string>): Set<string>;
206
+ /**
207
+ * Contrast pairs that concern a component: both sides among the tokens it reaches (its text on its own surface).
208
+ * A component that sets no surface of its own (text on whatever it sits on) gets the pairs of the foregrounds it
209
+ * uses instead. Never a pair that only shares a background with it.
210
+ */
211
+ export declare function relevantPairs<P extends {
212
+ foreground: string;
213
+ background: string;
214
+ }>(pairs: P[], reached: Set<string>): P[];
215
+ /** Characters of the docs prompt per page of bridge_draft_docs: a whole prompt can pass 25,000 characters. */
216
+ export declare const DOCS_PROMPT_PAGE = 12000;
217
+ /** Splits text into pages of at most `size` characters, on line breaks when it can. */
218
+ export declare function textPages(text: string, size: number): string[];
219
+ /**
220
+ * bridge_draft_docs result for a tool call: the prompt one page at a time (page 1 by default), with a summary of
221
+ * what the draft holds and how to read the next page. The CLI prints the whole draft and does not page.
222
+ */
223
+ export declare function pagedDraftDocs<D extends {
224
+ component: string;
225
+ prompt: string;
226
+ prefill: {
227
+ tokens: string[];
228
+ contrastNotes: string[];
229
+ missing: string[];
230
+ };
231
+ }>(d: D, page?: number, size?: number): {
232
+ summary: string;
233
+ } & D & {
234
+ prompt: string;
235
+ promptPage: {
236
+ next?: string | undefined;
237
+ page: number;
238
+ pages: number;
239
+ };
240
+ };
200
241
  export declare function draftDocsOp(ctx: BridgeContext, a: {
201
242
  name: string;
202
243
  branch?: string | undefined;
package/dist/say.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ type Surface = {
2
+ surface: 'mcp' | 'cli';
3
+ };
4
+ /** The MCP wording or the CLI wording, for this context's reader. */
5
+ export declare function say(ctx: Surface, mcp: string, cli: string): string;
6
+ /** Where a change comes from, as the labels say ("source: cli"): what the caller passed, else this context's reader. */
7
+ export declare const sourceOf: (ctx: Surface, source?: "mcp" | "cli" | undefined) => "mcp" | "cli";
8
+ /** The tool in pull request bodies and commit messages: "Bridge MCP" or "the bridge CLI". */
9
+ export declare const toolName: (source: "mcp" | "cli") => "Bridge MCP" | "the bridge CLI";
10
+ /** The same with its source label: "Bridge MCP (source: mcp)". */
11
+ export declare const toolTag: (source: "mcp" | "cli") => string;
12
+ /** How to give Bridge a token where it runs. */
13
+ export declare function addToken(ctx: Surface): string;
14
+ /** "Read-only: ... to open this as a pull request." for previews without a token. */
15
+ export declare function readOnlyPreview(ctx: Surface, what?: string): string;
16
+ /** Thrown when a rule blocks the action (the merge gate, the owner override): not a usage error. */
17
+ export declare class BlockedError extends Error {
18
+ readonly blocked = true;
19
+ constructor(message: string);
20
+ }
21
+ export declare const isBlocked: (e: unknown) => e is BlockedError;
22
+ export {};