@bridge-ds/core 0.19.0 → 0.21.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/LICENSE +17 -0
- package/bridge.config.schema.json +5 -0
- package/dist/audit/index.js +275 -52
- package/dist/audit/index.js.map +1 -1
- package/dist/audit/missing-pieces.d.ts +4 -0
- package/dist/component-spec.d.ts +13 -0
- package/dist/config.d.ts +5 -0
- package/dist/exploration-done-github.d.ts +50 -0
- package/dist/exploration-resume.d.ts +136 -0
- package/dist/explorations-github.d.ts +75 -3
- package/dist/explorations.d.ts +137 -8
- package/dist/fidelity.d.ts +12 -1
- package/dist/figma-fix-loop.d.ts +1 -1
- package/dist/figma-fix-run.d.ts +103 -0
- package/dist/figma-fixes.d.ts +14 -2
- package/dist/gap-case.d.ts +1 -2
- package/dist/github-client.d.ts +17 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2139 -1290
- package/dist/index.js.map +1 -1
- package/dist/measure-location.d.ts +42 -0
- package/dist/measure-workflow.d.ts +48 -0
- package/dist/measured-only.d.ts +15 -1
- package/dist/node/index.js +15 -12
- package/dist/node/index.js.map +1 -1
- package/dist/previews-github.d.ts +13 -0
- package/dist/previews.d.ts +8 -1
- package/dist/{prod-branch-Bdx_2bRQ.js → prod-branch-C7tphFAA.js} +257 -192
- package/dist/prod-branch-C7tphFAA.js.map +1 -0
- package/dist/prod-branch-github.d.ts +54 -4
- package/dist/prod-branch.d.ts +42 -1
- package/dist/products.d.ts +17 -0
- package/dist/repo-model.d.ts +2 -0
- package/dist/{repo-source-m0Tc603o.js → repo-source-CEBBBtm1.js} +2183 -1937
- package/dist/repo-source-CEBBBtm1.js.map +1 -0
- package/dist/{report-DFPKygfk.js → report-B7wNAnSu.js} +38 -38
- package/dist/{report-DFPKygfk.js.map → report-B7wNAnSu.js.map} +1 -1
- package/dist/review-gate.d.ts +7 -1
- package/dist/suggestion-review.d.ts +43 -2
- package/dist/suggestions-github.d.ts +12 -1
- package/dist/tier1-publish.d.ts +48 -0
- package/dist/try-in-product.d.ts +4 -1
- package/package.json +1 -1
- package/dist/prod-branch-Bdx_2bRQ.js.map +0 -1
- package/dist/repo-source-m0Tc603o.js.map +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type BridgeConfig } from './config';
|
|
2
|
+
import { type FixAttempt, type FixVerdict, type GapCaseForInput, type TriedVariant } from './figma-fix-loop';
|
|
3
|
+
import type { FigmaFix } from './figma-fixes';
|
|
4
|
+
import type { GapCase } from './gap-case';
|
|
5
|
+
/** Where `bridge specs --measure` writes, from the repo root. */
|
|
6
|
+
export declare const DEFAULT_MEASURED_SPECS_FILE = "measured-specs.json";
|
|
7
|
+
/** The label every figma-fixes.json change carries, next to drafted-by-claude. */
|
|
8
|
+
export declare const FIGMA_FIXES_LABEL = "figma-fixes";
|
|
9
|
+
/** Asks Claude one prompt, returns the reply text. Runners pass the team's key; tests pass a fake. */
|
|
10
|
+
export type FixAsk = (prompt: string) => Promise<string>;
|
|
11
|
+
/** Where a loop stands between rounds: plain JSON, so a server can keep it between requests. */
|
|
12
|
+
export interface FixLoopState {
|
|
13
|
+
component: string;
|
|
14
|
+
/** Rounds done. */
|
|
15
|
+
round: number;
|
|
16
|
+
attempts: FixAttempt[];
|
|
17
|
+
/** The closest fixes so far (verdict closer), with their score and the referee's summary. */
|
|
18
|
+
best?: {
|
|
19
|
+
fixes: unknown[];
|
|
20
|
+
score: number;
|
|
21
|
+
summary: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
/** No round left, or every difference resolved. */
|
|
24
|
+
done: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface FixLoopRound {
|
|
27
|
+
round: number;
|
|
28
|
+
fixes: unknown[];
|
|
29
|
+
/** invalid: the fixes broke the schema; undefined: no fixes could be read from the reply. */
|
|
30
|
+
verdict?: FixVerdict | 'invalid' | undefined;
|
|
31
|
+
summary: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const startFixLoop: (component: string) => FixLoopState;
|
|
34
|
+
/**
|
|
35
|
+
* One round: Claude proposes fixes from the gap case and what the earlier rounds gave, the values referee tries them,
|
|
36
|
+
* and the state keeps the closest. `ask` may throw (the network, the key): the state is then unchanged.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fixLoopRound(input: GapCaseForInput, state: FixLoopState, ask: FixAsk, gap?: GapCase): Promise<{
|
|
39
|
+
state: FixLoopState;
|
|
40
|
+
round: FixLoopRound;
|
|
41
|
+
}>;
|
|
42
|
+
/** What the loop proposes once done: the closest fixes, or a status fix (Differs, with the reason) when none came closer. */
|
|
43
|
+
export declare function fixLoopOutcome(gap: GapCase, state: FixLoopState, existingIds?: string[]): {
|
|
44
|
+
kind: 'fixes' | 'status';
|
|
45
|
+
fixes: unknown[];
|
|
46
|
+
summary: string;
|
|
47
|
+
};
|
|
48
|
+
/** The branch a component's fixes go on (a number is added when it is taken): bridge/figma-fixes-text-input. */
|
|
49
|
+
export declare const figmaFixesBranchStem: (config: BridgeConfig, component: string) => string;
|
|
50
|
+
export interface FigmaFixesProposalInput extends GapCaseForInput {
|
|
51
|
+
/** The fixes to propose (fix objects; the repo's fixes with the same ids are replaced). */
|
|
52
|
+
proposed: unknown[];
|
|
53
|
+
/** One or two sentences a reviewer reads first. */
|
|
54
|
+
summary: string;
|
|
55
|
+
config: BridgeConfig;
|
|
56
|
+
/** figma-fixes.json path in the repo. */
|
|
57
|
+
fixesPath: string;
|
|
58
|
+
/** Who drafted it, for the body and the commit: "Bridge MCP (source: mcp)". */
|
|
59
|
+
tool: string;
|
|
60
|
+
/** The `source:` label: mcp, cli, studio. */
|
|
61
|
+
source: string;
|
|
62
|
+
}
|
|
63
|
+
export interface FigmaFixesReport {
|
|
64
|
+
component: string;
|
|
65
|
+
verdict: FixVerdict;
|
|
66
|
+
summary: string;
|
|
67
|
+
variants: TriedVariant[];
|
|
68
|
+
fixes: string[];
|
|
69
|
+
tier: number;
|
|
70
|
+
prTitle: string;
|
|
71
|
+
}
|
|
72
|
+
export type FigmaFixesProposal = {
|
|
73
|
+
status: 'blocked';
|
|
74
|
+
verdict: FixVerdict;
|
|
75
|
+
why: string;
|
|
76
|
+
detail: string;
|
|
77
|
+
component: string;
|
|
78
|
+
} | {
|
|
79
|
+
status: 'ready';
|
|
80
|
+
report: FigmaFixesReport;
|
|
81
|
+
/** The accepted fixes as validated. */
|
|
82
|
+
fixes: FigmaFix[];
|
|
83
|
+
labels: string[];
|
|
84
|
+
prBody: string;
|
|
85
|
+
fileContents: {
|
|
86
|
+
path: string;
|
|
87
|
+
content: string;
|
|
88
|
+
}[];
|
|
89
|
+
title: string;
|
|
90
|
+
message: string;
|
|
91
|
+
/** Tier 2 and above open as a draft. */
|
|
92
|
+
draft: boolean;
|
|
93
|
+
/** The default branch it targets. */
|
|
94
|
+
base: string;
|
|
95
|
+
branchStem: string;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The change for review of proposed fixes. The values referee runs again first: a fix that moves the component further
|
|
99
|
+
* from the code is refused, and part or story fixes that move nothing are refused (propose a status fix), unless they
|
|
100
|
+
* size, place or lay out a part: the values referee can't judge layout, Check fidelity decides. Throws a sentence when
|
|
101
|
+
* the fixes are invalid or the summary is not one.
|
|
102
|
+
*/
|
|
103
|
+
export declare function figmaFixesProposal(input: FigmaFixesProposalInput): FigmaFixesProposal;
|
package/dist/figma-fixes.d.ts
CHANGED
|
@@ -134,8 +134,12 @@ export interface AppliedFix {
|
|
|
134
134
|
id: string;
|
|
135
135
|
kind: FigmaFix['kind'];
|
|
136
136
|
component: string;
|
|
137
|
-
/**
|
|
138
|
-
|
|
137
|
+
/**
|
|
138
|
+
* applied: it changed what the pull draws. not-found: nothing matched (the code or the measure moved: re-check it).
|
|
139
|
+
* skipped: it matched, but the measure has no size of the part's own to pin there (the detail says why). already:
|
|
140
|
+
* the input had it.
|
|
141
|
+
*/
|
|
142
|
+
result: 'applied' | 'not-found' | 'skipped' | 'already';
|
|
139
143
|
/** Story entries it changed. */
|
|
140
144
|
stories: number;
|
|
141
145
|
/** Plain words: what it did, or what it did not find. */
|
|
@@ -152,6 +156,14 @@ export type FixedMeasuredSpecsFile = Omit<MeasuredSpecsFile, 'stories' | 'compon
|
|
|
152
156
|
};
|
|
153
157
|
/** A story is one of `where`'s variants: every arg it names, at that value, and the state. */
|
|
154
158
|
export declare function storyMatchesWhere(s: MeasuredSpecsStory, where: FixWhere | undefined): boolean;
|
|
159
|
+
/** Why a `fixed` size was not laid on one part of one story: the measure has no size of the part's own there. */
|
|
160
|
+
export interface SkippedSize {
|
|
161
|
+
part: string;
|
|
162
|
+
side: 'width' | 'height';
|
|
163
|
+
why: 'words' | 'fills' | 'unmeasured';
|
|
164
|
+
/** The measured px it did not pin (words, fills). */
|
|
165
|
+
measured?: number | undefined;
|
|
166
|
+
}
|
|
155
167
|
/**
|
|
156
168
|
* The measured specs the pull reads, with the fixes laid on, and one provenance record per fix. Pure: the input is not
|
|
157
169
|
* changed. Fixes run in file order; a fix whose component, part or story is not in this measure is reported
|
package/dist/gap-case.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentSpec, type SpecField, type SpecPart, type SpecValue, type SpecVariant } from './component-spec';
|
|
2
|
-
import type
|
|
2
|
+
import { type FidelityComponentResult, type Size } from './fidelity';
|
|
3
3
|
import { type MeasuredBox, type MeasuredSpec, type MeasuredSpecsFile, type MeasuredSpecsStory, type MeasuredState } from './measured-spec';
|
|
4
4
|
export declare const GAP_CASE_VERSION = 1;
|
|
5
5
|
/** How a story reaches a variant: at rest, a forced pseudo state, or disabled (an arg). */
|
|
@@ -114,7 +114,6 @@ export declare function storyState(s: Pick<MeasuredSpecsStory, 'state' | 'props'
|
|
|
114
114
|
export declare function storyForVariant(spec: Pick<ComponentSpec, 'axes'>, props: Record<string, string>, stories: MeasuredSpecsStory[], shot?: {
|
|
115
115
|
file: string;
|
|
116
116
|
}): MeasuredSpecsStory | undefined;
|
|
117
|
-
/** A part in words: the measure's ids are class names ("cds--toggle__switch" -> "toggle switch"). */
|
|
118
117
|
export declare function partWords(part: Pick<SpecPart, 'id' | 'name'> | undefined, id?: string): string;
|
|
119
118
|
/** Token path -> value, from the measure: components[].resolved, then the token harvest (by CSS name). */
|
|
120
119
|
export declare function measuredResolver(file: Pick<MeasuredSpecsFile, 'components' | 'tokens'>): (path: string) => string | number | undefined;
|
package/dist/github-client.d.ts
CHANGED
|
@@ -638,6 +638,23 @@ export declare class GitHubClient {
|
|
|
638
638
|
autoMerge: boolean;
|
|
639
639
|
}>;
|
|
640
640
|
listPullRequestFiles(n: number): Promise<PullRequestFile[]>;
|
|
641
|
+
/** The commits of a pull request, oldest first, as GitHub lists them (one read, up to 100). */
|
|
642
|
+
listPullRequestCommits(n: number): Promise<{
|
|
643
|
+
sha: string;
|
|
644
|
+
commit: {
|
|
645
|
+
message: string;
|
|
646
|
+
author?: {
|
|
647
|
+
name?: string | null;
|
|
648
|
+
date?: string | null;
|
|
649
|
+
} | null;
|
|
650
|
+
committer?: {
|
|
651
|
+
date?: string | null;
|
|
652
|
+
} | null;
|
|
653
|
+
};
|
|
654
|
+
author?: {
|
|
655
|
+
login?: string | null;
|
|
656
|
+
} | null;
|
|
657
|
+
}[]>;
|
|
641
658
|
updatePullRequest(n: number, patch: {
|
|
642
659
|
title?: string;
|
|
643
660
|
body?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export * from './change-drafts';
|
|
|
41
41
|
export * from './draft-exchange';
|
|
42
42
|
export * from './explorations';
|
|
43
43
|
export * from './explorations-github';
|
|
44
|
+
export * from './exploration-done-github';
|
|
45
|
+
export * from './exploration-resume';
|
|
44
46
|
export * from './requests-github';
|
|
45
47
|
export * from './component-spec';
|
|
46
48
|
export * from './measured-spec';
|
|
@@ -53,7 +55,11 @@ export * from './figma-fixes';
|
|
|
53
55
|
export * from './measured-only';
|
|
54
56
|
export * from './css-color';
|
|
55
57
|
export * from './figma-fix-loop';
|
|
58
|
+
export * from './figma-fix-run';
|
|
59
|
+
export * from './measure-location';
|
|
60
|
+
export * from './measure-workflow';
|
|
56
61
|
export * from './review-gate';
|
|
62
|
+
export * from './tier1-publish';
|
|
57
63
|
export * from './library-update';
|
|
58
64
|
export * from './branch-actions';
|
|
59
65
|
export * from './jira';
|