@bridge-ds/core 0.8.0 → 0.10.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/README.md +27 -1
- package/bridge.config.schema.json +23 -0
- 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/config.d.ts +28 -0
- package/dist/docs-proposal.d.ts +58 -10
- package/dist/figma-push-github.d.ts +143 -0
- package/dist/figma-push.d.ts +204 -0
- package/dist/github-client.d.ts +15 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1569 -3179
- package/dist/index.js.map +1 -1
- package/dist/node/git-local.d.ts +15 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +201 -10
- package/dist/node/index.js.map +1 -1
- package/dist/node/suggestion-apply-node.d.ts +69 -0
- package/dist/{component-spec-SKuywZqr.js → prod-branch-BdMPKffE.js} +1134 -1438
- package/dist/prod-branch-BdMPKffE.js.map +1 -0
- package/dist/prod-branch-github.d.ts +160 -0
- package/dist/prod-branch.d.ts +267 -0
- package/dist/{report-iPSnsjYi.js → report-DOnKUw8G.js} +24 -24
- package/dist/{report-iPSnsjYi.js.map → report-DOnKUw8G.js.map} +1 -1
- package/dist/suggestion-apply-ByBEYtct.js +4802 -0
- package/dist/suggestion-apply-ByBEYtct.js.map +1 -0
- package/dist/suggestion-apply.d.ts +150 -0
- package/dist/suggestion-review.d.ts +70 -0
- package/dist/suggestions-github.d.ts +131 -0
- package/dist/suggestions.d.ts +236 -0
- package/dist/token-proposal.d.ts +123 -0
- package/package.json +1 -1
- package/dist/component-spec-SKuywZqr.js.map +0 -1
- package/dist/layered-BnbmToGs.js +0 -500
- package/dist/layered-BnbmToGs.js.map +0 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { BridgeConfig } from './config';
|
|
2
|
+
import type { GitHubClient } from './github-client';
|
|
3
|
+
import type { NeededBy } from './prod-branch';
|
|
4
|
+
import type { RequestSource } from './requests';
|
|
5
|
+
import { type SuggestionPayloadV1 } from './suggestions';
|
|
6
|
+
import { LayeredTokenSet, type LayerIssue } from './layered';
|
|
7
|
+
import { type ChangeTier, type ContrastDelta, type ImpactEntry, type LayeredChange } from './layered-review';
|
|
8
|
+
import { type TokenEdit } from './token-edits';
|
|
9
|
+
import type { ContrastPair } from './wcag';
|
|
10
|
+
export interface TokenProposalPlan {
|
|
11
|
+
title: string;
|
|
12
|
+
summary: string;
|
|
13
|
+
/** The token edits the plan applied: what a suggestion stores and re-applies on the current tokens. */
|
|
14
|
+
edits: TokenEdit[];
|
|
15
|
+
before: LayeredTokenSet;
|
|
16
|
+
after: LayeredTokenSet;
|
|
17
|
+
changes: LayeredChange[];
|
|
18
|
+
tier: ChangeTier;
|
|
19
|
+
contrast: ContrastDelta[];
|
|
20
|
+
newFailures: ContrastDelta[];
|
|
21
|
+
newErrors: LayerIssue[];
|
|
22
|
+
impact: {
|
|
23
|
+
total: number;
|
|
24
|
+
entries: ImpactEntry[];
|
|
25
|
+
};
|
|
26
|
+
notes: string[];
|
|
27
|
+
/** Token files edited, as repo paths. */
|
|
28
|
+
touched: string[];
|
|
29
|
+
/** Every file the commit writes: the token files and the changeset. */
|
|
30
|
+
files: {
|
|
31
|
+
path: string;
|
|
32
|
+
content: string | null;
|
|
33
|
+
}[];
|
|
34
|
+
body: string;
|
|
35
|
+
/** Branch slug from the title. */
|
|
36
|
+
slug: string;
|
|
37
|
+
/** Why it cannot be opened (new validation errors, failing contrast pairs), or null. */
|
|
38
|
+
blocked: string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* What a token change would do, without writing: the token diff, validation and contrast against `before`, the tier,
|
|
42
|
+
* the body and the files. `blocked` says why it must not be opened. Null when the edits change nothing.
|
|
43
|
+
*/
|
|
44
|
+
export declare function planTokenProposal(input: {
|
|
45
|
+
before: LayeredTokenSet;
|
|
46
|
+
pairs: ContrastPair[];
|
|
47
|
+
edits: TokenEdit[];
|
|
48
|
+
title: string;
|
|
49
|
+
summary?: string | undefined;
|
|
50
|
+
config: BridgeConfig;
|
|
51
|
+
/** "Bridge MCP", "Bridge Studio". */
|
|
52
|
+
tool?: string | undefined;
|
|
53
|
+
/** More body paragraphs, after the generated body (the product line, "Needed by"). */
|
|
54
|
+
bodyExtra?: string[] | undefined;
|
|
55
|
+
}): TokenProposalPlan | null;
|
|
56
|
+
export interface OpenedTokenProposal {
|
|
57
|
+
branch: string;
|
|
58
|
+
commit: string;
|
|
59
|
+
pr: number;
|
|
60
|
+
url: string;
|
|
61
|
+
labels: string[];
|
|
62
|
+
draft: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Opens a planned token change on GitHub: a new branch from `base` (the agent prefix, the Jira key, -2, -3 when the name
|
|
66
|
+
* is taken), one commit, a pull request (a draft from tier 2, until design review) and its labels. Refuses a blocked plan.
|
|
67
|
+
*/
|
|
68
|
+
export declare function writeTokenProposalOnGitHub(gh: GitHubClient, plan: TokenProposalPlan, opts: {
|
|
69
|
+
base: string;
|
|
70
|
+
branchPrefix: string;
|
|
71
|
+
jira?: string | null | undefined;
|
|
72
|
+
/** Labels before the tier ones (governance.labels), and after them (the product label). */
|
|
73
|
+
labels?: string[] | undefined;
|
|
74
|
+
labelsAfter?: string[] | undefined;
|
|
75
|
+
/** Who proposes it, in the commit message: "Bridge MCP (source: mcp)". */
|
|
76
|
+
tool?: string | undefined;
|
|
77
|
+
}): Promise<OpenedTokenProposal>;
|
|
78
|
+
export interface SuggestedTokenProposal {
|
|
79
|
+
status: 'suggested';
|
|
80
|
+
/** The suggestion issue. */
|
|
81
|
+
number: number;
|
|
82
|
+
url: string;
|
|
83
|
+
/** sha256 of the payload: what approvals bind to. */
|
|
84
|
+
sha: string;
|
|
85
|
+
labels: string[];
|
|
86
|
+
/** Sentences about parts that did not go through (labels refused). The suggestion itself holds. */
|
|
87
|
+
warnings: string[];
|
|
88
|
+
}
|
|
89
|
+
/** The suggestion payload (bridge.suggestion/1) of a planned token change, computed on `base`. Pure. */
|
|
90
|
+
export declare function tokenSuggestionPayload(plan: TokenProposalPlan, ctx: {
|
|
91
|
+
base: {
|
|
92
|
+
ref: string;
|
|
93
|
+
sha: string;
|
|
94
|
+
};
|
|
95
|
+
source: RequestSource;
|
|
96
|
+
suggestedBy?: string | undefined;
|
|
97
|
+
createdAt?: string | undefined;
|
|
98
|
+
links?: SuggestionPayloadV1['links'];
|
|
99
|
+
previews?: SuggestionPayloadV1['previews'];
|
|
100
|
+
}): SuggestionPayloadV1;
|
|
101
|
+
/**
|
|
102
|
+
* Files a planned token change as a suggestion (suggest mode): one issue with the readable change, the checks and the
|
|
103
|
+
* exact edits, labelled like the pull request would be (tier, tokens, breaking), plus the suggestion labels. Needs
|
|
104
|
+
* Issues write only: no branch, no commit, no pull request. Refuses a blocked plan, like writeTokenProposalOnGitHub.
|
|
105
|
+
*/
|
|
106
|
+
export declare function suggestTokenProposalOnGitHub(gh: GitHubClient, plan: TokenProposalPlan, opts: {
|
|
107
|
+
/** Default branch the plan was computed on. Its head commit is recorded as the suggestion's base. */
|
|
108
|
+
base: string;
|
|
109
|
+
source: RequestSource;
|
|
110
|
+
/** GitHub login of who suggests it. */
|
|
111
|
+
suggestedBy?: string | undefined;
|
|
112
|
+
/** Labels before the tier ones (governance.labels), and after them (the product label). */
|
|
113
|
+
labels?: string[] | undefined;
|
|
114
|
+
labelsAfter?: string[] | undefined;
|
|
115
|
+
/** The product branch that needs it (a missing piece). */
|
|
116
|
+
neededBy?: NeededBy | undefined;
|
|
117
|
+
/** The Figma origin, a suggestion it replaces. */
|
|
118
|
+
links?: SuggestionPayloadV1['links'];
|
|
119
|
+
previews?: SuggestionPayloadV1['previews'];
|
|
120
|
+
assignees?: string[] | undefined;
|
|
121
|
+
/** Commit sha of `base`, when the caller already read it (saves a call). */
|
|
122
|
+
baseSha?: string | undefined;
|
|
123
|
+
}): Promise<SuggestedTokenProposal>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridge-ds/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Bridge core: bridge.config.json, DTCG token loading (tiers and layered modes), alias resolution, WCAG contrast, diffs, minimal-diff edits, PR body, the shared risk tier classifier, changesets and a fetch-based GitHub client. No Figma API, no DOM; Node-only helpers (git, reading a product folder) under @bridge-ds/core/node; the adoption audit under @bridge-ds/core/audit.",
|
|
6
6
|
"license": "MIT",
|