@bridge-ds/core 0.7.0 → 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.
- package/dist/audit/index.d.ts +1 -0
- package/dist/audit/index.js +269 -23
- package/dist/audit/index.js.map +1 -1
- package/dist/audit/missing-pieces.d.ts +43 -0
- package/dist/component-spec-BzfBkYRD.js +1122 -0
- package/dist/component-spec-BzfBkYRD.js.map +1 -0
- package/dist/docs-proposal.d.ts +73 -1
- package/dist/explorations-github.d.ts +2 -0
- package/dist/github-client.d.ts +9 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1744 -1418
- package/dist/index.js.map +1 -1
- package/dist/node/index.js +5 -3
- package/dist/node/index.js.map +1 -1
- package/dist/{component-spec-1z2ih4E3.js → pr-composer-D2SZm7cg.js} +826 -1443
- package/dist/pr-composer-D2SZm7cg.js.map +1 -0
- package/dist/prod-branch-D5Tl87Wf.js +266 -0
- package/dist/prod-branch-D5Tl87Wf.js.map +1 -0
- package/dist/prod-branch-github.d.ts +139 -0
- package/dist/prod-branch.d.ts +257 -0
- package/dist/products.d.ts +9 -0
- package/dist/{report-iPSnsjYi.js → report-DY_peRy4.js} +24 -24
- package/dist/{report-iPSnsjYi.js.map → report-DY_peRy4.js.map} +1 -1
- package/dist/token-proposal.d.ts +72 -0
- package/package.json +1 -1
- package/dist/component-spec-1z2ih4E3.js.map +0 -1
- package/dist/layered-BnbmToGs.js +0 -500
- package/dist/layered-BnbmToGs.js.map +0 -1
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import type { Exploration } from './explorations';
|
|
2
|
+
import type { ComponentChangeRequest } from './requests';
|
|
3
|
+
import type { TokenEdit } from './token-edits';
|
|
4
|
+
/** What the library lacks: a token value, a variant of an existing component, or a component. */
|
|
5
|
+
export type PieceKind = 'token' | 'variant' | 'component';
|
|
6
|
+
/** What a variant changes on its component, in designer words. */
|
|
7
|
+
export type PieceAspect = 'tone' | 'shape' | 'size' | 'style';
|
|
8
|
+
export interface PieceValue {
|
|
9
|
+
/** Audit category: color, radius, spacing... */
|
|
10
|
+
category: string;
|
|
11
|
+
/** CSS property, when known: background-color, border-radius. */
|
|
12
|
+
property?: string | undefined;
|
|
13
|
+
/** As written: "#c2410c", "10px". */
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PieceNearest {
|
|
17
|
+
/** Token path of the closest library value: color.feedback.danger.bg. */
|
|
18
|
+
token: string;
|
|
19
|
+
cssVar: string;
|
|
20
|
+
/** Its value, as the audit resolved it. */
|
|
21
|
+
value: string;
|
|
22
|
+
/** How close: high means it looks a lot like it. */
|
|
23
|
+
level: 'exact' | 'high' | 'medium' | 'low';
|
|
24
|
+
/** The word people use for it: "danger" for color.feedback.danger.bg, "control" for radius.control. */
|
|
25
|
+
label: string;
|
|
26
|
+
}
|
|
27
|
+
export interface MissingPiece {
|
|
28
|
+
/** Stable id inside one product branch: "badge-overdue-tone", "color-c2410c". */
|
|
29
|
+
id: string;
|
|
30
|
+
kind: PieceKind;
|
|
31
|
+
/** Designer title: "Badge: overdue tone", "New color #C2410C", "New component: Timeline". */
|
|
32
|
+
title: string;
|
|
33
|
+
/** One plain sentence: what the branch did and what the library has today. */
|
|
34
|
+
summary: string;
|
|
35
|
+
/** The name the branch gives it ("overdue"), from a class name, the element's text or the component name. */
|
|
36
|
+
name: string;
|
|
37
|
+
/** The library component it extends (variant) or the proposed component name (component). */
|
|
38
|
+
component?: string | undefined;
|
|
39
|
+
aspect?: PieceAspect | undefined;
|
|
40
|
+
values: PieceValue[];
|
|
41
|
+
nearest?: PieceNearest | undefined;
|
|
42
|
+
/** Where the branch writes it, first places only. */
|
|
43
|
+
where: {
|
|
44
|
+
file: string;
|
|
45
|
+
line: number;
|
|
46
|
+
}[];
|
|
47
|
+
/** Token pieces: the token the library branch would add (one value, every file the closest token lives in). */
|
|
48
|
+
token?: {
|
|
49
|
+
path: string;
|
|
50
|
+
type: string;
|
|
51
|
+
value: string;
|
|
52
|
+
files: string[];
|
|
53
|
+
} | undefined;
|
|
54
|
+
}
|
|
55
|
+
/** Where the library side of a piece lives. */
|
|
56
|
+
export type LibraryLinkKind = 'token-change' | 'exploration' | 'request';
|
|
57
|
+
export interface LibraryLink {
|
|
58
|
+
/** The piece id. */
|
|
59
|
+
piece: string;
|
|
60
|
+
kind: LibraryLinkKind;
|
|
61
|
+
/** Pull request number (token change, exploration) or issue number (request). */
|
|
62
|
+
number: number;
|
|
63
|
+
url: string;
|
|
64
|
+
title: string;
|
|
65
|
+
/** Head branch of a pull request. */
|
|
66
|
+
branch?: string | undefined;
|
|
67
|
+
/** GitHub login of who opened it, and the AI agent behind it ("claude") when one did. */
|
|
68
|
+
openedBy?: string | undefined;
|
|
69
|
+
agent?: string | undefined;
|
|
70
|
+
/** ISO date. */
|
|
71
|
+
at: string;
|
|
72
|
+
}
|
|
73
|
+
/** What the product branch body keeps: the last check and the library branches opened for its pieces. */
|
|
74
|
+
export interface PiecesRecord {
|
|
75
|
+
/** ISO date of the last check. */
|
|
76
|
+
checkedAt: string;
|
|
77
|
+
/** Head commit the check read. */
|
|
78
|
+
headSha?: string | undefined;
|
|
79
|
+
pieces: MissingPiece[];
|
|
80
|
+
links: LibraryLink[];
|
|
81
|
+
/** Values and elements the library already has (a token or a component to use instead): fixes, not pieces. */
|
|
82
|
+
fixes?: number | undefined;
|
|
83
|
+
}
|
|
84
|
+
/** Every library branch opened for a product branch carries this label, so lists can find them without the body. */
|
|
85
|
+
export declare const NEEDED_BY_LABEL = "needed-by-product";
|
|
86
|
+
/** The record in a product branch body, or undefined when the branch was never checked. */
|
|
87
|
+
export declare function parsePiecesRecord(body: string | null | undefined): PiecesRecord | undefined;
|
|
88
|
+
/** The section people read on GitHub, then the hidden record tools read. */
|
|
89
|
+
export declare function piecesSection(r: PiecesRecord): string;
|
|
90
|
+
/** The body with the pieces section replaced, or added at the end. */
|
|
91
|
+
export declare function withPiecesRecord(body: string | null | undefined, r: PiecesRecord): string;
|
|
92
|
+
/**
|
|
93
|
+
* A new check merged with the previous record: links stay with their piece (same id), and links of pieces the branch
|
|
94
|
+
* no longer has stay too, so a library branch is never forgotten.
|
|
95
|
+
*/
|
|
96
|
+
export declare function mergePiecesRecord(prev: PiecesRecord | undefined, next: Omit<PiecesRecord, 'links'> & {
|
|
97
|
+
links?: LibraryLink[] | undefined;
|
|
98
|
+
}): PiecesRecord;
|
|
99
|
+
/** The record with one more link (replacing the piece's earlier one). */
|
|
100
|
+
export declare function withLink(r: PiecesRecord, l: LibraryLink): PiecesRecord;
|
|
101
|
+
export interface NeededBy {
|
|
102
|
+
/** The product branch (pull request number), its title and branch. */
|
|
103
|
+
pr: number;
|
|
104
|
+
title: string;
|
|
105
|
+
branch: string;
|
|
106
|
+
url: string;
|
|
107
|
+
/** Product key and name: "admin", "Admin demo". */
|
|
108
|
+
product: string;
|
|
109
|
+
productName: string;
|
|
110
|
+
/** Who started the product branch (GitHub login). */
|
|
111
|
+
author?: string | undefined;
|
|
112
|
+
/** The piece it answers. */
|
|
113
|
+
piece: string;
|
|
114
|
+
pieceTitle: string;
|
|
115
|
+
/** The closest thing the library has today, so a reviewer can suggest it instead: "danger". */
|
|
116
|
+
nearest?: string | undefined;
|
|
117
|
+
nearestToken?: string | undefined;
|
|
118
|
+
}
|
|
119
|
+
/** "Needed by" for a library branch body: one line people read, one hidden block tools read. */
|
|
120
|
+
export declare function neededBySection(n: NeededBy): string;
|
|
121
|
+
export declare function parseNeededBy(body: string | null | undefined): NeededBy | undefined;
|
|
122
|
+
/** The body with the "Needed by" section first (replacing an earlier one). */
|
|
123
|
+
export declare function withNeededBy(body: string | null | undefined, n: NeededBy): string;
|
|
124
|
+
export interface ProductBranchRef {
|
|
125
|
+
pr: number;
|
|
126
|
+
title: string;
|
|
127
|
+
branch: string;
|
|
128
|
+
url: string;
|
|
129
|
+
productKey: string;
|
|
130
|
+
productName: string;
|
|
131
|
+
author?: string | undefined;
|
|
132
|
+
}
|
|
133
|
+
export type LibraryBranchPlan = {
|
|
134
|
+
kind: 'token-change';
|
|
135
|
+
title: string;
|
|
136
|
+
summary: string;
|
|
137
|
+
edits: TokenEdit[];
|
|
138
|
+
neededBy: NeededBy;
|
|
139
|
+
} | {
|
|
140
|
+
kind: 'exploration';
|
|
141
|
+
title: string;
|
|
142
|
+
exploration: Exploration;
|
|
143
|
+
neededBy: NeededBy;
|
|
144
|
+
brief: string;
|
|
145
|
+
} | {
|
|
146
|
+
kind: 'request';
|
|
147
|
+
title: string;
|
|
148
|
+
request: ComponentChangeRequest;
|
|
149
|
+
neededBy: NeededBy;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* What a piece opens in the library, honestly labelled by what Bridge can write:
|
|
153
|
+
* - a token piece: a token change (the new token, a draft for review, the usual gate);
|
|
154
|
+
* - a variant: a library exploration (a branch and a draft for the component work, with a brief for Claude);
|
|
155
|
+
* - a new component: a component request (an issue): it needs design work before code.
|
|
156
|
+
*/
|
|
157
|
+
export declare function libraryBranchPlan(piece: MissingPiece, branch: ProductBranchRef, opts?: {
|
|
158
|
+
source?: ComponentChangeRequest['source'];
|
|
159
|
+
requestedBy?: string | undefined;
|
|
160
|
+
}): LibraryBranchPlan;
|
|
161
|
+
export type LinkStatusKey = 'draft' | 'in-review' | 'changes' | 'approved' | 'shipped' | 'closed' | 'exploring' | 'requested' | 'in-progress' | 'done' | 'declined';
|
|
162
|
+
export interface LinkStatus {
|
|
163
|
+
key: LinkStatusKey;
|
|
164
|
+
/** "In review", "Shipped". */
|
|
165
|
+
label: string;
|
|
166
|
+
/** Logins asked to review (pull requests), or assignees (requests). */
|
|
167
|
+
people: string[];
|
|
168
|
+
/** "In review · @dana reviews". */
|
|
169
|
+
line: string;
|
|
170
|
+
}
|
|
171
|
+
/** Badge tone of a status: status colours only for status. */
|
|
172
|
+
export declare const LINK_STATUS_TONE: Record<LinkStatusKey, 'neutral' | 'info' | 'warning' | 'success' | 'danger'>;
|
|
173
|
+
/**
|
|
174
|
+
* Where a library branch stands, from what GitHub says: a pull request (state, draft, labels, requested reviewers,
|
|
175
|
+
* latest review per person) or a request issue (state, reason, assignees, whether a pull request implements it).
|
|
176
|
+
*/
|
|
177
|
+
export declare function linkStatus(x: {
|
|
178
|
+
kind: 'token-change' | 'exploration';
|
|
179
|
+
state: string;
|
|
180
|
+
draft: boolean;
|
|
181
|
+
labels?: readonly string[] | undefined;
|
|
182
|
+
requestedReviewers?: readonly string[] | undefined;
|
|
183
|
+
reviews?: readonly {
|
|
184
|
+
user?: string | undefined;
|
|
185
|
+
state: string;
|
|
186
|
+
}[] | undefined;
|
|
187
|
+
} | {
|
|
188
|
+
kind: 'request';
|
|
189
|
+
state: 'open' | 'closed';
|
|
190
|
+
stateReason?: string | null | undefined;
|
|
191
|
+
assignees?: readonly string[] | undefined;
|
|
192
|
+
implemented?: boolean | undefined;
|
|
193
|
+
}): LinkStatus;
|
|
194
|
+
export type LibraryPreviewKey = 'nothing-yet' | 'not-used' | 'preview' | 'outdated' | 'published' | 'switched' | 'declined';
|
|
195
|
+
export interface LibraryPreviewState {
|
|
196
|
+
key: LibraryPreviewKey;
|
|
197
|
+
/** One sentence in designer words. */
|
|
198
|
+
sentence: string;
|
|
199
|
+
/** The one action that moves it on, when there is one. */
|
|
200
|
+
action: {
|
|
201
|
+
kind: 'use-preview' | 'refresh-preview' | 'switch';
|
|
202
|
+
label: string;
|
|
203
|
+
} | null;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* What the product branch shows of a library branch, and what to do next:
|
|
207
|
+
* - while the library branch is open, the product branch carries its commits (Bridge merges the library branch in),
|
|
208
|
+
* so the product preview shows the real library change; new library commits make it outdated;
|
|
209
|
+
* - once the library branch ships, "Switch to the published version" brings main into the product branch: its own
|
|
210
|
+
* diff no longer carries the library change, the shipped one is used;
|
|
211
|
+
* - a request has nothing to preview until someone builds it; a closed library branch says so.
|
|
212
|
+
*
|
|
213
|
+
* `missing` is how many library commits the product branch lacks, `total` how many the library branch has on top of
|
|
214
|
+
* main (null when unknown). `behindMain` is how far the product branch is behind main.
|
|
215
|
+
*/
|
|
216
|
+
export declare function libraryPreviewState(x: {
|
|
217
|
+
kind: LibraryLinkKind;
|
|
218
|
+
lifecycle: 'open' | 'merged' | 'closed';
|
|
219
|
+
/** The library branch changes something beyond its exploration note. */
|
|
220
|
+
hasChanges: boolean;
|
|
221
|
+
missing: number | null;
|
|
222
|
+
total: number | null;
|
|
223
|
+
behindMain: number | null;
|
|
224
|
+
nearest?: string | undefined;
|
|
225
|
+
}): LibraryPreviewState;
|
|
226
|
+
/**
|
|
227
|
+
* The one sentence first on a product branch: "Built with the library. 1 piece was missing, and Claude AI opened a
|
|
228
|
+
* library branch for it." `who` names who opened the library branches when they are all from the same one.
|
|
229
|
+
*/
|
|
230
|
+
export declare function productBranchSentence(r: PiecesRecord | undefined, opts?: {
|
|
231
|
+
agentName?: string | undefined;
|
|
232
|
+
viewer?: string | null | undefined;
|
|
233
|
+
}): {
|
|
234
|
+
lead: string;
|
|
235
|
+
strong: string;
|
|
236
|
+
rest: string;
|
|
237
|
+
};
|
|
238
|
+
/** "Why it exists" on the library review: "Ann needs it for <title> in Admin demo." */
|
|
239
|
+
export declare function whyItExists(n: NeededBy, opts?: {
|
|
240
|
+
names?: Record<string, string>;
|
|
241
|
+
}): {
|
|
242
|
+
who: string;
|
|
243
|
+
title: string;
|
|
244
|
+
product: string;
|
|
245
|
+
};
|
|
246
|
+
/** The reviewer's question when the closest library value looks a lot like the piece. */
|
|
247
|
+
export declare function nearestQuestion(n: NeededBy, opts?: {
|
|
248
|
+
names?: Record<string, string>;
|
|
249
|
+
}): string | null;
|
|
250
|
+
/** The review comment of "Suggest <nearest>": request changes with the library value to use instead. */
|
|
251
|
+
export declare function suggestNearestComment(n: NeededBy): string | null;
|
|
252
|
+
/** A piece id from its kind and names: "badge-overdue-tone". */
|
|
253
|
+
export declare function pieceId(parts: (string | undefined)[]): string;
|
|
254
|
+
/** The word people use for a token: the tone in its path, else its last meaningful segment. */
|
|
255
|
+
export declare function tokenLabel(path: string): string;
|
|
256
|
+
/** A new token beside the closest one, named after the piece: color.feedback.danger.bg + "overdue" -> color.feedback.overdue.bg when the closest has a tone, else a sibling. */
|
|
257
|
+
export declare function proposedTokenPath(nearest: string | undefined, name: string, category: string): string;
|
package/dist/products.d.ts
CHANGED
|
@@ -19,6 +19,15 @@ export declare const DEFAULT_PRODUCTS: ProductConfig[];
|
|
|
19
19
|
/** Pull request labels that pin a branch to a product ("product: admin"). */
|
|
20
20
|
export declare const PRODUCT_LABEL_PREFIX = "product: ";
|
|
21
21
|
export declare const productLabel: (key: string) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Labels and a body line for new work started for a product (a branch, an exploration, a request): the
|
|
24
|
+
* `product: <key>` label and "**Product:** <name>". The default product adds nothing, since productOfBranch lands
|
|
25
|
+
* an unlabeled branch there. Studio, the CLI and the MCP server all write these.
|
|
26
|
+
*/
|
|
27
|
+
export declare function productMarks(products: readonly ProductConfig[], p: ProductConfig): {
|
|
28
|
+
labels: string[];
|
|
29
|
+
line: string;
|
|
30
|
+
};
|
|
22
31
|
/** The configured products, or DEFAULT_PRODUCTS when the config lists none. */
|
|
23
32
|
export declare function productsOf(config: {
|
|
24
33
|
products?: ProductConfig[] | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bc as hexToRgba, aN as comboKey } from "./pr-composer-D2SZm7cg.js";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
const AUDIT_SCHEMA_VERSION = 1;
|
|
4
4
|
const FINDING_CATEGORIES = ["color", "spacing", "size", "radius", "border-width", "shadow", "duration", "easing", "z-index", "font-family", "font-size", "font-weight", "line-height"];
|
|
@@ -1880,31 +1880,31 @@ export {
|
|
|
1880
1880
|
tailwindColor as X,
|
|
1881
1881
|
tailwindFindings as Y,
|
|
1882
1882
|
toOklab as Z,
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1883
|
+
auditFile as a,
|
|
1884
|
+
AUDIT_IGNORE_DIRS as b,
|
|
1885
|
+
AUDIT_SCHEMA_VERSION as c,
|
|
1886
|
+
DesignSystemIndex as d,
|
|
1887
|
+
LOOKALIKE_CLASSES as e,
|
|
1888
|
+
applyAllowlist as f,
|
|
1889
|
+
applyIgnoreComments as g,
|
|
1890
|
+
auditCssText as h,
|
|
1891
|
+
isAuditable as i,
|
|
1892
|
+
auditMarkdown as j,
|
|
1893
|
+
blankComments as k,
|
|
1894
|
+
buildAuditReport as l,
|
|
1895
|
+
classifyModule as m,
|
|
1896
|
+
classifyTag as n,
|
|
1897
|
+
compareWithBaseline as o,
|
|
1898
|
+
cssPropertyOf as p,
|
|
1899
|
+
deltaE as q,
|
|
1900
|
+
domRendererComponent as r,
|
|
1901
|
+
dsEquivalent as s,
|
|
1902
|
+
historyPoint as t,
|
|
1903
|
+
ignoreDirectives as u,
|
|
1904
|
+
importsOf as v,
|
|
1905
1905
|
isColorLiteral as w,
|
|
1906
1906
|
isNonVisual as x,
|
|
1907
1907
|
isRouterLink as y,
|
|
1908
1908
|
isSafeFix as z
|
|
1909
1909
|
};
|
|
1910
|
-
//# sourceMappingURL=report-
|
|
1910
|
+
//# sourceMappingURL=report-DY_peRy4.js.map
|