@bridge-ds/core 0.9.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.
Files changed (35) hide show
  1. package/README.md +27 -1
  2. package/bridge.config.schema.json +23 -0
  3. package/dist/audit/index.js +3 -3
  4. package/dist/config.d.ts +28 -0
  5. package/dist/docs-proposal.d.ts +58 -10
  6. package/dist/figma-push-github.d.ts +143 -0
  7. package/dist/figma-push.d.ts +204 -0
  8. package/dist/github-client.d.ts +6 -1
  9. package/dist/index.d.ts +6 -0
  10. package/dist/index.js +998 -2861
  11. package/dist/index.js.map +1 -1
  12. package/dist/node/git-local.d.ts +15 -0
  13. package/dist/node/index.d.ts +1 -0
  14. package/dist/node/index.js +201 -10
  15. package/dist/node/index.js.map +1 -1
  16. package/dist/node/suggestion-apply-node.d.ts +69 -0
  17. package/dist/{pr-composer-D2SZm7cg.js → prod-branch-BdMPKffE.js} +491 -173
  18. package/dist/prod-branch-BdMPKffE.js.map +1 -0
  19. package/dist/prod-branch-github.d.ts +28 -7
  20. package/dist/prod-branch.d.ts +17 -7
  21. package/dist/{report-DY_peRy4.js → report-DOnKUw8G.js} +2 -2
  22. package/dist/{report-DY_peRy4.js.map → report-DOnKUw8G.js.map} +1 -1
  23. package/dist/suggestion-apply-ByBEYtct.js +4802 -0
  24. package/dist/suggestion-apply-ByBEYtct.js.map +1 -0
  25. package/dist/suggestion-apply.d.ts +150 -0
  26. package/dist/suggestion-review.d.ts +70 -0
  27. package/dist/suggestions-github.d.ts +131 -0
  28. package/dist/suggestions.d.ts +236 -0
  29. package/dist/token-proposal.d.ts +51 -0
  30. package/package.json +1 -1
  31. package/dist/component-spec-BzfBkYRD.js +0 -1122
  32. package/dist/component-spec-BzfBkYRD.js.map +0 -1
  33. package/dist/pr-composer-D2SZm7cg.js.map +0 -1
  34. package/dist/prod-branch-D5Tl87Wf.js +0 -266
  35. package/dist/prod-branch-D5Tl87Wf.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import type { ChangesMode } from './config';
1
2
  import { type ExplorationSettings } from './explorations-github';
2
3
  import { type GitHubClient, type PullRequestSummary } from './github-client';
3
4
  import { type ProductConfig } from './products';
@@ -63,15 +64,15 @@ export interface OpenLibraryBranchInput {
63
64
  exploration: Pick<ExplorationSettings, 'packages' | 'apps'>;
64
65
  /**
65
66
  * Opens the token change of a token piece (planTokenProposal + writeTokenProposalOnGitHub where the caller has the
66
- * token files and contrast pairs). Without it a token piece is refused.
67
+ * token files and contrast pairs). Without it a token piece is refused. In suggest mode (`ctx.mode`), it files a
68
+ * suggestion instead (suggestTokenProposalOnGitHub with `neededBy: plan.neededBy`) and returns its result: a result
69
+ * with `status: 'suggested'` is linked as a suggestion, anything else as a token change pull request.
67
70
  */
68
71
  writeTokens?: ((plan: Extract<LibraryBranchPlan, {
69
72
  kind: 'token-change';
70
- }>) => Promise<{
71
- number: number;
72
- url: string;
73
- branch: string;
74
- }>) | undefined;
73
+ }>, ctx: {
74
+ mode: ChangesMode;
75
+ }) => Promise<LibraryTokenWrite>) | undefined;
75
76
  /** Who opens it, and the AI agent behind it ("claude"). */
76
77
  openedBy?: string | undefined;
77
78
  agent?: string | undefined;
@@ -79,9 +80,27 @@ export interface OpenLibraryBranchInput {
79
80
  /** Merge the new library branch into the product branch when it already changes something (default true). */
80
81
  usePreview?: boolean | undefined;
81
82
  dryRun?: boolean | undefined;
83
+ /**
84
+ * "direct" (default here, so existing callers keep their behaviour): a token piece opens a pull request, a variant
85
+ * an exploration branch. "suggest": a token piece is filed as a suggestion and a variant as a component request, so
86
+ * the token only needs Issues write. Callers pass changesMode(config), or an explicit choice.
87
+ */
88
+ mode?: ChangesMode | undefined;
82
89
  }
