@bridge-ds/core 0.8.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.
@@ -0,0 +1,72 @@
1
+ import type { BridgeConfig } from './config';
2
+ import type { GitHubClient } from './github-client';
3
+ import { LayeredTokenSet, type LayerIssue } from './layered';
4
+ import { type ChangeTier, type ContrastDelta, type ImpactEntry, type LayeredChange } from './layered-review';
5
+ import { type TokenEdit } from './token-edits';
6
+ import type { ContrastPair } from './wcag';
7
+ export interface TokenProposalPlan {
8
+ title: string;
9
+ summary: string;
10
+ before: LayeredTokenSet;
11
+ after: LayeredTokenSet;
12
+ changes: LayeredChange[];
13
+ tier: ChangeTier;
14
+ contrast: ContrastDelta[];
15
+ newFailures: ContrastDelta[];
16
+ newErrors: LayerIssue[];
17
+ impact: {
18
+ total: number;
19
+ entries: ImpactEntry[];
20
+ };
21
+ notes: string[];
22
+ /** Token files edited, as repo paths. */
23
+ touched: string[];
24
+ /** Every file the commit writes: the token files and the changeset. */
25
+ files: {
26
+ path: string;
27
+ content: string | null;
28
+ }[];
29
+ body: string;
30
+ /** Branch slug from the title. */
31
+ slug: string;
32
+ /** Why it cannot be opened (new validation errors, failing contrast pairs), or null. */
33
+ blocked: string | null;
34
+ }
35
+ /**
36
+ * What a token change would do, without writing: the token diff, validation and contrast against `before`, the tier,
37
+ * the body and the files. `blocked` says why it must not be opened. Null when the edits change nothing.
38
+ */
39
+ export declare function planTokenProposal(input: {
40
+ before: LayeredTokenSet;
41
+ pairs: ContrastPair[];
42
+ edits: TokenEdit[];
43
+ title: string;
44
+ summary?: string | undefined;
45
+ config: BridgeConfig;
46
+ /** "Bridge MCP", "Bridge Studio". */
47
+ tool?: string | undefined;
48
+ /** More body paragraphs, after the generated body (the product line, "Needed by"). */
49
+ bodyExtra?: string[] | undefined;
50
+ }): TokenProposalPlan | null;
51
+ export interface OpenedTokenProposal {
52
+ branch: string;
53
+ commit: string;
54
+ pr: number;
55
+ url: string;
56
+ labels: string[];
57
+ draft: boolean;
58
+ }
59
+ /**
60
+ * Opens a planned token change on GitHub: a new branch from `base` (the agent prefix, the Jira key, -2, -3 when the name
61
+ * is taken), one commit, a pull request (a draft from tier 2, until design review) and its labels. Refuses a blocked plan.
62
+ */
63
+ export declare function writeTokenProposalOnGitHub(gh: GitHubClient, plan: TokenProposalPlan, opts: {
64
+ base: string;
65
+ branchPrefix: string;
66
+ jira?: string | null | undefined;
67
+ /** Labels before the tier ones (governance.labels), and after them (the product label). */
68
+ labels?: string[] | undefined;
69
+ labelsAfter?: string[] | undefined;
70
+ /** Who proposes it, in the commit message: "Bridge MCP (source: mcp)". */
71
+ tool?: string | undefined;
72
+ }): Promise<OpenedTokenProposal>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridge-ds/core",
3
- "version": "0.8.0",
3
+ "version": "0.9.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",