90
+ /** What writeTokens returns: the pull request it opened, or the suggestion it filed. */
91
+ export type LibraryTokenWrite = {
92
+ number: number;
93
+ url: string;
94
+ branch: string;
95
+ status?: undefined;
96
+ } | {
97
+ status: 'suggested';
98
+ number: number;
99
+ url: string;
100
+ };
83
101
  export interface OpenedLibraryBranch {
84
- status: 'opened' | 'already-linked' | 'dry-run';
102
+ /** "suggested": the library side is a suggestion (`link.kind` 'suggestion', `link.number` its issue). */
103
+ status: 'opened' | 'suggested' | 'already-linked' | 'dry-run';
85
104
  plan: LibraryBranchPlan;
86
105
  link: LibraryLink | null;
87
106
  preview: PreviewMerge | null;
@@ -94,6 +113,8 @@ export declare function productBranchRef(pull: Pick<Pull, 'number' | 'title' | '
94
113
  * product branch and carries the `needed-by-product` label; the product branch records the link. A token piece opens a
95
114
  * token change (through `writeTokens`), a variant a library exploration, a new component a request. When the new
96
115
  * library branch already changes something (a token change), the product branch takes its preview.
116
+ * In suggest mode nothing is a branch: a token piece is a suggestion (through `writeTokens`), a variant and a new
117
+ * component are requests; recording the link on the product branch is best effort (a warning when refused).
97
118
  */
98
119
  export declare function openLibraryBranchOnGitHub(gh: GitHubClient, input: OpenLibraryBranchInput): Promise<OpenedLibraryBranch>;
99
120
  export interface LinkedLibraryBranch {
@@ -1,5 +1,7 @@
1
1
  import type { Exploration } from './explorations';
2
+ import type { ChangesMode } from './config';
2
3
  import type { ComponentChangeRequest } from './requests';
4
+ import type { SuggestionStatus } from './suggestions';
3
5
  import type { TokenEdit } from './token-edits';
4
6
  /** What the library lacks: a token value, a variant of an existing component, or a component. */
5
7
  export type PieceKind = 'token' | 'variant' | 'component';
@@ -52,13 +54,13 @@ export interface MissingPiece {
52
54
  files: string[];
53
55
  } | undefined;
54
56
  }
55
- /** Where the library side of a piece lives. */
56
- export type LibraryLinkKind = 'token-change' | 'exploration' | 'request';
57
+ /** Where the library side of a piece lives. A suggestion is an issue holding the exact token change (suggestions.ts). */
58
+ export type LibraryLinkKind = 'token-change' | 'exploration' | 'request' | 'suggestion';
57
59
  export interface LibraryLink {
58
60
  /** The piece id. */
59
61
  piece: string;
60
62
  kind: LibraryLinkKind;
61
- /** Pull request number (token change, exploration) or issue number (request). */
63
+ /** Pull request number (token change, exploration) or issue number (request, suggestion). */
62
64
  number: number;
63
65
  url: string;
64
66
  title: string;
@@ -150,15 +152,18 @@ export type LibraryBranchPlan = {
150
152
  };
151
153
  /**
152
154
  * 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 token piece: a token change (the new token, a draft for review, the usual gate); in suggest mode the same
156
+ * change is filed as a suggestion;
157
+ * - a variant: a library exploration (a branch and a draft for the component work, with a brief for Claude); in
158
+ * suggest mode a component request, since an exploration is a branch;
155
159
  * - a new component: a component request (an issue): it needs design work before code.
156
160
  */
157
161
  export declare function libraryBranchPlan(piece: MissingPiece, branch: ProductBranchRef, opts?: {
158
162
  source?: ComponentChangeRequest['source'];
159
163
  requestedBy?: string | undefined;
164
+ mode?: ChangesMode | undefined;
160
165
  }): LibraryBranchPlan;
161
- export type LinkStatusKey = 'draft' | 'in-review' | 'changes' | 'approved' | 'shipped' | 'closed' | 'exploring' | 'requested' | 'in-progress' | 'done' | 'declined';
166
+ export type LinkStatusKey = 'draft' | 'in-review' | 'changes' | 'approved' | 'shipped' | 'closed' | 'exploring' | 'requested' | 'in-progress' | 'done' | 'declined' | 'outdated';
162
167
  export interface LinkStatus {
163
168
  key: LinkStatusKey;
164
169
  /** "In review", "Shipped". */
@@ -172,7 +177,8 @@ export interface LinkStatus {
172
177
  export declare const LINK_STATUS_TONE: Record<LinkStatusKey, 'neutral' | 'info' | 'warning' | 'success' | 'danger'>;
173
178
  /**
174
179
  * 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).
180
+ * latest review per person), a request issue (state, reason, assignees, whether a pull request implements it) or a
181
+ * suggestion (its status, suggestionStatus in suggestions.ts, and who it is assigned to).
176
182
  */
177
183
  export declare function linkStatus(x: {
178
184
  kind: 'token-change' | 'exploration';
@@ -190,6 +196,10 @@ export declare function linkStatus(x: {
190
196
  stateReason?: string | null | undefined;
191
197
  assignees?: readonly string[] | undefined;
192
198
  implemented?: boolean | undefined;
199
+ } | {
200
+ kind: 'suggestion';
201
+ status: SuggestionStatus;
202
+ assignees?: readonly string[] | undefined;
193
203
  }): LinkStatus;
194
204
  export type LibraryPreviewKey = 'nothing-yet' | 'not-used' | 'preview' | 'outdated' | 'published' | 'switched' | 'declined';
195
205
  export interface LibraryPreviewState {
@@ -1,4 +1,4 @@
1
- import { bc as hexToRgba, aN as comboKey } from "./pr-composer-D2SZm7cg.js";
1
+ import { bn as hexToRgba, aW as comboKey } from "./prod-branch-BdMPKffE.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"];
@@ -1907,4 +1907,4 @@ export {
1907
1907
  isRouterLink as y,
1908
1908
  isSafeFix as z
1909
1909
  };
1910
- //# sourceMappingURL=report-DY_peRy4.js.map
1910
+ //# sourceMappingURL=report-DOnKUw8G.js.map